Belle II Software  release-08-01-10
TOPTemplateFitter Class Reference

Class to perform template fit on TOP waveform data Minimzation method is described here http://wwwa1.kph.uni-mainz.de/Vorlesungen/SS11/Statistik/. More...

#include <TOPTemplateFitter.h>

Collaboration diagram for TOPTemplateFitter:

Classes

struct  FitResult
 structure holding values from template fit More...
 
struct  MinimizationSums
 Variables used during template fit minimization. More...
 
struct  TemplateParameters
 Parameters of the template function. More...
 

Public Member Functions

 TOPTemplateFitter (const TOPRawWaveform &wf, const TOPSampleTimes &sampleTimes, const double averageRMS)
 full constructor More...
 
 ~TOPTemplateFitter ()
 default destructor
 
double getChisq () const
 Returns fit chi square. More...
 
const std::vector< double > & getChisqVector () const
 Returns calculated chisq values. More...
 
const FitResultgetFitResult () const
 Returns fitted values with errors. More...
 
void performTemplateFit (const double risingEdgeStart, const double fitRange)
 Prepares data and performs the template fit in sample space. More...
 

Static Public Member Functions

static TemplateParametersgetTemplateParameters ()
 Returns the template parameters. More...
 
static int getTemplateSamples ()
 Returns the total number of template samples. More...
 
static int getTemplateResolution ()
 Returns the template resolution. More...
 
static bool getUseParabola ()
 Returns useParabola. More...
 
static void setTemplateParameters (const TemplateParameters &params)
 Sets the template parameters. More...
 
static void setTemplateSamples (int nSamples)
 Set the total number of template samples. More...
 
static void setTemplateResolution (int resolution)
 Set the template resolution. More...
 
static void setUseParabola (bool use)
 Enable Usage of parabola improvement. More...
 
static void InitializeTemplateFit ()
 Intializes the template fit using default values.
 

Private Member Functions

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 More...
 
double ComputeMinimizedParametersAndChisq (const MinimizationSums &sums, FitResult &result)
 Compute the minimized parameters and chi square value. More...
 
void CalculateParabolaVertex (const Point &p1, const Point &p2, const Point &p3, Point &vertex)
 Calculate vertex coordinates of parabola given three data points. More...
 

Private Attributes

const TOPRawWaveform m_wf
 raw sampled waveforms
 
const TOPSampleTimes m_sampleTimes
 provides timing correction
 
const double m_averageRMS
 average RMS of waveform samples, no database for this
 
FitResult m_result
 fit result from template fit
 
double m_chisq = 0
 chi square value from template fit
 
std::vector< double > m_chisq_vec
 all computed chi square values from template fit
 

Static Private Attributes

static int s_totalTemplateSamples = 64
 number of samples used for template
 
static int s_templateResolution = 4
 resolution of template with respect to normal sample spacing
 
static TemplateParameters s_templateParameters
 parameters used for the template calculation
 
static std::vector< double > s_templateSamples
 precomputed template samples
 
static int s_fineOffsetRange = TOPTemplateFitter::s_templateResolution * 5
 range for offset between template and signal
 
static bool s_templateReInitialize = true
 flag showing that the template samples have to be recomputed
 
static bool s_useParabola = true
 try improving fit by making use of parabolic shape of chisq values
 

Detailed Description

Class to perform template fit on TOP waveform data Minimzation method is described here http://wwwa1.kph.uni-mainz.de/Vorlesungen/SS11/Statistik/.

Definition at line 30 of file TOPTemplateFitter.h.

Constructor & Destructor Documentation

◆ TOPTemplateFitter()

TOPTemplateFitter ( const TOPRawWaveform wf,
const TOPSampleTimes sampleTimes,
const double  averageRMS 
)

full constructor

Parameters
wfTOP raw waveform samples
sampleTimesdatabase object holding time correction
averageRMSaverage sample RMS

Definition at line 28 of file TOPTemplateFitter.cc.

