3 from __future__
import print_function
7 from array
import array
11 for dir
in os.environ[
'CMSSW_SEARCH_PATH'].
split(
":"):
12 if os.path.exists(os.path.join(dir,rfile)):
return os.path.join(dir,rfile)
16 detIDsFileName =
getFileInPath(
'DQM/SiStripMonitorClient/data/detids.dat')
18 filename_online=sys.argv[1]
19 filename_offline=sys.argv[2]
21 runNum=filename_offline[19:25]
23 dir=
"DQMData/Run " + runNum +
"/PixelPhase1/Run summary/Pahse1_MechanicalView/"
26 dirBPix=dir +
"PXBarrel/"
27 dirFPix=dir +
"PXForward/"
29 hnameB=
"digi_occupancy_per_SignedModuleCoord_per_SignedLadderCoord_PXLayer_"
31 minlad=[-6,-14,-22,-32]
37 DQMfile=TFile(inputFile)
43 RocMap=DQMfile.FindObjectAny(hname)
45 for j
in range(1,RocMap.GetNbinsY()+1):
47 lad=minlad[l-1] +
int(j-1)/2
50 for i
in range(1,RocMap.GetNbinsX()+1):
54 bin=RocMap.GetBin(i,j)
55 digi=RocMap.GetBinContent(bin)
57 if (digi!=0):
continue
61 if (lad==0
or mod==0):
continue
63 if (lad < 0
and mod < 0) :
68 if (j%2==1): roc=(i-1)%8
69 if (j%2==0): roc= 15-(i-1)%8
72 if (j%2 ==0): roc=(i-1)%8
73 if (j%2 ==1): roc= 15-(i-1)%8
75 if (lad > 0
and mod < 0):
80 if (j%2 ==0): roc=(i-1)%8
81 if (j%2 ==1): roc= 15-(i-1)%8
84 if (j%2 ==1): roc=(i-1)%8
85 if (j%2 ==0): roc= 15-(i-1)%8
87 if (lad > 0
and mod > 0):
92 if (j%2 ==1): roc=7-(i-1)%8
93 if (j%2 ==0): roc=8+(i-1)%8
96 if (j%2 ==0): roc=7-(i-1)%8
97 if (j%2 ==1): roc=8+(i-1)%8
99 if (lad < 0
and mod > 0):
103 if (j%2 ==0): roc=7-(i-1)%8
104 if (j%2 ==1): roc=8+(i-1)%8
107 if (j%2 ==1): roc=7-(i-1)%8
108 if (j%2 ==0): roc=8+(i-1)%8
110 f1=open(
getFileInPath(
'DQM/SiStripMonitorClient/data/detids.dat'))
112 Mod_check =
"LYR"+
str(l) +
"_LDR" +
str(
abs(lad)) +
"F_MOD" +
str(
abs(mod))
113 shell_check =
"BPix_" +
str(shell)
116 refName=line.split(
" ")[1]
118 shell_ref =
str(refName[:8]).
strip()
119 module_ref =
str(refName[14:]).
strip()
121 if (Mod_check == module_ref)
and (shell_check == shell_ref):
123 ModuleName_BPIX = refName.strip()+
"_ROC "
124 BmLYR1_check = ModuleName_BPIX.split(
'_')
125 if ((BmLYR1_check[1] ==
"BmI" or BmLYR1_check[1] ==
"BmO")
and (BmLYR1_check[3] ==
"LYR1")):
131 BPix_Name = ModuleName_BPIX +
str(roc)
132 BPIXCounter_v0.append(BPix_Name)
133 BPIXCounter = list(set(BPIXCounter_v0))
141 hnameF=
"digi_occupancy_per_SignedDiskCoord_per_SignedBladePanelCoord_PXRing_"
146 DQMfile=TFile(inputFile)
147 for r
in range (1,3):
149 hname=hnameF +
str(r)
150 RocMap=DQMfile.FindObjectAny(hname)
152 for j
in range(1,RocMap.GetNbinsY()+1):
154 bld=minbld[r-1] +
int(j-1)/4
157 for i
in range(1,RocMap.GetNbinsX()+1):
161 bin=RocMap.GetBin(i,j)
162 digi=RocMap.GetBinContent(bin)
164 if (digi!=0):
continue
168 if (bld==0
or disk==0):
continue
172 if ((j-1)%4==0
or (j-1)%4==1): pnl=2
173 if ((j-1)%4==2
or (j-1)%4==3): pnl=1
175 if (disk < 0
and bld <0):
179 if ((j-1)%4==0
or (j-1)%4==3): roc= 15-(i-1)%8
180 if ((j-1)%4==1
or (j-1)%4==2): roc= (i-1)%8
182 if (disk < 0
and bld >0):
186 if ((j-1)%4==0
or (j-1)%4==3): roc= 15-(i-1)%8
187 if ((j-1)%4==1
or (j-1)%4==2): roc= (i-1)%8
189 if (disk > 0
and bld >0):
193 if ((j-1)%4==0
or (j-1)%4==3): roc=7-(i-1)%8
194 if ((j-1)%4==1
or (j-1)%4==2): roc=8+(i-1)%8
196 if (disk > 0
and bld <0):
200 if ((j-1)%4==0
or (j-1)%4==3): roc=7-(i-1)%8;
201 if ((j-1)%4==1
or (j-1)%4==2): roc=8+(i-1)%8;
204 FPix_Name =
"FPix_" +
str(shell) +
"_D" +
str(
abs(disk)) +
'_BLD'+
str(
abs(bld)) +
'_PNL' +
str(
abs(pnl)) +
'_RNG'+
str(
abs(r)) +
"_ROC " +
str(roc) +
""
205 FPIXCounter.append(FPix_Name)
210 deadROCList_offline = list(set(
BPIX_list(filename_offline))) + list(set(
FPIX_list(filename_offline)))
212 MaskedROC_DuringRun = list(set(deadROCList_online) - set(deadROCList_offline))
213 print(
'Number of New Dead ROC: '+
str(len(MaskedROC_DuringRun)))
215 outFileName =
'DeadROC_Diff.txt'
216 outFileName_online =
'DeadROC_online.txt'
217 outFileName_offline =
'DeadROC_offline.txt'
218 f = open(outFileName,
"w")
219 f1 = open(outFileName_online,
"w")
220 f2 = open(outFileName_offline,
"w")
222 for i
in range(len(MaskedROC_DuringRun)):
224 f.write(MaskedROC_DuringRun[i]+
"\n")
227 for i
in range(len(deadROCList_online)):
229 f1.write(deadROCList_online[i]+
"\n")
232 for i
in range(len(deadROCList_offline)):
234 f2.write(deadROCList_offline[i]+
"\n")