57void StandardTestStatDistributionDemo(
const char *infile =
"",
const char *workspaceName =
"combined",
58 const char *modelConfigName =
"ModelConfig",
const char *dataName =
"obsData")
65 bool allowNegativeMu =
true;
71 if (!strcmp(infile,
"")) {
72 filename =
"results/example_combined_GaussExample_model.root";
77 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
81 cout <<
"will run standard hist2workspace example" << endl;
82 gROOT->ProcessLine(
".! prepareHistFactory .");
83 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
84 cout <<
"\n\n---------------------" << endl;
85 cout <<
"Done creating example input" << endl;
86 cout <<
"---------------------\n\n" << endl;
97 cout <<
"StandardRooStatsDemoMacro: Input file " <<
filename <<
" is not found" << endl;
107 cout <<
"workspace not found" << endl;
120 cout <<
"data or ModelConfig was not found" << endl;
130 double plcUpperLimit = interval->
UpperLimit(*firstPOI);
132 cout <<
"\n\n--------------------------------------" << endl;
133 cout <<
"Will generate sampling distribution at " << firstPOI->
GetName() <<
" = " << plcUpperLimit << endl;
136 cout <<
"not sure what to do with other parameters of interest, but here are their values" << endl;
154 sampler.SetPdf(*mc->
GetPdf());
158 cout <<
"tell it to use 1 event" << endl;
159 sampler.SetNEventsPerToy(1);
161 firstPOI->
setVal(plcUpperLimit);
166 sampler.SetProofConfig(&pc);
169 firstPOI->
setVal(plcUpperLimit);
173 allParameters.
Print(
"v");
177 plot.AddSamplingDistribution(sampDist);
178 plot.GetTH1F(sampDist)->GetYaxis()->SetTitle(
179 Form(
"f(-log #lambda(#mu=%.2f) | #mu=%.2f)", plcUpperLimit, plcUpperLimit));
180 plot.SetAxisTitle(
Form(
"-log #lambda(#mu=%.2f)", plcUpperLimit));
185 double min =
plot.GetTH1F(sampDist)->GetXaxis()->GetXmin();
186 double max =
plot.GetTH1F(sampDist)->GetXaxis()->GetXmax();
188 TF1 *
f =
new TF1(
"f",
Form(
"2*ROOT::Math::chisquared_pdf(2*x,%d,0)", nPOI), min, max);
190 c1->SaveAs(
"standard_test_stat_distribution.pdf");
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
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
Int_t getSize() const
Return the number of elements in the collection.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * first() const
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
RooAbsData is the common abstract base class for binned and unbinned datasets.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setMin(const char *name, double value)
Set minimum of name range to given value.
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
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return nullptr if not existing)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
void Print(Option_t *option="") const override
overload the print method
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
The ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface cla...
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
Holds configuration options for proof and proof-lite.
This class provides simple and straightforward utilities to plot SamplingDistribution objects.
This class simply holds a sampling distribution of some test statistic.
const std::vector< double > & GetSamplingDistribution() const
Get test statistics values.
ToyMCSampler is an implementation of the TestStatSampler interface.
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.