ATLAS Offline Software
Loading...
Searching...
No Matches
read_hist_ntuple.py
Go to the documentation of this file.
1import ROOT
2print ":" * 80
3print "::: ntuple..."
4f1 = ROOT.TFile.Open("ntuple.root","READ")
5t = f1.Get("trees/tree1")
6print ":: entries:",t.GetEntries()
7print ":: branches:",[b.GetName() for b in t.GetListOfBranches()]
8for 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)
16print ":: done."
17
18print ":" * 80
19print "::: histogram..."
20f2 = ROOT.TFile.Open("hist.root", "READ")
21h1 = f2.Get("simple1D/h1")
22print ":: entries:",h1.GetEntries()
23h1.Draw()
24print ":: done."
25
26print "::: bye."
27
void xrange(TH1 *h, bool symmetric)