Logo ROOT   6.12/07
Reference Guide
StandardHypoTestDemo.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_roostats
3 /// \notebook
4 /// Standard tutorial macro for hypothesis test (for computing the discovery significance) using all
5 /// RooStats hypotheiss tests calculators and test statistics.
6 ///
7 /// Usage:
8 ///
9 /// ~~~{.cpp}
10 /// root>.L StandardHypoTestDemo.C
11 /// root> StandardHypoTestDemo("fileName","workspace name","S+B modelconfig name","B model name","data set name",calculator type, test statistic type, number of toys)
12 ///
13 /// type = 0 Freq calculator
14 /// type = 1 Hybrid calculator
15 /// type = 2 Asymptotic calculator
16 /// type = 3 Asymptotic calculator using nominal Asimov data sets (not using fitted parameter values but nominal ones)
17 ///
18 /// testStatType = 0 LEP
19 /// = 1 Tevatron
20 /// = 2 Profile Likelihood
21 /// = 3 Profile Likelihood one sided (i.e. = 0 if mu_hat < 0)
22 /// ~~~
23 ///
24 /// \macro_image
25 /// \macro_output
26 /// \macro_code
27 ///
28 /// \author Lorenzo Moneta
29 
30 #include "TFile.h"
31 #include "RooWorkspace.h"
32 #include "RooAbsPdf.h"
33 #include "RooRealVar.h"
34 #include "RooDataSet.h"
35 #include "RooStats/ModelConfig.h"
36 #include "RooRandom.h"
37 #include "TGraphErrors.h"
38 #include "TGraphAsymmErrors.h"
39 #include "TCanvas.h"
40 #include "TLine.h"
41 #include "TSystem.h"
42 #include "TROOT.h"
43 
47 #include "RooStats/ToyMCSampler.h"
48 #include "RooStats/HypoTestPlot.h"
49 
55 
59 
60 #include <cassert>
61 
62 using namespace RooFit;
63 using namespace RooStats;
64 
65 struct HypoTestOptions {
66 
67  bool noSystematics = false; // force all systematics to be off (i.e. set all nuisance parameters as constat
68  double nToysRatio = 4; // ratio Ntoys Null/ntoys ALT
69  double poiValue = -1; // change poi snapshot value for S+B model (needed for expected p0 values)
70 int printLevel=0;
71 bool generateBinned = false; // for binned generation
72  bool useProof = false; // use Proof
73  bool enableDetailedOutput = false; // for detailed output
74 
75 };
76 
77 HypoTestOptions optHT;
78 
79 void StandardHypoTestDemo(const char* infile = "",
80  const char* workspaceName = "combined",
81  const char* modelSBName = "ModelConfig",
82  const char* modelBName = "",
83  const char* dataName = "obsData",
84  int calcType = 0, /* 0 freq 1 hybrid, 2 asymptotic */
85  int testStatType = 3, /* 0 LEP, 1 TeV, 2 LHC, 3 LHC - one sided*/
86  int ntoys = 5000,
87  bool useNC = false,
88  const char * nuisPriorName = 0)
89 {
90 
91  bool noSystematics = optHT.noSystematics;
92  double nToysRatio = optHT.nToysRatio; // ratio Ntoys Null/ntoys ALT
93  double poiValue = optHT.poiValue; // change poi snapshot value for S+B model (needed for expected p0 values)
94  int printLevel = optHT.printLevel;
95  bool generateBinned = optHT.generateBinned; // for binned generation
96  bool useProof = optHT.useProof; // use Proof
97  bool enableDetOutput = optHT.enableDetailedOutput;
98 
99 
100  // Other Parameter to pass in tutorial
101  // apart from standard for filename, ws, modelconfig and data
102 
103  // type = 0 Freq calculator
104  // type = 1 Hybrid calculator
105  // type = 2 Asymptotic calculator
106 
107  // testStatType = 0 LEP
108  // = 1 Tevatron
109  // = 2 Profile Likelihood
110  // = 3 Profile Likelihood one sided (i.e. = 0 if mu < mu_hat)
111 
112  // ntoys: number of toys to use
113 
114  // useNumberCounting: set to true when using number counting events
115 
116  // nuisPriorName: name of prior for the nuisance. This is often expressed as constraint term in the global model
117  // It is needed only when using the HybridCalculator (type=1)
118  // If not given by default the prior pdf from ModelConfig is used.
119 
120  // extra options are available as global parameters of the macro. They major ones are:
121 
122  // generateBinned generate binned data sets for toys (default is false) - be careful not to activate with
123  // a too large (>=3) number of observables
124  // nToyRatio ratio of S+B/B toys (default is 2)
125  // printLevel
126 
127 
128  // disable - can cause some problems
129  //ToyMCSampler::SetAlwaysUseMultiGen(true);
130 
131  SimpleLikelihoodRatioTestStat::SetAlwaysReuseNLL(true);
132  ProfileLikelihoodTestStat::SetAlwaysReuseNLL(true);
133  RatioOfProfiledLikelihoodsTestStat::SetAlwaysReuseNLL(true);
134 
135  //RooRandom::randomGenerator()->SetSeed(0);
136 
137  // to change minimizers
138  // ~~~{.bash}
139  // ROOT::Math::MinimizerOptions::SetDefaultStrategy(0);
140  // ROOT::Math::MinimizerOptions::SetDefaultMinimizer("Minuit2");
141  // ROOT::Math::MinimizerOptions::SetDefaultTolerance(1);
142  // ~~~
143 
144  // -------------------------------------------------------
145  // First part is just to access a user-defined file
146  // or create the standard example file if it doesn't exist
147  const char* filename = "";
148  if (!strcmp(infile,"")) {
149  filename = "results/example_combined_GaussExample_model.root";
150  bool fileExist = !gSystem->AccessPathName(filename); // note opposite return code
151  // if file does not exists generate with histfactory
152  if (!fileExist) {
153 #ifdef _WIN32
154  cout << "HistFactory file cannot be generated on Windows - exit" << endl;
155  return;
156 #endif
157  // Normally this would be run on the command line
158  cout <<"will run standard hist2workspace example"<<endl;
159  gROOT->ProcessLine(".! prepareHistFactory .");
160  gROOT->ProcessLine(".! hist2workspace config/example.xml");
161  cout <<"\n\n---------------------"<<endl;
162  cout <<"Done creating example input"<<endl;
163  cout <<"---------------------\n\n"<<endl;
164  }
165 
166  }
167  else
168  filename = infile;
169 
170  // Try to open the file
171  TFile *file = TFile::Open(filename);
172 
173  // if input file was specified byt not found, quit
174  if(!file ){
175  cout <<"StandardRooStatsDemoMacro: Input file " << filename << " is not found" << endl;
176  return;
177  }
178 
179 
180  // -------------------------------------------------------
181  // Tutorial starts here
182  // -------------------------------------------------------
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  w->Print();
191 
192  // get the modelConfig out of the file
193  ModelConfig* sbModel = (ModelConfig*) w->obj(modelSBName);
194 
195 
196  // get the modelConfig out of the file
197  RooAbsData* data = w->data(dataName);
198 
199  // make sure ingredients are found
200  if(!data || !sbModel){
201  w->Print();
202  cout << "data or ModelConfig was not found" <<endl;
203  return;
204  }
205  // make b model
206  ModelConfig* bModel = (ModelConfig*) w->obj(modelBName);
207 
208 
209  // case of no systematics
210  // remove nuisance parameters from model
211  if (noSystematics) {
212  const RooArgSet * nuisPar = sbModel->GetNuisanceParameters();
213  if (nuisPar && nuisPar->getSize() > 0) {
214  std::cout << "StandardHypoTestInvDemo" << " - Switch off all systematics by setting them constant to their initial values" << std::endl;
215  RooStats::SetAllConstant(*nuisPar);
216  }
217  if (bModel) {
218  const RooArgSet * bnuisPar = bModel->GetNuisanceParameters();
219  if (bnuisPar)
220  RooStats::SetAllConstant(*bnuisPar);
221  }
222  }
223 
224 
225  if (!bModel ) {
226  Info("StandardHypoTestInvDemo","The background model %s does not exist",modelBName);
227  Info("StandardHypoTestInvDemo","Copy it from ModelConfig %s and set POI to zero",modelSBName);
228  bModel = (ModelConfig*) sbModel->Clone();
229  bModel->SetName(TString(modelSBName)+TString("B_only"));
230  RooRealVar * var = dynamic_cast<RooRealVar*>(bModel->GetParametersOfInterest()->first());
231  if (!var) return;
232  double oldval = var->getVal();
233  var->setVal(0);
234  //bModel->SetSnapshot( RooArgSet(*var, *w->var("lumi")) );
235  bModel->SetSnapshot( RooArgSet(*var) );
236  var->setVal(oldval);
237  }
238 
239  if (!sbModel->GetSnapshot() || poiValue > 0) {
240  Info("StandardHypoTestDemo","Model %s has no snapshot - make one using model poi",modelSBName);
241  RooRealVar * var = dynamic_cast<RooRealVar*>(sbModel->GetParametersOfInterest()->first());
242  if (!var) return;
243  double oldval = var->getVal();
244  if (poiValue > 0) var->setVal(poiValue);
245  //sbModel->SetSnapshot( RooArgSet(*var, *w->var("lumi") ) );
246  sbModel->SetSnapshot( RooArgSet(*var) );
247  if (poiValue > 0) var->setVal(oldval);
248  //sbModel->SetSnapshot( *sbModel->GetParametersOfInterest() );
249  }
250 
251 
252 
253 
254 
255  // part 1, hypothesis testing
256  SimpleLikelihoodRatioTestStat * slrts = new SimpleLikelihoodRatioTestStat(*bModel->GetPdf(), *sbModel->GetPdf());
257  // null parameters must includes snapshot of poi plus the nuisance values
258  RooArgSet nullParams(*bModel->GetSnapshot());
259  if (bModel->GetNuisanceParameters()) nullParams.add(*bModel->GetNuisanceParameters());
260 
261  slrts->SetNullParameters(nullParams);
262  RooArgSet altParams(*sbModel->GetSnapshot());
263  if (sbModel->GetNuisanceParameters()) altParams.add(*sbModel->GetNuisanceParameters());
264  slrts->SetAltParameters(altParams);
265 
267 
268 
270  ropl = new RatioOfProfiledLikelihoodsTestStat(*bModel->GetPdf(), *sbModel->GetPdf(), sbModel->GetSnapshot());
271  ropl->SetSubtractMLE(false);
272 
273  if (testStatType == 3) profll->SetOneSidedDiscovery(1);
274  profll->SetPrintLevel(printLevel);
275 
276  if (enableDetOutput) {
277  slrts->EnableDetailedOutput();
278  profll->EnableDetailedOutput();
279  ropl->EnableDetailedOutput();
280  }
281 
282 
283  /* profll.SetReuseNLL(mOptimize);*/
284  /* slrts.SetReuseNLL(mOptimize);*/
285  /* ropl.SetReuseNLL(mOptimize);*/
286 
287  AsymptoticCalculator::SetPrintLevel(printLevel);
288 
289  HypoTestCalculatorGeneric * hypoCalc = 0;
290  // note here Null is B and Alt is S+B
291  if (calcType == 0) hypoCalc = new FrequentistCalculator(*data, *sbModel, *bModel);
292  else if (calcType == 1) hypoCalc= new HybridCalculator(*data, *sbModel, *bModel);
293  else if (calcType == 2) hypoCalc= new AsymptoticCalculator(*data, *sbModel, *bModel);
294 
295  if (calcType == 0) {
296  ((FrequentistCalculator*)hypoCalc)->SetToys(ntoys, ntoys/nToysRatio);
297  if (enableDetOutput) ((FrequentistCalculator*) hypoCalc)->StoreFitInfo(true);
298  }
299  if (calcType == 1) {
300  ((HybridCalculator*)hypoCalc)->SetToys(ntoys, ntoys/nToysRatio);
301  // n. a. yetif (enableDetOutput) ((HybridCalculator*) hypoCalc)->StoreFitInfo(true);
302  }
303  if (calcType == 2 ) {
304  if (testStatType == 3) ((AsymptoticCalculator*) hypoCalc)->SetOneSidedDiscovery(true);
305  if (testStatType != 2 && testStatType != 3)
306  Warning("StandardHypoTestDemo","Only the PL test statistic can be used with AsymptoticCalculator - use by default a two-sided PL");
307 
308 
309  }
310 
311 
312  // check for nuisance prior pdf in case of nuisance parameters
313  if (calcType == 1 && (bModel->GetNuisanceParameters() || sbModel->GetNuisanceParameters() )) {
314  RooAbsPdf * nuisPdf = 0;
315  if (nuisPriorName) nuisPdf = w->pdf(nuisPriorName);
316  // use prior defined first in bModel (then in SbModel)
317  if (!nuisPdf) {
318  Info("StandardHypoTestDemo","No nuisance pdf given for the HybridCalculator - try to deduce pdf from the model");
319  if (bModel->GetPdf() && bModel->GetObservables() )
320  nuisPdf = RooStats::MakeNuisancePdf(*bModel,"nuisancePdf_bmodel");
321  else
322  nuisPdf = RooStats::MakeNuisancePdf(*sbModel,"nuisancePdf_sbmodel");
323  }
324  if (!nuisPdf ) {
325  if (bModel->GetPriorPdf()) {
326  nuisPdf = bModel->GetPriorPdf();
327  Info("StandardHypoTestDemo","No nuisance pdf given - try to use %s that is defined as a prior pdf in the B model",nuisPdf->GetName());
328  }
329  else {
330  Error("StandardHypoTestDemo","Cannot run Hybrid calculator because no prior on the nuisance parameter is specified or can be derived");
331  return;
332  }
333  }
334  assert(nuisPdf);
335  Info("StandardHypoTestDemo","Using as nuisance Pdf ... " );
336  nuisPdf->Print();
337 
338  const RooArgSet * nuisParams = (bModel->GetNuisanceParameters() ) ? bModel->GetNuisanceParameters() : sbModel->GetNuisanceParameters();
339  RooArgSet * np = nuisPdf->getObservables(*nuisParams);
340  if (np->getSize() == 0) {
341  Warning("StandardHypoTestDemo","Prior nuisance does not depend on nuisance parameters. They will be smeared in their full range");
342  }
343  delete np;
344 
345  ((HybridCalculator*)hypoCalc)->ForcePriorNuisanceAlt(*nuisPdf);
346  ((HybridCalculator*)hypoCalc)->ForcePriorNuisanceNull(*nuisPdf);
347  }
348 
349  /* hypoCalc->ForcePriorNuisanceAlt(*sbModel->GetPriorPdf());*/
350  /* hypoCalc->ForcePriorNuisanceNull(*bModel->GetPriorPdf());*/
351 
352  ToyMCSampler * sampler = (ToyMCSampler *)hypoCalc->GetTestStatSampler();
353 
354  if (sampler && (calcType == 0 || calcType == 1) ) {
355 
356  // look if pdf is number counting or extended
357  if (sbModel->GetPdf()->canBeExtended() ) {
358  if (useNC) Warning("StandardHypoTestDemo","Pdf is extended: but number counting flag is set: ignore it ");
359  }
360  else {
361  // for not extended pdf
362  if (!useNC) {
363  int nEvents = data->numEntries();
364  Info("StandardHypoTestDemo","Pdf is not extended: number of events to generate taken from observed data set is %d",nEvents);
365  sampler->SetNEventsPerToy(nEvents);
366  }
367  else {
368  Info("StandardHypoTestDemo","using a number counting pdf");
369  sampler->SetNEventsPerToy(1);
370  }
371  }
372 
373  if (data->isWeighted() && !generateBinned) {
374  Info("StandardHypoTestDemo","Data set is weighted, nentries = %d and sum of weights = %8.1f but toy generation is unbinned - it would be faster to set generateBinned to true\n",data->numEntries(), data->sumEntries());
375  }
376  if (generateBinned) sampler->SetGenerateBinned(generateBinned);
377 
378  // use PROOF
379  if (useProof) {
380  ProofConfig pc(*w, 0, "", kFALSE);
381  sampler->SetProofConfig(&pc); // enable proof
382  }
383 
384 
385 
386  // set the test statistic
387  if (testStatType == 0) sampler->SetTestStatistic(slrts);
388  if (testStatType == 1) sampler->SetTestStatistic(ropl);
389  if (testStatType == 2 || testStatType == 3) sampler->SetTestStatistic(profll);
390 
391  }
392 
393  HypoTestResult * htr = hypoCalc->GetHypoTest();
394  htr->SetPValueIsRightTail(true);
395  htr->SetBackgroundAsAlt(false);
396  htr->Print(); // how to get meaningful CLs at this point?
397 
398  delete sampler;
399  delete slrts;
400  delete ropl;
401  delete profll;
402 
403  if (calcType != 2) {
404  HypoTestPlot * plot = new HypoTestPlot(*htr,100);
405  plot->SetLogYaxis(true);
406  plot->Draw();
407  }
408  else {
409  std::cout << "Asymptotic results " << std::endl;
410 
411  }
412 
413  // look at expected significances
414  // found median of S+B distribution
415  if (calcType != 2) {
416 
417  SamplingDistribution * altDist = htr->GetAltDistribution();
418  HypoTestResult htExp("Expected Result");
419  htExp.Append(htr);
420  // find quantiles in alt (S+B) distribution
421  double p[5];
422  double q[5];
423  for (int i = 0; i < 5; ++i) {
424  double sig = -2 + i;
425  p[i] = ROOT::Math::normal_cdf(sig,1);
426  }
427  std::vector<double> values = altDist->GetSamplingDistribution();
428  TMath::Quantiles( values.size(), 5, &values[0], q, p, false);
429 
430  for (int i = 0; i < 5; ++i) {
431  htExp.SetTestStatisticData( q[i] );
432  double sig = -2 + i;
433  std::cout << " Expected p -value and significance at " << sig << " sigma = "
434  << htExp.NullPValue() << " significance " << htExp.Significance() << " sigma " << std::endl;
435 
436  }
437  }
438  else {
439  // case of asymptotic calculator
440  for (int i = 0; i < 5; ++i) {
441  double sig = -2 + i;
442  // sigma is inverted here
443  double pval = AsymptoticCalculator::GetExpectedPValues( htr->NullPValue(), htr->AlternatePValue(), -sig, false);
444  std::cout << " Expected p -value and significance at " << sig << " sigma = "
445  << pval << " significance " << ROOT::Math::normal_quantile_c(pval,1) << " sigma " << std::endl;
446 
447  }
448  }
449 
450 
451  // write result in a file in case of toys
452  bool writeResult = (calcType != 2);
453 
454  if (enableDetOutput) {
455  writeResult=true;
456  Info("StandardHypoTestDemo","Detailed output will be written in output result file");
457  }
458 
459 
460  if (htr != NULL && writeResult) {
461 
462  // write to a file the results
463  const char * calcTypeName = (calcType == 0) ? "Freq" : (calcType == 1) ? "Hybr" : "Asym";
464  TString resultFileName = TString::Format("%s_HypoTest_ts%d_",calcTypeName,testStatType);
465  //strip the / from the filename
466 
467  TString name = infile;
468  name.Replace(0, name.Last('/')+1, "");
469  resultFileName += name;
470 
471  TFile * fileOut = new TFile(resultFileName,"RECREATE");
472  htr->Write();
473  Info("StandardHypoTestDemo","HypoTestResult has been written in the file %s",resultFileName.Data());
474 
475  fileOut->Close();
476  }
477 
478 
479 
480 
481 
482 }
483 
virtual Double_t sumEntries() const =0
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:785
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
void SetBackgroundAsAlt(Bool_t l=kTRUE)
Holds configuration options for proof and proof-lite.
Definition: ProofConfig.h:46
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...
Definition: ModelConfig.h:30
const RooArgSet * GetObservables() const
get RooArgSet for observables (return NULL if not existing)
Definition: ModelConfig.h:237
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
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
void Print(const Option_t *="") const
Print out some information about the results Note: use Alt/Null labels for the hypotheses here as the...
double normal_quantile_c(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the upper tail of the normal (Gaussian) distri...
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
HypoTestResult is a base class for results from hypothesis tests.
virtual void SetNEventsPerToy(const Int_t nevents)
Definition: ToyMCSampler.h:147
#define gROOT
Definition: TROOT.h:402
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
This class provides the plots for the result of a study performed with any of the HypoTestCalculatorG...
Definition: HypoTestPlot.h:22
SamplingDistribution * GetAltDistribution(void) const
void SetLogYaxis(Bool_t ly)
changes plot to log scale on y axis
virtual ModelConfig * Clone(const char *name="") const
clone
Definition: ModelConfig.h:54
void SetAltParameters(const RooArgSet &altParameters)
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:3950
virtual void SetTestStatistic(TestStatistic *testStatistic, unsigned int i)
Definition: ToyMCSampler.h:184
Common base class for the Hypothesis Test Calculators.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2365
void SetNullParameters(const RooArgSet &nullParameters)
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=0, Int_t type=7)
Computes sample quantiles, corresponding to the given probabilities Parameters: x -the data sample n ...
Definition: TMath.cxx:1178
double normal_cdf(double x, double sigma=1, double x0=0)
Cumulative distribution function of the normal (Gaussian) distribution (lower tail).
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsArg.h:227
void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
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...
RooAbsPdf * GetPriorPdf() const
get parameters prior pdf (return NULL if not existing)
Definition: ModelConfig.h:234
virtual void setVal(Double_t value)
Set value of variable to &#39;value&#39;.
Definition: RooRealVar.cxx:205
virtual HypoTestResult * GetHypoTest() const
inherited methods from HypoTestCalculator interface
Int_t getSize() const
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
RooAbsArg * first() const
virtual Double_t NullPValue() const
Return p-value for null hypothesis.
void SetProofConfig(ProofConfig *pc=NULL)
Definition: ToyMCSampler.h:233
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
ToyMCSampler is an implementation of the TestStatSampler interface.
Definition: ToyMCSampler.h:71
void Warning(const char *location, const char *msgfmt,...)
This class simply holds a sampling distribution of some test statistic.
TestStatistic that returns the ratio of profiled likelihoods.
Bool_t canBeExtended() const
Definition: RooAbsPdf.h:216
Same purpose as HybridCalculatorOriginal, but different implementation.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
virtual Double_t AlternatePValue() const
Return p-value for alternate hypothesis.
const Bool_t kFALSE
Definition: RtypesCore.h:88
void SetPValueIsRightTail(Bool_t pr)
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
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
bool SetAllConstant(const RooAbsCollection &coll, bool constant=true)
Definition: RooStatsUtils.h:82
TestStatistic class that returns -log(L[null] / L[alt]) where L is the likelihood.
virtual Bool_t isWeighted() const
Definition: RooAbsData.h:94
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
Definition: file.py:1
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:228
Does a frequentist hypothesis test.
static constexpr double pc
void SetGenerateBinned(bool binned=true)
Definition: ToyMCSampler.h:203
const RooArgSet * GetSnapshot() const
get RooArgSet for parameters for a particular hypothesis (return NULL if not existing) ...
float * q
Definition: THbookFile.cxx:87
void Print(Option_t *opts=0) const
Print contents of the workspace.
virtual void SetSnapshot(const RooArgSet &set)
set parameter values for a particular hypothesis if using a common PDF by saving a snapshot in the wo...
Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio...
char name[80]
Definition: TGX11.cxx:109
TestStatSampler * GetTestStatSampler(void) const
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:285