User Tools

Site Tools


root:pyrootgetevent

Accessing Events in a Tree

To access the events in a tree no variables need to be assigned to the different branches. Instead the leaves are available as properties of the tree, returning the values of the present event.

tree.GetEvent(0)
print tree.Z0_MM  # 18558.9
tree.GetEvent(1)
print tree.Z0_MM  # 2896.5

To iterate over all events, a for loop can be used directly on the tree object

for event in tree:
    print event.Z0_MM
root/pyrootgetevent.txt · Last modified: 2013/11/20 14:24 by nchiap