371 from CoolRunQuery.AtlRunQueryQueryConfig
import QC
374 h2_DefectVsLB = [
'',
'',
'',
'']
378 gStyle.SetTitleX(0.5)
379 gStyle.SetTitleAlign(23)
381 lbrange = readylb[-1]-readylb[0]
385 if len(intolerable) > 0 :
387 TCol = TColor.GetColor(
"#0f3a60")
388 hname[0]=
"%s_Intolerable_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
389 htitle =
"%s - Intolerable defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
390 h2_DefectVsLB[0] =
TH2F(
"h2_defectVsLB_%s"%hname[0],htitle,
391 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
392 len(intolerable),0.,len(intolerable))
393 h2_DefectVsLB[0].SetFillColor(TCol)
394 h2_DefectVsLB[0].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
395 SetYLabel(h2_DefectVsLB[0],[defect
for defect
in intolerable])
396 h2_DefectVsLB[0].LabelsOption(
"a",
"Y")
401 for i,item
in enumerate(intolerable):
402 ibiny = h2_DefectVsLB[0].GetYaxis().
FindBin(item)
403 binxmax = h2_DefectVsLB[0].GetXaxis().GetXmax()
404 frac = 100*
float(len(intolerable[item]))/
float(len(readylb))
406 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
408 ttext[item] = TText(binxmax,ibiny-0.8,
"")
409 ttext[item].SetTextSize(0.03)
410 ttext[item].SetTextColor(TCol)
411 for lb
in intolerable[item]:
412 if lb
not in readylb:
414 ibinx = h2_DefectVsLB[0].GetXaxis().
FindBin(lb)
415 h2_DefectVsLB[0].SetBinContent(ibinx,ibiny,1.)
418 canvas = TCanvas(
'c_Int',
"Systems Defects - %s"%hname[0], 200, 10, 1000, 800)
421 gPad.SetLeftMargin(0.40)
422 gPad.SetRightMargin(0.1)
423 h2_DefectVsLB[0].Draw(
"BOX")
424 for item
in intolerable:
427 hname[0] = QC.datapath+
"/"+hname[0]+
".png"
428 canvas.Print(hname[0])
431 if len(tolerable) > 0 :
433 all = {**tolerable, **intolerable, **ignored}
435 TCol1 = TColor.GetColor(
"#0f3a60")
436 TCol2 = TColor.GetColor(
"#a3c0d9")
437 TCol3 = TColor.GetColor(
"#4681b3")
441 hname[1]=
"%s_All_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
442 htitle =
"%s - All defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
445 h2_DefectVsLB[1] =
TH2F(
"h2_defectVsLB_int_%s"%hname[1],htitle,
446 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
447 len(all),0.,len(all))
449 h2_DefectVsLB[2] =
TH2F(
"h2_defectVsLB_tol_%s"%hname[1],htitle,
450 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
451 len(all),0.,len(all))
454 h2_DefectVsLB[3] =
TH2F(
"h2_defectVsLB_ign_%s"%hname[1],htitle,
455 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
456 len(all),0.,len(all))
458 h2_DefectVsLB[1].SetFillColor(TCol1)
459 h2_DefectVsLB[2].SetFillColor(TCol2)
460 h2_DefectVsLB[3].SetFillColor(TCol3)
462 h2_DefectVsLB[1].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
463 h2_DefectVsLB[2].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
464 h2_DefectVsLB[3].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
465 SetYLabel(h2_DefectVsLB[1],[defect
for defect
in all])
466 SetYLabel(h2_DefectVsLB[2],[defect
for defect
in all])
467 SetYLabel(h2_DefectVsLB[3],[defect
for defect
in all])
468 h2_DefectVsLB[1].LabelsOption(
"a",
"Y")
469 h2_DefectVsLB[2].LabelsOption(
"a",
"Y")
470 h2_DefectVsLB[3].LabelsOption(
"a",
"Y")
476 for i,item
in enumerate(all):
477 ibiny = h2_DefectVsLB[1].GetYaxis().
FindBin(item)
478 binxmax = h2_DefectVsLB[1].GetXaxis().GetXmax()
479 frac = 100*
float(len(all[item]))/
float(len(readylb))
481 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
483 ttext[item] = TText(binxmax,ibiny-0.8,
"")
484 ttext[item].SetTextSize(0.03)
485 if item
in intolerable:
486 ttext[item].SetTextColor(TCol1)
487 if item
in tolerable:
488 ttext[item].SetTextColor(TCol2)
490 ttext[item].SetTextColor(TCol3)
492 ibinx = h2_DefectVsLB[1].GetXaxis().
FindBin(lb)
493 if item
in intolerable:
494 h2_DefectVsLB[1].SetBinContent(ibinx,ibiny,1.)
495 if item
in tolerable:
496 h2_DefectVsLB[2].SetBinContent(ibinx,ibiny,1.)
498 h2_DefectVsLB[3].SetBinContent(ibinx,ibiny,1.)
501 canvas = TCanvas(
'c_Tol',
"Systems Defects - %s"%hname[1], 200, 10, 1000, 800)
504 gPad.SetLeftMargin(0.40)
505 gPad.SetRightMargin(0.1)
506 h2_DefectVsLB[2].Draw(
"BOX")
507 h2_DefectVsLB[3].Draw(
"BOXSAME")
508 h2_DefectVsLB[1].Draw(
"BOXSAME")
513 hname[1] = QC.datapath+
"/"+hname[1]+
".png"
514 canvas.Print(hname[1])