REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
 All Data Structures Namespaces Functions Variables Enumerations Enumerator Friends Pages
TRestComponentDataSet.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_TRestComponentDataSet
24 #define REST_TRestComponentDataSet
25 
26 #include <THn.h>
27 
28 #include "TRestComponent.h"
29 #include "TRestDataSet.h"
30 
33  private:
35  std::vector<std::string> fWeights; //<
36 
38  std::vector<Int_t> fNSimPerNode; //<
39 
41  std::vector<std::string> fDataSetFileNames; //<
42 
44  std::vector<THnD*> fNodeDensity; //<
45 
49 
52 
55 
57  Bool_t fDataSetLoaded = false;
58 
59  Bool_t ValidDataSet();
60 
61  protected:
62  std::vector<Double_t> ExtractParameterizationNodes();
63  std::vector<Int_t> ExtractNodeStatistics();
64  void FillHistograms();
65 
66  Bool_t VariablesOk();
67  Bool_t WeightsOk();
68 
69  public:
70  Bool_t LoadDataSets();
71 
73  Bool_t IsDataSetLoaded() { return fDataSetLoaded; }
74 
75  Double_t GetRate(std::vector<Double_t> point) override;
76  Double_t GetTotalRate() override;
77 
78  TCanvas* DrawComponent(std::vector<std::string> drawVariables, std::vector<std::string> scanVariables,
79  Int_t binScanSize = 1, TString drawOption = "");
80 
81  THnD* GetDensityForNode(Double_t value);
82  THnD* GetDensityForActiveNode();
83  THnD* GetDensity() { return GetDensityForActiveNode(); }
84 
85  TH1D* GetHistogram(Double_t node, std::string varName);
86  TH2D* GetHistogram(Double_t node, std::string varName1, std::string varName2);
87  TH3D* GetHistogram(Double_t node, std::string varName1, std::string varName2, std::string varName3);
88 
89  TH1D* GetHistogram(std::string varName);
90  TH2D* GetHistogram(std::string varName1, std::string varName2);
91  TH3D* GetHistogram(std::string varName1, std::string varName2, std::string varName3);
92 
93  void PrintStatistics();
94 
95  void PrintMetadata() override;
96  void Initialize() override;
97  void InitFromConfigFile() override;
98 
100  TRestComponentDataSet(const char* cfgFileName, const std::string& name);
102 
103  ClassDefOverride(TRestComponentDataSet, 1);
104 };
105 #endif
It defines a background/signal model distribution in a given parameter space (tipically x...
std::vector< THnD * > fNodeDensity
The generated N-dimensional variable space density for a given node.
Bool_t IsDataSetLoaded()
This method should go to TRestComponentDataSet.
It allows to group a number of runs that satisfy given metadata conditions.
Definition: TRestDataSet.h:34
Bool_t ValidDataSet()
Takes care of initializing datasets if have not been initialized. On sucess it returns true...
~TRestComponentDataSet()
Default destructor.
TRestDataSet fDataSet
The dataset used to initialize the distribution.
Double_t GetTotalRate() override
This method integrates the rate to all the parameter space defined in the density function...
Bool_t LoadDataSets()
A method responsible to import a list of TRestDataSet into fDataSet and check that the variables and ...
std::vector< Int_t > ExtractNodeStatistics()
It returns a vector with the number of entries found for each parameterization node.
void PrintStatistics()
It prints out the statistics available for each parametric node.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionSolarFlux.
void FillHistograms()
It will produce a histogram with the distribution defined using the variables and the weights for eac...
Double_t GetRate(std::vector< Double_t > point) override
It returns the intensity/rate (in seconds) corresponding to the generated distribution or formula eva...
void InitFromConfigFile() override
It customizes the retrieval of XML data values of this class.
Bool_t VariablesOk()
It returns true if all variables have been found inside TRestDataSet.
Bool_t WeightsOk()
It returns true if all weights have been found inside TRestDataSet.
TCanvas * DrawComponent(std::vector< std::string > drawVariables, std::vector< std::string > scanVariables, Int_t binScanSize=1, TString drawOption="")
std::vector< Int_t > fNSimPerNode
It defines the number of entries for each parameterization node (Initialized by the dataset) ...
std::vector< std::string > fWeights
A list with the dataset columns used to weight the distribution density and define rate...
Bool_t fDataSetLoaded
It is true of the dataset was loaded without issues.
std::vector< Double_t > ExtractParameterizationNodes()
It returns a vector with all the different values found on the dataset column for the user given para...
It defines a background/signal model distribution in a given parameter space (tipically x...
TH1D * GetHistogram(Double_t node, std::string varName)
It returns a 1-dimensional projected histogram for the variable names provided in the argument...
std::vector< std::string > fDataSetFileNames
The filename of the dataset used.
void Initialize() override
It will initialize the data frame with the filelist and column names (or observables) that have been ...
TRestComponentDataSet()
Default constructor.