Repository navigation
[6.42] [RF] Generalize boundary finding for RooHistPdf and RooHistFunc - #24277
Merged
dpiparo merged 4 commits intoNov 20, 2026
Merged
Conversation
The interface to return bin boundaries and sampling hints for plotting in RooHistPdf and RooHistFunc doesn't consider that the histogram variable might be a transformation of the variable for which the bin boundaries or plot hints are requested. This commit improves the situation by implementing an algorithm that assumes that plot variable and histogram variable are linearly related, and numerically figures out the inverse transformation for transforming histogram bins to plot bins if needed. Non-linear transformations are not inverted exactly, but linear transformations are very common, even explicitly via the `RooLinearVar`, and supporting those is already a good improvement in user experience. For a non-linear transformation, a warning is now emitted so the user knows that the bin boundaries are only approximate. The inverse is deliberately computed arithmetically rather than via the l-value `setVal()` interface, because inverting a boundary can land outside the range of the plot observable, which would throw. Closes root-project#13030. (cherry picked from commit eeffe46)
Cover RooHistFunc, a transformation with negative slope and plotSamplingHint() for transformed histogram observables. On master, RooHistFunc throws for a RooLinearVar observable and plotSamplingHint() returns no hint for a shifted RooHistPdf. Assisted-by: claude-code:claude-opus-5-5 (cherry picked from commit ca6ed9b)
To map the bin boundaries, histogramBoundariesInPlotObs() sets the plot observable to probe the transformation and restored it with setVal(). That throws if an outer integral over a wider range had set the observable outside its default range. Restore it with assign() instead. Also fix the binBoundaries() documentation, which named RooCurve as a user (RooCurve uses plotSamplingHint()), and shorten the comments. Assisted-by: claude-code:claude-opus-5-5 (cherry picked from commit 6c08bc5)
The RooBinIntegrator took the bin boundaries from the integrand only when it was created, but RooRealIntegral keeps reusing it when the parameters change. For a RooHistPdf or RooHistFunc of a shifted observable, the boundaries move with the shift, so the integral was only right at the shift of its first evaluation. Afterwards, it could count an edge bin twice. Get the boundaries for each integral instead. This costs one binBoundaries() call per integral, which in the RooFit tests and tutorials is less than 0.3 % of the run time. Assisted-by: claude-code:claude-opus-5-5 (cherry picked from commit c107cea)
root-project-bot
requested review from
guitargeek and
hageboeck
as code owners
November 20, 2026 16:16
Test Results 24 files 24 suites 4d 1h 47m 33s ⏱️ Results for commit 55e79c6. |
dpiparo
merged commit Nov 20, 2026
de73d23
into
root-project:v6-42-00-patches
39 of 40 checks passed
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 #21969, requested by @guitargeek.