32 return StatusCode::SUCCESS;
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"));
55 fe_error_maps_per_state.emplace_back(*
this, state + std::string(
"FEMap"));
58 for (
const auto& state : error_names_stateFEI4) {
59 error_maps_per_state.emplace_back(*
this, state + std::string(
"Map"));
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;
66 std::vector<VecAccumulator2DMap> error_maps_per_cat_rodmod;
70 error_maps_per_cat_rodmod.emplace_back(*
this, error_names_cat_rodmod[cat]);
72 std::vector<VecAccumulator2DMap> error_maps_per_cat;
74 error_maps_per_cat.emplace_back(*
this, error_names_cat[cat]);
78 std::vector<int> flagged_ibl_error_bits;
79 std::vector<unsigned int> weights_of_flagged_ibl_error_bits;
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]++;
233 if (perFEI3state>=0 && perFEI3state<kNumErrorStatesPerFE) {
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]++;
247 error_maps_per_state[state + kNumErrorStatesFEI3].add(pixlayer, pixelIDperFEI4, 1.0);
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;
288 error_maps_per_state[state + kNumErrorStatesFEI3].add(pixlayer, pixelIDperFEI4,
payload);
298 for (
int iFE = 0; iFE < nFE; iFE++) {
304 if (pixID.is_valid()) {
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) {
347 for (
int state = 0; state < numErrorStatesLayer[
i]; state++) {
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];
359 for (
unsigned int state = 0; state < kNumErrorStatesFEI3 + kNumErrorStatesFEI4; state++) {
360 if (state < kNumErrorStatesFEI3) {
361 if (
isPerFEI3State(error_names_stateFEI3[state]) && perFEI3state<kNumErrorStatesPerFE)
369 "PerLumi"),
lb, num_errors_per_state[state - kNumErrorStatesFEI3],
403 fill2DProfLumiLayers(
"ErrorCatRODModPerLumi",
lb, num_errormodules_per_cat_rodmod, numErrorCatRODModsLayer);
406 for (
unsigned int cat = 0; cat < error_names_cat_rodmod_norm.size(); ++cat) {
413 return StatusCode::SUCCESS;
428 std::bitset<kNumErrorStatesFEI3>
result(0);
440 std::bitset<kNumErrorStatesFEI3>
result(0);
479 if (PixelByteStreamErrors::hasError(errorword,
504 if (
sc == 0) nerrors_cat_rodmod[0][ife] +=
payload;
505 if (
sc == 16) nerrors_cat_rodmod[2][ife] +=
payload;
506 if (
sc == 1 ||
sc == 2 ||
507 sc == 3 ||
sc == 24 ||
508 sc == 28 ||
sc == 29 ||
510 nerrors_cat_rodmod[5][ife] +=
payload;
514 return (state.find(
"SEU") != std::string::npos ||
515 state.find(
"EOC") != std::string::npos ||
516 state.find(
"Warning") != std::string::npos);