202 if len(sys.argv) != 3:
203 print(
"input files needed!")
208 print(filename+
" -- "+filename[19:25])
209 print(pclfile+
" -- "+pclfile[19:25])
210 runNum=filename[19:25]
212 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/" 213 dirERROR=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/SiPixelQualityPCL/BadROC_Other/" 216 dirBPix=dir +
"PXBarrel/" 217 dirFPix=dir +
"PXForward/" 219 hoccB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 220 hoccF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 221 hdeadB=
"Dead Channels per ROC_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_" 222 hdeadF=
"Dead Channels per ROC_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_" 224 ROOT.gROOT.SetBatch(1)
225 ROOT.gStyle.SetOptStat(0)
226 ROOT.gStyle.SetPalette(52)
228 for i
in range(0,255):
229 color.append(ROOT.TColor.GetColorPalette(i))
230 ROOT.gStyle.SetPalette(1)
231 ROOT.gStyle.SetNumberContours(128)
232 rootf=ROOT.TFile(filename)
233 rootp=ROOT.TFile(pclfile)
237 c=ROOT.TCanvas(
"c",
"c",1250,1000)
239 print(
"----> Build maps for BPix")
242 for lyr
in range(1,5):
243 histOccList.append(rootf.FindObjectAny(hoccB+
str(lyr)))
244 histDeadList.append(rootp.Get(dirERROR+hdeadB+
str(lyr)))
245 for hist1, hist2
in zip(histOccList, histDeadList):
246 if hist1 !=
None or hist2 !=
None:
248 match=re.search(
'(?<=PXLayer_)[0-9]',hist1.GetName())
249 if match !=
None and "per_SignedModuleCoord_per_SignedLadderCoord" in hist1.GetName():
250 lyr=
int(match.group(0))
251 hist1.SetTitle(
"Digi Occupancy Layer {0}".
format(lyr))
264 maxx=hist2.GetMaximum()
265 for biny
in range(1,hist2.GetNbinsY()+1):
267 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
268 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
269 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
270 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
271 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)
274 for binx
in range(1,hist2.GetNbinsX()+1):
277 elif hist2.GetBinContent(binx,biny)==hist2.GetBinContent(binTBM[len(binTBM)-1],biny):
281 if hist2.GetBinContent(binx,biny)!=0
and check:
285 if len(binTBM)==(tbmRoc):
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 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+
int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
298 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
299 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
300 y1=hist2.GetYaxis().GetBinLowEdge(biny)
301 y2=hist2.GetYaxis().GetBinUpEdge(biny)
302 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+
int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
304 if hist2.GetBinContent(binx,biny)!=0:
306 c.SaveAs(
'MergedPCLOther_BPix_Layer{0}_TBM.pdf'.
format(lyr))
307 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedPCLOther_BPix_Layer{0}_TBM.png -r144 -q MergedPCLOther_BPix_Layer{0}_TBM.pdf'.
format(lyr))
308 os.system(
'rm -f MergedPCLOther_BPix_Layer{0}_TBM.pdf'.
format(lyr))
310 print(
"Some Error in get the histograms for FPIX")
312 print(
"----> Build maps for FPix")
313 for rng
in range(1,3):
314 histOccList.append(rootf.FindObjectAny(hoccF+
str(rng)))
315 histDeadList.append(rootp.Get(dirERROR+hdeadF+
str(rng)))
316 for hist1, hist2
in zip(histOccList, histDeadList):
317 if hist1 !=
None or hist2 !=
None:
319 match=re.search(
'(?<=PXRing_)[0-9]',hist1.GetName())
320 if match !=
None and "per_SignedDiskCoord_per_SignedBladePanelCoord" in hist1.GetName():
321 ring=
int(match.group(0))
322 hist1.SetTitle(
"Digi Occupancy Ring {0}".
format(ring))
331 maxx=hist2.GetMaximum()
332 for biny
in range(1,hist2.GetNbinsY()+1):
334 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
335 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
336 y1=hist2.GetYaxis().GetBinLowEdge(biny-1)
337 y2=hist2.GetYaxis().GetBinUpEdge(biny-1)
338 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)
340 for binx
in range(1,hist2.GetNbinsX()+1):
343 elif hist2.GetBinContent(binx,biny)==hist2.GetBinContent(binTBM[len(binTBM)-1],biny):
347 if hist2.GetBinContent(binx,biny)!=0
and check:
351 if len(binTBM)==tbmRoc:
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 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+
int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
363 x1=hist2.GetXaxis().GetBinLowEdge(binTBM[0])
364 x2=hist2.GetXaxis().GetBinUpEdge(binTBM[len(binTBM)-1])
365 y1=hist2.GetYaxis().GetBinLowEdge(biny)
366 y2=hist2.GetYaxis().GetBinUpEdge(biny)
367 draw_box(boxList,x1,x2,y1,y2,0.2,color[100+
int((224-100)*(1-hist2.GetBinContent(binTBM[0],biny)/maxx))],0,1,lineWd)
369 if hist2.GetBinContent(binx,biny)!=0:
371 c.SaveAs(
'MergedPCLOther_FPix_Ring{0}_TBM.pdf'.
format(ring))
372 os.system(
'gs -dBATCH -dNOPAUSE -sDEVICE=png16m -dUseCropBox -sOutputFile=MergedPCLOther_FPix_Ring{0}_TBM.png -r144 -q MergedPCLOther_FPix_Ring{0}_TBM.pdf'.
format(ring))
373 os.system(
'rm -f MergedPCLOther_FPix_Ring{0}_TBM.pdf'.
format(ring))
376 print(
"Some Error in get the histograms for FPIX")
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 renderPluginBPIX(lineList, layer)
def renderPluginFPIX(lineList, ring)
def draw_box(boxList, xl, xr, yl, yr, opacity=1, color=1, style=1001, lstyle=1, lw=3)