46 return z * std::exp(1.0 - z);
81 void addData(
const std::array<double, 6>& inpData,
double rmsNoise)
83 std::array<double, 6> v;
84 std::copy(inpData.begin(), inpData.end(), v.begin());
171 double Chi(
double t);
185 double lrSignal(
double a,
double b);
209 double integral12(
double lower,
double upper, std::function<
double(
double)> f);
211 double integral20(
double lower,
double upper, std::function<
double(
double)> f);
A functor to provide a simple model of APV25 strip response.
static double s_default_tau
Default waveform decay time.
double getTau() const
return the decay time
DefaultWave(double tau=s_default_tau)
Constructor takes waveform decay time as parameter.
double getValue(double t) const
getValue() returns the value at desired time and time shift.
double m_tau
Waveform decay time.
double m_fittedTimeError
Error estimate of the fitted time.
const std::vector< double > & getFittedAmplitudes()
Retrieve strip amplitudes after a fit.
std::vector< std::array< double, 6 > > strip_data_type
Function type for cluster data.
std::vector< double > m_fittedAmplitudes
Fitted amplitudes of the sample.
strip_data_type m_fittedData
Fitted values from current fit.
static int s_minimizer_precision
minimizer precision
double getFittedTime()
Retrieve fitted time shift value after a fit.
std::vector< double > m_noises
RMS noise for strips.
double getDt() const
Get sampling interval.
const strip_data_type & getFitData()
Get fitted values for all samples.
double getFitLikelihood()
Return negative log-likelihood for the fit.
strip_data_type m_data
Vector of sextets of APV samples.
double pSignal()
Calculate probability of the hit being a signal, with given priors for signal and background.
void doFit()
Perform fit on the data.
const strip_data_type & getData() const
Get original fitted data.
std::vector< double > m_fittedAmplitudeErrors
Fitted amplitude errors.
const std::vector< double > & getFittedAmplitudeErrors()
Retrieve errors of strip amplitudes after a fit.
double m_dt
Time interval between samples.
double wave(double t) const
Get unit waveform value at a given time.
const std::array< double, 6 > & getTimes() const
Get sample times.
void calculateFitErrors()
Calculate fit errors.
double getFittedTimeError()
Retrieve error of time shift value after a fit.
void addData(const std::array< double, 6 > &inpData, double rmsNoise)
Add strip data to the fitter.
double integral12(double lower, double upper, std::function< double(double)> f)
High-order Gauss-Legendre quadrature for likelihood integrals.
double negLogLikelihood(double t)
Get negative profile log-likelihood for a given time shift.
double integral20(double lower, double upper, std::function< double(double)> f)
High-order Gauss-Legendre quadrature for likelihood integrals.
int m_ndf
Degrees of freedom of the fit.
static void setPrecision(int ndigits)
Set precision of the minimzer.
double m_fittedTime
Time from interval (-dt,+dt).
wave_function_type m_wave
Waveform function.
void calculateFittedData()
Calculate fitted data.
WaveFitter(wave_function_type wave, std::array< double, 6 > times)
Constructor creates an empty fitter with default settings.
void calculateAmplitudes()
Calculate amplitudes.
double lrSignal(double a, double b)
Calculate likelihood ratio Lsignal/Lbackground for acceptance (signal) window given as arguments.
std::array< double, 6 > m_times
Vector of sample times.
double m_fittedLik
Chi2 from the current fit.
void reset()
Reset fitter data.
std::function< double(double)> wave_function_type
Function type for waveform.
bool m_hasFit
Are fit results available?
double Chi(double t)
Get standardized chi2 for a given time shift.
Abstract base class for different kinds of events.