[RF] Fix RooHistPdf sub-range integrals with interpolation#20119
Open
ferdymercury wants to merge 1 commit into
Open
[RF] Fix RooHistPdf sub-range integrals with interpolation#20119ferdymercury wants to merge 1 commit into
ferdymercury wants to merge 1 commit into
Conversation
Test Results2 604 tests 2 604 ✅ 1h 14m 0s ⏱️ Results for commit 0929cf3. ♻️ This comment has been updated with latest results. |
guitargeek
approved these changes
Jun 24, 2026
guitargeek
left a comment
Contributor
There was a problem hiding this comment.
Thanks for implementing the right fix! I added a test, and now it's good to go.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.