diff --git a/interface/Combine.h b/interface/Combine.h index 5aea6a5e41a..0bf0a07d902 100644 --- a/interface/Combine.h +++ b/interface/Combine.h @@ -32,6 +32,7 @@ extern bool bypassFrequentistFit_; extern std::string setPhysicsModelParameterExpression_; extern std::string setPhysicsModelParameterRangeExpression_; extern std::string defineBackgroundOnlyModelParameterExpression_; +extern std::string nllBackend_; namespace { struct ToCleanUp { diff --git a/src/Combine.cc b/src/Combine.cc index 4cf64dd0974..5f083c22c49 100644 --- a/src/Combine.cc +++ b/src/Combine.cc @@ -91,6 +91,7 @@ TTree *Combine::tree_ = 0; std::string setPhysicsModelParameterExpression_ = ""; std::string setPhysicsModelParameterRangeExpression_ = ""; std::string defineBackgroundOnlyModelParameterExpression_ = ""; +std::string nllBackend_ = "combine"; std::string Combine::trackParametersNameString_=""; std::string Combine::trackErrorsNameString_=""; diff --git a/src/RooSimultaneousOpt.cc b/src/RooSimultaneousOpt.cc index f689b4af999..de51640ca81 100644 --- a/src/RooSimultaneousOpt.cc +++ b/src/RooSimultaneousOpt.cc @@ -2,6 +2,8 @@ #include "../interface/CachingNLL.h" #include +extern std::string nllBackend_; + #if ROOT_VERSION_CODE < ROOT_VERSION(6,30,0) RooAbsReal* RooSimultaneousOpt::createNLL(RooAbsData& data, const RooLinkedList& cmdList) @@ -10,6 +12,16 @@ std::unique_ptr RooSimultaneousOpt::createNLLImpl(RooAbsData& data, const RooLinkedList& cmdList) #endif { + if (nllBackend_ != "combine") { + RooLinkedList cmdListCopy{cmdList}; + // Set the RooFit::EvalBackend() of RooFit to what the nllBackend_ in + // combine is set. +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,30,0) + RooCmdArg evalBackendArg{RooFit::EvalBackend(nllBackend_)}; + cmdListCopy.Add(&evalBackendArg); +#endif + return RooSimultaneous::createNLLImpl(data, cmdListCopy); + } RooCmdConfig pc(Form("RooSimultaneousOpt::createNLL(%s)",GetName())) ; pc.defineSet("cPars","Constrain",0,0); RooArgSet *cPars = pc.getSet("cPars");