CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/HiggsAnalysis/CombinedLimit/src/ProfiledLikelihoodRatioTestStat.cc

Go to the documentation of this file.
00001 #include "../interface/ProfiledLikelihoodRatioTestStat.h"
00002 #include "../interface/CloseCoutSentry.h"
00003 #include <stdexcept>
00004 #include <RooRealVar.h>
00005 
00006 Double_t ProfiledLikelihoodRatioTestStat::Evaluate(RooAbsData& data, RooArgSet& nullPOI)
00007 {
00008     if (data.numEntries() != 1) throw std::invalid_argument("HybridNew::TestSimpleStatistics: dataset doesn't have exactly 1 entry.");
00009     CloseCoutSentry(true);
00010 
00011     const RooArgSet *entry = data.get(0);
00012     *paramsNull_ = *entry;
00013     *paramsNull_ = nuisances_;
00014     *paramsNull_ = snapNull_;
00015     *paramsNull_ = nullPOI;
00016 
00017     pdfNull_->fitTo(data, RooFit::Constrain(nuisances_), RooFit::Hesse(0), RooFit::PrintLevel(-1), RooFit::PrintEvalErrors(-1));
00018     double nullNLL = pdfNull_->getVal();
00019 
00020     *paramsAlt_ = *entry;
00021     *paramsAlt_ = nuisances_;
00022     *paramsAlt_ = snapAlt_;
00023 
00024     pdfAlt_->fitTo(data, RooFit::Constrain(nuisances_), RooFit::Hesse(0), RooFit::PrintLevel(-1), RooFit::PrintEvalErrors(-1));
00025 
00026     double altNLL = pdfAlt_->getVal();
00027     return -log(nullNLL/altNLL);
00028 }
00029