Skip to content

[RF] Rewrite rf709 with HistFactory classes and deprecate RooParamHistFunc and RooHistConstraint - #13199

Merged
guitargeek merged 5 commits into
root-project:masterfrom
guitargeek:rf_bb
Nov 6, 2026
Merged

guitargeek merged 5 commits into
root-project:masterfrom
guitargeek:rf_bb

Conversation

@guitargeek

@guitargeek guitargeek commented Jul 6, 2023 •

Copy link
Copy Markdown
Contributor

This Pull request:

Rewrites the rf709 Barlow-Beeston tutorial with the same building blocks that HistFactory uses, and deprecates RooParamHistFunc and RooHistConstraint for removal in ROOT 6.46.

Changes or fixes:

RooParamHistFunc and RooHistConstraint duplicate what the HistFactory classes already provide for the Barlow-Beeston method. Over the last years, this has repeatedly caused confusion about which classes to use and how they differ. After this PR there is one recommended approach: ParamHistFunc scaling a RooHistFunc, with one RooPoisson constraint per bin, like in the models that HistFactory builds.

  • rf709_BarlowBeeston (C++ and Python) now builds its models this way, so it also serves as an introduction to how HistFactory models work. As in HistFactory, the gammas of empty template bins are fixed and not constrained. Otherwise they would be flat directions of the likelihood, which breaks HESSE.
  • The likelihood is the same as before: the old and new NLLs agree to about 1e-12 at random parameter points. The printed results therefore change only within the fit tolerance, for example Barlow-Beeston Asig = 0.8503 ± 0.2358 before and 0.8506 ± 0.2358 after. The new version also stops printing "Minimized function has error status". That message came from RooHistConstraint, which returns the product of all per-bin Poisson terms. The product underflows to zero away from the minimum, because the default CPU backend takes the log of that value instead of calling getLogVal().
  • Deprecation: both classes get R__DEPRECATED(6, 46, ...) messages that point to the HistFactory alternative and to the tutorial. Their docs get \deprecated notes, and there is a release note. The attribute is deliberately not guarded by ROOFIT_BUILDS_ITSELF. That definition is exported with ROOT::RooFitCore and is also used when building the RooFit module, so a guarded deprecation would never warn CMake or interpreter users. Instead, the warnings are silenced locally where RooFit itself still uses the classes: RooHistConstraint, RooLagrangianMorphFunc, codegen, and the unit test.
  • The release note acknowledges that these classes may be stored in RooWorkspaces written to disk, and asks affected users to reach out via a GitHub issue or the ROOT forum. Until the removal, such workspaces can still be read and fitted without warnings.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

Tested locally:

  • the rf709 tutorials (C++ interpreted and with ACLiC, and Python), plus the rf711 and rf712 tutorials;
  • testRooFit and testCodegen;
  • a full clang build, with no warnings;
  • GCC syntax checks of every file that uses the deprecated classes.

Assisted-by: claude-code:claude-opus-5-5. Claude Code compared the old and new tutorials and drafted the follow-up commits: the empty-bin fix, the Python version, the replacement of rf709, and the deprecation.

Closes #24003

@guitargeek guitargeek self-assigned this Jul 6, 2023
@github-actions

github-actions Bot commented Jul 7, 2023 •

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 7h 51m 47s ⏱️
 3 885 tests  3 883 ✅ 0 💤 2 ❌
72 220 runs  72 218 ✅ 0 💤 2 ❌

For more details on these failures, see this check.

Results for commit 1a7e64f.

♻️ This comment has been updated with latest results.

@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@root-project root-project deleted a comment from phsft-bot Jan 7, 2026
@guitargeek guitargeek closed this Sep 29, 2026
@guitargeek
guitargeek deleted the rf_bb branch September 29, 2026 07:53
@guitargeek
guitargeek restored the rf_bb branch November 5, 2026 14:30
@guitargeek guitargeek reopened this Nov 5, 2026
Gammas of empty template bins were floating and unconstrained, i.e. flat
directions of the likelihood, so HESSE failed for the Barlow-Beeston
case. Fix them like HistFactory does.

Also move the tutorial to tutorials/roofit/roofit with the matching
\ingroup and index entry, add the includes needed for ACLiC, and update
stale comments.

Assisted-by: claude-code:claude-opus-5-5
Assisted-by: claude-code:claude-opus-5-5
Model the template uncertainties with ParamHistFunc and per-bin
RooPoisson constraints, like HistFactory, instead of RooParamHistFunc and
RooHistConstraint, and remove the rf709b copies. The docs of these two
classes no longer point to rf709, since it doesn't use them anymore.

Assisted-by: claude-code:claude-opus-5-5
Their functionality is too close to the HistFactory classes, which has
repeatedly caused confusion. Users should switch to ParamHistFunc with
per-bin RooPoisson constraints, as shown in rf709_BarlowBeeston. Both
classes will be removed in ROOT 6.46.

The deprecation is not guarded by ROOFIT_BUILDS_ITSELF, because that
definition also reaches CMake and interpreter users. Instead, the
warnings are silenced locally where RooFit still uses the classes.

Assisted-by: claude-code:claude-opus-5-5
@guitargeek
guitargeek marked this pull request as ready for review November 6, 2026 12:50
@guitargeek guitargeek changed the title [RF] Add new version of the BarlowBeeston tutorial in HistFactory style [RF] Rewrite rf709 with HistFactory classes and deprecate RooParamHistFunc and RooHistConstraint Nov 6, 2026
@cburgard

cburgard commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Deprecating this class would resolve a few of the complications we have with HS3. I'm all for it 👍

@guitargeek
guitargeek merged commit 4052989 into root-project:master Nov 6, 2026
30 of 35 checks passed
@guitargeek
guitargeek deleted the rf_bb branch November 6, 2026 16:56
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.

[RF] RooParamHistFunc: analytical integral inconsistent with value for paramRelative = false

3 participants