REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Private Member Functions | Private Attributes
TRestDataSetCalibration Class Reference

Detailed Description

This class is meant to perform the calibration of different runs.

TRestDataSetCalibration performs the calibration of a TRestDataSet, the calibration is performed over different peaks provided in the config file. The first peak provided in the config file should correspond to the maximum in the spectra. The expected position of the rest of the peaks are estimated with respect to the maximum.

A summary of the basic parameters is described below:

The energy peaks to calibrate are given using peak metadata:

The following metadata members are used as output after the fit:

If an output file name is provided a new dataset will be generated with the corresponding metadata and calibration constants, while adding a new observable, calib_energy. In addition, the spectrum and the fit results will be stored in the output file.

Examples

RML example to calibrate a dataset with a peak at 5.89 keV

<TRestDataSetCalibration name="EnergyCalibration" verboseLevel="info">
<peak energy="5.899" />
<parameter name="calObservable" value="tckAna_MaxTrackEnergy"/>
<parameter name="nBins" value="1024"/>
<parameter name="calibRange" value="(0,20000)" />
<parameter name="dataSetName" value="myDataSet.root"/>
This class is meant to perform the calibration of different runs.

Example to perform calibration over a calibration dataSet using restRoot:

[0] TRestDataSetCalibration cal ("calibration.rml");
[1] cal.SetDataSetName("myDataSet.root");
[2] cal.SetOutputFileName("myCalibratedDataSet.root");
[3] cal.Calibrate();

Example to perform calibration over a background dataSet using restRoot:

[0] TRestDataSetCalibration cal ("calibration.rml");
[1] cal.SetDataSetName("myBackgroundDataSet.root");
[2] cal.SetOutputFileName("myBackgroundCalibratedDataSet.root");
[3] cal.SetCalibrationFile("myCalibratedDataSet.root");
[4] cal.Calibrate();

REST-for-Physics - Software for Rare Event Searches Toolkit

History of developments:

2023-03: First implementation of TRestDataSetCalibration JuanAn Garcia

Author
: JuanAn Garcia e-mail: juana.nosp@m.ngp@.nosp@m.uniza.nosp@m.r.es

Definition at line 29 of file TRestDataSetCalibration.h.

#include <TRestDataSetCalibration.h>

Inheritance diagram for TRestDataSetCalibration:
TRestMetadata

Public Member Functions

void Calibrate ()
 Performs the calibration of a given dataSet. If no calibration file is provided, it performs the gaussian fit to the different parameters provided in the config file. Otherwise, it takes the calibration constants from the provided calibration file.
 
 ClassDefOverride (TRestDataSetCalibration, 1)
 
auto GetCalibFWHM () const
 
auto GetCalibPeaks () const
 
std::string GetCalObservable () const
 
double GetIntercept () const
 
double GetSlope () const
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestDataSetCalibration.
 
void SetCalibrationFile (const std::string &calibFile)
 
void SetDataSetName (const std::string &dSName)
 
void SetOutputFileName (const std::string &outName)
 
 TRestDataSetCalibration ()
 Default constructor.
 
 TRestDataSetCalibration (const char *configFilename, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestDataSetCalibration ()
 Default destructor.
 

Private Member Functions

void InitFromConfigFile () override
 Function to initialize some variables from configfile, in case that the variable is not found in the rml it checks the input file pattern.
 
void Initialize () override
 Function to initialize input/output event members and define the section name.
 

Private Attributes

std::string fCalibFile = ""
 Name of the calibration file to be used.
 
std::vector< double > fCalibFWHM
 Vector containing calibrated sigma in ADCs.
 
std::vector< double > fCalibPeaks
 Vector containing calibrated peaks in ADCs.
 
TVector2 fCalibRange
 Range to be calibrated.
 
std::string fCalObservable = ""
 Calibration variable to be used.
 
std::string fDataSetName = ""
 Name of the dataSet inside the config file.
 
std::vector< double > fEnergyPeaks
 Vector containing expected energy peaks in keV must be sorted.
 
Double_t fIntercept = 0
 Intercept of the calibration fit.
 
Int_t fNBins
 Number of bins used in the calibration.
 
std::string fOutputFileName = ""
 Name of the output file.
 
Double_t fSlope = 0
 Slope from the calibration fit.
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ TRestDataSetCalibration()

TRestDataSetCalibration::TRestDataSetCalibration ( const char *  configFilename,
std::string  name = "" 
)

Constructor loading data from a config file.

If no configuration path is defined using TRestMetadata::SetConfigFilePath the path to the config file must be specified using full path, absolute or relative.

The default behaviour is that the config file must be specified with full path, absolute or relative.

Parameters
configFilenameA const char* that defines the RML filename.
nameThe name of the metadata section. It will be used to find the corresponding TRestDataSetCalibration section inside the RML.

Definition at line 125 of file TRestDataSetCalibration.cxx.


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