From c71bfb57408921b603c2dcfe1a911cb9f0e112c9 Mon Sep 17 00:00:00 2001 From: Steven Doran <78985334+S81D@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:39:13 -0500 Subject: [PATCH 1/2] Update PhaseIIADCHitFinder.cpp Assigned correct 50% interpolation time instead of max ADC time --- UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp b/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp index 8be738345..03bb113b0 100755 --- a/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp +++ b/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp @@ -945,7 +945,7 @@ std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( // Store the freshly made pulse in the vector of found pulses pulses.emplace_back(channel_key, ( pulse_start_sample * NS_PER_ADC_SAMPLE )-timing_offset, - (peak_sample * NS_PER_ADC_SAMPLE)-timing_offset, + (hit_time * NS_PER_ADC_SAMPLE)-timing_offset, calibrated_minibuffer_data.GetBaseline(), calibrated_minibuffer_data.GetSigmaBaseline(), raw_area, max_ADC, calibrated_amplitude, charge); From f10d805f492bbd30d50be290e052195872cd67e2 Mon Sep 17 00:00:00 2001 From: Steven Doran <78985334+S81D@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:05:07 -0500 Subject: [PATCH 2/2] Update PhaseIIADCHitFinder.cpp clean up verbose of the hit finding tool --- .../PhaseIIADCHitFinder.cpp | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp b/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp index 03bb113b0..902a25016 100755 --- a/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp +++ b/UserTools/PhaseIIADCHitFinder/PhaseIIADCHitFinder.cpp @@ -729,6 +729,8 @@ std::vector PhaseIIADCHitFinder::find_pulses_bywindow( } +// ****************************************************************** +// "PulseFindingApproach" default for EventBuilding std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( const Waveform& raw_minibuffer_data, const CalibratedADCWaveform& calibrated_minibuffer_data, @@ -824,8 +826,8 @@ std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( if(it != ChannelKeyToTimingOffsetMap.end()){ //Timing offset is available timing_offset = ChannelKeyToTimingOffsetMap.at(channel_key); } else { - if(verbosity>2){ - std::cout << "Didn't find Timing offset for channel " << channel_key << std::endl; + if(verbosity>v_error){ + std::cout << "PhaseIIADCHitFinder: Didn't find Timing offset for channel... setting this channel's offset to 0ns" << channel_key << std::endl; } } @@ -837,7 +839,10 @@ std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( calibrated_minibuffer_data.GetSigmaBaseline(), raw_area, max_ADC, calibrated_amplitude, charge); } - + + + // ****************************************************************** + // "PulseWindowType" default for EventBuilding // Peak windows are defined only by crossing and un-crossing of ADC threshold } else if(pulse_window_type == "dynamic"){ size_t pulse_start_sample = BOGUS_INT; @@ -898,8 +903,8 @@ std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( if(it != ChannelKeyToTimingOffsetMap.end()){ //Timing offset is available timing_offset = ChannelKeyToTimingOffsetMap.at(channel_key); } else { - if(verbosity>2){ - std::cout << "Didn't find Timing offset for channel " << channel_key << std::endl; + if(verbosity>v_error){ + std::cout << "PhaseIIADCHitFinder: Didn't find Timing offset for channel... setting this channel's offset to 0ns" << channel_key << std::endl; } } @@ -932,20 +937,23 @@ std::vector PhaseIIADCHitFinder::find_pulses_bythreshold( } } - if(verbosity>4) std::cout << "Hit time [ns] " << hit_time * NS_PER_ADC_SAMPLE << std::endl; + if(verbosity>v_debug) { + + std::cout << "Hit time [ns] " << hit_time * NS_PER_ADC_SAMPLE << std::endl; - if (hit_time < 0.0) { - // If for some reason the interpolation finds a negative time value (if the pulse is extremely early in the buffer), - // default to the peak time - std::cout << "Hit time is negative! Defaulting to peak time" << std::endl; - hit_time = peak_sample; + if (hit_time < 0.0) { + // If for some reason the interpolation finds a negative time value (if the pulse is extremely early in the buffer), + // default to the peak time (maximum ADC value of the pulse) + std::cout << "Hit time is negative! Defaulting to peak time" << std::endl; + hit_time = peak_sample; + } } // Store the freshly made pulse in the vector of found pulses pulses.emplace_back(channel_key, ( pulse_start_sample * NS_PER_ADC_SAMPLE )-timing_offset, - (hit_time * NS_PER_ADC_SAMPLE)-timing_offset, + (hit_time * NS_PER_ADC_SAMPLE)-timing_offset, // interpolated hit time calibrated_minibuffer_data.GetBaseline(), calibrated_minibuffer_data.GetSigmaBaseline(), raw_area, max_ADC, calibrated_amplitude, charge);