CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProfiledLikelihoodRatioTestStatExt.h
Go to the documentation of this file.
1 #ifndef HiggsAnalysis_CombinedLimit_ProfiledLikelihoodRatioTestStatExt_h
2 #define HiggsAnalysis_CombinedLimit_ProfiledLikelihoodRatioTestStatExt_h
3 
4 #include <memory>
5 #include <vector>
6 
7 class RooMinimizerOpt;
8 #include <RooAbsPdf.h>
9 #include <RooAbsData.h>
10 #include <RooArgSet.h>
11 #include <RooStats/TestStatistic.h>
12 #include "../interface/RooSimultaneousOpt.h"
13 #include "../interface/CachingNLL.h"
14 
15 namespace nllutils {
16  bool robustMinimize(RooAbsReal &nll, RooMinimizerOpt &minimizer, int verbosity=0);
17 }
18 
19 class ProfiledLikelihoodRatioTestStatOpt : public RooStats::TestStatistic {
20  public:
21  ProfiledLikelihoodRatioTestStatOpt(const RooArgSet &obs, RooAbsPdf &pdfNull, RooAbsPdf &pdfAlt,
22  const RooArgSet *nuisances, const RooArgSet & paramsNull = RooArgSet(), const RooArgSet & paramsAlt = RooArgSet(),
23  int verbosity=0) ;
24 
25  virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullPOI) ;
26 
27  virtual const TString GetVarName() const {
28  return TString::Format("-log(%s/%s)", pdfNull_->GetName(), pdfAlt_->GetName());
29  }
30 
31  // Verbosity (default: 0)
32  void setPrintLevel(Int_t level) { verbosity_ = level; }
33 
34  private:
35  RooAbsPdf *pdfNull_, *pdfAlt_;
36  RooArgSet snapNull_, snapAlt_;
37  RooArgSet nuisances_;
38  std::auto_ptr<RooArgSet> paramsNull_, paramsAlt_;
39  std::auto_ptr<RooAbsReal> nllNull_, nllAlt_;
40  Int_t verbosity_;
41 
42  // create NLL. if returns true, it can be kept, if false it should be deleted at the end of Evaluate
43  bool createNLL(RooAbsPdf &pdf, RooAbsData &data, std::auto_ptr<RooAbsReal> &nll) ;
44 
45  double minNLL(std::auto_ptr<RooAbsReal> &nll) ;
46 }; // TestSimpleStatistics
47 
48 
49 class ProfiledLikelihoodTestStatOpt : public RooStats::TestStatistic {
50  public:
52 
53  ProfiledLikelihoodTestStatOpt(const RooArgSet & observables,
54  RooAbsPdf &pdf,
55  const RooArgSet *nuisances,
56  const RooArgSet & params, const RooArgSet & poi, const RooArgList &gobsParams, const RooArgList &gobs, int verbosity=0, OneSidedness oneSided = oneSidedDef) ;
57 
58  virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullPOI) ;
59  virtual std::vector<Double_t> Evaluate(RooAbsData& data, RooArgSet& nullPOI, const std::vector<Double_t> &rVals) ;
60 
61  virtual const TString GetVarName() const { return "- log (#lambda)"; }
62 
63  // Verbosity (default: 0)
64  void setPrintLevel(Int_t level) { verbosity_ = level; }
65 
66  void SetOneSided(OneSidedness oneSided) { oneSided_ = oneSided; }
67  private:
68 
69  RooAbsPdf *pdf_;
70  RooArgSet snap_, poi_; // snapshot of parameters, and of the subset which are POI
71  std::auto_ptr<RooArgSet> params_;
72  RooArgSet nuisances_; // subset of params which are nuisances (not a snapshot)
73  RooArgSet poiParams_; // subset of params which are POI (not a snapshot)
74  std::auto_ptr<RooAbsReal> nll_;
75  RooArgList gobsParams_, gobs_;
76  Int_t verbosity_;
78 
79  // create NLL. if returns true, it can be kept, if false it should be deleted at the end of Evaluate
80  bool createNLL(RooAbsPdf &pdf, RooAbsData &data) ;
81  double minNLL(bool constrained, RooRealVar *r=0) ;
82 }; // TestSimpleStatistics
83 
84 
85 #endif
virtual Double_t Evaluate(RooAbsData &data, RooArgSet &nullPOI)
bool robustMinimize(RooAbsReal &nll, RooMinimizerOpt &minimizer, int verbosity=0)
ProfiledLikelihoodTestStatOpt(const RooArgSet &observables, RooAbsPdf &pdf, const RooArgSet *nuisances, const RooArgSet &params, const RooArgSet &poi, const RooArgList &gobsParams, const RooArgList &gobs, int verbosity=0, OneSidedness oneSided=oneSidedDef)
double minNLL(bool constrained, RooRealVar *r=0)
virtual Double_t Evaluate(RooAbsData &data, RooArgSet &nullPOI)
ProfiledLikelihoodRatioTestStatOpt(const RooArgSet &obs, RooAbsPdf &pdfNull, RooAbsPdf &pdfAlt, const RooArgSet *nuisances, const RooArgSet &paramsNull=RooArgSet(), const RooArgSet &paramsAlt=RooArgSet(), int verbosity=0)
double minNLL(std::auto_ptr< RooAbsReal > &nll)
bool createNLL(RooAbsPdf &pdf, RooAbsData &data, std::auto_ptr< RooAbsReal > &nll)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple level
Definition: testEve_cfg.py:34
bool createNLL(RooAbsPdf &pdf, RooAbsData &data)