372 from CoolRunQuery.AtlRunQueryQueryConfig
import QC
375 h2_DefectVsLB = [
'',
'',
'',
'']
379 gStyle.SetTitleX(0.5)
380 gStyle.SetTitleAlign(23)
382 lbrange = readylb[-1]-readylb[0]
386 if len(intolerable) > 0 :
388 TCol = TColor.GetColor(
"#0f3a60")
389 hname[0]=
"%s_Intolerable_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
390 htitle =
"%s - Intolerable defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
391 h2_DefectVsLB[0] =
TH2F(
"h2_defectVsLB_%s"%hname[0],htitle,
392 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
393 len(intolerable),0.,len(intolerable))
394 h2_DefectVsLB[0].SetFillColor(TCol)
395 h2_DefectVsLB[0].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
396 SetYLabel(h2_DefectVsLB[0],[defect
for defect
in intolerable])
397 h2_DefectVsLB[0].LabelsOption(
"a",
"Y")
402 for i,item
in enumerate(intolerable):
403 ibiny = h2_DefectVsLB[0].GetYaxis().
FindBin(item)
404 binxmax = h2_DefectVsLB[0].GetXaxis().GetXmax()
405 frac = 100*
float(len(intolerable[item]))/
float(len(readylb))
407 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
409 ttext[item] = TText(binxmax,ibiny-0.8,
"")
410 ttext[item].SetTextSize(0.03)
411 ttext[item].SetTextColor(TCol)
412 for lb
in intolerable[item]:
413 if lb
not in readylb:
415 ibinx = h2_DefectVsLB[0].GetXaxis().
FindBin(lb)
416 h2_DefectVsLB[0].SetBinContent(ibinx,ibiny,1.)
419 canvas = TCanvas(
'c_Int',
"Systems Defects - %s"%hname[0], 200, 10, 1000, 800)
422 gPad.SetLeftMargin(0.40)
423 gPad.SetRightMargin(0.1)
424 h2_DefectVsLB[0].Draw(
"BOX")
425 for item
in intolerable:
428 hname[0] = QC.datapath+
"/"+hname[0]+
".png"
429 canvas.Print(hname[0])
432 if len(tolerable) > 0 :
434 all = {**tolerable, **intolerable, **ignored}
436 TCol1 = TColor.GetColor(
"#0f3a60")
437 TCol2 = TColor.GetColor(
"#a3c0d9")
438 TCol3 = TColor.GetColor(
"#4681b3")
442 hname[1]=
"%s_All_Run%s"%(sys,
str(dic[DataKey(
'Run')][run]))
443 htitle =
"%s - All defects - Run %s"%(sys,
str(dic[DataKey(
'Run')][run]))
446 h2_DefectVsLB[1] =
TH2F(
"h2_defectVsLB_int_%s"%hname[1],htitle,
447 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
448 len(all),0.,len(all))
450 h2_DefectVsLB[2] =
TH2F(
"h2_defectVsLB_tol_%s"%hname[1],htitle,
451 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
452 len(all),0.,len(all))
455 h2_DefectVsLB[3] =
TH2F(
"h2_defectVsLB_ign_%s"%hname[1],htitle,
456 lbrange,readylb[0]-0.5,readylb[-1]+0.5,
457 len(all),0.,len(all))
459 h2_DefectVsLB[1].SetFillColor(TCol1)
460 h2_DefectVsLB[2].SetFillColor(TCol2)
461 h2_DefectVsLB[3].SetFillColor(TCol3)
463 h2_DefectVsLB[1].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
464 h2_DefectVsLB[2].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
465 h2_DefectVsLB[3].GetXaxis().SetTitle(
"Lumiblocks with ATLAS Ready")
466 SetYLabel(h2_DefectVsLB[1],[defect
for defect
in all])
467 SetYLabel(h2_DefectVsLB[2],[defect
for defect
in all])
468 SetYLabel(h2_DefectVsLB[3],[defect
for defect
in all])
469 h2_DefectVsLB[1].LabelsOption(
"a",
"Y")
470 h2_DefectVsLB[2].LabelsOption(
"a",
"Y")
471 h2_DefectVsLB[3].LabelsOption(
"a",
"Y")
477 for i,item
in enumerate(all):
478 ibiny = h2_DefectVsLB[1].GetYaxis().
FindBin(item)
479 binxmax = h2_DefectVsLB[1].GetXaxis().GetXmax()
480 frac = 100*
float(len(all[item]))/
float(len(readylb))
482 ttext[item] = TText(binxmax,ibiny-0.8,
" %.2f %%"%frac)
484 ttext[item] = TText(binxmax,ibiny-0.8,
"")
485 ttext[item].SetTextSize(0.03)
486 if item
in intolerable:
487 ttext[item].SetTextColor(TCol1)
488 if item
in tolerable:
489 ttext[item].SetTextColor(TCol2)
491 ttext[item].SetTextColor(TCol3)
493 ibinx = h2_DefectVsLB[1].GetXaxis().
FindBin(lb)
494 if item
in intolerable:
495 h2_DefectVsLB[1].SetBinContent(ibinx,ibiny,1.)
496 if item
in tolerable:
497 h2_DefectVsLB[2].SetBinContent(ibinx,ibiny,1.)
499 h2_DefectVsLB[3].SetBinContent(ibinx,ibiny,1.)
502 canvas = TCanvas(
'c_Tol',
"Systems Defects - %s"%hname[1], 200, 10, 1000, 800)
505 gPad.SetLeftMargin(0.40)
506 gPad.SetRightMargin(0.1)
507 h2_DefectVsLB[2].Draw(
"BOX")
508 h2_DefectVsLB[3].Draw(
"BOXSAME")
509 h2_DefectVsLB[1].Draw(
"BOXSAME")
514 hname[1] = QC.datapath+
"/"+hname[1]+
".png"
515 canvas.Print(hname[1])