7 #ifndef ALGOSLIDINGWINDOW_CXX 8 #define ALGOSLIDINGWINDOW_CXX 23 const std::string name)
67 double pulse_start_threshold=0;
68 double pulse_tail_threshold =0;
70 double pulse_start_baseline =0;
78 for(
size_t i=0; i<wf.size(); ++i) {
80 auto const&
value = wf[i];
82 float start_threshold = mean_v.at(i);
85 else start_threshold += sigma_v.at(i) *
_nsigma;
88 if( (!fire || in_tail) && (
double)
value > start_threshold ) {
100 std::cout <<
"\033[93mPulse End\033[00m: " 101 <<
"baseline: " << mean_v[i] <<
" ... " <<
" ... adc: " <<
value <<
" T=" << i << std::endl;
108 pulse_start_threshold = start_threshold;
109 pulse_start_baseline = mean_v.at(i);
111 pulse_tail_threshold = pulse_start_baseline;
113 else pulse_tail_threshold += sigma_v.at(i) *
_end_nsigma;
115 int last_pulse_end_index = 0;
117 int buffer_num_index = (int)i - last_pulse_end_index;
120 if(buffer_num_index<0) {
121 std::cerr <<
"\033[95m[ERROR]\033[00m Logic error! Negative buffer_num_index..." << std::endl;
129 for(
size_t pre_index=
_pulse.
t_start; pre_index<i; ++pre_index) {
131 auto const& pre_adc = wf[pre_index];
132 if(pre_adc > pulse_start_baseline)
continue;
134 _pulse.
area += pre_adc - pulse_start_baseline;
139 std::cout <<
"\033[93mPulse Start\033[00m: " 140 <<
"baseline: " << mean_v[i]
141 <<
" ... threshold: " << start_threshold
142 <<
" ... adc: " <<
value 143 <<
" T=" << i << std::endl;
149 if( fire && ((
double)
value) < pulse_start_threshold ) {
154 if( (fire || in_tail) && ((
double)value) < pulse_tail_threshold ){
164 std::cout <<
"\033[93mPulse End\033[00m: " 165 <<
"baseline: " << mean_v[i] <<
" ... " <<
" ... adc: " << value <<
" T=" << i << std::endl;
175 double adc_above_baseline = ((double)value - (
double)pulse_start_baseline);
std::vector< double > PedestalSigma_t
virtual void Reset()
A method to be called event-wise to reset parameters.
float _nsigma
A variable holder for a multiplicative factor for the pedestal standard deviation to define the thres...
virtual ~AlgoSlidingWindow()
Default destructor.
AlgoSlidingWindow(const std::string name="SlidingWindow")
Default constructor.
bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
Implementation of AlgoSlidingWindow::reco() method.
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
T get(std::string const &key) const
std::vector< short > Waveform_t
std::string value(boost::any const &)
Class definition file of AlgoSlidingWindow.
void Reset()
Implementation of AlgoSlidingWindow::reset() method.
float _adc_thres
A variable holder for a user-defined absolute ADC threshold value.
std::vector< double > PedestalMean_t
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
cet::coded_exception< error, detail::translate > exception