User Tools

Site Tools


root:pyroot_ttree

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
root:pyroot_ttree [2018/02/28 13:57] – [TChain] iwnroot:pyroot_ttree [2018/02/28 13:58] – [Looping over a TTree] iwn
Line 102: Line 102:
 <code python> <code python>
 for event in tree: for event in tree:
-    print tree.px+    print event.px
 </code> </code>
 If you also need the event's index: If you also need the event's index:
 <code python> <code python>
 for i, event in enumerate(tree): for i, event in enumerate(tree):
-    print i, tree.px+    print i, event.px
 </code> </code>
- 
  
 ===== Making a histogram with TTree ===== ===== Making a histogram with TTree =====
Line 195: Line 194:
 chain.Add("sample_3.root") chain.Add("sample_3.root")
 for event in chain: for event in chain:
-  ...+  print event.px
 </code> </code>
 Note it's also possible to use a glob wildcard: ''chain.Add("sample_*.root")'' Note it's also possible to use a glob wildcard: ''chain.Add("sample_*.root")''
root/pyroot_ttree.txt · Last modified: 2018/02/28 14:03 by iwn