From a6034f297810c97731ae37504a5551f65ea92daa Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Fri, 18 Oct 2024 23:23:06 +0200 Subject: [PATCH] Fix compilation of `benchHistFactory` The interface to store and retrieve the minimization path was removed. It was not necessary anymore, because by now all backends that are benchmarked behave the same and therefore the minimizer follows the same minimization path. --- root/roofit/histfactory/benchHistFactory.cxx | 37 ++++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/root/roofit/histfactory/benchHistFactory.cxx b/root/roofit/histfactory/benchHistFactory.cxx index bf658a62..a9eae01d 100644 --- a/root/roofit/histfactory/benchHistFactory.cxx +++ b/root/roofit/histfactory/benchHistFactory.cxx @@ -31,28 +31,10 @@ class TestData { constraintParams.add(*mc->GetParametersOfInterest()); if (mc->GetNuisanceParameters()) constraintParams.add(*mc->GetNuisanceParameters()); - - auto *pdf = ws->pdf("simPdf"); - - std::unique_ptr nll{pdf->createNLL(*ws->data("obsData"), Constrain(constraintParams), - GlobalObservables(*mc->GetGlobalObservables()), EvalBackend::Legacy())}; - - RooMinimizer m(*nll); - m.setPrintLevel(-1); - m.setStrategy(0); - m.setLoggingToDataSet(true); - - m.minimize("Minuit2"); - - minimizationPath = std::make_unique(*m.getLogDataSet()); } std::unique_ptr ws; - // Dataset with the floating parameters as columns, and each call to getVal - // in the minimization path as rows. - std::unique_ptr minimizationPath; - // The constraint parameters in the model. RooArgSet constraintParams; }; @@ -77,22 +59,23 @@ static void benchHistFactory001(benchmark::State &state) GlobalObservables(*mc->GetGlobalObservables()), EvalBackend(evalBackend))}; - auto &minimizationPath = *g_testData.minimizationPath; - - RooArgSet parameters{}; + RooArgSet parameters; + RooArgSet initialParams; nll->getParameters(nullptr, parameters); + parameters.snapshot(initialParams); // The minimization path depends on the configuration in unpredictable ways. // That's why we don't use the RooMinimizer each time, but only "emulate" a // fit by taking a reference minimization path. for (auto _ : state) { - for (auto i = 0; i < minimizationPath.numEntries(); ++i) { - state.PauseTiming(); - parameters.assign(*minimizationPath.get(i)); - state.ResumeTiming(); - nll->getVal(); - } + state.PauseTiming(); + parameters.assign(initialParams); + RooMinimizer m(*nll); + m.setPrintLevel(-1); + m.setStrategy(0); + state.ResumeTiming(); + m.minimize("Minuit2"); } }