Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
pmtana::PMTPulseRecoBase Class Referenceabstract

#include <PMTPulseRecoBase.h>

Inheritance diagram for pmtana::PMTPulseRecoBase:
pmtana::AlgoCFD pmtana::AlgoFixedWindow pmtana::AlgoSiPM pmtana::AlgoSlidingWindow pmtana::AlgoSSPLeadingEdge pmtana::AlgoThreshold

Public Member Functions

 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...
 
virtual void Reset ()
 A method to be called event-wise to reset parameters. 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

virtual bool RecoPulse (const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)=0
 
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

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...
 

Private Attributes

std::string _name
 Unique name. More...
 
bool _status
 Status after pulse reconstruction. More...
 

Detailed Description

The base class of pulse reconstruction algorithms. All algorithms should inherit from this calss to be executed by a manager class, pulse_reco. Note that this class does not depend on the rest of the framework except for the use of constants. In order to reconstruct a pulse, all it requires is a std::vector<short> type object (i.e. raw waveform), waveform pedestal, and its standard deviation. All of these are to be provided by an executer. Reconstructed pulse parameters are stored in the pulse_param struct object.

All methods specified as "virtual" should be implemented by the inherit children class.

This class provides some basic std::vector calculation algorithms such as integral, derivative, max and min algorithms. Inherit children classes are encouraged to use these provided methods when possible.

Definition at line 66 of file PMTPulseRecoBase.h.

Constructor & Destructor Documentation

pmtana::PMTPulseRecoBase::PMTPulseRecoBase ( const std::string  name = "noname")

Default constructor with fhicl parameters.

Definition at line 15 of file PMTPulseRecoBase.cxx.

15  : _name (name)
16  , _status (true)
17  //*************************************************************************
18  { Reset(); }
static QCString name
Definition: declinfo.cpp:673
bool _status
Status after pulse reconstruction.
virtual void Reset()
A method to be called event-wise to reset parameters.
std::string _name
Unique name.
virtual pmtana::PMTPulseRecoBase::~PMTPulseRecoBase ( )
virtualdefault

Default destructor.

Member Function Documentation

bool pmtana::PMTPulseRecoBase::Derivative ( const std::vector< short > &  wf,
std::vector< int32_t > &  diff,
size_t  begin = 0,
size_t  end = 0 
) const
protected

A method to compute derivative, which is a simple subtraction of previous ADC sample from each sample. The result is stored in the input "diff" reference vector which is int32_t type as a derivative could be negative.

Definition at line 117 of file PMTPulseRecoBase.cxx.

