Skip to content

[RF] Fix RooHistPdf sub-range integrals with interpolation#20119

Open
ferdymercury wants to merge 1 commit into
root-project:masterfrom
ferdymercury:patch-24
Open

[RF] Fix RooHistPdf sub-range integrals with interpolation#20119
ferdymercury wants to merge 1 commit into
root-project:masterfrom
ferdymercury:patch-24

Conversation

@ferdymercury

@ferdymercury ferdymercury commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

The analytical integral of a RooHistPdf sums the underlying RooDataHist
bin contents, which only matches the interpolated curve over the full
range. For interpolated histograms (intOrder > 0), RooHistPdf took this
shortcut also over sub-ranges, returning the step-function (intOrder == 0)
area regardless of the interpolation order. Fall back to numerical
integration in that case; full-range integrals and non-interpolated
histograms are unaffected and still use the analytical path.

Closes #20116.

@github-actions

github-actions Bot commented Oct 15, 2025

Copy link
Copy Markdown

Test Results

2 604 tests   2 604 ✅  1h 14m 0s ⏱️
    1 suites      0 💤
    1 files        0 ❌

Results for commit 0929cf3.

♻️ This comment has been updated with latest results.

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing the right fix! I added a test, and now it's good to go.

@guitargeek guitargeek added the bug label Jun 24, 2026
@guitargeek guitargeek changed the title [RF] disable analytical integrals also with linear interpolation [RF] Fix RooHistPdf sub-range integrals with interpolation Jun 24, 2026
The analytical integral of a RooHistPdf sums the bin contents of the
underlying RooDataHist, which integrates the piecewise-constant
histogram. For interpolated histograms (intOrder > 0) this only matches
the actual curve over the full range; over a sub-range it does not, so
the integral was wrong (it returned the intOrder == 0 step-function area
regardless of the interpolation order).

Fall back to numerical integration for sub-range integrals of interpolated
histograms, but only when integrating over the histogram's own fundamental
observable. A derived (non-fundamental) observable has already passed the
constant-Jacobian check in okayForAnalytical and is a genuine transform of
the histogram variable, e.g. the RooLinearVar that RooMomentMorphFuncND
uses to renormalize its components; those keep the analytical path they
rely on. Full-range integrals and non-interpolated histograms are
unaffected.

Closes root-project#20116.

🤖 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.

Wrong integrals for RooHistPdf with interpolation order = 1

2 participants