ATLAS Offline Software
read_hist_ntuple.py
Go to the documentation of this file.
1 import ROOT
2 print ":" * 80
3 print "::: ntuple..."
4 f1 = ROOT.TFile.Open("ntuple.root","READ")
5 t = f1.Get("trees/tree1")
6 print ":: entries:",t.GetEntries()
7 print ":: branches:",[b.GetName() for b in t.GetListOfBranches()]
8 for i in xrange(t.GetEntries()):
9  if t.GetEntry(i) <= 0:
10  print "** error reading entry [%i]" % (i,)
11  break
12  print ":: entry [%i]..." % (i,)
13  print ":: run:",t.run
14  print ":: size:",t.size
15  print ":: rundata:",list(t.rundata)
16 print ":: done."
17 
18 print ":" * 80
19 print "::: histogram..."
20 f2 = ROOT.TFile.Open("hist.root", "READ")
21 h1 = f2.Get("simple1D/h1")
22 print ":: entries:",h1.GetEntries()
23 h1.Draw()
24 print ":: done."
25 
26 print "::: bye."
27 
xrange
void xrange(TH1 *h, bool symmetric)
Definition: computils.cxx:516
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38