12def SCTErrMonAlgConfig(flags):
13 import logging
14 local_logger = logging.getLogger('AthenaMonitoringCfg')
15 info = local_logger.info
16 info('SCTErrMonAlgConfig')
17
18 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
19 result = ComponentAccumulator()
20
21 from IOVDbSvc.IOVDbSvcConfig import addFolders
22 if flags.Common.isOnline:
23 result.merge(addFolders(flags,'/TDAQ/RunCtrl/DataTakingMode','TDAQ',className='AthenaAttributeList'))
24 info('SCTErrMonAlgConfig: added DATA COOL folders')
25
26 from AthenaMonitoring import AthMonitorCfgHelper
27 helper = AthMonitorCfgHelper(flags, 'SCTErrMonCfg')
28
29 from AthenaConfiguration.ComponentFactory import CompFactory
30 myMonAlg = helper.addAlgorithm(CompFactory.SCTErrMonAlg, 'SCTErrMonAlg')
31 myMonAlg.TriggerChain = ""
32
33 from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ConditionsSummaryToolCfg
34 myMonAlg.SCT_ConditionsSummaryTool = result.popToolsAndMerge(
35 SCT_ConditionsSummaryToolCfg(flags))
36
37
38 myMonAlg.UseDCS = flags.InDet.useDCS
39
40 myMonAlg.doOnlineMon = flags.Common.isOnline
41
42 from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
43 result.merge(BunchCrossingCondAlgCfg(flags))
44
45 myMonGroup = helper.addGroup(myMonAlg, "SCTErrMonitor", "SCT/")
46
47
48
49 from ROOT import SCT_Monitoring as sctMon
50
51
52 myMonGroup.defineHistogram(varname="lumiBlock;NumberOfEventsVsLB",
53 cutmask="is1D",
54 type="TH1F",
55 title="Num of events per LB ;LumiBlock",
56 path="GENERAL/Conf",
57 xbins=sctMon.NBINS_LBs,
58 xmin=0.5,
59 xmax=sctMon.NBINS_LBs+0.5,
60 opt='kAlwaysCreate')
61
62
63 myMonGroup.defineHistogram(varname="lumiBlock;NumberOfSCTFlagErrorsVsLB",
64 cutmask="sctFlag",
65 type="TH1F",
66 title="Num of SCT Flag errors per LB ;LumiBlock",
67 path="GENERAL/Conf",
68 xbins=sctMon.NBINS_LBs,
69 xmin=0.5,
70 xmax=sctMon.NBINS_LBs+0.5,
71 opt='kAlwaysCreate')
72
73
74 myMonGroup.defineHistogram(varname="lumiBlock, sctFlag;FractionOfSCTFlagErrorsPerLB",
75 type="TProfile",
76 title="Frac of SCT Flag errors per LB ;LumiBlock",
77 path="GENERAL/Conf",
78 xbins=sctMon.NBINS_LBs,
79 xmin=0.5,
80 xmax=sctMon.NBINS_LBs+0.5,
81 opt='kAlwaysCreate')
82
83
84 myMonGroup.defineHistogram(varname="detailedConfBin, nBad;SCTConfDetails",
85 type="TProfile",
86 title="Exclusion from the Configuration",
87 path="GENERAL/Conf",
88 xbins=sctMon.ConfbinsDetailed,
89 xmin=-0.5,
90 xmax=sctMon.ConfbinsDetailed-0.5,
91 xlabels=["Modules", "Link 0", "Link 1",
92 "Chips", "Strips (10^{2})"],
93 opt='kAlwaysCreate')
94
95
96 myMonGroup.defineHistogram(varname="moduleOutBin, moduleOut;SCTConfOutM",
97 type="TProfile",
98 title="Num of Out Modules in All Region",
99 path="GENERAL/Conf",
100 xbins=1,
101 xmin=-0.5,
102 xmax=0.5,
103 xlabels=["Mod Out"],
104 opt='kAlwaysCreate')
105
106
107 from ROOT import SCT_ByteStreamErrors
108 for i in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES):
109 myMonGroup.defineHistogram(
110 varname="lumiBlock, n_" +
111 SCT_ByteStreamErrors.ErrorTypeDescription[i] +
112 ";SCT_" +
113 SCT_ByteStreamErrors.ErrorTypeDescription[i] +
114 "VsLbs",
115 type="TProfile",
116 title="Ave. " +
117 SCT_ByteStreamErrors.ErrorTypeDescription[i] +
118 " per LB in All Region;LumiBlock;Num of " +
119 SCT_ByteStreamErrors.ErrorTypeDescription[i],
120 path="GENERAL/Conf",
121 xbins=sctMon.NBINS_LBs,
122 xmin=0.5,
123 xmax=sctMon.NBINS_LBs+0.5,
124 opt='kAlwaysCreate')
125
126
127 for i in range(sctMon.N_ERRCATEGORY):
128 myMonGroup.defineHistogram(
129 varname="lumiBlock, n_" +
130 sctMon.CategoryErrorsNames[i]+";SCT_LinksWith" +
131 sctMon.CategoryErrorsNames[i]+"VsLbs",
132 type="TProfile",
133 title="Ave. Num of Links with " +
134 sctMon.CategoryErrorsNames[i] +
135 " per LB in All Region;LumiBlock;Num of Links with " +
136 sctMon.CategoryErrorsNames[i],
137 path="GENERAL/Conf",
138 xbins=sctMon.NBINS_LBs,
139 xmin=0.5,
140 xmax=sctMon.NBINS_LBs+0.5,
141 opt='kAlwaysCreate')
142
143
144 for errCate in range(sctMon.N_ERRCATEGORY):
145 for region in range(sctMon.N_REGIONS):
146 for layer in range(sctMon.N_ENDCAPSx2):
147 myMonGroup.defineHistogram(
148 varname="eta, phi, hasError_" +
149 sctMon.CategoryErrorsNames[errCate]+"_" +
150 sctMon.subDetNameShort[region].
Data()+
"_" +
151 str(layer//2)+"_"+str(layer % 2) +
152 ";SCT_NumberOf"+sctMon.CategoryErrorsNames[errCate] +
153 sctMon.subDetNameShort[region].
Data()+
"_" +
154 str(layer//2)+"_"+str(layer % 2),
155 type="TProfile2D",
156 title="Num of " +
157 sctMon.CategoryErrorsNames[errCate]+
" per "+sctMon.layerName[region].
Data()+str(
158 layer//2)+"_"+str(layer % 2),
159 path="SCT" +
160 sctMon.subDetNameShort[region].
Data() +
161 "/errors/"+sctMon.CategoryErrorsNames[errCate],
162 xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
163 xmin=(
164 sctMon.FIRST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
165 xmax=(
166 sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
167 ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
168 ymin=(
169 sctMon.FIRST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
170 ymax=(
171 sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
172 duration="lb",
173 opt='kAlwaysCreate')
174
175 if myMonAlg.doOnlineMon and sctMon.CategoryErrorsNames[errCate] == "Errors":
176 myMonGroup.defineHistogram(
177 varname="eta, phi, hasError_" +
178 sctMon.CategoryErrorsNames[errCate]+"_recent_" +
179 sctMon.subDetNameShort[region].
Data()+
"_" +
180 str(layer//2)+"_"+str(layer % 2)+";SummaryErrsRecent_" +
181 sctMon.subDetNameShort[region].
Data()+
"_" +
182 str(layer//2)+"_"+str(layer % 2),
183 type="TProfile2D",
184 title="Num of " +
185 sctMon.CategoryErrorsNames[errCate] +
186 " per "+sctMon.layerName[region].
Data()
187 + str(layer//2)+"_"+str(layer % 2)+" - recent",
188 path="SCT" +
189 sctMon.subDetNameShort[region].
Data() +
190 "/errors",
191 xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
192 xmin=(
193 sctMon.FIRST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
194 xmax=(
195 sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
196 ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
197 ymin=(
198 sctMon.FIRST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
199 ymax=(
200 sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
201 duration="lowStat",
202 opt='kLBNHistoryDepth=30,kAlwaysCreate')
203
204
205 myMonGroup.defineHistogram(varname="maskedLinksBin, maskedLinks;MaskedLinks",
206 type="TProfile",
207 title="Number of Masked Links for SCT,ECA,B,ECC",
208 path="GENERAL/errors",
209 xbins=sctMon.N_REGIONS_INC_GENERAL,
210 xmin=-0.5,
211 xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
212 xlabels=["EndCapC", "Barrel", "EndCapA", "All"],
213 opt='kAlwaysCreate')
214
215
216 myMonGroup.defineHistogram(varname="flaggedWafersIndices, nFlaggedWafers;FlaggedWafers",
217 type="TProfile",
218 title="Number of flagged wafers for SCT,ECA,B,ECC",
219 path="GENERAL/errors",
220 xbins=sctMon.N_REGIONS_INC_GENERAL,
221 xmin=-0.5,
222 xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
223 xlabels=["EndCapC", "Barrel", "EndCapA", "All"],
224 opt='kAlwaysCreate')
225
226
227 coverageTitles = [
228 "",
229 "Ave. Coverage of Enabled Links per LB",
230 "Ave. Coverage of Links with No Bad LinkLevelError per LB",
231 "Ave. Coverage of Links with No Bad RODLevelError per LB",
232 "Ave. Coverage of Links with No Bad Error per LB",
233 "Ave. Coverage of links Not Affected by PS Trip",
234 "Ave. Coverage of Links With No Bad Problem per LB"
235 ]
236 for iProblem in range(1, sctMon.numberOfProblemForCoverage):
237 myMonGroup.defineHistogram(
238 varname="lumiBlock, detectorCoverage" +
239 sctMon.coverageVarNames[iProblem]+";SCT_Coverage" +
240 sctMon.coverageVarNames[iProblem]+"VsLbs",
241 type="TProfile",
242 title=coverageTitles[iProblem] +
243 ";LumiBlock;Detector Coverage [%]",
244 path="DetectorCoverage",
245 xbins=sctMon.NBINS_LBs,
246 xmin=0.5,
247 xmax=sctMon.NBINS_LBs+0.5,
248 opt='kAlwaysCreate')
249
250 if iProblem == sctMon.summary:
251 myMonGroup.defineHistogram(
252 varname="lumiBlock, detectorCoverage" +
253 sctMon.coverageVarNames[iProblem]+"InR4P;SCT_Coverage" +
254 sctMon.coverageVarNames[iProblem]+"InR4PVsLbs",
255 type="TProfile",
256 title=coverageTitles[iProblem] + " in Ready for Physics" +
257 ";LumiBlock;Detector Coverage [%]",
258 path="DetectorCoverage",
259 xbins=sctMon.NBINS_LBs,
260 xmin=0.5,
261 xmax=sctMon.NBINS_LBs+0.5,
262 opt='kAlwaysCreate')
263
264
265 myMonGroup.defineHistogram(varname="lumiBlock, psTripModules;SCT_ModulesWithPSTripVsLbs",
266 type="TProfile",
267 title="Ave. Num of Modules Affected by PS Trip per LB in All Region;LumiBlock;Num. of Modules Affected by PS Trip",
268 path="DetectorCoverage",
269 xbins=sctMon.NBINS_LBs,
270 xmin=0.5,
271 xmax=sctMon.NBINS_LBs+0.5,
272 opt='kAlwaysCreate')
273
274
275 for region in range(sctMon.N_REGIONS):
276 for layer in range(sctMon.n_layers[region]*2):
277 myMonGroup.defineHistogram(
278 varname="eta_out, phi_out, modulemap" +
279 sctMon.subDetNameShort[region].
Data()+str(layer//2)+
"_" +
280 str(layer % 2)+";modulemap" +
281 sctMon.subDetNameShort[region].
Data()+str(layer//2)+
"_" +
282 str(layer % 2),
283 type="TProfile2D",
284 title=
"Module out of configuration: "+sctMon.layerName[region].
Data()+str(layer//2)+
" side "+str(
285 layer % 2) + ";Index in the direction of #eta;Index in the direction of #phi",
286 path="SCT" +
287 sctMon.subDetNameShort[region].
Data()+
"/Conf/",
288 xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
289 xmin=(sctMon.FIRST_ETA_BIN if region ==
290 sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
291 xmax=(
292 sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
293 ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
294 ymin=(sctMon.FIRST_PHI_BIN if region ==
295 sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
296 ymax=(
297 sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
298 duration="lb",
299 opt='kAlwaysCreate')
300
301
302 xlabels = [SCT_ByteStreamErrors.ErrorTypeDescription[i]
303 for i in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES)]
304 for reg in range(sctMon.N_REGIONS):
305 nLayers = sctMon.n_layers[reg]*2
306 ylabels = [str(i//2)+"_"+str(i % 2) for i in range(nLayers)]
307 myMonGroup.defineHistogram(varname="errorType, layerSide, errorFraction;RateErrorsPerLumi",
308 cutmask="is" +
309 sctMon.subDetNameShort[reg].
Data(),
310 type="TProfile2D",
311 title="Rate of Error Types for " +
312 sctMon.layerName[reg].
Data() +
313 " per Lumi-Block",
314 path="SCT" +
315 sctMon.subDetNameShort[reg].
Data(
316 )+"/errors",
317 xbins=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES,
318 xmin=-0.5,
319 xmax=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES-0.5,
320 xlabels=xlabels,
321 ybins=nLayers,
322 ymin=-0.5,
323 ymax=nLayers-0.5,
324 ylabels=ylabels,
325 duration="lb",
326 opt='kAlwaysCreate')
327
328 result.merge(helper.result())
329 return result