Definition at line 172 of file D3PDSizeSummary.py.
◆ __init__()
def D3PDSizeSummary.Filestats.__init__ |
( |
|
self, |
|
|
|
fname, |
|
|
|
treename = None |
|
) |
| |
Definition at line 173 of file D3PDSizeSummary.py.
173 def __init__ (self, fname, treename = None):
175 self.treename = treename
176 self.branchgroups = {}
◆ draw_pie()
def D3PDSizeSummary.Filestats.draw_pie |
( |
|
self | ) |
|
Definition at line 251 of file D3PDSizeSummary.py.
254 print "Number of branch groups:", len(self.branchgroups)
255 print "Values of branch groups:",
list(self.branchgroups.
keys())
257 blist = self.branchgroups.
values()
258 blist.sort (
lambda a, b:
int(b.filebytes - a.filebytes))
259 pie = ROOT.TPie(
"BranchPie",
"", len(self.branchgroups))
260 for i, bgroup
in enumerate( blist ):
261 bginfo = bgroup.get_dict(self.nev)
264 print "Branch group #%d, named %s with size %f = %f%%" % (i , bginfo[
'name'], (
float(bgroup.filebytes) / 1024 / self.nev ), (100. *
float(bgroup.filebytes) /
float(self.file_size)) )
266 pie.SetEntryLabel(i, bginfo[
'name'])
267 pie.SetEntryVal (i, (100. *
float(bgroup.filebytes) /
float(self.file_size)) )
268 pie.SetEntryFillColor(i, i+2)
271 c1 = ROOT.TCanvas(
'c1' ,
'c1' )
273 pie.SetCircle(.5,.45,.2)
274 pie.SetLabelFormat(
"#splitline{%txt}{(%perc)}")
275 pie.SetLabelFormat(
"%txt")
277 pie.SetTextSize(0.03)
278 pie.SetCircle(0.4808696, 0.7940109, 0.2)
279 pie.SetValueFormat(
"%4.2f")
280 pie.SetLabelFormat(
"%txt")
281 pie.SetPercentFormat(
"%3.1f")
282 pie.SetLabelsOffset(0.005)
283 pie.SetAngularOffset(265.2655)
284 leg = ROOT.TLegend(0.05580866, 0.06554878, 0.785877, 0.4512195)
285 for i, bgroup
in enumerate( blist ):
286 if ( (
float(bgroup.filebytes) /
float(self.file_size)) > 0.05):
287 pie.SetEntryRadiusOffset(i,.07)
288 bginfo = bgroup.get_dict(self.nev)
289 leg.AddEntry( pie.GetSlice(i),
"%s : %1.1lf%%" % (bginfo[
'name'] , 100. *
float(bgroup.filebytes) /
float(self.file_size)) ,
"f" )
291 pie.SetEntryLabel(i,
"")
299 c1.SaveAs(options.filename +
"." + options.extension)
◆ get_branchgroup()
def D3PDSizeSummary.Filestats.get_branchgroup |
( |
|
self, |
|
|
|
b |
|
) |
| |
Definition at line 190 of file D3PDSizeSummary.py.
190 def get_branchgroup (self, b):
192 ll = bname.split (
'_')
193 if bname
in [
'RunNumber',
205 elif (bname.endswith (
'Error')
or bname.endswith (
'Flags')):
209 group = self.branchgroups.get (gname)
211 group = Branchgroup (gname)
212 self.branchgroups[gname] = group
◆ get_stats()
def D3PDSizeSummary.Filestats.get_stats |
( |
|
self | ) |
|
Definition at line 216 of file D3PDSizeSummary.py.
216 def get_stats (self):
217 self.file_size = os.stat(self.fname).st_size
218 self.rfile = ROOT.TFile.Open (self.fname)
220 if self.treename ==
None:
221 raise Exception (
"Can't find tree name in file.")
222 self.tree = self.rfile.Get (self.treename)
224 raise Exception (
"Can't find tree " + self.treename +
" in file.")
◆ get_treename()
def D3PDSizeSummary.Filestats.get_treename |
( |
|
self | ) |
|
Definition at line 181 of file D3PDSizeSummary.py.
181 def get_treename (self):
182 if self.treename:
return
183 for kk
in self.rfile.GetListOfKeys():
184 if (kk.GetClassName() ==
'TTree' and
185 kk.GetName() !=
'CollectionTree'):
186 self.treename = kk.GetName()
◆ print_stats_text()
def D3PDSizeSummary.Filestats.print_stats_text |
( |
|
self | ) |
|
Definition at line 237 of file D3PDSizeSummary.py.
237 def print_stats_text (self):
238 print "Number of events:", self.nev
239 print "File size: %dk" %
int(
float(self.file_size)/1024 + 0.5)
240 print "Overall size/event: %.1fk" % (
float(self.file_size) / self.nev / 1024)
242 bl = self.branchgroups.
values()
243 bl.sort (
lambda a, b:
int(b.filebytes - a.filebytes))
244 Branchgroup.print_header()
246 bg.print_stats (self.nev)
247 Branchgroup.print_trailer()
◆ scan_branches()
def D3PDSizeSummary.Filestats.scan_branches |
( |
|
self | ) |
|
Definition at line 230 of file D3PDSizeSummary.py.
230 def scan_branches (self):
231 for b
in self.tree.GetListOfBranches():
232 bg = self.get_branchgroup (b)
◆ branchgroups
D3PDSizeSummary.Filestats.branchgroups |
◆ file_size
D3PDSizeSummary.Filestats.file_size |
◆ fname
D3PDSizeSummary.Filestats.fname |
◆ nev
D3PDSizeSummary.Filestats.nev |
◆ rfile
D3PDSizeSummary.Filestats.rfile |
◆ tree
D3PDSizeSummary.Filestats.tree |
◆ treename
D3PDSizeSummary.Filestats.treename |
The documentation for this class was generated from the following file: