CMS 3D CMS Logo

testtree.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from builtins import range
3 from ROOT import TFile
4 from PhysicsTools.HeppyCore.statistics.tree import Tree
5 
6 def create_tree(filename="test_tree.root"):
7  outfile = TFile(filename, 'recreate')
8  tree = Tree('test_tree', 'A test tree')
9  tree.var('var1')
10  for i in range(100):
11  tree.fill('var1', i)
12  tree.tree.Fill()
13  print('creating a tree', tree.tree.GetName(),\
14  tree.tree.GetEntries(), 'entries in',\
15  outfile.GetName())
16  outfile.Write()
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
testtree.create_tree
def create_tree(filename="test_tree.root")
Definition: testtree.py:6