REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDataSetCalibration.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see https://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see https://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
23#ifndef REST_TRestDataSetCalibration
24#define REST_TRestDataSetCalibration
25
26#include "TRestMetadata.h"
27
30 private:
32 std::string fOutputFileName = "";
33
35 std::string fDataSetName = "";
36
38 std::vector<double> fEnergyPeaks;
39
41 std::vector<double> fCalibPeaks;
42
44 std::vector<double> fCalibFWHM;
45
47 std::string fCalibFile = "";
48
50 std::string fCalObservable = "";
51
53 TVector2 fCalibRange;
54
56 Int_t fNBins;
57
59 Double_t fSlope = 0;
60
62 Double_t fIntercept = 0;
63
64 void Initialize() override;
65 void InitFromConfigFile() override;
66
67 public:
68 void PrintMetadata() override;
69
70 void Calibrate();
71
72 inline void SetDataSetName(const std::string& dSName) { fDataSetName = dSName; }
73 inline void SetOutputFileName(const std::string& outName) { fOutputFileName = outName; }
74 inline void SetCalibrationFile(const std::string& calibFile) { fCalibFile = calibFile; }
75
76 inline auto GetCalibPeaks() const { return fCalibPeaks; }
77 inline auto GetCalibFWHM() const { return fCalibFWHM; }
78
79 inline double GetSlope() const { return fSlope; }
80 inline double GetIntercept() const { return fIntercept; }
81 inline std::string GetCalObservable() const { return fCalObservable; }
82
84 TRestDataSetCalibration(const char* configFilename, std::string name = "");
86
87 ClassDefOverride(TRestDataSetCalibration, 1);
88};
89#endif
This class is meant to perform the calibration of different runs.
void Calibrate()
Performs the calibration of a given dataSet. If no calibration file is provided, it performs the gaus...
TVector2 fCalibRange
Range to be calibrated.
Double_t fIntercept
Intercept of the calibration fit.
TRestDataSetCalibration()
Default constructor.
Int_t fNBins
Number of bins used in the calibration.
std::string fCalibFile
Name of the calibration file to be used.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestDataSetCalibration()
Default destructor.
std::string fDataSetName
Name of the dataSet inside the config file.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestDataSetCalibration.
Double_t fSlope
Slope from the calibration fit.
std::vector< double > fCalibPeaks
Vector containing calibrated peaks in ADCs.
std::vector< double > fEnergyPeaks
Vector containing expected energy peaks in keV must be sorted.
std::string fOutputFileName
Name of the output file.
std::vector< double > fCalibFWHM
Vector containing calibrated sigma in ADCs.
void InitFromConfigFile() override
Function to initialize some variables from configfile, in case that the variable is not found in the ...
std::string fCalObservable
Calibration variable to be used.
A base class for any REST metadata class.
Definition: TRestMetadata.h:70