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