Logo ROOT  
Reference Guide
LikelihoodInterval.h
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
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_LikelihoodInterval
12 #define RooStats_LikelihoodInterval
13 
14 #include "RooStats/ConfInterval.h"
15 
16 #include "RooArgSet.h"
17 
18 #include "RooAbsReal.h"
19 
20 #include "Math/IFunctionfwd.h"
21 
22 #include <map>
23 #include <memory>
24 #include <string>
25 
26 namespace ROOT {
27  namespace Math {
28  class Minimizer;
29  }
30 }
31 
32 namespace RooStats {
33 
35 
36  public:
37 
38  /// default constructor
39  explicit LikelihoodInterval(const char* name = 0);
40 
41  //// construct the interval from a Profile Likelihood object, parameter of interest and optionally a snapshot of
42  //// POI with their best fit values
43  LikelihoodInterval(const char* name, RooAbsReal*, const RooArgSet*, RooArgSet * = 0);
44 
45  /// destructor
46  virtual ~LikelihoodInterval();
47 
48  /// check if given point is in the interval
49  virtual Bool_t IsInInterval(const RooArgSet&) const;
50 
51  /// set the confidence level for the interval (e.g 0.682 for a 1-sigma interval)
53 
54  /// return confidence level
55  virtual Double_t ConfidenceLevel() const {return fConfidenceLevel;}
56 
57  /// return a cloned list of parameters of interest. User manages the return object
58  virtual RooArgSet* GetParameters() const;
59 
60  /// check if parameters are correct (i.e. they are the POI of this interval)
61  Bool_t CheckParameters(const RooArgSet&) const ;
62 
63 
64  /// return the lower bound of the interval on a given parameter
65  Double_t LowerLimit(const RooRealVar& param) { bool ok; return LowerLimit(param,ok); }
66  Double_t LowerLimit(const RooRealVar& param, bool & status) ;
67 
68  /// return the upper bound of the interval on a given parameter
69  Double_t UpperLimit(const RooRealVar& param) { bool ok; return UpperLimit(param,ok); }
70  Double_t UpperLimit(const RooRealVar& param, bool & status) ;
71 
72  /// find both lower and upper interval boundaries for a given parameter
73  /// return false if the bounds have not been found
74  Bool_t FindLimits(const RooRealVar & param, double & lower, double &upper);
75 
76  /// return the 2D-contour points for the given subset of parameters
77  /// by default make the contour using 30 points. The User has to preallocate the x and y array which will return
78  /// the set of x and y points defining the contour.
79  /// The return value of the function specify the number of contour point found.
80  /// In case of error a zero is returned
81  Int_t GetContourPoints(const RooRealVar & paramX, const RooRealVar & paramY, Double_t * x, Double_t *y, Int_t npoints = 30);
82 
83  /// return the profile log-likelihood ratio function
85 
86  /// return a pointer to a snapshot with best fit parameter of interest
87  const RooArgSet * GetBestFitParameters() const { return fBestFitParams; }
88 
89  protected:
90 
91  /// reset the cached limit values
92  void ResetLimits();
93 
94  /// internal function to create the minimizer for finding the contours
95  bool CreateMinimizer();
96 
97  private:
98 
99  RooArgSet fParameters; /// parameters of interest for this interval
100  RooArgSet * fBestFitParams; /// snapshot of the model parameters with best fit value (managed internally)
101  RooAbsReal* fLikelihoodRatio; /// likelihood ratio function used to make contours (managed internally)
102  Double_t fConfidenceLevel; /// Requested confidence level (eg. 0.95 for 95% CL)
103  std::map<std::string, double> fLowerLimits; /// map with cached lower bound values
104  std::map<std::string, double> fUpperLimits; /// map with cached upper bound values
105  std::shared_ptr<ROOT::Math::Minimizer > fMinimizer; //! transient pointer to minimizer class used to find limits and contour
106  std::shared_ptr<RooFunctor> fFunctor; //! transient pointer to functor class used by the minimizer
107  std::shared_ptr<ROOT::Math::IMultiGenFunction> fMinFunc; //! transient pointer to the minimization function
108 
109  ClassDef(LikelihoodInterval,1) /// Concrete implementation of a ConfInterval based on a likelihood ratio
110 
111  };
112 }
113 
114 #endif
RooStats::LikelihoodInterval::GetContourPoints
Int_t GetContourPoints(const RooRealVar &paramX, const RooRealVar &paramY, Double_t *x, Double_t *y, Int_t npoints=30)
return the 2D-contour points for the given subset of parameters by default make the contour using 30 ...
Definition: LikelihoodInterval.cxx:378
RooStats::LikelihoodInterval::fFunctor
std::shared_ptr< RooFunctor > fFunctor
transient pointer to minimizer class used to find limits and contour
Definition: LikelihoodInterval.h:106
RooStats::LikelihoodInterval::ResetLimits
void ResetLimits()
reset the cached limit values
Definition: LikelihoodInterval.cxx:217
RooAbsReal.h
RooStats::LikelihoodInterval::GetParameters
virtual RooArgSet * GetParameters() const
return a cloned list of parameters of interest. User manages the return object
Definition: LikelihoodInterval.cxx:165
RooArgSet.h
RooStats::LikelihoodInterval::GetBestFitParameters
const RooArgSet * GetBestFitParameters() const
return a pointer to a snapshot with best fit parameter of interest
Definition: LikelihoodInterval.h:87
IFunctionfwd.h
ConfInterval.h
x
Double_t x[n]
Definition: legend1.C:17
RooAbsReal
Definition: RooAbsReal.h:61
bool
RooStats::LikelihoodInterval::fUpperLimits
std::map< std::string, double > fUpperLimits
map with cached lower bound values
Definition: LikelihoodInterval.h:104
RooStats::LikelihoodInterval::GetLikelihoodRatio
RooAbsReal * GetLikelihoodRatio()
return the profile log-likelihood ratio function
Definition: LikelihoodInterval.h:84
RooStats::LikelihoodInterval::fConfidenceLevel
Double_t fConfidenceLevel
likelihood ratio function used to make contours (managed internally)
Definition: LikelihoodInterval.h:102
RooStats::LikelihoodInterval::fLowerLimits
std::map< std::string, double > fLowerLimits
Requested confidence level (eg. 0.95 for 95% CL)
Definition: LikelihoodInterval.h:103
RooStats::LikelihoodInterval::LowerLimit
Double_t LowerLimit(const RooRealVar &param)
return the lower bound of the interval on a given parameter
Definition: LikelihoodInterval.h:65
RooStats::LikelihoodInterval::fMinimizer
std::shared_ptr< ROOT::Math::Minimizer > fMinimizer
map with cached upper bound values
Definition: LikelihoodInterval.h:105
RooStats::LikelihoodInterval::fParameters
RooArgSet fParameters
Definition: LikelihoodInterval.h:99
RooStats::LikelihoodInterval::fBestFitParams
RooArgSet * fBestFitParams
parameters of interest for this interval
Definition: LikelihoodInterval.h:100
y
Double_t y[n]
Definition: legend1.C:17
RooStats::LikelihoodInterval::fMinFunc
std::shared_ptr< ROOT::Math::IMultiGenFunction > fMinFunc
transient pointer to functor class used by the minimizer
Definition: LikelihoodInterval.h:107
RooStats::LikelihoodInterval::IsInInterval
virtual Bool_t IsInInterval(const RooArgSet &) const
check if given point is in the interval
Definition: LikelihoodInterval.cxx:117
RooFit::Minimizer
RooCmdArg Minimizer(const char *type, const char *alg=0)
Definition: RooGlobalFunc.cxx:211
RooStats::LikelihoodInterval::FindLimits
Bool_t FindLimits(const RooRealVar &param, double &lower, double &upper)
find both lower and upper interval boundaries for a given parameter return false if the bounds have n...
Definition: LikelihoodInterval.cxx:303
Double_t
double Double_t
Definition: RtypesCore.h:59
RooStats::LikelihoodInterval::CheckParameters
Bool_t CheckParameters(const RooArgSet &) const
check if parameters are correct (i.e. they are the POI of this interval)
Definition: LikelihoodInterval.cxx:173
RooStats
Definition: Asimov.h:19
RooStats::LikelihoodInterval::fLikelihoodRatio
RooAbsReal * fLikelihoodRatio
snapshot of the model parameters with best fit value (managed internally)
Definition: LikelihoodInterval.h:101
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooStats::LikelihoodInterval::~LikelihoodInterval
virtual ~LikelihoodInterval()
destructor
Definition: LikelihoodInterval.cxx:106
name
char name[80]
Definition: TGX11.cxx:110
RooStats::ConfInterval
Definition: ConfInterval.h:41
RooRealVar
Definition: RooRealVar.h:35
RooStats::LikelihoodInterval::ConfidenceLevel
virtual Double_t ConfidenceLevel() const
return confidence level
Definition: LikelihoodInterval.h:55
RooStats::LikelihoodInterval::CreateMinimizer
bool CreateMinimizer()
internal function to create the minimizer for finding the contours
Definition: LikelihoodInterval.cxx:224
RooStats::LikelihoodInterval::LikelihoodInterval
LikelihoodInterval(const char *name=0)
default constructor
Definition: LikelihoodInterval.cxx:84
ROOT
VSD Structures.
Definition: StringConv.hxx:21
RooStats::LikelihoodInterval
Definition: LikelihoodInterval.h:34
Math
RooArgSet
Definition: RooArgSet.h:28
RooStats::LikelihoodInterval::UpperLimit
Double_t UpperLimit(const RooRealVar &param)
return the upper bound of the interval on a given parameter
Definition: LikelihoodInterval.h:69
int
RooStats::LikelihoodInterval::SetConfidenceLevel
virtual void SetConfidenceLevel(Double_t cl)
set the confidence level for the interval (e.g 0.682 for a 1-sigma interval)
Definition: LikelihoodInterval.h:52