Skip to content

Commit f968b17

Browse files
siliataiderdpiparo
authored andcommitted
[Python][UHI] Fix entry count after slicing operations
1 parent 3e36046 commit f968b17

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bindings/pyroot/pythonizations/test/uhi_indexing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def test_statistics_slice(self, hist_setup):
300300
sliced_hist_full = hist_setup[...]
301301

302302
assert hist_setup.GetEffectiveEntries() == sliced_hist_full.GetEffectiveEntries()
303+
assert sliced_hist_full.GetEntries() == sliced_hist_full.GetEffectiveEntries()
303304
assert hist_setup.Integral() == sliced_hist_full.Integral()
304305

305306
# Check if slicing over a range updates the statistics
@@ -310,6 +311,7 @@ def test_statistics_slice(self, hist_setup):
310311

311312
assert hist_setup.Integral() == sliced_hist.Integral()
312313
assert hist_setup.GetEffectiveEntries() == sliced_hist.GetEffectiveEntries()
314+
assert sliced_hist.GetEntries() == sliced_hist.GetEffectiveEntries()
313315
assert hist_setup.GetStdDev() == pytest.approx(sliced_hist.GetStdDev(), rel=10e-5)
314316
assert hist_setup.GetMean() == pytest.approx(sliced_hist.GetMean(), rel=10e-5)
315317

hist/hist/inc/TH1.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
281281

282282
// Update the statistics
283283
ResetStats();
284-
fEntries = std::accumulate(dataArray, dataArray + newSize, 0.0);
285284
}
286285

287286
template <typename T>
@@ -359,7 +358,6 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
359358

360359
// Update the statistics
361360
ResetStats();
362-
fEntries += std::accumulate(values.begin(), values.end(), 0.0);
363361
}
364362

365363
template <typename T>

0 commit comments

Comments
 (0)