From e2f1b37baacb7e3b5c892a361cc37f8f9c7d647e Mon Sep 17 00:00:00 2001
From: sgorbuno <se.gorbunov@gsi.de>
Date: Tue, 27 Jul 2021 21:33:23 +0000
Subject: [PATCH] L1 bugfixes: fix reconstruction with mvd hits in tb mode

---
 reco/L1/CbmL1.cxx          | 4 ++--
 reco/L1/CbmL1ReadEvent.cxx | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx
index df491c40bf..1e120171c4 100644
--- a/reco/L1/CbmL1.cxx
+++ b/reco/L1/CbmL1.cxx
@@ -273,8 +273,8 @@ InitStatus CbmL1::Init()
     if (NULL == mcManager) LOG(fatal) << GetName() << ": No CbmMCDataManager!";
 
     fStsPoints = mcManager->InitBranch("StsPoint");
-    if (!fTimesliceMode) fMvdPoints = mcManager->InitBranch("MvdPoint");
-    fMCTracks = mcManager->InitBranch("MCTrack");
+    fMvdPoints = mcManager->InitBranch("MvdPoint");
+    fMCTracks  = mcManager->InitBranch("MCTrack");
     if (NULL == fStsPoints) LOG(fatal) << GetName() << ": No StsPoint data!";
     if (NULL == fMCTracks) LOG(fatal) << GetName() << ": No MCTrack data!";
 
diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx
index 2566b451bd..92c72ca14c 100644
--- a/reco/L1/CbmL1ReadEvent.cxx
+++ b/reco/L1/CbmL1ReadEvent.cxx
@@ -503,7 +503,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength,
         th.time = mh->GetTime();
         th.dt   = mh->GetTimeError();
 
-        if (fTimesliceMode) th.id = hitIndex;
+        if (fTimesliceMode) th.id = nMvdHits + hitIndex;
         else
           th.id = tmpHits.size();
 
@@ -1315,12 +1315,8 @@ void CbmL1::HitMatch()
             iFile  = vFileEvent.begin()->first;
             iEvent = vFileEvent.begin()->second;
           }
-          int nMvdPoints_ = 0;
 
-          if (!fTimesliceMode)
-            if (listMvdPts) nMvdPoints_ = listMvdPts->GetEntriesFast();
-
-          Double_t dtrck          = dFEI(iFile, iEvent, iIndex + nMvdPoints_);
+          Double_t dtrck          = dFEI(iFile, iEvent, nMvdPoints + iIndex);
           DFEI2I::iterator trk_it = dFEI2vMCPoints.find(dtrck);
 
           if (trk_it == dFEI2vMCPoints.end()) continue;
-- 
GitLab