REST-for-Physics
v2.3
Rare Event Searches ToolKit for Physics
|
Definition at line 124 of file TRestDataSetGainMap.h.
Public Member Functions | |
void | AddPeak (const double &energyPeak, const TVector2 &rangePeak=TVector2(0, 0)) |
void | DrawFullSpectrum (const bool drawFits=true, const int color=-1, TCanvas *c=nullptr) |
void | DrawGainMap (const int peakNumber=0, const bool fullModuleAsRef=true) |
Function to draw the relative gain map for a given energy peak of the module. More... | |
void | DrawLinearFit (const int index_x, const int index_y, TCanvas *c=nullptr) |
void | DrawLinearFit (const TVector2 &position, TCanvas *c=nullptr) |
void | DrawLinearFit (TCanvas *c=nullptr) |
void | DrawSpectrum (const bool drawFits=true, const int color=-1, TCanvas *c=nullptr) |
Function to draw the spectrum for each segment of the module on the same canvas. The canvas is divided in fNumberOfSegmentsX x fNumberOfSegmentsY pads. The segments are drawn with the bottom left corner corresponding to the minimun x and y values of the readout range and top right corner corresponding to the maximum x and y values of the readout range. Tip: define a canvas and use this same canvas along different calls to this function to draw the spectra of different modules on the same canvas. Example: TCanvas *myCanvas = new TCanvas(); module1->DrawSpectrum(false, kBlue, myCanvas); module2->DrawSpectrum(false, kRed, myCanvas);. More... | |
void | DrawSpectrum (const int index_x, const int index_y, bool drawFits=true, int color=-1, TCanvas *c=nullptr) |
void | DrawSpectrum (const TVector2 &position, bool drawFits=true, int color=-1, TCanvas *c=nullptr) |
void | GenerateGainMap () |
Function that calculates the calibration parameters for each segment defined at fSplitX and fSplitY ang generate their spectra and gain map. More... | |
std::string | GetDataSetFileName () const |
std::pair< int, int > | GetIndexMatrix (const double x, const double y) const |
Function to get the index of the matrix of calibration parameters for a given x and y position on the detector plane. More... | |
double | GetIntercept (const double x, const double y) const |
Function to get the calibration parameter intercept for a given x and y position on the detector plane. More... | |
double | GetInterceptFullSpc () const |
std::string | GetModuleDefinitionCut () const |
Int_t | GetModuleId () const |
Int_t | GetNumberOfSegmentsX () const |
Int_t | GetNumberOfSegmentsY () const |
std::string | GetObservable () const |
TRestDataSetGainMap * | GetParent () const |
Int_t | GetPlaneId () const |
TVector2 | GetReadoutRange () const |
double | GetSlope (const double x, const double y) const |
Function to get the calibration parameter slope for a given x and y position on the detector plane. More... | |
double | GetSlopeFullSpc () const |
std::string | GetSpatialObservableX () const |
std::string | GetSpatialObservableY () const |
std::set< double > | GetSplitX () const |
std::set< double > | GetSplitY () const |
void | Initialize () |
void | LoadConfigFromTiXmlElement (const TiXmlElement *module) |
Function to read the parameters from the RML element (TiXmlElement) and set those class members. More... | |
Module (const TRestDataSetGainMap &parent) | |
Module (const TRestDataSetGainMap &parent, const Int_t planeId, const Int_t moduleId) | |
void | Print () const |
Prints on screen the information about the members of Module. | |
void | Refit (const size_t x, const size_t y, const size_t peakNumber, const TVector2 &range) |
Function to fit again manually a peak for a given segment of the module. The calibration curve is updated after the fit. More... | |
void | Refit (const TVector2 &position, const double energy, const TVector2 &range) |
Function to fit again manually a peak for a given segment of the module. More... | |
void | RefitFullSpc (const double energy, const TVector2 &range) |
Function to fit again manually a peak for the whole module spectrum. The calibration curve is updated after the fit. More... | |
void | RefitFullSpc (const size_t peakNumber, const TVector2 &range) |
Function to fit again manually a peak for the whole module spectrum. The calibration curve is updated after the fit. More... | |
void | SetAutoRangePeaks (const bool &autoRangePeaks) |
void | SetCalibrationRange (const TVector2 &calibrationRange) |
void | SetDataSetFileName (const std::string &dataSetFileName) |
void | SetModuleDefinitionCut (const std::string &moduleDefinitionCut) |
void | SetModuleId (const Int_t &moduleId) |
void | SetNBins (const Int_t &nBins) |
void | SetNumberOfSegmentsX (const Int_t &numberOfSegmentsX) |
void | SetNumberOfSegmentsY (const Int_t &numberOfSegmentsY) |
void | SetPlaneId (const Int_t &planeId) |
void | SetReadoutRange (const TVector2 &readoutRange) |
void | SetSplits () |
Function to set the class members for segmentation of the detector plane along the X and Y axis. | |
void | SetSplits (const std::set< double > &splitXandY) |
void | SetSplitX () |
Function to set the class members for segmentation of the detector plane along the X axis. More... | |
void | SetSplitX (const std::set< double > &splitX) |
void | SetSplitY () |
Function to set the class members for segmentation of the detector plane along the Y axis. More... | |
void | SetSplitY (const std::set< double > &splitY) |
void | SetZeroPoint (const bool &ZeroPoint) |
void | UpdateCalibrationFits (const size_t x, const size_t y) |
Function to update the calibration curve for a given segment of the module. The calibration curve is cleared and then the means of the gaussian fits for each energy peak are added. If there are less than 2 fits, zero points are added. Then, the calibration curve is refitted (linearFit). More... | |
void | UpdateCalibrationFitsFullSpc () |
Function to update the calibration curve for the whole module. The calibration curve is cleared and then the means of the gaussian fits for each energy peak are added. If there are less than 2 fits, zero points are added. Then, the calibration curve is refitted (linearFit). | |
Data Fields | |
bool | fAutoRangePeaks = true |
Automatic range for the peaks fitting. See GenerateGainMap() for more information of the logic. | |
TVector2 | fCalibRange = TVector2(0, 0) |
Calibration range. If fCalibRange.X()>=fCalibRange.Y() the range will be automatically calculated. | |
std::string | fDataSetFileName = "" |
std::string | fDefinitionCut = "" |
Cut that defines which events are from this module. | |
std::vector< double > | fEnergyPeaks = {} |
Energy of the peaks to be used for the calibration. | |
double | fFullIntercept = 0 |
Intercept of the calibration linear fit of whole module. | |
TGraph * | fFullLinearFit = nullptr |
Calibration linear fit for the whole module. | |
double | fFullSlope = 0 |
Slope of the calibration linear fit of whole module. | |
TH1F * | fFullSpectrum = nullptr |
Spectrum of the observable for the whole module. | |
std::vector< std::vector< double > > | fIntercept = {} |
Array containing the intercept of the linear fit for each segment. | |
Int_t | fModuleId = -1 |
Int_t | fNBins = 100 |
Number of bins for the spectrum histograms. | |
Int_t | fNumberOfSegmentsX = 1 |
Number of segments in the x direction. | |
Int_t | fNumberOfSegmentsY = 1 |
Number of segments in the y direction. | |
Int_t | fPlaneId = -1 |
std::vector< TVector2 > | fRangePeaks = {} |
Range of the peaks to be used for the calibration. If empty it will be automatically calculated. | |
TVector2 | fReadoutRange = TVector2(-1, 246.24) |
Readout dimensions. | |
std::vector< std::vector< TGraph * > > | fSegLinearFit = {} |
Array containing the calibration linear fit for each segment. | |
std::vector< std::vector< TH1F * > > | fSegSpectra = {} |
Array containing the observable spectrum for each segment. | |
std::vector< std::vector< double > > | fSlope = {} |
Array containing the slope of the linear fit for each segment. | |
std::set< double > | fSplitX = {} |
Split points in the x direction. | |
std::set< double > | fSplitY = {} |
Split points in the y direction. | |
bool | fZeroPoint = false |
Private Member Functions | |
std::pair< double, double > | FitPeaks (TH1F *hSeg, TGraph *gr) |
std::pair< double, double > | UpdateCalibrationFits (TH1F *hSeg, TGraph *gr) |
Private Attributes | |
const TRestDataSetGainMap * | p = nullptr |
Pointer to the parent class. | |
void TRestDataSetGainMap::Module::DrawGainMap | ( | const int | peakNumber = 0 , |
const bool | fullModuleAsRef = true |
||
) |
Function to draw the relative gain map for a given energy peak of the module.
peakNumber | The index of the peak to be drawn (remember they are in descending order). |
fullModuleAsRef | If true, it will use the peak position at the full module spectrum as reference for the gain map. If false, it will use the centered segment of the module as reference. |
Definition at line 1409 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::DrawSpectrum | ( | const bool | drawFits = true , |
const int | color = -1 , |
||
TCanvas * | c = nullptr |
||
) |
Function to draw the spectrum for each segment of the module on the same canvas. The canvas is divided in fNumberOfSegmentsX x fNumberOfSegmentsY pads. The segments are drawn with the bottom left corner corresponding to the minimun x and y values of the readout range and top right corner corresponding to the maximum x and y values of the readout range. Tip: define a canvas and use this same canvas along different calls to this function to draw the spectra of different modules on the same canvas. Example: TCanvas *myCanvas = new TCanvas(); module1->DrawSpectrum(false, kBlue, myCanvas); module2->DrawSpectrum(false, kRed, myCanvas);.
drawFits | A bool to also draw the fits or not. |
color | An int to set the color of the spectra. If negative, the color of the spectra is not changed. |
c | A TCanvas pointer to draw the spectra. If none (nullptr) is given, a new one is created. |
Definition at line 1277 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::GenerateGainMap | ( | ) |
Function that calculates the calibration parameters for each segment defined at fSplitX and fSplitY ang generate their spectra and gain map.
It uses the data of the observable fObservable from the TRestDataSet at fDataSetFileName (or fCalibFileName if first is empty). The segmentation is given by the splits.
Ranges for peak fitting follows this logic:
Definition at line 707 of file TRestDataSetGainMap.cxx.
std::pair< int, int > TRestDataSetGainMap::Module::GetIndexMatrix | ( | const double | x, |
const double | y | ||
) | const |
Function to get the index of the matrix of calibration parameters for a given x and y position on the detector plane.
x | A const double that defines the x position on the detector plane. |
y | A const double that defines the y position on the detector plane. |
Definition at line 544 of file TRestDataSetGainMap.cxx.
double TRestDataSetGainMap::Module::GetIntercept | ( | const double | x, |
const double | y | ||
) | const |
Function to get the calibration parameter intercept for a given x and y position on the detector plane.
x | A const double that defines the x position on the detector plane. |
y | A const double that defines the y position on the detector plane. |
Definition at line 602 of file TRestDataSetGainMap.cxx.
double TRestDataSetGainMap::Module::GetSlope | ( | const double | x, |
const double | y | ||
) | const |
Function to get the calibration parameter slope for a given x and y position on the detector plane.
x | A const double that defines the x position on the detector plane. |
y | A const double that defines the y position on the detector plane. |
Definition at line 580 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::LoadConfigFromTiXmlElement | ( | const TiXmlElement * | module | ) |
Function to read the parameters from the RML element (TiXmlElement) and set those class members.
module | A const TiXmlElement pointer that contains the information. Example of this RML element: <module planeId="0" moduleId="0" moduleDefinitionCut="TREXsides_tagId==1" numberOfSegmentsX="5" numberOfSegmentsY="5" <peak energy="22.5" range="(250000,370000)"> <peak energy="8.0" range=""> </module> |
Definition at line 1146 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::Refit | ( | const size_t | x, |
const size_t | y, | ||
const size_t | peakNumber, | ||
const TVector2 & | range | ||
) |
Function to fit again manually a peak for a given segment of the module. The calibration curve is updated after the fit.
x | index along X-axis of the corresponding segment. |
y | index along Y-axis of the corresponding segment. |
peakNumber | The index of the peak to be fitted. |
range | The range for the fitting of the peak (in the observables corresponding units). |
Definition at line 974 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::Refit | ( | const TVector2 & | position, |
const double | energyPeak, | ||
const TVector2 & | range | ||
) |
Function to fit again manually a peak for a given segment of the module.
position | position along X and Y axes at the detector module (in physical units). |
energyPeak | The energy of the peak to be fitted (in physical units). |
range | The range for the fitting of the peak (in the observables corresponding units). |
Definition at line 949 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::RefitFullSpc | ( | const double | energyPeak, |
const TVector2 & | range | ||
) |
Function to fit again manually a peak for the whole module spectrum. The calibration curve is updated after the fit.
energyPeak | The energy of the peak to be fitted (in physical units). |
range | The range for the fitting of the peak (in the observables corresponding units). |
Definition at line 1008 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::RefitFullSpc | ( | const size_t | peakNumber, |
const TVector2 & | range | ||
) |
Function to fit again manually a peak for the whole module spectrum. The calibration curve is updated after the fit.
peakNumber | The index of the peak to be fitted. |
range | The range for the fitting of the peak (in the observables corresponding units). |
Definition at line 1029 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::SetSplitX | ( | ) |
Function to set the class members for segmentation of the detector plane along the X axis.
It uses the number of segments and the readout range to define the edges of the segments.
Definition at line 630 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::SetSplitY | ( | ) |
Function to set the class members for segmentation of the detector plane along the Y axis.
It uses the number of segments and the readout range to define the edges of the segments.
Definition at line 663 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::UpdateCalibrationFits | ( | const size_t | x, |
const size_t | y | ||
) |
Function to update the calibration curve for a given segment of the module. The calibration curve is cleared and then the means of the gaussian fits for each energy peak are added. If there are less than 2 fits, zero points are added. Then, the calibration curve is refitted (linearFit).
x | index along X-axis of the corresponding segment. |
y | index along Y-axis of the corresponding segment. |
Definition at line 1058 of file TRestDataSetGainMap.cxx.
std::string TRestDataSetGainMap::Module::fDataSetFileName = "" |
Name of the file that contains the calibration data. If empty, it will use its parent TRestDataSetGainMap::fCalibFileName.
Definition at line 173 of file TRestDataSetGainMap.h.
Int_t TRestDataSetGainMap::Module::fPlaneId = -1 |
Plane ID (unique identifier). Although it is not linked to any TRestDetectorReadout it is recommended to use the same.
Definition at line 135 of file TRestDataSetGainMap.h.
bool TRestDataSetGainMap::Module::fZeroPoint = false |
Add zero point to the calibration linear fit. Zero point will be automatically added if there are less than 2 points.
Definition at line 189 of file TRestDataSetGainMap.h.