10def checkxAODSize(xAODFiles, histfile, addgraphlabel=False):
11
12
13 histfilename = histfile if histfile else "hist.root"
14
15
16 sizes = []
17 for filename in xAODFiles:
18 cmd = ['checkxAOD', filename]
19 outlog = subprocess.Popen(cmd, stdout = subprocess.PIPE)
20 lines = str(outlog.communicate()).
split(
"\\n")
21
22 iline = 0
23 for line in lines:
24
25 if line.startswith("CSV"):
28 domaindict = dict(zip(domainlist, domainsize))
29 iline = iline + 1
30 sizes.append(float(domaindict['Total']))
31
32
33 hfile = ROOT.TFile( histfilename, 'UPDATE', 'ROOT file with histograms' )
34 hfile.cd()
35 hfile.mkdir("Sizes")
36 hfile.cd("Sizes")
37
38
39 hsize = ROOT.TH1F('hist PHYSLITE PHYS AOD event size', 'hist PHYSLITE PHYS AOD event size', len(sizes), -0.5, len(sizes)-0.5 )
40 for i in range(0,len(sizes)):
41 hsize.Fill(i, sizes[i])
42 hsize.Write()
43
44
45 xbins = [*range(len(sizes))]
47 for i in range(len(sizes)):
48 x.append(xbins[i])
49 y.append(sizes[i])
50
51 grsize = ROOT.TGraph(len(sizes),x,y)
52 grsize.SetTitle('graph PHYSLITE PHYS AOD file size')
53 grsize.SetName('graph PHYSLITE PHYS AOD file size')
54
55
56 if addgraphlabel:
57 xbinsLabel = [ 'PHYSLITE %3.1f'%sizes[0],
58 'PHYS %3.1f'%sizes[1],
59 'AOD %3.1f'%sizes[2] ]
60
61 graxis = grsize.GetXaxis()
62 for ibin in range(0,len(sizes)):
63 tmpbin = graxis.FindBin(ibin)
64 graxis.SetBinLabel(tmpbin, xbinsLabel[ibin])
65 graxis.Draw("AP")
66
67 grsize.Write()
68 hfile.Close()
69
70 return
71
std::vector< std::string > split(const std::string &s, const std::string &t=":")