LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
pmtana::AlgoFixedWindow Class Reference

#include "AlgoFixedWindow.h"

Inheritance diagram for pmtana::AlgoFixedWindow:
pmtana::PMTPulseRecoBase

Public Member Functions

 AlgoFixedWindow (const std::string name="FixedWindow")
 Default ctor. More...
 
 AlgoFixedWindow (const fhicl::ParameterSet &pset, const std::string name="FixedWindow")
 Alternative ctor. More...
 
virtual ~AlgoFixedWindow ()
 Default destructor. More...
 
void Reset ()
 Implementation of AlgoFixedWindow::reset() method. More...
 
const std::string & Name () const
 Name getter. More...
 
const 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 &)
 Implementation of AlgoFixedWindow::reco() method. More...
 
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

size_t _index_start
 index marker for the beginning of the pulse time window More...
 
size_t _index_end
 index marker for the end of pulse time window More...
 
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 fixed_window algorithm to AlgoFixedWindow 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 33 of file AlgoFixedWindow.h.

Constructor & Destructor Documentation

pmtana::AlgoFixedWindow::AlgoFixedWindow ( const std::string  name = "FixedWindow")

Default ctor.

Definition at line 15 of file AlgoFixedWindow.cxx.

References _index_end, _index_start, and Reset().

15  : PMTPulseRecoBase(name)
16  //*******************************************************************************
17  {
18  Reset();
19 
20  _index_start = 0;
21 
22  _index_end = 0;
23  }
size_t _index_end
index marker for the end of pulse time window
size_t _index_start
index marker for the beginning of the pulse time window
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
void Reset()
Implementation of AlgoFixedWindow::reset() method.
pmtana::AlgoFixedWindow::AlgoFixedWindow ( const fhicl::ParameterSet pset,
const std::string  name = "FixedWindow" 
)

Alternative ctor.

Definition at line 26 of file AlgoFixedWindow.cxx.

References _index_end, _index_start, fhicl::ParameterSet::get(), and Reset().

29  : PMTPulseRecoBase(name)
30  //****************************************************************************************
31  {
32  Reset();
33 
34  _index_start = pset.get<size_t>("StartIndex");
35 
36  _index_end = pset.get<size_t>("EndIndex");
37  }
size_t _index_end
index marker for the end of pulse time window
size_t _index_start
index marker for the beginning of the pulse time window
T get(std::string const &key) const
Definition: ParameterSet.h:231
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
void Reset()
Implementation of AlgoFixedWindow::reset() method.
pmtana::AlgoFixedWindow::~AlgoFixedWindow ( )
virtual

Default destructor.

Definition at line 40 of file AlgoFixedWindow.cxx.

42  {}

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
protectedinherited

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 122 of file PMTPulseRecoBase.cxx.

References evd::details::begin(), pmtana::CheckIndex(), and evd::details::end().

127  {
128 
129  if(CheckIndex(wf,begin,end)){
130 
131  diff.clear();
132  diff.reserve(end - begin);
133 
134  for(size_t index = begin ; index <= end ; ++index)
135 
136  diff.push_back(wf.at(index+1) - wf.at(index));
137 
138  return true;
139  }
140 
141  return false;
142 
143  }
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_t pmtana::PMTPulseRecoBase::GetNPulse ( ) const
inlineinherited

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

Definition at line 106 of file PMTPulseRecoBase.h.

Referenced by opdet::LEDCalibrationAna::analyze().

106 {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
inherited

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 73 of file PMTPulseRecoBase.cxx.

References pmtana::PMTPulseRecoBase::_pulse_v.

Referenced by opdet::LEDCalibrationAna::analyze().

75  {
76 
77  if(index >= _pulse_v.size()) {
78 
79  std::cerr << "\033[93m"
80  << "Invalid pulse index: " << index
81  << "\033[00m"
82  << std::endl;
83 
84  throw std::exception();
85  }
86 
87  else return _pulse_v.at(index);
88 
89  }
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
const pulse_param_array & pmtana::PMTPulseRecoBase::GetPulses ( ) const
inherited

A getter for the whole array of pulse_param struct object.

Definition at line 92 of file PMTPulseRecoBase.cxx.

References pmtana::PMTPulseRecoBase::_pulse_v.

Referenced by opdet::RunHitFinder().

94  {
95  return _pulse_v;
96  }
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
protectedinherited

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 99 of file PMTPulseRecoBase.cxx.

References evd::details::begin(), pmtana::CheckIndex(), and evd::details::end().

Referenced by RecoPulse().

104  {
105 
106  if(!CheckIndex(wf,begin,end)) return false;
107 
108  std::vector<short>::const_iterator begin_iter(wf.begin());
109 
110  std::vector<short>::const_iterator end_iter(wf.begin());
111 
112  begin_iter = begin_iter + begin;
113 
114  end_iter = end_iter + end + 1;
115 
116  result = (double)(std::accumulate(begin_iter, end_iter, 0));
117 
118  return true;
119  }
intermediate_table::const_iterator const_iterator
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_t pmtana::PMTPulseRecoBase::Max ( const std::vector< short > &  wf,
double &  result,
size_t  begin = 0,
size_t  end = 0 
) const
protectedinherited

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 146 of file PMTPulseRecoBase.cxx.

References evd::details::begin(), pmtana::CheckIndex(), and evd::details::end().

Referenced by RecoPulse().

151  {
152 
153  size_t target_index = wf.size() + 1;
154 
155  result = 0;
156 
157  if(CheckIndex(wf,begin,end)) {
158 
159  for(size_t index = begin; index <= end; ++index)
160 
161  if( result < wf.at(index)) { target_index = index; result = (double)(wf.at(index)); }
162 
163  }
164 
165  return target_index;
166 
167  }
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
size_t pmtana::PMTPulseRecoBase::Min ( const std::vector< short > &  wf,
double &  result,
size_t  begin = 0,
size_t  end = 0 
) const
protectedinherited

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 170 of file PMTPulseRecoBase.cxx.

References evd::details::begin(), pmtana::CheckIndex(), and evd::details::end().

175  {
176 
177  size_t target_index = wf.size() + 1;
178 
179  result = 4096;
180 
181  if(CheckIndex(wf,begin,end)) {
182 
183  for(size_t index = begin; index <= end; ++index)
184 
185  if( result > wf.at(index)) { target_index = index; result = (double)(wf.at(index)); }
186 
187  }
188 
189  return target_index;
190 
191  }
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
const std::string & pmtana::PMTPulseRecoBase::Name ( ) const
inherited

Name getter.

Definition at line 21 of file PMTPulseRecoBase.cxx.

References pmtana::PMTPulseRecoBase::_name.

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 
)
inherited

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

