def create_simple_tree(nevents):
"""Create a simple TTree with a couple of branches."""
t = TTree('aTTree','A TTree')
t.Branch('run', AddressOf(pytree, 'run'),'run/I')
t.Branch('evt', AddressOf(pytree, 'evt'),'evt/I')
t.Branch('x', AddressOf(pytree, 'x'),'x/F')
t.Branch('y', AddressOf(pytree, 'y'),'y/F')
t.Branch('z', AddressOf(pytree, 'z'),'z/F')
for i in range(nevents):
pytree.run = 1 if (i<500) else 2
pytree.evt = i
pytree.x = gauss(0., 10.)
pytree.y = gauss(0, 10.)
pytree.z = gauss(5., 50.)
t.Fill()
return t
评论列表
文章目录