KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVAlphaCalibration Class Reference

Detailed Description

Set up and run the calibration of siliciums.

This can be used either 'interactively' or in menu-driven mode. In both cases, in order to run a calirbation, the user must specify

  • the histogram
  • the energy and normalization factor of the peaks present in the histogram
  • the parameter of the method that will initialise the position of the peaks

The role of this class is to search for a number of peaks given by the user in a histogram and to fit them in order to get several information about the response of the detectors. This class was made in order to calibrate silicium with alpha but it can be use for every detectors which response is a gaussian.

The way it has to be used

To set up the calibration class the user needs to give the number of peaks that has to be found in the constructor. If the user wants to fit several peaks with one program, it is recommended to set up only one KVAlphaCalibration class and to set the histograms in a loop, instead of using the constructor with a histogram.

Afterwards, the user needs to set the energy and the normalization factor of the peaks with the method SetPeak(). The method SetSigmaSpec needs to be used in order to set up the TSpectrum that will initialise the model, while SetSigmaFit will set the width for the model. The default value of ThresholdOfTSpectrum may be fine but if the TSpectrum find to many peaks it can be modified with SetThresholdOfTSpectrum. Finally the user just has to use the FitInit and FitSpectrum methods in order to get the results

It is possible for the user to draw the histogram, but he needs to create a canvas. The histogram will be drawn in it

Definition at line 71 of file KVAlphaCalibration.h.

#include <KVAlphaCalibration.h>

Public Member Functions

 KVAlphaCalibration (int NumberOfPeak_)
 
 KVAlphaCalibration (int NumberOfPeak_, TH1 *h)
 
 ~KVAlphaCalibration ()
 Default destructor.
 
void AddPeak (double Energy_, double Intensity_)
 
void DrawResult (bool WhatToDraw=true)
 
void FitAll (bool debug_=false)
 This function calls the FitInit and FitSpectrum function.
 
TGraphFitInit (bool debug_=false)
 
void FitSpectrum (bool debug_=false)
 
double GetGaussianFitParameter (int)
 
double GetGaussianFitParError (int)
 
double GetInitializationFitParameter (int)
 
void Init (int)
 
void PrintResult (void)
 
void SetHisto (TH1 *h)
 Set the histogram that contains the data.
 
void SetHistRange (double xmin, double xmax)
 
void SetParameters (double SigmaOfTSpectrum_=1., double SigmaOfGaussian_=1., double ThresholdOfTSpectrum_=0.5, double IsOriginAtZero_=false)
 

Private Member Functions

double FunctionToFit (double *x, double *par)
 
TF1 GetFunction (void)
 
void HistoInit (TH1 *h)
 
void SetFunction (std::string FunctionName="x*[0]")
 

Private Attributes

TGraphfactorGraph
 Graph where the initial fit is done.
 
TF1GaussianFit
 function that will fit the peaks
 
std::vector< double > GaussianFitResults
 Array that contains results of the final fit.
 
std::vector< double > GaussianFitResultsError
 Array that contains the error of the results of the final fit.
 
TH1Histo
 histogram that contains the data to fit. Set by user
 
TF1InitializationFit
 function that will do the initial fit
 
double InitializationFitResults [2]
 Array that contain the results of the initialization fit.
 
std::vector< double > InitializationPeak
 
std::vector< double > IntensityOfPeak
 array of peaks amlitude. Set by user
 
bool IsOriginAtZero
 
std::vector< double > MeanOfPeak
 array peaks energy. Set by user
 
int NumberOfPeak
 Number of Peak present in the histogram. Chose by user.
 
double SigmaOfGaussian
 Width of the peak that the model will fit chosen by user. It is possible that it has to be different from SigmaSpec to get a better fit.
 
double SigmaOfTSpectrum
 Width of the peaks that TSpectrum will search, chosen by user.
 
TSpectrumspec
 the method that will search for peaks
 
double ThresholdOfTSpectrum
 Lowest peak that the TSpectrum has to search for. It is the ratio of the highest peak that the TSpectrum found. Chosen by user.
 

