CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/HiggsAnalysis/CombinedLimit/interface/SimplerLikelihoodRatioTestStatExt.h

Go to the documentation of this file.
00001 #ifndef HiggsAnalysis_CombinedLimit_SimplerLikelihoodRatioTestStatExt_h
00002 #define HiggsAnalysis_CombinedLimit_SimplerLikelihoodRatioTestStatExt_h
00003 
00025 #include <memory>
00026 #include <stdexcept>
00027 #include <RooAbsPdf.h>
00028 #include <RooAbsData.h>
00029 #include <RooSimultaneous.h>
00030 #include <RooArgSet.h>
00031 #include <RooStats/TestStatistic.h>
00032 
00033 
00034 class SimplerLikelihoodRatioTestStatOpt : public RooStats::TestStatistic {
00035     public:
00041         SimplerLikelihoodRatioTestStatOpt(const RooArgSet &obs, RooAbsPdf &pdfNull, RooAbsPdf &pdfAlt, const RooArgSet & paramsNull = RooArgSet(), const RooArgSet & paramsAlt = RooArgSet(), bool factorize=true) ;
00042 
00043         virtual ~SimplerLikelihoodRatioTestStatOpt() ;
00044 
00045         virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullPOI) ;
00046 
00047         virtual const TString GetVarName() const {
00048             return TString::Format("-log(%s/%s)", pdfNull_->GetName(), pdfAlt_->GetName()); 
00049         }
00050     private:
00052         const RooArgSet *obs_; 
00054         RooAbsPdf *pdfNull_, *pdfAlt_;
00056         RooArgSet pdfCompNull_, pdfCompAlt_;
00058         RooArgList pdfDepObs_;
00060         RooArgSet snapNull_, snapAlt_; 
00062         std::auto_ptr<RooArgSet> paramsNull_, paramsAlt_;
00064         std::auto_ptr<RooAbsPdf> pdfNullOwned_, pdfAltOwned_;
00066         RooSimultaneous *simPdfNull_, *simPdfAlt_;
00068         std::vector<RooAbsPdf *> simPdfComponentsNull_, simPdfComponentsAlt_;
00069 
00070         double evalSimNLL(RooAbsData &data,  RooSimultaneous *pdf, std::vector<RooAbsPdf *> &components);
00071         double evalSimpleNLL(RooAbsData &data,  RooAbsPdf *pdf);
00072         void unrollSimPdf(RooSimultaneous *pdf, std::vector<RooAbsPdf *> &out);
00073 
00074 }; // 
00075 
00076 // ===== This below is identical to the RooStats::SimpleLikelihoodRatioTestStat also in implementation
00077 //       I've made a copy here just to be able to put some debug hooks inside.
00078 #if 0
00079 class SimplerLikelihoodRatioTestStatExt : public RooStats::TestStatistic {
00080     public:
00081         SimplerLikelihoodRatioTestStatExt(const RooArgSet &obs, RooAbsPdf &pdfNull, RooAbsPdf &pdfAlt, const RooArgSet & paramsNull = RooArgSet(), const RooArgSet & paramsAlt = RooArgSet()) ;
00082 
00083         virtual ~SimplerLikelihoodRatioTestStatExt() ;
00084 
00085         virtual Double_t Evaluate(RooAbsData& data, RooArgSet& nullPOI) ;
00086 
00087         virtual const TString GetVarName() const {
00088             return TString::Format("-log(%s/%s)", pdfNull_->GetName(), pdfAlt_->GetName()); 
00089         }
00090 
00091     private:
00092         RooAbsPdf *pdfNull_, *pdfAlt_;
00093         RooArgSet snapNull_, snapAlt_; 
00094         std::auto_ptr<RooArgSet> paramsNull_, paramsAlt_;
00095         std::auto_ptr<RooAbsPdf> pdfNullOwned_, pdfAltOwned_;
00096 }; // TestSimpleStatistics
00097 #endif
00098 
00099 #endif