203 if len(sys.argv) != 3:
204 print(
"input files needed!")
209 print(filename+
" -- "+filename[19:25])
210 print(pclfile+
" -- "+pclfile[19:25])
211 runNum=filename[19:25]
213 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/"
214 dirERROR=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/SiPixelQualityPCL/BadROC_PCL/"
217 dirBPix=dir +
"PXBarrel/"
218 dirFPix=dir +
"PXForward/"
220 hoccB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_"
221 hoccF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_"
222 hdeadB=
"Dead Channels per ROC_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_"
223 hdeadF=
"Dead Channels per ROC_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_"
225 ROOT.gROOT.SetBatch(1)
226 ROOT.gStyle.SetOptStat(0)
227 ROOT.gStyle.SetPalette(52)
229 for i
in range(0,255):
230 color.append(ROOT.TColor.GetColorPalette(i))
231 ROOT.gStyle.SetPalette(1)
232 ROOT.gStyle.SetNumberContours(128)
233 rootf=ROOT.TFile(filename)
234 rootp=ROOT.TFile(pclfile)
238 c=ROOT.TCanvas(
"c",
"c",1250,1000)
240 print(
"----> Build maps for BPix")
243 for lyr
in range(1,5):
244 histOccList.append(rootf.FindObjectAny(hoccB+
str(lyr)))
245 histDeadList.append(rootp.Get(dirERROR+hdeadB+
str(lyr)))
246 for hist1, hist2
in zip(histOccList, histDeadList):
247 if hist1 !=
None or hist2 !=
None:
249 match=re.search(
'(?<=PXLayer_)[0-9]',hist1.GetName())
250 if match !=
None and "per_SignedModuleCoord_per_SignedLadderCoord" in hist1.GetName():
251 lyr=int(match.group(0))
252 hist1.SetTitle(
"Digi Occupancy Layer {0}".
format(lyr))
265 maxx=hist2.GetMaximum()
266 for biny
in range(1,hist2.GetNbinsY()+1):
268 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
269 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
270 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
271 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
272 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny-1)/maxx))],0,1,lineWd)
275 for binx
in range(1,hist2.GetNbinsX()+1):
278 elif hist2.GetBinContent(binx,biny)==hist2.GetBinContent(binTBM[len(binTBM)-1],biny):
282 if hist2.GetBinContent(binx,biny)!=0
and check:
286 if len(binTBM)==(tbmRoc):
287 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
288 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
289 y1=hist2.GetYaxis().GetBinLowEdge(biny)
290 y2=hist2.GetYaxis().GetBinUpEdge(biny)
291 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
299 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
300 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
301 y1=hist2.GetYaxis().GetBinLowEdge(biny)
302 y2=hist2.GetYaxis().GetBinUpEdge(biny)
303 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
305 if hist2.GetBinContent(binx,biny)!=0:
307 c.SaveAs(
'MergedPCLDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
308 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedPCLDeadROC_BPix_Layer{0}_TBM.png -r144 -q MergedPCLDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
309 os.system(
'rm -f MergedPCLDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
311 print(
"Some Error in get the histograms for FPIX")
313 print(
"----> Build maps for FPix")
314 for rng
in range(1,3):
315 histOccList.append(rootf.FindObjectAny(hoccF+
str(rng)))
316 histDeadList.append(rootp.Get(dirERROR+hdeadF+
str(rng)))
317 for hist1, hist2
in zip(histOccList, histDeadList):
318 if hist1 !=
None or hist2 !=
None:
320 match=re.search(
'(?<=PXRing_)[0-9]',hist1.GetName())
321 if match !=
None and "per_SignedDiskCoord_per_SignedBladePanelCoord" in hist1.GetName():
322 ring=int(match.group(0))
323 hist1.SetTitle(
"Digi Occupancy Ring {0}".
format(ring))
332 maxx=hist2.GetMaximum()
333 for biny
in range(1,hist2.GetNbinsY()+1):
335 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
336 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
337 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
338 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
339 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny-1)/maxx))],0,1,lineWd)
341 for binx
in range(1,hist2.GetNbinsX()+1):
344 elif hist2.GetBinContent(binx,biny)==hist2.GetBinContent(binTBM[len(binTBM)-1],biny):
348 if hist2.GetBinContent(binx,biny)!=0
and check:
352 if len(binTBM)==tbmRoc:
353 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
354 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
355 y1=hist2.GetYaxis().GetBinLowEdge(biny)
356 y2=hist2.GetYaxis().GetBinUpEdge(biny)
357 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
364 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
365 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
366 y1=hist2.GetYaxis().GetBinLowEdge(biny)
367 y2=hist2.GetYaxis().GetBinUpEdge(biny)
368 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
370 if hist2.GetBinContent(binx,biny)!=0:
372 c.SaveAs(
'MergedPCLDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
373 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedPCLDeadROC_FPix_Ring{0}_TBM.png -r144 -q MergedPCLDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
374 os.system(
'rm -f MergedPCLDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
377 print(
"Some Error in get the histograms for FPIX")