ATLAS Offline Software
Loading...
Searching...
No Matches
PixelAthErrorMonAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
10#include "PixelBSUtils.h"
11
12PixelAthErrorMonAlg::PixelAthErrorMonAlg(const std::string& name, ISvcLocator* pSvcLocator) :
13 AthMonitorAlgorithm(name, pSvcLocator)
14{
15 // jo flags
16 declareProperty("doOnline", m_doOnline = false);
17 declareProperty("doLumiBlock", m_doLumiBlock = false);
18 declareProperty("doLowOccupancy", m_doLowOccupancy = false);
19 declareProperty("doHighOccupancy", m_doHighOccupancy = false);
20 declareProperty("doHeavyIonMon", m_doHeavyIonMon = false);
21}
22
24
25
34
35StatusCode PixelAthErrorMonAlg::fillHistograms(const EventContext& ctx) const {
36 using namespace Monitored;
37
38 int lb = GetEventInfo(ctx)->lumiBlock();
39 auto errorGroup = getGroup("Error");
40
41 ATH_MSG_DEBUG("Filling Error Monitoring Histograms");
42
43 unsigned int bcid = GetEventInfo(ctx)->bcid();
44 auto bcidval = Monitored::Scalar<unsigned int>("pixdesyncmontool_bcid", bcid);
45
46 // Generate a vector of error maps for all different error states.
47 std::vector<VecAccumulator2DMap> error_maps_per_state;
48 error_maps_per_state.reserve(kNumErrorStatesFEI3 + kNumErrorStatesFEI4);
49 std::vector<VecAccumulator2DMap> fe_error_maps_per_state;
50 fe_error_maps_per_state.reserve(kNumErrorStatesPerFE);
51 for (const auto& state : error_names_stateFEI3) {
52 error_maps_per_state.emplace_back(*this, state + std::string("Map"));
53 if (isPerFEI3State(state))
54 {
55 fe_error_maps_per_state.emplace_back(*this, state + std::string("FEMap"));
56 }
57 }
58 for (const auto& state : error_names_stateFEI4) {
59 error_maps_per_state.emplace_back(*this, state + std::string("Map"));
60 }
61 if (error_maps_per_state.size()!=(kNumErrorStatesFEI3 + kNumErrorStatesFEI4) ||
62 fe_error_maps_per_state.size()!=kNumErrorStatesPerFE) {
63 ATH_MSG_ERROR("PixelMonitoring: Mismatch in the definition of the number of error states.");
64 return StatusCode::RECOVERABLE;
65 }
66 std::vector<VecAccumulator2DMap> error_maps_per_cat_rodmod;
67 // only first four rodmod histos are unique, others are covered by
68 // the overall, rod/mod-agnostic categories below
69 for (unsigned int cat = 0; cat < ErrorCategoryRODMOD::kTruncROD + 1; ++cat) {
70 error_maps_per_cat_rodmod.emplace_back(*this, error_names_cat_rodmod[cat]);
71 }
72 std::vector<VecAccumulator2DMap> error_maps_per_cat;
73 for (unsigned int cat = 0; cat < ErrorCategory::COUNT; ++cat) {
74 error_maps_per_cat.emplace_back(*this, error_names_cat[cat]);
75 }
76
77 // containers to keep IBL service records info
78 std::vector<int> flagged_ibl_error_bits;
79 std::vector<unsigned int> weights_of_flagged_ibl_error_bits;
80
81 int nActive_layer[PixLayers::COUNT] = {
82 0
83 };
84
85 // Array to count number of errors occurring in all layers.
86 float num_errors[PixLayers::COUNT] = {
87 0
88 };
89 float num_errors_per_state[std::max(kNumErrorStatesFEI3, kNumErrorStatesFEI4)][PixLayers::COUNT] = {{0}};
90
91 // Counters for erroneous modules in a layer, per
92 // error category, w/ and w/o ROD/MOD distinction.
93 float num_errormodules_per_cat[ErrorCategory::COUNT][PixLayers::COUNT] = {{0}};
94 float num_errormodules_per_cat_rodmod[ErrorCategoryRODMOD::COUNT][PixLayers::COUNT] = {{0}};
95
96 // Generate femcc_errwords, ROB error and per LB maps.
97 VecAccumulator2DMap femcc_errwords_maps(*this, "FEMCCErrorwords");
98 VecAccumulator2DMap trunc_rob_errors_maps(*this, "TruncatedROBErrors", true);
99 VecAccumulator2DMap masked_rob_errors_maps(*this, "MaskedROBErrors", true);
100 VecAccumulator2DMap all_errors_maps(*this, "ErrorsLB");
101 VecAccumulator2DMap modsync_errors_maps(*this, "ErrorsModSyncLB");
102 VecAccumulator2DMap rodsync_errors_maps(*this, "ErrorsRODSyncLB");
103
104 //====================================================================================
105 // This is an example how to read the Error informaiton.
106 //
107 // The Error word is defined in
108 // InDetConditions/PixelConditionsData/PixelConditionsData/PixelByteStreamErrors.h
109 //
110 // The IDCInDetBSErrContainer can be accessed through
111 // m_pixelCondSummaryTool->getBSErrorWord(i,ctx)
112 // where
113 // i= [ 0, 2047] : module error
114 // ( [0, 11] - DBMC, [12, 155] - ECC, [156, 435] - IBL,
115 // [436, 721] - B0, [722, 1215] - B1, [1216, 1891] - B2,
116 // [1892, 2035] - ECA, [2036, 2047] - DBMA )
117 //
118 // for PIXEL(FEI3):
119 // = [ 2048, 4095] : FE-0 error
120 // = [ 4096, 6143] : FE-1 error
121 // = [ 6144, 8191] : FE-2 error
122 // ... ... ...
123 // ... ... ...
124 // = [30720, 32767] : FE-14 error
125 // = [32768, 34815] : FE-15 error
126 //
127 // for IBL(FEI4):
128 // = [ 2048, 4095] : FE-0 error
129 // = [ 4096, 6143] : FE-1 error
130 // = [34816, 35375] : Error counter in bit#=0 from ServiceRecords (shift: modHash*nFE+iFE)
131 // = [35376, 35935] : Error counter in bit#=1 from ServiceRecords
132 // ... ... ...
133 // ... ... ...
134 // = [52176, 52735] : Error counter in bit#=31 from ServiceRecords
135 //
136 //====================================================================================
137 //
138
139 const int maxHash = m_pixelid->wafer_hash_max(); // 2048
140
145 if (!idcErrCont.isValid()) {
146 ATH_MSG_FATAL("Faled to get BS error container" << m_idcErrContKey.key() );
147 }
148 }
149 // Loop over modules except DBM, s.a.
150 for (int modHash = 12; modHash < maxHash - 12; modHash++) {
151 Identifier waferID = m_pixelid->wafer_id(modHash);
152 int pixlayer = getPixLayersID(m_pixelid->barrel_ec(waferID), m_pixelid->layer_disk(waferID));
153 int nFE(0);
154 bool is_fei4(false); // FEI4 readout architecture (IBL, DBM)
155 int iblsublayer(pixlayer);
156 if (pixlayer == PixLayers::kIBL) {
157 if (m_pixelid->eta_module(waferID) > -7 && m_pixelid->eta_module(waferID) < 6) { // IBL Planar
158 nFE = 2;
159 iblsublayer = PixLayers::kIBL2D;
160 } else { // IBL 3D
161 nFE = 1;
162 iblsublayer = PixLayers::kIBL3D;
163 }
164 is_fei4 = true;
165 } else { // for fei3 Pixel layers
166 nFE = 16;
167 is_fei4 = false;
168 }
169 // flagging/counting categorized errors per module.
170 bool has_err_cat[ErrorCategory::COUNT][nFEIBL2D] = {{false}};
171 int nerrors_cat_rodmod[ErrorCategoryRODMOD::COUNT][nFEIBL2D] = {{0}};
172
173 // count number of words w/ MCC/FE flags per module
174 unsigned int num_femcc_errwords = 0;
175
176 uint64_t mod_errorword = (!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask
177 ? InDet::getBSErrorWord( *pixel_active,
178 *idcErrCont,
179 modHash,
180 modHash,
182 : m_pixelCondSummaryTool->getBSErrorWord(modHash, ctx) );
183 VALIDATE_STATUS_ARRAY(!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask, InDet::getBSErrorWord( *pixel_active,*idcErrCont,modHash,modHash,m_readoutTechnologyMask) ,m_pixelCondSummaryTool->getBSErrorWord(modHash, ctx) );
184
185 // extracting ROB error information
186 //
187 if (PixelByteStreamErrors::hasError(mod_errorword, PixelByteStreamErrors::TruncatedROB)) {
188 trunc_rob_errors_maps.add(pixlayer, waferID, 1.0);
189 }
190 if (PixelByteStreamErrors::hasError(mod_errorword, PixelByteStreamErrors::MaskedROB)) {
191 masked_rob_errors_maps.add(pixlayer, waferID, 1.0);
192 }
193 // getting module_error information (only fei3 layers)
194 //
195 if (!is_fei4) {
196 std::bitset<kNumErrorStatesFEI3> stateFEI3 = getErrorStateFEI3Mod(mod_errorword);
197 num_errors[pixlayer] += stateFEI3.count();
198 for (unsigned int state = 0; state < stateFEI3.size(); ++state) {
199 if (stateFEI3[state]) {
200 num_errors_per_state[state][pixlayer]++;
201 error_maps_per_state[state].add(pixlayer, waferID, 1.0);
202 }
203 }
204 fillErrorCatRODmod(mod_errorword, nerrors_cat_rodmod);
205 }
206
207 // getting fe_error information (all pixel layers)
208 //
209 for (int iFE = 0; iFE < nFE; iFE++) {
210
211 int offsetFE = (1 + iFE) * maxHash + modHash; // (FE index+1)*2048 + moduleHash
212 uint64_t fe_errorword = (!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask
213 ? InDet::getBSErrorWord( *pixel_active,
214 *idcErrCont,
215 modHash,
216 offsetFE,
218 : m_pixelCondSummaryTool->getBSErrorWord(modHash, offsetFE, ctx) );
219 VALIDATE_STATUS_ARRAY(!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask, InDet::getBSErrorWord( *pixel_active,*idcErrCont,modHash,offsetFE,m_readoutTechnologyMask) ,m_pixelCondSummaryTool->getBSErrorWord(modHash, offsetFE, ctx) );
220
221
222 fillErrorCatRODmod(fe_errorword, is_fei4, nerrors_cat_rodmod, iFE);
223
224 if (!is_fei4) {
225 std::bitset<kNumErrorStatesFEI3> stateFEI3 = getErrorStateFE(fe_errorword, is_fei4);
226 num_errors[pixlayer] += stateFEI3.count();
227 if (stateFEI3.any()) num_femcc_errwords++;
228 int perFEI3state(-1);
229 for (unsigned int state = 0; state < stateFEI3.size(); ++state) {
230 if (isPerFEI3State(error_names_stateFEI3[state])) perFEI3state++;
231 if (stateFEI3[state]) {
232 num_errors_per_state[state][pixlayer]++;
233 if (perFEI3state>=0 && perFEI3state<kNumErrorStatesPerFE) {
234 fe_error_maps_per_state[perFEI3state].add(pixlayer, waferID, iFE, 1.0);
235 } else {
236 error_maps_per_state[state].add(pixlayer, waferID, 1.0);
237 }
238 }
239 }
240 } else {
241 std::bitset<kNumErrorStatesFEI3> stateFEI4 = getErrorStateFE(fe_errorword, is_fei4);
242 num_errors[iblsublayer] += stateFEI4.count();
243 Identifier pixelIDperFEI4 = m_pixelReadout->getPixelIdfromHash(modHash, iFE, 1, 1);
244 for (unsigned int state = 0; state < stateFEI4.size(); ++state) {
245 if (stateFEI4[state]) {
246 num_errors_per_state[state][iblsublayer]++;
247 error_maps_per_state[state + kNumErrorStatesFEI3].add(pixlayer, pixelIDperFEI4, 1.0);
248 }
249 }
250 }
251 } // FE loop
252 if (!is_fei4) femcc_errwords_maps.add(pixlayer, waferID, num_femcc_errwords);
253
254 // getting error information from service records (only IBL)
255 //
256 int state_offset(8); // serviceCode part starts from state 8 of kNumErrorStatesFEI4
257 const int serviceRecordFieldOffset = 17 * maxHash;
258 if (pixlayer == PixLayers::kIBL) {
259 int moduleOffset = (modHash - 156) * 2;
260 for (int serviceCode = 0; serviceCode < 32; serviceCode++) {
261 // skip irrelevant SR's (as in rel21)
262 if ((serviceCode >= 9 && serviceCode <= 14) || (serviceCode >= 17 && serviceCode <= 23)) {
263 state_offset--;
264 continue;
265 }
266 int serviceCodeOffset = serviceCode * 280 * 2;
267 for (int iFE = 0; iFE < nFE; iFE++) {
268 Identifier pixelIDperFEI4 = m_pixelReadout->getPixelIdfromHash(modHash, iFE, 1, 1);
269 // index = offset + (serviceCode)*(#IBL*nFEmax) + (moduleHash-156)*nFEmax + iFE
270 int serviceCodeCounterIndex = serviceRecordFieldOffset + serviceCodeOffset + moduleOffset + iFE;
271 uint64_t serviceCodeCounter = (!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask
272 ? InDet::getBSErrorWord( *pixel_active,
273 *idcErrCont,
274 modHash,
275 serviceCodeCounterIndex,
277 : m_pixelCondSummaryTool->getBSErrorWord(modHash, serviceCodeCounterIndex, ctx) );
278 VALIDATE_STATUS_ARRAY(!m_pixelDetElStatusActiveOnly.empty() && m_readoutTechnologyMask, InDet::getBSErrorWord( *pixel_active,*idcErrCont,modHash,serviceCodeCounterIndex,m_readoutTechnologyMask) ,m_pixelCondSummaryTool->getBSErrorWord(modHash, serviceCodeCounterIndex, ctx) );
279
280 if (serviceCodeCounter > 0) {
281 float payload = serviceCodeCounter; // NB: + 1, as in rel 21, is now added upstream
282 flagged_ibl_error_bits.push_back(serviceCode);
283 weights_of_flagged_ibl_error_bits.push_back(payload);
284
285 int state = serviceCode + state_offset;
286 num_errors[iblsublayer] += payload;
287 num_errors_per_state[state][iblsublayer] += payload;
288 error_maps_per_state[state + kNumErrorStatesFEI3].add(pixlayer, pixelIDperFEI4, payload);
289
290 fillErrorCatRODmod(serviceCode, payload, nerrors_cat_rodmod, iFE);
291 }
292 } // over FE
293 } //over service codes
294 } // IBL modules
295
296 // access categorized error information per module (for IBL - FE)
297 // it is only flagged - the actual number of errors per category is not tracked
298 for (int iFE = 0; iFE < nFE; iFE++) {
299 if (pixlayer != PixLayers::kIBL && iFE > 0) continue;
300 Identifier pixID = waferID;
301 if (pixlayer == PixLayers::kIBL) {
302 pixID = m_pixelReadout->getPixelIdfromHash(modHash, iFE, 1, 1);
303 }
304 if (pixID.is_valid()) {
305 for (int i = 0; i < ErrorCategoryRODMOD::COUNT; i++) {
306 if (nerrors_cat_rodmod[i][iFE]) {
307 if (getErrorCategory(i + 1) != 99) has_err_cat[getErrorCategory(i + 1)][iFE] = true;
308 if (pixlayer == PixLayers::kIBL) num_errormodules_per_cat_rodmod[i][iblsublayer]++;
309 else num_errormodules_per_cat_rodmod[i][pixlayer]++;
310 if (!m_doOnline) {
311 all_errors_maps.add(pixlayer, pixID, nerrors_cat_rodmod[i][iFE]);
312 if (i < ErrorCategoryRODMOD::kTruncROD + 1) {
313 error_maps_per_cat_rodmod[i].add(pixlayer, pixID, 1.0);
314 if (i == 0) modsync_errors_maps.add(pixlayer, pixID, 1.0);
315 if (i == 1) rodsync_errors_maps.add(pixlayer, pixID, 1.0);
316 }
317 }
318 }
319 }
320 for (int i = 0; i < ErrorCategory::COUNT; i++) {
321 if (has_err_cat[i][iFE]) {
322 if (pixlayer == PixLayers::kIBL) num_errormodules_per_cat[i][iblsublayer]++;
323 else num_errormodules_per_cat[i][pixlayer]++;
324 if (!m_doOnline) {
325 error_maps_per_cat[i].add(pixlayer, pixID, 1.0);
326 }
327 }
328 }
329
330 // filling nActive modules per layer for later normalization
331 // for IBL normalization is done by number of FEI4
332 if ((pixlayer != PixLayers::kIBL && isActive(!m_pixelDetElStatusActiveOnly.empty() ? pixel_active.cptr() : nullptr, modHash) == true) ||
333 (pixlayer == PixLayers::kIBL && isChipActive(!m_pixelDetElStatusActiveOnly.empty() ? pixel_active.cptr() : nullptr, modHash, iFE) == true)) {
334 if (pixlayer == PixLayers::kIBL) nActive_layer[iblsublayer]++;
335 else nActive_layer[pixlayer]++;
336 }
337 } else {
338 ATH_MSG_ERROR("PixelMonitoring: got invalid pixID " << pixID);
339 }
340 } // loop over FEs
341 } // loop over modules
342
343 // normalization by active modules (or FE's in IBL case)
344 //
345 for (int i = 0; i < PixLayers::COUNT; i++) {
346 if (nActive_layer[i] > 0) {
347 for (int state = 0; state < numErrorStatesLayer[i]; state++) {
348 num_errors_per_state[state][i] /= nActive_layer[i];
349 }
350 for (int cat = 0; cat < ErrorCategoryRODMOD::COUNT; cat++) {
351 num_errormodules_per_cat_rodmod[cat][i] /= nActive_layer[i];
352 }
353 for (int cat = 0; cat < ErrorCategory::COUNT; cat++) {
354 num_errormodules_per_cat[cat][i] /= nActive_layer[i];
355 }
356 }
357 }
358 int perFEI3state(0);
359 for (unsigned int state = 0; state < kNumErrorStatesFEI3 + kNumErrorStatesFEI4; state++) {
360 if (state < kNumErrorStatesFEI3) {
361 if (isPerFEI3State(error_names_stateFEI3[state]) && perFEI3state<kNumErrorStatesPerFE)
362 fill2DProfLayerAccum(fe_error_maps_per_state[perFEI3state++]);
363 else fill2DProfLayerAccum(error_maps_per_state[state]);
364 fill1DProfLumiLayers(error_names_stateFEI3[state] + std::string(
365 "PerLumi"), lb, num_errors_per_state[state], PixLayers::NFEI3LAYERS);
366 } else {
367 fill2DProfLayerAccum(error_maps_per_state[state]);
369 "PerLumi"), lb, num_errors_per_state[state - kNumErrorStatesFEI3],
371 }
372 }
373 // Fill the accumulated maps
374 fill2DProfLayerAccum(femcc_errwords_maps);
375 fill2DProfLayerAccum(trunc_rob_errors_maps);
376 fill2DProfLayerAccum(masked_rob_errors_maps);
377 fill2DProfLayerAccum(all_errors_maps);
378 fill2DProfLayerAccum(modsync_errors_maps);
379 fill2DProfLayerAccum(rodsync_errors_maps);
380
381 for (int i = 0; i < PixLayers::COUNT; i++) {
382 auto val = Monitored::Scalar<float>("AvgSyncErrPerBCID_val", num_errormodules_per_cat_rodmod[0][i]);
383 fill(pixLayersLabel[i], bcidval, val);
384 }
385
386 if (!m_doOnline) {
387 for (unsigned int cat = 0; cat < ErrorCategoryRODMOD::kTruncROD + 1; ++cat) {
388 fill2DProfLayerAccum(error_maps_per_cat_rodmod[cat]);
389 }
390 for (unsigned int cat = 0; cat < ErrorCategory::COUNT; ++cat) {
391 fill2DProfLayerAccum(error_maps_per_cat[cat]);
392 }
393 }
394 // Fill the luminosity error profiles for all layers.
395 fill1DProfLumiLayers("ErrorsPerLumi", lb, num_errors);
396
397 auto vals = Monitored::Collection("ServiceRecord_val", flagged_ibl_error_bits);
398 auto wgts = Monitored::Collection("ServiceRecord_wgt", weights_of_flagged_ibl_error_bits);
399 fill(errorGroup, vals, wgts);
400
401 // Fill 2D luminosity error profiles per error bit and cat split by ROD/MOD for all layers.
402 fill2DProfLumiLayers("ErrorStatePerLumi", lb, num_errors_per_state, numErrorStatesLayer);
403 fill2DProfLumiLayers("ErrorCatRODModPerLumi", lb, num_errormodules_per_cat_rodmod, numErrorCatRODModsLayer);
404
405 // Fill 1D luminosity error profiles for error catergory for all layers.
406 for (unsigned int cat = 0; cat < error_names_cat_rodmod_norm.size(); ++cat) {
407 fill1DProfLumiLayers(error_names_cat_rodmod_norm[cat], lb, num_errormodules_per_cat_rodmod[cat]);
408 }
409 for (unsigned int cat = 0; cat < ErrorCategory::COUNT; ++cat) {
410 fill1DProfLumiLayers(error_names_cat_norm[cat], lb, num_errormodules_per_cat[cat]);
411 }
412
413 return StatusCode::SUCCESS;
414}
415
416int PixelAthErrorMonAlg::getErrorCategory(int error_cat_rodmod) const {
417 int error_cat = 99;
418
419 if (error_cat_rodmod == 1 || error_cat_rodmod == 2) error_cat = ErrorCategory::kSync;
420 if (error_cat_rodmod == 3 || error_cat_rodmod == 4) error_cat = ErrorCategory::kTrunc;
421 if (error_cat_rodmod == 5) error_cat = ErrorCategory::kOpt;
422 if (error_cat_rodmod == 6) error_cat = ErrorCategory::kSeu;
423 if (error_cat_rodmod == 7) error_cat = ErrorCategory::kTout;
424 return error_cat;
425}
426
427std::bitset<kNumErrorStatesFEI3> PixelAthErrorMonAlg::getErrorStateFEI3Mod(uint64_t errorword) const {
428 std::bitset<kNumErrorStatesFEI3> result(0);
429 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::TimeOut)) result |= 1;
430 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::BCID)) result |= 1 << 1;
431 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::LVL1ID)) result |= 1 << 2;
432 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Preamble)) result |= 1 << 3;
433 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::RODTrailerBitError)) result |= 1 << 14;
434 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::RODHeaderLimit)) result |= 1 << 15;
435 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::RODDataOVerflow)) result |= 1 << 16;
436 return result;
437}
438
439std::bitset<kNumErrorStatesFEI3> PixelAthErrorMonAlg::getErrorStateFE(uint64_t errorword, bool is_fei4) const {
440 std::bitset<kNumErrorStatesFEI3> result(0);
441 if (!is_fei4) {
442 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCLVL1IDEoECheck)) result |= 1 << 4;
443 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCBCIDEoECheck)) result |= 1 << 5;
444 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCLVL1IDCheck)) result |= 1 << 6;
445 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCEoEOverflow)) result |= 1 << 7;
446 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCHitOverflow)) result |= 1 << 8;
447 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEWarning)) result |= 1 << 9;
448 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEHitParity)) result |= 1 << 10;
449 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FERegisterParity)) result |= 1 << 11;
450 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEHammingCode)) result |= 1 << 12;
451 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEEoCOverflow)) result |= 1 << 13;
452 } else {
453 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::TimeOut)) result |= 1;
454 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::BCID)) result |= 1 << 1;
455 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::LVL1ID)) result |= 1 << 2;
456 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Preamble)) result |= 1 << 3;
457 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Trailer)) result |= 1 << 4;
458 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Invalid)) result |= 1 << 5;
459 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::LinkMaskedByPPC)) result |= 1 << 6;
460 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Limit)) result |= 1 << 7;
461 }
462 return result;
463}
464
466 int (&nerrors_cat_rodmod)[ErrorCategoryRODMOD::COUNT][nFEIBL2D]) const {
467 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::TimeOut)) nerrors_cat_rodmod[6][0]++;// timeout errors
468 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::BCID)) nerrors_cat_rodmod[1][0]++;// ROD synchronization
469 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::LVL1ID)) nerrors_cat_rodmod[1][0]++;// ROD synchronization
470 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Preamble)) nerrors_cat_rodmod[4][0]++;// optical errors
471 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::RODHeaderLimit)) nerrors_cat_rodmod[3][0]++;// ROD truncation
472 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::RODDataOVerflow)) nerrors_cat_rodmod[3][0]++;// ROD truncation
473}
474
475void PixelAthErrorMonAlg::fillErrorCatRODmod(uint64_t errorword, bool is_fei4,
476 int (&nerrors_cat_rodmod)[ErrorCategoryRODMOD::COUNT][nFEIBL2D],
477 int ife) const {
478 if (!is_fei4) {
479 if (PixelByteStreamErrors::hasError(errorword,
480 PixelByteStreamErrors::MCCLVL1IDEoECheck)) nerrors_cat_rodmod[0][0]++;// module synchronization
481 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCBCIDEoECheck)) nerrors_cat_rodmod[0][0]++; // ---
482 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCLVL1IDCheck)) nerrors_cat_rodmod[0][0]++; // ---
483 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCEoEOverflow)) nerrors_cat_rodmod[2][0]++;// module truncation
484 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::MCCHitOverflow)) nerrors_cat_rodmod[2][0]++; // ---
485 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEEoCOverflow)) nerrors_cat_rodmod[2][0]++;// ---
486 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEHitParity)) nerrors_cat_rodmod[5][0]++;// SEU (single event upset)
487 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FERegisterParity)) nerrors_cat_rodmod[5][0]++;
488 // ---
489 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::FEHammingCode)) nerrors_cat_rodmod[5][0]++;// ---
490 } else {
491 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::TimeOut)) nerrors_cat_rodmod[6][ife]++;// timeout errors
492 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::BCID)) nerrors_cat_rodmod[1][ife]++;// ROD synchronization
493 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::LVL1ID)) nerrors_cat_rodmod[1][ife]++;// ROD synchronization
494 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Preamble)) nerrors_cat_rodmod[4][ife]++;// optical errors
495 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Trailer)) nerrors_cat_rodmod[6][ife]++;// timeout errors
496 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Invalid)) nerrors_cat_rodmod[3][ife]++;// ROD truncation
497 if (PixelByteStreamErrors::hasError(errorword, PixelByteStreamErrors::Limit)) nerrors_cat_rodmod[3][ife]++;// ROD truncation
498 }
499}
500
502 int (&nerrors_cat_rodmod)[ErrorCategoryRODMOD::COUNT][nFEIBL2D],
503 int ife) const {
504 if (sc == 0) nerrors_cat_rodmod[0][ife] += payload;// synchronization error (SR0:BCID counter)
505 if (sc == 16) nerrors_cat_rodmod[2][ife] += payload;// truncation error (SR16:Truncated event)
506 if (sc == 1 || sc == 2 || // (SR1:Hamming code 0, SR2:Hamming code 1,
507 sc == 3 || sc == 24 || // SR3:Hamming code 2, SR24:Triple redundant CNFGMEM,
508 sc == 28 || sc == 29 || // SR28:Bit flip in CMD, SR29:Triple redundant CMD,
509 sc == 31) // SR31:Triple redundant EFUSE)
510 nerrors_cat_rodmod[5][ife] += payload;// SEU error
511}
512
513bool PixelAthErrorMonAlg::isPerFEI3State(const std::string& state) const {
514 return (state.find("SEU") != std::string::npos ||
515 state.find("EOC") != std::string::npos ||
516 state.find("Warning") != std::string::npos);
517}
518
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
static const int kNumErrorStatesFEI4
static constexpr std::array< const char *, 4 > error_names_cat_rodmod_norm
static constexpr std::array< const char *, kNumErrorStatesFEI4 > error_names_stateFEI4
static constexpr std::array< const char *, ErrorCategory::COUNT > error_names_cat_norm
static constexpr std::array< const char *, ErrorCategoryRODMOD::COUNT > error_names_cat_rodmod
static const int numErrorStatesLayer[PixLayers::COUNT]
static const int numErrorCatRODModsLayer[PixLayers::COUNT]
static const int kNumErrorStatesPerFE
static const int kNumErrorStatesFEI3
static constexpr std::array< const char *, ErrorCategory::COUNT > error_names_cat
static constexpr std::array< const char *, kNumErrorStatesFEI3 > error_names_stateFEI3
static const int nFEIBL2D
const std::string pixLayersLabel[PixLayers::COUNT]
#define VALIDATE_STATUS_ARRAY(use_info, info_val, summary_val)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
bool is_valid() const
Check if id is in a valid state.
Declare a monitored scalar variable.
PixelAthErrorMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::bitset< kNumErrorStatesFEI3 > getErrorStateFE(uint64_t errorword, bool isibl) const
bool isPerFEI3State(const std::string &state) const
Gaudi::Property< bool > m_useByteStreamRD53
void fillErrorCatRODmod(uint64_t mod_errorword, int(&nerrors_cat_rodmod)[ErrorCategoryRODMOD::COUNT][nFEIBL2D]) const
virtual StatusCode initialize() override
initialize
SG::ReadHandleKey< IDCInDetBSErrContainer > m_idcErrContKey
Gaudi::Property< bool > m_useByteStreamFEI4
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
int getErrorCategory(int error_cat_rodmod) const
Gaudi::Property< bool > m_useByteStreamFEI3
unsigned int m_readoutTechnologyMask
std::bitset< kNumErrorStatesFEI3 > getErrorStateFEI3Mod(uint64_t errorword) const
void fill2DProfLayerAccum(const VecAccumulator2DMap &accumulator) const
take VecAccumulator2DMap and fill the corresponding group
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusActiveOnly
Optional read handle to get status data to test whether a pixel detector element is active.
bool isChipActive(const IdentifierHash &module_hash, unsigned int chip_i) const
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
void fill2DProfLumiLayers(const std::string &prof2Dname, int lb, float(*weights)[PixLayers::COUNT], const int *nCategories) const
filling 2DProf per-lumi per-layer histograms ["ECA","ECC","BLayer","Layer1","Layer2",...
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
void fill1DProfLumiLayers(const std::string &prof1Dname, int lb, float *weights, int nlayers=PixLayers::COUNT) const
filling 1DProf per-lumi per-layer histograms ["ECA","ECC","BLayer","Layer1","Layer2",...
int getPixLayersID(int ec, int ld) const
helper function to get layers ID
bool isActive(const InDet::SiDetectorElementStatus *element_status, const IdentifierHash &module_hash) const
SG::ReadHandle< InDet::SiDetectorElementStatus > getPixelDetElStatus(const SG::ReadHandleKey< InDet::SiDetectorElementStatus > &key, const EventContext &ctx) const
virtual StatusCode initialize() override
initialize
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
int lb
Definition globals.cxx:23
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
unsigned int getBSErrorWord(const InDet::SiDetectorElementStatus &elementStatus, const IDCInDetBSErrContainer &bsErrorContainer, const IdentifierHash &moduleIdHash, unsigned int index, unsigned int readOutTechnologyMask=(Pixel::makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology::FEI4)|(Pixel::makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology::FEI3))))
Retrieve the bytestream error word for the given module if the readout technology of the module is co...
Generic monitoring tool for athena components.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
unsigned int makeReadoutTechnologyBit(InDetDD::PixelReadoutTechnology technology, unsigned int bit_val=1)
Create a word with a bit representing the given readout technology to the given value.