CMS 3D CMS Logo

testtree.py
Go to the documentation of this file.
1 from ROOT import TFile
2 from PhysicsTools.HeppyCore.statistics.tree import Tree
3 
4 def create_tree(filename="test_tree.root"):
5  outfile = TFile(filename, 'recreate')
6  tree = Tree('test_tree', 'A test tree')
7  tree.var('var1')
8  for i in range(100):
9  tree.fill('var1', i)
10  tree.tree.Fill()
11  print 'creating a tree', tree.tree.GetName(),\
12  tree.tree.GetEntries(), 'entries in',\
13  outfile.GetName()
14  outfile.Write()
def create_tree(filename="test_tree.root")
Definition: testtree.py:4