42 bool _positive)
const override;
44 std::size_t
findFirstMax(
const std::vector<double>& arr,
double threshold)
const;
66 std::vector<double> wf_aux(ped_pulse);
68 for (
size_t ix = 0; ix < wf_aux.size(); ix++) {
69 wf_aux[ix] = ((double)wf_pulse[ix]) - wf_aux[ix];
73 for (
size_t ix = 0; ix < wf_aux.size(); ix++) {
74 wf_aux[ix] = wf_aux[ix] - ((double)wf_pulse[ix]);
82 TH1F* h_aux =
new TH1F(
"aux",
"aux", wf_aux.size(), -0.5, wf_aux.size() - 0.5);
83 for (
long unsigned int j = 0; j < wf_aux.size(); j++)
84 h_aux->SetBinContent(j + 1, wf_aux[j]);
87 TF1*
f =
new TF1(
"f",
"gaus",
double(first_max) -
fNbins,
double(first_max) +
fNbins);
88 f->SetParameters(wf_aux[first_max], first_max,
fInitSigma);
90 h_aux->Fit(f,
"q",
"SAME", first_max -
fNbins, first_max +
fNbins);
91 double t_fit = f->GetParameter(1);
99 peak_time = first_max;
100 mf::LogInfo(
"RiseTimeGaussFit") <<
"No good fit found, keeping 1st max bin instead";
112 for (std::size_t i = 1,
n = arr.size(); i <
n; ++i) {
116 else if (max < threshold)
124 mf::LogInfo(
"RiseTimeGaussFit") <<
"No local max found above fixed threshold: " << threshold;
Interfacce class for a tool to calculate the pulse rise time.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::size_t findFirstMax(const std::vector< double > &arr, double threshold) const
std::vector< short > Waveform_t
fhicl::Atom< double > MinAmp
double RiseTime(const pmtana::Waveform_t &wf_pulse, const pmtana::PedestalMean_t &ped_pulse, bool _positive) const override
fhicl::Atom< double > InitSigma
RiseTimeGaussFit(art::ToolConfigTable< Config > const &config)
std::vector< double > PedestalMean_t
fhicl::Atom< double > Tolerance