Logo ROOT  
Reference Guide
MinNLLTestStat.h
Go to the documentation of this file.
1// @(#)root/roostats:$Id: MinNLLTestStat.h 43035 2012-02-16 16:48:57Z sven $
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_MinNLLTestStat
13#define ROOSTATS_MinNLLTestStat
14
15
16#include "Rtypes.h"
17
19
20//#include "RooStats/DistributionCreator.h"
23
25
26#include "RooRealVar.h"
27#include "RooProfileLL.h"
28#include "RooNLLVar.h"
29#include "RooMsgService.h"
30
31#include "RooMinuit.h"
32#include "RooMinimizer.h"
34#include "TStopwatch.h"
36
37namespace RooStats {
38
39/** \class MinNLLTestStat
40 \ingroup Roostats
41
42MinNLLTestStat is an implementation of the TestStatistic interface that
43calculates the minimum value of the negative log likelihood
44function and returns it as a test statistic.
45Internally it operates by delegating to a MinNLLTestStat object.
46
47*/
48
50
51 public:
53 // Proof constructor. Do not use.
54 fProflts = 0;
55 }
58 }
59
61 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
62 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
63 }
64
66 if (this == &rhs) return *this;
67 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
68 if (fProflts) delete fProflts;
69 fProflts = NULL;
70 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
71 return *this;
72 }
73
74 virtual ~MinNLLTestStat() {
75 delete fProflts;
76 }
77
78 void SetOneSided(Bool_t flag=true) {fProflts->SetOneSided(flag);}
80 void SetReuseNLL(Bool_t flag) { fProflts->SetReuseNLL(flag); }
81 void SetMinimizer(const char* minimizer){ fProflts->SetMinimizer(minimizer); }
82 void SetStrategy(Int_t strategy){ fProflts->SetStrategy(strategy); }
83 void SetTolerance(double tol){ fProflts->SetTolerance(tol); }
84 void SetPrintLevel(Int_t printlevel){ fProflts->SetPrintLevel(printlevel); }
85 void SetLOffset(Bool_t flag=kTRUE) { fProflts->SetLOffset(flag) ; }
86
87 // Main interface to evaluate the test statistic on a dataset
88 virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) {
89 return fProflts->EvaluateProfileLikelihood(1, data, paramsOfInterest); //find unconditional NLL minimum
90 }
91
92 virtual void EnableDetailedOutput( bool e=true ) { fProflts->EnableDetailedOutput(e); }
93
94 virtual const RooArgSet* GetDetailedOutput(void) const {
95 // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
96 // The returned RooArgSet contains the following:
97 //
98 // - the minimum nll, fitstatus and convergence quality for each fit </li>
99 // - for all non-constant parameters their value, error and pull </li>
100 return fProflts->GetDetailedOutput();
101 }
102
103 virtual void SetVarName(const char* name) { fProflts->SetVarName(name); }
104
105 virtual const TString GetVarName() const { return fProflts->GetVarName(); }
106
107 private:
109
110 protected:
111 ClassDef(MinNLLTestStat,1) // implements the minimum NLL as a test statistic to be used with several tools
112 };
113}
114
115
116#endif
#define e(i)
Definition: RSha256.hxx:103
double Double_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
char name[80]
Definition: TGX11.cxx:109
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:44
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
MinNLLTestStat is an implementation of the TestStatistic interface that calculates the minimum value ...
void SetOneSided(Bool_t flag=true)
virtual const TString GetVarName() const
MinNLLTestStat(const MinNLLTestStat &rhs)
void SetPrintLevel(Int_t printlevel)
void SetStrategy(Int_t strategy)
virtual Double_t Evaluate(RooAbsData &data, RooArgSet &paramsOfInterest)
Main interface to evaluate the test statistic on a dataset given the values for the Null Parameters O...
void SetOneSidedDiscovery(Bool_t flag=true)
virtual void SetVarName(const char *name)
void SetTolerance(double tol)
MinNLLTestStat(RooAbsPdf &pdf)
void SetMinimizer(const char *minimizer)
MinNLLTestStat & operator=(const MinNLLTestStat &rhs)
void SetReuseNLL(Bool_t flag)
ProfileLikelihoodTestStat * fProflts
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
void SetLOffset(Bool_t flag=kTRUE)
virtual void EnableDetailedOutput(bool e=true)
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet &paramsOfInterest)
internal function to evaluate test statistics can do depending on type:
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
virtual const TString GetVarName() const
virtual void SetVarName(const char *name)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
Basic string class.
Definition: TString.h:131
Namespace for the RooStats classes.
Definition: Asimov.h:19