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;
74 if (!strcmp(infile,
"")) {
75 filename =
"results/example_combined_GaussExample_model.root";
80 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
84 cout <<
"will run standard hist2workspace example" << endl;
85 gROOT->ProcessLine(
".! prepareHistFactory .");
86 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
87 cout <<
"\n\n---------------------" << endl;
88 cout <<
"Done creating example input" << endl;
89 cout <<
"---------------------\n\n" << endl;
100 cout <<
"StandardRooStatsDemoMacro: Input file " <<
filename <<
" is not found" << endl;
111 cout <<
"workspace not found" << endl;
124 cout <<
"data or ModelConfig was not found" << endl;
134 pl.SetConfidenceLevel(confLevel);
139 cout <<
"\n>>>> RESULT : " << confLevel * 100 <<
"% interval on " << firstPOI->
GetName() <<
" is : ["
140 << interval->
LowerLimit(*firstPOI) <<
", " << interval->
UpperLimit(*firstPOI) <<
"]\n " << endl;
144 cout <<
"making a plot of the profile likelihood function ....(if it is taking a lot of time use less points or the "
145 "TF1 drawing option)\n";
147 plot.SetNPoints(nScanPoints);
148 if (poiXMin < poiXMax)
149 plot.SetRange(poiXMin, poiXMax);
158 nullparams.addClone(*firstPOI);
159 nullparams.setRealValue(firstPOI->
GetName(), nullParamValue);
160 pl.SetNullParameters(nullparams);
161 std::cout <<
"Perform Test of Hypothesis : null Hypothesis is " << firstPOI->
GetName() << nullParamValue
163 auto result = pl.GetHypoTest();
164 std::cout <<
"\n>>>> Hypotheis Test Result \n";
winID h TVirtualViewer3D TVirtualGLPainter char TVirtualGLPainter plot
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
R__EXTERN TSystem * gSystem
RooAbsArg * first() const
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooRealVar represents a 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
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
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...
The RooWorkspace is a persistable container for RooFit projects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.