-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Python iteration over a TTreeReader is broken #8183
Copy link
Copy link
Closed
Labels
Description
Describe the bug
Here's a self-contained reproducer:
import ROOT
ROOT.RDataFrame(10).Define("x", "int(rdfentry_)").Snapshot("t", "f.root")
f = ROOT.TFile("f.root")
t = f.Get("t")
reader = ROOT.TTreeReader(t)
age = ROOT.TTreeReaderValue['int'](reader, "x")
staff_list = []
for entry in reader:
print(age.Get()[0])This prints
1
2
3
4
5
6
7
8
9
9
instead of
0
1
2
3
4
5
6
7
8
9
Expected behavior
Either Python iteration should be disabled (in favor of while reader.Next(), which works as expected) or it should produce the same results as the while reader.Next() loop.
Additional context
First reported at https://root-forum.cern.ch/t/ttreereader-vs-rdataframe-vs-branches-to-read-ttree/44785
Reactions are currently unavailable