Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two main updates in this branch: an implementation of "ADC droop" calibration, and an update to the threshold filter to use channel-by-channel extracted thresholds.
ADC "droop" Calibration
Firstly, a calibration for the ADC instability ("ADC droop") effect is implemented.
A brief summary of what is included is below, and some more details on the effect and the mechanism can be found here: https://indico.fnal.gov/event/67027/contributions/307766/attachments/184558/253844/workshop%2001_24_25-1.pdf
For each chip in an event, the values of the chip V_ref and V_cm for the ADC are simulated (as a function of time and the number of hits in the event). The model for these voltages is a "step" impulse with an exponential decay back to baseline. This includes 4 parameters (2 for each V_cm and V_ref): the impulse size and the RC constant of the exponential decay. The initial values for these parameters are taken from bench top tests with the LArPix tiles. However, these tests were performed at room temperature, and the behavior of the ASIC, as well as the R and C values for the relevant board components will vary by ~10-20% from room temperature to LAr. Thus, in order to ensure the parameters used accurately reflect data, a systematic scan of events is performed. The procedure is described below:
A sample line fit and the histograms of line slopes for raw and calibrated data are included below.
The calibrated value is stored in the field "Q" for both calib_final_hits and calib_prompt_hits. The uncalibrated value is also stored in the field "Q_raw" for both of these.
Threshold Filter
Rather than assuming a uniform threshold (essentially giving a hard cut off of data word below the fixed value), a channel by channel threshold value is used. These thresholds are specified in a json file of the same format implemented in larnd-sim. It should be confirmed that changes in the encoding of these thresholds stay consistent between larnd-sim and ndlar_flow.
Some distributions for. a sample data file are included below showing Q_raw for unfiltered hits ("raw"), Q for unfiltered hits ("calibrated") , and Q for filtered hits ("final").
Note that, although all of these changes are being pushed together, its very simple to disentangle the effects of each in further analysis. Because Q_raw is stored, its simple to study just the impact of the new filter. Similarly, the impact of the calibration alone can be understood by using calib_prompt_hits.