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