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 global bpix_tot_deadROC
15 global bpix_tot_ineffROC
16 global bpix_tot_Nrocspopulated
17 global bpix_tot_totalentries
19 barrelPath = commonPath +
"PXBarrel/";
20 histoname = [
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_1",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_2",
21 "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_3",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_4"]
22 digi2D = fin.Get(barrelPath + histoname[layerNo-1])
24 if digi2D.GetEntries() == 0 :
28 NexpectedROC = [1536, 3584, 5632, 8192]
29 nLadders_bpx = [6, 14, 22, 32]
30 nx = digi2D.GetNbinsX()
31 ny = digi2D.GetNbinsY()
32 for xbin
in range(1,nx+1):
33 if xbin >= 33
and xbin <= 40:
continue;
34 for ybin
in range(1,ny+1):
35 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
36 bentries = digi2D.GetBinContent(xbin,ybin)
39 totalEntries += bentries
40 meanEntries =
float(totalEntries)/Nrocspopulated
43 for xbin
in range(1,nx+1):
44 if xbin >= 33
and xbin <= 40:
46 for ybin
in range(1,ny+1):
47 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
48 bentries = digi2D.GetBinContent(xbin,ybin);
49 if(bentries > 0
and bentries < meanEntries/4. ):
52 tmpstr =
"BPix L" +
str(layerNo)
53 print >> os, tmpstr,
'{0:4d} {1:4d} {2:4.1f}'.
format(NexpectedROC[layerNo-1] - Nrocspopulated, NineffROC, round(meanEntries,1))
54 bpix_tot_deadROC += NexpectedROC[layerNo-1] - Nrocspopulated
55 bpix_tot_ineffROC += NineffROC
56 bpix_tot_Nrocspopulated += Nrocspopulated
57 bpix_tot_totalentries +=
float(totalEntries)
61 global fpix_tot_deadROC
62 global fpix_tot_ineffROC
63 global fpix_tot_Nrocspopulated
64 global fpix_tot_totalentries
66 forwardPath = commonPath +
"PXForward/";
67 histoname = [
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_1",
68 "digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_2"]
69 digi2D = fin.Get(forwardPath + histoname[ringNo-1])
71 if digi2D.GetEntries() == 0 :
73 nblades_perRing_fpx = [22, 34]
74 NexpectedROC_perRing = [704, 1088]
75 Nrocspopulated = [0] * 6
76 totalEntries = [0] * 6
78 nx = digi2D.GetNbinsX()
79 ny = digi2D.GetNbinsY()
80 for xbin
in range(1,nx+1):
81 if xbin >= 25
and xbin <= 32:
continue;
82 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1;
83 for ybin
in range(1,ny+1):
84 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
86 bentries = digi2D.GetBinContent(xbin,ybin)
88 Nrocspopulated[dcounter] += 1
89 totalEntries[dcounter] += bentries
93 meanEntries[d] =
float(totalEntries[d])/Nrocspopulated[d]
97 for xbin
in range(1,nx+1):
98 if xbin >= 25
and xbin <= 32:
continue;
99 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1
100 for ybin
in range(1,ny+1):
101 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
103 bentries = digi2D.GetBinContent(xbin,ybin)
105 if bentries > 0
and bentries < meanEntries[dcounter]/4.:
106 NineffROC[dcounter] += 1
108 print >> os,
"#Summary for FPix Ring", ringNo
111 if d < 3: disc =
"M" +
str(3 - d)
112 else: disc =
"P" +
str(d - 2)
114 tmpstr =
"FPix R" +
str(ringNo) +
"D" +
str(disc)
115 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))
116 fpix_tot_deadROC += NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d]
117 fpix_tot_ineffROC += NineffROC[d]
118 fpix_tot_Nrocspopulated += Nrocspopulated[d]
119 fpix_tot_totalentries +=
float(totalEntries[d])
126 outname=
"PixZeroOccROCs_run" +
str(runNumber) +
".txt" 128 bpix_tot_ineffROC = 0
129 bpix_tot_Nrocspopulated = 0
130 bpix_tot_totalentries = 0
133 fpix_tot_ineffROC = 0
134 fpix_tot_Nrocspopulated = 0
135 fpix_tot_totalentries = 0
138 commonPath =
"DQMData/Run " +
str(runNumber) +
"/PixelPhase1/Run summary/Phase1_MechanicalView/" 140 hnpixclus_bpix = fin.Get(commonPath +
"charge_PXBarrel")
141 hnpixclus_fpix = fin.Get(commonPath +
"charge_PXForward")
143 out_file = open(outname,
"w")
144 print >> out_file,
"#Layer/Disc KEY NDeadROC NineffROC MeanOccupacy" 145 print >> out_file,
"#Pixel Barrel Summary" 148 print >> out_file,
"DQM histogram for Layer",
str(l),
" is empty!" 149 print >> out_file,
"BPix tot",
'{0:4d} {1:4d} {2:4.1f}'.
format(bpix_tot_deadROC, bpix_tot_ineffROC, round(
float(bpix_tot_totalentries)/bpix_tot_Nrocspopulated,1))
150 print >> out_file,
"#Pixel Forward Summary" 151 for ring
in range(1,3):
153 print >> out_file,
"DQM histogram for Ring",
str(ring),
" is empty!" 154 print >> out_file,
"FPix tot",
'{0:4d} {1:4d} {2:4.1f}'.
format(fpix_tot_deadROC, fpix_tot_ineffROC, round(
float(fpix_tot_totalentries)/fpix_tot_Nrocspopulated,1))
155 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########################################################