<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Hi again All,</div><div><br></div><div>&nbsp; I got a couple of e-mails expressing some confusion over my example. This comes from</div><div>my poor choice of “single_sample_ped” which maybe should have been named something</div><div>like “Nsample_ped”. &nbsp;Here’s the deal:</div><div><br></div><div>Currently, both the f125 and f250 report a pedestal that is the average of 4 samples. Since it</div><div>is the average, it really does represent the pedestal of a single sample (thus, the name). &nbsp;This</div><div>is why nsamples_pedestal is always set to “1”.</div><div><br></div><div>However, we have left open the possibility with the fADC125 firmware to have it report a pedestal</div><div>sum that is not actually an average, but not a straight sum either. For example, a sum of 16 samples</div><div>divided by 4. This will allow us to report the pedestal with greater precision, but still stay within</div><div>our bit budget. So, for that example, “pedestal” would represent the equivalent of 4 samples and</div><div>nsamples_pedestal would be set to “4”. &nbsp;Therefore, by multiplying by the ratio of nsamples_integral</div><div>to nsamples_pedestal, we get the pedestal value that should be subtracted from the integral.</div><div><br></div><div>If we write the code now to handle this, then when a new firmware version is deployed in the future,</div><div>the reconstruction code won’t need to be changed and it will work with both new and old data.</div><div><br></div><div>I hope that makes things a little clearer. Let me know if it doesn’t.</div><div><br></div><div>Regards,</div><div>-David</div><br><div><div>On Dec 4, 2014, at 5:43 PM, David Lawrence &lt;<a href="mailto:davidl@jlab.org">davidl@jlab.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi All,<div><br></div><div>&nbsp; I have just checked in some changes to the commissioning branch that will hopefully help</div><div>improve the situation regarding number of samples used to calculate pedestals to be subtracted</div><div>from integrals. These include:</div><div><br></div><div>1.) Adding nsamples_integral and nsamples_pedestal fields to the Df125PulseIntegral class as</div><div>&nbsp; &nbsp;well as the DCDCDigiHit and DFDCCathodeDigiHit classes.</div><div><br></div><div>2.) Fixed the problem where the value of samples_pedestal was always set to 4 for the Df250PulseIntegral</div><div>&nbsp; &nbsp;objects. Now it is set to 1.</div><div><br></div><div>3.) The value of nsamples_integral in both the Df1250PulseIntegral and Df250PulseIntegral objects</div><div>&nbsp; &nbsp;are now set automatically to NSA_NSB iff the values came from mode7 data and a config. object</div><div>&nbsp; &nbsp;was found in the data stream. Otherwise, it is set to what was used in emulation so in all cases, it should</div><div>&nbsp; &nbsp;be valid.</div><div><br></div><div><br></div><div>So, for people implementing code that performs pedestal subtraction, you should do something like</div><div>the following:</div><div><br></div><div><font face="Courier">double integral &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= (double)pulse_integral-&gt;integral;</font></div><div><font face="Courier">double single_sample_ped = (double)pulse_integral-&gt;pedestal;</font></div><div><font face="Courier">double nsamples_integral = (double)pulse_integral-&gt;nsamples_integral;</font></div><div><font face="Courier">double nsamples_pedestal = (double)pulse_integral-&gt;nsamples_pedestal;</font></div><div><font face="Courier">double pedestal &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=&nbsp;</font><span style="font-family: Courier;">single_sample_ped</span><font face="Courier">&nbsp;* nsamples_integral/nsamples_pedestal;</font></div><div><font face="Courier">double dE = gain * (</font><span style="font-family: Courier;">integral - pedestal);</span></div><div><br></div><div><br></div><div>i.e. you should no longer reference the NSA_NSB from the config objects directly. This mechanism should</div><div>work for both emulated and non-emulated pulse integral objects. Let me know if anyone sees any issues.</div><div><br></div><div>Regards,</div><div>-David</div></div>_______________________________________________<br>Halld-online mailing list<br><a href="mailto:Halld-online@jlab.org">Halld-online@jlab.org</a><br>https://mailman.jlab.org/mailman/listinfo/halld-online</blockquote></div><br></body></html>