KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
KVAlphaCalibration Class Reference

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 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 70 of file KVAlphaCalibration.h.

Public Member Functions

 KVAlphaCalibration (int NumberOfPeak_)
 
 KVAlphaCalibration (int NumberOfPeak_, TH1 *h)
 
 ~KVAlphaCalibration ()
 Default destructor. More...
 
void AddPeak (double Energy_, double Intensity_)
 
void DrawResult (bool WhatToDraw=true)
 
void FitAll (bool debug_=false)
 This function calls the FitInit and FitSpectrum function. More...
 
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. More...
 
void SetHistRange (double xmin, double xmax)
 
void SetParameters (double SigmaOfTSpectrum_=1., double SigmaOfGaussian_=1., double ThresholdOfTSpectrum_=0.5, double IsOriginAtZero_=false)
 

Protected Member Functions

double FunctionToFit (double *x, double *par)
 

Protected Attributes

std::vector< doubleGaussianFitResults
 Array that contains results of the final fit. More...
 
std::vector< doubleGaussianFitResultsError
 Array that contains the error of the results of the final fit. More...
 
double InitializationFitResults [2]
 Array that contain the results of the initialization fit. More...
 
std::vector< doubleInitializationPeak
 
bool IsOriginAtZero
 
int NumberOfPeak
 Number of Peak present in the histogram. Chose by user. More...
 
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. More...
 
double SigmaOfTSpectrum
 Width of the peaks that TSpectrum will search, chosen by user. More...
 
TSpectrumspec
 the method that will search for peaks More...
 
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. More...
 

Private Member Functions

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

Private Attributes

TGraphfactorGraph
 Graph where the initial fit is done. More...
 
TF1GaussianFit
 function that will fit the peaks More...
 
TH1Histo
 histogram that contains the data to fit. Set by user More...
 
TF1InitializationFit
 function that will do the initial fit More...
 
std::vector< doubleIntensityOfPeak
 array of peaks amlitude. Set by user More...
 
std::vector< doubleMeanOfPeak
 array peaks energy. Set by user More...
 

#include <KVAlphaCalibration.h>

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 
)
protected

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 90 of file KVAlphaCalibration.h.

◆ GaussianFit

TF1* KVAlphaCalibration::GaussianFit
private

function that will fit the peaks

Definition at line 89 of file KVAlphaCalibration.h.

◆ GaussianFitResults

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

Array that contains results of the final fit.

Definition at line 80 of file KVAlphaCalibration.h.

◆ GaussianFitResultsError

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

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

Definition at line 81 of file KVAlphaCalibration.h.

◆ Histo

TH1* KVAlphaCalibration::Histo
private

histogram that contains the data to fit. Set by user

Definition at line 87 of file KVAlphaCalibration.h.

◆ InitializationFit

TF1* KVAlphaCalibration::InitializationFit
private

function that will do the initial fit

Definition at line 88 of file KVAlphaCalibration.h.

◆ InitializationFitResults

double KVAlphaCalibration::InitializationFitResults[2]
protected

Array that contain the results of the initialization fit.

Definition at line 79 of file KVAlphaCalibration.h.

◆ InitializationPeak

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

Definition at line 83 of file KVAlphaCalibration.h.

◆ IntensityOfPeak

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

array of peaks amlitude. Set by user

Definition at line 92 of file KVAlphaCalibration.h.

◆ IsOriginAtZero

bool KVAlphaCalibration::IsOriginAtZero
protected

Definition at line 76 of file KVAlphaCalibration.h.

◆ MeanOfPeak

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

array peaks energy. Set by user

Definition at line 91 of file KVAlphaCalibration.h.

◆ NumberOfPeak

int KVAlphaCalibration::NumberOfPeak
protected

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

Definition at line 77 of file KVAlphaCalibration.h.

◆ SigmaOfGaussian

double KVAlphaCalibration::SigmaOfGaussian
protected

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 74 of file KVAlphaCalibration.h.

◆ SigmaOfTSpectrum

double KVAlphaCalibration::SigmaOfTSpectrum
protected

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

Definition at line 73 of file KVAlphaCalibration.h.

◆ spec

TSpectrum* KVAlphaCalibration::spec
protected

the method that will search for peaks

Definition at line 78 of file KVAlphaCalibration.h.

◆ ThresholdOfTSpectrum

double KVAlphaCalibration::ThresholdOfTSpectrum
protected

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 75 of file KVAlphaCalibration.h.


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