Logo ROOT   6.08/07
Reference Guide
FrequentistCalculator.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id: FrequentistCalculator.h 37084 2010-11-29 21:37:13Z moneta $
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_FrequentistCalculator
12 #define ROOSTATS_FrequentistCalculator
13 
14 
15 #ifndef ROOSTATS_HypoTestCalculatorGeneric
17 #endif
18 
19 #ifndef ROOSTATS_ToyMCSampler
20 #include "RooStats/ToyMCSampler.h"
21 #endif
22 
23 #ifndef ROOSTATS_DetailedOutputAggregator
25 #endif
26 
27 #include "RooFitResult.h"
28 
29 
30 
31 
32 namespace RooStats {
33 
34  /**
35  Hypothesis Test Calculator using a full frequentist procedure for sampling the
36  test statistic distribution.
37  The nuisance parameters are fixed to their MLEs.
38  The use of ToyMCSampler as the TestStatSampler is assumed.
39 
40  \ingroup Roostats
41 */
42 
43 
45 
46  public:
48  const RooAbsData &data,
49  const ModelConfig &altModel,
50  const ModelConfig &nullModel,
51  TestStatSampler* sampler=0
52  ) :
53  HypoTestCalculatorGeneric(data, altModel, nullModel, sampler),
56  fNToysNull(-1),
57  fNToysAlt(-1),
58  fNToysNullTail(0),
59  fNToysAltTail(0),
60  fFitInfo(NULL),
61  fStoreFitInfo(false)
62  {
63  }
64 
68  if( fFitInfo ) delete fFitInfo;
69  }
70 
71 
72  /// set number of toys
73  void SetToys(int toysNull, int toysAlt) { fNToysNull = toysNull; fNToysAlt = toysAlt; }
74 
75  /// set least number of toys in tails
76  void SetNToysInTails(int toysNull, int toysAlt) { fNToysNullTail = toysNull; fNToysAltTail = toysAlt; }
77 
78  /// set given nuisance parameters to a specific value that will be used instead of their
79  /// profiled value for Null toys
82 
83  if( c ) fConditionalMLEsNull = (const RooArgSet*)c->snapshot();
85  }
86 
87  /// set given nuisance parameters to a specific value that will be used instead of their
88  /// profiled value for Alternate toys
91 
92  if( c ) fConditionalMLEsAlt = (const RooArgSet*)c->snapshot();
94  }
95 
96  void StoreFitInfo(bool val = true) {
97  fStoreFitInfo = val;
98  }
99 
100  const RooArgSet* GetFitInfo() const {
101  return fFitInfo;
102  }
103 
104  protected:
105  /// configure TestStatSampler for the Null run
106  int PreNullHook(RooArgSet *parameterPoint, double obsTestStat) const;
107 
108  /// configure TestStatSampler for the Alt run
109  int PreAltHook(RooArgSet *parameterPoint, double obsTestStat) const;
110 
111  void PreHook() const;
112  void PostHook() const;
113 
114  protected:
115  // MLE inputs
118 
119  // different number of toys for null and alt
122 
123  // adaptive sampling
126 
127  private:
128  mutable RooArgSet* fFitInfo;
130 
131  protected:
133  };
134 }
135 
136 #endif
void SetConditionalMLEsNull(const RooArgSet *c)
set given nuisance parameters to a specific value that will be used instead of their profiled value f...
const RooArgSet * GetFitInfo() const
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
void SetConditionalMLEsAlt(const RooArgSet *c)
set given nuisance parameters to a specific value that will be used instead of their profiled value f...
return c
void SetToys(int toysNull, int toysAlt)
set number of toys
TestStatSampler is an interface class for a tools which produce RooStats SamplingDistributions.
Common base class for the Hypothesis Test Calculators.
#define ClassDef(name, id)
Definition: Rtypes.h:254
FrequentistCalculator(const RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, TestStatSampler *sampler=0)
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
int PreNullHook(RooArgSet *parameterPoint, double obsTestStat) const
configure TestStatSampler for the Null run
int PreAltHook(RooArgSet *parameterPoint, double obsTestStat) const
configure TestStatSampler for the Alt run
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
Namespace for the RooStats classes.
Definition: Asimov.h:20
void SetNToysInTails(int toysNull, int toysAlt)
set least number of toys in tails
Hypothesis Test Calculator using a full frequentist procedure for sampling the test statistic distrib...
#define NULL
Definition: Rtypes.h:82