360 from CoolRunQuery.AtlRunQueryQueryConfig
import QC
363 h2_DefectVsLB = [
'',
'',
'',
'']
367 gStyle.SetTitleX(0.5)
368 gStyle.SetTitleAlign(23)
370 lbrange = readylb[-1]-readylb[0]
374 if len(intolerable) > 0 :
376 TCol = TColor.GetColor(
"#0f3a60")
377 hname[0]=
"%s_Intolerable_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
378 htitle =
"%s - Intolerable defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
379 h2_DefectVsLB[0] =
TH2F(
"h2_defectVsLB_%s"%hname[0],htitle,
380 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
381 len(intolerable),0.,len(intolerable))
382 h2_DefectVsLB[0].SetFillColor(TCol)
383 h2_DefectVsLB[0].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
384 SetYLabel(h2_DefectVsLB[0],[defect
for defect
in intolerable])
385 h2_DefectVsLB[0].LabelsOption(
"a",
"Y")
390 for i,item
in enumerate(intolerable):
391 ibiny = h2_DefectVsLB[0].GetYaxis().
FindBin(item)
392 binxmax = h2_DefectVsLB[0].GetXaxis().GetXmax()
393 frac = 100*
float(len(intolerable[item]))/
float(len(readylb))
395 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
397 ttext[item] = TText(binxmax,ibiny-0.8,
"")
398 ttext[item].SetTextSize(0.03)
399 ttext[item].SetTextColor(TCol)
400 for lb
in intolerable[item]:
401 if lb
not in readylb:
403 ibinx = h2_DefectVsLB[0].GetXaxis().
FindBin(lb)
404 h2_DefectVsLB[0].SetBinContent(ibinx,ibiny,1.)
407 canvas = TCanvas(
'c_Int',
"Systems Defects - %s"%hname[0], 200, 10, 1000, 800)
410 gPad.SetLeftMargin(0.40)
411 gPad.SetRightMargin(0.1)
412 h2_DefectVsLB[0].Draw(
"BOX")
413 for item
in intolerable:
416 hname[0] = QC.datapath+
"/"+hname[0]+
".png"
417 canvas.Print(hname[0])
420 if len(tolerable) > 0 :
422 all = {**tolerable, **intolerable, **ignored}
424 TCol1 = TColor.GetColor(
"#0f3a60")
425 TCol2 = TColor.GetColor(
"#a3c0d9")
426 TCol3 = TColor.GetColor(
"#4681b3")
430 hname[1]=
"%s_All_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
431 htitle =
"%s - All defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
434 h2_DefectVsLB[1] =
TH2F(
"h2_defectVsLB_int_%s"%hname[1],htitle,
435 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
436 len(all),0.,len(all))
438 h2_DefectVsLB[2] =
TH2F(
"h2_defectVsLB_tol_%s"%hname[1],htitle,
439 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
440 len(all),0.,len(all))
443 h2_DefectVsLB[3] =
TH2F(
"h2_defectVsLB_ign_%s"%hname[1],htitle,
444 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
445 len(all),0.,len(all))
447 h2_DefectVsLB[1].SetFillColor(TCol1)
448 h2_DefectVsLB[2].SetFillColor(TCol2)
449 h2_DefectVsLB[3].SetFillColor(TCol3)
451 h2_DefectVsLB[1].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
452 h2_DefectVsLB[2].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
453 h2_DefectVsLB[3].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
454 SetYLabel(h2_DefectVsLB[1],[defect
for defect
in all])
455 SetYLabel(h2_DefectVsLB[2],[defect
for defect
in all])
456 SetYLabel(h2_DefectVsLB[3],[defect
for defect
in all])
457 h2_DefectVsLB[1].LabelsOption(
"a",
"Y")
458 h2_DefectVsLB[2].LabelsOption(
"a",
"Y")
459 h2_DefectVsLB[3].LabelsOption(
"a",
"Y")
465 for i,item
in enumerate(all):
466 ibiny = h2_DefectVsLB[1].GetYaxis().
FindBin(item)
467 binxmax = h2_DefectVsLB[1].GetXaxis().GetXmax()
468 frac = 100*
float(len(all[item]))/
float(len(readylb))
470 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
472 ttext[item] = TText(binxmax,ibiny-0.8,
"")
473 ttext[item].SetTextSize(0.03)
474 if item
in intolerable:
475 ttext[item].SetTextColor(TCol1)
476 if item
in tolerable:
477 ttext[item].SetTextColor(TCol2)
479 ttext[item].SetTextColor(TCol3)
481 ibinx = h2_DefectVsLB[1].GetXaxis().
FindBin(lb)
482 if item
in intolerable:
483 h2_DefectVsLB[1].SetBinContent(ibinx,ibiny,1.)
484 if item
in tolerable:
485 h2_DefectVsLB[2].SetBinContent(ibinx,ibiny,1.)
487 h2_DefectVsLB[3].SetBinContent(ibinx,ibiny,1.)
490 canvas = TCanvas(
'c_Tol',
"Systems Defects - %s"%hname[1], 200, 10, 1000, 800)
493 gPad.SetLeftMargin(0.40)
494 gPad.SetRightMargin(0.1)
495 h2_DefectVsLB[2].Draw(
"BOX")
496 h2_DefectVsLB[3].Draw(
"BOXSAME")
497 h2_DefectVsLB[1].Draw(
"BOXSAME")
502 hname[1] = QC.datapath+
"/"+hname[1]+
".png"
503 canvas.Print(hname[1])