Logo ROOT  
Reference Guide
HybridCalculatorOriginal.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2
3/*************************************************************************
4 * Project: RooStats *
5 * Package: RooFit/RooStats *
6 * Authors: *
7 * Danilo Piparo, Gregory Schott *
8 *************************************************************************
9 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOSTATS_HybridCalculatorOriginal
17#define ROOSTATS_HybridCalculatorOriginal
18
20
21#include <vector>
22
23
25
27
28class TH1;
29
30namespace RooStats {
31
32 class HybridResult;
33
35
36 public:
37
38
39 /// Dummy Constructor with only name
40 explicit HybridCalculatorOriginal(const char *name = 0);
41
42 /// Constructor for HybridCalculator from pdf instances but without a data-set
44 RooAbsPdf& b_model,
45 RooArgList& observables,
46 const RooArgSet* nuisance_parameters = 0,
47 RooAbsPdf* prior_pdf = 0,
48 bool GenerateBinned = false, int testStatistics = 1, int ntoys = 1000 );
49
50 /// Constructor for HybridCalculator using a data set and pdf instances
52 RooAbsPdf& sb_model,
53 RooAbsPdf& b_model,
54 const RooArgSet* nuisance_parameters = 0,
55 RooAbsPdf* prior_pdf = 0,
56 bool GenerateBinned = false, int testStatistics = 1, int ntoys = 1000 );
57
58
59 /// Constructor passing a ModelConfig for the SBmodel and a ModelConfig for the B Model
61 const ModelConfig& sb_model,
62 const ModelConfig& b_model,
63 bool GenerateBinned = false, int testStatistics = 1, int ntoys = 1000 );
64
65
66 public:
67
68 /// Destructor of HybridCalculator
70
71 /// inherited methods from HypoTestCalculator interface
72 HybridResult* GetHypoTest() const override;
73
74 // inherited setter methods from HypoTestCalculator
75
76
77 /// set the model for the null hypothesis (only B)
78 void SetNullModel(const ModelConfig & ) override;
79 /// set the model for the alternate hypothesis (S+B)
80 void SetAlternateModel(const ModelConfig & ) override;
81
82
83 /// Set a common PDF for both the null and alternate
84 virtual void SetCommonPdf(RooAbsPdf & pdf) { fSbModel = &pdf; }
85 /// Set the PDF for the null (only B)
86 virtual void SetNullPdf(RooAbsPdf& pdf) { fBModel = &pdf; }
87 /// Set the PDF for the alternate hypothesis ( i.e. S+B)
88 virtual void SetAlternatePdf(RooAbsPdf& pdf) { fSbModel = &pdf; }
89
90 /// Set the DataSet
91 void SetData(RooAbsData& data) override { fData = &data; }
92
93 /// set parameter values for the null if using a common PDF
94 virtual void SetNullParameters(const RooArgSet& ) { } // not needed
95 /// set parameter values for the alternate if using a common PDF
96 virtual void SetAlternateParameters(const RooArgSet&) {} // not needed
97
98 /// additional methods specific for HybridCalculator
99 /// set a prior pdf for the nuisance parameters
100 void SetNuisancePdf(RooAbsPdf & prior_pdf) {
101 fPriorPdf = &prior_pdf;
102 fUsePriorPdf = true; // if set by default turn it on
103 }
104
105 /// set the nuisance parameters to be marginalized
106 void SetNuisanceParameters(const RooArgSet & params) { fNuisanceParameters = &params; }
107
108 /// set number of toy MC (Default is 1000)
109 void SetNumberOfToys(unsigned int ntoys) { fNToys = ntoys; }
110
111 /// return number of toys used
112 unsigned int GetNumberOfToys() const { return fNToys; }
113
114 /// control use of the pdf for the nuisance parameter and marginalize them
115 void UseNuisance(bool on = true) { fUsePriorPdf = on; }
116
117 /// control to use bin data generation
118 void SetGenerateBinned(bool on = true) { fGenerateBinned = on; }
119
120 /// set the desired test statistics:
121 /// index=1 : 2 * log( L_sb / L_b ) (DEFAULT)
122 /// index=2 : number of generated events
123 /// index=3 : profiled likelihood ratio
124 /// if the index is different to any of those values, the default is used
125 void SetTestStatistic(int index);
126
127 HybridResult* Calculate(TH1& data, unsigned int nToys, bool usePriors) const;
128 HybridResult* Calculate(RooAbsData& data, unsigned int nToys, bool usePriors) const;
129 HybridResult* Calculate(unsigned int nToys, bool usePriors) const;
130 void PrintMore(const char* options) const;
131
132 void PatchSetExtended(bool on = true) { fTmpDoExtended = on; std::cout << "extended patch set to " << on << std::endl; } // patch to test with RooPoisson (or other non-extended models)
133
134 private:
135
136 void RunToys(std::vector<double>& bVals, std::vector<double>& sbVals, unsigned int nToys, bool usePriors) const;
137
138 // check input parameters before performing the calculation
139 bool DoCheckInputs() const;
140
141 unsigned int fTestStatisticsIdx; ///< Index of the test statistics to use
142 unsigned int fNToys; ///< number of Toys MC
143 RooAbsPdf* fSbModel; ///< The pdf of the signal+background model
144 RooAbsPdf* fBModel; ///< The pdf of the background model
145 mutable RooArgList* fObservables; ///< Collection of the observables of the model
146 const RooArgSet* fNuisanceParameters; ///< Collection of the nuisance parameters in the model
147 RooAbsPdf* fPriorPdf; ///< Prior PDF of the nuisance parameters
148 RooAbsData * fData; ///< pointer to the data sets
149 bool fGenerateBinned; ///< Flag to control binned generation
150 bool fUsePriorPdf; ///< use a prior for nuisance parameters
152
153 protected:
154 ClassDefOverride(HybridCalculatorOriginal,1) // Hypothesis test calculator using a Bayesian-frequentist hybrid method
155 };
156
157}
158
159#endif
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition: TGX11.cxx:110
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:62
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
HybridCalculatorOriginal class.
void SetNuisancePdf(RooAbsPdf &prior_pdf)
additional methods specific for HybridCalculator set a prior pdf for the nuisance parameters
virtual void SetAlternatePdf(RooAbsPdf &pdf)
Set the PDF for the alternate hypothesis ( i.e. S+B)
virtual void SetAlternateParameters(const RooArgSet &)
set parameter values for the alternate if using a common PDF
void PrintMore(const char *options) const
Print out some information about the input models.
RooAbsPdf * fSbModel
The pdf of the signal+background model.
virtual void SetNullParameters(const RooArgSet &)
set parameter values for the null if using a common PDF
unsigned int GetNumberOfToys() const
return number of toys used
RooAbsPdf * fBModel
The pdf of the background model.
void SetData(RooAbsData &data) override
Set the DataSet.
void RunToys(std::vector< double > &bVals, std::vector< double > &sbVals, unsigned int nToys, bool usePriors) const
do the actual run-MC processing
unsigned int fNToys
number of Toys MC
void SetNullModel(const ModelConfig &) override
set the model for the null hypothesis (only B)
unsigned int fTestStatisticsIdx
Index of the test statistics to use.
RooAbsData * fData
pointer to the data sets
void SetAlternateModel(const ModelConfig &) override
set the model for the alternate hypothesis (S+B)
bool fGenerateBinned
Flag to control binned generation.
HybridCalculatorOriginal(const char *name=0)
Dummy Constructor with only name.
void UseNuisance(bool on=true)
control use of the pdf for the nuisance parameter and marginalize them
virtual void SetCommonPdf(RooAbsPdf &pdf)
Set a common PDF for both the null and alternate.
void SetTestStatistic(int index)
set the desired test statistics: index=1 : 2 * log( L_sb / L_b ) (DEFAULT) index=2 : number of genera...
const RooArgSet * fNuisanceParameters
Collection of the nuisance parameters in the model.
void SetGenerateBinned(bool on=true)
control to use bin data generation
HybridResult * GetHypoTest() const override
inherited methods from HypoTestCalculator interface
RooAbsPdf * fPriorPdf
Prior PDF of the nuisance parameters.
~HybridCalculatorOriginal() override
Destructor of HybridCalculator.
virtual void SetNullPdf(RooAbsPdf &pdf)
Set the PDF for the null (only B)
HybridResult * Calculate(TH1 &data, unsigned int nToys, bool usePriors) const
first compute the test statistics for data and then prepare and run the toy-MC experiments
void SetNuisanceParameters(const RooArgSet &params)
set the nuisance parameters to be marginalized
RooArgList * fObservables
Collection of the observables of the model.
void SetNumberOfToys(unsigned int ntoys)
set number of toy MC (Default is 1000)
bool fUsePriorPdf
use a prior for nuisance parameters
Class encapsulating the result of the HybridCalculatorOriginal.
Definition: HybridResult.h:27
HypoTestCalculator is an interface class for a tools which produce RooStats HypoTestResults.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:30
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Namespace for the RooStats classes.
Definition: Asimov.h:19