128 bool useProof =
false;
134 void OneSidedFrequentistUpperLimitWithBands(
const char* infile =
"",
135 const char* workspaceName =
"combined",
136 const char* modelConfigName =
"ModelConfig",
137 const char* dataName =
"obsData") {
141 double confidenceLevel=0.95;
142 int nPointsToScan = 12;
148 const char* filename =
"";
149 if (!strcmp(infile,
"")) {
150 filename =
"results/example_combined_GaussExample_model.root";
155 cout <<
"HistFactory file cannot be generated on Windows - exit" << endl;
159 cout <<
"will run standard hist2workspace example"<<endl;
160 gROOT->ProcessLine(
".! prepareHistFactory .");
161 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
162 cout <<
"\n\n---------------------"<<endl;
163 cout <<
"Done creating example input"<<endl;
164 cout <<
"---------------------\n\n"<<endl;
176 cout <<
"StandardRooStatsDemoMacro: Input file " << filename <<
" is not found" << endl;
187 cout <<
"workspace not found" << endl;
200 cout <<
"data or ModelConfig was not found" <<endl;
220 fc.SetConfidenceLevel(confidenceLevel);
221 fc.AdditionalNToysFactor(0.5);
223 fc.SetNBins(nPointsToScan);
224 fc.CreateConfBelt(
true);
248 fc.FluctuateNumDataEntries(
false);
250 cout <<
"Not sure what to do about this model" <<endl;
265 cout <<
"will use global observables for unconditional ensemble"<<endl;
276 cout <<
"\n95% interval on " <<firstPOI->
GetName()<<
" is : ["<<
282 double observedUL = interval->
UpperLimit(*firstPOI);
283 firstPOI->
setVal(observedUL);
284 double obsTSatObsUL =
fc.GetTestStatSampler()->EvaluateTestStatistic(*data,tmpPOI);
292 TH1F* histOfThresholds =
new TH1F(
"histOfThresholds",
"",
307 histOfThresholds->
Fill(poiVal,arMax);
313 histOfThresholds->
Draw();
328 w->
saveSnapshot(
"paramsToGenerateData",*poiAndNuisance);
330 cout <<
"\nWill use these parameter points to generate pseudo data for bkg only" << endl;
331 paramsToGenerateData->
Print(
"v");
339 double CLbinclusive=0;
342 TH1F* histOfUL =
new TH1F(
"histOfUL",
"",100,0,firstPOI->
getMax());
345 for(
int imc=0; imc<nToyMC; ++imc){
358 cout <<
"Not sure what to do about this model" <<endl;
392 *globtmp = *tmp->
get(0) ;
408 firstPOI->
setVal(observedUL);
409 double toyTSatObsUL =
fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData,tmpPOI);
412 if(obsTSatObsUL < toyTSatObsUL)
414 if(obsTSatObsUL <= toyTSatObsUL)
415 CLbinclusive+= (1.)/nToyMC;
425 double thisTS =
fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData,tmpPOI);
431 thisUL = firstPOI->
getVal();
469 histOfUL->
Fill(thisUL);
477 c1->
SaveAs(
"one-sided_upper_limit_output.pdf");
495 double band2sigDown, band1sigDown, bandMedian, band1sigUp,band2sigUp;
496 for(
int i=1; i<=cumulative->
GetNbinsX(); ++i){
508 cout <<
"-2 sigma band " << band2sigDown << endl;
509 cout <<
"-1 sigma band " << band1sigDown <<
" [Power Constraint)]" << endl;
510 cout <<
"median of band " << bandMedian << endl;
511 cout <<
"+1 sigma band " << band1sigUp << endl;
512 cout <<
"+2 sigma band " << band2sigUp << endl;
515 cout <<
"\nobserved 95% upper-limit "<< interval->
UpperLimit(*firstPOI) <<endl;
516 cout <<
"CLb strict [P(toy>obs|0)] for observed 95% upper-limit "<< CLb <<endl;
517 cout <<
"CLb inclusive [P(toy>=obs|0)] for observed 95% upper-limit "<< CLbinclusive <<endl;
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
virtual Double_t getMin(const char *name=0) const
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
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.
Bool_t saveSnapshot(const char *name, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of parameters 'params' If importValues ...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Holds configuration options for proof and proof-lite.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
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...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
virtual void SetGlobalObservables(const RooArgSet &o)
Double_t getVal(const RooArgSet *set=0) const
void SetOneSided(Bool_t flag=true)
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void SetMinimum(Double_t minimum=-1111)
1-D histogram with a float per channel (see TH1 documentation)}
virtual TestStatistic * GetTestStatistic(unsigned int i) const
RooCmdArg Extended(Bool_t flag=kTRUE)
Iterator abstract base class.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
static struct mg_connection * fc(struct mg_context *ctx)
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
virtual void SetContent(const Double_t *content)
Replace bin contents by the contents of array content.
Double_t SignificanceToPValue(Double_t Z)
returns p-value corresponding to a 1-sided significance
virtual TObject * clone(const char *newname) const
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 LowerLimit(RooRealVar ¶m)
return lower limit on a given parameter
virtual Double_t * GetIntegral()
Return a pointer to the array of bins integral.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
R__EXTERN TSystem * gSystem
virtual void Draw(Option_t *option="")
Draw this histogram with options.
TIterator * typeIterator() const
Return iterator over all defined states.
virtual const Text_t * GetName() const
Returns name of object.
const RooAbsCategoryLValue & indexCat() const
RooAbsArg * first() const
void SetProofConfig(ProofConfig *pc=NULL)
RooAbsData is the common abstract base class for binned and unbinned datasets.
Bool_t loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name...
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
ToyMCSampler is an implementation of the TestStatSampler interface.
RooDataSet is a container class to hold unbinned data.
Bool_t canBeExtended() const
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
Double_t UpperLimit(RooRealVar ¶m)
return upper limit on a given parameter
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
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)
PointSetInterval is a concrete implementation of the ConfInterval interface.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsPdf * getPdf(const char *catName) const
Return the p.d.f associated with the given index category name.
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
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)
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
Generate a new dataset containing the specified variables with events sampled from our distribution...
virtual RooAbsReal * createProfile(const RooArgSet ¶msOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function...
virtual TObject * Next()=0
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
static constexpr double pc
virtual Int_t GetNbinsX() const
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
Double_t GetAcceptanceRegionMax(RooArgSet &, Double_t cl=-1., Double_t leftside=-1.)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void Print(Option_t *opts=0) const
Print contents of the workspace.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset...
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