ATLAS Offline Software
Functions | Variables
python.sizes Namespace Reference

Functions

def printTable (out, stream, quantity, topq1Only=False)
 

Variables

 c1 = ROOT.TCanvas('c1', '', 400, 400)
 
string location = '/disk/homedisk/home/sjh2/public_web/twiki/'
 
string derivationTag = 'p1851'
 
string qunatityFromAmi = 'totalEvents'
 
 out = open(location + 'derivation_progress.html', 'w')
 
 d_string = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
 
string txt
 

Function Documentation

◆ printTable()

def python.sizes.printTable (   out,
  stream,
  quantity,
  topq1Only = False 
)

Definition at line 14 of file sizes.py.

14 def printTable(out, stream, quantity, topq1Only=False):
15  toGB = 1.
16  if quantity == 'totalSize':
17  toGB = 1. / 1000. / 1000. / 1000.
18 
19  primaryxAOD = ami.askAmi('data12_8TeV.*' + stream + '.merge.AOD.r572*_p1751_p2309', quantity)
20  topq1_round1 = ami.askAmi('data12_8TeV.*' + stream + '*DAOD_TOPQ1*' + derivationTag, quantity)
21 
22  topq2_round1 = {}
23  if not topq1Only:
24  topq2_round1 = ami.askAmi('data12_8TeV.*' + stream + '*DAOD_TOPQ2*' + derivationTag, quantity)
25 
26  h_topq1_frac = ROOT.TH1D('h_topq1_frac', ';TOPQ1 Size / Primary Size [%];Number of datasets', 20, 0, 10)
27  h_topq2_frac = ROOT.TH1D('h_topq2_frac', ';TOPQ2 Size / Primary Size [%];Number of datasets', 20, 0, 1)
28 
29  h_topq1_abs = ROOT.TH1D('h_topq1_abs', ';TOPQ1 Size [GB];Number of datasets', 20, 0, 200)
30  h_topq2_abs = ROOT.TH1D('h_topq2_abs', ';TOPQ2 Size [GB];Number of datasets', 30, 0, 15)
31 
32  out.write('---+ !%s\n' % stream)
33  if not topq1Only:
34  out.write('| *%s* | *%s* | *%s* | *%s* | *%s* | *%s* |\n' % ('Primary xAOD name', 'Size [GB]', 'TOPQ1 size [GB]', '%', 'TOPQ2 size [GB]', '%'))
35  else:
36  out.write('| *%s* | *%s* | *%s* | *%s* |\n' % ('Primary xAOD name', 'Size [GB]', 'TOPQ1 size [GB]', '%'))
37 
38  tot_prim = 0
39  tot_topq1 = 0
40  tot_topq2 = 0
41  for k in sorted(primaryxAOD.keys()):
42  primaryNum = primaryxAOD[k] * toGB
43 
44  topq1_name = k.replace('AOD', 'DAOD_TOPQ1') + '_' + derivationTag
45  topq1Num = -1
46  if topq1_round1.has_key(topq1_name):
47  topq1Num = topq1_round1[topq1_name] * toGB
48 
49  topq2_name = k.replace('AOD', 'DAOD_TOPQ2') + '_' + derivationTag
50  topq2Num = -1
51  if topq2_round1.has_key(topq2_name):
52  topq2Num = topq2_round1[topq2_name] * toGB
53 
54  note = ''
55 
56  cstart = '%RED%'
57  cend = "%ENDCOLOR%"
58 
59  topq1Frac = 0
60  topq2Frac = 0
61  if topq1Num > 0:
62  tot_prim += primaryNum
63  tot_topq1 += topq1Num
64  topq1Frac = 100. * topq1Num / primaryNum
65  h_topq1_frac.Fill(topq1Frac)
66  h_topq1_abs.Fill(topq1Num)
67  cstart= ''
68  cend = ''
69  topq1Num = cstart + ('%4.2f' % topq1Num) + cend
70  topq1Frac = cstart + ('%4.2f' % topq1Frac) + cend
71  else:
72  topq1Num = cstart + '-' + cend
73  topq1Frac = cstart + '-' + cend
74 
75  if topq2Num > 0:
76  tot_topq2 += topq2Num
77  topq2Frac = 100. * topq2Num / primaryNum
78  h_topq2_frac.Fill(topq2Frac)
79  h_topq2_abs.Fill(topq2Num)
80  cstart = ''
81  cend = ''
82  topq2Num = cstart + ('%4.2f' % topq2Num) + cend
83  topq2Frac = cstart + ('%4.2f' % topq2Frac) + cend
84  else:
85  topq2Num = cstart + '-' + cend
86  topq2Frac = cstart + '-' + cend
87 
88  k = cstart + k + cend
89  primaryNum = cstart + ('%4.2f' % primaryNum) + cend
90 
91  if not topq1Only:
92  txt = '| %s | %s | %s | %s | %s | %s |\n' % (k, primaryNum, topq1Num, topq1Frac, topq2Num, topq2Frac)
93  else:
94  txt = '| %s | %s | %s | %s |\n' % (k, primaryNum, topq1Num, topq1Frac)
95 
96  out.write(txt)
97 
98  if not topq1Only:
99  txt = '| total (only include primary that have derivation) | %4.2f | %4.2f | %4.2f | %4.2f | %4.2f |\n' % (tot_prim, tot_topq1, 100. * tot_topq1 / tot_prim, tot_topq2, 100. * tot_topq2 / tot_prim)
100  else:
101  txt = '| total (only include primary that have derivation) | %4.2f | %4.2f | %4.2f |\n' % (tot_prim, tot_topq1, 100. * tot_topq1 / tot_prim)
102 
103  out.write(txt)
104  out.write('\n')
105 
106  name = stream + '_topq1_abs.gif'
107  h_topq1_abs.SetFillColor(ROOT.kRed)
108  h_topq1_abs.Draw('hist')
109  c1.Print(location + name)
110  out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name)
111 
112  name = stream + '_topq1_frac.gif'
113  h_topq1_frac.SetFillColor(ROOT.kRed)
114  h_topq1_frac.Draw('hist')
115  c1.Print(location + name)
116  out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name)
117 
118  if not topq1Only:
119  name = stream + '_topq2_abs.gif'
120  h_topq2_abs.SetFillColor(ROOT.kRed)
121  h_topq2_abs.Draw('hist')
122  c1.Print(location + name)
123  out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name)
124 
125  name = stream + '_topq2_frac.gif'
126  h_topq2_frac.SetFillColor(ROOT.kRed)
127  h_topq2_frac.Draw('hist')
128  c1.Print(location + name)
129  out.write('http://epweb2.ph.bham.ac.uk/user/head/twiki/%s\n' % name)
130 

