Skip to content

[RF] Convert stressRooStats suite to googletest - #23303

Open
guitargeek wants to merge 2 commits into
root-project:masterfrom
guitargeek:roostats-gtest-conversion
Open

[RF] Convert stressRooStats suite to googletest#23303
guitargeek wants to merge 2 commits into
root-project:masterfrom
guitargeek:roostats-gtest-conversion

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Translate more RooUnitTest tests to gtest.

The overarching motivation for this is the following: the RooUnitTest infrastructure requires the RooFit plotting classes to be serializable to disk for reference results. On the long term I want to avoid this, so we can have a discussion on whether the RooFit plotting primitives should support IO at all.

🤖 Done with the help of AI

Rewrite the RooStats S.T.R.E.S.S. suite in place as a googletest suite,
following the precedent of the stressRooFit conversions. All 48 test
configurations of the original suite are kept, with the same models,
calculator configurations, random seeds and tolerances, and the
RooUnitTest semantics are reproduced (seed 12345 reset per test, failure
on logged RooFit ERROR messages).

Instead of comparing against the references stored in
stressRooStats_ref.root, the references are now self-contained:

  - analytic references are computed inline in the same test (profile
    likelihood intervals on Gaussian/Poisson models, Bayesian central
    intervals via gamma quantiles)
  - published values from the Cousins et al. papers stay hardcoded
  - for the pure regression tests, the frozen values from the last
    stressRooStats_ref.root are hardcoded at full precision

The AsymptoticCalculator test now checks both the live
ProfileLikelihoodCalculator and AsymptoticCalculator significances
against the frozen reference, which is strictly more coverage than the
original comparison against the frozen PLC value only.

The tests are parameterized over the RooFit evaluation backends via the
shared gtest_wrapper.h macros, matching the backend coverage of the
removed per-backend ctest invocations; on cuda builds the gtest entry
takes the GPU resource lock that the dedicated cuda invocation used to
declare, and both ctest entries get an explicit one-hour timeout since
the backends now run serially in one process. The fixtures save and
restore the global default evaluation backend so it does not leak
between tests.

Unlike the original suite, the default minimizer is now Minuit2 instead
of Minuit. Coverage of the old minimizer is kept by a separate ctest
that runs the same binary with STRESSROOSTATS_MINIMIZER=Minuit,
restricted to the legacy and cpu backends like the original
non-default-minimizer invocations.

With the reference file and the RooUnitTest classes gone,
stressRooStats_ref.root and stressRooStats_tests.h are removed
(stressRooStats_models.h is still used). Also dropped: the write mode,
the verbose-mode plotting code, the benchmark scaffolding, the
TestHypoTestCalculator class that was never registered in any suite,
and the test statistic types that were only reachable from it.

🤖 Done with the help of AI
Convert the RooFit::TestStatistics plotting test to a reference-free
gtest, following the precedent of the other stress test conversions. The
model, parallel minimization setup and likelihood plotting are
unchanged, but instead of comparing the RooPlot against the reference in
TestStatistics_ref.root via RooUnitTest::regPlot, the test now checks:

  - the fitted parameter against the analytic maximum likelihood
    estimate (with a tolerance at the scale of the Minuit convergence
    criterion)
  - every point of the plotted curve against a direct evaluation of the
    likelihood at that parameter value
  - the likelihood shape against the analytically known Poisson -log L
    (up to the constant offset)

The TestStatistics_ref.root file had no other users, so it is removed
together with the COPY_TO_BUILDDIR of the ctest registration.

🤖 Done with the help of AI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants