From 278874d7cb343e90f24b7becce891e20960de76e Mon Sep 17 00:00:00 2001
From: "P.-A. Loizeau" <p.-a.loizeau@gsi.de>
Date: Thu, 23 Jan 2025 17:26:29 +0100
Subject: [PATCH] [mRICH] add pars for PASTA unpacking online/offline

---
 algo/detectors/rich/ReadoutConfig.cxx         | 30 +++++++++++++++++--
 macro/beamtime/mcbm2024/mRichPar_70.par       | 19 ++++++++++--
 .../rich/mcbm/CbmRichMCbmHitProducer.cxx      |  6 +++-
 3 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/algo/detectors/rich/ReadoutConfig.cxx b/algo/detectors/rich/ReadoutConfig.cxx
index c1cc545bb1..de19b27b13 100644
--- a/algo/detectors/rich/ReadoutConfig.cxx
+++ b/algo/detectors/rich/ReadoutConfig.cxx
@@ -65,7 +65,7 @@ namespace cbm::algo::rich
 
     // Constants
     const uint16_t numComp          = 1;   // Number of components
-    const uint16_t numElinksPerComp = 76;  // Number of elinks per component (74 for mRICH, 2 for FSD/NCAL)
+    const uint16_t numElinksPerComp = 84;  // Number of elinks per component (74 mRICH, 2 FSD/NCAL, 8 PASTA)
     const uint16_t numChanPerElink  = 33;  // Number of channels per Elink
 
     // Equipment IDs for each component
@@ -78,8 +78,10 @@ namespace cbm::algo::rich
       0x7130, 0x7131, 0x7140, 0x7141, 0x7150, 0x7151, 0x7160, 0x7161, 0x7170, 0x7171, 0x7180, 0x7181, 0x7200,
       0x7201, 0x7210, 0x7211, 0x7220, 0x7221, 0x7230, 0x7231, 0x7240, 0x7241, 0x7250, 0x7251, 0x7260, 0x7261,
       0x7270, 0x7271, 0x7280, 0x7281, 0x7300, 0x7301, 0x7310, 0x7311, 0x7320, 0x7321, 0x7330, 0x7331, 0x7340,
-      0x7341, 0x7350, 0x7351, 0x7360, 0x7361, 0x7370, 0x7371, 0x7380, 0x7381, 0x7901, 0x7902};
+      0x7341, 0x7350, 0x7351, 0x7360, 0x7361, 0x7370, 0x7371, 0x7380, 0x7381, 0x7901, 0x7902, 0x9992, 0x9993,
+      0x9994, 0x9995, 0x9996, 0x9997, 0x9998, 0x9999 };
     // TRBaddresses 0x7901 and 0x7902 are for FSD/NCAL
+    // TRBaddresses 0x9992 to 0x9999 are for PASTA
 
     double ToTshifts[numElinksPerComp][numChanPerElink] = {
       {0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
@@ -305,6 +307,30 @@ namespace cbm::algo::rich
       {0.00,  15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00,
        15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00,
        15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00, 15.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
+      {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
+       10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00},
       {0.00,  10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
        10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00,
        10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00}};
diff --git a/macro/beamtime/mcbm2024/mRichPar_70.par b/macro/beamtime/mcbm2024/mRichPar_70.par
index 99f83b84de..940949b33d 100644
--- a/macro/beamtime/mcbm2024/mRichPar_70.par
+++ b/macro/beamtime/mcbm2024/mRichPar_70.par
@@ -76,7 +76,15 @@ TRBaddresses: Int_t \
   0x7380  \
   0x7381  \
   0x7901  \
-  0x7902
+  0x7902  \
+  0x7992  \
+  0x7993  \
+  0x7994  \
+  0x7995  \
+  0x7996  \
+  0x7997  \
+  0x7998  \
+  0x7999
 
 ToTshifts: Double_t \
   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
@@ -154,7 +162,14 @@ ToTshifts: Double_t \
   0.00  14.55  13.55  14.05  12.05  15.25  11.75  10.35  13.35  13.55  11.35  14.05  15.85  16.35  15.35  7.65  8.65  5.25  3.35  5.75  7.55  8.25  6.55  6.85  7.05  7.35  8.55  6.85  5.55  6.15  4.65  6.05  7.75 \
   0.00  14.05  12.75  13.75  11.35  14.35  11.85  10.25  13.35  13.45  11.25  14.35  16.05  15.75  14.65  7.55  8.35  5.15  2.95  5.35  7.55  8.25  6.55  7.05  7.35  7.75  8.65  6.65  5.05  7.05  4.55  5.85  7.75 \
   0.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00  15.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
+  0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00 \
   0.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00  10.00
 
-
 ########################
diff --git a/reco/detectors/rich/mcbm/CbmRichMCbmHitProducer.cxx b/reco/detectors/rich/mcbm/CbmRichMCbmHitProducer.cxx
index c451a02062..1126b91cc8 100644
--- a/reco/detectors/rich/mcbm/CbmRichMCbmHitProducer.cxx
+++ b/reco/detectors/rich/mcbm/CbmRichMCbmHitProducer.cxx
@@ -202,7 +202,11 @@ void CbmRichMCbmHitProducer::ProcessDigi(CbmEvent* event, Int_t digiIndex)
   if (digi == nullptr) return;
   if (digi->GetAddress() < 0) return;
   Int_t DiRICH_Add = (digi->GetAddress() >> 16) & 0xFFFF;
-  if (DiRICH_Add == 0x7901 || DiRICH_Add == 0x7902) return;  // TRBaddresses 0x7901 and 0x7902 are for FSD/NCAL
+  if (DiRICH_Add == 0x7901 || DiRICH_Add == 0x7902 || (0x9992 <= DiRICH_Add && DiRICH_Add <= 0x9999)) {
+    // TRBaddresses 0x7901 and 0x7902 are for FSD/NCAL
+    // TRBaddresses 0x9992 to 0x9999 are for PASTA
+    return;
+  }
   fNofDigis++;
   if (isInToT(digi->GetToT())) {
     TVector3 posPoint;
-- 
GitLab