diff --git a/roofit/histfactory/inc/RooStats/HistFactory/RooBarlowBeestonLL.h b/roofit/histfactory/inc/RooStats/HistFactory/RooBarlowBeestonLL.h index 3fac9d657d6fa..04844727891b5 100644 --- a/roofit/histfactory/inc/RooStats/HistFactory/RooBarlowBeestonLL.h +++ b/roofit/histfactory/inc/RooStats/HistFactory/RooBarlowBeestonLL.h @@ -47,7 +47,7 @@ class RooBarlowBeestonLL : public RooAbsReal { }; void initializeBarlowCache(); - bool getParameters(const RooArgSet* depList, RooArgSet& outputSet, bool stripDisconnected=true) const override; + void addParameters(RooAbsCollection & params, const RooArgSet *nset, RooFit::GetParametersPolicy const &policy) const override; RooAbsReal& nll() { return const_cast(_nll.arg()) ; } void setPdf(RooAbsPdf* pdf) { _pdf = pdf; } void setDataset(RooAbsData* data) { _data = data; } diff --git a/roofit/histfactory/src/RooBarlowBeestonLL.cxx b/roofit/histfactory/src/RooBarlowBeestonLL.cxx index 94251d16ef722..b7192f6e8f4eb 100644 --- a/roofit/histfactory/src/RooBarlowBeestonLL.cxx +++ b/roofit/histfactory/src/RooBarlowBeestonLL.cxx @@ -298,15 +298,15 @@ void RooStats::HistFactory::RooBarlowBeestonLL::initializeBarlowCache() { //////////////////////////////////////////////////////////////////////////////// -bool RooStats::HistFactory::RooBarlowBeestonLL::getParameters(const RooArgSet* depList, - RooArgSet& outputSet, - bool stripDisconnected) const { - bool errorInBaseCall = RooAbsArg::getParameters( depList, outputSet, stripDisconnected ); +void RooStats::HistFactory::RooBarlowBeestonLL::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const +{ + RooAbsArg::addParameters(params, nset, policy); RooArgSet toRemove; toRemove.reserve( _statUncertParams.size()); - for (auto const& arg : outputSet) { + for (auto const& arg : params) { // If there is a gamma in the name, // strip it from the list of dependencies @@ -316,10 +316,7 @@ bool RooStats::HistFactory::RooBarlowBeestonLL::getParameters(const RooArgSet* d } } - for( auto& arg : toRemove) outputSet.remove( *arg, true ); - - return errorInBaseCall || false; - + for( auto& arg : toRemove) params.remove( *arg, true ); } diff --git a/roofit/roofitcore/inc/RooAbsArg.h b/roofit/roofitcore/inc/RooAbsArg.h index b53f27a8185b6..0b03bd348d7f7 100644 --- a/roofit/roofitcore/inc/RooAbsArg.h +++ b/roofit/roofitcore/inc/RooAbsArg.h @@ -55,6 +55,11 @@ namespace RooFit { namespace Experimental { class CodegenContext; } + +struct GetParametersPolicy { + bool stripDisconnected = false; +}; + } // namespace RooFit class RooRefArray : public TObjArray { @@ -208,12 +213,27 @@ class RooAbsArg : public TNamed, public RooPrintable { /////////////////////////////////////////////////////////////////////////////// // Parameter & observable interpretation of servers - RooFit::OwningPtr getVariables(bool stripDisconnected = true) const; - RooFit::OwningPtr getParameters(const RooAbsData *data, bool stripDisconnected = true) const; - RooFit::OwningPtr getParameters(const RooAbsData &data, bool stripDisconnected = true) const; - RooFit::OwningPtr getParameters(const RooArgSet &observables, bool stripDisconnected = true) const; - RooFit::OwningPtr getParameters(const RooArgSet *observables, bool stripDisconnected = true) const; - virtual bool getParameters(const RooArgSet *observables, RooArgSet &outputSet, bool stripDisconnected = true) const; + RooFit::OwningPtr getVariables() const; + + auto getParameters(const RooArgSet &ref, RooFit::GetParametersPolicy const &policy = {}) const + { + return getParameters(&ref, policy); + } + auto getParameters(const RooAbsData &ref, RooFit::GetParametersPolicy const &policy = {}) const + { + return getParameters(&ref, policy); + } + auto getParameters(std::nullptr_t, RooFit::GetParametersPolicy const &policy = {}) const + { + return getParameters(static_cast(nullptr), policy); + } + RooFit::OwningPtr + getParameters(const RooAbsData *data, RooFit::GetParametersPolicy const &policy = {}) const; + RooFit::OwningPtr + getParameters(const RooArgSet *observables, RooFit::GetParametersPolicy const &policy = {}) const; + bool getParameters(const RooArgSet *observables, RooArgSet &outputSet, + RooFit::GetParametersPolicy const &policy = {}) const; + RooFit::OwningPtr getObservables(const RooArgSet &set, bool valueOnly = true) const; RooFit::OwningPtr getObservables(const RooAbsData *data) const; RooFit::OwningPtr getObservables(const RooAbsData &data) const; @@ -225,6 +245,9 @@ class RooAbsArg : public TNamed, public RooPrintable { bool recursiveCheckObservables(const RooArgSet *nset) const; RooFit::OwningPtr getComponents() const; + virtual void + addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, RooFit::GetParametersPolicy const &policy) const; + void attachArgs(const RooAbsCollection &set); void attachDataSet(const RooAbsData &set); void attachDataStore(const RooAbsDataStore &set); @@ -509,9 +532,6 @@ class RooAbsArg : public TNamed, public RooPrintable { virtual bool isValid() const; - virtual void - getParametersHook(const RooArgSet * /*nset*/, RooArgSet * /*list*/, bool /*stripDisconnected*/) const {}; - void clearValueAndShapeDirty() const { _valueDirty = false; @@ -530,8 +550,6 @@ class RooAbsArg : public TNamed, public RooPrintable { static void ioStreamerPass2Finalize(); private: - void addParameters(RooAbsCollection ¶ms, const RooArgSet *nset = nullptr, bool stripDisconnected = true) const; - RefCountListLegacyIterator_t *makeLegacyIterator(const RefCountList_t &list) const; protected: diff --git a/roofit/roofitcore/inc/RooEvaluatorWrapper.h b/roofit/roofitcore/inc/RooEvaluatorWrapper.h index cd0ec26b7c769..665a8fc56b313 100644 --- a/roofit/roofitcore/inc/RooEvaluatorWrapper.h +++ b/roofit/roofitcore/inc/RooEvaluatorWrapper.h @@ -46,14 +46,15 @@ class RooEvaluatorWrapper final : public RooAbsReal { double defaultErrorLevel() const override { return _topNode->defaultErrorLevel(); } - bool getParameters(const RooArgSet *observables, RooArgSet &outputSet, bool stripDisconnected = true) const override; - bool setData(RooAbsData &data, bool cloneData) override; double getValV(const RooArgSet *) const override { return evaluate(); } void applyWeightSquared(bool flag) override { _topNode->applyWeightSquared(flag); } + void addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const override; + bool hasGradient() const override; bool hasHessian() const override; diff --git a/roofit/roofitcore/inc/RooMultiPdf.h b/roofit/roofitcore/inc/RooMultiPdf.h index ebad07f7daa26..48c2d448ec3b9 100644 --- a/roofit/roofitcore/inc/RooMultiPdf.h +++ b/roofit/roofitcore/inc/RooMultiPdf.h @@ -32,7 +32,8 @@ class RooMultiPdf : public RooAbsPdf { // Always normalized because each pdf is normalized bool selfNormalized() const override { return true; } - void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override; + void addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const override; protected: RooListProxy c; diff --git a/roofit/roofitcore/inc/RooMultiReal.h b/roofit/roofitcore/inc/RooMultiReal.h index 4185489216127..c4e748b50a937 100644 --- a/roofit/roofitcore/inc/RooMultiReal.h +++ b/roofit/roofitcore/inc/RooMultiReal.h @@ -21,7 +21,8 @@ class RooMultiReal : public RooAbsReal { inline const RooCategoryProxy &indexCategory() const { return _index; } inline const RooListProxy &getModelList() const { return _models; } - void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override; + void addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const override; protected: RooListProxy _models; // list of RooAbsReal models diff --git a/roofit/roofitcore/src/ConstraintHelpers.cxx b/roofit/roofitcore/src/ConstraintHelpers.cxx index 758025af951e9..da2c5d4603bcc 100644 --- a/roofit/roofitcore/src/ConstraintHelpers.cxx +++ b/roofit/roofitcore/src/ConstraintHelpers.cxx @@ -111,7 +111,7 @@ std::unique_ptr createConstraintTerm(std::string const &name, RooAbs if (constrainedParameters) { cPars.add(*constrainedParameters); } else { - pdf.getParameters(&observables, cPars, false); + pdf.getParameters(&observables, cPars); doStripDisconnected = true; } diff --git a/roofit/roofitcore/src/RooAbsArg.cxx b/roofit/roofitcore/src/RooAbsArg.cxx index 4f790ee178d7f..8a8d4b0d6f4de 100644 --- a/roofit/roofitcore/src/RooAbsArg.cxx +++ b/roofit/roofitcore/src/RooAbsArg.cxx @@ -505,21 +505,10 @@ void RooAbsArg::treeNodeServerList(RooAbsCollection *list, const RooAbsArg *arg, /// function is responsible for deleting the returned argset. /// The complement of this function is getObservables() -RooFit::OwningPtr RooAbsArg::getParameters(const RooAbsData *set, bool stripDisconnected) const +RooFit::OwningPtr +RooAbsArg::getParameters(const RooAbsData *set, RooFit::GetParametersPolicy const &policy) const { - return getParameters(set ? set->get() : nullptr, stripDisconnected); -} - -/// Return the parameters of this p.d.f when used in conjunction with dataset 'data'. -RooFit::OwningPtr RooAbsArg::getParameters(const RooAbsData &data, bool stripDisconnected) const -{ - return getParameters(&data, stripDisconnected); -} - -/// Return the parameters of the p.d.f given the provided set of observables. -RooFit::OwningPtr RooAbsArg::getParameters(const RooArgSet &observables, bool stripDisconnected) const -{ - return getParameters(&observables, stripDisconnected); + return getParameters(set ? set->get() : nullptr, policy); } /// Create a list of leaf nodes in the arg tree starting with @@ -528,19 +517,21 @@ RooFit::OwningPtr RooAbsArg::getParameters(const RooArgSet &observabl /// for deleting the returned argset. The complement of this function /// is getObservables(). -RooFit::OwningPtr RooAbsArg::getParameters(const RooArgSet *observables, bool stripDisconnected) const +RooFit::OwningPtr +RooAbsArg::getParameters(const RooArgSet *observables, RooFit::GetParametersPolicy const &policy) const { auto *outputSet = new RooArgSet; - getParameters(observables, *outputSet, stripDisconnected); + getParameters(observables, *outputSet, policy); return RooFit::OwningPtr{outputSet}; } /// Add all parameters of the function and its daughters to `params`. /// \param[in] params Collection that stores all parameters. Add all new parameters to this. /// \param[in] nset Normalisation set (optional). If a value depends on this set, it's not a parameter. -/// \param[in] stripDisconnected Passed on to getParametersHook(). +/// \param[in] stripDisconnected TODO. -void RooAbsArg::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, bool stripDisconnected) const +void RooAbsArg::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const { RooArgSet nodeParamServers; @@ -561,12 +552,9 @@ void RooAbsArg::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, b std::sort(branchList.begin(), branchList.end()); const auto last = std::unique(branchList.begin(), branchList.end()); for (auto serverIt = branchList.begin(); serverIt < last; ++serverIt) { - (*serverIt)->addParameters(nodeParamServers, nset, stripDisconnected); + (*serverIt)->addParameters(nodeParamServers, nset, policy); } - // Allow pdf to strip parameters from list - getParametersHook(nset, &nodeParamServers, stripDisconnected); - // Add parameters of this node to the combined list params.add(nodeParamServers, true); } @@ -579,12 +567,13 @@ void RooAbsArg::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, b /// \param[out] outputSet Output set. /// \param[in] stripDisconnected Allow pdf to strip parameters from list before adding it. -bool RooAbsArg::getParameters(const RooArgSet *observables, RooArgSet &outputSet, bool stripDisconnected) const +bool RooAbsArg::getParameters(const RooArgSet *observables, RooArgSet &outputSet, + RooFit::GetParametersPolicy const &policy) const { outputSet.clear(); outputSet.setName("parameters"); - addParameters(outputSet, observables, stripDisconnected); + addParameters(outputSet, observables, policy); outputSet.sort(); @@ -1812,9 +1801,9 @@ RooAbsCache *RooAbsArg::getCache(Int_t index) const /// Return RooArgSet with all variables (tree leaf nodes of expression tree) -RooFit::OwningPtr RooAbsArg::getVariables(bool stripDisconnected) const +RooFit::OwningPtr RooAbsArg::getVariables() const { - return getParameters(RooArgSet(), stripDisconnected); + return getParameters(RooArgSet()); } /// Create a GraphViz .dot file visualizing the expression tree headed by diff --git a/roofit/roofitcore/src/RooAbsData.cxx b/roofit/roofitcore/src/RooAbsData.cxx index 13b7320efbfaf..4ede3ab90f561 100644 --- a/roofit/roofitcore/src/RooAbsData.cxx +++ b/roofit/roofitcore/src/RooAbsData.cxx @@ -1422,12 +1422,13 @@ SplittingSetup initSplit(RooAbsData const &data, RooAbsCategory const &splitCat) // Construct set of variables to be included in split sets = full set - split category setup.subsetVars.add(*data.get()); + RooArgSet vars; if (splitCat.isDerived()) { - std::unique_ptr vars{splitCat.getVariables()}; - setup.subsetVars.remove(*vars, true, true); + splitCat.getParameters(nullptr, vars); } else { - setup.subsetVars.remove(splitCat, true, true); + vars.add(splitCat); } + setup.subsetVars.remove(vars, true, true); // Add weight variable explicitly if dataset has weights, but no top-level weight // variable exists (can happen with composite datastores) diff --git a/roofit/roofitcore/src/RooAbsReal.cxx b/roofit/roofitcore/src/RooAbsReal.cxx index ad4f7fde38ddb..e9d6358799a07 100644 --- a/roofit/roofitcore/src/RooAbsReal.cxx +++ b/roofit/roofitcore/src/RooAbsReal.cxx @@ -662,9 +662,10 @@ RooFit::OwningPtr RooAbsReal::createIntObj(const RooArgSet& iset2, c const char* cacheParamsStr = getStringAttribute("CACHEPARAMINT") ; if (cacheParamsStr && strlen(cacheParamsStr)) { - std::unique_ptr intParams{integral->getVariables()}; + RooArgSet intParams; + integral->getParameters(nullptr, intParams); - RooArgSet cacheParams = RooHelpers::selectFromArgSet(*intParams, cacheParamsStr); + RooArgSet cacheParams = RooHelpers::selectFromArgSet(intParams, cacheParamsStr); if (!cacheParams.empty()) { cxcoutD(Caching) << "RooAbsReal::createIntObj(" << GetName() << ") INFO: constructing " << cacheParams.size() @@ -1176,7 +1177,8 @@ RooDataHist* RooAbsReal::fillDataHist(RooDataHist *hist, const RooArgSet* normSe TH1* RooAbsReal::createHistogram(RooStringView varNameList, Int_t xbins, Int_t ybins, Int_t zbins) const { - std::unique_ptr vars{getVariables()}; + RooArgSet vars; + getParameters(nullptr, vars); auto varNames = ROOT::Split(varNameList, ",:"); std::vector histVars(3, nullptr); @@ -1189,10 +1191,10 @@ TH1* RooAbsReal::createHistogram(RooStringView varNameList, Int_t xbins, Int_t y coutE(Plotting) << errMsg.str() << std::endl; throw std::invalid_argument(errMsg.str()); } - auto var = static_cast(vars->find(varNames[iVar].c_str())); + auto var = static_cast(vars.find(varNames[iVar].c_str())); if(!var) { std::stringstream errMsg; - errMsg << "RooAbsPdf::createHistogram(" << GetName() << ") ERROR variable " << varNames[iVar] << " does not exist in argset: " << *vars; + errMsg << "RooAbsPdf::createHistogram(" << GetName() << ") ERROR variable " << varNames[iVar] << " does not exist in argset: " << vars; coutE(Plotting) << errMsg.str() << std::endl; throw std::runtime_error(errMsg.str()); } diff --git a/roofit/roofitcore/src/RooEvaluatorWrapper.cxx b/roofit/roofitcore/src/RooEvaluatorWrapper.cxx index c7446f9985270..ecd2d7438caa6 100644 --- a/roofit/roofitcore/src/RooEvaluatorWrapper.cxx +++ b/roofit/roofitcore/src/RooEvaluatorWrapper.cxx @@ -160,21 +160,21 @@ RooEvaluatorWrapper::RooEvaluatorWrapper(const RooEvaluatorWrapper &other, const RooEvaluatorWrapper::~RooEvaluatorWrapper() = default; -bool RooEvaluatorWrapper::getParameters(const RooArgSet *observables, RooArgSet &outputSet, - bool stripDisconnected) const +void RooEvaluatorWrapper::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const { - outputSet.add(_evaluator->getParameters()); - if (observables) { - outputSet.remove(*observables, /*silent*/ false, /*matchByNameOnly*/ true); + params.add(_evaluator->getParameters()); + if (nset) { + params.remove(*nset, /*silent*/ false, /*matchByNameOnly*/ true); } // Exclude the data variables from the parameters which are not global observables for (auto const &item : _dataSpans) { if (_data->getGlobalObservables() && _data->getGlobalObservables()->find(item.first->GetName())) { continue; } - RooAbsArg *found = outputSet.find(item.first->GetName()); + RooAbsArg *found = params.find(item.first->GetName()); if (found) { - outputSet.remove(*found); + params.remove(*found); } } // If we take the global observables as data, we have to return these as @@ -182,26 +182,26 @@ bool RooEvaluatorWrapper::getParameters(const RooArgSet *observables, RooArgSet // constant parameters in the fit result that are global observables will // not have the right values. if (_takeGlobalObservablesFromData && _data->getGlobalObservables()) { - outputSet.replace(*_data->getGlobalObservables()); + params.replace(*_data->getGlobalObservables()); } // The disconnected parameters are stripped away in // RooAbsArg::getParametersHook(), that is only called in the original // RooAbsArg::getParameters() implementation. So he have to call it to // identify disconnected parameters to remove. - if (stripDisconnected) { + if (policy.stripDisconnected) { RooArgSet paramsStripped; - _topNode->getParameters(observables, paramsStripped, true); + RooFit::GetParametersPolicy policy; + policy.stripDisconnected = true; + _topNode->getParameters(nset, paramsStripped, policy); RooArgSet toRemove; - for (RooAbsArg *param : outputSet) { + for (RooAbsArg *param : params) { if (!paramsStripped.find(param->GetName())) { toRemove.add(*param); } } - outputSet.remove(toRemove, /*silent*/ false, /*matchByNameOnly*/ true); + params.remove(toRemove, /*silent*/ false, /*matchByNameOnly*/ true); } - - return false; } /// @brief A wrapper class to store a C++ function of type 'double (*)(double*, double*)'. @@ -779,7 +779,7 @@ void RooEvaluatorWrapper::createFuncWrapper() { // Get the parameters. RooArgSet paramSet; - this->getParameters(_data ? _data->get() : nullptr, paramSet, /*sripDisconnectedParams=*/false); + this->getParameters(_data ? _data->get() : nullptr, paramSet); const bool isChi2 = _topNode->getAttribute("Chi2EvaluationActive"); const bool skipZeroWeights = !isChi2 && (!_pdf || !_pdf->getAttribute("BinnedLikelihoodActive")); diff --git a/roofit/roofitcore/src/RooMinimizerFcn.cxx b/roofit/roofitcore/src/RooMinimizerFcn.cxx index 6a3235950f2b3..0f63bf5e6c340 100644 --- a/roofit/roofitcore/src/RooMinimizerFcn.cxx +++ b/roofit/roofitcore/src/RooMinimizerFcn.cxx @@ -75,7 +75,7 @@ bool intersect(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) RooArgSet getAllParameters(RooAbsReal const &funct) { RooArgSet out; - funct.getParameters(nullptr, out, /*stripDisconnected*/ false); + funct.getParameters(nullptr, out); return out; } @@ -245,13 +245,18 @@ RooArgSet RooMinimizerFcn::freezeDisconnectedParameters() const RooArgSet paramsDisconnected; RooArgSet paramsConnected; - _funct->getParameters(nullptr, paramsDisconnected, /*stripDisconnected*/ false); - _funct->getParameters(nullptr, paramsConnected, /*stripDisconnected*/ true); + RooFit::GetParametersPolicy policy; + policy.stripDisconnected = false; + _funct->getParameters(nullptr, paramsDisconnected, policy); + policy.stripDisconnected = true; + _funct->getParameters(nullptr, paramsConnected, policy); paramsDisconnected.remove(paramsConnected, true, true); RooArgSet changedSet; + paramsDisconnected.Print(); + for (RooAbsArg *a : paramsDisconnected) { auto *v = dynamic_cast(a); auto *cv = dynamic_cast(a); diff --git a/roofit/roofitcore/src/RooMultiPdf.cxx b/roofit/roofitcore/src/RooMultiPdf.cxx index f0eaf06639fea..d7c72cb8d8e54 100644 --- a/roofit/roofitcore/src/RooMultiPdf.cxx +++ b/roofit/roofitcore/src/RooMultiPdf.cxx @@ -79,12 +79,13 @@ Double_t RooMultiPdf::getLogVal(const RooArgSet *nset) const return logval; } -void RooMultiPdf::getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const +void RooMultiPdf::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const { - if (!stripDisconnected) - return; - - list->removeAll(); - getCurrentPdf()->getParameters(nset, *list, stripDisconnected); - list->add(*x); + if (policy.stripDisconnected) { + getCurrentPdf()->addParameters(params, nset, policy); + params.add(*x, /*silent=*/true); + } else { + RooAbsArg::addParameters(params, nset, policy); + } } diff --git a/roofit/roofitcore/src/RooMultiReal.cxx b/roofit/roofitcore/src/RooMultiReal.cxx index 61b50cf594da5..d5e2f6c0d314b 100644 --- a/roofit/roofitcore/src/RooMultiReal.cxx +++ b/roofit/roofitcore/src/RooMultiReal.cxx @@ -41,22 +41,23 @@ Double_t RooMultiReal::evaluate() const } // Propagate parameter fetching to the current model -void RooMultiReal::getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const +void RooMultiReal::addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const { - if (!stripDisconnected) + if (!policy.stripDisconnected) { + RooAbsArg::addParameters(params, nset, policy); return; - - list->removeAll(); + } RooAbsReal *absReal = static_cast(_models.at(static_cast(_index))); if (absReal->isFundamental()) { if (!nset || !absReal->dependsOn(*nset)) { - list->add(*absReal); + params.add(*absReal, /*silent=*/true); } return; } - absReal->getParameters(nset, *list, stripDisconnected); - list->add(*_index); + absReal->addParameters(params, nset, policy); + params.add(*_index, /*silent=*/true); } \ No newline at end of file diff --git a/roofit/roofitcore/src/TestStatistics/buildLikelihood.cxx b/roofit/roofitcore/src/TestStatistics/buildLikelihood.cxx index bac8a76ab0bb3..b93ca42d2baf8 100644 --- a/roofit/roofitcore/src/TestStatistics/buildLikelihood.cxx +++ b/roofit/roofitcore/src/TestStatistics/buildLikelihood.cxx @@ -75,7 +75,7 @@ RooArgSet getConstraintsSet(RooAbsPdf *pdf, RooAbsData *data, RooArgSet constrai std::size_t N_default_constraints = 0; #endif if (constrained_parameters.empty()) { - std::unique_ptr default_constraints{pdf->getParameters(*data, false)}; + std::unique_ptr default_constraints{pdf->getParameters(*data)}; constrained_parameters.add(*default_constraints); doStripDisconnected = true; #ifndef NDEBUG diff --git a/roofit/roofitcore/test/testRooMulti.cxx b/roofit/roofitcore/test/testRooMulti.cxx index 271b0785a64fd..95793219c29cc 100644 --- a/roofit/roofitcore/test/testRooMulti.cxx +++ b/roofit/roofitcore/test/testRooMulti.cxx @@ -303,15 +303,15 @@ TEST(RooMultiReal, EvaluateAndParameterAccess_Hook) // Prepare the observables RooArgSet observables(x); - // Prepare an empty parameter list for getParametersHook to fill + // Prepare an empty parameter list for addParameters() to fill RooArgSet params; indx.setIndex(0); - multiReal.getParameters(&observables, params, true); + multiReal.getParameters(&observables, params, {/*stripDisconnected=*/true}); EXPECT_TRUE(params.find("model1") != nullptr); EXPECT_TRUE(params.find("model2") == nullptr); indx.setIndex(1); - multiReal.getParameters(&observables, params, true); + multiReal.getParameters(&observables, params, {/*stripDisconnected=*/true}); EXPECT_TRUE(params.find("model1") == nullptr); EXPECT_TRUE(params.find("model2") != nullptr); } @@ -342,7 +342,7 @@ TEST(RooMultiPdf, StripDisconnectedParameterTest) // --- Case 1: stripDisconnected = true --- cat.setIndex(0); - multiPdf.getParameters(&observables, params, true); + multiPdf.getParameters(&observables, params, {/*stripDisconnected=*/true}); EXPECT_TRUE(params.find("mean1") != nullptr); EXPECT_TRUE(params.find("sigma1") != nullptr); @@ -353,7 +353,7 @@ TEST(RooMultiPdf, StripDisconnectedParameterTest) // --- Case 2: stripDisconnected = false --- params.removeAll(); cat.setIndex(0); - multiPdf.getParameters(&observables, params, false); + multiPdf.getParameters(&observables, params, {/*stripDisconnected=*/false}); // Now both models' parameters should be present EXPECT_TRUE(params.find("mean1") != nullptr); diff --git a/roofit/xroofit/src/xRooFit.cxx b/roofit/xroofit/src/xRooFit.cxx index ddde2f9beb4af..7f5bb0341a686 100644 --- a/roofit/xroofit/src/xRooFit.cxx +++ b/roofit/xroofit/src/xRooFit.cxx @@ -608,9 +608,10 @@ class ProgressMonitor : public RooAbsReal { // required forwarding methods for RooEvaluatorWrapper in 6.32 onwards double defaultErrorLevel() const override { return fFunc->defaultErrorLevel(); } - bool getParameters(const RooArgSet *observables, RooArgSet &outputSet, bool stripDisconnected) const override + void addParameters(RooAbsCollection ¶ms, const RooArgSet *nset, + RooFit::GetParametersPolicy const &policy) const override { - return fFunc->getParameters(observables, outputSet, stripDisconnected); + fFunc->addParameters(params, nset, policy); } bool setData(RooAbsData &data, bool cloneData) override { return fFunc->setData(data, cloneData); } double getValV(const RooArgSet *) const override { return evaluate(); }