Belle II Software development
|
The class holds arrays of bins and bin centers, and a wave generator object containing information on the waveform function. More...
#include <NNWaveFitTool.h>
Public Member Functions | |
NNWaveFitTool (const nnFitterBins &bins, const nnFitterBinData &binCenters, const WaveGenerator &wave) | |
Constructor takes arrays of signals and bin probabilities. | |
const nnFitterBins & | getBins () const |
Get edges of time shift bins. | |
const nnFitterBinData & | getBinCenters () const |
Get mean bin time shifts. | |
void | shiftInTime (nnFitterBinData &p, double timeShift) |
Shift the probability array in time. | |
void | multiply (nnFitterBinData &p, const nnFitterBinData &p1) |
Multiply probabilities. | |
std::shared_ptr< nnFitterBinData > | pFromInterval (double left, double right) |
Convert a uniform distribution to time-shift-like pdf. | |
std::tuple< double, double > | getTimeShift (const nnFitterBinData &p) |
Return std::tuple containing time shift and its error. | |
std::tuple< double, double, double > | getAmplitudeChi2 (const apvSamples &samples, double timeShift, double tau) |
Return std::tuple with signal amplitude, its error, and chi2 of the fit. | |
double | pLessThan (nnFitterBinData p1, nnFitterBinData p2) |
Return the probability X < Y, where X and Y are random variables with binned pdfs p1 and p2. | |
Protected Member Functions | |
void | normalize (nnFitterBinData &p) |
Normalize the probability distribution. | |
Private Attributes | |
const nnFitterBins & | m_bins |
Edges of bins. | |
const nnFitterBinData & | m_binCenters |
Centers of bins. | |
nnFitterBinData | m_altBinData |
Bin data array for re-use. | |
apvSamples | m_altSamples |
Array of 6 apv samples for re-use. | |
WaveGenerator | m_waveGenerator |
APV signal generator. | |
The class holds arrays of bins and bin centers, and a wave generator object containing information on the waveform function.
It can compute probability distribution updates in clustering, or the parameters of waveform fit, such as the time shift, amplitude and their errors, and it can do compatibility tests.
Definition at line 91 of file NNWaveFitTool.h.
|
inline |
Constructor takes arrays of signals and bin probabilities.
bins | Pointer to array of time bin edges |
binCenters | Pointer to array of mean bin times |
wave | Wave generator to generate waveform samples. |
Definition at line 98 of file NNWaveFitTool.h.
tuple< double, double, double > getAmplitudeChi2 | ( | const apvSamples & | samples, |
double | timeShift, | ||
double | tau | ||
) |
Return std::tuple with signal amplitude, its error, and chi2 of the fit.
The amplitude is calculated using linear regression through origin, its error as the error of the regression coefficient.
samples | array of 6 samples to fit |
timeShift | fitted time shift |
tau | width of the waveform |
Definition at line 27 of file NNWaveFitTool.cc.
|
inline |
Get mean bin time shifts.
Definition at line 115 of file NNWaveFitTool.h.
|
inline |
Get edges of time shift bins.
Definition at line 110 of file NNWaveFitTool.h.
tuple< double, double > getTimeShift | ( | const nnFitterBinData & | p | ) |
Return std::tuple containing time shift and its error.
p | array of bin probabilities |
Definition at line 16 of file NNWaveFitTool.cc.
|
inline |
Multiply probabilities.
Modify first probability distribution by multiplying it with the second.
Definition at line 129 of file NNWaveFitTool.h.
|
inlineprotected |
Normalize the probability distribution.
After shifting, multiplications or other ooperations on probabilities, we need to restore the normalization and re-build the list used for calculation of EmpiricalDistributionFunction. If probabilities vanish over all bins, return uniform distribution.
Definition at line 178 of file NNWaveFitTool.h.
shared_ptr< nnFitterBinData > pFromInterval | ( | double | left, |
double | right | ||
) |
Convert a uniform distribution to time-shift-like pdf.
left | Left edge of the interval |
right | Right edge of the interval |
Definition at line 66 of file NNWaveFitTool.cc.
double pLessThan | ( | nnFitterBinData | p1, |
nnFitterBinData | p2 | ||
) |
Return the probability X < Y, where X and Y are random variables with binned pdfs p1 and p2.
p1 | binned pdf for X |
p2 | binned pdf for Y |
Definition at line 78 of file NNWaveFitTool.cc.
void shiftInTime | ( | nnFitterBinData & | p, |
double | timeShift | ||
) |
Shift the probability array in time.
The method works by linearly interpolating the EmpiricalDistributionFunction to calculate values for a shifted set of bins.
p | the probability array to be modified. |
timeShift | the size of the shift. |
Definition at line 52 of file NNWaveFitTool.cc.
|
private |
Bin data array for re-use.
Definition at line 195 of file NNWaveFitTool.h.
|
private |
Array of 6 apv samples for re-use.
Definition at line 196 of file NNWaveFitTool.h.
|
private |
Centers of bins.
Definition at line 194 of file NNWaveFitTool.h.
|
private |
Edges of bins.
Definition at line 193 of file NNWaveFitTool.h.
|
private |
APV signal generator.
Definition at line 197 of file NNWaveFitTool.h.