Constructor & Destructor Documentation

◆ KVAlphaCalibration() [1/2]

KVAlphaCalibration::KVAlphaCalibration ( int  NumberOfPeak_)

Definition at line 15 of file KVAlphaCalibration.cpp.

◆ KVAlphaCalibration() [2/2]

KVAlphaCalibration::KVAlphaCalibration ( int  NumberOfPeak_,
TH1 h 
)

Definition at line 26 of file KVAlphaCalibration.cpp.

◆ ~KVAlphaCalibration()

KVAlphaCalibration::~KVAlphaCalibration ( )

Default destructor.

Definition at line 39 of file KVAlphaCalibration.cpp.

Member Function Documentation

◆ AddPeak()

void KVAlphaCalibration::AddPeak ( double  Energy_,
double  Intensity_ 
)

Set the energy and the normalization factor the peaks you want to fit. The normalization factor is only here to constrain the model

Definition at line 87 of file KVAlphaCalibration.cpp.

◆ DrawResult()

void KVAlphaCalibration::DrawResult ( bool  WhatToDraw = true)

Definition at line 453 of file KVAlphaCalibration.cpp.

◆ FitAll()

void KVAlphaCalibration::FitAll ( bool  debug_ = false)

This function calls the FitInit and FitSpectrum function.

Definition at line 254 of file KVAlphaCalibration.cpp.

◆ FitInit()

TGraph * KVAlphaCalibration::FitInit ( bool  debug_ = false)

This method find the peaks with a TSpectrum and fit their position to initialize the model The boolean is false by default, but it is advised to set it true in order to check if the TSpectrum find the right peaks. If not, change the parameter SigmaOfTSpectrum and ThresholdOfTSpectrum

Definition at line 272 of file KVAlphaCalibration.cpp.

◆ FitSpectrum()

void KVAlphaCalibration::FitSpectrum ( bool  debug_ = false)

This methods will use the model and fit the peaks in the histogram with a gaussian in order to get a very accurate calibration It also print the results at the end of the fit

Definition at line 338 of file KVAlphaCalibration.cpp.

◆ FunctionToFit()

double KVAlphaCalibration::FunctionToFit ( double *  x,
double *  par 
)
private

Model called by the FitSpectrum method. Can not be called by the user It consist in a sum of gaussian. The number is the number of peak given by the user

Definition at line 421 of file KVAlphaCalibration.cpp.

◆ GetFunction()

TF1 KVAlphaCalibration::GetFunction ( void  )
private

◆ GetGaussianFitParameter()

double KVAlphaCalibration::GetGaussianFitParameter ( int  j)

Get the final parameter found by the model 0 for the slope 1 for the ordinate at the origin 2 for the width factor. This factor needs to be multiplied by the energy of one peak in order to get his width 3 - NumberOfPeak + 3 for the normalization factor

Definition at line 195 of file KVAlphaCalibration.cpp.

◆ GetGaussianFitParError()

double KVAlphaCalibration::GetGaussianFitParError ( int  j)

Get the error of final parameter found by the model 0 for the error of the slope 1 for the error of the ordinate at the origin 2 for the error of the width factor. This factor needs to be multiplied by the energy of one peak in order to get his width 3 - NumberOfPeak + 3 for the error of the normalization factor

Definition at line 225 of file KVAlphaCalibration.cpp.

◆ GetInitializationFitParameter()

double KVAlphaCalibration::GetInitializationFitParameter ( int  j)

Get the initialization parameter of the model. 0 for the slope 1 for the ordinate at the origin

Definition at line 168 of file KVAlphaCalibration.cpp.

◆ HistoInit()

void KVAlphaCalibration::HistoInit ( TH1 h)
private

Definition at line 48 of file KVAlphaCalibration.cpp.

◆ Init()

void KVAlphaCalibration::Init ( int  NumberOfPeak_)

Definition at line 63 of file KVAlphaCalibration.cpp.

◆ PrintResult()

void KVAlphaCalibration::PrintResult ( void  )

Definition at line 483 of file KVAlphaCalibration.cpp.