Definition at line 36 of file PMTPulseRecoBase.cxx.

References pmtana::PMTPulseRecoBase::_status, and pmtana::PMTPulseRecoBase::RecoPulse().

40  {
41  _status = this->RecoPulse(wf,mean_v,sigma_v);
42  return _status;
43  }
bool _status
Status after pulse reconstruction.
virtual bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)=0
bool pmtana::AlgoFixedWindow::RecoPulse ( const pmtana::Waveform_t wf,
const pmtana::PedestalMean_t mean_v,
const pmtana::PedestalSigma_t sigma_v 
)
protectedvirtual

Implementation of AlgoFixedWindow::reco() method.

Implements pmtana::PMTPulseRecoBase.

Definition at line 57 of file AlgoFixedWindow.cxx.

References _index_end, _index_start, pmtana::PMTPulseRecoBase::_pulse_v, pmtana::PMTPulseRecoBase::Integral(), pmtana::PMTPulseRecoBase::Max(), and Reset().

61  {
62  this->Reset();
63 
64  if( _index_start >= wf.size() ) return true;
65 
66  _pulse_v[0].t_start = (double)(_index_start);
67 
68  _pulse_v[0].ped_mean = mean_v.front();
69 
70  _pulse_v[0].ped_sigma = sigma_v.front();
71 
72  if(!_index_end)
73 
74  _pulse_v[0].t_end = (double)(wf.size() - 1);
75 
76  else if(_index_end < wf.size())
77 
78  _pulse_v[0].t_end = (double)_index_end;
79 
80  else
81 
82  _pulse_v[0].t_end = wf.size() - 1;
83 
84  _pulse_v[0].t_max = PMTPulseRecoBase::Max(wf, _pulse_v[0].peak, _index_start, _pulse_v[0].t_end);
85 
86  _pulse_v[0].peak -= mean_v.front();
87 
89 
90  _pulse_v[0].area = _pulse_v[0].area - ( _pulse_v[0].t_end - _pulse_v[0].t_start + 1) * mean_v.front();
91 
92  return true;
93 
94  }
bool Integral(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
size_t _index_end
index marker for the end of pulse time window
size_t _index_start
index marker for the beginning of the pulse time window
size_t Max(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
void Reset()
Implementation of AlgoFixedWindow::reset() method.
void pmtana::AlgoFixedWindow::Reset ( )
virtual

Implementation of AlgoFixedWindow::reset() method.

Reimplemented from pmtana::PMTPulseRecoBase.

Definition at line 45 of file AlgoFixedWindow.cxx.

References pmtana::PMTPulseRecoBase::_pulse, and pmtana::PMTPulseRecoBase::_pulse_v.

Referenced by AlgoFixedWindow(), and RecoPulse().

47  {
48  if(!(_pulse_v.size()))
49 
50  _pulse_v.push_back(_pulse);
51 
52  _pulse_v[0].reset_param();
53 
54  }
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)...
const bool pmtana::PMTPulseRecoBase::Status ( ) const
inherited

Status getter.

Definition at line 26 of file PMTPulseRecoBase.cxx.

References pmtana::PMTPulseRecoBase::_status.

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

Member Data Documentation

size_t pmtana::AlgoFixedWindow::_index_end
protected

index marker for the end of pulse time window

Definition at line 58 of file AlgoFixedWindow.h.

Referenced by AlgoFixedWindow(), and RecoPulse().

size_t pmtana::AlgoFixedWindow::_index_start
protected

index marker for the beginning of the pulse time window

Definition at line 57 of file AlgoFixedWindow.h.

Referenced by AlgoFixedWindow(), and RecoPulse().

pulse_param pmtana::PMTPulseRecoBase::_pulse
protectedinherited

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

Definition at line 126 of file PMTPulseRecoBase.h.

Referenced by pmtana::AlgoSiPM::RecoPulse(), pmtana::AlgoSlidingWindow::RecoPulse(), pmtana::AlgoCFD::RecoPulse(), pmtana::AlgoThreshold::RecoPulse(), Reset(), and pmtana::PMTPulseRecoBase::Reset().

pulse_param_array pmtana::PMTPulseRecoBase::_pulse_v
protectedinherited

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