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 | ||
+ | tree.GetEvent(1) | ||
+ | print tree.Z0_MM | ||
+ | </ | ||
+ | |||
+ | To iterate over all events, a '' | ||
+ | <code python> | ||
+ | for event in tree: | ||
+ | print event.Z0_MM | ||
+ | </ | ||