REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestExperiment.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_TRestExperiment
24 #define REST_TRestExperiment
25 
26 #include <TRandom3.h>
27 
28 #include "TRestComponent.h"
29 #include "TRestDataSet.h"
30 #include "TRestMetadata.h"
31 
34  private:
36  Double_t fExposureTime = 0; //<
37 
39  TRestComponent* fBackground = nullptr; //<
40 
42  TRestComponent* fSignal = nullptr; //<
43 
45  std::string fExperimentalDataSet = ""; //<
46 
49 
51  Bool_t fMockData = false; //<
52 
54  Bool_t fDataReady = false; //<
55 
57  Bool_t fUseAverage = false; //<
58 
60  Int_t fExperimentalCounts = 0; //<
61 
63  TRandom3* fRandom = nullptr;
64 
66  UInt_t fSeed = 0; //<
67 
68  protected:
69  void InitFromConfigFile() override;
70 
71  public:
72  void GenerateMockDataSet(Bool_t useAverage = false);
73  Int_t GetExperimentalCounts() const { return fExperimentalCounts; }
74 
75  Bool_t IsMockData() const { return fMockData; }
76  Bool_t IsDataReady() const { return fDataReady; }
77 
78  void SetExposureInSeconds(const Double_t exposure) { fExposureTime = exposure / units("s"); }
79  void SetSignal(TRestComponent* comp) { fSignal = comp; }
80  void SetBackground(TRestComponent* comp) { fBackground = comp; }
81 
82  void SetExperimentalDataSet(const std::string& filename);
83 
84  Double_t GetExposureInSeconds() const { return fExposureTime * units("s"); }
85  TRestComponent* GetBackground() const { return fBackground; }
86  TRestComponent* GetSignal() const { return fSignal; }
87  TRestDataSet GetExperimentalDataSet() const { return fExperimentalData; }
88  ROOT::RDF::RNode GetExperimentalDataFrame() const { return fExperimentalData.GetDataFrame(); }
89 
90  void PrintExperimentalData() { GetExperimentalDataFrame().Display("")->Print(); }
91 
92  void Initialize() override;
93 
94  void PrintMetadata() override;
95 
96  TRestExperiment(const char* cfgFileName, const std::string& name = "");
99 
100  ClassDefOverride(TRestExperiment, 2);
101 };
102 #endif
It defines a background/signal model distribution in a given parameter space (tipically x,...
It allows to group a number of runs that satisfy given metadata conditions.
Definition: TRestDataSet.h:34
ROOT::RDF::RNode GetDataFrame() const
Gives access to the RDataFrame.
Definition: TRestDataSet.h:129
It includes a model definition and experimental data used to obtain a final experimental sensitivity.
UInt_t fSeed
Seed used in random generator.
Int_t fExperimentalCounts
It keeps track on the number of counts inside the dataset.
TRestComponent * fBackground
A pointer to the background component.
Bool_t fDataReady
Only if it is true we will be able to calculate the LogLikelihood.
TRestComponent * fSignal
A pointer to the signal component.
void InitFromConfigFile() override
It customizes the retrieval of XML data values of this class.
void Initialize() override
It will initialize the data frame with the filelist and column names (or observables) that have been ...
~TRestExperiment()
Default destructor.
TRestExperiment()
Default constructor.
TRestDataSet fExperimentalData
It contains the experimental data (should contain same columns as the components)
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionSolarFlux.
TRandom3 * fRandom
Internal process random generator.
Bool_t fUseAverage
The mock dataset will be generated using the mean counts instead of a real MonteCarlo.
void SetExperimentalDataSet(const std::string &filename)
std::string fExperimentalDataSet
It defines the filename used to load the dataset.
Double_t fExposureTime
The exposure time. If 0 it will be extracted from the tracking dataset (In us, standard REST unit)
Bool_t fMockData
If enabled it means that the experimental data was MC-generated.
A base class for any REST metadata class.
Definition: TRestMetadata.h:74