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  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 
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
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;
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]);
368  fill1DProfLumiLayers(error_names_stateFEI4[state - kNumErrorStatesFEI3] + std::string(
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 
416 int 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 
427 std::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 
439 std::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 
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 
513 bool 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 
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:439
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
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:513
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
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
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
pixLayersLabel
const std::string pixLayersLabel[PixLayers::COUNT]
Definition: PixelAthMonitoringBase.h:33
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:85
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:465
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:228
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:831
InDetDD::PixelReadoutTechnology::FEI4
@ FEI4
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
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
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
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:427
PixelAthErrorMonAlg::getErrorCategory
int getErrorCategory(int error_cat_rodmod) const
Definition: PixelAthErrorMonAlg.cxx:416
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
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
Identifier
Definition: IdentifierFieldParser.cxx:14