49 if (begin >= wf.size() || end >= wf.size() || begin >
end) {
51 std::cerr <<
"Invalid arguments: waveform length = " << wf.size() <<
" begin = " << begin
52 <<
" end = " << end << std::endl;
57 if (!end) end = wf.size() - 1;
80 std::cerr <<
"\033[93m" 81 <<
"Invalid pulse index: " << index <<
"\033[00m" << std::endl;
111 begin_iter = begin_iter +
begin;
113 end_iter = end_iter +
end + 1;
115 result = (double)(std::accumulate(begin_iter, end_iter, 0));
122 std::vector<int32_t>& diff,
133 for (
size_t index =
begin; index <=
end; ++index)
135 diff.push_back(wf.at(index + 1) - wf.at(index));
151 size_t target_index = wf.size() + 1;
157 for (
size_t index =
begin; index <=
end; ++index)
159 if (result < wf.at(index)) {
160 target_index = index;
161 result = (double)(wf.at(index));
176 size_t target_index = wf.size() + 1;
182 for (
size_t index =
begin; index <=
end; ++index)
184 if (result > wf.at(index)) {
185 target_index = index;
186 result = (double)(wf.at(index));
bool _status
Status after pulse reconstruction.
bool Integral(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
bool Status() const
Status getter.
std::vector< double > PedestalSigma_t
virtual void Reset()
A method to be called event-wise to reset parameters.
std::string _name
Unique name.
size_t Min(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
const std::string & Name() const
Name getter.
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.
size_t Max(const std::vector< short > &wf, double &result, size_t begin=0, size_t end=0) const
bool CheckIndex(const std::vector< short > &wf, const size_t &begin, size_t &end)
const pulse_param_array & GetPulses() const
A getter for the whole array of pulse_param struct object.
std::vector< short > Waveform_t
virtual bool RecoPulse(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)=0
bool Reconstruct(const pmtana::Waveform_t &, const pmtana::PedestalMean_t &, const pmtana::PedestalSigma_t &)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::vector< pmtana::pulse_param > pulse_param_array
Class definition file of PMTPulseRecoBase.
std::vector< double > PedestalMean_t
const pulse_param & GetPulse(size_t index=0) const
pulse_param_array _pulse_v
A container array of pulse_param struct objects to store (possibly multiple) reconstructed pulse(s)...
bool Derivative(const std::vector< short > &wf, std::vector< int32_t > &diff, size_t begin=0, size_t end=0) const
PMTPulseRecoBase(const std::string name="noname")
Default constructor with fhicl parameters.
cet::coded_exception< error, detail::translate > exception