Logo ROOT   6.10/09
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 
22 #include "RooStats/RooStatsUtils.h"
23 
24 //#include "RooStats/DistributionCreator.h"
26 #include "RooStats/TestStatistic.h"
27 
28 #include "RooStats/RooStatsUtils.h"
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"
37 #include "Math/MinimizerOptions.h"
38 #include "TStopwatch.h"
40 
41 namespace RooStats {
42 
43 /** \class MinNLLTestStat
44  \ingroup Roostats
45 
46 MinNLLTestStat is an implementation of the TestStatistic interface that
47 calculates the minimum value of the negative log likelihood
48 function and returns it as a test statistic.
49 Internally it operates by delegating to a MinNLLTestStat object.
50 
51 */
52 
53  class MinNLLTestStat : public TestStatistic{
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); }
87  void SetTolerance(double tol){ fProflts->SetTolerance(tol); }
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
MinNLLTestStat(RooAbsPdf &pdf)
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
MinNLLTestStat is an implementation of the TestStatistic interface that calculates the minimum value ...
void SetStrategy(Int_t strategy)
void SetReuseNLL(Bool_t flag)
Basic string class.
Definition: TString.h:129
void SetOneSided(Bool_t flag=true)
virtual void EnableDetailedOutput(bool e=true, bool withErrorsAndPulls=false)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual const TString GetVarName() const
virtual Double_t EvaluateProfileLikelihood(int type, RooAbsData &data, RooArgSet &paramsOfInterest)
internal function to evaluate test statistics can do depending on type:
#define NULL
Definition: RtypesCore.h:88
void SetTolerance(double tol)
#define ClassDef(name, id)
Definition: Rtypes.h:297
void SetPrintLevel(Int_t printlevel)
int printlevel
virtual const TString GetVarName() const
void SetMinimizer(const char *minimizer)
void SetOneSidedDiscovery(Bool_t flag=true)
void SetLOffset(Bool_t flag=kTRUE)
const double tol
virtual void SetVarName(const char *name)
MinNLLTestStat & operator=(const MinNLLTestStat &rhs)
virtual const RooArgSet * GetDetailedOutput(void) const
return detailed output: for fits this can be pulls, processing time, ... The returned pointer will no...
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
ProfileLikelihoodTestStat is an implementation of the TestStatistic interface that calculates the pro...
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...
virtual void EnableDetailedOutput(bool e=true)
Namespace for the RooStats classes.
Definition: Asimov.h:20
double Double_t
Definition: RtypesCore.h:55
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
ProfileLikelihoodTestStat * fProflts
const int strategy
Definition: testNdimFit.cxx:46
MinNLLTestStat(const MinNLLTestStat &rhs)
virtual void SetVarName(const char *name)
TestStatistic is an interface class to provide a facility for construction test statistics distributi...
Definition: TestStatistic.h:31
const Bool_t kTRUE
Definition: RtypesCore.h:91