ROOT  6.06/09
Reference Guide
HybridCalculator.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Sven Kreiss, Kyle Cranmer Nov 2010
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOSTATS_HybridCalculator
12 #define ROOSTATS_HybridCalculator
13 
14 
15 
16 
17 
18 #ifndef ROOSTATS_HypoTestCalculatorGeneric
20 #endif
21 
22 #ifndef ROOSTATS_ToyMCSampler
23 #include "RooStats/ToyMCSampler.h"
24 #endif
25 
26 
27 
28 namespace RooStats {
29 
30  /**
31 
32 This class implements the Hypothesis test calculation using an hybrid (frequentist/bayesian) procedure.
33 A frequentist sampling of the test statistic distribution is obtained but with mariginalization of the nuisance parameters.
34 The toys are generated by sampling the nuisance parameters according to their prior distribution.
35 
36 The use of the of ToyMCSampler as the TestStatSampler is assumed.
37 
38 \ingroup Roostats
39 
40 */
41 
42 
44 
45  public:
47  const RooAbsData &data,
48  const ModelConfig &altModel,
49  const ModelConfig &nullModel,
50  TestStatSampler* sampler=0
51  ) :
52  HypoTestCalculatorGeneric(data, altModel, nullModel, sampler),
53  fPriorNuisanceNull(MakeNuisancePdf(nullModel, "PriorNuisanceNull")),
54  fPriorNuisanceAlt(MakeNuisancePdf(altModel, "PriorNuisanceAlt")),
57  fNToysNull(-1),
58  fNToysAlt(-1),
59  fNToysNullTail(0),
60  fNToysAltTail(0)
61  {
62  }
63 
66  if(fPriorNuisanceAltExternal == false) delete fPriorNuisanceAlt;
67  }
68 
69 
70  /// Override the distribution used for marginalizing nuisance parameters that is inferred from ModelConfig
71  virtual void ForcePriorNuisanceNull(RooAbsPdf& priorNuisance) {
73  fPriorNuisanceNull = &priorNuisance; fPriorNuisanceNullExternal = true;
74  }
75  virtual void ForcePriorNuisanceAlt(RooAbsPdf& priorNuisance) {
76  if(fPriorNuisanceAltExternal == false) delete fPriorNuisanceAlt;
77  fPriorNuisanceAlt = &priorNuisance; fPriorNuisanceAltExternal = true;
78  }
79 
80  virtual void SetNullModel(const ModelConfig &nullModel) {
81  fNullModel = &nullModel;
82  if(fPriorNuisanceNullExternal == false) {
83  delete fPriorNuisanceNull;
84  fPriorNuisanceNull = MakeNuisancePdf(nullModel, "PriorNuisanceNull");
85  }
86  }
87 
88  virtual void SetAlternateModel(const ModelConfig &altModel) {
89  fAltModel = &altModel;
90  if(fPriorNuisanceAltExternal == false) {
91  delete fPriorNuisanceAlt;
92  fPriorNuisanceAlt = MakeNuisancePdf(altModel, "PriorNuisanceAlt");
93  }
94  }
95 
96  /// set number of toys
97  void SetToys(int toysNull, int toysAlt) { fNToysNull = toysNull; fNToysAlt = toysAlt; }
98 
99  /// set least number of toys in tails
100  void SetNToysInTails(int toysNull, int toysAlt) { fNToysNullTail = toysNull; fNToysAltTail = toysAlt; }
101 
102  protected:
103  /// check whether all input is consistent
104  int CheckHook(void) const;
105 
106  /// configure TestStatSampler for the Null run
107  int PreNullHook(RooArgSet* /*parameterPoint*/, double obsTestStat) const;
108 
109  /// configure TestStatSampler for the Alt run
110  int PreAltHook(RooArgSet* /*parameterPoint*/, double obsTestStat) const;
111 
112  protected:
115 
116  // these flags tell us if the nuisance pdfs came from an external resource (via ForcePriorNuisance)
117  // or were created internally and should be deleted
120 
121  // different number of toys for null and alt
124 
125  // adaptive sampling
128 
129  protected:
131  };
132 }
133 
134 #endif
void SetNToysInTails(int toysNull, int toysAlt)
set least number of toys in tails
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
RooAbsPdf * MakeNuisancePdf(RooAbsPdf &pdf, const RooArgSet &observables, const char *name)
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
bool Bool_t
Definition: RtypesCore.h:59
int PreNullHook(RooArgSet *, double obsTestStat) const
configure TestStatSampler for the Null run
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
Definition: TIterator.cxx:20
Common base class for the Hypothesis Test Calculators.
#define ClassDef(name, id)
Definition: Rtypes.h:254
int PreAltHook(RooArgSet *, double obsTestStat) const
configure TestStatSampler for the Alt run
virtual void SetNullModel(const ModelConfig &nullModel)
HybridCalculator(const RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, TestStatSampler *sampler=0)
This class implements the Hypothesis test calculation using an hybrid (frequentist/bayesian) procedur...
Namespace for the RooStats classes.
Definition: Asimov.h:20
void SetToys(int toysNull, int toysAlt)
set number of toys
int CheckHook(void) const
check whether all input is consistent
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
virtual void SetAlternateModel(const ModelConfig &altModel)
virtual void ForcePriorNuisanceAlt(RooAbsPdf &priorNuisance)
virtual void ForcePriorNuisanceNull(RooAbsPdf &priorNuisance)
Override the distribution used for marginalizing nuisance parameters that is inferred from ModelConfi...