201 if len(sys.argv) != 2:
202 print "input file needed!" 206 print filename+
" -- "+filename[19:25]
207 runNum=filename[19:25]
209 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/" 210 dirFED=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/FED/" 213 dirBPix=dir +
"PXBarrel/" 214 dirFPix=dir +
"PXForward/" 216 hoccB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 217 hoccF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 218 hdeadB=
"Dead Channels per ROC_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 219 hdeadF=
"Dead Channels per ROC_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 221 ROOT.gROOT.SetBatch(1)
222 ROOT.gStyle.SetOptStat(0)
223 ROOT.gStyle.SetPalette(1)
224 ROOT.gStyle.SetNumberContours(128)
225 rootf=ROOT.TFile(filename)
229 c=ROOT.TCanvas(
"c",
"c",1250,1000)
231 print "----> Build maps for BPix" 234 for lyr
in range(1,5):
235 histOccList.append(rootf.FindObjectAny(hoccB+
str(lyr)))
236 histDeadList.append(rootf.FindObjectAny(hdeadB+
str(lyr)))
237 for hist1, hist2
in zip(histOccList, histDeadList):
238 if hist1 !=
None or hist2 !=
None:
240 match=re.search(
'(?<=PXLayer_)[0-9]',hist1.GetName())
241 if match !=
None and "per_SignedModuleCoord_per_SignedLadderCoord" in hist1.GetName():
242 lyr=
int(match.group(0))
243 hist1.SetTitle(
"Digi Occupancy Layer {0}".
format(lyr))
255 for biny
in range(1,hist2.GetNbinsY()+1):
257 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
258 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
259 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
260 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
261 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
262 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
264 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
266 for binx
in range(1,hist2.GetNbinsX()+1):
267 if hist2.GetBinContent(binx,biny)!=0:
271 if len(binTBM)==tbmRoc:
272 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
273 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
274 y1=hist2.GetYaxis().GetBinLowEdge(biny)
275 y2=hist2.GetYaxis().GetBinUpEdge(biny)
276 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
277 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
279 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
286 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
287 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
288 y1=hist2.GetYaxis().GetBinLowEdge(biny)
289 y2=hist2.GetYaxis().GetBinUpEdge(biny)
290 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
291 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
293 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
294 c.SaveAs(
'MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
295 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))
296 os.system(
'rm -f MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
298 print "Some Error in get the histograms for FPIX" 300 print "----> Build maps for FPix" 301 for rng
in range(1,3):
302 histOccList.append(rootf.FindObjectAny(hoccF+
str(rng)))
303 histDeadList.append(rootf.FindObjectAny(hdeadF+
str(rng)))
304 for hist1, hist2
in zip(histOccList, histDeadList):
305 if hist1 !=
None or hist2 !=
None:
307 match=re.search(
'(?<=PXRing_)[0-9]',hist1.GetName())
308 if match !=
None and "per_SignedDiskCoord_per_SignedBladePanelCoord" in hist1.GetName():
309 ring=
int(match.group(0))
310 hist1.SetTitle(
"Digi Occupancy Ring {0}".
format(ring))
319 for biny
in range(1,hist2.GetNbinsY()+1):
321 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
322 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
323 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
324 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
325 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
326 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
328 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
330 for binx
in range(1,hist2.GetNbinsX()+1):
331 if hist2.GetBinContent(binx,biny)!=0:
335 if len(binTBM)==tbmRoc:
336 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
337 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
338 y1=hist2.GetYaxis().GetBinLowEdge(biny)
339 y2=hist2.GetYaxis().GetBinUpEdge(biny)
340 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
341 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
343 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
350 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
351 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
352 y1=hist2.GetYaxis().GetBinLowEdge(biny)
353 y2=hist2.GetYaxis().GetBinUpEdge(biny)
354 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
355 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
357 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
358 c.SaveAs(
'MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
359 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))
360 os.system(
'rm -f MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
363 print "Some Error in get the histograms for FPIX" def draw_box(boxList, xl, xr, yl, yr, opacity=1, color=1, style=1001, lstyle=1, lw=3)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def renderPluginFPIX(lineList, ring)
def renderPluginBPIX(lineList, layer)