User Tools

Site Tools


root:pyrootgetevent
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


root:pyrootgetevent [2013/11/20 14:24] (current) – created nchiap
Line 1: Line 1:
 +====== 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.
 +<code python>
 +tree.GetEvent(0)
 +print tree.Z0_MM  # 18558.9
 +tree.GetEvent(1)
 +print tree.Z0_MM  # 2896.5
 +</code>
 +
 +To iterate over all events, a ''for'' loop can be used directly on the tree object
 +<code python>
 +for event in tree:
 +    print event.Z0_MM
 +</code>
  
root/pyrootgetevent.txt · Last modified: 2013/11/20 14:24 by nchiap