41#include "TRestExperimentList.h"
92 RESTError <<
"TRestExperimentList::InitFromConfigFile. The experiments table is empty!"
101 while (comp !=
nullptr) {
102 if (
ToLower(comp->GetNature()) ==
"background")
104 else if (
ToLower(comp->GetNature()) ==
"signal")
107 RESTWarning <<
"TRestExperimentList::InitFromConfigFile. Unknown component!" <<
RESTendl;
113 Int_t nExpectedColumns = 3;
114 if (
fSignal) nExpectedColumns--;
118 if (nExpectedColumns == 0) {
119 RESTError <<
"TRestExperimentList::InitFromConfigFile. At least one free parameter required! "
120 "(Exposure/Background/Signal)"
125 if (nExpectedColumns != nTableColumns) {
126 std::string expectedColumns =
"";
130 expectedColumns +=
"signal";
134 expectedColumns +=
"background";
137 RESTError <<
"TRestExperimentList::InitFromConfigFile. Number of expected columns does not match "
138 "the number of table columns"
140 RESTError <<
"Number of table columns : " << nTableColumns <<
RESTendl;
141 RESTError <<
"Number of expected columns : " << nExpectedColumns <<
RESTendl;
142 RESTError <<
"Expected columns : " << expectedColumns <<
RESTendl;
148 Bool_t generateMockData =
false;
152 std::string rowStr =
"";
153 for (
const auto& el : experimentRow) {
157 RESTInfo <<
"TRestExperimentList. Loading experiment: " << rowStr <<
RESTendl;
162 experiment->SetExposureInSeconds(
165 generateMockData =
true;
168 std::string fname =
SearchFile(experimentRow[column]);
170 RESTWarning <<
"Loading experimental data havent been tested yet!" <<
RESTendl;
172 <<
"It might require further development. Remove these lines once it works smooth!"
175 RESTError << experimentRow[column] <<
" is not a exposure time or an experimental dataset"
183 generateMockData =
true;
188 if (GetComponent(experimentRow[column])) {
190 sgnl->SetName((TString)experimentRow[column]);
191 experiment->SetSignal(sgnl);
193 RESTError <<
"TRestExperimentList. Signal component : " << experimentRow[column]
198 experiment->SetSignal(
fSignal);
202 if (GetComponent(experimentRow[column])) {
204 experiment->SetBackground(bck);
206 RESTError <<
"TRestExperimentList. Background component : " << experimentRow[column]
213 if (generateMockData) {
214 RESTInfo <<
"TRestExperimentList. Generating mock dataset" <<
RESTendl;
218 if (experiment->GetSignal() && experiment->GetBackground()) {
219 experiment->SetName(experiment->GetSignal()->GetName());
272 std::vector<Double_t> nodes = experiment->GetSignal()->GetParameterizationNodes();
281void TRestExperimentList::PrintParameterizationNodes() {
282 std::cout <<
"Experiment list nodes: ";
284 std::cout << std::endl;
287TRestComponent* TRestExperimentList::GetComponent(std::string compName) {
290 TFile* f = TFile::Open(c.c_str(),
"READ");
291 TObject* obj = f->Get((TString)compName);
295 if (obj->InheritsFrom(
"TRestComponent")) {
298 RESTError <<
"An object named : " << compName
299 <<
" exists inside the file, but it does not inherit from TRestComponent" <<
RESTendl;
314 if (
fUseAverage) RESTMetadata <<
"Average MonteCarlo counts generation was enabled" <<
RESTendl;
It defines a background/signal model distribution in a given parameter space (tipically x,...
A helper metadata class to create a list of TRestExperiment instances.
std::string fExperimentsFile
A file where we define experiment components, exposureTime, and tracking data of each experiment.
std::vector< TRestExperiment * > fExperiments
A vector with a list of experiments includes the background components in this model.
std::vector< Double_t > fParameterizationNodes
The fusioned list of parameterization nodes found at each experiment signal.
std::vector< std::string > fComponentFiles
A vector with filenames containing the components.
void InitFromConfigFile() override
It customizes the retrieval of XML data values of this class.
TRestComponent * fBackground
If not null this will be the common signal used in each experiment.
Bool_t fUseAverage
The mock dataset will be generated using the mean counts instead of a real MonteCarlo.
void Initialize() override
It will initialize the data frame with the filelist and column names (or observables) that have been ...
std::string fExposureStrategy
In case an exposure time is given it defines how to assign time to each experiment (equal/ksvz).
void ExtractExperimentParameterizationNodes()
It scans all the experiment signals parametric nodes to build a complete list of nodes used to build ...
Double_t fExposureFactor
The factor used on the exponential exposure time as a function of the experiment number.
std::string fComponentPattern
A fullpath filename pattern helping to initialize the component files vector.
TRestExperimentList()
Default constructor.
TRestComponent * fSignal
If not null this will be the common signal used in each experiment.
std::vector< std::vector< std::string > > fExperimentsTable
A table with the experiment file information.
~TRestExperimentList()
Default destructor.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestAxionSolarFlux.
Double_t fExposureTime
If not zero this will be the common exposure time in micro-seconds (standard REST units)
It includes a model definition and experimental data used to obtain a final experimental sensitivity.
void SetExperimentalDataSet(const std::string &filename)
Double_t StringToDouble(std::string in)
Gets a double from a string.
std::string ToLower(std::string in)
Convert string to its lower case. Alternative of TString::ToLower.
Int_t isANumber(std::string in)
Returns 1 only if a valid number is found in the string in. If not it returns 0.
std::string ReplaceMathematicalExpressions(std::string buffer, Int_t precision=0, std::string errorMessage="")
Evaluates and replaces valid mathematical expressions found in the input string buffer.