User Tools

Site Tools


root:pyrootgetevent

Differences

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

Link to this comparison view

root:pyrootgetevent [2013/11/20 14:24] (current)
nchiap created
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