Logo ROOT   6.14/05
Reference Guide
OneSidedFrequentistUpperLimitWithBands.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_roostats
3 /// \notebook
4 /// OneSidedFrequentistUpperLimitWithBands
5 ///
6 /// This is a standard demo that can be used with any ROOT file
7 /// prepared in the standard way. You specify:
8 /// - name for input ROOT file
9 /// - name of workspace inside ROOT file that holds model and data
10 /// - name of ModelConfig that specifies details for calculator tools
11 /// - name of dataset
12 ///
13 /// With default parameters the macro will attempt to run the
14 /// standard hist2workspace example and read the ROOT file
15 /// that it produces.
16 ///
17 /// The first ~100 lines define a new test statistic, then the main macro starts.
18 /// You may want to control:
19 /// ~~~{.cpp}
20 /// double confidenceLevel=0.95;
21 /// int nPointsToScan = 12;
22 /// int nToyMC = 150;
23 /// ~~~
24 /// This uses a modified version of the profile likelihood ratio as
25 /// a test statistic for upper limits (eg. test stat = 0 if muhat>mu).
26 ///
27 /// Based on the observed data, one defines a set of parameter points
28 /// to be tested based on the value of the parameter of interest
29 /// and the conditional MLE (eg. profiled) values of the nuisance parameters.
30 ///
31 /// At each parameter point, pseudo-experiments are generated using this
32 /// fixed reference model and then the test statistic is evaluated.
33 /// Note, the nuisance parameters are floating in the fits. For each point,
34 /// the threshold that defines the 95% acceptance region is found. This
35 /// forms a "Confidence Belt".
36 ///
37 /// After constructing the confidence belt, one can find the confidence
38 /// interval for any particular dataset by finding the intersection
39 /// of the observed test statistic and the confidence belt. First
40 /// this is done on the observed data to get an observed 1-sided upper limt.
41 ///
42 /// Finally, there expected limit and bands (from background-only) are
43 /// formed by generating background-only data and finding the upper limit.
44 /// This is done by hand for now, will later be part of the RooStats tools.
45 ///
46 /// On a technical note, this technique is NOT the Feldman-Cousins technique,
47 /// because that is a 2-sided interval BY DEFINITION. However, like the
48 /// Feldman-Cousins technique this is a Neyman-Construction. For technical
49 /// reasons the easiest way to implement this right now is to use the
50 /// FeldmanCousins tool and then change the test statistic that it is using.
51 ///
52 /// Building the confidence belt can be computationally expensive. Once it is built,
53 /// one could save it to a file and use it in a separate step.
54 ///
55 /// We can use PROOF to speed things along in parallel, however,
56 /// the test statistic has to be installed on the workers
57 /// so either turn off PROOF or include the modified test statistic
58 /// in your `$ROOTSYS/roofit/roostats/inc` directory,
59 /// add the additional line to the LinkDef.h file,
60 /// and recompile root.
61 ///
62 /// Note, if you have a boundary on the parameter of interest (eg. cross-section)
63 /// the threshold on the one-sided test statistic starts off very small because we
64 /// are only including downward fluctuations. You can see the threshold in these printouts:
65 /// ~~~{.cpp}
66 /// [#0] PROGRESS:Generation -- generated toys: 500 / 999
67 /// NeymanConstruction: Prog: 12/50 total MC = 39 this test stat = 0
68 /// SigXsecOverSM=0.69 alpha_syst1=0.136515 alpha_syst3=0.425415 beta_syst2=1.08496 [-1e+30, 0.011215] in interval = 1
69 /// ~~~
70 /// this tells you the values of the parameters being used to generate the pseudo-experiments
71 /// and the threshold in this case is 0.011215. One would expect for 95% that the threshold
72 /// would be ~1.35 once the cross-section is far enough away from 0 that it is essentially
73 /// unaffected by the boundary. As one reaches the last points in the scan, the
74 /// theshold starts to get artificially high. This is because the range of the parameter in
75 /// the fit is the same as the range in the scan. In the future, these should be independently
76 /// controlled, but they are not now. As a result the ~50% of pseudo-experiments that have an
77 /// upward fluctuation end up with muhat = muMax. Because of this, the upper range of the
78 /// parameter should be well above the expected upper limit... but not too high or one will
79 /// need a very large value of nPointsToScan to resolve the relevant region. This can be
80 /// improved, but this is the first version of this script.
81 ///
82 /// Important note: when the model includes external constraint terms, like a Gaussian
83 /// constraint to a nuisance parameter centered around some nominal value there is
84 /// a subtlety. The asymptotic results are all based on the assumption that all the
85 /// measurements fluctuate... including the nominal values from auxiliary measurements.
86 /// If these do not fluctuate, this corresponds to an "conditional ensemble". The
87 /// result is that the distribution of the test statistic can become very non-chi^2.
88 /// This results in thresholds that become very large. This can be seen in the following
89 /// thought experiment. Say the model is
90 /// \f$ Pois(N | s + b)G(b0|b,sigma) \f$
91 /// where \f$ G(b0|b,sigma) \f$ is the external constraint and b0 is 100. If N is also 100
92 /// then the profiled value of b given s is going to be some trade off between 100-s and b0.
93 /// If sigma is \f$ \sqrt(N) \f$, then the profiled value of b is probably 100 - s/2 So for
94 /// s=60 we are going to have a profiled value of b~70. Now when we generate pseudo-experiments
95 /// for s=60, b=70 we will have N~130 and the average shat will be 30, not 60. In practice,
96 /// this is only an issue for values of s that are very excluded. For values of s near the 95%
97 /// limit this should not be a big effect. This can be avoided if the nominal values of the constraints also fluctuate, but that requires that those parameters are RooRealVars in the model.
98 /// This version does not deal with this issue, but it will be addressed in a future version.
99 ///
100 /// \macro_image
101 /// \macro_output
102 /// \macro_code
103 ///
104 /// \authors Kyle Cranmer Haichen Wang Daniel Whiteson
105 
106 #include "TFile.h"
107 #include "TROOT.h"
108 #include "TH1F.h"
109 #include "TCanvas.h"
110 #include "TSystem.h"
111 
112 #include "RooWorkspace.h"
113 #include "RooSimultaneous.h"
114 #include "RooAbsData.h"
115 
116 #include "RooStats/ModelConfig.h"
117 #include "RooStats/FeldmanCousins.h"
118 #include "RooStats/ToyMCSampler.h"
120 #include "RooStats/ConfidenceBelt.h"
121 
122 #include "RooStats/RooStatsUtils.h"
124 
125 using namespace RooFit;
126 using namespace RooStats;
127 
128 bool useProof = false; // flag to control whether to use Proof
129 int nworkers = 0; // number of workers (default use all available cores)
130 
131 // -------------------------------------------------------
132 // The actual macro
133 
134 void OneSidedFrequentistUpperLimitWithBands(const char* infile = "",
135  const char* workspaceName = "combined",
136  const char* modelConfigName = "ModelConfig",
137  const char* dataName = "obsData") {
138 
139 
140 
141  double confidenceLevel=0.95;
142  int nPointsToScan = 12;
143  int nToyMC = 150;
144 
145  // -------------------------------------------------------
146  // First part is just to access a user-defined file
147  // or create the standard example file if it doesn't exist
148  const char* filename = "";
149  if (!strcmp(infile,"")) {
150  filename = "results/example_combined_GaussExample_model.root";
151  bool fileExist = !gSystem->AccessPathName(filename); // note opposite return code
152  // if file does not exists generate with histfactory
153  if (!fileExist) {
154 #ifdef _WIN32
155  cout << "HistFactory file cannot be generated on Windows - exit" << endl;
156  return;
157 #endif
158  // Normally this would be run on the command line
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;
165  }
166 
167  }
168  else
169  filename = infile;
170 
171  // Try to open the file
172  TFile *file = TFile::Open(filename);
173 
174  // if input file was specified byt not found, quit
175  if(!file ){
176  cout <<"StandardRooStatsDemoMacro: Input file " << filename << " is not found" << endl;
177  return;
178  }
179 
180 
181  // -------------------------------------------------------
182  // Now get the data and workspace
183 
184  // get the workspace out of the file
185  RooWorkspace* w = (RooWorkspace*) file->Get(workspaceName);
186  if(!w){
187  cout <<"workspace not found" << endl;
188  return;
189  }
190 
191  // get the modelConfig out of the file
192  ModelConfig* mc = (ModelConfig*) w->obj(modelConfigName);
193 
194  // get the modelConfig out of the file
195  RooAbsData* data = w->data(dataName);
196 
197  // make sure ingredients are found
198  if(!data || !mc){
199  w->Print();
200  cout << "data or ModelConfig was not found" <<endl;
201  return;
202  }
203 
204  // -------------------------------------------------------
205  // Now get the POI for convenience
206  // you may want to adjust the range of your POI
207 
208  RooRealVar* firstPOI = (RooRealVar*) mc->GetParametersOfInterest()->first();
209  /* firstPOI->setMin(0);*/
210  /* firstPOI->setMax(10);*/
211 
212  // --------------------------------------------
213  // Create and use the FeldmanCousins tool
214  // to find and plot the 95% confidence interval
215  // on the parameter of interest as specified
216  // in the model config
217  // REMEMBER, we will change the test statistic
218  // so this is NOT a Feldman-Cousins interval
219  FeldmanCousins fc(*data,*mc);
220  fc.SetConfidenceLevel(confidenceLevel);
221  fc.AdditionalNToysFactor(0.5); // degrade/improve sampling that defines confidence belt: in this case makes the example faster
222  /* fc.UseAdaptiveSampling(true); // speed it up a bit, don't use for expected limits*/
223  fc.SetNBins(nPointsToScan); // set how many points per parameter of interest to scan
224  fc.CreateConfBelt(true); // save the information in the belt for plotting
225 
226  // -------------------------------------------------------
227  // Feldman-Cousins is a unified limit by definition
228  // but the tool takes care of a few things for us like which values
229  // of the nuisance parameters should be used to generate toys.
230  // so let's just change the test statistic and realize this is
231  // no longer "Feldman-Cousins" but is a fully frequentist Neyman-Construction.
232  /* ProfileLikelihoodTestStatModified onesided(*mc->GetPdf());*/
233  /* fc.GetTestStatSampler()->SetTestStatistic(&onesided);*/
234  /* ((ToyMCSampler*) fc.GetTestStatSampler())->SetGenerateBinned(true); */
235  ToyMCSampler* toymcsampler = (ToyMCSampler*) fc.GetTestStatSampler();
236  ProfileLikelihoodTestStat* testStat = dynamic_cast<ProfileLikelihoodTestStat*>(toymcsampler->GetTestStatistic());
237  testStat->SetOneSided(true);
238 
239  // Since this tool needs to throw toy MC the PDF needs to be
240  // extended or the tool needs to know how many entries in a dataset
241  // per pseudo experiment.
242  // In the 'number counting form' where the entries in the dataset
243  // are counts, and not values of discriminating variables, the
244  // datasets typically only have one entry and the PDF is not
245  // extended.
246  if(!mc->GetPdf()->canBeExtended()){
247  if(data->numEntries()==1)
248  fc.FluctuateNumDataEntries(false);
249  else
250  cout <<"Not sure what to do about this model" <<endl;
251  }
252 
253  // We can use PROOF to speed things along in parallel
254  // However, the test statistic has to be installed on the workers
255  // so either turn off PROOF or include the modified test statistic
256  // in your `$ROOTSYS/roofit/roostats/inc` directory,
257  // add the additional line to the LinkDef.h file,
258  // and recompile root.
259  if (useProof) {
260  ProofConfig pc(*w, nworkers, "", false);
261  toymcsampler->SetProofConfig(&pc); // enable proof
262  }
263 
264  if(mc->GetGlobalObservables()){
265  cout << "will use global observables for unconditional ensemble"<<endl;
266  mc->GetGlobalObservables()->Print();
267  toymcsampler->SetGlobalObservables(*mc->GetGlobalObservables());
268  }
269 
270 
271  // Now get the interval
272  PointSetInterval* interval = fc.GetInterval();
273  ConfidenceBelt* belt = fc.GetConfidenceBelt();
274 
275  // print out the interval on the first Parameter of Interest
276  cout << "\n95% interval on " <<firstPOI->GetName()<<" is : ["<<
277  interval->LowerLimit(*firstPOI) << ", "<<
278  interval->UpperLimit(*firstPOI) <<"] "<<endl;
279 
280  // get observed UL and value of test statistic evaluated there
281  RooArgSet tmpPOI(*firstPOI);
282  double observedUL = interval->UpperLimit(*firstPOI);
283  firstPOI->setVal(observedUL);
284  double obsTSatObsUL = fc.GetTestStatSampler()->EvaluateTestStatistic(*data,tmpPOI);
285 
286 
287  // Ask the calculator which points were scanned
288  RooDataSet* parameterScan = (RooDataSet*) fc.GetPointsToScan();
289  RooArgSet* tmpPoint;
290 
291  // make a histogram of parameter vs. threshold
292  TH1F* histOfThresholds = new TH1F("histOfThresholds","",
293  parameterScan->numEntries(),
294  firstPOI->getMin(),
295  firstPOI->getMax());
296  histOfThresholds->GetXaxis()->SetTitle(firstPOI->GetName());
297  histOfThresholds->GetYaxis()->SetTitle("Threshold");
298 
299  // loop through the points that were tested and ask confidence belt
300  // what the upper/lower thresholds were.
301  // For FeldmanCousins, the lower cut off is always 0
302  for(Int_t i=0; i<parameterScan->numEntries(); ++i){
303  tmpPoint = (RooArgSet*) parameterScan->get(i)->clone("temp");
304  //cout <<"get threshold"<<endl;
305  double arMax = belt->GetAcceptanceRegionMax(*tmpPoint);
306  double poiVal = tmpPoint->getRealValue(firstPOI->GetName()) ;
307  histOfThresholds->Fill(poiVal,arMax);
308  }
309  TCanvas* c1 = new TCanvas();
310  c1->Divide(2);
311  c1->cd(1);
312  histOfThresholds->SetMinimum(0);
313  histOfThresholds->Draw();
314  c1->cd(2);
315 
316  // -------------------------------------------------------
317  // Now we generate the expected bands and power-constraint
318 
319  // First: find parameter point for mu=0, with conditional MLEs for nuisance parameters
320  RooAbsReal* nll = mc->GetPdf()->createNLL(*data);
321  RooAbsReal* profile = nll->createProfile(*mc->GetParametersOfInterest());
322  firstPOI->setVal(0.);
323  profile->getVal(); // this will do fit and set nuisance parameters to profiled values
324  RooArgSet* poiAndNuisance = new RooArgSet();
325  if(mc->GetNuisanceParameters())
326  poiAndNuisance->add(*mc->GetNuisanceParameters());
327  poiAndNuisance->add(*mc->GetParametersOfInterest());
328  w->saveSnapshot("paramsToGenerateData",*poiAndNuisance);
329  RooArgSet* paramsToGenerateData = (RooArgSet*) poiAndNuisance->snapshot();
330  cout << "\nWill use these parameter points to generate pseudo data for bkg only" << endl;
331  paramsToGenerateData->Print("v");
332 
333 
334  RooArgSet unconditionalObs;
335  unconditionalObs.add(*mc->GetObservables());
336  unconditionalObs.add(*mc->GetGlobalObservables()); // comment this out for the original conditional ensemble
337 
338  double CLb=0;
339  double CLbinclusive=0;
340 
341  // Now we generate background only and find distribution of upper limits
342  TH1F* histOfUL = new TH1F("histOfUL","",100,0,firstPOI->getMax());
343  histOfUL->GetXaxis()->SetTitle("Upper Limit (background only)");
344  histOfUL->GetYaxis()->SetTitle("Entries");
345  for(int imc=0; imc<nToyMC; ++imc){
346 
347  // set parameters back to values for generating pseudo data
348  // cout << "\n get current nuis, set vals, print again" << endl;
349  w->loadSnapshot("paramsToGenerateData");
350  // poiAndNuisance->Print("v");
351 
352  RooDataSet* toyData = 0;
353  // now generate a toy dataset
354  if(!mc->GetPdf()->canBeExtended()){
355  if(data->numEntries()==1)
356  toyData = mc->GetPdf()->generate(*mc->GetObservables(),1);
357  else
358  cout <<"Not sure what to do about this model" <<endl;
359  } else{
360  // cout << "generating extended dataset"<<endl;
361  toyData = mc->GetPdf()->generate(*mc->GetObservables(),Extended());
362  }
363 
364  // generate global observables
365  // need to be careful for simpdf
366  // RooDataSet* globalData = mc->GetPdf()->generate(*mc->GetGlobalObservables(),1);
367 
368  RooSimultaneous* simPdf = dynamic_cast<RooSimultaneous*>(mc->GetPdf());
369  if(!simPdf){
370  RooDataSet *one = mc->GetPdf()->generate(*mc->GetGlobalObservables(), 1);
371  const RooArgSet *values = one->get();
372  RooArgSet *allVars = mc->GetPdf()->getVariables();
373  *allVars = *values;
374  delete allVars;
375  delete values;
376  delete one;
377  } else {
378 
379  //try fix for sim pdf
380  TIterator* iter = simPdf->indexCat().typeIterator() ;
381  RooCatType* tt = NULL;
382  while((tt=(RooCatType*) iter->Next())) {
383 
384  // Get pdf associated with state from simpdf
385  RooAbsPdf* pdftmp = simPdf->getPdf(tt->GetName()) ;
386 
387  // Generate only global variables defined by the pdf associated with this state
388  RooArgSet* globtmp = pdftmp->getObservables(*mc->GetGlobalObservables()) ;
389  RooDataSet* tmp = pdftmp->generate(*globtmp,1) ;
390 
391  // Transfer values to output placeholder
392  *globtmp = *tmp->get(0) ;
393 
394  // Cleanup
395  delete globtmp ;
396  delete tmp ;
397  }
398  }
399 
400  // globalData->Print("v");
401  // unconditionalObs = *globalData->get();
402  // mc->GetGlobalObservables()->Print("v");
403  // delete globalData;
404  // cout << "toy data = " << endl;
405  // toyData->get()->Print("v");
406 
407  // get test stat at observed UL in observed data
408  firstPOI->setVal(observedUL);
409  double toyTSatObsUL = fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData,tmpPOI);
410  // toyData->get()->Print("v");
411  // cout <<"obsTSatObsUL " <<obsTSatObsUL << "toyTS " << toyTSatObsUL << endl;
412  if(obsTSatObsUL < toyTSatObsUL) // not sure about <= part yet
413  CLb+= (1.)/nToyMC;
414  if(obsTSatObsUL <= toyTSatObsUL) // not sure about <= part yet
415  CLbinclusive+= (1.)/nToyMC;
416 
417 
418  // loop over points in belt to find upper limit for this toy data
419  double thisUL = 0;
420  for(Int_t i=0; i<parameterScan->numEntries(); ++i){
421  tmpPoint = (RooArgSet*) parameterScan->get(i)->clone("temp");
422  double arMax = belt->GetAcceptanceRegionMax(*tmpPoint);
423  firstPOI->setVal( tmpPoint->getRealValue(firstPOI->GetName()) );
424  // double thisTS = profile->getVal();
425  double thisTS = fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData,tmpPOI);
426 
427  // cout << "poi = " << firstPOI->getVal()
428  // << " max is " << arMax << " this profile = " << thisTS << endl;
429  // cout << "thisTS = " << thisTS<<endl;
430  if(thisTS<=arMax){
431  thisUL = firstPOI->getVal();
432  } else{
433  break;
434  }
435  }
436 
437 
438 
439  /*
440  // loop over points in belt to find upper limit for this toy data
441  double thisUL = 0;
442  for(Int_t i=0; i<histOfThresholds->GetNbinsX(); ++i){
443  tmpPoint = (RooArgSet*) parameterScan->get(i)->clone("temp");
444  cout <<"---------------- "<<i<<endl;
445  tmpPoint->Print("v");
446  cout << "from hist " << histOfThresholds->GetBinCenter(i+1) <<endl;
447  double arMax = histOfThresholds->GetBinContent(i+1);
448  // cout << " threhold from Hist = aMax " << arMax<<endl;
449  // double arMax2 = belt->GetAcceptanceRegionMax(*tmpPoint);
450  // cout << "from scan arMax2 = "<< arMax2 << endl; // not the same due to TH1F not TH1D
451  // cout << "scan - hist" << arMax2-arMax << endl;
452  firstPOI->setVal( histOfThresholds->GetBinCenter(i+1));
453  // double thisTS = profile->getVal();
454  double thisTS = fc.GetTestStatSampler()->EvaluateTestStatistic(*toyData,tmpPOI);
455 
456  // cout << "poi = " << firstPOI->getVal()
457  // << " max is " << arMax << " this profile = " << thisTS << endl;
458  // cout << "thisTS = " << thisTS<<endl;
459 
460  // NOTE: need to add a small epsilon term for single precision vs. double precision
461  if(thisTS<=arMax + 1e-7){
462  thisUL = firstPOI->getVal();
463  } else{
464  break;
465  }
466  }
467  */
468 
469  histOfUL->Fill(thisUL);
470 
471  // for few events, data is often the same, and UL is often the same
472  // cout << "thisUL = " << thisUL<<endl;
473 
474  delete toyData;
475  }
476  histOfUL->Draw();
477  c1->SaveAs("one-sided_upper_limit_output.pdf");
478 
479  // if you want to see a plot of the sampling distribution for a particular scan point:
480  /*
481  SamplingDistPlot sampPlot;
482  int indexInScan = 0;
483  tmpPoint = (RooArgSet*) parameterScan->get(indexInScan)->clone("temp");
484  firstPOI->setVal( tmpPoint->getRealValue(firstPOI->GetName()) );
485  toymcsampler->SetParametersForTestStat(tmpPOI);
486  SamplingDistribution* samp = toymcsampler->GetSamplingDistribution(*tmpPoint);
487  sampPlot.AddSamplingDistribution(samp);
488  sampPlot.Draw();
489  */
490 
491  // Now find bands and power constraint
492  Double_t* bins = histOfUL->GetIntegral();
493  TH1F* cumulative = (TH1F*) histOfUL->Clone("cumulative");
494  cumulative->SetContent(bins);
495  double band2sigDown, band1sigDown, bandMedian, band1sigUp,band2sigUp;
496  for(int i=1; i<=cumulative->GetNbinsX(); ++i){
497  if(bins[i]<RooStats::SignificanceToPValue(2))
498  band2sigDown=cumulative->GetBinCenter(i);
499  if(bins[i]<RooStats::SignificanceToPValue(1))
500  band1sigDown=cumulative->GetBinCenter(i);
501  if(bins[i]<0.5)
502  bandMedian=cumulative->GetBinCenter(i);
503  if(bins[i]<RooStats::SignificanceToPValue(-1))
504  band1sigUp=cumulative->GetBinCenter(i);
505  if(bins[i]<RooStats::SignificanceToPValue(-2))
506  band2sigUp=cumulative->GetBinCenter(i);
507  }
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;
513 
514  // print out the interval on the first Parameter of Interest
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;
518 
519  delete profile;
520  delete nll;
521 
522 }
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
Definition: RooAbsPdf.cxx:778
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)
Definition: RooAbsArg.cxx:2073
virtual const char * GetName() const
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:1276
Bool_t saveSnapshot(const char *name, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of parameters &#39;params&#39; If importValues ...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition: TH1.cxx:3251
Holds configuration options for proof and proof-lite.
Definition: ProofConfig.h:46
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Definition: TH1.cxx:8434
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:30
auto * tt
Definition: textangle.C:16
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
Definition: ModelConfig.h:237
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...
Definition: RooArgSet.h:86
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Definition: RooAbsArg.h:194
virtual void SetGlobalObservables(const RooArgSet &o)
Definition: ToyMCSampler.h:175
return c1
Definition: legend1.C:41
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
Definition: THist.hxx:285
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:688
virtual void SetMinimum(Double_t minimum=-1111)
Definition: TH1.h:391
#define gROOT
Definition: TROOT.h:410
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:567
int Int_t
Definition: RtypesCore.h:41
virtual TestStatistic * GetTestStatistic(unsigned int i) const
Definition: ToyMCSampler.h:132
RooCmdArg Extended(Bool_t flag=kTRUE)
Iterator abstract base class.
Definition: TIterator.h:30
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3976
static struct mg_connection * fc(struct mg_context *ctx)
Definition: civetweb.c:3352
ConfidenceBelt is a concrete implementation of the ConfInterval interface.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
Definition: RooCatType.h:22
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.
Definition: TH1.cxx:7700
Double_t SignificanceToPValue(Double_t Z)
returns p-value corresponding to a 1-sided significance
Definition: RooStatsUtils.h:49
virtual TObject * clone(const char *newname) const
Definition: RooArgSet.h:82
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
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 &#39;value&#39;.
Definition: RooRealVar.cxx:204
Double_t LowerLimit(RooRealVar &param)
return lower limit on a given parameter
virtual Double_t * GetIntegral()
Return a pointer to the array of bins integral.
Definition: TH1.cxx:2515
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
Definition: TSystem.h:540
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2974
TIterator * typeIterator() const
Return iterator over all defined states.
virtual const Text_t * GetName() const
Returns name of object.
Definition: RooCatType.h:44
const RooAbsCategoryLValue & indexCat() const
RooAbsArg * first() const
void SetProofConfig(ProofConfig *pc=NULL)
Definition: ToyMCSampler.h:233
TAxis * GetYaxis()
Definition: TH1.h:316
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
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.
Definition: ToyMCSampler.h:71
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
Bool_t canBeExtended() const
Definition: RooAbsPdf.h:216
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event &#39;index&#39;.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
Double_t UpperLimit(RooRealVar &param)
return upper limit on a given parameter
The FeldmanCousins class (like the Feldman-Cousins technique) is essentially a specific configuration...
The Canvas class.
Definition: TCanvas.h:31
Namespace for the RooStats classes.
Definition: Asimov.h:20
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
Definition: ModelConfig.h:222
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
Definition: ModelConfig.h:225
PointSetInterval is a concrete implementation of the ConfInterval interface.
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
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...
Definition: RooAbsPdf.h:41
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.
Definition: TPad.cxx:1162
const RooArgSet * GetGlobalObservables() const
get RooArgSet for global observables (return NULL if not existing)
Definition: ModelConfig.h:243
Definition: file.py:1
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:228
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.
Definition: RooArgSet.cxx:526
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...
Definition: RooAbsPdf.cxx:1725
virtual RooAbsReal * createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function...
Definition: RooAbsReal.cxx:461
virtual TObject * Next()=0
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2657
static constexpr double pc
virtual Int_t GetNbinsX() const
Definition: TH1.h:291
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:5504
Double_t GetAcceptanceRegionMax(RooArgSet &, Double_t cl=-1., Double_t leftside=-1.)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
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...
Definition: TH1.h:315
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:285