Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pedestal subtraction "mistakes" for all Detectors that employ fADC250 #751

Open
zihlmann opened this issue Sep 25, 2023 · 10 comments
Open
Assignees

Comments

@zihlmann
Copy link
Contributor

There are several issues regarding the handling of the pedestals in the detectors that
using fADC250. The algorithm on the FPGA is providing a value for the pedestal, however
if the algorithm fails to determine a proper value a quality factor QF is non zero and
in digi hits is reported as QF & 0x40. There are other QF bits set for other problems
the algorithm may have had but in case of a failed pedestal determination the 7th bit
is set.

The base approach when constructing detector hits in a DANA factory is to use the pedestal
provided by the FPGA algorithm but in the case the pedestal determination failed an average
pedestal from CCDB pedestal table is to be used.

So in the hit factory code an initial value for the pedestal is set using CCDB data
// For now, only keep events with a correct pedestal
double pedestal = a_pedestals[digihit->sector-1];

And later on the pedestal from the FPGA is used if the quality factor QF is ok
// digihit->pedestal is the sum of "nsamples_pedestal" samples
// Calculate the average pedestal per sample
if( (digihit->pedestal>0) && locTTabUtilities->CheckFADC250_PedestalOK(digihit->QF) ) {
pedestal = (double)digihit->pedestal/nsamples_pedestal;
}

the above code snipets are from libraries/START_COUNTER/DSCHit_factory.cc but other detectors
have very similar codes in their factories with the same result.

It turns out that there are ISSUES with this approach for various reasons:
a) the ccdb tables are always set to zero: Start Counter
This means no pedestal subtraction if QF == 0x40!
b) the ccdb tables are always set to a wrong value (250 instead of 100): Tagger hodoscope and microscope
this means the wrong pedestal of 250 is subtracted if QF == 0x40!
for the tagger hodoscope this is even more problematic since the base line shifts significantly with
increasing beam current to lower values.
c) the ccdb table is NOT used at all since in the case of a failed pedestal the hit is ignored: BCAL
what is meant by this statement is that if QF == 0x40 the factory discards the hit.
d) the ccdb table is not updated for all run periods and just fixed to 100: TOF

one can verify these problems in the factories that create the detector hits:
DBCALHit_factory.cc
DSCHit_factory.cc
DTAGHHit_factory_Calib.cc
DTAGMHit_factory_Calib.cc
DTOFHit_factory.cc

and to check what is in CCDB regarding pedestal XXXXXXX==runnumber:

ccdb dump PHOTON_BEAM/microscope/fadc_pedestals:XXXXXX all 250
ccdb dump PHOTON_BEAM/hodoscope/fadc_pedestals:XXXXXX all 250
ccdb dump StartCounter/pedestals:XXXXXX all zero
ccdb dump BCAL/ADC_pedestals:XXXXXX all zero
ccdb dump TOF2/pedestals:XXXXXX all 100 for run > 80k
ccdb dump FCAL/pedestals:XXXXXX looks OK

This is a subjective order of severity:

a) all BCAL hits where the pedestal determination failed are discarded
a) all tagger hits where the pedestal failed 250 is subtracted from the ADC values
b) all Start Counter hits where the pedestal failed zero is subtracted (no pedestal subtraction)
c) all TOF hits where the pedestal failed the pedestal subtraction is fixed to 100 for run periods 80k and onward

@markdalton
Copy link
Contributor

It would be very useful to know how often this happens for each detector.

@zihlmann
Copy link
Contributor Author

zihlmann commented Sep 25, 2023

rate of QF occurance as a function of readout channel number for various detectors using fADC250. this is for a GlueX production run at 300nA on Diamond radiator. (run 121204) The vertical axis is Number of QF occurences for this channel
normalized to the total number of physics triggers in the file.

qf_rates_300nAproduction

@zihlmann
Copy link
Contributor Author

zihlmann commented Sep 26, 2023

the following is the same but for run 121153 with 900nA beam current and specialized trigger thresholds to handle
the rates. Note that some of the detectors were turned off during this run test.

Note: The physics trigger involves FCAL-BCAL comobination so the "rates" in the FCAL and BCAL have to be taken
with a grain of salt since they will be highly correlated.
At high current it can be seen that the failing of the determination of the pedestal is of order less tha 1% for the BCAL
reaching amost 10% in the central region of the FCAL, between 5% and 16% in the Start Counter, reaching 10% close to the center for TOF (those detectors that were off will definitely be above 10%), 20%-30% for Tagger microscope conunters in the coherent peak, and between 2% and 10% for those tagger hodoscope counters that were on.

qf_pedestal_fail_run121153

@nsjarvis
Copy link
Contributor

nsjarvis commented Sep 26, 2023 via email

@zihlmann
Copy link
Contributor Author

zihlmann commented Sep 26, 2023 via email

@nsjarvis
Copy link
Contributor

The occupancy in 2023's SC monitoring plots is only ~ 30% higher in the middle-number counters (15 ish), but I suppose the algorithm failure rate is some power of this.

@zihlmann
Copy link
Contributor Author

for completeness these are the pedestals for the high intensity run 121153 where a pedestal value is reported.

qf_GOODpedestal_run121153

@zihlmann
Copy link
Contributor Author

Please take a look and consider updating the CCDB with pedestal values that make sens to be used as alternative to when the pedestal data is not available from the raw data.

@sdobbs
Copy link
Contributor

sdobbs commented Dec 14, 2023

We should resolve this for all detectors before the CPP data start production - I suggest we review the situation and make some decisions in the next C&P meeting.

@nsjarvis pointed out this high priority action item - https://halldweb.jlab.org/wiki-private/index.php/December_13,_2023,_Calibration_%26_Production#Old_Action_Items

@rjones30
Copy link
Contributor

Verified that the TAGM and TAGH default pedestals were all set to 250 in ccdb, whereas should be 100. Changed to 100 for all runs 10000-inf , var=mc and var=default, for both microscope and hodoscope. Updates verified.
-Richard Jones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants