47 std::vector<VecAccumulator2DMap> error_maps_per_state;
49 std::vector<VecAccumulator2DMap> fe_error_maps_per_state;
52 error_maps_per_state.emplace_back(*
this, state + std::string(
"Map"));
55 fe_error_maps_per_state.emplace_back(*
this, state + std::string(
"FEMap"));
59 error_maps_per_state.emplace_back(*
this, state + std::string(
"Map"));
63 ATH_MSG_ERROR(
"PixelMonitoring: Mismatch in the definition of the number of error states.");
64 return StatusCode::RECOVERABLE;
66 std::vector<VecAccumulator2DMap> error_maps_per_cat_rodmod;
72 std::vector<VecAccumulator2DMap> error_maps_per_cat;
78 std::vector<int> flagged_ibl_error_bits;
79 std::vector<unsigned int> weights_of_flagged_ibl_error_bits;
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");
139 const int maxHash =
m_pixelid->wafer_hash_max();
150 for (
int modHash = 12; modHash < maxHash - 12; modHash++) {
155 int iblsublayer(pixlayer);
174 unsigned int num_femcc_errwords = 0;
188 trunc_rob_errors_maps.add(pixlayer, waferID, 1.0);
191 masked_rob_errors_maps.add(pixlayer, waferID, 1.0);
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);
209 for (
int iFE = 0; iFE < nFE; iFE++) {
211 int offsetFE = (1 + iFE) * maxHash + modHash;
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) {
231 if (stateFEI3[state]) {
232 num_errors_per_state[state][pixlayer]++;
234 fe_error_maps_per_state[perFEI3state].add(pixlayer, waferID, iFE, 1.0);
236 error_maps_per_state[state].add(pixlayer, waferID, 1.0);
241 std::bitset<kNumErrorStatesFEI3> stateFEI4 =
getErrorStateFE(fe_errorword, is_fei4);
242 num_errors[iblsublayer] += stateFEI4.count();
244 for (
unsigned int state = 0; state < stateFEI4.size(); ++state) {
245 if (stateFEI4[state]) {
246 num_errors_per_state[state][iblsublayer]++;
252 if (!is_fei4) femcc_errwords_maps.add(pixlayer, waferID, num_femcc_errwords);
257 const int serviceRecordFieldOffset = 17 * maxHash;
259 int moduleOffset = (modHash - 156) * 2;
260 for (
int serviceCode = 0; serviceCode < 32; serviceCode++) {
262 if ((serviceCode >= 9 && serviceCode <= 14) || (serviceCode >= 17 && serviceCode <= 23)) {
266 int serviceCodeOffset = serviceCode * 280 * 2;
267 for (
int iFE = 0; iFE < nFE; iFE++) {
270 int serviceCodeCounterIndex = serviceRecordFieldOffset + serviceCodeOffset + moduleOffset + iFE;
275 serviceCodeCounterIndex,
280 if (serviceCodeCounter > 0) {
281 float payload = serviceCodeCounter;
282 flagged_ibl_error_bits.push_back(serviceCode);
283 weights_of_flagged_ibl_error_bits.push_back(payload);
285 int state = serviceCode + state_offset;
286 num_errors[iblsublayer] += payload;
287 num_errors_per_state[state][iblsublayer] += payload;
298 for (
int iFE = 0; iFE < nFE; iFE++) {
306 if (nerrors_cat_rodmod[i][iFE]) {
308 if (pixlayer ==
PixLayers::kIBL) num_errormodules_per_cat_rodmod[i][iblsublayer]++;
309 else num_errormodules_per_cat_rodmod[i][pixlayer]++;
311 all_errors_maps.add(pixlayer, pixID, nerrors_cat_rodmod[i][iFE]);
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);
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]++;
325 error_maps_per_cat[i].add(pixlayer, pixID, 1.0);
335 else nActive_layer[pixlayer]++;
338 ATH_MSG_ERROR(
"PixelMonitoring: got invalid pixID " << pixID);
346 if (nActive_layer[i] > 0) {
348 num_errors_per_state[state][i] /= nActive_layer[i];
351 num_errormodules_per_cat_rodmod[cat][i] /= nActive_layer[i];
354 num_errormodules_per_cat[cat][i] /= nActive_layer[i];
399 fill(errorGroup, vals, wgts);
413 return StatusCode::SUCCESS;
479 if (PixelByteStreamErrors::hasError(errorword,