◆ SetFunction()

void KVAlphaCalibration::SetFunction ( std::string  FunctionName = "x*[0]")
private

◆ SetHisto()

void KVAlphaCalibration::SetHisto ( TH1 h)

Set the histogram that contains the data.

Definition at line 108 of file KVAlphaCalibration.cpp.

◆ SetHistRange()

void KVAlphaCalibration::SetHistRange ( double  xmin,
double  xmax 
)

Definition at line 120 of file KVAlphaCalibration.cpp.

◆ SetParameters()

void KVAlphaCalibration::SetParameters ( double  SigmaOfTSpectrum_ = 1.,
double  SigmaOfGaussian_ = 1.,
double  ThresholdOfTSpectrum_ = 0.5,
double  IsOriginAtZero_ = false 
)

Definition at line 131 of file KVAlphaCalibration.cpp.

Member Data Documentation

◆ factorGraph

TGraph* KVAlphaCalibration::factorGraph
private

Graph where the initial fit is done.

Definition at line 91 of file KVAlphaCalibration.h.

◆ GaussianFit

TF1* KVAlphaCalibration::GaussianFit
private

function that will fit the peaks

Definition at line 90 of file KVAlphaCalibration.h.

◆ GaussianFitResults

std::vector<double> KVAlphaCalibration::GaussianFitResults
private

Array that contains results of the final fit.

Definition at line 81 of file KVAlphaCalibration.h.

◆ GaussianFitResultsError

std::vector<double> KVAlphaCalibration::GaussianFitResultsError
private

Array that contains the error of the results of the final fit.

Definition at line 82 of file KVAlphaCalibration.h.

◆ Histo

TH1* KVAlphaCalibration::Histo
private

histogram that contains the data to fit. Set by user

Definition at line 88 of file KVAlphaCalibration.h.

◆ InitializationFit

TF1* KVAlphaCalibration::InitializationFit
private

function that will do the initial fit

Definition at line 89 of file KVAlphaCalibration.h.

◆ InitializationFitResults

double KVAlphaCalibration::InitializationFitResults[2]
private

Array that contain the results of the initialization fit.

Definition at line 80 of file KVAlphaCalibration.h.

◆ InitializationPeak

std::vector<double> KVAlphaCalibration::InitializationPeak
private

Definition at line 84 of file KVAlphaCalibration.h.

◆ IntensityOfPeak

std::vector<double> KVAlphaCalibration::IntensityOfPeak
private

array of peaks amlitude. Set by user

Definition at line 93 of file KVAlphaCalibration.h.

◆ IsOriginAtZero

bool KVAlphaCalibration::IsOriginAtZero
private

Definition at line 77 of file KVAlphaCalibration.h.

◆ MeanOfPeak

std::vector<double> KVAlphaCalibration::MeanOfPeak
private

array peaks energy. Set by user

Definition at line 92 of file KVAlphaCalibration.h.

◆ NumberOfPeak

int KVAlphaCalibration::NumberOfPeak
private

Number of Peak present in the histogram. Chose by user.

Definition at line 78 of file KVAlphaCalibration.h.

◆ SigmaOfGaussian

double KVAlphaCalibration::SigmaOfGaussian
private

Width of the peak that the model will fit chosen by user. It is possible that it has to be different from SigmaSpec to get a better fit.

Definition at line 75 of file KVAlphaCalibration.h.

◆ SigmaOfTSpectrum

double KVAlphaCalibration::SigmaOfTSpectrum
private

Width of the peaks that TSpectrum will search, chosen by user.

Definition at line 74 of file KVAlphaCalibration.h.

◆ spec

TSpectrum* KVAlphaCalibration::spec
private

the method that will search for peaks

Definition at line 79 of file KVAlphaCalibration.h.

◆ ThresholdOfTSpectrum

double KVAlphaCalibration::ThresholdOfTSpectrum
private

Lowest peak that the TSpectrum has to search for. It is the ratio of the highest peak that the TSpectrum found. Chosen by user.

Definition at line 76 of file KVAlphaCalibration.h.