2 from __future__
import print_function
3 from ROOT
import TFile, gStyle,gPad ,TObject, TCanvas, TH1, TH1F, TH2F, TLegend, TPaletteAxis, TList, TLine, TAttLine, TF1,TAxis
9 pos=filename.find(
"__")
10 runNumber=
int(filename[pos-6:pos])
15 global bpix_tot_deadROC
16 global bpix_tot_ineffROC
17 global bpix_tot_Nrocspopulated
18 global bpix_tot_totalentries
20 barrelPath = commonPath +
"PXBarrel/";
21 histoname = [
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_1",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_2",
22 "digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_3",
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_4"]
23 digi2D = fin.Get(barrelPath + histoname[layerNo-1])
25 if digi2D.GetEntries() == 0 :
29 NexpectedROC = [1536, 3584, 5632, 8192]
30 nLadders_bpx = [6, 14, 22, 32]
31 nx = digi2D.GetNbinsX()
32 ny = digi2D.GetNbinsY()
33 for xbin
in range(1,nx+1):
34 if xbin >= 33
and xbin <= 40:
continue;
35 for ybin
in range(1,ny+1):
36 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
37 bentries = digi2D.GetBinContent(xbin,ybin)
40 totalEntries += bentries
41 meanEntries =
float(totalEntries)/Nrocspopulated
44 for xbin
in range(1,nx+1):
45 if xbin >= 33
and xbin <= 40:
47 for ybin
in range(1,ny+1):
48 if (ybin == 2*nLadders_bpx[layerNo-1] + 1)
or (ybin == 2*nLadders_bpx[layerNo-1] + 2):
continue;
49 bentries = digi2D.GetBinContent(xbin,ybin);
50 if(bentries > 0
and bentries < meanEntries/4. ):
53 tmpstr =
"BPix L" +
str(layerNo)
54 print(tmpstr,
'{0:4d} {1:4d} {2:4.1f}'.
format(NexpectedROC[layerNo-1] - Nrocspopulated, NineffROC, round(meanEntries,1)), file=os)
55 bpix_tot_deadROC += NexpectedROC[layerNo-1] - Nrocspopulated
56 bpix_tot_ineffROC += NineffROC
57 bpix_tot_Nrocspopulated += Nrocspopulated
58 bpix_tot_totalentries +=
float(totalEntries)
62 global fpix_tot_deadROC
63 global fpix_tot_ineffROC
64 global fpix_tot_Nrocspopulated
65 global fpix_tot_totalentries
67 forwardPath = commonPath +
"PXForward/";
68 histoname = [
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_1",
69 "digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_2"]
70 digi2D = fin.Get(forwardPath + histoname[ringNo-1])
72 if digi2D.GetEntries() == 0 :
74 nblades_perRing_fpx = [22, 34]
75 NexpectedROC_perRing = [704, 1088]
76 Nrocspopulated = [0] * 6
77 totalEntries = [0] * 6
79 nx = digi2D.GetNbinsX()
80 ny = digi2D.GetNbinsY()
81 for xbin
in range(1,nx+1):
82 if xbin >= 25
and xbin <= 32:
continue;
83 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1;
84 for ybin
in range(1,ny+1):
85 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
87 bentries = digi2D.GetBinContent(xbin,ybin)
89 Nrocspopulated[dcounter] += 1
90 totalEntries[dcounter] += bentries
94 meanEntries[d] =
float(totalEntries[d])/Nrocspopulated[d]
98 for xbin
in range(1,nx+1):
99 if xbin >= 25
and xbin <= 32:
continue;
100 if xbin > 1
and (xbin-1)%8 == 0: dcounter += 1
101 for ybin
in range(1,ny+1):
102 if (ybin >= 2*nblades_perRing_fpx[ringNo-1] + 1)
and (ybin <= 2*nblades_perRing_fpx[ringNo-1] + 4):
104 bentries = digi2D.GetBinContent(xbin,ybin)
106 if bentries > 0
and bentries < meanEntries[dcounter]/4.:
107 NineffROC[dcounter] += 1
109 print(
"#Summary for FPix Ring", ringNo, file=os)
112 if d < 3: disc =
"M" +
str(3 - d)
113 else: disc =
"P" +
str(d - 2)
115 tmpstr =
"FPix R" +
str(ringNo) +
"D" +
str(disc)
116 print(
'{0:10s} {1:4d} {2:4d} {3:4.1f}'.
format(tmpstr, NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d], NineffROC[d], round(meanEntries[d],1)), file=os)
117 fpix_tot_deadROC += NexpectedROC_perRing[ringNo-1] - Nrocspopulated[d]
118 fpix_tot_ineffROC += NineffROC[d]
119 fpix_tot_Nrocspopulated += Nrocspopulated[d]
120 fpix_tot_totalentries +=
float(totalEntries[d])
127 outname=
"PixZeroOccROCs_run" +
str(runNumber) +
".txt" 129 bpix_tot_ineffROC = 0
130 bpix_tot_Nrocspopulated = 0
131 bpix_tot_totalentries = 0
134 fpix_tot_ineffROC = 0
135 fpix_tot_Nrocspopulated = 0
136 fpix_tot_totalentries = 0
139 commonPath =
"DQMData/Run " +
str(runNumber) +
"/PixelPhase1/Run summary/Phase1_MechanicalView/" 141 hnpixclus_bpix = fin.Get(commonPath +
"charge_PXBarrel")
142 hnpixclus_fpix = fin.Get(commonPath +
"charge_PXForward")
144 out_file = open(outname,
"w")
145 print(
"#Layer/Disc KEY NDeadROC NineffROC MeanOccupacy", file=out_file)
146 print(
"#Pixel Barrel Summary", file=out_file)
149 print(
"DQM histogram for Layer",
str(l),
" is empty!", file=out_file)
150 print(
"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)), file=out_file)
151 print(
"#Pixel Forward Summary", file=out_file)
152 for ring
in range(1,3):
154 print(
"DQM histogram for Ring",
str(ring),
" is empty!", file=out_file)
155 print(
"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)), file=out_file)
156 print(
"Number of clusters=",
int(hnpixclus_bpix.GetEntries() + hnpixclus_fpix.GetEntries()), file=out_file)
def getRunNumber(filename)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def countBadROCForward(fin, ringNo, os)
endacp#########################################
def countBadROCBarrel(fin, layerNo, os)
barrel########################################################