Logo ROOT   6.18/05
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
17
18#include "Rtypes.h"
19
20#include <vector>
21
23
24//#include "RooStats/DistributionCreator.h"
27
29
30#include "RooRealVar.h"
31#include "RooProfileLL.h"
32#include "RooNLLVar.h"
33#include "RooMsgService.h"
34
35#include "RooMinuit.h"
36#include "RooMinimizer.h"
38#include "TStopwatch.h"
40
41namespace RooStats {
42
43/** \class MinNLLTestStat
44 \ingroup Roostats
45
46MinNLLTestStat is an implementation of the TestStatistic interface that
47calculates the minimum value of the negative log likelihood
48function and returns it as a test statistic.
49Internally it operates by delegating to a MinNLLTestStat object.
50
51*/
52
54
55 public:
57 // Proof constructor. Do not use.
58 fProflts = 0;
59 }
62 }
63
65 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
66 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
67 }
68
70 if (this == &rhs) return *this;
71 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
72 if (fProflts) delete fProflts;
73 fProflts = NULL;
74 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
75 return *this;
76 }
77
78 virtual ~MinNLLTestStat() {
79 delete fProflts;
80 }
81
82 void SetOneSided(Bool_t flag=true) {fProflts->SetOneSided(flag);}
84 void SetReuseNLL(Bool_t flag) { fProflts->SetReuseNLL(flag); }
85 void SetMinimizer(const char* minimizer){ fProflts->SetMinimizer(minimizer); }
86 void SetStrategy(Int_t strategy){ fProflts->SetStrategy(strategy); }
87 void SetTolerance(double tol){ fProflts->SetTolerance(tol); }
88 void SetPrintLevel(Int_t printlevel){ fProflts->SetPrintLevel(printlevel); }
89 void SetLOffset(Bool_t flag=kTRUE) { fProflts->SetLOffset(flag) ; }
90
91 // Main interface to evaluate the test statistic on a dataset
92 virtual Double_t Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) {
93 return fProflts->EvaluateProfileLikelihood(1, data, paramsOfInterest); //find unconditional NLL minimum
94 }
95
96 virtual void EnableDetailedOutput( bool e=true ) { fProflts->EnableDetailedOutput(e); }
97
98 virtual const RooArgSet* GetDetailedOutput(void) const {
99 // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
100 // The returned RooArgSet contains the following:
101 //
102 // - the minimum nll, fitstatus and convergence quality for each fit </li>
103 // - for all non-constant parameters their value, error and pull </li>
104 return fProflts->GetDetailedOutput();
105 }
106
107 virtual void SetVarName(const char* name) { fProflts->SetVarName(name); }
108
109 virtual const TString GetVarName() const { return fProflts->GetVarName(); }
110
111 private:
113
114 protected:
115 ClassDef(MinNLLTestStat,1) // implements the minimum NLL as a test statistic to be used with several tools
116 };
117}
118
119
120#endif
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
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:20