Skip to content

Commit

Permalink
Fix AHDC pulse indexing and estimate the pedestal of the AHDC wavefor…
Browse files Browse the repository at this point in the history
…m using the first five samples (#480)

* Recover more data from AHDC pulse

* caotjava for mon12/ahdc (fix merging conflicts)

* Don't change HipoExtractor but Override ModeAHDC

* Declare `protected` some methods of HipoExtractor

* Estimate the pedestal using the first five samples

* Fix AHDC pulse indexing

---------

Co-authored-by: Felix Touchte Codjo <[email protected]>
Co-authored-by: Felix Touchte Codjo <[email protected]>
  • Loading branch information
3 people authored Feb 23, 2025
1 parent 141e407 commit 22cb3e2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public List<Pulse> extract(NamedEntry pars, int id, short... samples){
float leadingEdgeTime = 0; // moment when the signal reaches a Constant Fraction of its Amplitude uphill (fitted)
float trailingEdgeTime = 0; // moment when the signal reaches a Constant Fraction of its Amplitude downhill (fitted)
float timeOverThreshold = 0; // is equal to (timeFallCFA - timeRiseCFA)
float constantFractionTime ; // time extracted using the Constant Fraction Discriminator (CFD) algorithm (fitted)
float constantFractionTime = 0; // time extracted using the Constant Fraction Discriminator (CFD) algorithm (fitted)
/// /////////////////////////
// Begin waveform correction
/// ////////////////////////
Expand All @@ -75,11 +75,14 @@ public List<Pulse> extract(NamedEntry pars, int id, short... samples){
//private void waveformCorrection(short[] samples, short adcOffset, float samplingTime, int sparseSample, int binMax, int adcMax, int integral, short samplesCorr[], int binOffset, int timeMax){
binNumber = samples.length;
binMax = 0;
if (binNumber >= 5) {
adcOffset = (short) ((samples[0] + samples[1] + samples[2] + samples[3] + samples[4])/5); // try to estimate the baseline (pedestal) using the first five samples
}
adcMax = (short) (samples[0] - adcOffset);
integral = 0;
samplesCorr = new short[binNumber];
for (int bin = 0; bin < binNumber; bin++){
samplesCorr[bin] = (short) (samples[bin] - adcOffset);
samplesCorr[bin] = (short) Math.max(samples[bin] - adcOffset, 0);
if (adcMax < samplesCorr[bin]){
adcMax = samplesCorr[bin];
binMax = bin;
Expand Down Expand Up @@ -239,6 +242,7 @@ public List<Pulse> extract(NamedEntry pars, int id, short... samples){
//}
// output
Pulse pulse = new Pulse();
pulse.id = id;
pulse.adcMax = adcMax;
pulse.time = timeMax;
pulse.timestamp = timestamp;
Expand Down

0 comments on commit 22cb3e2

Please sign in to comment.