Skip to content

Conversation

siliataider
Copy link
Contributor

This Pull request:

Changes or fixes:

When using UHI for slicing, GetEntries() value of a histogram did not correctly reflect the state after the operation.

Note that after this fix, calling GetEntries() on a sliced histogram will reflect the effective total count (the same value returned by GetEffectiveEntries()).

The following:

import ROOT

h = ROOT.TH1D("h", "h", 10, 0, 10)
h.SetBinContent(1, 5)

h_slice = h[...]

h.Print()
h_slice.Print()

Will output:

TH1.Print Name  = h, Entries= 1, Total sum= 5
TH1.Print Name  = h, Entries= 5, Total sum= 5

Checklist:

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

This PR fixes #19113

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me, thanks! 👍

Copy link

github-actions bot commented Jun 20, 2025

Test Results

    20 files      20 suites   4d 1h 16m 8s ⏱️
 3 013 tests  3 006 ✅   0 💤 7 ❌
58 672 runs  58 509 ✅ 156 💤 7 ❌

For more details on these failures, see this check.

Results for commit 7ff6013.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo added the clean build Ask CI to do non-incremental build on PR label Jun 21, 2025
@dpiparo dpiparo closed this Jun 21, 2025
@dpiparo dpiparo reopened this Jun 21, 2025
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.

LGTM thanks!

@dpiparo dpiparo merged commit f968b17 into root-project:master Jun 21, 2025
29 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR improvement in:Python Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Python][UHI] Incorrect number of entries reported in TH1 after slicing
4 participants