Variable Documentation

◆ c1

python.sizes.c1 = ROOT.TCanvas('c1', '', 400, 400)

Definition at line 9 of file sizes.py.

◆ d_string

python.sizes.d_string = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

Definition at line 138 of file sizes.py.

◆ derivationTag

string python.sizes.derivationTag = 'p1851'

Definition at line 12 of file sizes.py.

◆ location

string python.sizes.location = '/disk/homedisk/home/sjh2/public_web/twiki/'

Definition at line 11 of file sizes.py.

◆ out

python.sizes.out = open(location + 'derivation_progress.html', 'w')

Definition at line 135 of file sizes.py.

◆ qunatityFromAmi

string python.sizes.qunatityFromAmi = 'totalEvents'

Definition at line 132 of file sizes.py.

◆ txt

string python.sizes.txt
Initial value:
1 = '''
2  Generated: %s
3 
4  Hello, this page lists the most recent round of top derivations for DC14 (2012 Period B, about 5 fb-1).
5 
6  For more information on which containers are kept and the cuts that are applied in TOPQ1, and TOPQ2, see TopDerivations)
7 
8  The p-tag used for this page is %s
9 
10  You can find derivations on rucio with:
11  =rucio list-dids data12_8TeV:*DAOD_TOPQ1*p1851= (or =TOPQ2=)
12 
13  ''' % (d_string, derivationTag)

Definition at line 141 of file sizes.py.

DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
python.sizes.printTable
def printTable(out, stream, quantity, topq1Only=False)
Definition: sizes.py:14