Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
AsymptoticCalculator.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_AsymptoticCalculator
12#define ROOSTATS_AsymptoticCalculator
13
15#include "RooArgSet.h"
16#include "Rtypes.h"
17
18class RooArgList;
19class RooCategory;
20class RooRealVar;
21class RooPoisson;
22class RooProdPdf;
23
24
25namespace RooStats {
26
28
29 public:
31 RooAbsData &data, // need to pass non-const since RooAbsPdf::fitTo takes a non-const data set
32 const ModelConfig &altModel,
34 bool nominalAsimov = false
35 );
36
37 /// initialize the calculator by performing a global fit and make the Asimov data set
38 bool Initialize() const;
39
40 /// re-implement HypoTest computation using the asymptotic
41 HypoTestResult *GetHypoTest() const override;
42
43 /// Make Asimov data.
44 static RooAbsData * MakeAsimovData( RooAbsData & data, const ModelConfig & model, const RooArgSet & poiValues, RooArgSet & globObs, const RooArgSet * genPoiValues = nullptr);
45
46
47 /// Make a nominal Asimov data set from a model.
49
50
51
52 static RooAbsData * GenerateAsimovData(const RooAbsPdf & pdf, const RooArgSet & observables );
53
54 /// function given the null and the alt p value - return the expected one given the N - sigma value
55 static double GetExpectedPValues(double pnull, double palt, double nsigma, bool usecls, bool oneSided = true );
56
57 /// set test statistic for one sided (upper limits)
58 void SetOneSided(bool on) { fOneSided = on; }
59
60 /// set the test statistics for two sided (in case of upper limits
61 /// for discovery does not make really sense)
62 void SetTwoSided() { fOneSided = false; fOneSidedDiscovery = false;}
63
64 /// set the test statistics for one-sided discovery
66
67 /// re-implementation of setters since they are needed to re-initialize the calculator
80
81
82 bool IsTwoSided() const { return (!fOneSided && !fOneSidedDiscovery); }
83 bool IsOneSidedDiscovery() const { return fOneSidedDiscovery; }
84
85
86 /// set using of qtilde, by default is controlled if RoORealVar is limited or not
87 void SetQTilde(bool on) { fUseQTilde = on; }
88
89 /// return snapshot of the best fit parameter
90 const RooArgSet & GetBestFitPoi() const { return fBestFitPoi; }
91 /// return best fit parameter (firs of poi)
92 const RooRealVar * GetMuHat() const { return dynamic_cast<RooRealVar*>(fBestFitPoi.first()); }
93 /// return best fit value for all parameters
94 const RooArgSet & GetBestFitParams() const { return fBestFitPoi; }
95
96 static void SetPrintLevel(int level);
97
98 private:
99 bool fOneSided; ///< for one sided PL test statistic (upper limits)
100 mutable bool fOneSidedDiscovery; ///< for one sided PL test statistic (for discovery)
101 bool fNominalAsimov; ///< make Asimov at nominal parameter values
102 mutable bool fIsInitialized; ///<! flag to check if calculator is initialized
103 mutable int fUseQTilde; ///< flag to indicate if using qtilde or not (-1 (default based on RooRealVar)), 0 false, 1 (true)
104 mutable double fNLLObs;
105 mutable double fNLLAsimov;
106
107 mutable RooAbsData * fAsimovData; ///< asimov data set
108 mutable RooArgSet fAsimovGlobObs; ///< snapshot of Asimov global observables
109 mutable RooArgSet fBestFitPoi; ///< snapshot of best fitted POI values
110 mutable RooArgSet fBestFitParams; ///< snapshot of all best fitted Parameter values
111
113 };
114}
115
116#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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 on
RooAbsArg * first() const
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
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:24
Object to represent discrete states.
Definition RooCategory.h:28
Poisson pdf.
Definition RooPoisson.h:19
Efficient implementation of a product of PDFs of the form.
Definition RooProdPdf.h:36
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Hypothesis Test Calculator based on the asymptotic formulae for the profile likelihood ratio.
const RooRealVar * GetMuHat() const
return best fit parameter (firs of poi)
static double GetExpectedPValues(double pnull, double palt, double nsigma, bool usecls, bool oneSided=true)
function given the null and the alt p value - return the expected one given the N - sigma value
void SetAlternateModel(const ModelConfig &altModel) override
Set the model for the alternate hypothesis.
void SetOneSidedDiscovery(bool on)
set the test statistics for one-sided discovery
void SetData(RooAbsData &data) override
Set the DataSet.
static void SetPrintLevel(int level)
set print level (static function)
RooArgSet fAsimovGlobObs
snapshot of Asimov global observables
static RooAbsData * GenerateAsimovData(const RooAbsPdf &pdf, const RooArgSet &observables)
generate the asimov data for the observables (not the global ones) need to deal with the case of a si...
int fUseQTilde
flag to indicate if using qtilde or not (-1 (default based on RooRealVar)), 0 false,...
bool fIsInitialized
! flag to check if calculator is initialized
const RooArgSet & GetBestFitParams() const
return best fit value for all parameters
HypoTestResult * GetHypoTest() const override
re-implement HypoTest computation using the asymptotic
bool fOneSided
for one sided PL test statistic (upper limits)
RooArgSet fBestFitParams
snapshot of all best fitted Parameter values
AsymptoticCalculator(RooAbsData &data, const ModelConfig &altModel, const ModelConfig &nullModel, bool nominalAsimov=false)
constructor for asymptotic calculator from Data set and ModelConfig
void SetTwoSided()
set the test statistics for two sided (in case of upper limits for discovery does not make really sen...
bool fOneSidedDiscovery
for one sided PL test statistic (for discovery)
RooAbsData * fAsimovData
asimov data set
RooArgSet fBestFitPoi
snapshot of best fitted POI values
void SetQTilde(bool on)
set using of qtilde, by default is controlled if RoORealVar is limited or not
static RooAbsData * MakeAsimovData(RooAbsData &data, const ModelConfig &model, const RooArgSet &poiValues, RooArgSet &globObs, const RooArgSet *genPoiValues=nullptr)
Make Asimov data.
const RooArgSet & GetBestFitPoi() const
return snapshot of the best fit parameter
void SetNullModel(const ModelConfig &nullModel) override
re-implementation of setters since they are needed to re-initialize the calculator
bool fNominalAsimov
make Asimov at nominal parameter values
void SetOneSided(bool on)
set test statistic for one sided (upper limits)
bool Initialize() const
initialize the calculator by performing a global fit and make the Asimov data set
Common base class for the Hypothesis Test Calculators.
void SetNullModel(const ModelConfig &nullModel) override
set the model for the null hypothesis (only B)
void SetData(RooAbsData &data) override
Set the DataSet.
void SetAlternateModel(const ModelConfig &altModel) override
Set the model for the alternate hypothesis (S+B)
HypoTestResult is a base class for results from hypothesis tests.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition ModelConfig.h:35
Namespace for the RooStats classes.
Definition CodegenImpl.h:58