203 if len(sys.argv) != 2:
204 print(
"input file needed!")
208 print(filename+
" -- "+filename[19:25])
209 runNum=filename[19:25]
211 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/"
212 dirFED=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/FED/"
215 dirBPix=dir +
"PXBarrel/"
216 dirFPix=dir +
"PXForward/"
218 hoccB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_"
219 hoccF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_"
220 hdeadB=
"Dead Channels per ROC_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_"
221 hdeadF=
"Dead Channels per ROC_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_"
223 ROOT.gROOT.SetBatch(1)
224 ROOT.gStyle.SetOptStat(0)
225 ROOT.gStyle.SetPalette(1)
226 ROOT.gStyle.SetNumberContours(128)
227 rootf=ROOT.TFile(filename)
231 c=ROOT.TCanvas(
"c",
"c",1250,1000)
233 print(
"----> Build maps for BPix")
236 for lyr
in range(1,5):
237 histOccList.append(rootf.FindObjectAny(hoccB+
str(lyr)))
238 histDeadList.append(rootf.FindObjectAny(hdeadB+
str(lyr)))
239 for hist1, hist2
in zip(histOccList, histDeadList):
240 if hist1 !=
None or hist2 !=
None:
242 match=re.search(
'(?<=PXLayer_)[0-9]',hist1.GetName())
243 if match !=
None and "per_SignedModuleCoord_per_SignedLadderCoord" in hist1.GetName():
244 lyr=int(match.group(0))
245 hist1.SetTitle(
"Digi Occupancy Layer {0}".
format(lyr))
257 for biny
in range(1,hist2.GetNbinsY()+1):
259 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
260 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
261 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
262 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
263 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
264 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
266 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
268 for binx
in range(1,hist2.GetNbinsX()+1):
269 if hist2.GetBinContent(binx,biny)!=0:
273 if len(binTBM)==tbmRoc:
274 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
275 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
276 y1=hist2.GetYaxis().GetBinLowEdge(biny)
277 y2=hist2.GetYaxis().GetBinUpEdge(biny)
278 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
279 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
281 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
288 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
289 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
290 y1=hist2.GetYaxis().GetBinLowEdge(biny)
291 y2=hist2.GetYaxis().GetBinUpEdge(biny)
292 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
293 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
295 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
296 c.SaveAs(
'MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
297 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedOccupancyDeadROC_BPix_Layer{0}_TBM.png -r144 -q MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
298 os.system(
'rm -f MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
300 print(
"Some Error in get the histograms for FPIX")
302 print(
"----> Build maps for FPix")
303 for rng
in range(1,3):
304 histOccList.append(rootf.FindObjectAny(hoccF+
str(rng)))
305 histDeadList.append(rootf.FindObjectAny(hdeadF+
str(rng)))
306 for hist1, hist2
in zip(histOccList, histDeadList):
307 if hist1 !=
None or hist2 !=
None:
309 match=re.search(
'(?<=PXRing_)[0-9]',hist1.GetName())
310 if match !=
None and "per_SignedDiskCoord_per_SignedBladePanelCoord" in hist1.GetName():
311 ring=int(match.group(0))
312 hist1.SetTitle(
"Digi Occupancy Ring {0}".
format(ring))
321 for biny
in range(1,hist2.GetNbinsY()+1):
323 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
324 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
325 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
326 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
327 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
328 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
330 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
332 for binx
in range(1,hist2.GetNbinsX()+1):
333 if hist2.GetBinContent(binx,biny)!=0:
337 if len(binTBM)==tbmRoc:
338 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
339 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
340 y1=hist2.GetYaxis().GetBinLowEdge(biny)
341 y2=hist2.GetYaxis().GetBinUpEdge(biny)
342 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
343 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
345 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
352 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
353 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
354 y1=hist2.GetYaxis().GetBinLowEdge(biny)
355 y2=hist2.GetYaxis().GetBinUpEdge(biny)
356 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
357 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
359 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
360 c.SaveAs(
'MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
361 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedOccupancyDeadROC_FPix_Ring{0}_TBM.png -r144 -q MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
362 os.system(
'rm -f MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
365 print(
"Some Error in get the histograms for FPIX")