REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDataSetOdds.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_TRestDataSetOdds
24#define REST_TRestDataSetOdds
25
26#include "TH1F.h"
27#include "TRestCut.h"
28#include "TRestMetadata.h"
29
32 private:
34 std::string fOutputFileName = "";
35
37 std::string fDataSetName = "";
38
40 std::vector<std::string> fObsName;
41
43 std::vector<TVector2> fObsRange;
44
46 std::vector<int> fObsNbins;
47
49 std::string fOddsFile = "";
50
52 TRestCut* fCut = nullptr;
53
55 std::map<std::string, TH1F*> fHistos;
56
57 void Initialize() override;
58 void InitFromConfigFile() override;
59
60 public:
61 void PrintMetadata() override;
62
63 void ComputeLogOdds();
64
65 std::vector<std::tuple<std::string, TVector2, int>> GetOddsObservables();
66 std::string GetOddsFile() { return fOddsFile; }
67 std::string GetDataSetName() { return fDataSetName; }
68 std::string GetOutputFileName() { return fOutputFileName; }
69 TRestCut* GetCut() { return fCut; }
70
71 inline void SetDataSetName(const std::string& dSName) { fDataSetName = dSName; }
72 inline void SetOutputFileName(const std::string& outName) { fOutputFileName = outName; }
73 inline void SetOddsFile(const std::string& oddsFile) { fOddsFile = oddsFile; }
74 inline void SetCut(TRestCut* cut) { fCut = cut; }
75 void SetOddsObservables(const std::vector<std::tuple<std::string, TVector2, int>>& obs);
76 void AddOddsObservable(const std::string& name, const TVector2& range, int nbins);
77
79 TRestDataSetOdds(const char* configFilename, std::string name = "");
81
82 ClassDefOverride(TRestDataSetOdds, 1);
83};
84#endif
A class to help on cuts definitions. To be used with TRestAnalysisTree.
Definition: TRestCut.h:31
This class is meant to compute the log odds for different datasets.
std::string fOddsFile
Name of the odds file to be used to get the PDF.
std::vector< std::string > fObsName
Vector containing different obserbable names.
TRestDataSetOdds()
Default constructor.
void PrintMetadata() override
Prints on screen the information about the metadata members of TRestDataSetOdds.
std::map< std::string, TH1F * > fHistos
Map containing the PDF of the different observables.
std::vector< TVector2 > fObsRange
Vector containing different obserbable ranges.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestDataSetOdds()
Default destructor.
TRestCut * fCut
Cuts over the dataset for PDF selection.
void ComputeLogOdds()
This function computes the log odds for a given dataSet. If no calibration odds file is provided it c...
std::string fOutputFileName
Name of the output file.
std::string fDataSetName
Name of the dataSet inside the config file.
std::vector< int > fObsNbins
Vector containing number of bins for the different observables.
void InitFromConfigFile() override
Function to initialize some variables from configfile.
A base class for any REST metadata class.
Definition: TRestMetadata.h:70