From fe12ecb64726b01e5ea4d3e886a71de80b0f65b4 Mon Sep 17 00:00:00 2001
From: Daiya Akiyama <daiya.akiyama@cern.ch>
Date: Fri, 5 Jul 2024 00:40:58 +0900
Subject: [PATCH 1/5] Fixing the bug on the bad error judgement

---
 .../SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
index a6c2b3ec7cdf..c33d4489ba51 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
@@ -124,7 +124,7 @@ SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash, const Even
     auto errorCode{idcCachePtr->retrieve(elementIdHash)};
 
     for (auto badError : SCT_ByteStreamErrors::BadErrors) {
-      if (errorCode == badError) {
+      if (SCT_ByteStreamErrors::hasError(errorCode, badError)) {
         ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << errorCode  << " for ID " << elementIdHash);
         return false;
       }
@@ -200,7 +200,10 @@ SCT_ByteStreamErrorsTool::getDetectorElementStatus(const EventContext& ctx, InDe
    unsigned int element_i=0;
    for ( const auto &val : idcCachePtr->IDCCache->rawReadAccess()) {
       uint64_t error_code = val;
-      bool is_bad=(error_code<63) && ((1ull<<error_code) &  m_badErrorMask);
+      bool is_bad(false);
+      for (auto badError : SCT_ByteStreamErrors::BadErrors) {
+	is_bad |= SCT_ByteStreamErrors::hasError(error_code, badError);
+      }
       status.at(element_i) = status.at(element_i) & not is_bad;
       if ( is_bad ) {
          ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << error_code  << " for ID " << element_i);
-- 
GitLab


From abb1c0f5f7331d419bdf9894588ea3d4bbe38aed Mon Sep 17 00:00:00 2001
From: Daiya Akiyama <daiya.akiyama@cern.ch>
Date: Sun, 21 Jul 2024 21:27:54 +0900
Subject: [PATCH 2/5] update the reference files

---
 Tools/PROCTools/data/q442_AOD_digest.ref      | 14 ++---
 Tools/PROCTools/data/q449_AOD_digest.ref      | 60 +++++++++----------
 .../share/ref_v1Dev_decodeBS_build.ref        |  2 +-
 3 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/Tools/PROCTools/data/q442_AOD_digest.ref b/Tools/PROCTools/data/q442_AOD_digest.ref
index ad4de6f4c1f2..1a810c6d16d4 100644
--- a/Tools/PROCTools/data/q442_AOD_digest.ref
+++ b/Tools/PROCTools/data/q442_AOD_digest.ref
@@ -2,25 +2,25 @@
       330470  1183722158           1           0           0           0           0           0           0           0           0           0           0
       330470  1183722342         369         428          18           2           0           2           0           2          11           0          11
       330470  1183727953         481         589          99           7           2           7           0           7          17           0          17
-      330470  1183732647         419         502         133          11           0           7           0           7          18           0          18
-      330470  1183733040         286         291          25           3           1           5           0           5           8           0           8
+      330470  1183732647         419         503         133          11           0           7           0           7          18           0          18
+      330470  1183733040         286         292          25           3           1           5           0           5           8           0           8
       330470  1183734651         325         371          61           6           2           4           0           4          15           0          15
       330470  1183735332         355         386          39           6           0           5           0           5           7           0           7
-      330470  1183736475         690         710          73           5           0           3           0           3          21           0          21
+      330470  1183736475         690         711          73           5           0           3           0           3          21           0          21
       330470  1183738728           1           0           0           0           0           0           0           0           0           0           0
       330470  1183738949         342         450          80           8           0           5           0           5          10           0          10
       330470  1183742489         107         128           0           0           0           0           0           0           0           0           0
       330470  1183743040         232         326          22           4           0           2           0           2           1           0           1
-      330470  1183746343         445         494          52           5           0           2           0           2          15           0          15
+      330470  1183746343         445         495          52           5           0           2           0           2          15           0          15
       330470  1183746710           4           0           0           0           0           0           0           0           0           0           0
       330470  1183751782         212         245          12           3           0           0           0           0           3           0           3
-      330470  1183752624         329         368          49           5           1           3           0           3          13           0          13
+      330470  1183752624         329         368          49           5           2           3           0           3          13           0          13
       330470  1183753006         321         398          59           8           1           5           0           5          10           0          10
-      330470  1183754806         362         425          63           8           0           4           0           4           9           0           9
+      330470  1183754806         362         426          63           8           0           4           0           4           9           0           9
       330470  1183769295         292         334          14           2           2           1           0           1           6           0           6
       330470  1183769939         300         362          33           3           0           5           0           5          11           0          11
       330470  1183773832         229         209           9           2           0           1           0           1           8           0           8
       330470  1183775209          21           0           0           0           0           0           0           0           0           0           0
-      330470  1183787124         370         384          26           4           1           3           0           3           6           0           6
+      330470  1183787124         370         385          26           4           1           3           0           3           6           0           6
       330470  1183787946         262         326          30           4           0           2           0           2           5           0           5
       330470  1183795329         376         358          33           5           0           3           0           3           7           0           7
diff --git a/Tools/PROCTools/data/q449_AOD_digest.ref b/Tools/PROCTools/data/q449_AOD_digest.ref
index 394d5b2cc459..8caa66080117 100644
--- a/Tools/PROCTools/data/q449_AOD_digest.ref
+++ b/Tools/PROCTools/data/q449_AOD_digest.ref
@@ -1,74 +1,74 @@
          run       event       nTopo   nIdTracks  nTauTracks       nTaus      nMuons       nElec   nTrueElec   nFakeElec       nPhot   nTruePhot   nFakePhot
-      431493  1096110158         311         446          87           6           1          15           0          15          15           0          15
+      431493  1096110158         311         447          87           6           1          15           0          15          15           0          15
       431493  1096111916         286         319          49           6           0          10           0          10          14           0          14
-      431493  1096112143         267         388          46           4           1           1           0           1           2           0           2
+      431493  1096112143         267         389          48           4           1           1           0           1           2           0           2
       431493  1096113011         367         402          71           9           0           9           0           9          11           0          11
-      431493  1096113187         274         319          71           7           0           9           0           9          15           0          15
-      431493  1096113771         294         408          77           6           0          10           0          10          12           0          12
+      431493  1096113187         274         319          71           7           1           9           0           9          15           0          15
+      431493  1096113771         294         409          77           6           0          10           0          10          12           0          12
       431493  1096114154         374         572          87           6           0           6           0           6          18           0          18
       431493  1096114168         132         151          17           4           0           2           0           2           6           0           6
-      431493  1096115980         390         518         130          10           0          20           0          20          22           0          22
+      431493  1096115980         390         519         130          10           0          20           0          20          22           0          22
       431493  1096116200         309         410          57           6           1           4           0           4          12           0          12
       431493  1096118782         294         357          95           7           1          12           0          12          23           0          23
       431493  1096119418         307         337          81           6           0           5           0           5           9           0           9
       431493  1096119460         227         313          15           2           0           2           0           2           5           0           5
-      431493  1096120001         388         585         124           8           0          14           0          14          18           0          18
-      431493  1096122174         301         412          72           8           0           5           0           5          23           0          23
-      431493  1096123090         428         536         158          11           0          20           0          20          28           0          28
+      431493  1096120001         388         586         124           8           0          14           0          14          18           0          18
+      431493  1096122174         301         413          72           8           0           5           0           5          23           0          23
+      431493  1096123090         428         537         158          11           0          20           0          20          28           0          28
       431493  1096123254         489         685          96           7           2          14           0          14          27           0          27
-      431493  1096123504         260         341          52           5           0           8           0           8          11           0          11
+      431493  1096123504         260         342          52           5           0           8           0           8          11           0          11
       431493  1096125003         350         451          86           7           0          10           0          10          17           0          17
-      431493  1096125237         358         496          83           7           0           8           0           8          15           0          15
+      431493  1096125237         358         497          83           7           0           8           0           8          15           0          15
       431493  1096125348         298         346          54           5           2           8           0           8           8           0           8
       431493  1096125522         255         305          68           9           1           7           0           7          16           0          16
       431493  1096127413         400         583         103           7           1          10           0          10          24           0          24
-      431493  1096127722         223         416          55           7           1           7           0           7           7           0           7
+      431493  1096127722         223         417          55           7           1           7           0           7           7           0           7
       431493  1096128475         165         251          31           5           0           1           0           1          11           0          11
       431493  1096128958         301         370          77           7           0          14           0          14          22           0          22
       431493  1096129516         305         431          15           2           1           2           0           2          12           0          12
       431493  1096130319         318         520          76           6           1          10           0          10          15           0          15
-      431493  1096130794         340         449         113           8           1          15           0          15          22           0          22
+      431493  1096130794         340         450         113           8           1          15           0          15          22           0          22
       431493  1096131620         400         576         131           9           0          13           0          13          26           0          26
       431493  1096131904         328         437          83           9           0          12           0          12          11           0          11
       431493  1096132044         277         303          22           4           1           2           0           2           8           0           8
       431493  1096132412         331         388          66           8           2           5           0           5          10           0          10
       431493  1096132653         357         373          67           9           0           8           0           8          16           0          16
       431493  1096133511           1           0           0           0           0           0           0           0           0           0           0
-      431493  1096133828         288         376          90           7           3          14           0          14          11           0          11
-      431493  1096134918         631         930         303          14           1          20           0          20          34           0          34
+      431493  1096133828         288         378          90           7           3          14           0          14          11           0          11
+      431493  1096134918         631         931         304          14           1          20           0          20          34           0          34
       431493  1096137274         252         282          32           4           1           5           0           5           6           0           6
       431493  1096137322         415         585          72           4           0           4           0           4           9           0           9
       431493  1096137395         354         431          70           7           0           5           0           5          11           0          11
       431493  1096137906         161         179          20           4           2           5           0           5           7           0           7
       431493  1096139648         219         205          27           5           3           2           0           2           7           0           7
-      431493  1096139847         242         367          40           6           2           1           0           1           8           0           8
+      431493  1096139847         242         368          40           6           2           1           0           1           8           0           8
       431493  1096142414         373         506         111           8           1           7           0           7          23           0          23
       431493  1096143027         398         499          84           9           1           3           0           3          11           0          11
       431493  1096144036         268         343          65           5           0          12           0          12          14           0          14
       431493  1096145110         241         257          18           2           0           5           0           5           8           0           8
       431493  1096146639         283         422          77           6           0           3           0           3          18           0          18
-      431493  1096146735         321         377         105          10           2          21           0          21          26           0          26
+      431493  1096146735         321         378         105          10           2          21           0          21          26           0          26
       431493  1096147568         392         600          41           4           2           4           0           4          14           0          14
       431493  1096150983         272         320          22           5           0           2           0           2          13           0          13
       431493  1096152978         365         498          87           7           1           8           0           8          11           0          11
-      431493  1096153967         539         654         110          10           2           7           0           7          33           0          33
+      431493  1096153967         539         655         111          10           2           7           0           7          33           0          33
       431493  1096155046         240         373          32           4           1           1           0           1           3           0           3
       431493  1096155387         335         486          84           9           1           7           0           7          15           0          15
       431493  1096155429         374         453          93           8           0           7           0           7          17           0          17
       431493  1096155463         357         465          48           4           0           4           0           4          13           0          13
       431493  1096156230         344         459         110           9           0          10           0          10          14           0          14
       431493  1096157777         244         358          57           6           1           2           0           2           9           0           9
-      431493  1096159760         368         456          42           4           0           7           0           7          14           0          14
+      431493  1096159760         368         457          42           4           0           7           0           7          14           0          14
       431493  1096159903         232         279          60           8           0           9           0           9          14           0          14
       431493  1096160558         247         368          40           4           0           2           0           2          10           0          10
-      431493  1096161183         249         316          53           4           0          12           0          12           7           0           7
-      431493  1096162191         348         390          14           2           1           1           0           1           8           0           8
+      431493  1096161183         249         318          54           4           0          12           0          12           7           0           7
+      431493  1096162191         348         391          14           2           1           1           0           1           8           0           8
       431493  1096163035         344         448         120          10           0          14           0          14          26           0          26
       431493  1096163900         337         461          70           7           0          12           0          12          19           0          19
       431493  1096164842         307         442          50           5           1           3           0           3           9           0           9
       431493  1096167556         330         425          74           7           1           9           0           9          11           0          11
-      431493  1096168429         297         415          99           8           0           6           0           6           8           0           8
-      431493  1096171532         341         416          88           9           0          13           0          13          14           0          14
+      431493  1096168429         297         416          99           8           0           6           0           6           8           0           8
+      431493  1096171532         341         417          88           9           0          13           0          13          14           0          14
       431493  1096171788         310         441          60           4           0           9           0           9          12           0          12
       431493  1096171838         423         615         140           9           0          10           0          10          25           0          25
       431493  1096173554         314         425          47           5           1           4           0           4           9           0           9
@@ -76,26 +76,26 @@
       431493  1096176781         366         440          89          10           0          11           0          11          20           0          20
       431493  1096177006         309         381          45           5           0           7           0           7          11           0          11
       431493  1096177862         252         280          13           2           0           2           0           2          11           0          11
-      431493  1096177918         374         500         100           7           1           6           0           6          13           0          13
+      431493  1096177918         374         499          99           7           1           6           0           6          13           0          13
       431493  1096178101         361         439          19           3           0           1           0           1          10           0          10
       431493  1096178859         348         361          38           5           1           7           0           7          14           0          14
       431493  1096180059         377         436          34           4           1           2           0           2          22           0          22
-      431493  1096181059         229         262          38           5           0           7           0           7          10           0          10
+      431493  1096181059         229         263          38           5           0           7           0           7          10           0          10
       431493  1096181128         363         556          83           8           1           6           0           6          14           0          14
       431493  1096182354         308         314          58           6           1          13           0          13          16           0          16
-      431493  1096182555         238         357          58           7           0           6           0           6           9           0           9
+      431493  1096182555         238         358          58           7           0           6           0           6           9           0           9
       431493  1096183473         218         253          45           4           0          12           0          12           9           0           9
       431493  1096184610         380         428         105           7           1          16           0          16          11           0          11
-      431493  1096185473         341         482          63           5           0           9           0           9          14           0          14
+      431493  1096185473         341         485          63           5           0           9           0           9          14           0          14
       431493  1096188650         206         291          39           4           0           5           0           5          12           0          12
-      431493  1096190892         292         399          96           8           1           6           0           6          11           0          11
+      431493  1096190892         292         400          96           8           1           6           0           6          11           0          11
       431493  1096191815         269         352          49           5           1           6           0           6          16           0          16
       431493  1096194353         316         449          60           5           1           8           0           8          12           0          12
       431493  1096199978         274         446          75           6           0           8           0           8          11           0          11
       431493  1096205163         233         317          45           4           0           4           0           4          12           0          12
-      431493  1096207298         390         462          55           5           0           1           0           1          16           0          16
-      431493  1096209204         409         548          79           9           0          10           0          10          21           0          21
+      431493  1096207298         390         463          55           5           0           1           0           1          16           0          16
+      431493  1096209204         409         549          79           9           0          10           0          10          21           0          21
       431493  1096211915         330         373          62           6           0           7           0           7          18           0          18
       431493  1096218966         301         392          17           2           1           4           0           4          10           0          10
       431493  1096226529         318         396         102          10           0          11           0          11          12           0          12
-      431493  1096229568         188         245          66          10           1           5           0           5          17           0          17
+      431493  1096229568         188         246          66          10           1           5           0           5          17           0          17
diff --git a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
index efc786e0b90c..89d960dd9df2 100644
--- a/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
+++ b/Trigger/TrigValidation/TrigP1Test/share/ref_v1Dev_decodeBS_build.ref
@@ -6966,7 +6966,7 @@ HLT_j15_pf_ftf_L1RD0_FILLED:
     1: 38
   stepFeatures:
     0: 50
-    1: 199
+    1: 200
 HLT_j15f_L1RD0_FILLED:
   eventCount: 14
   stepCounts:
-- 
GitLab


From 1f888ce3a224fb2dfa45eb4221b225cc25e0b62a Mon Sep 17 00:00:00 2001
From: Daiya Akiyama <daiya.akiyama@cern.ch>
Date: Mon, 29 Jul 2024 17:27:08 +0900
Subject: [PATCH 3/5] update q442 digest reference

---
 Tools/PROCTools/data/q442_AOD_digest.ref | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Tools/PROCTools/data/q442_AOD_digest.ref b/Tools/PROCTools/data/q442_AOD_digest.ref
index 1a810c6d16d4..d32e229f7a20 100644
--- a/Tools/PROCTools/data/q442_AOD_digest.ref
+++ b/Tools/PROCTools/data/q442_AOD_digest.ref
@@ -14,7 +14,7 @@
       330470  1183746343         445         495          52           5           0           2           0           2          15           0          15
       330470  1183746710           4           0           0           0           0           0           0           0           0           0           0
       330470  1183751782         212         245          12           3           0           0           0           0           3           0           3
-      330470  1183752624         329         368          49           5           2           3           0           3          13           0          13
+      330470  1183752624         329         368          49           5           1           3           0           3          13           0          13
       330470  1183753006         321         398          59           8           1           5           0           5          10           0          10
       330470  1183754806         362         426          63           8           0           4           0           4           9           0           9
       330470  1183769295         292         334          14           2           2           1           0           1           6           0           6
-- 
GitLab


From 3126036bae45e46826baf7501dfe70bb79688c02 Mon Sep 17 00:00:00 2001
From: Daiya Akiyama <daiya.akiyama@cern.ch>
Date: Tue, 30 Jul 2024 20:03:34 +0900
Subject: [PATCH 4/5] adding the error bit check instead of the one by one flag
 check

---
 .../src/SCT_ByteStreamErrorsTool.cxx            | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
index c33d4489ba51..6f66d63cc27e 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx
@@ -41,7 +41,7 @@ SCT_ByteStreamErrorsTool::initialize() {
      if (badError>=63) {
         ATH_MSG_FATAL("Logic error: Error code too large and cannot represented as a bit.");
      }
-     m_badErrorMask |= (1<<badError);
+     m_badErrorMask |= SCT_ByteStreamErrors::makeError(badError);
   }
 
   return StatusCode::SUCCESS;
@@ -123,12 +123,12 @@ SCT_ByteStreamErrorsTool::isGood(const IdentifierHash& elementIdHash, const Even
 
     auto errorCode{idcCachePtr->retrieve(elementIdHash)};
 
-    for (auto badError : SCT_ByteStreamErrors::BadErrors) {
-      if (SCT_ByteStreamErrors::hasError(errorCode, badError)) {
-        ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << errorCode  << " for ID " << elementIdHash);
-        return false;
-      }
+    bool is_bad = errorCode & m_badErrorMask;
+    if (is_bad) {
+      ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << errorCode  << " for ID " << elementIdHash);
+      return false;
     }
+
   } // end of cache operations protection via m_cacheMutex, following code has own protection
   
   // If all 6 chips of a link issue ABCD errors or are bad chips or temporarily masked chips, the link is treated as bad one. 
@@ -200,10 +200,7 @@ SCT_ByteStreamErrorsTool::getDetectorElementStatus(const EventContext& ctx, InDe
    unsigned int element_i=0;
    for ( const auto &val : idcCachePtr->IDCCache->rawReadAccess()) {
       uint64_t error_code = val;
-      bool is_bad(false);
-      for (auto badError : SCT_ByteStreamErrors::BadErrors) {
-	is_bad |= SCT_ByteStreamErrors::hasError(error_code, badError);
-      }
+      bool is_bad = error_code & m_badErrorMask;
       status.at(element_i) = status.at(element_i) & not is_bad;
       if ( is_bad ) {
          ATH_MSG_VERBOSE("SCT_ByteStreamErrorsTool Bad Error " << error_code  << " for ID " << element_i);
-- 
GitLab


From 65d0dc1f4d2b6780b393d94e8014d21cb7489042 Mon Sep 17 00:00:00 2001
From: Duc Bao Ta <xiedebao@googlemail.com>
Date: Tue, 21 Jan 2025 12:01:25 +0100
Subject: [PATCH 5/5] update references

---
 Tools/PROCTools/data/q449_AOD_digest.ref      | 2 +-
 Tools/WorkflowTestRunner/python/References.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Tools/PROCTools/data/q449_AOD_digest.ref b/Tools/PROCTools/data/q449_AOD_digest.ref
index 8caa66080117..0cdb3075dcd9 100644
--- a/Tools/PROCTools/data/q449_AOD_digest.ref
+++ b/Tools/PROCTools/data/q449_AOD_digest.ref
@@ -3,7 +3,7 @@
       431493  1096111916         286         319          49           6           0          10           0          10          14           0          14
       431493  1096112143         267         389          48           4           1           1           0           1           2           0           2
       431493  1096113011         367         402          71           9           0           9           0           9          11           0          11
-      431493  1096113187         274         319          71           7           1           9           0           9          15           0          15
+      431493  1096113187         274         319          71           7           0           9           0           9          15           0          15
       431493  1096113771         294         409          77           6           0          10           0          10          12           0          12
       431493  1096114154         374         572          87           6           0           6           0           6          18           0          18
       431493  1096114168         132         151          17           4           0           2           0           2           6           0           6
diff --git a/Tools/WorkflowTestRunner/python/References.py b/Tools/WorkflowTestRunner/python/References.py
index 743118495ef6..6b325ca767cb 100644
--- a/Tools/WorkflowTestRunner/python/References.py
+++ b/Tools/WorkflowTestRunner/python/References.py
@@ -22,8 +22,8 @@ references_map = {
     "d1759": "v3",
     "d1912": "v5",
     # Reco
-    "q442": "v7",
-    "q449": "v21",
+    "q442": "v8",
+    "q449": "v22",
     "q452": "v9",
     "q454": "v20",
     # Derivations
-- 
GitLab