ROOT  6.06/09
Reference Guide
HypoTestCalculatorGeneric.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, Sven Kreiss 23/05/10
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_HypoTestCalculatorGeneric
12 #define ROOSTATS_HypoTestCalculatorGeneric
13 
14 
15 #ifndef ROOT_Rtypes
16 #include "Rtypes.h" // necessary for TNamed
17 #endif
18 
19 #ifndef ROOSTATS_HypoTestCalculator
21 #endif
22 
23 #ifndef ROOSTATS_ModelConfig
24 #include "RooStats/ModelConfig.h"
25 #endif
26 
27 #ifndef ROOSTATS_TestStatistic
28 #include "RooStats/TestStatistic.h"
29 #endif
30 
31 #ifndef ROOSTATS_TestStatSampler
33 #endif
34 
35 #ifndef ROOSTATS_SamplingDistribution
37 #endif
38 
39 #ifndef ROOSTATS_HypoTestResult
41 #endif
42 
43 
44 namespace RooStats {
45 
46  /**
47  Common base class for the Hypothesis Test Calculators.
48  It is not designed to use directly but via its derived classes
49 
50  \ingroup Roostats
51  */
52 
53 
55 
56  public:
58  const RooAbsData &data,
59  const ModelConfig &altModel,
60  const ModelConfig &nullModel,
61  TestStatSampler* sampler=0
62  );
63 
64 
66 
67 
68  public:
69 
70  /// inherited methods from HypoTestCalculator interface
71  virtual HypoTestResult* GetHypoTest() const;
72 
73  // set the model for the null hypothesis (only B)
74  virtual void SetNullModel(const ModelConfig &nullModel) { fNullModel = &nullModel; }
75  const RooAbsData * GetData(void) const { return fData; }
76  const ModelConfig* GetNullModel(void) const { return fNullModel; }
77  virtual const RooArgSet* GetFitInfo() const { return NULL; }
78  // set the model for the alternate hypothesis (S+B)
79  virtual void SetAlternateModel(const ModelConfig &altModel) { fAltModel = &altModel; }
80  const ModelConfig* GetAlternateModel(void) const { return fAltModel; }
81  // Set the DataSet
82  virtual void SetData(RooAbsData &data) { fData = &data; }
83 
84  // Returns instance of TestStatSampler. Use to change properties of
85  // TestStatSampler, e.g. GetTestStatSampler.SetTestSize(Double_t size);
87 
88  // set this for re-using always the same toys for alternate hypothesis in
89  // case of calls at dofferent null parameter points
90  // This is useful to get more stable bands when running the HypoTest inversion
91  void UseSameAltToys();
92 
93 
94  protected:
95  // should return zero (to be used later for conditional flow)
96  virtual int CheckHook(void) const { return 0; }
97  virtual int PreNullHook(RooArgSet* /*parameterPoint*/, double /*obsTestStat*/) const { return 0; }
98  virtual int PreAltHook(RooArgSet* /*parameterPoint*/, double /*obsTestStat*/) const { return 0; }
99  virtual void PreHook() const { }
100  virtual void PostHook() const { }
101 
102  protected:
109 
110  unsigned int fAltToysSeed; // to have same toys for alternate
111 
112  private:
113  void SetupSampler(const ModelConfig& model) const;
114  void SetAdaptiveLimits(Double_t obsTestStat, Bool_t forNull) const;
116  ModelConfig *thisModel,
117  double obsTestStat,
118  RooAbsPdf *impDens=NULL,
119  const RooArgSet *impSnapshot=NULL
120  ) const;
121 
122 
123  protected:
125 };
126 }
127 
128 #endif
void UseSameAltToys()
to re-use same toys for alternate hypothesis
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
HypoTestResult is a base class for results from hypothesis tests.
virtual int PreAltHook(RooArgSet *, double) const
virtual const RooArgSet * GetFitInfo() const
bool Bool_t
Definition: RtypesCore.h:59
Common base class for the Hypothesis Test Calculators.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual HypoTestResult * GetHypoTest() const
inherited methods from HypoTestCalculator interface
TestStatSampler * GetTestStatSampler(void) const
HypoTestCalculator is an interface class for a tools which produce RooStats HypoTestResults.
virtual void SetData(RooAbsData &data)
const ModelConfig * GetAlternateModel(void) const
void SetAdaptiveLimits(Double_t obsTestStat, Bool_t forNull) const
const ModelConfig * GetNullModel(void) const
This class simply holds a sampling distribution of some test statistic.
virtual void SetAlternateModel(const ModelConfig &altModel)
Namespace for the RooStats classes.
Definition: Asimov.h:20
SamplingDistribution * GenerateSamplingDistribution(ModelConfig *thisModel, double obsTestStat, RooAbsPdf *impDens=NULL, const RooArgSet *impSnapshot=NULL) const
double Double_t
Definition: RtypesCore.h:55
const RooAbsData * GetData(void) const
HypoTestCalculatorGeneric(const RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, TestStatSampler *sampler=0)
Constructor.
virtual int PreNullHook(RooArgSet *, double) const
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
#define NULL
Definition: Rtypes.h:82
virtual void SetNullModel(const ModelConfig &nullModel)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:33
void SetupSampler(const ModelConfig &model) const
common setup for both models