ATLAS Offline Software
AtlRunQueryHtmlUtils.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 import time, datetime
4 
5 from CoolRunQuery.AtlRunQueryRun import Run
6 from CoolRunQuery.AtlRunQueryQueryConfig import QC
7 
8 def WrapIntoHTML(content, title="Run query result", extracss=None):
9  wrap = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
10  wrap += '<html xmlns:"my"><head><title>%s</title>' % title
11  wrap += '<LINK href="atlas-runquery-lb.css" rel="stylesheet" type="text/css">'
12  if extracss:
13  for css in extracss:
14  wrap += '<LINK href="%s" rel="stylesheet" type="text/css">' % css
15  wrap += '</head>'
16  wrap += '<body>%s</body></html>' % content
17  return wrap
18 
19 
20 def OpenWindow(content, title="Run query result", extracss=None, size="normal"):
21  wrap = WrapIntoHTML(content, title, extracss)
22  openWindowCmd = 'openWindow'
23  if size=='large':
24  openWindowCmd = 'openLargeWindow'
25  return "<a href=\"javascript:%s('Print', '%s')\">" % ( openWindowCmd, wrap.replace('"','&quot') )
26 
27 
28 def CreatePopupHtmlPage(name,wincontent):
29  filename = 'popupContent_%s.html' % name
30  outfn = '%s/%s' % (QC.datapath, filename)
31  fh = open(outfn,"w")
32  if type(wincontent)==list:
33  for line in wincontent:
34  print (line, file = fh)
35  else:
36  print (wincontent, file = fh)
37  fh.close()
38  return outfn
39 
40 
41 
42 def CreateLBTable(run):
43  body = '<table class="outer">'
44  body += '<tr><td><b>LB start times (%s) and durations for run %i:</b><br>' % (QC.tzdesc(),run.runNr)
45  body += '<font size="-1" color="#888888">(Begin/end of run: %s)</font>' % run.timestr('html', run.runNr != Run.runnropen)
46  body += '<hr color="black" size=1>'
47  body += '<table class="lb">'
48  body += '<tr><th>LB</th><th>Start time (%s)</th><th>Duration (sec)</th></tr>' % QC.tzdesc()
49  body += '<tr>'
50  for idx,(lbtime,lbendtime) in enumerate(run.lbtimes):
51  lb=idx+1
52  timetuple = time.localtime(lbtime/1.E9) if QC.localtime else time.gmtime(lbtime/1.E9)
53  body += '<tr><td>%s</td><td>%s</td><td>%.2f</td></tr>' % (lb, time.strftime('%X',timetuple), (float(lbendtime)-float(lbtime))/1.E9)
54  if run.runNr == Run.runnropen: # run still ongoing
55  body += '<tr><td style="text-align:left"colspan="3"><i>&nbsp;&nbsp;Run still ongoing ...</i></td></tr>'
56  body += '</tr></table>'
57  body += '<hr color="red" size=1><font color="#777777"><font size="-1"><i><font size="-2">Created by AtlRunQuery on: %s</font></i></font></td></tr></table>' % str(datetime.datetime.now())
58  body += '</td></tr></table>'
59  return body.replace('"','&quot')
60 
61 
62 
63 def CreateLBTooltip(run):
64  if len(run.lbtimes)==0:
65  return
66 
67  content = '<strong><b>LB start times (%s) and durations for run %i:</b></strong><br>Begin/end of run: %s' % (QC.tzdesc(), run.runNr, run.timestr('html', run.runNr != Run.runnropen))
68  content += '<hr style="width:100%; background-color: #BBBBBB; height:1px; margin-left:0; border:0"/>'
69  content += '<table style="width: auto; border: 0px solid; border-width: margin: 0 0 0 0; 0px; border-spacing: 0px; border-collapse: separate; padding: 0px; font-size: 90%">'
70  content += '<tr>'
71  if len(run.lbtimes) > 150:
72  content += '<td><i>Too many LBs to show ... (click instead!)</i></td>'
73  else:
74  for idx,(lbstart, lbend) in enumerate(run.lbtimes):
75  lb=idx+1
76  timetuple = time.localtime(lbstart/1.E9) if QC.localtime else time.gmtime(lbstart/1.E9)
77  content += '<td style="text-align:right">&nbsp;&nbsp;%s:&nbsp;%s&nbsp;</td><td style="text-align:right">(%.1f&nbsp;sec)</td>' % (lb, time.strftime("%X",timetuple), (float(lbend)-float(lbstart))/1.E9)
78  if lb%6==0:
79  content += '</tr><tr>'
80  content += '</tr></table>'
81  content += '<hr style="width:100%; background-color: #BBBBBB; height:1px; margin-left:0; border:0"/>'
82  content += '<font color="#AA0000">Click to obtain full list in independent window!</font>'
83  run.addToolTip( 'LBStart_%i' % run.runNr, content )
84 
85 
86 
87 def CreateDQTooltip(run):
88  if 'DQ' not in Run.ShowOrder:
89  return
90 
91  def_with_primaries = run.stats['DQ']["primaries"]
92  condensed = True
93  if not condensed:
94  for x in sorted(def_with_primaries.keys()):
95  l_ready = [y for y in def_with_primaries[x] if run.data.isReady( (y.since,y.until) )]
96  if len(l_ready)==0:
97  continue
98  content = '<strong><b>%s: comments for run %i:</b></strong><br><span style="font-size: 80%%">ATLAS READY in LBs %s</span>' % (x,run.runNr,', '.join(["%i&minus;%i" % (r.startlb, r.endlb-1) for r in run.data.isReady()]))
99  content += '<hr width="100%%">'
100  content += '<table style="width: auto; white-space: nowrap; border: 0px solid; margin: 0 0 0 0; border-spacing: 0px; border-collapse: separate; padding: 0px;">'
101  for y in l_ready:
102  s = "%i&minus;%i" % (y.since,y.until-1) if y.until-y.since!=1 else "%i" % (y.since)
103  content += '<tr><td style="color:blue; padding-right: 5px;">LB %s</td>' % s # the LB info
104  content += '<td style="font-weight:bold; padding-right: 5px;">%s</td><td><i>%s</i></td></tr>' % (y.description.split("->")[-1], y.comment) # the primary and the comment
105  content += '</table>'
106  run.addToolTip("dqdefect_%i_%s" % (run.runNr,x), content)
107  else:
108  from itertools import groupby
109  from operator import attrgetter
110  gr = {}
111  for k in def_with_primaries:
112  d = {}
113  for p,v in groupby(sorted(def_with_primaries[k]), key=attrgetter('description', 'comment')):
114  d[p] = [(e.since, e.until) for e in v]
115  gr[k] = d
116 
117  for x in sorted(gr):
118  content = '<strong><b>%s: comments for run %i:</b></strong><br><span style="font-size: 80%%">ATLAS READY in LBs %s</span>' % (x,run.runNr,', '.join(["%i&minus;%i" % (r.startlb, r.endlb-1) for r in run.data.isReady()]))
119  content += '<hr width="100%%">'
120  content += '<table style="width: auto; white-space: nowrap; border: 0px solid; margin: 0 0 0 0; border-spacing: 0px; border-collapse: separate; padding: 0px;">'
121  for pdef in sorted(gr[x]):
122  l_ready = [y for y in gr[x][pdef] if run.data.isReady( y )]
123  if len(l_ready)==0:
124  continue
125  s = ", ".join(["%i&minus;%i" % y if y[1]-y[0]!=1 else "%i" % (y[0]) for y in l_ready])
126  content += '<tr><td colspan="2" style="color:blue; padding-right: 5px; max-width: 130;">LB %s</td></tr>' % s # the LB info
127  content += '<tr><td style="font-weight:bold; padding-right: 5px;">%s</td><td><i>%s</i></td></tr>' % (pdef[0].split("->")[-1], pdef[1]) # the primary and the comment
128  content += '</table>'
129  run.addToolTip("dqdefect_%i_%s" % (run.runNr,x), content)
130 
131 
133  if not run.stats[k.ResultKey]['StrOverlap']:
134  ovstr = '<tr><td width="200"><b><i>None (or not available for this run)</i></b></td></tr>'
135  else:
136  ovstr = ''
137  nacc=0
138  for stream, fraction in run.stats[k.ResultKey]['StrOverlap']:
139  nacc+=1
140  tdstr = '<td class="tdov%i">' % (nacc%2+1)
141  fs = "%.2g" % fraction
142  if fraction==100:
143  fs = "100"
144  ovstr += '<tr>%s%s</td>%s&nbsp;=&nbsp;</td>%s%s%%</td></tr>' % (tdstr, stream, tdstr, tdstr, fs)
145  strpairs = [('STR:physics_MuonswBeam', 'physics_L1Calo'),
146  ('STR:physics_MinBias', 'physics_L1Calo'),
147  ('STR:physics_Muons', 'physics_Egamma'),
148  ('STR:physics_Muons', 'physics_JetTauEtmiss'),
149  ('STR:physics_Egamma', 'physics_JetTauEtmiss'),
150  ('STR:physics_MinBias', 'physics_JetTauEtmiss')]
151  for st in strpairs:
152  if k==st[0] and stream==st[1]:
153  s1 = st[0].replace('STR:','')
154  fname = 'data_' + s1.strip() + '_' + st[1].strip() + '.txt'
155  f = open(QC.datapath + '/' + fname,'a')
156  f.write('%i %f\n' % (run.runNr,fraction))
157  f.close()
158  break
159 
160  boxcontent = '<table class="streamtiptable"><tr><td>'
161  boxcontent += '<strong><b>Info&nbsp;for&nbsp;stream:&nbsp;<font color="#AA0000">%s</font></b></strong>' % k.Header[4:]
162  boxcontent += '</td></tr><tr><td>'
163  boxcontent += '<hr style="width:100%; background-color: #999999; height:1px; margin-left:0; border:0"/>'
164  boxcontent += '</td></tr>'
165  boxcontent += '<tr><td>'
166  boxcontent += '<strong><b>Stream&nbsp;overlaps</b></strong>&nbsp;(nonzero&nbsp;overlaps&nbsp;only):'
167  boxcontent += '</td></tr><tr><td>'
168  boxcontent += '<table class="overlaptable">%s</table><strong>' % ovstr
169  boxcontent += '</td></tr>'
170 
171  # Tier-0 output
172  prodsteps = ['StrTier0TypesRAW', 'StrTier0TypesESD' ]
173  allt0text = ''
174  for p in prodsteps:
175  if p in run.stats[k.ResultKey]:
176  typelist = list(run.stats[k.ResultKey][p])
177  if not typelist:
178  continue
179 
180  typelist.sort()
181  t0text = ''
182  for i, t0out in enumerate(typelist):
183  if 'TMP' not in t0out: # don't show temporary output
184  if i%4==0 and i>0:
185  t0text += '<br>'
186  if t0out == 'NTUP':
187  t0outtxt = 'NTUP_... <font size="-2">(types as above)</font>' # stands for all NTUP types in merge step
188  else:
189  t0outtxt = t0out
190  if run.stats[k.ResultKey][p][t0out]: # output on CAF
191  t0text += '<font color="#BB0000">%s</font>, ' % t0outtxt
192  else:
193  t0text += '%s, ' % t0outtxt
194 
195  if t0text != '':
196  allt0text += '<strong><b><i>'
197  if 'RAW' in p:
198  allt0text += 'Produced&nbsp;by&nbsp;reconstruction&nbsp;step'
199  if 'StrTier0AMI' in run.stats[k.ResultKey] and run.stats[k.ResultKey]['StrTier0AMI']:
200  if p in run.stats[k.ResultKey]['StrTier0AMI']:
201  allt0text += '&nbsp;(AMI&nbsp;tag:&nbsp;%s)' % run.stats[k.ResultKey]['StrTier0AMI'][p]
202  else:
203  allt0text += '&nbsp;(AMI&nbsp;tag:&nbsp;%s)' % 'UNKNOWN'
204  else:
205  allt0text += 'Produced&nbsp;by&nbsp;merge&nbsp;step'
206 
207  allt0text += ':</i></b></strong>'
208 
209  allt0text += '<table class="overlaptable"><tr><td style="padding-left:10px">' + t0text[:len(t0text)-2] + '</td></tr></table>'
210  if p != prodsteps[-1]:
211  allt0text += ''
212 
213  if allt0text != '':
214  boxcontent += '<tr><td>'
215  boxcontent += '<hr style="width:100%; background-color:#999999; height:1px; margin-left:0; border:0"/>'
216  boxcontent += '</td></tr><tr><td>'
217  boxcontent += '<strong><b>Tier-0 output types for this stream:</b></strong><br>(Datasets in <font color="#BB000"><strong><b>red</b></strong></font> are <font color="#BB000">replicated to CAF</font>'
218  boxcontent += '</td></tr><tr><td>'
219  boxcontent += '<table class="overlaptable" style="color:#222222"><tr><td>%s</td></tr></table>' % allt0text
220  boxcontent += '</td></tr>'
221 
222  # events-per-LB information
223  lbrecinfo = run.stats[k.ResultKey]['LBRecInfo']
224  if not lbrecinfo:
225  lbrecinfo = '<tr><td style="font-size:75%"><i>No LB information in SFO DB. <br> Probably because files for this stream <br>were not closed at LB boundaries by SFO.</i></td></tr>'
226  else:
227  ev = dict(lbrecinfo)
228  for lb in ev:
229  ev[lb]=0
230  for lb,nev in lbrecinfo:
231  ev[lb] += nev
232  lbs = sorted(ev.keys())
233  output = '<tr>'
234  idx = 0
235  while idx <len(lbs):
236  output += '<td style="font-size:75%%;text-align:right">%i&nbsp;(%s)</td>' % (lbs[idx],ev[lbs[idx]])
237  if len(lbs)>50 and idx==23:
238  output += '</tr><tr><td style="font-size:75%; text-align:left" colspan="8">&nbsp;... <i>too many LBs ... show begin and end of run only...</i></td></tr>'
239  idx = len(lbs) - 23
240  elif (idx+1)%8==0:
241  output += '</tr><tr>' # newline every 10
242  idx += 1
243  output += '</tr>'
244  lbrecinfo = output
245 
246  boxcontent += '<tr><td>'
247  boxcontent += '<hr style="width:100%; background-color:#999999; height:1px; margin-left:0; border:0"/>'
248  boxcontent += '<strong><b>Recorded LB (#Events)</b></strong></strong>:'
249  boxcontent += '</td></tr><tr><td>'
250  boxcontent += '<table class="eventsperlbstreamtable" style="color:#222222">%s</table>' % lbrecinfo
251  boxcontent += '</td></tr></table>'
252  if 'No LB information' not in lbrecinfo:
253  boxcontent += '<font color="#AA0000"><strong><b>Click to obtain the full LB list and plots in independent window!</b></strong></font>'
254 
255  run.addToolTip("STROV_%i_%s" % (run.runNr, k.ResultKey[4:]), boxcontent)
256 
257 
258 
259 
260 
262  from CoolRunQuery.output.AtlRunQueryRoot import makeRatePlot
263  histoText = '' # upper left on above the histogramm
264 
265  lbduration = [(idx+1,lbtime,(lbendtime-lbtime)/1e9) for idx,(lbtime,lbendtime) in enumerate(run.lbtimes) ]
266 
267  duration = (run.lbtimes[-1][1] - run.lbtimes[0][0])/1e9
268  averrate = []
269  for tr in v:
270  averrate.append((tr, sum([int(co[3]) for co in v[tr]])/duration))
271  averrate.sort(lambda x,y: y[1]-x[1])
272 
273  paths = []
274  wincmds = []
275  triggergroups = []
276  loopcntr = 0
277  plotstart = 0
278  plotrange = 8
279  triggers_in_range = averrate[plotstart:plotstart+plotrange]
280  while len(triggers_in_range)>0:
281  path = makeRatePlot( v, lbduration, triggers_in_range, averrate, 'Luminosity block number', 'Rate [Hz]',
282  'trigcounts%i_vs_lb_run_%i' % (loopcntr,run.runNr),
283  'Trigger Rates for run %i' % (run.runNr),
284  QC.datapath, histoText )
285  paths += [path]
286 
287  wincmd = createRateWinContent(loopcntr, v, lbduration, triggers_in_range, run, path)
288  wincmds += [wincmd]
289 
290  triggergroups += [triggers_in_range]
291 
292  loopcntr += 1
293  plotstart += plotrange
294  triggers_in_range = averrate[plotstart:plotstart+plotrange]
295 
296  return triggergroups,paths,wincmds
297 
298 
299 
300 
301 def createRateWinContent(loopcntr, v, lbduration, triggers_in_range, run, path):
302 
303  triggers = [tr[0] for tr in triggers_in_range]
304 
305  # create window and tooltip
306  wincontent = ['<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">']
307  wincontent += ['<html xmlns:"my">']
308  wincontent += [' <head>']
309  wincontent += [' <title>Run query result for trigger rates</title>']
310  wincontent += [' <LINK href="atlas-runquery-lb.css" rel="stylesheet" type="text/css">']
311  wincontent += [' </head>']
312  wincontent += [' <body>']
313  wincontent += [' <table class="outer" style="padding: 5px">']
314  wincontent += [' <tr><td><strong><b>Trigger rates for run %s:</b></strong><br><font size="-1" color="#888888">(Begin/end of run: %s)</font></td></tr>' % (run.runNr, run.timestr('html', run.runNr != Run.runnropen))]
315  wincontent += [' <tr><td colspan="2"><hr color="black" size=1></td></tr>']
316  wincontent += [' <tr><td><img src="%s" align="left"></td>' % path.rsplit('/')[-1]]
317  wincontent += [' <td><img src="%s" align="left"></td></tr>' % path.rsplit('/')[-1].replace('.png','_log.png')]
318  wincontent += [' <tr><td colspan="2"><hr color="black" size=1></td></tr>']
319  wincontent += [' <tr><td colspan="2" style="font-size:70%; height:30px; text-align: right; vertical-align: middle;"><b>TBP</b> - <i>trigger before prescale</i>,<b>TAV</b> - <i>trigger after veto</i>, <b>DTF</b> - <i>dead time fraction</i></td></tr>']
320  wincontent += [' <tr><td colspan="2">']
321  wincontent += [' <table class="LB">']
322  header = '<th>LB</th><th>Start time</th><th>Duration</th>'
323  header2 = '<th></th><th>(%s)</th><th>(s)</th>' % QC.tzdesc()
324  for tr in triggers:
325  if "UNPAIRED" in tr or "EMPTY" in tr or "FILLED" in tr:
326  header += '<th colspan="3">%s<BR>_%s</th>' % tuple(tr.rsplit('_',1))
327  else:
328  header += '<th colspan="3">%s</th>' % tr
329  header2 += '<th>TBP</th><th>TAV</th><th>DTF</th>'
330  wincontent += [' <thead>']
331  wincontent += [' <tr>%s</tr>' % header]
332  wincontent += [' <tr class="second">%s</tr>' % header2]
333  wincontent += [' </thead>']
334  wincontent += [' <tbody>']
335  for lb, lbstart, dt in lbduration:
336  timetuple = time.localtime(lbstart/1.E9) if QC.localtime else time.gmtime(lbstart/1.E9)
337  linecontent = '<td>%i</td><td>%s</td><td class="dt">%3.1f</td>' % (lb,time.strftime("%X",timetuple),dt)
338  for tr in triggers:
339  _lb,bp,ap,av = v[tr][lb-1]
340  try:
341  avr=float(av)/dt
342  except ValueError:
343  avr=0
344  try:
345  bpr=float(bp)/dt
346  except ValueError:
347  bpr=0
348  try:
349  apr=float(ap)/dt
350  except ValueError:
351  apr=0
352  deadtime=0
353  bg = ""
354  if apr>0:
355  deadtime = ( apr - avr ) / apr
356  if deadtime>0.90:
357  bg=' style="background-color: #ff0000;"'
358  elif deadtime>0.30:
359  bg=' style="background-color: #ff3333;"'
360  elif deadtime>0.10:
361  bg=' style="background-color: #ff6666;"'
362  elif deadtime>0.05:
363  bg=' style="background-color: #ff9999;"'
364  elif deadtime>0.01:
365  bg=' style="background-color: #ffcccc;"'
366  linecontent += '<td>%3.1f</td><td>%3.1f</td><td%s class="dt">(%2.1f%%)</td>' % (bpr,avr,bg,100*deadtime)
367  if lb%2!=0:
368  col = '#eeeeee'
369  else:
370  col = '#ffffff'
371  wincontent += [' <tr style="background:%s">%s</tr>' % (col,linecontent)]
372 
373  if run.runNr == Run.runnropen: # run still ongoing
374  wincontent += [' <tr><td style="text-align:left"colspan="%i"><i>&nbsp;&nbsp;Run still ongoing ...</i></td></tr>' % (len(triggers)+1)]
375  wincontent += [' </tbody>']
376  wincontent += [' </table>']
377  wincontent += [' </td></tr>']
378  wincontent += [' <tr><td colspan="2"><hr color="red" size=1></td></tr>']
379  wincontent += [' <tr><td colspan="2">']
380  wincontent += [' <font color="#777777" size="-1"><i><font size="-2">Created by AtlRunQuery on: %s</font></i></font>' % str(datetime.datetime.now())]
381  wincontent += [' </td></tr>']
382  wincontent += [' </table>']
383  wincontent += [' </body>']
384  wincontent += ['</html>']
385 
386  CreatePopupHtmlPage('trRates_%i_%i' % (run.runNr, loopcntr), wincontent)
387  return ''
388 
389 
390 
391 
392 
394  from CoolRunQuery.output.AtlRunQueryRoot import makeLBPlotSummaryForLHC
395  # make summary of all LHC information
396  # requires: beam intensities, beam energy, stable beams
397  # keys = [ 'olc:beam1intensity', 'olc:beam2intensity', 'lhc:beamenergy', 'olc:lumi:0' ]
398  lbrange = range(run.lastlb+1)
399  yvec = [(run.lastlb+1)*[0], (run.lastlb+1)*[0], (run.lastlb+1)*[-1]] # note that this is not the same as 3*[[]]
400  ymax = 3*[-1]
401 
402  # stable beams
403  hasStableBeamsInfo, xvecStb = run.getStableBeamsVector()
404  for ik,k in enumerate( [ 'olc:beam1intensity', 'olc:beam2intensity', 'lhc:beamenergy' ] ):
405  if k not in Run.ShowOrder:
406  continue
407  for entry in run.data[k]:
408  if entry.startlb == 0:
409  continue
410 
411  val = float(entry.value) if (entry.value!='n.a.') else 0
412 
413  if ik==0 or ik==1:
414  if val > 1e30:
415  val = 0
416  val *= 1.0 # beam intensities in 10^11 protons
417  elif ik==2:
418  if val >= 7864:
419  val = -1
420 
421  lastlb = min(entry.lastlb,run.lastlb)
422 
423  for lb in range(entry.startlb,lastlb+1):
424  yvec[ik][lb] = val
425 
426  for ilb in range(entry.startlb,lastlb+1):
427  if val > ymax[ik]:
428  if not hasStableBeamsInfo or ilb in xvecStb:
429  ymax[ik] = val # find max
430 
431  histoText = ''
432  path = makeLBPlotSummaryForLHC( lbrange, xvecStb, yvec, run.runNr, QC.datapath, histoText )
433 
434  return path, lbrange, yvec, ymax
435 
436 
437 def makeSummaryPageForLHC(run, yvec, path):
438  # create window and tooltip
439  wincontent = '<table class=&quot;outer&quot; style=&quot;padding: 5px; font-family: sans-serif; font-size: 85%&quot;><tr><td>'
440  wincontent += '<strong><b>LHC beam energy and intensities during run %i:</b></strong><br><font size=&quot;-1&quot;><font color=&quot;#888888&quot;>(Begin/end of run: %s)</font></font><hr color=&quot;black&quot; size=1>' % (run.runNr, run.timestr('html', run.runNr != Run.runnropen))
441  wincontent += '<table style=&quot;padding: 0px&quot;><tr><td>'
442  wincontent += '<img src=&quot;%s&quot; align=&quot;left&quot;></td>' % path
443  wincontent += '</td></tr></table>'
444  wincontent += '<hr color=&quot;black&quot; size=1>'
445  wincontent += '<table class=&quot;lb&quot;>'
446  wincontent += '<tr><th style=&quot;text-align:right&quot;>LB</th><th style=&quot;text-align:right&quot;>&nbsp;&nbsp;&nbsp;Start time<br> (%s)</th><th style=&quot;text-align:right&quot;>&nbsp;&nbsp;&nbsp;Duration<br>(sec)</th><th style=&quot;text-align:right&quot;>&nbsp;&nbsp;&nbsp;Beam energy<br>(GeV)</th><th style=&quot;text-align:right&quot;>&nbsp;&nbsp;&nbsp;Intensity Beam-1<br>(1e11&nbsp;protons)</th><th style=&quot;text-align:right&quot;>&nbsp;&nbsp;&nbsp;Intensity Beam-2<br>(1e11&nbsp;protons)</th>' % QC.tzdesc()
447  wincontent += '</tr><tr style=&quot;background:%s&quot;>' % '#eeeeee'
448  nbeam1intensity = len(yvec[0])
449  nbeam2intensity = len(yvec[1])
450  nbeamenergy = len(yvec[2])
451  for idx,(lbtime,lbendtime) in enumerate(run.lbtimes):
452  lb=idx+1
453  timetuple = time.localtime(lbtime/1.E9) if QC.localtime else time.gmtime(lbtime/1.E9)
454  beam1intensity = yvec[0][idx] if idx<nbeam1intensity else 0
455  beam2intensity = yvec[1][idx] if idx<nbeam2intensity else 0
456  beamenergy = yvec[2][idx] if idx<nbeamenergy else 0
457  wincontent += '<td>%i</td><td>%s</td><td>%.2f</td><td>%i</td><td>%.4g</td><td>%.4g</td>' % (lb, time.strftime("%X",timetuple), (float(lbendtime)-float(lbtime))/1.E9, beamenergy, beam1intensity, beam2intensity)
458  if idx%2!=0:
459  col = '#eeeeee'
460  else:
461  col = '#ffffff'
462  wincontent += '</tr><tr style=&quot;background:%s&quot;>' % col
463  if run.runNr == Run.runnropen: # run still ongoing
464  wincontent += '<tr><td style=&quot;text-align:left&quot;colspan=&quot;4&quot;><i>&nbsp;&nbsp;Run still ongoing ...</i></td></tr>'
465  wincontent += '</tr></table>'
466  wincontent += """<hr color=&quot;red&quot; size=1><font color=&quot;#777777&quot;><font size=&quot;-1&quot;><i><font size=&quot;-2&quot;>Created by AtlRunQuery on: %s</font></i></font></td></tr></table>""" % str(datetime.datetime.now())
467  return wincontent
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
python.html.AtlRunQueryHtmlUtils.CreateLBTooltip
def CreateLBTooltip(run)
Definition: AtlRunQueryHtmlUtils.py:63
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.html.AtlRunQueryHtmlUtils.createRateWinContent
def createRateWinContent(loopcntr, v, lbduration, triggers_in_range, run, path)
Definition: AtlRunQueryHtmlUtils.py:301
python.html.AtlRunQueryHtmlUtils.WrapIntoHTML
def WrapIntoHTML(content, title="Run query result", extracss=None)
Definition: AtlRunQueryHtmlUtils.py:8
python.html.AtlRunQueryHtmlUtils.OpenWindow
def OpenWindow(content, title="Run query result", extracss=None, size="normal")
Definition: AtlRunQueryHtmlUtils.py:20
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
python.html.AtlRunQueryHtmlUtils.makeSummaryPageForLHC
def makeSummaryPageForLHC(run, yvec, path)
Definition: AtlRunQueryHtmlUtils.py:437
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.html.AtlRunQueryHtmlUtils.createRatePopupWindow
def createRatePopupWindow(v, run)
Definition: AtlRunQueryHtmlUtils.py:261
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.
min
#define min(a, b)
Definition: cfImp.cxx:40
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
python.html.AtlRunQueryHtmlUtils.CreateDQTooltip
def CreateDQTooltip(run)
Definition: AtlRunQueryHtmlUtils.py:87
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11
python.output.AtlRunQueryRoot.makeRatePlot
def makeRatePlot(v, lbduration, plottriggers, averrate, xtit, ytit, name, title, datapath, printText='')
Definition: AtlRunQueryRoot.py:852
python.html.AtlRunQueryHtmlUtils.CreatePopupHtmlPage
def CreatePopupHtmlPage(name, wincontent)
Definition: AtlRunQueryHtmlUtils.py:28
python.html.AtlRunQueryHtmlUtils.CreateLBTable
def CreateLBTable(run)
Definition: AtlRunQueryHtmlUtils.py:42
python.output.AtlRunQueryRoot.makeLBPlotSummaryForLHC
def makeLBPlotSummaryForLHC(lbrange, xvecStb, yvec, runNr, datapath, printText='')
Definition: AtlRunQueryRoot.py:209
python.html.AtlRunQueryHtmlUtils.CreateStreamOverlapTooltip
def CreateStreamOverlapTooltip(run, k)
Definition: AtlRunQueryHtmlUtils.py:132
python.html.AtlRunQueryHtmlUtils.makeSummaryPlotForLHC
def makeSummaryPlotForLHC(run)
Definition: AtlRunQueryHtmlUtils.py:393
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::split
@ split
Definition: LayerMaterialProperties.h:38