Skip to content

Commit a6034f2

Browse files
committed
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.
1 parent 9a52714 commit a6034f2

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

root/roofit/histfactory/benchHistFactory.cxx

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,10 @@ class TestData {
3131
constraintParams.add(*mc->GetParametersOfInterest());
3232
if (mc->GetNuisanceParameters())
3333
constraintParams.add(*mc->GetNuisanceParameters());
34-
35-
auto *pdf = ws->pdf("simPdf");
36-
37-
std::unique_ptr<RooAbsReal> nll{pdf->createNLL(*ws->data("obsData"), Constrain(constraintParams),
38-
GlobalObservables(*mc->GetGlobalObservables()), EvalBackend::Legacy())};
39-
40-
RooMinimizer m(*nll);
41-
m.setPrintLevel(-1);
42-
m.setStrategy(0);
43-
m.setLoggingToDataSet(true);
44-
45-
m.minimize("Minuit2");
46-
47-
minimizationPath = std::make_unique<RooDataSet>(*m.getLogDataSet());
4834
}
4935

5036
std::unique_ptr<RooWorkspace> ws;
5137

52-
// Dataset with the floating parameters as columns, and each call to getVal
53-
// in the minimization path as rows.
54-
std::unique_ptr<RooDataSet> minimizationPath;
55-
5638
// The constraint parameters in the model.
5739
RooArgSet constraintParams;
5840
};
@@ -77,22 +59,23 @@ static void benchHistFactory001(benchmark::State &state)
7759
GlobalObservables(*mc->GetGlobalObservables()),
7860
EvalBackend(evalBackend))};
7961

80-
auto &minimizationPath = *g_testData.minimizationPath;
81-
82-
RooArgSet parameters{};
62+
RooArgSet parameters;
63+
RooArgSet initialParams;
8364
nll->getParameters(nullptr, parameters);
65+
parameters.snapshot(initialParams);
8466

8567
// The minimization path depends on the configuration in unpredictable ways.
8668
// That's why we don't use the RooMinimizer each time, but only "emulate" a
8769
// fit by taking a reference minimization path.
8870

8971
for (auto _ : state) {
90-
for (auto i = 0; i < minimizationPath.numEntries(); ++i) {
91-
state.PauseTiming();
92-
parameters.assign(*minimizationPath.get(i));
93-
state.ResumeTiming();
94-
nll->getVal();
95-
}
72+
state.PauseTiming();
73+
parameters.assign(initialParams);
74+
RooMinimizer m(*nll);
75+
m.setPrintLevel(-1);
76+
m.setStrategy(0);
77+
state.ResumeTiming();
78+
m.minimize("Minuit2");
9679
}
9780
}
9881

0 commit comments

Comments
 (0)