Skip to content

Instantly share code, notes, and snippets.

@lukedeo
Created February 24, 2014 05:01
Show Gist options
  • Save lukedeo/9182200 to your computer and use it in GitHub Desktop.
Save lukedeo/9182200 to your computer and use it in GitHub Desktop.
import rootpy
from rootpy.io import root_open
from rootpy.tree import Tree, TreeChain
# -- Let me real quick grab a nasty d3pd
f = root_open('user.dguest.050909._00001.skim-output.root')
# -- Yank that tree out of there...
T = f['physics']
# -- pythonically grab a list of branches
br = T.branchnames
# -- STICKS THE ENTIRE THING IN AN NDARRAY
ntuple = T.to_array()
# -- grab the leading jet pt of the second event.
leading_jet_pt = ntuple['jet_AntiKt4LCTopo_pt'][2][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment