#include <ProfiledLikelihoodRatioTestStatExt.h>
Public Member Functions | |
virtual Double_t | Evaluate (RooAbsData &data, RooArgSet &nullPOI) |
virtual const TString | GetVarName () const |
ProfiledLikelihoodRatioTestStatOpt (const RooArgSet &obs, RooAbsPdf &pdfNull, RooAbsPdf &pdfAlt, const RooArgSet *nuisances, const RooArgSet ¶msNull=RooArgSet(), const RooArgSet ¶msAlt=RooArgSet(), int verbosity=0) | |
void | setPrintLevel (Int_t level) |
Private Member Functions | |
bool | createNLL (RooAbsPdf &pdf, RooAbsData &data, std::auto_ptr< RooAbsReal > &nll) |
double | minNLL (std::auto_ptr< RooAbsReal > &nll) |
Private Attributes | |
std::auto_ptr< RooAbsReal > | nllAlt_ |
std::auto_ptr< RooAbsReal > | nllNull_ |
RooArgSet | nuisances_ |
std::auto_ptr< RooArgSet > | paramsAlt_ |
std::auto_ptr< RooArgSet > | paramsNull_ |
RooAbsPdf * | pdfAlt_ |
RooAbsPdf * | pdfNull_ |
RooArgSet | snapAlt_ |
RooArgSet | snapNull_ |
Int_t | verbosity_ |
Definition at line 19 of file ProfiledLikelihoodRatioTestStatExt.h.
ProfiledLikelihoodRatioTestStatOpt::ProfiledLikelihoodRatioTestStatOpt | ( | const RooArgSet & | obs, |
RooAbsPdf & | pdfNull, | ||
RooAbsPdf & | pdfAlt, | ||
const RooArgSet * | nuisances, | ||
const RooArgSet & | paramsNull = RooArgSet() , |
||
const RooArgSet & | paramsAlt = RooArgSet() , |
||
int | verbosity = 0 |
||
) |
Definition at line 40 of file ProfiledLikelihoodRatioTestStatExt.cc.
References gather_cfg::cout, DBG, nuisances_, pdfAlt_, pdfNull_, snapAlt_, and snapNull_.
: pdfNull_(&pdfNull), pdfAlt_(&pdfAlt), paramsNull_(pdfNull_->getVariables()), paramsAlt_(pdfAlt_->getVariables()), verbosity_(verbosity) { snapNull_.addClone(paramsNull); snapAlt_.addClone(paramsAlt); DBG(DBG_TestStat_params, (std::cout << "Null snapshot" << pdfNull_->GetName())) DBG(DBG_TestStat_params, (snapNull_.Print("V"))) DBG(DBG_TestStat_params, (std::cout << "Alt snapshot" << pdfAlt_->GetName())) DBG(DBG_TestStat_params, (snapAlt_.Print("V"))) if (nuisances) nuisances_.addClone(*nuisances); }
bool ProfiledLikelihoodRatioTestStatOpt::createNLL | ( | RooAbsPdf & | pdf, |
RooAbsData & | data, | ||
std::auto_ptr< RooAbsReal > & | nll | ||
) | [private] |
Definition at line 85 of file ProfiledLikelihoodRatioTestStatExt.cc.
References nuisances_.
Referenced by Evaluate().
{ if (typeid(pdf) == typeid(RooSimultaneousOpt)) { if (nll_.get() == 0) nll_.reset(pdf.createNLL(data, RooFit::Constrain(nuisances_))); else ((cacheutils::CachingSimNLL&)(*nll_)).setData(data); return true; } else { nll_.reset(pdf.createNLL(data, RooFit::Constrain(nuisances_))); return false; } }
Double_t ProfiledLikelihoodRatioTestStatOpt::Evaluate | ( | RooAbsData & | data, |
RooArgSet & | nullPOI | ||
) | [virtual] |
Definition at line 59 of file ProfiledLikelihoodRatioTestStatExt.cc.
References gather_cfg::cout, createNLL(), DBG, DBGV, minNLL(), nllAlt_, nllNull_, nuisances_, paramsAlt_, paramsNull_, pdfAlt_, pdfNull_, snapAlt_, and snapNull_.
{ *paramsNull_ = nuisances_; *paramsNull_ = snapNull_; *paramsNull_ = nullPOI; DBGV(DBG_TestStat_params, (std::cout << "Parameters of null pdf (pre fit)" << pdfNull_->GetName())) DBGV(DBG_TestStat_params, (paramsNull_->Print("V"))) bool canKeepNullNLL = createNLL(*pdfNull_, data, nllNull_); double nullNLL = minNLL(nllNull_); if (!canKeepNullNLL) nllNull_.reset(); *paramsAlt_ = nuisances_; *paramsAlt_ = snapAlt_; DBGV(DBG_TestStat_params, (std::cout << "Parameters of alt pdf " << pdfAlt_->GetName())) DBGV(DBG_TestStat_params, (paramsAlt_->Print("V"))) bool canKeepAltNLL = createNLL(*pdfAlt_, data, nllAlt_); double altNLL = minNLL(nllAlt_); if (!canKeepAltNLL) nllAlt_.reset(); DBG(DBG_TestStat_params, (printf("Pln: null = %+8.4f, alt = %+8.4f\n", nullNLL, altNLL))) return nullNLL-altNLL; }
virtual const TString ProfiledLikelihoodRatioTestStatOpt::GetVarName | ( | ) | const [inline, virtual] |
double ProfiledLikelihoodRatioTestStatOpt::minNLL | ( | std::auto_ptr< RooAbsReal > & | nll | ) | [private] |
Definition at line 98 of file ProfiledLikelihoodRatioTestStatExt.cc.
References gather_cfg::cout, data, nuisances_, and verbosity_.
Referenced by Evaluate().
{ #if defined(DBG_TestStat_NOFIT) && (DBG_TestStat_NOFIT > 0) if (verbosity_ > 0) std::cout << "Profiling likelihood for pdf " << pdf.GetName() << std::endl; std::auto_ptr<RooAbsReal> nll_(pdf.createNLL(data, RooFit::Constrain(nuisances_))); return nll_->getVal(); #endif RooMinimizer minim(*nll_); minim.setStrategy(0); minim.setPrintLevel(verbosity_-2); minim.minimize(ROOT::Math::MinimizerOptions::DefaultMinimizerType().c_str(), ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo().c_str()); if (verbosity_ > 1) { std::auto_ptr<RooFitResult> res(minim.save()); res->Print("V"); } return nll_->getVal(); }
void ProfiledLikelihoodRatioTestStatOpt::setPrintLevel | ( | Int_t | level | ) | [inline] |
Definition at line 32 of file ProfiledLikelihoodRatioTestStatExt.h.
References testEve_cfg::level, and verbosity_.
{ verbosity_ = level; }
std::auto_ptr<RooAbsReal> ProfiledLikelihoodRatioTestStatOpt::nllAlt_ [private] |
Definition at line 39 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate().
std::auto_ptr<RooAbsReal> ProfiledLikelihoodRatioTestStatOpt::nllNull_ [private] |
Definition at line 39 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate().
RooArgSet ProfiledLikelihoodRatioTestStatOpt::nuisances_ [private] |
Definition at line 37 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by createNLL(), Evaluate(), minNLL(), and ProfiledLikelihoodRatioTestStatOpt().
std::auto_ptr<RooArgSet> ProfiledLikelihoodRatioTestStatOpt::paramsAlt_ [private] |
Definition at line 38 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate().
std::auto_ptr<RooArgSet> ProfiledLikelihoodRatioTestStatOpt::paramsNull_ [private] |
Definition at line 38 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate().
RooAbsPdf * ProfiledLikelihoodRatioTestStatOpt::pdfAlt_ [private] |
Definition at line 35 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate(), GetVarName(), and ProfiledLikelihoodRatioTestStatOpt().
RooAbsPdf* ProfiledLikelihoodRatioTestStatOpt::pdfNull_ [private] |
Definition at line 35 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate(), GetVarName(), and ProfiledLikelihoodRatioTestStatOpt().
RooArgSet ProfiledLikelihoodRatioTestStatOpt::snapAlt_ [private] |
Definition at line 36 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate(), and ProfiledLikelihoodRatioTestStatOpt().
RooArgSet ProfiledLikelihoodRatioTestStatOpt::snapNull_ [private] |
Definition at line 36 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by Evaluate(), and ProfiledLikelihoodRatioTestStatOpt().
Int_t ProfiledLikelihoodRatioTestStatOpt::verbosity_ [private] |
Definition at line 40 of file ProfiledLikelihoodRatioTestStatExt.h.
Referenced by minNLL(), and setPrintLevel().