45struct ProfileLikelihoodOptions {
47 double confLevel = 0.95;
49 bool plotAsTF1 =
false;
50 double poiMinPlot = 1;
51 double poiMaxPlot = 0;
52 bool doHypoTest =
false;
56ProfileLikelihoodOptions optPL;
58void StandardProfileLikelihoodDemo(
const char *infile =
"",
const char *workspaceName =
"combined",
59 const char *modelConfigName =
"ModelConfig",
const char *dataName =
"obsData")
62 double confLevel = optPL.confLevel;
63 double nScanPoints = optPL.nScanPoints;
64 bool plotAsTF1 = optPL.plotAsTF1;
65 double poiXMin = optPL.poiMinPlot;
66 double poiXMax = optPL.poiMaxPlot;
67 bool doHypoTest = optPL.doHypoTest;
68 double nullParamValue = optPL.nullValue;
73 const char *filename =
"";
74 if (!strcmp(infile,
"")) {
75 filename =
"results/example_combined_GaussExample_model.root";
76 bool fileExist = !
gSystem->AccessPathName(filename);
80 cout <<
"will run standard hist2workspace example" << endl;
81 gROOT->ProcessLine(
".! prepareHistFactory .");
82 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
83 cout <<
"\n\n---------------------" << endl;
84 cout <<
"Done creating example input" << endl;
85 cout <<
"---------------------\n\n" << endl;
113 pl.SetConfidenceLevel(confLevel);
118 cout <<
"\n>>>> RESULT : " << confLevel * 100 <<
"% interval on " << firstPOI->
GetName() <<
" is : ["
119 << interval->
LowerLimit(*firstPOI) <<
", " << interval->
UpperLimit(*firstPOI) <<
"]\n " << endl;
123 cout <<
"making a plot of the profile likelihood function ....(if it is taking a lot of time use less points or the "
124 "TF1 drawing option)\n";
126 plot.SetNPoints(nScanPoints);
127 if (poiXMin < poiXMax)
128 plot.SetRange(poiXMin, poiXMax);
137 nullparams.addClone(*firstPOI);
138 nullparams.setRealValue(firstPOI->
GetName(), nullParamValue);
139 pl.SetNullParameters(nullparams);
140 std::cout <<
"Perform Test of Hypothesis : null Hypothesis is " << firstPOI->
GetName() << nullParamValue
142 auto result = pl.GetHypoTest();
143 std::cout <<
"\n>>>> Hypotheis Test Result \n";
RooAbsArg * first() const
Abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Variable that can be changed from the outside.
This class provides simple and straightforward utilities to plot a LikelihoodInterval object.
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
double UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
double LowerLimit(const RooRealVar ¶m)
return the lower bound of the interval on a given parameter
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
The ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface cla...
Persistable container for RooFit projects.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
const char * GetName() const override
Returns name of object.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
RooStats::ModelConfig ModelConfig
Namespace for the RooStats classes.