From 3becf269c9cf65b6405e4caad503275994eb8f47 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 18 Apr 2024 14:56:33 +0200 Subject: [PATCH] Implement right overload of `createNLL` in RooSimultaneousOpt --- interface/RooSimultaneousOpt.h | 6 +++++- src/RooSimultaneousOpt.cc | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/interface/RooSimultaneousOpt.h b/interface/RooSimultaneousOpt.h index e983224b224..183260018e0 100644 --- a/interface/RooSimultaneousOpt.h +++ b/interface/RooSimultaneousOpt.h @@ -30,7 +30,11 @@ class RooSimultaneousOpt : public RooSimultaneous { ~RooSimultaneousOpt() override ; - virtual RooAbsReal* createNLL(RooAbsData& data, const RooLinkedList& cmdList) ; +#if ROOT_VERSION_CODE < ROOT_VERSION(6,30,0) + RooAbsReal* createNLL(RooAbsData& data, const RooLinkedList& cmdList) override; +#else + std::unique_ptr createNLLImpl(RooAbsData& data, const RooLinkedList& cmdList) override; +#endif const RooArgList & extraConstraints() const { return _extraConstraints; } const RooArgList & channelMasks() const { return _channelMasks; } diff --git a/src/RooSimultaneousOpt.cc b/src/RooSimultaneousOpt.cc index a10c3828a41..f689b4af999 100644 --- a/src/RooSimultaneousOpt.cc +++ b/src/RooSimultaneousOpt.cc @@ -2,15 +2,24 @@ #include "../interface/CachingNLL.h" #include +#if ROOT_VERSION_CODE < ROOT_VERSION(6,30,0) RooAbsReal* RooSimultaneousOpt::createNLL(RooAbsData& data, const RooLinkedList& cmdList) +#else +std::unique_ptr +RooSimultaneousOpt::createNLLImpl(RooAbsData& data, const RooLinkedList& cmdList) +#endif { RooCmdConfig pc(Form("RooSimultaneousOpt::createNLL(%s)",GetName())) ; pc.defineSet("cPars","Constrain",0,0); RooArgSet *cPars = pc.getSet("cPars"); - cacheutils::CachingSimNLL *nll = new cacheutils::CachingSimNLL(this, &data, cPars); + auto nll = std::make_unique(this, &data, cPars); nll->setChannelMasks(this->channelMasks()); +#if ROOT_VERSION_CODE < ROOT_VERSION(6,30,0) + return nll.release(); +#else return nll; +#endif } RooSimultaneousOpt::~RooSimultaneousOpt()