202 if len(sys.argv) != 2:
203 print(
"input file needed!")
207 print(filename+
" -- "+filename[19:25])
208 runNum=filename[19:25]
210 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/" 211 dirFED=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/FED/" 214 dirBPix=dir +
"PXBarrel/" 215 dirFPix=dir +
"PXForward/" 217 hoccB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 218 hoccF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 219 hdeadB=
"Dead Channels per ROC_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 220 hdeadF=
"Dead Channels per ROC_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 222 ROOT.gROOT.SetBatch(1)
223 ROOT.gStyle.SetOptStat(0)
224 ROOT.gStyle.SetPalette(1)
225 ROOT.gStyle.SetNumberContours(128)
226 rootf=ROOT.TFile(filename)
230 c=ROOT.TCanvas(
"c",
"c",1250,1000)
232 print(
"----> Build maps for BPix")
235 for lyr
in range(1,5):
236 histOccList.append(rootf.FindObjectAny(hoccB+
str(lyr)))
237 histDeadList.append(rootf.FindObjectAny(hdeadB+
str(lyr)))
238 for hist1, hist2
in zip(histOccList, histDeadList):
239 if hist1 !=
None or hist2 !=
None:
241 match=re.search(
'(?<=PXLayer_)[0-9]',hist1.GetName())
242 if match !=
None and "per_SignedModuleCoord_per_SignedLadderCoord" in hist1.GetName():
243 lyr=
int(match.group(0))
244 hist1.SetTitle(
"Digi Occupancy Layer {0}".
format(lyr))
256 for biny
in range(1,hist2.GetNbinsY()+1):
258 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
259 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
260 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
261 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
262 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
263 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
265 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
267 for binx
in range(1,hist2.GetNbinsX()+1):
268 if hist2.GetBinContent(binx,biny)!=0:
272 if len(binTBM)==tbmRoc:
273 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
274 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
275 y1=hist2.GetYaxis().GetBinLowEdge(biny)
276 y2=hist2.GetYaxis().GetBinUpEdge(biny)
277 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
278 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
280 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
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 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
292 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
294 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
295 c.SaveAs(
'MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
296 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))
297 os.system(
'rm -f MergedOccupancyDeadROC_BPix_Layer{0}_TBM.pdf'.
format(lyr))
299 print(
"Some Error in get the histograms for FPIX")
301 print(
"----> Build maps for FPix")
302 for rng
in range(1,3):
303 histOccList.append(rootf.FindObjectAny(hoccF+
str(rng)))
304 histDeadList.append(rootf.FindObjectAny(hdeadF+
str(rng)))
305 for hist1, hist2
in zip(histOccList, histDeadList):
306 if hist1 !=
None or hist2 !=
None:
308 match=re.search(
'(?<=PXRing_)[0-9]',hist1.GetName())
309 if match !=
None and "per_SignedDiskCoord_per_SignedBladePanelCoord" in hist1.GetName():
310 ring=
int(match.group(0))
311 hist1.SetTitle(
"Digi Occupancy Ring {0}".
format(ring))
320 for biny
in range(1,hist2.GetNbinsY()+1):
322 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
323 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
324 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
325 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
326 if hist2.GetBinContent(binTBM[0],biny-1) >= 0.97*hist2.GetMaximum():
327 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
329 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
331 for binx
in range(1,hist2.GetNbinsX()+1):
332 if hist2.GetBinContent(binx,biny)!=0:
336 if len(binTBM)==tbmRoc:
337 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
338 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
339 y1=hist2.GetYaxis().GetBinLowEdge(biny)
340 y2=hist2.GetYaxis().GetBinUpEdge(biny)
341 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
342 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
344 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
351 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
352 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
353 y1=hist2.GetYaxis().GetBinLowEdge(biny)
354 y2=hist2.GetYaxis().GetBinUpEdge(biny)
355 if hist2.GetBinContent(binTBM[0],biny) >= 0.97*hist2.GetMaximum():
356 draw_box(boxList,x1,x2,y1,y2,0.2,1,0,1,lineWd)
358 draw_box(boxList,x1,x2,y1,y2,0.2,633,0,1,lineWd)
359 c.SaveAs(
'MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
360 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))
361 os.system(
'rm -f MergedOccupancyDeadROC_FPix_Ring{0}_TBM.pdf'.
format(ring))
364 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)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def renderPluginFPIX(lineList, ring)
def renderPluginBPIX(lineList, layer)