54void StandardTestStatDistributionDemo(
const char *infile =
"",
const char *workspaceName =
"combined",
55 const char *modelConfigName =
"ModelConfig",
const char *dataName =
"obsData")
62 bool allowNegativeMu =
true;
67 const char *filename =
"";
68 if (!strcmp(infile,
"")) {
69 filename =
"results/example_combined_GaussExample_model.root";
70 bool fileExist = !
gSystem->AccessPathName(filename);
74 cout <<
"will run standard hist2workspace example" << endl;
75 gROOT->ProcessLine(
".! prepareHistFactory .");
76 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
77 cout <<
"\n\n---------------------" << endl;
78 cout <<
"Done creating example input" << endl;
79 cout <<
"---------------------\n\n" << endl;
90 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
100 cout <<
"workspace not found" << endl;
113 cout <<
"data or ModelConfig was not found" << endl;
123 double plcUpperLimit = interval->
UpperLimit(*firstPOI);
125 cout <<
"\n\n--------------------------------------" << endl;
126 cout <<
"Will generate sampling distribution at " << firstPOI->
GetName() <<
" = " << plcUpperLimit << endl;
129 cout <<
"not sure what to do with other parameters of interest, but here are their values" << endl;
147 sampler.SetPdf(*mc->
GetPdf());
151 cout <<
"tell it to use 1 event" << endl;
152 sampler.SetNEventsPerToy(1);
154 firstPOI->
setVal(plcUpperLimit);
157 firstPOI->
setVal(plcUpperLimit);
161 allParameters.
Print(
"v");
167 Form(
"f(-log #lambda(#mu=%.2f) | #mu=%.2f)", plcUpperLimit, plcUpperLimit));
176 TF1 *
f =
new TF1(
"f",
Form(
"2*ROOT::Math::chisquared_pdf(2*x,%d,0)", nPOI), min, max);
178 c1->SaveAs(
"standard_test_stat_distribution.pdf");
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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.
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.
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, bool shared=true)
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
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...
This class provides simple and straightforward utilities to plot SamplingDistribution objects.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
double AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
TH1F * GetTH1F(const SamplingDistribution *sampleDist=nullptr)
Returns the TH1F associated with the give SamplingDistribution.
void SetAxisTitle(char *varName)
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.
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.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
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.
__device__ AFloat max(AFloat x, AFloat y)