Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
ProfileLikelihoodTestStat.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id$
2// Author: Kyle Cranmer, Lorenzo Moneta, Gregory Schott, Wouter Verkerke
3// Additional Contributions: Giovanni Petrucciani
4/*************************************************************************
5 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOSTATS_ProfileLikelihoodTestStat
13#define ROOSTATS_ProfileLikelihoodTestStat
14
15
16#include "Rtypes.h"
17
19
20
21#include "RooRealVar.h"
22
24
26
27
28namespace RooStats {
29
31
33
34 public:
36 : fPdf(&pdf),
37 fStrategy(::ROOT::Math::MinimizerOptions::DefaultStrategy()),
38 fTolerance(std::max(1., ::ROOT::Math::MinimizerOptions::DefaultTolerance())),
39 fPrintLevel(::ROOT::Math::MinimizerOptions::DefaultPrintLevel()),
41 {
42 // avoid default tolerance to be too small (1. is default in RooMinimizer)
43 }
44
48
49 void SetOneSided(bool flag=true) {fLimitType = (flag ? oneSided : twoSided);}
51 void SetSigned(bool flag=true) {fSigned = flag;} // +/- t_mu instead of t_mu>0 with one-sided settings
52
53 bool IsTwoSided() const { return fLimitType == twoSided; }
55
56 static void SetAlwaysReuseNLL(bool flag);
57
58 void SetReuseNLL(bool flag) { fReuseNll = flag ; }
59 void SetLOffset(bool flag=true) { fLOffset = flag ? "initial" : "none"; }
60 void SetLOffset(std::string const &mode) { fLOffset = mode; }
61
62 void SetMinimizer(const char* minimizer){ fMinimizer=minimizer;}
66
67 /// Main interface to evaluate the test statistic on a dataset
71
72 /// evaluate the profile likelihood ratio (type = 0) or the minimum of likelihood (type=1) or the conditional LL (type = 2)
74
80 /// Returns detailed output. The value returned by this function is updated after each call to Evaluate().
81 /// The returned RooArgSet contains the following:
82 ///
83 /// - the minimum nll, fitstatus and convergence quality for each fit
84 /// - for each fit and for each non-constant parameter, the value, error and pull of the parameter are stored
85 ///
86 const RooArgSet* GetDetailedOutput(void) const override {
87 return fDetailedOutput.get();
88 }
89
90 /// set the conditional observables which will be used when creating the NLL
91 /// so the pdf's will not be normalized on the conditional observables when computing the NLL
93
94 /// set the global observables which will be used when creating the NLL
95 /// so the constraint pdf's will be normalized correctly on the global observables when computing the NLL
96 void SetGlobalObservables(const RooArgSet& set) override {fGlobalObs.removeAll(); fGlobalObs.add(set);}
97
98 virtual void SetVarName(const char* name) { fVarName = name; }
99 const TString GetVarName() const override {return fVarName;}
100
101 virtual RooAbsPdf * GetPdf() const { return fPdf; }
102
103 private:
104
105 std::unique_ptr<RooFitResult> GetMinNLL();
106
107 RooAbsPdf* fPdf = nullptr;
108 std::unique_ptr<RooAbsReal> fNll; //!
112 bool fSigned = false;
113
114 /// this will store a snapshot of the unconditional nuisance
115 /// parameter fit.
118 std::unique_ptr<RooArgSet> fDetailedOutput; ///<!
119 RooArgSet fConditionalObs; ///< conditional observables
120 RooArgSet fGlobalObs; ///< global observables
121
122 TString fVarName = "Profile Likelihood Ratio";
123
124 static bool fgAlwaysReuseNll ;
125 bool fReuseNll = false;
130 std::string fLOffset;
131
132 ClassDefOverride(ProfileLikelihoodTestStat,0) // implements the profile likelihood ratio as a test statistic to be used with several tools
133 };
134}
135
136
137#endif
#define e(i)
Definition RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
std::unique_ptr< RooArgSet > fDetailedOutput
!
RooArgSet fConditionalObs
conditional observables
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
double Evaluate(RooAbsData &data, RooArgSet &paramsOfInterest) override
Main interface to evaluate the test statistic on a dataset.
void SetConditionalObservables(const RooArgSet &set) override
set the conditional observables which will be used when creating the NLL so the pdf's will not be nor...
void SetGlobalObservables(const RooArgSet &set) override
set the global observables which will be used when creating the NLL so the constraint pdf's will be n...
virtual double EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet &paramsOfInterest)
evaluate the profile likelihood ratio (type = 0) or the minimum of likelihood (type=1) or the conditi...
const RooArgSet * GetDetailedOutput(void) const override
Returns detailed output.
const TString GetVarName() const override
virtual void SetVarName(const char *name)
std::unique_ptr< RooFitResult > GetMinNLL()
find minimum of NLL using RooMinimizer
bool fDetailedOutputEnabled
this will store a snapshot of the unconditional nuisance parameter fit.
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Basic string class.
Definition TString.h:139
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Namespace for the RooStats classes.
Definition CodegenImpl.h:58
std::string const & NLLOffsetMode()
Test what offsetting mode RooStats should use by default.