From d23d336c6144bcd6ef4fa9ee8eff06a4456a7044 Mon Sep 17 00:00:00 2001
From: Dominik Smith <smith@th.physik.uni-frankfurt.de>
Date: Wed, 14 Sep 2022 12:46:14 +0200
Subject: [PATCH] UnpackT0/Tof: Fixed error counters. Updated address
 computation.

---
 algo/detectors/t0/UnpackT0.cxx          |  4 ++--
 algo/detectors/tof/TofReadoutConfig.cxx | 24 ++++++++++++++----------
 algo/detectors/tof/UnpackTof.cxx        |  4 ++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/algo/detectors/t0/UnpackT0.cxx b/algo/detectors/t0/UnpackT0.cxx
index f8fc5a25d0..9ba0373157 100644
--- a/algo/detectors/t0/UnpackT0.cxx
+++ b/algo/detectors/t0/UnpackT0.cxx
@@ -81,11 +81,11 @@ namespace cbm::algo
           break;
         }
         case critof001::MSG_SLOWC: {
-          // Fill error
+          result.second.fNumNonHitOrTsbMessage++;
           break;
         }
         case critof001::MSG_SYST: {
-          // Fill error
+          result.second.fNumNonHitOrTsbMessage++;
           break;
         }
         default: {
diff --git a/algo/detectors/tof/TofReadoutConfig.cxx b/algo/detectors/tof/TofReadoutConfig.cxx
index 6b8eb5048e..76617736b4 100644
--- a/algo/detectors/tof/TofReadoutConfig.cxx
+++ b/algo/detectors/tof/TofReadoutConfig.cxx
@@ -150,24 +150,28 @@ namespace cbm::algo
           BuildChannelsUidMapCera(uCh, uGbtx);
           break;
         }
-        case 69:
-        case 6:  // Buc box
-        {
-          BuildChannelsUidMapBuc(uCh, uGbtx);
-          if (rpcType[uGbtx] == 6) break;
-        }
-          [[fallthrough]];
         case 4:  // intended fallthrough
           [[fallthrough]];
         case 7: [[fallthrough]];
         case 9:  // Star2 boxes
         {
-          if (rpcType[uGbtx] == 69) uCh -= 80;
           BuildChannelsUidMapStar2(uCh, uGbtx);
-          if (rpcType[uGbtx] == 69) uCh -= 80;
           break;
         }
-
+        case 6:  // Buc box
+        {
+          BuildChannelsUidMapBuc(uCh, uGbtx);
+          break;
+        }
+        case 69: {
+          /// 2022 case: 69 is followed by 4 and 9
+          BuildChannelsUidMapBuc(uCh, uGbtx);
+          /// Map also 4 and 9 (equivalent to fallthrough to 4 then 9 but without changing past behaviors)
+          uCh -= 80;  // PAL, 2022/03/17: ?!?
+          BuildChannelsUidMapStar2(uCh, uGbtx);
+          uCh -= 80;  // PAL, 2022/03/17: ?!?
+          break;
+        }
         case -1: {
           LOG(info) << " Found unused GBTX link at uCh = " << uCh;
           uCh += 160;
diff --git a/algo/detectors/tof/UnpackTof.cxx b/algo/detectors/tof/UnpackTof.cxx
index 3875d303e1..03d182708f 100644
--- a/algo/detectors/tof/UnpackTof.cxx
+++ b/algo/detectors/tof/UnpackTof.cxx
@@ -80,11 +80,11 @@ namespace cbm::algo
           break;
         }
         case critof001::MSG_SLOWC: {
-          // Fill error
+          result.second.fNumNonHitOrTsbMessage++;
           break;
         }
         case critof001::MSG_SYST: {
-          // Fill error
+          result.second.fNumNonHitOrTsbMessage++;
           break;
         }
         default: {
-- 
GitLab