69 def analyze(root, level, gtrees, gbranches, doprint):
73 keys = root.GetListOfKeys()
75 objname = key.GetName()
76 if objname
not in trees:
77 obj = root.Get(objname)
78 if obj
and obj.InheritsFrom(
'TTree'):
80 if objname ==
'Events':
87 for key
in sorted(trees.keys()):
89 nentry = tree.GetEntriesFast()
91 print(
'%s has %d entries.' % (key, nentry))
96 gtrees[key] = gtrees[key] + nentry
103 print(
'\nBranches of Events tree:\n')
113 print(
' Total bytes Zipped bytes Comp. Branch name')
114 print(
' ----------- ------------ ----- -----------')
116 branches = events.GetListOfBranches()
122 for branch
in branches:
123 branch_class = branch.GetClass().GetName()
127 if branch_class[0: 13] ==
'art::Wrapper<':
131 subbranches = branch.GetListOfBranches()
132 for subbranch
in subbranches:
133 name = subbranch.GetName()
137 if name[-4:] ==
'.obj':
138 ntot = subbranch.GetTotBytes(
"*")
139 nzip = subbranch.GetZipBytes(
"*")
140 ntotall = ntotall + ntot
141 nzipall = nzipall + nzip
147 print(
'%14d%14d%8.2f %s' % (ntot, nzip, comp, name))
151 if name
in gbranches:
152 gbranches[name][0] = gbranches[name][0] + ntot
153 gbranches[name][1] = gbranches[name][1] + nzip
155 gbranches[name] = [ntot, nzip]
160 subsubbranches = subbranch.GetListOfBranches()
161 for subsubbranch
in subsubbranches:
162 name = subsubbranch.GetName()
163 ntot = subsubbranch.GetTotBytes(
"*")
164 nzip = subsubbranch.GetZipBytes(
"*")
170 print(
'%14d%14d%8.2f %s' % (ntot, nzip, comp,
171 subsubbranch.GetName()))
175 if name
in gbranches:
176 gbranches[name][0] = gbranches[name][0] + ntot
177 gbranches[name][1] = gbranches[name][1] + nzip
179 gbranches[name] = [ntot, nzip]
183 name =
'All branches' 189 print(
'%14d%14d%8.2f %s' % (ntotall, nzipall, comp, name))
193 nev = events.GetEntriesFast()
201 print(
'%10d events.' % nev)
202 print(
'%7.2f Mb average size per event.' % nevtot)
203 print(
'%7.2f Mb average zipped size per event.' % nevzip)
205 if name
in gbranches:
206 gbranches[name][0] = gbranches[name][0] + ntotall
207 gbranches[name][1] = gbranches[name][1] + nzipall
209 gbranches[name] = [ntotall, nzipall]
def analyze(root, level, gtrees, gbranches, doprint)