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