43 using namespace RooFit;
44 using namespace RooStats;
54 const char* workspaceName =
"combined",
55 const char* modelConfigName =
"ModelConfig",
56 const char* dataName =
"obsData"){
63 bool allowNegativeMu=
true;
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;
98 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
110 cout <<
"workspace not found" << endl;
123 cout <<
"data or ModelConfig was not found" <<endl;
134 double plcUpperLimit = interval->
UpperLimit(*firstPOI);
136 cout <<
"\n\n--------------------------------------"<<endl;
137 cout <<
"Will generate sampling distribution at " << firstPOI->
GetName() <<
" = " << plcUpperLimit <<endl;
140 cout <<
"not sure what to do with other parameters of interest, but here are their values"<<endl;
162 cout <<
"tell it to use 1 event"<<endl;
165 firstPOI->
setVal(plcUpperLimit);
173 firstPOI->
setVal(plcUpperLimit);
177 allParameters.
Print(
"v");
182 plot.
GetTH1F(sampDist)->GetYaxis()->SetTitle(
Form(
"f(-log #lambda(#mu=%.2f) | #mu=%.2f)",plcUpperLimit,plcUpperLimit));
185 TCanvas*
c1 =
new TCanvas(
"c1");
188 double min = plot.
GetTH1F(sampDist)->GetXaxis()->GetXmin();
189 double max = plot.
GetTH1F(sampDist)->GetXaxis()->GetXmax();
191 TF1*
f =
new TF1(
"f",
Form(
"2*ROOT::Math::chisquared_pdf(2*x,%d,0)",nPOI),min,max);
193 c1->SaveAs(
"standard_test_stat_distribution.pdf");
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.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
virtual void SetParametersForTestStat(const RooArgSet &nullpoi)
LikelihoodInterval is a concrete implementation of the RooStats::ConfInterval interface.
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
virtual void SetGlobalObservables(const RooArgSet &o)
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return NULL if not existing)
ProfileLikelihoodCalculator is a concrete implementation of CombinedCalculator (the interface class f...
static const char * filename()
Double_t AddSamplingDistribution(const SamplingDistribution *samplingDist, Option_t *drawOptions="NORMALIZE HIST")
adds the sampling distribution and returns the scale factor
virtual void SetNEventsPerToy(const Int_t nevents)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
virtual LikelihoodInterval * GetInterval() const
Return a likelihood interval.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
RooAbsArg * first() const
void plot(TString fname="data.root", TString var0="var0", TString var1="var1")
void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
RooRealVar represents a fundamental (non-derived) real valued object.
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
R__EXTERN TSystem * gSystem
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
void SetAxisTitle(char *varName)
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
virtual Int_t numEntries() const
void SetProofConfig(ProofConfig *pc=NULL)
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
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.
virtual void Print(Option_t *option="") const
overload the print method
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
TH1F * GetTH1F(const SamplingDistribution *samplDist=NULL)
Returns the TH1F associated with the give SamplingDistribution.
virtual void SetObservables(const RooArgSet &o)
Bool_t canBeExtended() const
virtual void SetPdf(RooAbsPdf &pdf)
virtual SamplingDistribution * GetSamplingDistribution(RooArgSet ¶mPoint)
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
This class provides simple and straightforward utilities to plot SamplingDistribution objects...
virtual Double_t getMax(const char *name=0) const
void StandardTestStatDistributionDemo(const char *infile="", const char *workspaceName="combined", const char *modelConfigName="ModelConfig", const char *dataName="obsData")
void Print(Option_t *opts=0) const
Print contents of the workspace.
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
The RooWorkspace is a persistable container for RooFit projects.