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. More...
 
 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. More...
 
void SetCalibrationFile (const std::string &calibFile)
 
void SetDataSetName (const std::string &dSName)
 
void SetOutputFileName (const std::string &outName)
 
 TRestDataSetCalibration ()
 Default constructor. More...
 
 TRestDataSetCalibration (const char *configFilename, std::string name="")
 Constructor loading data from a config file. More...
 
 ~TRestDataSetCalibration ()
 Default destructor. More...
 

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. More...
 
void Initialize () override
 Function to initialize input/output event members and define the section name. More...
 

Private Attributes

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

Additional Inherited Members

Constructor & Destructor Documentation

◆ TRestDataSetCalibration() [1/2]

TRestDataSetCalibration::TRestDataSetCalibration ( )

Default constructor.

Definition at line 109 of file TRestDataSetCalibration.cxx.

◆ TRestDataSetCalibration() [2/2]

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.

◆ ~TRestDataSetCalibration()

TRestDataSetCalibration::~TRestDataSetCalibration ( )

Default destructor.

Definition at line 136 of file TRestDataSetCalibration.cxx.

Member Function Documentation

◆ Calibrate()

void TRestDataSetCalibration::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.

Definition at line 181 of file TRestDataSetCalibration.cxx.

◆ GetCalibFWHM()

auto TRestDataSetCalibration::GetCalibFWHM ( ) const
inline

Definition at line 77 of file TRestDataSetCalibration.h.

◆ GetCalibPeaks()

auto TRestDataSetCalibration::GetCalibPeaks ( ) const
inline

Definition at line 76 of file TRestDataSetCalibration.h.

◆ GetCalObservable()

std::string TRestDataSetCalibration::GetCalObservable ( ) const
inline

Definition at line 81 of file TRestDataSetCalibration.h.

◆ GetIntercept()

double TRestDataSetCalibration::GetIntercept ( ) const
inline

Definition at line 80 of file TRestDataSetCalibration.h.

◆ GetSlope()

double TRestDataSetCalibration::GetSlope ( ) const
inline

Definition at line 79 of file TRestDataSetCalibration.h.

◆ InitFromConfigFile()

void TRestDataSetCalibration::InitFromConfigFile ( )
overrideprivatevirtual

Function to initialize some variables from configfile, in case that the variable is not found in the rml it checks the input file pattern.

Reimplemented from TRestMetadata.

Definition at line 149 of file TRestDataSetCalibration.cxx.

◆ Initialize()

void TRestDataSetCalibration::Initialize ( )
overrideprivatevirtual

Function to initialize input/output event members and define the section name.

Reimplemented from TRestMetadata.

Definition at line 142 of file TRestDataSetCalibration.cxx.

◆ PrintMetadata()

void TRestDataSetCalibration::PrintMetadata ( )
overridevirtual

Prints on screen the information about the metadata members of TRestDataSetCalibration.

Reimplemented from TRestMetadata.

Definition at line 275 of file TRestDataSetCalibration.cxx.

◆ SetCalibrationFile()

void TRestDataSetCalibration::SetCalibrationFile ( const std::string &  calibFile)
inline

Definition at line 74 of file TRestDataSetCalibration.h.

◆ SetDataSetName()

void TRestDataSetCalibration::SetDataSetName ( const std::string &  dSName)
inline

Definition at line 72 of file TRestDataSetCalibration.h.

◆ SetOutputFileName()

void TRestDataSetCalibration::SetOutputFileName ( const std::string &  outName)
inline

Definition at line 73 of file TRestDataSetCalibration.h.

Field Documentation

◆ fCalibFile

std::string TRestDataSetCalibration::fCalibFile = ""
private

Name of the calibration file to be used.

Definition at line 47 of file TRestDataSetCalibration.h.

◆ fCalibFWHM

std::vector<double> TRestDataSetCalibration::fCalibFWHM
private

Vector containing calibrated sigma in ADCs.

Definition at line 44 of file TRestDataSetCalibration.h.

◆ fCalibPeaks

std::vector<double> TRestDataSetCalibration::fCalibPeaks
private

Vector containing calibrated peaks in ADCs.

Definition at line 41 of file TRestDataSetCalibration.h.

◆ fCalibRange

TVector2 TRestDataSetCalibration::fCalibRange
private

Range to be calibrated.

Definition at line 53 of file TRestDataSetCalibration.h.

◆ fCalObservable

std::string TRestDataSetCalibration::fCalObservable = ""
private

Calibration variable to be used.

Definition at line 50 of file TRestDataSetCalibration.h.

◆ fDataSetName

std::string TRestDataSetCalibration::fDataSetName = ""
private

Name of the dataSet inside the config file.

Definition at line 35 of file TRestDataSetCalibration.h.

◆ fEnergyPeaks

std::vector<double> TRestDataSetCalibration::fEnergyPeaks
private

Vector containing expected energy peaks in keV must be sorted.

Definition at line 38 of file TRestDataSetCalibration.h.

◆ fIntercept

Double_t TRestDataSetCalibration::fIntercept = 0
private

Intercept of the calibration fit.

Definition at line 62 of file TRestDataSetCalibration.h.

◆ fNBins

Int_t TRestDataSetCalibration::fNBins
private

Number of bins used in the calibration.

Definition at line 56 of file TRestDataSetCalibration.h.

◆ fOutputFileName

std::string TRestDataSetCalibration::fOutputFileName = ""
private

Name of the output file.

Definition at line 32 of file TRestDataSetCalibration.h.

◆ fSlope

Double_t TRestDataSetCalibration::fSlope = 0
private

Slope from the calibration fit.

Definition at line 59 of file TRestDataSetCalibration.h.


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