Skip to content

[RF] Generalize boundary finding for RooHistPdf and RooHistFunc - #21969

Draft
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:issue-13030
Draft

[RF] Generalize boundary finding for RooHistPdf and RooHistFunc#21969
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:issue-13030

Conversation

@guitargeek

@guitargeek guitargeek commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

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.

If the transformation is not linear, the RooHistFunc or RooHistPdf won't be correctly plotted either, but linear transformations are very common, even explicitly via the RooLinearVar, and supporting those is already a good improvement in user experience.

Closes #13030.

The plot from the reproducer in the original issue does now look like this:

plot

@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 7h 34m 39s ⏱️
 3 881 tests  3 879 ✅ 0 💤 2 ❌
71 749 runs  71 746 ✅ 1 💤 2 ❌

For more details on these failures, see this check.

Results for commit ccb30df.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo added this to the 6.40.00 milestone Apr 22, 2026
@guitargeek
guitargeek marked this pull request as draft April 24, 2026 07:47
@dpiparo

dpiparo commented May 14, 2026

Copy link
Copy Markdown
Member

Is this PR making it into 6.40 or should this be shifted to 6.40.02?

@guitargeek guitargeek removed this from the 6.40.00 milestone May 14, 2026
@guitargeek

Copy link
Copy Markdown
Contributor Author

Let's aim for 6.40.02, it's not realistic to have this in 6.40 at this point.

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.

If the transformation is not linear, the RooHistFunc or RooHistPdf won't
be correctly plotted either, but linear transformations are very common,
even explicitly via the `RooLinearVar`, and supporting those is already
a good improvement in user experience. In that case, a warning is now
emitted so the user knows that the plotted 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.
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] Plotting shifted RooHistPdfs doesn't go well

2 participants