From c1c2f0160268e59c3ffd607c1c72e668764003f1 Mon Sep 17 00:00:00 2001
From: Louis Henry <lohenry@cern.ch>
Date: Fri, 2 Sep 2022 12:03:56 +0200
Subject: [PATCH 1/4] Fix the FT reconstructibility

---
 Digi/DigiAlg/src/BuildMCTrackInfo.cpp | 8 ++++----
 Digi/DigiAlg/src/BuildMCTrackInfo.h   | 9 +++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
index 8eaaa1f8f..8f2d91c8b 100755
--- a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
+++ b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
@@ -143,7 +143,7 @@ StatusCode BuildMCTrackInfo::execute() {
     for ( const auto& cluster : clusters->range() ) {
       LHCb::Detector::FTChannelID channelID = cluster.channelID();
       // Create station to be in the range 2-4
-      int sta = to_unsigned( channelID.station() ) + 1;
+      int sta = channelID.globalStationIdx() + shiftT;
       for ( auto part = ftLink.first( channelID ); part; part = ftLink.next() ) {
         if ( mcParts == part->parent() ) {
           MCNum = part->key();
@@ -242,9 +242,9 @@ void BuildMCTrackInfo::computeAcceptance( std::vector<int>& station ) {
                   << endmsg;
         continue;
       }
-      int  sta = ftSta->stationID(); // station 1-3, layerID 0-3 xuvx
-      bool isX = ftLay->stereoAngle() == 0;
-      updateAccBit( station[MCNum], sta, isX );
+      int  iSta = ftSta->stationIdx() + shiftT; // station 0-2 + 2, layerID 0-3 xuvx
+      bool isX  = (ftLay->layerID() % 4 == 0 || ftLay->layerID() % 4 == 3); //FIXME: hardcoded
+      updateAccBit( station[MCNum], iSta, isX );
     }
   }
 }
diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.h b/Digi/DigiAlg/src/BuildMCTrackInfo.h
index 2d0814fdb..9ba8313d2 100755
--- a/Digi/DigiAlg/src/BuildMCTrackInfo.h
+++ b/Digi/DigiAlg/src/BuildMCTrackInfo.h
@@ -26,7 +26,8 @@ class DeFTDetector;
  */
 class BuildMCTrackInfo final : public GaudiAlgorithm {
   using GaudiAlgorithm::GaudiAlgorithm;
-
+  
+  static constexpr int shiftT = 2;
 public:
   StatusCode initialize() override; ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
@@ -37,17 +38,17 @@ protected:
       result |= MCTrackInfo::maskTT1;
     } else if ( 1 == sta ) {
       result |= MCTrackInfo::maskTT2;
-    } else if ( 2 == sta ) {
+    } else if ( shiftT == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT1X;
       else
         result |= MCTrackInfo::maskT1S;
-    } else if ( 3 == sta ) {
+    } else if ( shiftT+1 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT2X;
       else
         result |= MCTrackInfo::maskT2S;
-    } else if ( 4 == sta ) {
+    } else if ( shiftT+2 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT3X;
       else
-- 
GitLab


From 5bbc81cf883be4f7db6e5e12d9bcdc37e203b8ce Mon Sep 17 00:00:00 2001
From: Louis Henry <lohenry@cern.ch>
Date: Wed, 7 Sep 2022 16:15:48 +0200
Subject: [PATCH 2/4] Add shiftT to updateAccBit

---
 Digi/DigiAlg/src/BuildMCTrackInfo.h | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.h b/Digi/DigiAlg/src/BuildMCTrackInfo.h
index 9ba8313d2..88b989e65 100755
--- a/Digi/DigiAlg/src/BuildMCTrackInfo.h
+++ b/Digi/DigiAlg/src/BuildMCTrackInfo.h
@@ -26,8 +26,9 @@ class DeFTDetector;
  */
 class BuildMCTrackInfo final : public GaudiAlgorithm {
   using GaudiAlgorithm::GaudiAlgorithm;
-  
+
   static constexpr int shiftT = 2;
+
 public:
   StatusCode initialize() override; ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
@@ -43,12 +44,12 @@ protected:
         result |= MCTrackInfo::maskT1X;
       else
         result |= MCTrackInfo::maskT1S;
-    } else if ( shiftT+1 == sta ) {
+    } else if ( shiftT + 1 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT2X;
       else
         result |= MCTrackInfo::maskT2S;
-    } else if ( shiftT+2 == sta ) {
+    } else if ( shiftT + 2 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT3X;
       else
@@ -61,17 +62,17 @@ protected:
       result |= MCTrackInfo::maskAccTT1;
     } else if ( 1 == sta ) {
       result |= MCTrackInfo::maskAccTT2;
-    } else if ( 2 == sta ) {
+    } else if ( shiftT == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskAccT1X;
       else
         result |= MCTrackInfo::maskAccT1S;
-    } else if ( 3 == sta ) {
+    } else if ( shiftT + 1 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskAccT2X;
       else
         result |= MCTrackInfo::maskAccT2S;
-    } else if ( 4 == sta ) {
+    } else if ( shiftT + 2 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskAccT3X;
       else
-- 
GitLab


From a36b80f62a148c4722734d51d3be684582ff1831 Mon Sep 17 00:00:00 2001
From: Louis Henry <lohenry@cern.ch>
Date: Wed, 7 Sep 2022 16:18:50 +0200
Subject: [PATCH 3/4] Fixed formatting

---
 Digi/DigiAlg/src/BuildMCTrackInfo.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
index 8f2d91c8b..490ddb7db 100755
--- a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
+++ b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
@@ -242,8 +242,8 @@ void BuildMCTrackInfo::computeAcceptance( std::vector<int>& station ) {
                   << endmsg;
         continue;
       }
-      int  iSta = ftSta->stationIdx() + shiftT; // station 0-2 + 2, layerID 0-3 xuvx
-      bool isX  = (ftLay->layerID() % 4 == 0 || ftLay->layerID() % 4 == 3); //FIXME: hardcoded
+      int  iSta = ftSta->stationIdx() + shiftT;                               // station 0-2 + 2, layerID 0-3 xuvx
+      bool isX  = ( ftLay->layerID() % 4 == 0 || ftLay->layerID() % 4 == 3 ); // FIXME: hardcoded
       updateAccBit( station[MCNum], iSta, isX );
     }
   }
-- 
GitLab


From 6c7d6baf5c6b37c863aa18d23b278de2984396fe Mon Sep 17 00:00:00 2001
From: Louis Henry <lohenry@cern.ch>
Date: Fri, 16 Sep 2022 10:32:20 +0200
Subject: [PATCH 4/4] Fix formatting

---
 Digi/DigiAlg/src/BuildMCTrackInfo.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
index 0602db04b..e87abb594 100755
--- a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
+++ b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp
@@ -45,17 +45,17 @@ protected:
       result |= MCTrackInfo::maskTT1;
     } else if ( 1 == sta ) {
       result |= MCTrackInfo::maskTT2;
-    } else if ( shiftT+0 == sta ) {
+    } else if ( shiftT + 0 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT1X;
       else
         result |= MCTrackInfo::maskT1S;
-    } else if ( shiftT+1 == sta ) {
+    } else if ( shiftT + 1 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT2X;
       else
         result |= MCTrackInfo::maskT2S;
-    } else if ( shiftT+2 == sta ) {
+    } else if ( shiftT + 2 == sta ) {
       if ( isX )
         result |= MCTrackInfo::maskT3X;
       else
@@ -232,7 +232,8 @@ StatusCode BuildMCTrackInfo::execute() {
           MCNum = part->key();
           updateBit( station[MCNum], shiftedStation, channelID.isX() );
           if ( isVerbose )
-            verbose() << "MC " << MCNum << " FT Sta " << shiftedStation << " lay " << to_unsigned( channelID.layer() ) << endmsg;
+            verbose() << "MC " << MCNum << " FT Sta " << shiftedStation << " lay " << to_unsigned( channelID.layer() )
+                      << endmsg;
         }
       }
     }
@@ -344,8 +345,8 @@ void BuildMCTrackInfo::computeAcceptance( std::vector<int>& station ) {
                   << endmsg;
         continue;
       }
-      int  shiftedStation = ftSta->stationIdx() + shiftT;                               // station 0-2 + 2, layerID 0-3 xuvx
-      bool isX  = ( ftLay->layerID() % 4 == 0 || ftLay->layerID() % 4 == 3 ); // FIXME: hardcoded
+      int  shiftedStation = ftSta->stationIdx() + shiftT; // station 0-2 + 2, layerID 0-3 xuvx
+      bool isX            = ( ftLay->layerID() % 4 == 0 || ftLay->layerID() % 4 == 3 ); // FIXME: hardcoded
       updateAccBit( station[MCNum], shiftedStation, isX );
     }
   }
-- 
GitLab