Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
24#include "RooRealVar.h"
25#include "RooProfileLL.h"
26#include "RooMsgService.h"
27
28#include "RooMinimizer.h"
30#include "TStopwatch.h"
32
33namespace RooStats {
34
35/** \class MinNLLTestStat
36 \ingroup Roostats
37
38MinNLLTestStat is an implementation of the TestStatistic interface that
39calculates the minimum value of the negative log likelihood
40function and returns it as a test statistic.
41Internally it operates by delegating to a MinNLLTestStat object.
42
43*/
44
46
47 public:
48 // Proof constructor. Do not use.
51
53 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
54 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
55 }
56
58 if (this == &rhs) return *this;
59 RooAbsPdf * pdf = rhs.fProflts->GetPdf();
60 if (fProflts) delete fProflts;
61 fProflts = nullptr;
62 if (pdf) fProflts = new ProfileLikelihoodTestStat(*pdf);
63 return *this;
64 }
65
66 ~MinNLLTestStat() override {
67 delete fProflts;
68 }
69
70 void SetOneSided(bool flag=true) {fProflts->SetOneSided(flag);}
71 void SetOneSidedDiscovery(bool flag=true) {fProflts->SetOneSidedDiscovery(flag);}
72 void SetReuseNLL(bool flag) { fProflts->SetReuseNLL(flag); }
73 void SetMinimizer(const char* minimizer){ fProflts->SetMinimizer(minimizer); }
74 void SetStrategy(Int_t strategy){ fProflts->SetStrategy(strategy); }
75 void SetTolerance(double tol){ fProflts->SetTolerance(tol); }
76 void SetPrintLevel(Int_t printlevel){ fProflts->SetPrintLevel(printlevel); }
77 void SetLOffset(bool flag=true) { fProflts->SetLOffset(flag) ; }
78
79 // Main interface to evaluate the test statistic on a dataset
80 double Evaluate(RooAbsData& data, RooArgSet& paramsOfInterest) override {
81 return fProflts->EvaluateProfileLikelihood(1, data, paramsOfInterest); //find unconditional NLL minimum
82 }
83
84 virtual void EnableDetailedOutput( bool e=true ) { fProflts->EnableDetailedOutput(e); }
85
86 const RooArgSet* GetDetailedOutput(void) const override {
87 // Returns detailed output. The value returned by this function is updated after each call to Evaluate().
88 // The returned RooArgSet contains the following:
89 //
90 // - the minimum nll, fitstatus and convergence quality for each fit </li>
91 // - for all non-constant parameters their value, error and pull </li>
93 }
94
95 virtual void SetVarName(const char* name) { fProflts->SetVarName(name); }
96
97 const TString GetVarName() const override { return fProflts->GetVarName(); }
98
99 private:
101
102 protected:
103 ClassDefOverride(MinNLLTestStat,1) // implements the minimum NLL as a test statistic to be used with several tools
104 };
105}
106
107
108#endif
#define e(i)
Definition RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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
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:55
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...
Basic string class.
Definition TString.h:139
Namespace for the RooStats classes.
Definition Asimov.h:19