52 bool useProof =
false;
58 void StandardTestStatDistributionDemo(
const char* infile =
"",
59 const char* workspaceName =
"combined",
60 const char* modelConfigName =
"ModelConfig",
61 const char* dataName =
"obsData"){
68 bool allowNegativeMu=
true;
74 const char* filename =
"";
75 if (!strcmp(infile,
"")) {
76 filename =
"results/example_combined_GaussExample_model.root";
81 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
85 cout <<
"will run standard hist2workspace example"<<endl;
86 gROOT->ProcessLine(
".! prepareHistFactory .");
87 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
88 cout <<
"\n\n---------------------"<<endl;
89 cout <<
"Done creating example input"<<endl;
90 cout <<
"---------------------\n\n"<<endl;
102 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
113 cout <<
"workspace not found" << endl;
126 cout <<
"data or ModelConfig was not found" <<endl;
136 double plcUpperLimit = interval->
UpperLimit(*firstPOI);
138 cout <<
"\n\n--------------------------------------"<<endl;
139 cout <<
"Will generate sampling distribution at " << firstPOI->
GetName() <<
" = " << plcUpperLimit <<endl;
142 cout <<
"not sure what to do with other parameters of interest, but here are their values"<<endl;
160 sampler.SetPdf(*mc->
GetPdf());
164 cout <<
"tell it to use 1 event"<<endl;
165 sampler.SetNEventsPerToy(1);
167 firstPOI->
setVal(plcUpperLimit);
172 sampler.SetProofConfig(&
pc);
175 firstPOI->
setVal(plcUpperLimit);
179 allParameters.
Print(
"v");
193 TF1* f =
new TF1(
"f",
Form(
"2*ROOT::Math::chisquared_pdf(2*x,%d,0)",nPOI),min,max);
195 c1->
SaveAs(
"standard_test_stat_distribution.pdf");
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Holds configuration options for proof and proof-lite.
const std::vector< Double_t > & GetSamplingDistribution() const
Get test statistics values.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
virtual Double_t getMax(const char *name=0) const
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface class f...
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
RooRealVar represents a fundamental (non-derived) real valued object.
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Double_t UpperLimit(const RooRealVar ¶m)
return the upper bound of the interval on a given parameter
virtual void Print(Option_t *option="") const
overload the print method
R__EXTERN TSystem * gSystem
RooAbsArg * first() const
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
void SetAxisTitle(char *varName)
char * Form(const char *fmt,...)
RooAbsData is the common abstract base class for binned and unbinned datasets.
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
ToyMCSampler is an implementation of the TestStatSampler interface.
This class simply holds a sampling distribution of some test statistic.
Bool_t canBeExtended() const
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
Namespace for the RooStats classes.
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
TH1F * GetTH1F(const SamplingDistribution *samplDist=NULL)
Returns the TH1F associated with the give SamplingDistribution.
This class provides simple and straightforward utilities to plot SamplingDistribution objects...
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return NULL if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
static constexpr double pc
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void Print(Option_t *opts=0) const
Print contents of the workspace.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
The RooWorkspace is a persistable container for RooFit projects.
virtual Int_t numEntries() const
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.