Hi everyone!
I stuck upon weird behavior of TChain if I upload more than 1 file in it.
Here is small script which reproduces the problem for me:
from ROOT import TChain
def test1():
tree = TChain("tree_name")
tree.Add("file1.root")
tree.Add("file2.root")
for idx, event in enumerate(tree):
if idx == 100:
break
print("Event: ", idx, event.variable[0])
def test2():
tree = TChain("tree_name")
tree.Add("file1.root")
tree.Add("file2.root")
for idx, event in enumerate(tree):
if idx == 100:
break
print("Total number of events: ", tree.GetEntries())
print("Event: ", idx, event.variable[0])
test1()
test2()
test1() - runs successfully
test2() - returns the error:
AttributeError: 'TChain' object has no attribute 'variable'
How does tree.GetEntries can influence that?
cheers and have a nice day!
ROOT Version: 6.18
Platform: Scientific Linux 7
Compiler: gcc 4.8.5
Python: 3.7.4