10#ifndef _SVD_RECONSTRUCTION_NNWAVEFITTOOL_H
11#define _SVD_RECONSTRUCTION_NNWAVEFITTOOL_H
19#include <svd/simulation/SVDSimulationTools.h>
50 auto ibin =
m_bins.begin();
53 *ipt++ = std::make_pair(*ibin++, cp);
56 *ipt++ = std::make_pair(*ibin++, cp);
67 if (t >
m_pTable.back().first)
return 1.0;
68 if (t <
m_pTable[0].first)
return 0.0;
69 auto it = lower_bound(
m_pTable.begin(),
m_pTable.end(), std::make_pair(t, 0.0));
70 if (it ==
m_pTable.begin())
return it->second;
73 double result = it2->second + (it->second - it2->second) * (t - it2->first) / (it->first - it2->first);
79 std::vector<std::pair<double, double> >
m_pTable;
131 std::transform(p.begin(), p.end(),
132 p1.begin(), p.begin(), std::multiplies<double>());
142 std::shared_ptr<nnFitterBinData>
pFromInterval(
double left,
double right);
160 std::tuple<double, double, double>
180 double pnorm = std::accumulate(p.begin(), p.end(), 0.0);
182 if (pnorm < 1.0e-10) {
183 double uniformP = 1.0 / std::distance(p.begin(), p.end());
184 std::fill(p.begin(), p.end(), uniformP);
187 std::transform(p.begin(), p.end(), p.begin(),
188 std::bind(std::divides<double>(), std::placeholders::_1, pnorm));
Empirical distribution function object is basic for mainpulation of probabilities.
double operator()(double t)
EmpiricalDistributionFunction(t) gives edf value at time t, linearly interpolated from cummulative bi...
std::vector< std::pair< double, double > > m_pTable
(bin, prob) pairs
EmpiricalDistributionFunction(const nnFitterBinData &p, const nnFitterBins &bins)
Constructor constructs edf object from a probability distribution.
const nnFitterBins & m_bins
array of bin boundaries.
Waveform generator This is a functor to calculate APV samples from waveform.
std::array< apvSampleBaseType, nAPVSamples > apvSamples
vector od apvSample BaseType objects
std::vector< double > nnFitterBins
Vector of bin edges, nnFitterBinData.size() + 1.
std::vector< double > nnFitterBinData
Vector of values defined for bins, such as bin times or bin probabilities.
Abstract base class for different kinds of events.