All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlgoFixedWindow.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // AlgoFixedWindow source
4 //
5 ////////////////////////////////////////////////////////////////////////
6 
7 #include "fhiclcpp/ParameterSet.h"
8 
9 #include "AlgoFixedWindow.h"
10 
11 namespace pmtana{
12 
13  //*******************************************************************************
15  //*******************************************************************************
16  {
17  Reset();
18 
19  _index_start = 0;
20 
21  _index_end = 0;
22  }
23 
24  //****************************************************************************************
25  AlgoFixedWindow::AlgoFixedWindow(const fhicl::ParameterSet &pset,
26  std::unique_ptr<pmtana::RiseTimeCalculatorBase> risetimecalculator,
27  //AlgoFixedWindow::AlgoFixedWindow(const ::fcllite::PSet& pset,
28  const std::string name)
29  : PMTPulseRecoBase(name)
30  //****************************************************************************************
31  {
32  _risetime_calc_ptr = std::move(risetimecalculator);
33 
34  Reset();
35 
36  _index_start = pset.get<size_t>("StartIndex");
37 
38  _index_end = pset.get<size_t>("EndIndex");
39  }
40 
41  //***************************************************************
43  //***************************************************************
44  {
45  if(!(_pulse_v.size()))
46 
47  _pulse_v.push_back(_pulse);
48 
49  _pulse_v[0].reset_param();
50 
51  }
52 
53  //***************************************************************
55  const PedestalMean_t& mean_v,
56  const PedestalSigma_t& sigma_v)
57  //***************************************************************
58  {
59  this->Reset();
60 
61  if( _index_start >= wf.size() ) return true;
62 
63  _pulse_v[0].t_start = (double)(_index_start);
64 
65  _pulse_v[0].ped_mean = mean_v.front();
66 
67  _pulse_v[0].ped_sigma = sigma_v.front();
68 
69  if(!_index_end)
70 
71  _pulse_v[0].t_end = (double)(wf.size() - 1);
72 
73  else if(_index_end < wf.size())
74 
75  _pulse_v[0].t_end = (double)_index_end;
76 
77  else
78 
79  _pulse_v[0].t_end = wf.size() - 1;
80 
81  _pulse_v[0].t_max = PMTPulseRecoBase::Max(wf, _pulse_v[0].peak, _index_start, _pulse_v[0].t_end);
82 
83  _pulse_v[0].peak -= mean_v.front();
84 
86 
87  _pulse_v[0].area = _pulse_v[0].area - ( _pulse_v[0].t_end - _pulse_v[0].t_start + 1) * mean_v.front();
88 
90  _pulse_v[0].t_rise = _risetime_calc_ptr->RiseTime(
91  {wf.begin()+_pulse.t_start, wf.begin()+_pulse.t_end},
92  {mean_v.begin()+_pulse.t_start, mean_v.begin()+_pulse.t_end},
93  true);
94 
95  return true;
96 
97  }
98 
99 }
bool Integral(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
std::vector< double > PedestalSigma_t
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
bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
Implementation of AlgoFixedWindow::reco() method.
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
size_t Max(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
std::vector< short > Waveform_t
std::unique_ptr< pmtana::RiseTimeCalculatorBase > _risetime_calc_ptr
Tool for rise time calculation.
Class definition file of AlgoFixedWindow.
then echo fcl name
AlgoFixedWindow(const std::string name="FixedWindow")
Default ctor.
std::vector< double > PedestalMean_t
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.