forked from cms-analysis/HiggsAnalysis-CombinedLimit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCombine.h
More file actions
128 lines (107 loc) · 4.23 KB
/
Combine.h
File metadata and controls
128 lines (107 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef HiggsAnalysis_CombinedLimit_Combine_h
#define HiggsAnalysis_CombinedLimit_Combine_h
#include <TString.h>
#include <TFile.h>
#include <boost/program_options.hpp>
#include "RooArgSet.h"
#include "RooAbsReal.h"
#include "RooRealVar.h"
#include "CombineUtils.h"
class TDirectory;
class TTree;
class LimitAlgo;
class RooWorkspace;
class RooAbsData;
namespace RooStats { class ModelConfig; }
extern Float_t t_cpu_, t_real_, g_quantileExpected_;
extern bool g_fillTree_;
//RooWorkspace *writeToysHere = 0;
extern TDirectory *outputFile;
extern TDirectory *writeToysHere;
extern TDirectory *readToysFromHere;
extern LimitAlgo * algo, * hintAlgo ;
extern int verbose;
extern bool withSystematics;
extern bool doSignificance_, lowerLimit_;
extern float cl;
extern bool bypassFrequentistFit_;
extern std::string setPhysicsModelParameterExpression_;
extern std::string setPhysicsModelParameterRangeExpression_;
extern std::string defineBackgroundOnlyModelParameterExpression_;
struct ToCleanUp {
TFile *tfile = nullptr;
std::string file;
std::string path;
~ToCleanUp();
};
class Combine {
public:
Combine() ;
boost::program_options::options_description & statOptions() { return statOptions_; }
boost::program_options::options_description & ioOptions() { return ioOptions_; }
boost::program_options::options_description & miscOptions() { return miscOptions_; }
void applyOptions(const boost::program_options::variables_map &vm) ;
void run(TString hlfFile, const std::string &dataset, double &limit, double &limitErr, int &iToy, TTree *tree, int nToys);
/// Stop combine from fillint the tree (some algos need control)
static void toggleGlobalFillTree(bool flag=false);
/// Save a point into the output tree. Usually if expected = false, quantile should be set to -1 (except e.g. for saveGrid option of HybridNew)
static void commitPoint(bool expected, float quantile);
/// Add a branch to the output tree (for advanced use or debugging only)
static void addBranch(const char *name, void *address, const char *leaflist) ;
static std::string& nllBackend();
static void setNllBackend(std::string const&);
private:
bool mklimit(RooWorkspace *w, RooStats::ModelConfig *mc_s, RooStats::ModelConfig *mc_b, RooAbsData &data, double &limit, double &limitErr) ;
std::string parseRegex(std::string instr, const RooArgSet *nuisances, RooWorkspace *w) ;
void addDiscreteNuisances(RooWorkspace *);
void addNuisances(const RooArgSet *);
void addFloatingParameters(const RooArgSet &);
void addPOI(const RooArgSet *);
template <class Var>
void addBranches(const std::string&, RooWorkspace*, std::vector<std::pair<Var*,float>>&, const std::string&);
boost::program_options::options_description statOptions_, ioOptions_, miscOptions_;
// statistics-related variables
bool unbinned_, generateBinnedWorkaround_, newGen_, guessGenMode_;
std::string genAsBinned_, genAsUnbinned_;
float rMin_, rMax_;
std::string prior_;
bool hintUsesStatOnly_;
bool toysNoSystematics_;
bool toysFrequentist_;
float expectSignal_;
bool expectSignalSet_; // keep track of whether or not expectSignal was defaulted
float expectSignalMass_;
std::string redefineSignalPOIs_;
std::string freezeNuisances_;
std::string floatNuisances_;
std::string freezeNuisanceGroups_;
std::string freezeWithAttributes_;
// input-output related variables
bool saveWorkspace_;
std::string workspaceName_;
std::string snapshotName_;
std::string modelConfigName_, modelConfigNameB_;
bool overrideSnapshotMass_;
bool validateModel_;
bool saveToys_;
double mass_;
// implementation-related variables
bool compiledExpr_;
bool makeTempDir_;
bool rebuildSimPdf_;
bool optSimPdf_;
bool noMCbonly_;
bool noDefaultPrior_;
bool makeToyGenSnapshot_;
bool floatAllNuisances_;
bool freezeAllGlobalObs_;
std::vector<std::string> librariesToLoad_;
std::vector<std::string> modelPoints_;
static TTree *tree_;
static std::vector<std::pair<RooAbsReal*,float> > trackedParametersMap_;
static std::vector<std::pair<RooRealVar*,float> > trackedErrorsMap_;
static std::string trackParametersNameString_;
static std::string trackErrorsNameString_;
static std::string textToWorkspaceString_;
};
#endif