All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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, std::unique_ptr< pmtana::RiseTimeCalculatorBase > risetimecalculator=nullptr, 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::string & Name () 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...
 
std::unique_ptr
< pmtana::RiseTimeCalculatorBase
_risetime_calc_ptr = nullptr
 Tool for rise time calculation. 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  }
void Reset()
Implementation of AlgoThreshold::reset() method.
then echo fcl name
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
pmtana::AlgoThreshold::AlgoThreshold ( const fhicl::ParameterSet &  pset,
std::unique_ptr< pmtana::RiseTimeCalculatorBase risetimecalculator = nullptr,
const std::string  name = "AlgoThreshold" 
)

Alternative constructor.

Definition at line 23 of file AlgoThreshold.cxx.

28  //*******************************************************
29  {
30 
31  _start_adc_thres = pset.get<double>("StartADCThreshold");
32  _end_adc_thres = pset.get<double>("EndADCThreshold");
33 
34  //_nsigma = pset.get<double>("NSigmaThreshold");
35 
36  _nsigma_start = pset.get<double>("NSigmaThresholdStart");
37  _nsigma_end = pset.get<double>("NSigmaThresholdEnd");
38 
39  _risetime_calc_ptr = std::move(risetimecalculator);
40 
41  Reset();
42 
43  }
void Reset()
Implementation of AlgoThreshold::reset() method.
std::unique_ptr< pmtana::RiseTimeCalculatorBase > _risetime_calc_ptr
Tool for rise time calculation.
double _nsigma_start
A variable holder for a multiplicative factor for the pedestal standard deviation to define the thres...
Definition: AlgoThreshold.h:65
then echo fcl name
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:60

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 53 of file AlgoThreshold.cxx.

57  {
58  bool fire = false;
59 
60  double counter=0;
61 
62  double ped_mean = mean_v.front();
63  double ped_rms = sigma_v.front();
64 
65  //double threshold = ( _adc_thres > (_nsigma * ped_rms) ? _adc_thres : (_nsigma * ped_rms) );
66  auto start_threshold = ( _start_adc_thres > (_nsigma_start * ped_rms) ? _start_adc_thres : (_nsigma_start * ped_rms) );
67  auto end_threshold = ( _end_adc_thres > (_nsigma_end * ped_rms) ? _end_adc_thres : (_nsigma_end * ped_rms) );
68 
69  // threshold += ped_mean
70 
71  start_threshold += ped_mean;
72  end_threshold += ped_mean;
73 
74  Reset();
75 
76  for(auto const &value : wf){
77 
78  if( !fire && ((double)value) >= start_threshold ){
79 
80  // Found a new pulse
81 
82  fire = true;
83 
84  _pulse.ped_mean = ped_mean;
85  _pulse.ped_sigma = ped_rms;
86 
87  //vic: i move t_start back one, this helps with porch
88 
89  _pulse.t_start = counter - 1 > 0 ? counter - 1 : counter;
90  //std::cout << "counter: " << counter << " tstart : " << _pulse.t_start << "\n";
91 
92  }
93 
94  if( fire && ((double)value) < end_threshold ){
95 
96  // Found the end of a pulse
97 
98  fire = false;
99 
100  //vic: i move t_start forward one, this helps with tail
101  _pulse.t_end = counter < wf.size() ? counter : counter - 1;
102 
104  _pulse.t_rise = _risetime_calc_ptr->RiseTime(
105  {wf.begin()+_pulse.t_start, wf.begin()+_pulse.t_end},
106  {mean_v.begin()+_pulse.t_start, mean_v.begin()+_pulse.t_end},
107  true);
108 
109  _pulse_v.push_back(_pulse);
110 
112 
113  }
114 
115 
116  //std::cout << "\tFire=" << fire << std::endl;
117 
118  if(fire){
119 
120  // Add this adc count to the integral
121 
122  _pulse.area += ((double)value - (double)ped_mean);
123 
124  if(_pulse.peak < ((double)value - (double)ped_mean)) {
125 
126  // Found a new maximum
127 
128  _pulse.peak = ((double)value - (double)ped_mean);
129 
130  _pulse.t_max = counter;
131 
132  }
133 
134  }
135 
136  counter++;
137  }
138 
139  if(fire){
140 
141  // Take care of a pulse that did not finish within the readout window.
142 
143  fire = false;
144 
145  _pulse.t_end = counter - 1;
146 
148  _pulse.t_rise = _risetime_calc_ptr->RiseTime(
149  {wf.begin()+_pulse.t_start, wf.begin()+_pulse.t_end},
150  {mean_v.begin()+_pulse.t_start, mean_v.begin()+_pulse.t_end},
151  true);
152 
153  _pulse_v.push_back(_pulse);
154 
156 
157  }
158 
159  return true;
160 
161  }
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
void Reset()
Implementation of AlgoThreshold::reset() method.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:285
std::unique_ptr< pmtana::RiseTimeCalculatorBase > _risetime_calc_ptr
Tool for rise time calculation.
double _nsigma_start
A variable holder for a multiplicative factor for the pedestal standard deviation to define the thres...
Definition: AlgoThreshold.h:65
temporary value
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:60
void pmtana::AlgoThreshold::Reset ( )
virtual

Implementation of AlgoThreshold::reset() method.

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 46 of file AlgoThreshold.cxx.

48  {
50  }
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 61 of file AlgoThreshold.h.

double pmtana::AlgoThreshold::_nsigma_end
protected

Definition at line 66 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 65 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 60 of file AlgoThreshold.h.


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