280 colours = [ c_NovelRed, 4, c_DarkOrange, c_DarkGreen, c_Violet, c_LightBlue, 3, c_VDarkYellow, c_Gray,
281 1, 2, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 ]
284 run_and_time =
sorted(rootstreamdic[DataKey(
'Start and endtime')])
285 runs = [x[0]
for x
in run_and_time]
289 tmin =
min([x[1][0]
for x
in run_and_time])
290 tmax =
max([x[1][1]
for x
in run_and_time])
293 tminS = time.gmtime(tmin)
294 tmaxS = time.gmtime(tmax)
302 maxnev = {
'all_':-1,
'debug_':-1,
'calibration_':-1 }
303 for key, content
in rootstreamdic.iteritems():
304 if type(key)==DataKey:
306 if 'Start and endtime' not in key:
307 graphs.append( TGraph( len(content) ) )
308 graphs[-1].SetName( key.strip().
replace(
' ',
'_') )
309 graphs[-1].SetTitle( key.strip() )
311 for i
in range(len(content)):
316 cumulsum += content[j][1]/scale
317 graphs[-1].SetPoint( i, content[j][0], cumulsum )
318 for stype
in maxnev.keys():
320 if cumulsum > maxnev[stype]:
321 maxnev[stype] = cumulsum
322 if 'debug_' not in key
and cumulsum > maxnev[
'all_']:
323 maxnev[
'all_'] = cumulsum
324 sortdic[len(graphs)-1] = cumulsum
327 sortedlist =
sorted(sortdic, key=sortdic.__getitem__, reverse=
True)
334 if 'physics_' in name
or 'express_' in name:
337 g.GetPoint( g.GetN()-1, x, y )
339 legend.SetX2( legend.GetX2() - 0.2 )
340 legend.SetY1( legend.GetY2() - 0.05 )
341 DrawGraph( g, colours[ic], 2, 1, legend, name.replace(
'physics_',
'').
replace(
'express_',
'').
replace(
'express',
'Express'),
True,
'M', TText() )
345 frame.Draw(
"sameaxis")
349 fname =
'%s/atlrunquery_%s.png' % (datapath, name)
354 htmlstr.append(
MakeHtml( [
'Events in streams %s versus run' % name], [fname],
True, 60, 5 ) )
357 c, frame, legend =
CreateCanvasAndFrame( runmin, runmax, tminS, tmaxS, maxnev[
'all_'],
'',
'million' )
362 if '#Events (streamed)' in name:
363 DrawGraph( g, c_NovelBlue, 2, 2, legend,
"Total number of streamed events" )
364 elif '#Events' == name:
365 DrawGraph( g, c_NovelBlue, 5, 1, legend,
"Total number of triggered events (excl. calib)",
True,
'M', TText() )
366 elif 'physics_' in name
or 'express_' in name:
367 DrawGraph( g, colours[ic], 2, 1, legend, name.replace(
'physics_',
'').
replace(
'express_',
'').
replace(
'express',
'Express') )
371 frame.Draw(
"sameaxis")
375 fname =
'%s/atlrunquery_physicsstreams.png' % datapath
380 htmlstr.append(
MakeHtml( [
'Events in physics streams versus run'], [fname],
True, 60, 5 ) )
384 plottypes = {
'debug_' : [
'Debug',
'thousand',
'k' ],
385 'calibration_' : [
'Calibration',
'million',
'M' ] }
388 for key, cprop
in plottypes.iteritems():
390 c, frame, legend =
CreateCanvasAndFrame( runmin, runmax, tminS, tmaxS, maxnev[key], cprop[0], cprop[1] )
391 legend.SetY1( legend.GetY1() + 0.15 )
392 legend.SetX2( legend.GetX2() - 0.15 )
398 DrawGraph( g, colours[ic], 2, 1, legend, name, ic == 0, cprop[2], TText() )
402 frame.Draw(
"sameaxis")
406 fname =
'%s/atlrunquery_%sstreams.png' % (datapath, cprop[0].lower())
411 htmlstr.append(
MakeHtml( [
'Events in %s streams versus run' % cprop[0].lower()], [fname],
True, 60, 5 ) )
414 retstr =
'<table width="900" style="margin-left: 14px; background-color: #f0f0f0; border: 2px white solid; border-collapse: collapse;"><tr>'
415 for i,s
in enumerate(htmlstr):
416 retstr +=
'<td style="padding: 4px">%s</td>' % s
418 retstr +=
'</tr><tr>'
419 retstr +=
'</tr></table>'