From 950d02450505be0a66babe3ee1e3fbde55fef557 Mon Sep 17 00:00:00 2001
From: "P.-A. Loizeau" <p.-a.loizeau@gsi.de>
Date: Wed, 6 Apr 2022 19:02:48 +0200
Subject: [PATCH] Add missing dict for error msg vector + improve error flag
 handling in mSTS unp

---
 core/data/DataLinkDef.h                           | 1 +
 reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx    | 4 ++--
 reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/core/data/DataLinkDef.h b/core/data/DataLinkDef.h
index 781ad0795c..223c19ebb0 100644
--- a/core/data/DataLinkDef.h
+++ b/core/data/DataLinkDef.h
@@ -28,6 +28,7 @@
 #pragma link C++ class CbmErrorMessage + ;
 #pragma link C++ class CbmRawEvent + ;
 #pragma link C++ class CbmTsEventHeader + ;
+#pragma link C++ class std::vector<CbmErrorMessage> + ;
 
 // ---In base
 #pragma link C++ class CbmDigiBranchBase + ;
diff --git a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx
index 949ac2d867..aa59345c4a 100644
--- a/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx
+++ b/reco/detectors/sts/unpack/CbmStsUnpackAlgo.cxx
@@ -540,8 +540,8 @@ void CbmStsUnpackAlgo::processHitInfo(const stsxyter::Message& mess)
       /// If EM flag ON, store a corresponding error message with the next flag after all other possible status flags set
       if (mess.IsHitMissedEvts())
         if (fOptOutBVec)
-          fOptOutBVec->emplace_back(
-            CbmErrorMessage(ECbmModuleId::kSts, dTimeInNs, uAsicIdx, 1 << stsxyter::kusLenStatStatus, usChan));
+          fOptOutBVec->emplace_back(CbmErrorMessage(ECbmModuleId::kSts, dTimeInNs, fviFebAddress[uFebIdx],
+                                                    1 << stsxyter::kusLenStatStatus, uChanInMod));
     }
   }
 
diff --git a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx
index 4866e0eade..c9af9980a9 100644
--- a/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx
+++ b/reco/detectors/sts/unpack/CbmStsUnpackMonitor.cxx
@@ -651,8 +651,8 @@ void CbmStsUnpackMonitor::FillHitMonitoringHistos(const UInt_t& uFebIdx, const U
   FillStsFebChanAdcCalProf(uFebIdx, uChanInFeb, dCalAdc);
   FillStsFebChanCntRaw(uFebIdx, uChanInFeb);
   FillStsFebChanAdcRaw(uFebIdx, uChanInFeb, usRawAdc);
-  FillStsFebChanRawTs(uFebIdx, usChan, usRawTs);
-  FillStsFebChanMissEvt(uFebIdx, usChan, isHitMissedEvts);
+  FillStsFebChanRawTs(uFebIdx, uChanInFeb, usRawTs);
+  FillStsFebChanMissEvt(uFebIdx, uChanInFeb, isHitMissedEvts);
   FillStsFebChanAdcRawProf(uFebIdx, uChanInFeb, usRawAdc);
 }
 
-- 
GitLab