ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HybridCalculatorOriginal.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 
3 /*************************************************************************
4  * Project: RooStats *
5  * Package: RooFit/RooStats *
6  * Authors: *
7  * Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke *
8  * Other author of this class: Danilo Piparo *
9  *************************************************************************
10  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
11  * All rights reserved. *
12  * *
13  * For the licensing terms see $ROOTSYS/LICENSE. *
14  * For the list of contributors see $ROOTSYS/README/CREDITS. *
15  *************************************************************************/
16 
17 ////////////////////////////////////////////////////////////////////////////////
18 
20 
21 #include "RooStats/ModelConfig.h"
22 
23 #include "RooDataHist.h"
24 #include "RooDataSet.h"
25 #include "RooGlobalFunc.h"
26 #include "RooNLLVar.h"
27 #include "RooRealVar.h"
28 #include "RooAbsData.h"
29 #include "RooWorkspace.h"
30 
31 #include "TH1.h"
32 
33 using namespace std;
34 
36 
37 using namespace RooStats;
38 
39 ///////////////////////////////////////////////////////////////////////////
40 
41 HybridCalculatorOriginal::HybridCalculatorOriginal(const char *name) :
42  TNamed(name,name),
43  fSbModel(0),
44  fBModel(0),
45  fObservables(0),
46  fNuisanceParameters(0),
47  fPriorPdf(0),
48  fData(0),
49  fGenerateBinned(false),
50  fUsePriorPdf(false), fTmpDoExtended(true)
51 {
52  // constructor with name and title
53  // set default parameters
54  SetTestStatistic(1);
55  SetNumberOfToys(1000);
56 }
57 
58 
59 /// constructor without the data - is it needed ???????????
60 HybridCalculatorOriginal::HybridCalculatorOriginal( RooAbsPdf& sbModel,
61  RooAbsPdf& bModel,
62  RooArgList& observables,
63  const RooArgSet* nuisance_parameters,
64  RooAbsPdf* priorPdf ,
65  bool GenerateBinned,
66  int testStatistics,
67  int numToys) :
68  fSbModel(&sbModel),
69  fBModel(&bModel),
70  fNuisanceParameters(nuisance_parameters),
71  fPriorPdf(priorPdf),
72  fData(0),
73  fGenerateBinned(GenerateBinned),
74  fUsePriorPdf(false),
75  fTmpDoExtended(true)
76 {
77  /// HybridCalculatorOriginal constructor without specifying a data set
78  /// the user need to specify the models in the S+B case and B-only case,
79  /// the list of observables of the model(s) (for MC-generation), the list of parameters
80  /// that are marginalised and the prior distribution of those parameters
81 
82  // observables are managed by the class (they are copied in)
83  fObservables = new RooArgList(observables);
84  //Try to recover the information from the pdf's
85  //fObservables=new RooArgList("fObservables");
86  //fNuisanceParameters=new RooArgSet("fNuisanceParameters");
87  // if (priorPdf){
88 
89 
90  SetTestStatistic(testStatistics);
91  SetNumberOfToys(numToys);
92 
93  if (priorPdf) UseNuisance(true);
94 
95  // this->Print();
96  /* if ( _verbose ) */ //this->PrintMore("v"); /// TO DO: add the verbose mode
97 }
98 
99 
101  RooAbsPdf& sbModel,
102  RooAbsPdf& bModel,
103  const RooArgSet* nuisance_parameters,
104  RooAbsPdf* priorPdf,
105  bool GenerateBinned,
106  int testStatistics,
107  int numToys) :
108  fSbModel(&sbModel),
109  fBModel(&bModel),
110  fObservables(0),
111  fNuisanceParameters(nuisance_parameters),
112  fPriorPdf(priorPdf),
113  fData(&data),
114  fGenerateBinned(GenerateBinned),
115  fUsePriorPdf(false),
116  fTmpDoExtended(true)
117 {
118  /// HybridCalculatorOriginal constructor for performing hypotesis test
119  /// the user need to specify the data set, the models in the S+B case and B-only case.
120  /// In case of treatment of nuisance parameter, the user need to specify the
121  /// the list of parameters that are marginalised and the prior distribution of those parameters
122 
123 
124  SetTestStatistic(testStatistics);
125  SetNumberOfToys(numToys);
126 
127  if (priorPdf) UseNuisance(true);
128 }
129 
130 
131 
133  const ModelConfig& sbModel,
134  const ModelConfig& bModel,
135  bool GenerateBinned,
136  int testStatistics,
137  int numToys) :
138  fSbModel(sbModel.GetPdf()),
139  fBModel(bModel.GetPdf()),
140  fObservables(0), // no need to set them - can be taken from the data
141  fNuisanceParameters((sbModel.GetNuisanceParameters()) ? sbModel.GetNuisanceParameters() : bModel.GetNuisanceParameters()),
142  fPriorPdf((sbModel.GetPriorPdf()) ? sbModel.GetPriorPdf() : bModel.GetPriorPdf()),
143  fData(&data),
144  fGenerateBinned(GenerateBinned),
145  fUsePriorPdf(false),
146  fTmpDoExtended(true)
147 {
148  /// Constructor with a ModelConfig object representing the signal + background model and
149  /// another model config representig the background only model
150  /// a Prior pdf for the nuiscane parameter of the signal and background can be specified in
151  /// the s+b model or the b model. If it is specified in the s+b model, the one of the s+b model will be used
152 
153  if (fPriorPdf) UseNuisance(true);
154 
155  SetTestStatistic(testStatistics);
156  SetNumberOfToys(numToys);
157 }
158 
159 ///////////////////////////////////////////////////////////////////////////
160 
162 {
163  /// HybridCalculatorOriginal destructor
164  if (fObservables) delete fObservables;
165 }
166 
167 ///////////////////////////////////////////////////////////////////////////
168 
170 {
171  // Set the model describing the null hypothesis
172  fBModel = model.GetPdf();
173  // only if it has not been set before
174  if (!fPriorPdf) fPriorPdf = model.GetPriorPdf();
176 }
177 
179 {
180  // Set the model describing the alternate hypothesis
181  fSbModel = model.GetPdf();
182  fPriorPdf = model.GetPriorPdf();
184 }
185 
187 {
188  /// set the desired test statistics:
189  /// index=1 : likelihood ratio: 2 * log( L_sb / L_b ) (DEFAULT)
190  /// index=2 : number of generated events
191  /// index=3 : profiled likelihood ratio
192  /// if the index is different to any of those values, the default is used
193  fTestStatisticsIdx = index;
194 }
195 
196 ///////////////////////////////////////////////////////////////////////////
197 
198 HybridResult* HybridCalculatorOriginal::Calculate(TH1& data, unsigned int nToys, bool usePriors) const
199 {
200  /// first compute the test statistics for data and then prepare and run the toy-MC experiments
201 
202  /// convert data TH1 histogram to a RooDataHist
203  TString dataHistName = GetName(); dataHistName += "_roodatahist";
204  RooDataHist dataHist(dataHistName,"Data distribution as RooDataHist converted from TH1",*fObservables,&data);
205 
206  HybridResult* result = Calculate(dataHist,nToys,usePriors);
207 
208  return result;
209 }
210 
211 ///////////////////////////////////////////////////////////////////////////
212 
213 HybridResult* HybridCalculatorOriginal::Calculate(RooAbsData& data, unsigned int nToys, bool usePriors) const
214 {
215  /// first compute the test statistics for data and then prepare and run the toy-MC experiments
216 
217  double testStatData = 0;
218  if ( fTestStatisticsIdx==2 ) {
219  /// number of events used as test statistics
220  double nEvents = data.sumEntries();
221  testStatData = nEvents;
222  } else if ( fTestStatisticsIdx==3 ) {
223  /// profiled likelihood ratio used as test statistics
224  if ( fTmpDoExtended ) {
225  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,data,RooFit::CloneData(false),RooFit::Extended());
227  double sb_nll_val = sb_nll.getVal();
228  RooNLLVar b_nll("b_nll","b_nll",*fBModel,data,RooFit::CloneData(false),RooFit::Extended());
230  double b_nll_val = b_nll.getVal();
231  double m2lnQ = 2*(sb_nll_val-b_nll_val);
232  testStatData = m2lnQ;
233  } else {
234  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,data,RooFit::CloneData(false));
235  fSbModel->fitTo(data,RooFit::Hesse(false),RooFit::Strategy(0));
236  double sb_nll_val = sb_nll.getVal();
237  RooNLLVar b_nll("b_nll","b_nll",*fBModel,data,RooFit::CloneData(false));
238  fBModel->fitTo(data,RooFit::Hesse(false),RooFit::Strategy(0));
239  double b_nll_val = b_nll.getVal();
240  double m2lnQ = 2*(sb_nll_val-b_nll_val);
241  testStatData = m2lnQ;
242  }
243  } else if ( fTestStatisticsIdx==1 ) {
244  /// likelihood ratio used as test statistics (default)
245  if ( fTmpDoExtended ) {
246  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,data,RooFit::Extended());
247  RooNLLVar b_nll("b_nll","b_nll",*fBModel,data,RooFit::Extended());
248  double m2lnQ = 2*(sb_nll.getVal()-b_nll.getVal());
249  testStatData = m2lnQ;
250  } else {
251  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,data);
252  RooNLLVar b_nll("b_nll","b_nll",*fBModel,data);
253  double m2lnQ = 2*(sb_nll.getVal()-b_nll.getVal());
254  testStatData = m2lnQ;
255  }
256  }
257 
258  std::cout << "Test statistics has been evaluated for data\n";
259 
260  HybridResult* result = Calculate(nToys,usePriors);
261  result->SetDataTestStatistics(testStatData);
262 
263  return result;
264 }
265 
266 ///////////////////////////////////////////////////////////////////////////
267 
268 HybridResult* HybridCalculatorOriginal::Calculate(unsigned int nToys, bool usePriors) const
269 {
270  std::vector<double> bVals;
271  bVals.reserve(nToys);
272 
273  std::vector<double> sbVals;
274  sbVals.reserve(nToys);
275 
276  RunToys(bVals,sbVals,nToys,usePriors);
277 
278  HybridResult* result;
279 
280  TString name = "HybridResult_" + TString(GetName() );
281 
282  if ( fTestStatisticsIdx==2 )
283  result = new HybridResult(name,sbVals,bVals,false);
284  else
285  result = new HybridResult(name,sbVals,bVals);
286 
287  return result;
288 }
289 
290 ///////////////////////////////////////////////////////////////////////////
291 
292 void HybridCalculatorOriginal::RunToys(std::vector<double>& bVals, std::vector<double>& sbVals, unsigned int nToys, bool usePriors) const
293 {
294  /// do the actual run-MC processing
295  std::cout << "HybridCalculatorOriginal: run " << nToys << " toy-MC experiments\n";
296  std::cout << "with test statistics index: " << fTestStatisticsIdx << "\n";
297  if (usePriors) std::cout << "marginalize nuisance parameters \n";
298 
299  assert(nToys > 0);
300  assert(fBModel);
301  assert(fSbModel);
302  if (usePriors) {
303  assert(fPriorPdf);
305  }
306 
307  std::vector<double> parameterValues; /// array to hold the initial parameter values
308  /// backup the initial values of the parameters that are varied by the prior MC-integration
309  int nParameters = (fNuisanceParameters) ? fNuisanceParameters->getSize() : 0;
310  RooArgList parametersList("parametersList"); /// transforms the RooArgSet in a RooArgList (needed for .at())
311  if (usePriors && nParameters>0) {
312  parametersList.add(*fNuisanceParameters);
313  parameterValues.resize(nParameters);
314  for (int iParameter=0; iParameter<nParameters; iParameter++) {
315  RooRealVar* oneParam = (RooRealVar*) parametersList.at(iParameter);
316  parameterValues[iParameter] = oneParam->getVal();
317  }
318  }
319 
320  // create a cloned list of all parameters need in case of test statistics 3 where those
321  // changed by the best fit
322  RooArgSet originalSbParams;
323  RooArgSet originalBParams;
324  if (fTestStatisticsIdx == 3) {
327  if (sbparams) originalSbParams.addClone(*sbparams);
328  if (bparams) originalBParams.addClone(*bparams);
329  delete sbparams;
330  delete bparams;
331 // originalSbParams.Print("V");
332 // originalBParams.Print("V");
333  }
334 
335 
336  for (unsigned int iToy=0; iToy<nToys; iToy++) {
337 
338  /// prints a progress report every 500 iterations
339  /// TO DO: add a global verbose flag
340  if ( /*verbose && */ iToy%500==0 ) {
341  std::cout << "....... toy number " << iToy << " / " << nToys << std::endl;
342  }
343 
344  /// vary the value of the integrated parameters according to the prior pdf
345  if (usePriors && nParameters>0) {
346  /// generation from the prior pdf (TO DO: RooMCStudy could be used here)
348  for (int iParameter=0; iParameter<nParameters; iParameter++) {
349  RooRealVar* oneParam = (RooRealVar*) parametersList.at(iParameter);
350  oneParam->setVal(tmpValues->get()->getRealValue(oneParam->GetName()));
351  }
352  delete tmpValues;
353  }
354 
355 
356  /// generate the dataset in the B-only hypothesis
357  RooAbsData* bData;
358  if (fGenerateBinned)
359  bData = static_cast<RooAbsData*> (fBModel->generateBinned(*fObservables,RooFit::Extended()));
360  else {
361  if ( fTmpDoExtended ) bData = static_cast<RooAbsData*> (fBModel->generate(*fObservables,RooFit::Extended()));
362  else bData = static_cast<RooAbsData*> (fBModel->generate(*fObservables,1));
363  }
364 
365  /// work-around in case of an empty dataset (TO DO: need a debug in RooFit?)
366  bool bIsEmpty = false;
367  if (bData==NULL) {
368  bIsEmpty = true;
369  // if ( _verbose ) std::cout << "empty B-only dataset!\n";
370  RooDataSet* bDataDummy=new RooDataSet("bDataDummy","empty dataset",*fObservables);
371  bData = static_cast<RooAbsData*>(new RooDataHist ("bDataEmpty","",*fObservables,*bDataDummy));
372  delete bDataDummy;
373  }
374 
375  /// generate the dataset in the S+B hypothesis
376  RooAbsData* sbData;
377  if (fGenerateBinned)
378  sbData = static_cast<RooAbsData*> (fSbModel->generateBinned(*fObservables,RooFit::Extended()));
379  else {
380  if ( fTmpDoExtended ) sbData = static_cast<RooAbsData*> (fSbModel->generate(*fObservables,RooFit::Extended()));
381  else sbData = static_cast<RooAbsData*> (fSbModel->generate(*fObservables,1));
382  }
383 
384  /// work-around in case of an empty dataset (TO DO: need a debug in RooFit?)
385  bool sbIsEmpty = false;
386  if (sbData==NULL) {
387  sbIsEmpty = true;
388  // if ( _verbose ) std::cout << "empty S+B dataset!\n";
389  RooDataSet* sbDataDummy=new RooDataSet("sbDataDummy","empty dataset",*fObservables);
390  sbData = static_cast<RooAbsData*>(new RooDataHist ("sbDataEmpty","",*fObservables,*sbDataDummy));
391  delete sbDataDummy;
392  }
393 
394  /// restore the parameters to their initial values
395  if (usePriors && nParameters>0) {
396  for (int iParameter=0; iParameter<nParameters; iParameter++) {
397  RooRealVar* oneParam = (RooRealVar*) parametersList.at(iParameter);
398  oneParam->setVal(parameterValues[iParameter]);
399  }
400  }
401 
402  // test first the S+B hypothesis and the the B-only hypothesis
403  for (int hypoTested=0; hypoTested<=1; hypoTested++) {
404  RooAbsData* dataToTest = sbData;
405  bool dataIsEmpty = sbIsEmpty;
406  if ( hypoTested==1 ) { dataToTest = bData; dataIsEmpty = bIsEmpty; }
407  /// evaluate the test statistic in the tested hypothesis case
408  if ( fTestStatisticsIdx==2 ) { /// number of events used as test statistics
409  double nEvents = 0;
410  if ( !dataIsEmpty ) nEvents = dataToTest->numEntries();
411  if ( hypoTested==0 ) sbVals.push_back(nEvents);
412  else bVals.push_back(nEvents);
413  } else if ( fTestStatisticsIdx==3 ) { /// profiled likelihood ratio used as test statistics
414  if ( fTmpDoExtended ) {
415  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,*dataToTest,RooFit::CloneData(false),RooFit::Extended());
417  double sb_nll_val = sb_nll.getVal();
418  RooNLLVar b_nll("b_nll","b_nll",*fBModel,*dataToTest,RooFit::CloneData(false),RooFit::Extended());
420  double b_nll_val = b_nll.getVal();
421  double m2lnQ = -2*(b_nll_val-sb_nll_val);
422  if ( hypoTested==0 ) sbVals.push_back(m2lnQ);
423  else bVals.push_back(m2lnQ);
424  } else {
425  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,*dataToTest,RooFit::CloneData(false));
426  fSbModel->fitTo(*dataToTest,RooFit::PrintLevel(-1), RooFit::Hesse(false),RooFit::Strategy(0));
427  double sb_nll_val = sb_nll.getVal();
428  RooNLLVar b_nll("b_nll","b_nll",*fBModel,*dataToTest,RooFit::CloneData(false));
429  fBModel->fitTo(*dataToTest,RooFit::PrintLevel(-1), RooFit::Hesse(false),RooFit::Strategy(0));
430  double b_nll_val = b_nll.getVal();
431  double m2lnQ = -2*(b_nll_val-sb_nll_val);
432  if ( hypoTested==0 ) sbVals.push_back(m2lnQ);
433  else bVals.push_back(m2lnQ);
434  }
435  } else if ( fTestStatisticsIdx==1 ) { /// likelihood ratio used as test statistics (default)
436  if ( fTmpDoExtended ) {
437  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,*dataToTest,RooFit::CloneData(false),RooFit::Extended());
438  RooNLLVar b_nll("b_nll","b_nll",*fBModel,*dataToTest,RooFit::CloneData(false),RooFit::Extended());
439  double m2lnQ = -2*(b_nll.getVal()-sb_nll.getVal());
440  if ( hypoTested==0 ) sbVals.push_back(m2lnQ);
441  else bVals.push_back(m2lnQ);
442  } else {
443  RooNLLVar sb_nll("sb_nll","sb_nll",*fSbModel,*dataToTest,RooFit::CloneData(false));
444  RooNLLVar b_nll("b_nll","b_nll",*fBModel,*dataToTest,RooFit::CloneData(false));
445  double m2lnQ = -2*(b_nll.getVal()-sb_nll.getVal());
446  if ( hypoTested==0 ) sbVals.push_back(m2lnQ);
447  else bVals.push_back(m2lnQ);
448  }
449  }
450  } // tested both hypotheses
451 
452  /// delete the toy-MC datasets
453  delete sbData;
454  delete bData;
455 
456  /// restore the parameters to their initial values in case fitting is done
457  if (fTestStatisticsIdx == 3) {
459  if (sbparams) {
460  assert(originalSbParams.getSize() == sbparams->getSize());
461  *sbparams = originalSbParams;
462  delete sbparams;
463  }
465  if (bparams) {
466  assert(originalBParams.getSize() == bparams->getSize());
467  *bparams = originalBParams;
468  delete bparams;
469  }
470  }
471 
472 
473 
474  } /// end of loop over toy-MC experiments
475 
476 
477  /// restore the parameters to their initial values
478  if (usePriors && nParameters>0) {
479  for (int iParameter=0; iParameter<nParameters; iParameter++) {
480  RooRealVar* oneParam = (RooRealVar*) parametersList.at(iParameter);
481  oneParam->setVal(parameterValues[iParameter]);
482  }
483  }
484 
485  return;
486 }
487 
488 ///////////////////////////////////////////////////////////////////////////
489 
490 void HybridCalculatorOriginal::PrintMore(const char* options) const
491 {
492  /// Print out some information about the input models
493 
494  if (fSbModel) {
495  std::cout << "Signal plus background model:\n";
496  fSbModel->Print(options);
497  }
498 
499  if (fBModel) {
500  std::cout << "\nBackground model:\n";
501  fBModel->Print(options);
502  }
503 
504  if (fObservables) {
505  std::cout << "\nObservables:\n";
506  fObservables->Print(options);
507  }
508 
509  if (fNuisanceParameters) {
510  std::cout << "\nParameters being integrated:\n";
511  fNuisanceParameters->Print(options);
512  }
513 
514  if (fPriorPdf) {
515  std::cout << "\nPrior PDF model for integration:\n";
516  fPriorPdf->Print(options);
517  }
518 
519  return;
520 }
521 ///////////////////////////////////////////////////////////////////////////
522 // implementation of inherited methods from HypoTestCalculator
523 
525  // perform the hypothesis test and return result of hypothesis test
526 
527  // check first that everything needed is there
528  if (!DoCheckInputs()) return 0;
529  RooAbsData * treeData = dynamic_cast<RooAbsData *> (fData);
530  if (!treeData) {
531  std::cerr << "Error in HybridCalculatorOriginal::GetHypoTest - invalid data type - return NULL" << std::endl;
532  return 0;
533  }
534  bool usePrior = (fUsePriorPdf && fPriorPdf );
535  return Calculate( *treeData, fNToys, usePrior);
536 }
537 
538 
540  if (!fData) {
541  std::cerr << "Error in HybridCalculatorOriginal - data have not been set" << std::endl;
542  return false;
543  }
544 
545  // if observable have not been set take them from data
546  if (!fObservables && fData->get() ) fObservables = new RooArgList( *fData->get() );
547  if (!fObservables) {
548  std::cerr << "Error in HybridCalculatorOriginal - no observables" << std::endl;
549  return false;
550  }
551 
552  if (!fSbModel) {
553  std::cerr << "Error in HybridCalculatorOriginal - S+B pdf has not been set " << std::endl;
554  return false;
555  }
556 
557  if (!fBModel) {
558  std::cerr << "Error in HybridCalculatorOriginal - B pdf has not been set" << std::endl;
559  return false;
560  }
562  std::cerr << "Error in HybridCalculatorOriginal - nuisance parameters have not been set " << std::endl;
563  return false;
564  }
565  if (fUsePriorPdf && !fPriorPdf) {
566  std::cerr << "Error in HybridCalculatorOriginal - prior pdf has not been set " << std::endl;
567  return false;
568  }
569  return true;
570 }
571 
572 
virtual Double_t sumEntries() const =0
HybridCalculatorOriginal(const char *name=0)
Dummy Constructor with only name.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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
virtual RooDataHist * generateBinned(const RooArgSet &whatVars, Double_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:2175
RooCmdArg CloneData(Bool_t flag)
RooCmdArg PrintLevel(Int_t code)
#define assert(cond)
Definition: unittest.h:542
RooCmdArg Strategy(Int_t code)
Basic string class.
Definition: TString.h:137
HybridCalculatorOriginal class.
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
Definition: TIterator.cxx:21
RooCmdArg Extended(Bool_t flag=kTRUE)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:250
void RunToys(std::vector< double > &bVals, std::vector< double > &sbVals, unsigned int nToys, bool usePriors) const
RooDataSet is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:40
virtual void Print(Option_t *options=0) const
Print TNamed name and title.
Definition: RooAbsArg.h:227
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void SetAlternateModel(const ModelConfig &)
virtual void SetNullModel(const ModelConfig &)
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
virtual HybridResult * GetHypoTest() const
inherited methods from HypoTestCalculator interface
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Definition: RooAbsArg.cxx:560
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
virtual const RooArgSet * get() const
Definition: RooAbsData.h:77
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:203
const int nEvents
Definition: testRooFit.cxx:42
Class RooNLLVar implements a a -log(likelihood) calculation from a dataset and a PDF.
Definition: RooNLLVar.h:26
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:293
HybridResult * Calculate(TH1 &data, unsigned int nToys, bool usePriors) const
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
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
RooCmdArg Hesse(Bool_t flag=kTRUE)
RooAbsArg * at(Int_t idx) const
Definition: RooArgList.h:84
The TH1 histogram class.
Definition: TH1.h:80
void PrintMore(const char *options) const
ClassImp(RooStats::HybridCalculatorOriginal) using namespace RooStats
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
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:1702
#define NULL
Definition: Rtypes.h:82
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
Definition: RooAbsPdf.cxx:1056
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add clone of specified element to an owning set.
Definition: RooArgSet.cxx:475
double result[121]
Int_t getSize() const
RooAbsPdf * GetPriorPdf() const
get parameters prior pdf (return NULL if not existing)
Definition: ModelConfig.h:256
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
void SetTestStatistic(int index)
set the desired test statistics: index=1 : 2 * log( L_sb / L_b ) (DEFAULT) index=2 : number of genera...
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:527
virtual ~HybridCalculatorOriginal()
Destructor of HybridCalculator.