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

    23 files      23 suites   3d 16h 11m 28s ⏱️
 3 853 tests  3 852 ✅ 0 💤 1 ❌
78 505 runs  78 503 ✅ 1 💤 1 ❌

For more details on these failures, see this check.

Results for commit 75cff41.

♻️ 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.

@guitargeek
guitargeek force-pushed the issue-13030 branch 2 times, most recently from 4a392dc to ccb30df Compare July 30, 2026 07:47
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.
@dpiparo dpiparo added this to the 6.40.06 milestone Sep 2, 2026
@dpiparo

dpiparo commented Sep 2, 2026

Copy link
Copy Markdown
Member

Now in the 6.40.06 milestone. It would be nice to have it in by then!

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