KaliVeda
Toolkit for HIC analysis
|
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.
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. | |
TGraph * | FitInit (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 | |
TGraph * | factorGraph |
Graph where the initial fit is done. | |
TF1 * | GaussianFit |
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. | |
TH1 * | Histo |
histogram that contains the data to fit. Set by user | |
TF1 * | InitializationFit |
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. | |
TSpectrum * | spec |
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. | |
KVAlphaCalibration::KVAlphaCalibration | ( | int | NumberOfPeak_ | ) |
Definition at line 15 of file KVAlphaCalibration.cpp.
KVAlphaCalibration::KVAlphaCalibration | ( | int | NumberOfPeak_, |
TH1 * | h | ||
) |
Definition at line 26 of file KVAlphaCalibration.cpp.
KVAlphaCalibration::~KVAlphaCalibration | ( | ) |
Default destructor.
Definition at line 39 of file KVAlphaCalibration.cpp.
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.
void KVAlphaCalibration::DrawResult | ( | bool | WhatToDraw = true | ) |
Definition at line 453 of file KVAlphaCalibration.cpp.
void KVAlphaCalibration::FitAll | ( | bool | debug_ = false | ) |
This function calls the FitInit and FitSpectrum function.
Definition at line 254 of file KVAlphaCalibration.cpp.
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.
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.
|
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.
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.
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.
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.
Definition at line 48 of file KVAlphaCalibration.cpp.
void KVAlphaCalibration::Init | ( | int | NumberOfPeak_ | ) |
Definition at line 63 of file KVAlphaCalibration.cpp.
Definition at line 483 of file KVAlphaCalibration.cpp.
|
private |
Set the histogram that contains the data.
Definition at line 108 of file KVAlphaCalibration.cpp.
void KVAlphaCalibration::SetHistRange | ( | double | xmin, |
double | xmax | ||
) |
Definition at line 120 of file KVAlphaCalibration.cpp.
void KVAlphaCalibration::SetParameters | ( | double | SigmaOfTSpectrum_ = 1. , |
double | SigmaOfGaussian_ = 1. , |
||
double | ThresholdOfTSpectrum_ = 0.5 , |
||
double | IsOriginAtZero_ = false |
||
) |
Definition at line 131 of file KVAlphaCalibration.cpp.
|
private |
Graph where the initial fit is done.
Definition at line 91 of file KVAlphaCalibration.h.
|
private |
function that will fit the peaks
Definition at line 90 of file KVAlphaCalibration.h.
|
private |
Array that contains results of the final fit.
Definition at line 81 of file KVAlphaCalibration.h.
|
private |
Array that contains the error of the results of the final fit.
Definition at line 82 of file KVAlphaCalibration.h.
|
private |
histogram that contains the data to fit. Set by user
Definition at line 88 of file KVAlphaCalibration.h.
|
private |
function that will do the initial fit
Definition at line 89 of file KVAlphaCalibration.h.
|
private |
Array that contain the results of the initialization fit.
Definition at line 80 of file KVAlphaCalibration.h.
|
private |
Definition at line 84 of file KVAlphaCalibration.h.
|
private |
array of peaks amlitude. Set by user
Definition at line 93 of file KVAlphaCalibration.h.
|
private |
Definition at line 77 of file KVAlphaCalibration.h.
|
private |
array peaks energy. Set by user
Definition at line 92 of file KVAlphaCalibration.h.
|
private |
Number of Peak present in the histogram. Chose by user.
Definition at line 78 of file KVAlphaCalibration.h.
|
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.
|
private |
Width of the peaks that TSpectrum will search, chosen by user.
Definition at line 74 of file KVAlphaCalibration.h.
|
private |
the method that will search for peaks
Definition at line 79 of file KVAlphaCalibration.h.
|
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.