122  {
123 
124  if(CheckIndex(wf,begin,end)){
125 
126  diff.clear();
127  diff.reserve(end - begin);
128 
129  for(size_t index = begin ; index <= end ; ++index)
130 
131  diff.push_back(wf.at(index+1) - wf.at(index));
132 
133  return true;
134  }
135 
136  return false;
137 
138  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
size_t pmtana::PMTPulseRecoBase::GetNPulse ( ) const
inline

A getter for the number of reconstructed pulses from the input waveform.

Definition at line 102 of file PMTPulseRecoBase.h.

102 {return _pulse_v.size();};
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
const pulse_param & pmtana::PMTPulseRecoBase::GetPulse ( size_t  index = 0) const

A getter for the pulse_param struct object. Reconstruction algorithm may have more than one pulse reconstructed from an input waveform. Note you must, accordingly, provide an index key to specify which pulse_param object to be retrieved.

Definition at line 68 of file PMTPulseRecoBase.cxx.

70  {
71 
72  if(index >= _pulse_v.size()) {
73 
74  std::cerr << "\033[93m"
75  << "Invalid pulse index: " << index
76  << "\033[00m"
77  << std::endl;
78 
79  throw std::exception();
80  }
81 
82  else return _pulse_v.at(index);
83 
84  }
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
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
const pulse_param_array & pmtana::PMTPulseRecoBase::GetPulses ( ) const

A getter for the whole array of pulse_param struct object.

Definition at line 87 of file PMTPulseRecoBase.cxx.

89  {
90  return _pulse_v;
91  }
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
bool pmtana::PMTPulseRecoBase::Integral ( const std::vector< short > &  wf,
double &  result,
size_t  begin = 0,
size_t  end = 0 
) const
protected

A method to integrate an waveform from index "begin" to the "end". The result is filled in "result" reference. If the "end" is default (=0), then "end" is set to the last index of the waveform.

Definition at line 94 of file PMTPulseRecoBase.cxx.

99  {
100 
101  if(!CheckIndex(wf,begin,end)) return false;
102 
103  std::vector<short>::const_iterator begin_iter(wf.begin());
104 
105  std::vector<short>::const_iterator end_iter(wf.begin());
106 
107  begin_iter = begin_iter + begin;
108 
109  end_iter = end_iter + end + 1;
110 
111  result = (double)(std::accumulate(begin_iter, end_iter, 0));
112 
113  return true;
114  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static QCString result
intermediate_table::const_iterator const_iterator
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
size_t pmtana::PMTPulseRecoBase::Max ( const std::vector< short > &  wf,
double &  result,
size_t  begin = 0,
size_t  end = 0 
) const
protected

A method to return the maximum value of ADC sample within the index from "begin" to "end". If the "end" is default (=0), then "end" is set to the last index of the waveform.

Definition at line 141 of file PMTPulseRecoBase.cxx.

146  {
147 
148  size_t target_index = wf.size() + 1;
149 
150  result = 0;
151 
152  if(CheckIndex(wf,begin,end)) {
153 
154  for(size_t index = begin; index <= end; ++index)
155 
156  if( result < wf.at(index)) { target_index = index; result = (double)(wf.at(index)); }
157 
158  }
159 
160  return target_index;
161 
162  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static QCString result
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
size_t pmtana::PMTPulseRecoBase::Min ( const std::vector< short > &  wf,
double &  result,
size_t  begin = 0,
size_t  end = 0 
) const
protected

A method to return the minimum value of ADC sample within the index from "begin" to "end". If the "end" is default (=0), then "end" is set to the last index of the waveform.

Definition at line 165 of file PMTPulseRecoBase.cxx.

170  {
171 
172  size_t target_index = wf.size() + 1;
173 
174  result = 4096;
175 
176  if(CheckIndex(wf,begin,end)) {
177 
178  for(size_t index = begin; index <= end; ++index)
179 
180  if( result > wf.at(index)) { target_index = index; result = (double)(wf.at(index)); }
181 
182  }
183 
184  return target_index;
185 
186  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static QCString result
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
const std::string & pmtana::PMTPulseRecoBase::Name ( void  ) const

Name getter.

Definition at line 21 of file PMTPulseRecoBase.cxx.

23  { return _name; }
std::string _name
Unique name.
bool pmtana::PMTPulseRecoBase::Reconstruct ( const pmtana::Waveform_t wf,
const pmtana::PedestalMean_t mean_v,
const pmtana::PedestalSigma_t sigma_v 
)

A core method: this executes the algorithm and stores reconstructed parameters in the pulse_param struct object.

Definition at line 31 of file PMTPulseRecoBase.cxx.

35  {
36  _status = this->RecoPulse(wf,mean_v,sigma_v);
37  return _status;
38  }
bool _status
Status after pulse reconstruction.
virtual bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)=0
virtual bool pmtana::PMTPulseRecoBase::RecoPulse ( const pmtana::Waveform_t ,
const pmtana::PedestalMean_t ,
const pmtana::PedestalSigma_t  
)
protectedpure virtual
void pmtana::PMTPulseRecoBase::Reset ( void  )
virtual

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

Reimplemented in pmtana::AlgoFixedWindow, pmtana::AlgoThreshold, pmtana::AlgoCFD, pmtana::AlgoSlidingWindow, pmtana::AlgoSSPLeadingEdge, and pmtana::AlgoSiPM.

Definition at line 57 of file PMTPulseRecoBase.cxx.

59  {
61 
62  _pulse_v.clear();
63 
64  _pulse_v.reserve(3);
65  }
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
bool pmtana::PMTPulseRecoBase::Status ( void  ) const

Status getter.

Definition at line 26 of file PMTPulseRecoBase.cxx.

28  { return _status; }
bool _status
Status after pulse reconstruction.

Member Data Documentation

std::string pmtana::PMTPulseRecoBase::_name
private

Unique name.

Definition at line 102 of file PMTPulseRecoBase.h.

pulse_param pmtana::PMTPulseRecoBase::_pulse
protected

A subject pulse_param object to be filled with the last reconstructed pulse parameters.

Definition at line 122 of file PMTPulseRecoBase.h.

pulse_param_array pmtana::PMTPulseRecoBase::_pulse_v
protected

A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s).

Definition at line 119 of file PMTPulseRecoBase.h.

bool pmtana::PMTPulseRecoBase::_status
private

Status after pulse reconstruction.

Definition at line 110 of file PMTPulseRecoBase.h.


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