Skip to content

Instantly share code, notes, and snippets.

@ndawe
Last active December 28, 2015 00:09
Show Gist options
  • Save ndawe/7411021 to your computer and use it in GitHub Desktop.
Save ndawe/7411021 to your computer and use it in GitHub Desktop.
from root_numpy import tree2rec
from root_numpy.testdata import get_filepath
from rootpy.io import root_open
import rootpy.compiled as C
C.register_code("""
double mult(double x, double y)
{
return x * y;
}
""", "mult".split())
assert C.mult(2, 2) == 4
filename = get_filepath('test.root')
with root_open(filename) as rfile:
print tree2rec(rfile.tree,
branches=['x', 'y', 'mult(x, y)'],
selection='z > 0',
start=0, stop=10, step=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment