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. More... | |
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. More... | |
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). More... | |
Data Fields | |
bool | fAutoRangePeaks = true |
Automatic range for the peaks fitting. See GenerateGainMap() for more information of the logic. More... | |
TVector2 | fCalibRange = TVector2(0, 0) |
Calibration range. If fCalibRange.X()>=fCalibRange.Y() the range will be automatically calculated. More... | |
std::string | fDataSetFileName = "" |
std::string | fDefinitionCut = "" |
Cut that defines which events are from this module. More... | |
std::vector< double > | fEnergyPeaks = {} |
Energy of the peaks to be used for the calibration. More... | |
double | fFullIntercept = 0 |
Intercept of the calibration linear fit of whole module. More... | |
TGraph * | fFullLinearFit = nullptr |
Calibration linear fit for the whole module. More... | |
double | fFullSlope = 0 |
Slope of the calibration linear fit of whole module. More... | |
TH1F * | fFullSpectrum = nullptr |
Spectrum of the observable for the whole module. More... | |
std::vector< std::vector< double > > | fIntercept = {} |
Array containing the intercept of the linear fit for each segment. More... | |
Int_t | fModuleId = -1 |
Int_t | fNBins = 100 |
Number of bins for the spectrum histograms. More... | |
Int_t | fNumberOfSegmentsX = 1 |
Number of segments in the x direction. More... | |
Int_t | fNumberOfSegmentsY = 1 |
Number of segments in the y direction. More... | |
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. More... | |
TVector2 | fReadoutRange = TVector2(-1, 246.24) |
Readout dimensions. More... | |
std::vector< std::vector< TGraph * > > | fSegLinearFit = {} |
Array containing the calibration linear fit for each segment. More... | |
std::vector< std::vector< TH1F * > > | fSegSpectra = {} |
Array containing the observable spectrum for each segment. More... | |
std::vector< std::vector< double > > | fSlope = {} |
Array containing the slope of the linear fit for each segment. More... | |
std::set< double > | fSplitX = {} |
Split points in the x direction. More... | |
std::set< double > | fSplitY = {} |
Split points in the y direction. More... | |
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. More... | |
|
inline |
Definition at line 285 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 286 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 287 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 291 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 207 of file TRestDataSetGainMap.h.
void TRestDataSetGainMap::Module::DrawFullSpectrum | ( | const bool | drawFits = true , |
const int | color = -1 , |
||
TCanvas * | c = nullptr |
||
) |
Definition at line 1305 of file TRestDataSetGainMap.cxx.
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::DrawLinearFit | ( | const int | index_x, |
const int | index_y, | ||
TCanvas * | c = nullptr |
||
) |
Definition at line 1341 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::DrawLinearFit | ( | const TVector2 & | position, |
TCanvas * | c = nullptr |
||
) |
Definition at line 1336 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::DrawLinearFit | ( | TCanvas * | c = nullptr | ) |
Definition at line 1372 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::DrawSpectrum | ( | const int | index_x, |
const int | index_y, | ||
bool | drawFits = true , |
||
int | color = -1 , |
||
TCanvas * | c = nullptr |
||
) |
Definition at line 1209 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::DrawSpectrum | ( | const TVector2 & | position, |
bool | drawFits = true , |
||
int | color = -1 , |
||
TCanvas * | c = nullptr |
||
) |
Definition at line 1203 of file TRestDataSetGainMap.cxx.
|
private |
Definition at line 840 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.
|
inline |
Definition at line 232 of file TRestDataSetGainMap.h.
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.
|
inline |
Definition at line 219 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 226 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 222 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 227 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 228 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 223 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 214 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 221 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 233 of file TRestDataSetGainMap.h.
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.
|
inline |
Definition at line 218 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 224 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 225 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 230 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 231 of file TRestDataSetGainMap.h.
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::Print | ( | ) | const |
Prints on screen the information about the members of Module.
Definition at line 1468 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.
|
inline |
Definition at line 278 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 260 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 275 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 257 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 256 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 261 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 272 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 273 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 255 of file TRestDataSetGainMap.h.
|
inline |
Definition at line 276 of file TRestDataSetGainMap.h.
void TRestDataSetGainMap::Module::SetSplits | ( | ) |
Function to set the class members for segmentation of the detector plane along the X and Y axis.
Definition at line 620 of file TRestDataSetGainMap.cxx.
|
inline |
Definition at line 267 of file TRestDataSetGainMap.h.
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::SetSplitX | ( | const std::set< double > & | splitX | ) |
Definition at line 644 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::SetSplitY | ( | const std::set< double > & | splitY | ) |
Definition at line 677 of file TRestDataSetGainMap.cxx.
|
inline |
Definition at line 277 of file TRestDataSetGainMap.h.
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.
|
private |
Definition at line 1076 of file TRestDataSetGainMap.cxx.
void TRestDataSetGainMap::Module::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).
Definition at line 1126 of file TRestDataSetGainMap.cxx.
bool TRestDataSetGainMap::Module::fAutoRangePeaks = true |
Automatic range for the peaks fitting. See GenerateGainMap() for more information of the logic.
Definition at line 192 of file TRestDataSetGainMap.h.
TVector2 TRestDataSetGainMap::Module::fCalibRange = TVector2(0, 0) |
Calibration range. If fCalibRange.X()>=fCalibRange.Y() the range will be automatically calculated.
Definition at line 148 of file TRestDataSetGainMap.h.
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.
std::string TRestDataSetGainMap::Module::fDefinitionCut = "" |
Cut that defines which events are from this module.
Definition at line 154 of file TRestDataSetGainMap.h.
std::vector<double> TRestDataSetGainMap::Module::fEnergyPeaks = {} |
Energy of the peaks to be used for the calibration.
Definition at line 142 of file TRestDataSetGainMap.h.
double TRestDataSetGainMap::Module::fFullIntercept = 0 |
Intercept of the calibration linear fit of whole module.
Definition at line 182 of file TRestDataSetGainMap.h.
TGraph* TRestDataSetGainMap::Module::fFullLinearFit = nullptr |
Calibration linear fit for the whole module.
Definition at line 204 of file TRestDataSetGainMap.h.
double TRestDataSetGainMap::Module::fFullSlope = 0 |
Slope of the calibration linear fit of whole module.
Definition at line 179 of file TRestDataSetGainMap.h.
TH1F* TRestDataSetGainMap::Module::fFullSpectrum = nullptr |
Spectrum of the observable for the whole module.
Definition at line 201 of file TRestDataSetGainMap.h.
std::vector<std::vector<double> > TRestDataSetGainMap::Module::fIntercept = {} |
Array containing the intercept of the linear fit for each segment.
Definition at line 185 of file TRestDataSetGainMap.h.
Int_t TRestDataSetGainMap::Module::fModuleId = -1 |
Definition at line 139 of file TRestDataSetGainMap.h.
Int_t TRestDataSetGainMap::Module::fNBins = 100 |
Number of bins for the spectrum histograms.
Definition at line 151 of file TRestDataSetGainMap.h.
Int_t TRestDataSetGainMap::Module::fNumberOfSegmentsX = 1 |
Number of segments in the x direction.
Definition at line 157 of file TRestDataSetGainMap.h.
Int_t TRestDataSetGainMap::Module::fNumberOfSegmentsY = 1 |
Number of segments in the y direction.
Definition at line 160 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.
std::vector<TVector2> TRestDataSetGainMap::Module::fRangePeaks = {} |
Range of the peaks to be used for the calibration. If empty it will be automatically calculated.
Definition at line 145 of file TRestDataSetGainMap.h.
TVector2 TRestDataSetGainMap::Module::fReadoutRange = TVector2(-1, 246.24) |
Readout dimensions.
Definition at line 163 of file TRestDataSetGainMap.h.
std::vector<std::vector<TGraph*> > TRestDataSetGainMap::Module::fSegLinearFit = {} |
Array containing the calibration linear fit for each segment.
Definition at line 198 of file TRestDataSetGainMap.h.
std::vector<std::vector<TH1F*> > TRestDataSetGainMap::Module::fSegSpectra = {} |
Array containing the observable spectrum for each segment.
Definition at line 195 of file TRestDataSetGainMap.h.
std::vector<std::vector<double> > TRestDataSetGainMap::Module::fSlope = {} |
Array containing the slope of the linear fit for each segment.
Definition at line 176 of file TRestDataSetGainMap.h.
std::set<double> TRestDataSetGainMap::Module::fSplitX = {} |
Split points in the x direction.
Definition at line 166 of file TRestDataSetGainMap.h.
std::set<double> TRestDataSetGainMap::Module::fSplitY = {} |
Split points in the y direction.
Definition at line 169 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.
|
private |
Pointer to the parent class.
Definition at line 127 of file TRestDataSetGainMap.h.