31  : m_wf(wf), m_sampleTimes(sampleTimes), m_averageRMS(averageRMS)
32 {
33  m_chisq = -1.;
36  }
37 }
static void InitializeTemplateFit()
Intializes the template fit using default values.
const TOPRawWaveform m_wf
raw sampled waveforms
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
double m_chisq
chi square value from template fit
const TOPSampleTimes m_sampleTimes
provides timing correction

Member Function Documentation

◆ CalculateParabolaVertex()

void CalculateParabolaVertex ( const Point &  p1,
const Point &  p2,
const Point &  p3,
Point &  vertex 
)
private

Calculate vertex coordinates of parabola given three data points.

Parameters
p1data point 1
p2data point 2
p3data point 3
vertexvertex position

Definition at line 108 of file TOPTemplateFitter.cc.

◆ ComputeMinimizedParametersAndChisq()

double ComputeMinimizedParametersAndChisq ( const MinimizationSums sums,
FitResult result 
)
private

Compute the minimized parameters and chi square value.

Parameters
sumsminimization sums for chisq calculation
resultminimized parameters
Returns
chi square

Definition at line 165 of file TOPTemplateFitter.cc.

◆ getChisq()

double getChisq ( ) const
inline

Returns fit chi square.

Returns
fit chi square

Definition at line 109 of file TOPTemplateFitter.h.

109 {return m_chisq;}

◆ getChisqVector()

const std::vector<double>& getChisqVector ( ) const
inline

Returns calculated chisq values.

Returns
chisq vector

Definition at line 115 of file TOPTemplateFitter.h.

◆ getFitResult()

const FitResult& getFitResult ( ) const
inline

Returns fitted values with errors.

Returns
fitted values with errors

Definition at line 121 of file TOPTemplateFitter.h.

◆ getTemplateParameters()

static TemplateParameters& getTemplateParameters ( )
inlinestatic

Returns the template parameters.

Returns
template parameters

Definition at line 127 of file TOPTemplateFitter.h.

◆ getTemplateResolution()

static int getTemplateResolution ( )
inlinestatic

Returns the template resolution.

Returns
template resolution

Definition at line 139 of file TOPTemplateFitter.h.

◆ getTemplateSamples()

static int getTemplateSamples ( )
inlinestatic

Returns the total number of template samples.

Returns
total number of template samples

Definition at line 133 of file TOPTemplateFitter.h.

◆ getUseParabola()

static bool getUseParabola ( )
inlinestatic

Returns useParabola.

Returns
useParabola

Definition at line 145 of file TOPTemplateFitter.h.

◆ performTemplateFit()

void performTemplateFit ( const double  risingEdgeStart,
const double  fitRange 
)

Prepares data and performs the template fit in sample space.

Parameters
risingEdgeStartinitial guess for rising edge position from CFD
fitRangerange of template fit

Definition at line 78 of file TOPTemplateFitter.cc.

◆ PerformTemplateFitMinimize()

void PerformTemplateFitMinimize ( const std::vector< short > &  samples,
const std::vector< short > &  pedestals,
const std::vector< float > &  timingCorrection,
const double  risingEdgeCFD,
const double  fitRange 
)
private

performs the template fit

Parameters
samplessample vector
pedestalspedestal vector
timingCorrectiontiming correction for samples
risingEdgeCFDrising edge from constant fraction discrimination
fitRangefit range

Definition at line 122 of file TOPTemplateFitter.cc.

◆ setTemplateParameters()

void setTemplateParameters ( const TemplateParameters params)
static

Sets the template parameters.

Parameters
paramstemplate Parameters

Definition at line 39 of file TOPTemplateFitter.cc.

◆ setTemplateResolution()

void setTemplateResolution ( int  resolution)
static

Set the template resolution.

Parameters
resolutiontemplate resolution

Definition at line 52 of file TOPTemplateFitter.cc.

◆ setTemplateSamples()

void setTemplateSamples ( int  nSamples)
static

Set the total number of template samples.

Parameters
nSamplestotal number of template samples

Definition at line 45 of file TOPTemplateFitter.cc.

◆ setUseParabola()

static void setUseParabola ( bool  use)
inlinestatic

Enable Usage of parabola improvement.

Parameters
useenable/disable usage

Definition at line 169 of file TOPTemplateFitter.h.


The documentation for this class was generated from the following files: