-
Notifications
You must be signed in to change notification settings - Fork 2
/
HypoTestCalculatorGeneric.h
107 lines (82 loc) · 3.45 KB
/
HypoTestCalculatorGeneric.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// @(#)root/roostats:$Id$
// Author: Kyle Cranmer, Sven Kreiss 23/05/10
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOSTATS_HypoTestCalculatorGeneric
#define ROOSTATS_HypoTestCalculatorGeneric
#ifndef ROOT_Rtypes
#include "Rtypes.h" // necessary for TNamed
#endif
#ifndef ROOSTATS_HypoTestCalculator
#include "RooStats/HypoTestCalculator.h"
#endif
#ifndef ROOSTATS_ModelConfig
#include "RooStats/ModelConfig.h"
#endif
#ifndef ROOSTATS_TestStatistic
#include "RooStats/TestStatistic.h"
#endif
#ifndef ROOSTATS_TestStatSampler
#include "RooStats/TestStatSampler.h"
#endif
#ifndef ROOSTATS_SamplingDistribution
#include "RooStats/SamplingDistribution.h"
#endif
#ifndef ROOSTATS_HypoTestResult
#include "RooStats/HypoTestResult.h"
#endif
namespace RooStats {
class HypoTestCalculatorGeneric : public HypoTestCalculator {
public:
HypoTestCalculatorGeneric(
const RooAbsData &data,
const ModelConfig &altModel,
const ModelConfig &nullModel,
TestStatSampler* sampler=0
);
~HypoTestCalculatorGeneric();
public:
/// inherited methods from HypoTestCalculator interface
virtual HypoTestResult* GetHypoTest() const;
// set the model for the null hypothesis (only B)
virtual void SetNullModel(const ModelConfig &nullModel) { fNullModel = &nullModel; }
const ModelConfig* GetNullModel(void) const { return fNullModel; }
// set the model for the alternate hypothesis (S+B)
virtual void SetAlternateModel(const ModelConfig &altModel) { fAltModel = &altModel; }
const ModelConfig* GetAlternateModel(void) const { return fAltModel; }
// Set the DataSet
virtual void SetData(RooAbsData &data) { fData = &data; }
// Returns instance of TestStatSampler. Use to change properties of
// TestStatSampler, e.g. GetTestStatSampler.SetTestSize(Double_t size);
TestStatSampler* GetTestStatSampler(void) const { return fTestStatSampler; }
protected:
// should return zero (to be used later for conditional flow)
virtual int CheckHook(void) const { return 0; }
virtual int PreNullHook(RooArgSet* /*parameterPoint*/, double /*obsTestStat*/) const { return 0; }
virtual int PreAltHook(RooArgSet* /*parameterPoint*/, double /*obsTestStat*/) const { return 0; }
protected:
const ModelConfig *fAltModel;
const ModelConfig *fNullModel;
const RooAbsData *fData;
TestStatSampler *fTestStatSampler;
TestStatSampler *fDefaultSampler;
TestStatistic *fDefaultTestStat;
private:
void SetupSampler(const ModelConfig& model) const;
void SetAdaptiveLimits(Double_t obsTestStat, Bool_t forNull) const;
SamplingDistribution* GenerateSamplingDistribution(
ModelConfig *thisModel,
double obsTestStat,
RooAbsPdf *impDens=NULL,
const RooArgSet *impSnapshot=NULL
) const;
protected:
ClassDef(HypoTestCalculatorGeneric,1)
};
}
#endif