Skip to content

Conversation

siliataider
Copy link
Contributor

@siliataider siliataider commented Oct 20, 2025

This Pull request:

Changes or fixes:

When slicing histograms containing an axis with an infinite upper bin edge, the SliceHistoInPlace method produced invalid axis limits (NaN) in the resulting slice. This was caused by calling the SetBins overload using (lowEdge, upEdge) limits, which fails for axes that extend to infinity. Since the resulting sliced histogram had wrong axis values, any following operation including projections had the wrong output.

This PR updates SliceHistoInPlace to compute and store the full bin edge arrays for each dimension instead.

The reproducer from issue #20077 now yields identical results for both h.ProjectionY() and h[uhi.sum, :].

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

Note

This PR fixes #20077 partially by addressing the second part of the issue
This implementation makes sure the UHI projection result is the same the original ROOT projection methods, it doesn't however change the behavior of ProjectionY() described in the first part of the issue issue

Copy link

Test Results

    22 files      22 suites   3d 17h 36m 53s ⏱️
 3 689 tests  3 688 ✅ 0 💤 1 ❌
79 225 runs  79 220 ✅ 0 💤 5 ❌

For more details on these failures, see this check.

Results for commit 08fdb3b.

@siliataider
Copy link
Contributor Author

The failing test (483:gtest-tmva-sofie-TestSofieModels) on all platforms is unrelated to this PR

Copy link
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is definitely an improvement! IIUC, TH1 and derivates still have an issue with handling infinite bin edges. If that is the case, that should be reported in the linked issue, ideally with a C++ reproducer, or a new one should be opened to not lose sight of that.

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.

Histogram projections and UHI fail on histograms with axes having infinite upper edges.

2 participants