2 from ROOT
import TFile, gStyle,gPad ,TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1,TAxis
8 pos=filename.find(
"__")
9 runNumber=
int(filename[pos-6:pos])
14 barrelPath = commonPath +
"PXBarrel/";
15 histoname = [
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_1",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_2",
16 "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_3",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_4"]
17 digi2D = fin.Get(barrelPath + histoname[layerNo-1])
19 if digi2D.GetEntries() == 0 :
23 NexpectedROC = [1536, 3584, 5632, 8192]
24 nLadders_bpx = [6, 14, 22, 32]
25 nx = digi2D.GetNbinsX()
26 ny = digi2D.GetNbinsY()
27 for xbin
in range(1,nx+1):
28 if xbin >= 33
and xbin <= 40:
continue;
29 for ybin
in range(1,ny+1):
30 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
31 bentries = digi2D.GetBinContent(xbin,ybin)
34 totalEntries += bentries
35 meanEntries =
float(totalEntries)/Nrocspopulated
38 for xbin
in range(1,nx+1):
39 if xbin >= 33
and xbin <= 40:
41 for ybin
in range(1,ny+1):
42 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
43 bentries = digi2D.GetBinContent(xbin,ybin);
44 if(bentries > 0
and bentries < meanEntries/4. ):
47 tmpstr =
"BPix L" +
str(layerNo)
48 print >> os, tmpstr,
'{0:4d} {1:4d} {2:4.1f}'.
format(NexpectedROC[layerNo-1] - Nrocspopulated, NineffROC, round(meanEntries,1))
52 forwardPath = commonPath +
"PXForward/";
53 histoname = [
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_1",
54 "digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_2"]
55 digi2D = fin.Get(forwardPath + histoname[ringNo-1])
57 if digi2D.GetEntries() == 0 :
59 nblades_perRing_fpx = [22, 34]
60 NexpectedROC_perRing = [704, 1088]
61 Nrocspopulated = [0] * 6
62 totalEntries = [0] * 6
64 nx = digi2D.GetNbinsX()
65 ny = digi2D.GetNbinsY()
66 for xbin
in range(1,nx+1):
67 if xbin >= 25
and xbin <= 32:
continue;
68 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1;
69 for ybin
in range(1,ny+1):
70 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
72 bentries = digi2D.GetBinContent(xbin,ybin)
74 Nrocspopulated[dcounter] += 1
75 totalEntries[dcounter] += bentries
79 meanEntries[d] =
float(totalEntries[d])/Nrocspopulated[d]
83 for xbin
in range(1,nx+1):
84 if xbin >= 25
and xbin <= 32:
continue;
85 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1
86 for ybin
in range(1,ny+1):
87 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
89 bentries = digi2D.GetBinContent(xbin,ybin)
91 if bentries > 0
and bentries < meanEntries[dcounter]/4.:
92 NineffROC[dcounter] += 1
94 print >> os,
"#Summary for FPix Ring", ringNo
97 if d < 3: disc =
"M" +
str(3 - d)
98 else: disc =
"P" +
str(d - 2)
100 tmpstr =
"FPix R" +
str(ringNo) +
"D" +
str(disc)
101 print >> os,
'{0:10s} {1:4d} {2:4d} {3:4.1f}'.
format(tmpstr, NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d], NineffROC[d], round(meanEntries[d],1))
107 outname=
"PixZeroOccROCs_run" +
str(runNumber) +
".txt" 109 commonPath =
"DQMData/Run " +
str(runNumber) +
"/PixelPhase1/Run summary/Phase1_MechanicalView/" 111 hnpixclus_bpix = fin.Get(commonPath +
"charge_PXBarrel")
112 hnpixclus_fpix = fin.Get(commonPath +
"charge_PXForward")
114 out_file = open(outname,
"w")
115 print >> out_file,
"#Layer/Disc KEY NDeadROC NineffROC MeanOccupacy" 116 print >> out_file,
"#Pixel Barrel Summary" 119 print >> out_file,
"DQM histogram for Layer",
str(l),
" is empty!" 120 print >> out_file,
"#Pixel Forward Summary" 121 for ring
in range(1,3):
123 print >> out_file,
"DQM histogram for Ring",
str(ring),
" is empty!" 125 print >> out_file,
"Number of clusters=",
int(hnpixclus_bpix.GetEntries() + hnpixclus_fpix.GetEntries())
def getRunNumber(filename)
def countBadROCForward(fin, ringNo, os)
endacp#########################################
def countBadROCBarrel(fin, layerNo, os)
barrel########################################################