Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TwoSidedFrequentistUpperLimitWithBands.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_roostats
3/// \notebook -js
4/// TwoSidedFrequentistUpperLimitWithBands
5///
6///
7/// This is a standard demo that can be used with any ROOT file
8/// prepared in the standard way. You specify:
9/// - name for input ROOT file
10/// - name of workspace inside ROOT file that holds model and data
11/// - name of ModelConfig that specifies details for calculator tools
12/// - name of dataset
13///
14/// With default parameters the macro will attempt to run the
15/// standard hist2workspace example and read the ROOT file
16/// that it produces.
17///
18/// You may want to control:
19/// ~~~{.cpp}
20/// double confidenceLevel=0.95;
21/// double additionalToysFac = 1.;
22/// int nPointsToScan = 12;
23/// int nToyMC = 200;
24/// ~~~
25///
26/// This uses a modified version of the profile likelihood ratio as
27/// a test statistic for upper limits (eg. test stat = 0 if muhat>mu).
28///
29/// Based on the observed data, one defines a set of parameter points
30/// to be tested based on the value of the parameter of interest
31/// and the conditional MLE (eg. profiled) values of the nuisance parameters.
32///
33/// At each parameter point, pseudo-experiments are generated using this
34/// fixed reference model and then the test statistic is evaluated.
35/// The auxiliary measurements (global observables) associated with the
36/// constraint terms in nuisance parameters are also fluctuated in the
37/// process of generating the pseudo-experiments in a frequentist manner
38/// forming an 'unconditional ensemble'. One could form a 'conditional'
39/// ensemble in which these auxiliary measurements are fixed. Note that the
40/// nuisance parameters are not randomized, which is a Bayesian procedure.
41/// Note, the nuisance parameters are floating in the fits. For each point,
42/// the threshold that defines the 95% acceptance region is found. This
43/// forms a "Confidence Belt".
44///
45/// After constructing the confidence belt, one can find the confidence
46/// interval for any particular dataset by finding the intersection
47/// of the observed test statistic and the confidence belt. First
48/// this is done on the observed data to get an observed 1-sided upper limt.
49///
50/// Finally, there expected limit and bands (from background-only) are
51/// formed by generating background-only data and finding the upper limit.
52/// The background-only is defined as such that the nuisance parameters are
53/// fixed to their best fit value based on the data with the signal rate fixed to 0.
54/// The bands are done by hand for now, will later be part of the RooStats tools.
55///
56/// On a technical note, this technique IS the generalization of Feldman-Cousins
57/// with nuisance parameters.
58///
59/// Building the confidence belt can be computationally expensive.
60/// Once it is built, one could save it to a file and use it in a separate step.
61///
62/// We can use PROOF to speed things along in parallel, however,
63/// the test statistic has to be installed on the workers
64/// so either turn off PROOF or include the modified test statistic
65/// in your $ROOTSYS/roofit/roostats/inc directory,
66/// add the additional line to the LinkDef.h file,
67/// and recompile root.
68///
69/// Note, if you have a boundary on the parameter of interest (eg. cross-section)
70/// the threshold on the two-sided test statistic starts off at moderate values and plateaus.
71///
72/// [#0] PROGRESS:Generation -- generated toys: 500 / 999
73/// NeymanConstruction: Prog: 12/50 total MC = 39 this test stat = 0
74/// SigXsecOverSM=0.69 alpha_syst1=0.136515 alpha_syst3=0.425415 beta_syst2=1.08496 [-1e+30, 0.011215] in interval = 1
75///
76/// this tells you the values of the parameters being used to generate the pseudo-experiments
77/// and the threshold in this case is 0.011215. One would expect for 95% that the threshold
78/// would be ~1.35 once the cross-section is far enough away from 0 that it is essentially
79/// unaffected by the boundary. As one reaches the last points in the scan, the
80/// threshold starts to get artificially high. This is because the range of the parameter in
81/// the fit is the same as the range in the scan. In the future, these should be independently
82/// controlled, but they are not now. As a result the ~50% of pseudo-experiments that have an
83/// upward fluctuation end up with muhat = muMax. Because of this, the upper range of the
84/// parameter should be well above the expected upper limit... but not too high or one will
85/// need a very large value of nPointsToScan to resolve the relevant region. This can be
86/// improved, but this is the first version of this script.
87///
88/// Important note: when the model includes external constraint terms, like a Gaussian
89/// constraint to a nuisance parameter centered around some nominal value there is
90/// a subtlety. The asymptotic results are all based on the assumption that all the
91/// measurements fluctuate... including the nominal values from auxiliary measurements.
92/// If these do not fluctuate, this corresponds to an "conditional ensemble". The
93/// result is that the distribution of the test statistic can become very non-chi^2.
94/// This results in thresholds that become very large.
95///
96/// \macro_image
97/// \macro_output
98/// \macro_code
99///
100/// \authors Kyle Cranmer,Contributions from Aaron Armbruster, Haoshuang Ji, Haichen Wang and Daniel Whiteson
101
102#include "TFile.h"
103#include "TROOT.h"
104#include "TH1F.h"
105#include "TCanvas.h"
106#include "TSystem.h"
107#include <iostream>
108
109#include "RooWorkspace.h"
110#include "RooSimultaneous.h"
111#include "RooAbsData.h"
112
113#include "RooStats/ModelConfig.h"
118
121
122using namespace RooFit;
123using namespace RooStats;
124using std::cout, std::endl;
125
126bool useProof = false; // flag to control whether to use Proof
127int nworkers = 0; // number of workers (default use all available cores)
128
129// -------------------------------------------------------
130
131void TwoSidedFrequentistUpperLimitWithBands(const char *infile = "", const char *workspaceName = "combined",
132 const char *modelConfigName = "ModelConfig",
133 const char *dataName = "obsData")
134{
135
136 double confidenceLevel = 0.95;
137 // degrade/improve number of pseudo-experiments used to define the confidence belt.
138 // value of 1 corresponds to default number of toys in the tail, which is 50/(1-confidenceLevel)
139 double additionalToysFac = 0.5;
140 int nPointsToScan = 20; // number of steps in the parameter of interest
141 int nToyMC = 200; // number of toys used to define the expected limit and band
142
143 // -------------------------------------------------------
144 // First part is just to access a user-defined file
145 // or create the standard example file if it doesn't exist
146 const char *filename = "";
147 if (!strcmp(infile, "")) {
148 filename = "results/example_combined_GaussExample_model.root";
149 bool fileExist = !gSystem->AccessPathName(filename); // note opposite return code
150 // if file does not exists generate with histfactory
151 if (!fileExist) {
152 // Normally this would be run on the command line
153 cout << "will run standard hist2workspace example" << endl;
154 gROOT->ProcessLine(".! prepareHistFactory .");
155 gROOT->ProcessLine(".! hist2workspace config/example.xml");
156 cout << "\n\n---------------------" << endl;
157 cout << "Done creating example input" << endl;
158 cout << "---------------------\n\n" << endl;
159 }
160
161 } else
162 filename = infile;
163
164 // Try to open the file
165 TFile *inputFile = TFile::Open(filename);
166
167 // -------------------------------------------------------
168 // Now get the data and workspace
169
170 // get the workspace out of the file
171 RooWorkspace *w = (RooWorkspace *)inputFile->Get(workspaceName);
172
173 // get the modelConfig out of the file
174 ModelConfig *mc = (ModelConfig *)w->obj(modelConfigName);
175
176 // get the modelConfig out of the file
177 RooAbsData *data = w->data(dataName);
178
179 cout << "Found data and ModelConfig:" << endl;
180 mc->Print();
181
182 // -------------------------------------------------------
183 // Now get the POI for convenience
184 // you may want to adjust the range of your POI
185 RooRealVar *firstPOI = (RooRealVar *)mc->GetParametersOfInterest()->first();
186 /* firstPOI->setMin(0);*/
187 /* firstPOI->setMax(10);*/
188
189 // -------------------------------------------------------
190 // create and use the FeldmanCousins tool
191 // to find and plot the 95% confidence interval
192 // on the parameter of interest as specified
193 // in the model config
194 // REMEMBER, we will change the test statistic
195 // so this is NOT a Feldman-Cousins interval
196 FeldmanCousins fc(*data, *mc);
197 fc.SetConfidenceLevel(confidenceLevel);
198 fc.AdditionalNToysFactor(additionalToysFac); // improve sampling that defines confidence belt
199 // fc.UseAdaptiveSampling(true); // speed it up a bit, but don't use for expected limits
200 fc.SetNBins(nPointsToScan); // set how many points per parameter of interest to scan
201 fc.CreateConfBelt(true); // save the information in the belt for plotting
202
203 // -------------------------------------------------------
204 // Feldman-Cousins is a unified limit by definition
205 // but the tool takes care of a few things for us like which values
206 // of the nuisance parameters should be used to generate toys.
207 // so let's just change the test statistic and realize this is
208 // no longer "Feldman-Cousins" but is a fully frequentist Neyman-Construction.
209 // fc.GetTestStatSampler()->SetTestStatistic(&onesided);
210 // ((ToyMCSampler*) fc.GetTestStatSampler())->SetGenerateBinned(true);
211 ToyMCSampler *toymcsampler = (ToyMCSampler *)fc.GetTestStatSampler();
212 ProfileLikelihoodTestStat *testStat = dynamic_cast<ProfileLikelihoodTestStat *>(toymcsampler->GetTestStatistic());
213
214 // Since this tool needs to throw toy MC the PDF needs to be
215 // extended or the tool needs to know how many entries in a dataset
216 // per pseudo experiment.
217 // In the 'number counting form' where the entries in the dataset
218 // are counts, and not values of discriminating variables, the
219 // datasets typically only have one entry and the PDF is not
220 // extended.
221 if (!mc->GetPdf()->canBeExtended()) {
222 if (data->numEntries() == 1)
223 fc.FluctuateNumDataEntries(false);
224 else
225 cout << "Not sure what to do about this model" << endl;
226 }
227
228 // We can use PROOF to speed things along in parallel
229 // However, the test statistic has to be installed on the workers
230 // so either turn off PROOF or include the modified test statistic
231 // in your $ROOTSYS/roofit/roostats/inc directory,
232 // add the additional line to the LinkDef.h file,
233 // and recompile root.
234 if (useProof) {
235 ProofConfig pc(*w, nworkers, "", false);
236 toymcsampler->SetProofConfig(&pc); // enable proof
237 }
238
239 if (mc->GetGlobalObservables()) {
240 cout << "will use global observables for unconditional ensemble" << endl;
242 toymcsampler->SetGlobalObservables(*mc->GetGlobalObservables());
243 }
244
245 // Now get the interval
246 PointSetInterval *interval = fc.GetInterval();
247 ConfidenceBelt *belt = fc.GetConfidenceBelt();
248
249 // print out the interval on the first Parameter of Interest
250 cout << "\n95% interval on " << firstPOI->GetName() << " is : [" << interval->LowerLimit(*firstPOI) << ", "
251 << interval->UpperLimit(*firstPOI) << "] " << endl;
252
253 // get observed UL and value of test statistic evaluated there
254 RooArgSet tmpPOI(*firstPOI);
255 double observedUL = interval->UpperLimit(*firstPOI);
256 firstPOI->setVal(observedUL);
257 double obsTSatObsUL = fc.GetTestStatSampler()->EvaluateTestStatistic(*data, tmpPOI);
258
259 // Ask the calculator which points were scanned
260 RooDataSet *parameterScan = (RooDataSet *)fc.GetPointsToScan();
261 RooArgSet *tmpPoint;
262
263 // make a histogram of parameter vs. threshold
264 TH1F *histOfThresholds =
265 new TH1F("histOfThresholds", "", parameterScan->numEntries(), firstPOI->getMin(), firstPOI->getMax());
266 histOfThresholds->GetXaxis()->SetTitle(firstPOI->GetName());
267 histOfThresholds->GetYaxis()->SetTitle("Threshold");
268
269 // loop through the points that were tested and ask confidence belt
270 // what the upper/lower thresholds were.
271 // For FeldmanCousins, the lower cut off is always 0
272 for (Int_t i = 0; i < parameterScan->numEntries(); ++i) {
273 tmpPoint = (RooArgSet *)parameterScan->get(i)->clone("temp");
274 // cout <<"get threshold"<<endl;
275 double arMax = belt->GetAcceptanceRegionMax(*tmpPoint);
276 double poiVal = tmpPoint->getRealValue(firstPOI->GetName());
277 histOfThresholds->Fill(poiVal, arMax);
278 }
279 TCanvas *c1 = new TCanvas();
280 c1->Divide(2);
281 c1->cd(1);
282 histOfThresholds->SetMinimum(0);
283 histOfThresholds->Draw();
284 c1->cd(2);
285
286 // -------------------------------------------------------
287 // Now we generate the expected bands and power-constraint
288
289 // First: find parameter point for mu=0, with conditional MLEs for nuisance parameters
290 std::unique_ptr<RooAbsReal> nll{mc->GetPdf()->createNLL(*data)};
291 std::unique_ptr<RooAbsReal> profile{nll->createProfile(*mc->GetParametersOfInterest())};
292 firstPOI->setVal(0.);
293 profile->getVal(); // this will do fit and set nuisance parameters to profiled values
294 RooArgSet *poiAndNuisance = new RooArgSet();
295 if (mc->GetNuisanceParameters())
296 poiAndNuisance->add(*mc->GetNuisanceParameters());
297 poiAndNuisance->add(*mc->GetParametersOfInterest());
298 w->saveSnapshot("paramsToGenerateData", *poiAndNuisance);
299 RooArgSet *paramsToGenerateData = (RooArgSet *)poiAndNuisance->snapshot();
300 cout << "\nWill use these parameter points to generate pseudo data for bkg only" << endl;
301 paramsToGenerateData->Print("v");
302
303 RooArgSet unconditionalObs;
304 unconditionalObs.add(*mc->GetObservables());
305 unconditionalObs.add(*mc->GetGlobalObservables()); // comment this out for the original conditional ensemble
306
307 double CLb = 0;
308 double CLbinclusive = 0;
309
310 // Now we generate background only and find distribution of upper limits
311 TH1F *histOfUL = new TH1F("histOfUL", "", 100, 0, firstPOI->getMax());
312 histOfUL->GetXaxis()->SetTitle("Upper Limit (background only)");
313 histOfUL->GetYaxis()->SetTitle("Entries");
314 for (int imc = 0; imc < nToyMC; ++imc) {
315
316 // set parameters back to values for generating pseudo data
317 // cout << "\n get current nuis, set vals, print again" << endl;
318 w->loadSnapshot("paramsToGenerateData");
319 // poiAndNuisance->Print("v");
320
321 std::unique_ptr<RooDataSet> toyData;
322 // now generate a toy dataset for the main measurement
323 if (!mc->GetPdf()->canBeExtended()) {
324 if (data->numEntries() == 1)
325 toyData = std::unique_ptr<RooDataSet>{mc->GetPdf()->generate(*mc->GetObservables(), 1)};
326 else
327 cout << "Not sure what to do about this model" << endl;
328 } else {
329 // cout << "generating extended dataset"<<endl;
330 toyData = std::unique_ptr<RooDataSet>{mc->GetPdf()->generate(*mc->GetObservables(), Extended())};
331 }
332
333 // generate global observables
334 // need to be careful for simpdf.
335 // In ROOT 5.28 there is a problem with generating global observables
336 // with a simultaneous PDF. In 5.29 there is a solution with
337 // RooSimultaneous::generateSimGlobal, but this may change to
338 // the standard generate interface in 5.30.
339
340 RooSimultaneous *simPdf = dynamic_cast<RooSimultaneous *>(mc->GetPdf());
341 if (!simPdf) {
342 std::unique_ptr<RooDataSet> one{mc->GetPdf()->generate(*mc->GetGlobalObservables(), 1)};
343 const RooArgSet *values = one->get();
344 std::unique_ptr<RooArgSet> allVars{mc->GetPdf()->getVariables()};
345 allVars->assign(*values);
346 } else {
347 std::unique_ptr<RooDataSet> one{simPdf->generateSimGlobal(*mc->GetGlobalObservables(), 1)};
348 const RooArgSet *values = one->get();
349 std::unique_ptr<RooArgSet> allVars{mc->GetPdf()->getVariables()};
350 allVars->assign(*values);
351 }
352
353 // get test stat at observed UL in observed data
354 firstPOI->setVal(observedUL);
355 double toyTSatObsUL = fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData, tmpPOI);
356 // toyData->get()->Print("v");
357 // cout <<"obsTSatObsUL " <<obsTSatObsUL << "toyTS " << toyTSatObsUL << endl;
358 if (obsTSatObsUL < toyTSatObsUL) // not sure about <= part yet
359 CLb += (1.) / nToyMC;
360 if (obsTSatObsUL <= toyTSatObsUL) // not sure about <= part yet
361 CLbinclusive += (1.) / nToyMC;
362
363 // loop over points in belt to find upper limit for this toy data
364 double thisUL = 0;
365 for (Int_t i = 0; i < parameterScan->numEntries(); ++i) {
366 tmpPoint = (RooArgSet *)parameterScan->get(i)->clone("temp");
367 double arMax = belt->GetAcceptanceRegionMax(*tmpPoint);
368 firstPOI->setVal(tmpPoint->getRealValue(firstPOI->GetName()));
369 // double thisTS = profile->getVal();
370 double thisTS = fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData, tmpPOI);
371
372 // cout << "poi = " << firstPOI->getVal()
373 // << " max is " << arMax << " this profile = " << thisTS << endl;
374 // cout << "thisTS = " << thisTS<<endl;
375 if (thisTS <= arMax) {
376 thisUL = firstPOI->getVal();
377 } else {
378 break;
379 }
380 }
381
382 histOfUL->Fill(thisUL);
383
384 // for few events, data is often the same, and UL is often the same
385 // cout << "thisUL = " << thisUL<<endl;
386 }
387 histOfUL->Draw();
388 c1->SaveAs("two-sided_upper_limit_output.pdf");
389
390 // if you want to see a plot of the sampling distribution for a particular scan point:
391 /*
392 SamplingDistPlot sampPlot;
393 int indexInScan = 0;
394 tmpPoint = (RooArgSet*) parameterScan->get(indexInScan)->clone("temp");
395 firstPOI->setVal( tmpPoint->getRealValue(firstPOI->GetName()) );
396 toymcsampler->SetParametersForTestStat(tmpPOI);
397 SamplingDistribution* samp = toymcsampler->GetSamplingDistribution(*tmpPoint);
398 sampPlot.AddSamplingDistribution(samp);
399 sampPlot.Draw();
400 */
401
402 // Now find bands and power constraint
403 Double_t *bins = histOfUL->GetIntegral();
404 TH1F *cumulative = (TH1F *)histOfUL->Clone("cumulative");
405 cumulative->SetContent(bins);
406 double band2sigDown = 0, band1sigDown = 0, bandMedian = 0, band1sigUp = 0, band2sigUp = 0;
407 for (int i = 1; i <= cumulative->GetNbinsX(); ++i) {
408 if (bins[i] < RooStats::SignificanceToPValue(2))
409 band2sigDown = cumulative->GetBinCenter(i);
410 if (bins[i] < RooStats::SignificanceToPValue(1))
411 band1sigDown = cumulative->GetBinCenter(i);
412 if (bins[i] < 0.5)
413 bandMedian = cumulative->GetBinCenter(i);
414 if (bins[i] < RooStats::SignificanceToPValue(-1))
415 band1sigUp = cumulative->GetBinCenter(i);
416 if (bins[i] < RooStats::SignificanceToPValue(-2))
417 band2sigUp = cumulative->GetBinCenter(i);
418 }
419 cout << "-2 sigma band " << band2sigDown << endl;
420 cout << "-1 sigma band " << band1sigDown << " [Power Constraint)]" << endl;
421 cout << "median of band " << bandMedian << endl;
422 cout << "+1 sigma band " << band1sigUp << endl;
423 cout << "+2 sigma band " << band2sigUp << endl;
424
425 // print out the interval on the first Parameter of Interest
426 cout << "\nobserved 95% upper-limit " << interval->UpperLimit(*firstPOI) << endl;
427 cout << "CLb strict [P(toy>obs|0)] for observed 95% upper-limit " << CLb << endl;
428 cout << "CLb inclusive [P(toy>=obs|0)] for observed 95% upper-limit " << CLbinclusive << endl;
429}
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
#define gROOT
Definition TROOT.h:406
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
Storage_t const & get() const
Const access to the underlying stl container.
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.
Definition RooAbsData.h:57
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
Definition RooAbsPdf.h:163
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
Definition RooAbsPdf.h:219
RooFit::OwningPtr< RooDataSet > generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={})
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
Definition RooAbsPdf.h:57
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
TObject * clone(const char *newname) const override
Definition RooArgSet.h:148
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Definition RooArgSet.h:191
Container class to hold unbinned data.
Definition RooDataSet.h:57
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
Variable that can be changed from the outside.
Definition RooRealVar.h:37
void setVal(double value) override
Set value of variable to 'value'.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooFit::OwningPtr< RooDataSet > generateSimGlobal(const RooArgSet &whatVars, Int_t nEvents) override
Special generator interface for generation of 'global observables' – for RooStats tools.
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
double GetAcceptanceRegionMax(RooArgSet &, double cl=-1., double leftside=-1.)
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition ModelConfig.h:35
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)
PointSetInterval is a concrete implementation of the ConfInterval interface.
double UpperLimit(RooRealVar &param)
return upper limit on a given parameter
double LowerLimit(RooRealVar &param)
return lower limit on a given parameter
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
Holds configuration options for proof and proof-lite.
Definition ProofConfig.h:45
ToyMCSampler is an implementation of the TestStatSampler interface.
void SetProofConfig(ProofConfig *pc=nullptr)
calling with argument or nullptr deactivates proof
virtual TestStatistic * GetTestStatistic(unsigned int i) const
void SetGlobalObservables(const RooArgSet &o) override
specify the conditional observables
Persistable container for RooFit projects.
The Canvas class.
Definition TCanvas.h:23
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
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.
Definition TFile.cxx:4089
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Definition TH1.cxx:9109
TAxis * GetXaxis()
Definition TH1.h:324
virtual Int_t GetNbinsX() const
Definition TH1.h:297
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition TH1.cxx:3344
TAxis * GetYaxis()
Definition TH1.h:325
virtual void SetContent(const Double_t *content)
Replace bin contents by the contents of array content.
Definition TH1.cxx:8366
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3066
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:404
virtual Double_t * GetIntegral()
Return a pointer to the array of bins integral.
Definition TH1.cxx:2586
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Definition TH1.cxx:2752
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296
RooCmdArg Extended(bool flag=true)
return c1
Definition legend1.C:41
double nll(double pdf, double weight, int binnedL, int doBinOffset)
Definition MathFuncs.h:353
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26
Namespace for the RooStats classes.
Definition Asimov.h:19
double SignificanceToPValue(double Z)
returns p-value corresponding to a 1-sided significance