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::AlgoSiPM Class Reference

#include <AlgoSiPM.h>

Inheritance diagram for pmtana::AlgoSiPM:
pmtana::PMTPulseRecoBase

Public Member Functions

 AlgoSiPM (const fhicl::ParameterSet &pset, std::unique_ptr< pmtana::RiseTimeCalculatorBase > risetimecalculator=nullptr, const std::string name="AlgoSiPM")
 
void Reset ()
 A method to be called event-wise to reset parameters. 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 &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
 
- 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 _adc_thres
 
int _min_width
 
double _2nd_thres
 
double _pedestal
 
- 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

Definition at line 22 of file AlgoSiPM.h.

Constructor & Destructor Documentation

pmtana::AlgoSiPM::AlgoSiPM ( const fhicl::ParameterSet &  pset,
std::unique_ptr< pmtana::RiseTimeCalculatorBase risetimecalculator = nullptr,
const std::string  name = "AlgoSiPM" 
)

Definition at line 12 of file AlgoSiPM.cxx.

16  {
17 
18  _adc_thres = pset.get< float >("ADCThreshold" );
19  _min_width = pset.get< float >("MinWidth" );
20  _2nd_thres = pset.get< float >("SecondThreshold");
21  _pedestal = pset.get< float >("Pedestal" );
22 
23  _risetime_calc_ptr = std::move(risetimecalculator);
24 
25 // _nsigma = 5;
26 
27  Reset();
28 
29  }
double _adc_thres
Definition: AlgoSiPM.h:47
double _2nd_thres
Definition: AlgoSiPM.h:53
std::unique_ptr< pmtana::RiseTimeCalculatorBase > _risetime_calc_ptr
Tool for rise time calculation.
then echo fcl name
void Reset()
A method to be called event-wise to reset parameters.
Definition: AlgoSiPM.cxx:32
double _pedestal
Definition: AlgoSiPM.h:56
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.

Member Function Documentation

bool pmtana::AlgoSiPM::RecoPulse ( const pmtana::Waveform_t wf,
const pmtana::PedestalMean_t ped_mean,
const pmtana::PedestalSigma_t ped_rms 
)
protectedvirtual

Implements pmtana::PMTPulseRecoBase.

Definition at line 40 of file AlgoSiPM.cxx.

43  {
44 
45  bool fire = false;
46  bool first_found = false;
47  bool record_hit = false;
48  int counter = 0;
49  // double threshold = (_2nd_thres > (_nsigma*_ped_rms) ? _2nd_thres
50  // : (_nsigma*_ped_rms));
51  //double pedestal = _pedestal;
52  double pedestal = ped_mean.front(); //Switch pedestal definition to incoroprate pedestal finder - K.S. 04/18/2019
53 
54  double threshold = _adc_thres;
55  threshold += pedestal;
56  double pre_threshold = _2nd_thres;
57  pre_threshold += pedestal;
58 
59  Reset();
60 
61  for (short const &value : wf) {
62 
63  if (!fire && (double(value) >= pre_threshold)) {
64 
65  // Found a new pulse
66  fire = true;
67  first_found = false;
68  record_hit = false;
70 
71  }
72 
73  if (fire && (double(value) < pre_threshold)) {
74 
75  // Found the end of a pulse
76  fire = false;
77  _pulse.t_end = counter - 1;
78  if (record_hit && ((_pulse.t_end - _pulse.t_start) >= _min_width))
79  {
81  _pulse.t_rise = _risetime_calc_ptr->RiseTime(
82  {wf.begin()+_pulse.t_start, wf.begin()+_pulse.t_end},
83  {ped_mean.begin()+_pulse.t_start, ped_mean.begin()+_pulse.t_end},
84  true);
85 
86  _pulse_v.push_back(_pulse);
87  record_hit = false;
88  }
90 
91  }
92 
93  if (fire) {
94 
95  // We want to record the hit only if _adc_thres is reached
96  if (!record_hit && (double(value) >= threshold)) record_hit = true;
97 
98  // Add this ADC count to the integral
99  _pulse.area += (double(value) - double(pedestal));
100 
101  if (!first_found &&
102  (_pulse.peak < (double(value) - double(pedestal)))) {
103 
104  // Found a new maximum
105  _pulse.peak = (double(value) - double(pedestal));
106  _pulse.t_max = counter;
107 
108  }
109  else if (!first_found)
110  // Found the first peak
111  first_found = true;
112 
113  }
114 
115  counter++;
116 
117  }
118 
119  if (fire) {
120 
121  // Take care of a pulse that did not finish within the readout window
122  fire = false;
123  _pulse.t_end = counter - 1;
124  if (record_hit && ((_pulse.t_end - _pulse.t_start) >= _min_width))
125  {
127  _pulse.t_rise = _risetime_calc_ptr->RiseTime(
128  {wf.begin()+_pulse.t_start, wf.begin()+_pulse.t_end},
129  {ped_mean.begin()+_pulse.t_start, ped_mean.begin()+_pulse.t_end},
130  true);
131 
132  _pulse_v.push_back(_pulse);
133  record_hit = false;
134  }
136 
137  }
138 
139  return true;
140 
141  }
double _adc_thres
Definition: AlgoSiPM.h:47
double _2nd_thres
Definition: AlgoSiPM.h:53
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
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.
temporary value
void Reset()
A method to be called event-wise to reset parameters.
Definition: AlgoSiPM.cxx:32
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
void pmtana::AlgoSiPM::Reset ( )
virtual

A method to be called event-wise to reset parameters.

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 32 of file AlgoSiPM.cxx.

33  {
34 
36 
37  }
virtual void Reset()
A method to be called event-wise to reset parameters.

Member Data Documentation

double pmtana::AlgoSiPM::_2nd_thres
protected

Definition at line 53 of file AlgoSiPM.h.

double pmtana::AlgoSiPM::_adc_thres
protected

Definition at line 47 of file AlgoSiPM.h.

int pmtana::AlgoSiPM::_min_width
protected

Definition at line 50 of file AlgoSiPM.h.

double pmtana::AlgoSiPM::_pedestal
protected

Definition at line 56 of file AlgoSiPM.h.


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