9#include <svd/reconstruction/NNWaveFitTool.h>
19 double timeShift = inner_product(p.begin(), p.end(),
m_binCenters.begin(), 0.0);
22 [timeShift](
double t)->double { return (t - timeShift) * (t - timeShift);});
23 double timeShiftError =
sqrt(inner_product(p.begin(), p.end(),
m_altBinData.begin(), 0.0));
24 return make_tuple(timeShift, timeShiftError);
28 double timeShift,
double tau)
32 double waveNorm = inner_product(
33 tw.begin(), tw.end(), tw.begin(), 0.0);
34 double amplitude = 0.0;
35 double amplitudeError = 100.0;
37 amplitude = inner_product(samples.begin(), samples.end(),
38 tw.begin(), 0.0) / waveNorm;
39 amplitudeError = 1.0 /
sqrt(waveNorm);
42 transform(samples.begin(), samples.end(), tw.begin(),
m_altSamples.begin(),
43 [amplitude](
double s,
double w)->double { return s - w* amplitude;});
44 size_t ndf = accumulate(samples.begin(), samples.end(),
size_t(0),
45 [](
size_t sum,
double x)->size_t { return ((x > 3) ? sum + 1 : sum); }
49 return make_tuple(amplitude, amplitudeError, chi2);
56 auto ibin =
m_bins.begin();
57 double lowEdf = edf(-timeShift + *ibin++);
58 for (
auto& prob : p) {
59 double highEdf = edf(-timeShift + *ibin++);
60 prob = highEdf - lowEdf;
68 auto uniCdf = [left, right](
double x)->
double {
69 if (x < left)
return 0.0;
70 if (x > right)
return 1.0;
71 return (x - left) / (right - left);
74 for (
size_t i = 1; i <
m_bins.size(); ++i)(*result)[i - 1] = uniCdf(
m_bins[i] -
m_bins[i - 1]);
Empirical distribution function object is basic for mainpulation of probabilities.
double sqrt(double a)
sqrt for double
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
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.