[6.40] [RF] Fix RooBinIntegrator for ranges cutting through integrand bins#22930
Open
root-project-bot wants to merge 1 commit into
Open
[6.40] [RF] Fix RooBinIntegrator for ranges cutting through integrand bins#22930root-project-bot wants to merge 1 commit into
root-project-bot wants to merge 1 commit into
Conversation
RooBinIntegrator builds its integration grid from the integrand's binBoundaries(xlo, xhi), which only returns the boundaries lying strictly inside the integration range. As a result, the integrator summed only the bins fully contained in the range and silently dropped the partial bins at the edges, because the integration limits were never added as the outermost bin boundaries. For example, integrating a 5-bin RooHistPdf (edges 0,2,4,6,8,10) over the sub-range [3,7] returned 2 instead of the correct 5.5. Fix this by prepending xmin and appending xmax as the outermost boundaries when they are not already present. The guard avoids zero-width bins when a range boundary coincides with a bin edge. Each resulting sub-bin then lies entirely within one original bin, so the midpoint rule stays exact for a piecewise-constant histogram. Add unit tests comparing the numeric RooBinIntegrator result against the analytic RooHistPdf integral for several range types, in both one and two dimensions. Closes root-project#22858. 🤖 Done with the help of AI. (cherry picked from commit ba4e908)
Test Results 22 files 22 suites 3d 7h 26m 11s ⏱️ For more details on these failures, see this check. Results for commit 730c12b. |
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.
Backport of #22922, requested by @guitargeek.