Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pmtana::AlgoThreshold Class Reference

#include <AlgoThreshold.h>

Inheritance diagram for pmtana::AlgoThreshold:
pmtana::PMTPulseRecoBase

Public Member Functions

 AlgoThreshold (const std::string name="AlgoThreshold")
 Default constructor. More...
 
 AlgoThreshold (const fhicl::ParameterSet &pset, const std::string name="AlgoThreshold")
 Alternative constructor. More...
 
void Reset ()
 Implementation of AlgoThreshold::reset() method. More...
 
- Public Member Functions inherited from pmtana::PMTPulseRecoBase
 PMTPulseRecoBase (const std::string name="noname")
 Default constructor with fhicl parameters. More...
 
virtual ~PMTPulseRecoBase ()=default
 Default destructor. More...
 
const std::stringName () const
 Name getter. More...
 
bool Status () const
 Status getter. More...
 
bool Reconstruct (const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
 
const pulse_paramGetPulse (size_t index=0) const
 
const pulse_param_arrayGetPulses () const
 A getter for the whole array of pulse_param struct object. More...
 
size_t GetNPulse () const
 A getter for the number of reconstructed pulses from the input waveform. More...
 

Protected Member Functions

bool RecoPulse (const pmtana::Waveform_t &wf, const pmtana::PedestalMean_t &mean_v, const pmtana::PedestalSigma_t &sigma_v)
 Implementation of AlgoThreshold::reco() method. More...
 
- Protected Member Functions inherited from pmtana::PMTPulseRecoBase
bool Integral (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 
bool Derivative (const std::vector< short > &wf, std::vector< int32_t > &diff, size_t begin=0, size_t end=0) const
 
size_t Max (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 
size_t Min (const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
 

Protected Attributes

double _start_adc_thres
 A variable holder for a user-defined absolute ADC threshold value. More...
 
double _end_adc_thres
 
double _nsigma_start
 A variable holder for a multiplicative factor for the pedestal standard deviation to define the threshold. More...
 
double _nsigma_end
 
- Protected Attributes inherited from pmtana::PMTPulseRecoBase
pulse_param_array _pulse_v
 A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s). More...
 
pulse_param _pulse
 A subject pulse_param object to be filled with the last reconstructed pulse parameters. More...
 

Detailed Description

This class implements threshold algorithm to AlgoThreshold class. The algorithm defines a pulse in user-specified time window. A typical usage is to set the beginning of the window to be 0 (= start of the waveform) and integrate over the time of interest. By default, the ending is set to index=0, in which case it uses the ending index of the input waveform (i.e. full integration).

Definition at line 35 of file AlgoThreshold.h.

Constructor & Destructor Documentation

pmtana::AlgoThreshold::AlgoThreshold ( const std::string  name = "AlgoThreshold")

Default constructor.

Definition at line 14 of file AlgoThreshold.cxx.

15  //***************************************************************************
16  {
17  //_adc_thres = 3;
18  //_nsigma = 5;
19  Reset();
20  }
static QCString name
Definition: declinfo.cpp:673
void Reset()
Implementation of AlgoThreshold::reset() method.
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
pmtana::AlgoThreshold::AlgoThreshold ( const fhicl::ParameterSet pset,
const std::string  name = "AlgoThreshold" 
)

Alternative constructor.

Definition at line 23 of file AlgoThreshold.cxx.

27  //*******************************************************
28  {
29 
30  _start_adc_thres = pset.get<double>("StartADCThreshold");
31  _end_adc_thres = pset.get<double>("EndADCThreshold");
32 
33  //_nsigma = pset.get<double>("NSigmaThreshold");
34 
35  _nsigma_start = pset.get<double>("NSigmaThresholdStart");
36  _nsigma_end = pset.get<double>("NSigmaThresholdEnd");
37 
38  Reset();
39 
40  }
static QCString name
Definition: declinfo.cpp:673
void Reset()
Implementation of AlgoThreshold::reset() method.
T get(std::string const &key) const
Definition: ParameterSet.h:271
double _nsigma_start
A variable holder for a multiplicative factor for the pedestal standard deviation to define the thres...
Definition: AlgoThreshold.h:63
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
double _start_adc_thres
A variable holder for a user-defined absolute ADC threshold value.
Definition: AlgoThreshold.h:58

Member Function Documentation

bool pmtana::AlgoThreshold::RecoPulse ( const pmtana::Waveform_t wf,
const pmtana::PedestalMean_t mean_v,
const pmtana::PedestalSigma_t sigma_v 
)
protectedvirtual

Implementation of AlgoThreshold::reco() method.

Implements pmtana::PMTPulseRecoBase.

Definition at line 50 of file AlgoThreshold.cxx.

54  {
55  bool fire = false;
56 
57  double counter=0;
58 
59  double ped_mean = mean_v.front();
60  double ped_rms = sigma_v.front();
61 
62  //double threshold = ( _adc_thres > (_nsigma * ped_rms) ? _adc_thres : (_nsigma * ped_rms) );
63  auto start_threshold = ( _start_adc_thres > (_nsigma_start * ped_rms) ? _start_adc_thres : (_nsigma_start * ped_rms) );
64  auto end_threshold = ( _end_adc_thres > (_nsigma_end * ped_rms) ? _end_adc_thres : (_nsigma_end * ped_rms) );
65 
66  // threshold += ped_mean
67 
68  start_threshold += ped_mean;
69  end_threshold += ped_mean;
70 
71  Reset();
72 
73  for(auto const &value : wf){
74 
75  if( !fire && ((double)value) >= start_threshold ){
76 
77  // Found a new pulse
78 
79  fire = true;
80 
81  _pulse.ped_mean = ped_mean;
82  _pulse.ped_sigma = ped_rms;
83 
84  //vic: i move t_start back one, this helps with porch
85 
86  _pulse.t_start = counter - 1 > 0 ? counter - 1 : counter;
87  //std::cout << "counter: " << counter << " tstart : " << _pulse.t_start << "\n";
88 
89  }
90 
91  if( fire && ((double)value) < end_threshold ){
92 
93  // Found the end of a pulse
94 
95  fire = false;
96 
97  //vic: i move t_start forward one, this helps with tail
98  _pulse.t_end = counter < wf.size() ? counter : counter - 1;
99 
100  _pulse_v.push_back(_pulse);
101 
103 
104  }
105 
106 
107  //std::cout << "\tFire=" << fire << std::endl;
108 
109  if(fire){
110 
111  // Add this adc count to the integral
112 
113  _pulse.area += ((double)value - (double)ped_mean);
114 
115  if(_pulse.peak < ((double)value - (double)ped_mean)) {
116 
117  // Found a new maximum
118 
119  _pulse.peak = ((double)value - (double)ped_mean);
120 
121  _pulse.t_max = counter;
122 
123  }
124 
125  }
126 
127  counter++;
128  }
129 
130  if(fire){
131 
132  // Take care of a pulse that did not finish within the readout window.
133 
134  fire = false;
135 
136  _pulse.t_end = counter - 1;
137 
138  _pulse_v.push_back(_pulse);
139 
141 
142  }
143 
144  return true;
145 
146  }
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
void Reset()
Implementation of AlgoThreshold::reset() method.
double _nsigma_start
A variable holder for a multiplicative factor for the pedestal standard deviation to define the thres...
Definition: AlgoThreshold.h:63
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
double _start_adc_thres
A variable holder for a user-defined absolute ADC threshold value.
Definition: AlgoThreshold.h:58
void pmtana::AlgoThreshold::Reset ( void  )
virtual

Implementation of AlgoThreshold::reset() method.

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 43 of file AlgoThreshold.cxx.

45  {
47  }
virtual void Reset()
A method to be called event-wise to reset parameters.

Member Data Documentation

double pmtana::AlgoThreshold::_end_adc_thres
protected

Definition at line 59 of file AlgoThreshold.h.

double pmtana::AlgoThreshold::_nsigma_end
protected

Definition at line 64 of file AlgoThreshold.h.

double pmtana::AlgoThreshold::_nsigma_start
protected

A variable holder for a multiplicative factor for the pedestal standard deviation to define the threshold.

Definition at line 63 of file AlgoThreshold.h.

double pmtana::AlgoThreshold::_start_adc_thres
protected

A variable holder for a user-defined absolute ADC threshold value.

Definition at line 58 of file AlgoThreshold.h.


The documentation for this class was generated from the following files: