LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PMTPulseRecoBase.h
Go to the documentation of this file.
1 
15 #ifndef PMTPULSERECOBASE_H
16 #define PMTPULSERECOBASE_H
17 
18 // STL
19 #include <string>
20 #include <vector>
21 
22 #include "OpticalRecoTypes.h"
24 
25 #include <memory>
26 
27 namespace pmtana {
28 
29  struct pulse_param {
30  public:
33 
34  //for vic
35  double t_cfdcross;
36 
38 
39  void reset_param()
40  {
41  area = 0;
42  peak = -1;
43  ped_mean = ped_sigma = -1;
44  t_start = t_max = t_end = t_rise = -1;
45  t_cfdcross = -1;
46  }
47  };
48 
49  typedef std::vector<pmtana::pulse_param> pulse_param_array;
50 
67 
68  public:
70  PMTPulseRecoBase(const std::string name = "noname");
71 
73  virtual ~PMTPulseRecoBase() = default;
74 
76  const std::string& Name() const;
77 
79  bool Status() const;
80 
82  virtual void Reset();
83 
87  bool Reconstruct(const pmtana::Waveform_t&,
90 
95  const pulse_param& GetPulse(size_t index = 0) const;
96 
98  const pulse_param_array& GetPulses() const;
99 
101  size_t GetNPulse() const { return _pulse_v.size(); };
102 
103  private:
105  std::string _name;
106 
108  bool _status;
109 
110  protected:
111  virtual bool RecoPulse(const pmtana::Waveform_t&,
112  const pmtana::PedestalMean_t&,
113  const pmtana::PedestalSigma_t&) = 0;
114 
116  pulse_param_array _pulse_v;
117 
120 
122  std::unique_ptr<pmtana::RiseTimeCalculatorBase> _risetime_calc_ptr = nullptr;
123 
124  protected:
129  bool Integral(const std::vector<short>& wf,
130  double& result,
131  size_t begin = 0,
132  size_t end = 0) const;
133 
138  bool Derivative(const std::vector<short>& wf,
139  std::vector<int32_t>& diff,
140  size_t begin = 0,
141  size_t end = 0) const;
142 
147  size_t Max(const std::vector<short>& wf,
148  double& result,
149  size_t begin = 0,
150  size_t end = 0) const;
151 
156  size_t Min(const std::vector<short>& wf,
157  double& result,
158  size_t begin = 0,
159  size_t end = 0) const;
160  };
161 
162 }
163 #endif
164  // end of doxygen group
bool _status
Status after pulse reconstruction.
std::vector< double > PedestalSigma_t
Interfacce class for a tool to calculate the pulse rise time.
size_t GetNPulse() const
A getter for the number of reconstructed pulses from the input waveform.
pulse_param _pulse
A subject pulse_param object to be filled with the last reconstructed pulse parameters.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
ntupleExperimental Reset()
std::vector< short > Waveform_t
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
std::vector< pmtana::pulse_param > pulse_param_array
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)...