11#include <top/dataobjects/TOPRawWaveform.h>
12#include <top/dbobjects/TOPSampleTimes.h>
24 using Point = std::pair<double, double>;
99 const double averageRMS);
182 const double fitRange);
195 const std::vector<float>& timingCorrection,
const double risingEdgeCFD,
196 const double fitRange);
Calibration constants of a singe ASIC channel: time axis (sample times)
Class to perform template fit on TOP waveform data Minimzation method is described here http://wwwa1....
static int s_fineOffsetRange
range for offset between template and signal
static void InitializeTemplateFit()
Intializes the template fit using default values.
static TemplateParameters s_templateParameters
parameters used for the template calculation
std::vector< double > m_chisq_vec
all computed chi square values from template fit
static void setUseParabola(bool use)
Enable Usage of parabola improvement.
const TOPRawWaveform m_wf
raw sampled waveforms
double getChisq() const
Returns fit chi square.
void PerformTemplateFitMinimize(const std::vector< short > &samples, const std::vector< short > &pedestals, const std::vector< float > &timingCorrection, const double risingEdgeCFD, const double fitRange)
performs the template fit
void performTemplateFit(const double risingEdgeStart, const double fitRange)
Prepares data and performs the template fit in sample space.
static bool s_templateReInitialize
flag showing that the template samples have to be recomputed
const double m_averageRMS
average RMS of waveform samples, no database for this
static int s_templateResolution
resolution of template with respect to normal sample spacing
void CalculateParabolaVertex(const Point &p1, const Point &p2, const Point &p3, Point &vertex)
Calculate vertex coordinates of parabola given three data points.
static void setTemplateParameters(const TemplateParameters ¶ms)
Sets the template parameters.
double m_chisq
chi square value from template fit
static void setTemplateSamples(int nSamples)
Set the total number of template samples.
FitResult m_result
fit result from template fit
const TOPSampleTimes m_sampleTimes
provides timing correction
const FitResult & getFitResult() const
Returns fitted values with errors.
double ComputeMinimizedParametersAndChisq(const MinimizationSums &sums, FitResult &result)
Compute the minimized parameters and chi square value.
static std::vector< double > s_templateSamples
precomputed template samples
static int getTemplateResolution()
Returns the template resolution.
~TOPTemplateFitter()
default destructor
static bool s_useParabola
try improving fit by making use of parabolic shape of chisq values
static TemplateParameters & getTemplateParameters()
Returns the template parameters.
static void setTemplateResolution(int resolution)
Set the template resolution.
static int getTemplateSamples()
Returns the total number of template samples.
static int s_totalTemplateSamples
number of samples used for template
static bool getUseParabola()
Returns useParabola.
const std::vector< double > & getChisqVector() const
Returns calculated chisq values.
Abstract base class for different kinds of events.
structure holding values from template fit
double amplitude
fitted amplitude
double amplitudeError
fitted amplitude error
void clear()
set the fit result variables to zero
double risingEdge
fitted rising edge
double backgroundOffsetError
fitted background offset error
double backgroundOffset
fitted background offset
Variables used during template fit minimization.
double Sxy
sum of signal sample *template*weight
double Syy
sum of signal sample * signal sample * weight
double Sx
sum of template*weight
double Sxx
sum of template*template*weight
void clear()
set sums used during template fit to initial values
double Sy
sum of signal sample * weight
double S1
sum of sample weights
Parameters of the template function.
double amplitude
amplitude of template function
double risingEdge
rising edge position of template in samples