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, 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::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 &, 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...
 

Detailed Description

Definition at line 22 of file AlgoSiPM.h.

Constructor & Destructor Documentation

pmtana::AlgoSiPM::AlgoSiPM ( const fhicl::ParameterSet pset,
const std::string  name = "AlgoSiPM" 
)

Definition at line 12 of file AlgoSiPM.cxx.

14  {
15 
16  _adc_thres = pset.get< float >("ADCThreshold" );
17  _min_width = pset.get< float >("MinWidth" );
18  _2nd_thres = pset.get< float >("SecondThreshold");
19  _pedestal = pset.get< float >("Pedestal" );
20 
21 // _nsigma = 5;
22 
23  Reset();
24 
25  }
static QCString name
Definition: declinfo.cpp:673
double _adc_thres
Definition: AlgoSiPM.h:45
double _2nd_thres
Definition: AlgoSiPM.h:51
T get(std::string const &key) const
Definition: ParameterSet.h:271
void Reset()
A method to be called event-wise to reset parameters.
Definition: AlgoSiPM.cxx:28
double _pedestal
Definition: AlgoSiPM.h:54
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 36 of file AlgoSiPM.cxx.

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

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

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 28 of file AlgoSiPM.cxx.

29  {
30 
32 
33  }
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 51 of file AlgoSiPM.h.

double pmtana::AlgoSiPM::_adc_thres
protected

Definition at line 45 of file AlgoSiPM.h.

int pmtana::AlgoSiPM::_min_width
protected

Definition at line 48 of file AlgoSiPM.h.

double pmtana::AlgoSiPM::_pedestal
protected

Definition at line 54 of file AlgoSiPM.h.


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