From b3eafe67f686b79138bd86beb4e75b2cad727251 Mon Sep 17 00:00:00 2001
From: Alexandru Bercuci <abercuci@niham.nipne.ro>
Date: Wed, 16 Feb 2022 11:09:14 +0200
Subject: [PATCH] update for Fasp FEE

---
 core/detectors/trd/CbmTrdParSetAsic.cxx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/core/detectors/trd/CbmTrdParSetAsic.cxx b/core/detectors/trd/CbmTrdParSetAsic.cxx
index 51e8bf4476..cfd00344a4 100644
--- a/core/detectors/trd/CbmTrdParSetAsic.cxx
+++ b/core/detectors/trd/CbmTrdParSetAsic.cxx
@@ -189,15 +189,19 @@ void CbmTrdParSetAsic::putParams(FairParamList* l)
         Int_t nchannels(((CbmTrdParAsic*) iModuleIt.second)->GetNchannels());
         CbmTrdParFasp* fasp = (CbmTrdParFasp*) iModuleIt.second;
 
-        for (Int_t ich(0); ich < nchannels; ich += 2) {
-          for (Int_t ipair(0); ipair < 2; ipair++) {
+        for (Int_t ich(0); ich < nchannels; ich++) {
+//          for (Int_t ipair(0); ipair < 2; ipair++) {
             Int_t faspAddress                                  = fasp->GetChannelAddress(ich);
-            const CbmTrdParFaspChannel* ch                     = fasp->GetChannel(faspAddress, ipair);
-            asicInfo[offset + 1 + ich + ipair]                 = faspAddress;
-            asicInfo[offset + 1 + (1 * NFASPCH) + ich + ipair] = ch->GetPileUpTime();
-            asicInfo[offset + 1 + (2 * NFASPCH) + ich + ipair] = ch->GetThreshold();
-            asicInfo[offset + 1 + (3 * NFASPCH) + ich + ipair] = ch->GetMinDelaySignal();
-          }
+            asicInfo[offset + 1 + ich]                 = faspAddress;
+            const CbmTrdParFaspChannel* ch                     = fasp->GetChannel(ich);
+            if(!ch) {
+               LOG(info) << "Missing calib for Fasp[" << offset << "] pad " << faspAddress;
+               continue;
+            }
+            asicInfo[offset + 1 + (1 * NFASPCH) + ich] = ch->GetPileUpTime();
+            asicInfo[offset + 1 + (2 * NFASPCH) + ich] = ch->GetThreshold();
+            asicInfo[offset + 1 + (3 * NFASPCH) + ich] = ch->GetMinDelaySignal();
+//          }
         }
         iAsicNr++;
       }
-- 
GitLab