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 "RooMsgService.h"
29
30#include "RooMinimizer.h"
32#include "TStopwatch.h"
34
35namespace RooStats {
36
37/** \class MinNLLTestStat
38 \ingroup Roostats
39
40MinNLLTestStat is an implementation of the TestStatistic interface that
41calculates the minimum value of the negative log likelihood
42function and returns it as a test statistic.
43Internally it operates by delegating to a MinNLLTestStat object.
44
45*/
46
48
49 public:
51 // Proof constructor. Do not use.
52 fProflts = nullptr;
53 }
56 }
57
58 MinNLLTestStat(const MinNLLTestStat& rhs) : TestStatistic(rhs), fProflts(nullptr) {
59 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
60 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
61 }
62
64 if (this == &rhs) return *this;
65 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
66 if (fProflts) delete fProflts;
67 fProflts = nullptr;
68 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
69 return *this;
70 }
71
72 ~MinNLLTestStat() override {
73 delete fProflts;
74 }
75
76 void SetOneSided(bool flag=true) {fProflts->SetOneSided(flag);}
77 void SetOneSidedDiscovery(bool flag=true) {fProflts->SetOneSidedDiscovery(flag);}
78 void SetReuseNLL(bool flag) { fProflts->SetReuseNLL(flag); }
79 void SetMinimizer(const char* minimizer){ fProflts->SetMinimizer(minimizer); }
80 void SetStrategy(Int_t strategy){ fProflts->SetStrategy(strategy); }
81 void SetTolerance(double tol){ fProflts->SetTolerance(tol); }
82 void SetPrintLevel(Int_t printlevel){ fProflts->SetPrintLevel(printlevel); }
83 void SetLOffset(bool flag=true) { fProflts->SetLOffset(flag) ; }
84
85 // Main interface to evaluate the test statistic on a dataset
86 double Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) override {
87 return fProflts->EvaluateProfileLikelihood(1, data, paramsOfInterest); //find unconditional NLL minimum
88 }
89
90 virtual void EnableDetailedOutput( bool e=true ) { fProflts->EnableDetailedOutput(e); }
91
92 const RooArgSet* GetDetailedOutput(void) const override {
93 // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
94 // The returned RooArgSet contains the following:
95 //
96 // - the minimum nll, fitstatus and convergence quality for each fit </li>
97 // - for all non-constant parameters their value, error and pull </li>
99 }
100
101 virtual void SetVarName(const char* name) { fProflts->SetVarName(name); }
102
103 const TString GetVarName() const override { return fProflts->GetVarName(); }
104
105 private:
107
108 protected:
109 ClassDefOverride(MinNLLTestStat,1) // implements the minimum NLL as a test statistic to be used with several tools
110 };
111}
112
113
114#endif
#define e(i)
Definition: RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
char name[80]
Definition: TGX11.cxx:110
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:62
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
MinNLLTestStat is an implementation of the TestStatistic interface that calculates the minimum value ...
double Evaluate(RooAbsData &data, RooArgSet &paramsOfInterest) override
Main interface to evaluate the test statistic on a dataset given the values for the Null Parameters O...
void SetLOffset(bool flag=true)
MinNLLTestStat(const MinNLLTestStat &rhs)
void SetReuseNLL(bool flag)
void SetPrintLevel(Int_t printlevel)
void SetStrategy(Int_t strategy)
void SetOneSidedDiscovery(bool 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)
ProfileLikelihoodTestStat * fProflts
void SetOneSided(bool flag=true)
virtual void EnableDetailedOutput(bool e=true)
const RooArgSet * GetDetailedOutput(void) const override
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
const TString GetVarName() const override
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
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)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
Basic string class.
Definition: TString.h:136
Namespace for the RooStats classes.
Definition: Asimov.h:19