From bc77107f60c7172a72a202ec19d7699640c9821c Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Wed, 11 Jan 2023 14:21:40 +0000
Subject: [PATCH] L1: bugfix in CbmTrackerInputQaTof

---
 macro/run/run_qa.C                  | 12 ++----------
 reco/L1/qa/CbmTrackerInputQaTof.cxx |  3 ++-
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/macro/run/run_qa.C b/macro/run/run_qa.C
index eae28b1e68..13f94e9c6b 100644
--- a/macro/run/run_qa.C
+++ b/macro/run/run_qa.C
@@ -187,17 +187,9 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
   }
   // ------------------------------------------------------------------------
 
-  // ----- TRD QA  ---------------------------------
+  // ----- TOF QA  ---------------------------------
   if (CbmSetup::Instance()->IsActive(ECbmModuleId::kTof)) {
-    // TODO: SZh 19.10.2022:
-    // After the proper TOF digi parameters initialization it is appeared,
-    // that CbmTrackerInputQaTof causes segmentation violation in
-    // CbmTrackerInputQaTof::ResolutionQa() for the event-based running
-    // (before the branch with the related code inside the task was never
-    // executed). Temporarily commented that task, till the bug would not be
-    // resolved.
-
-    //run->AddTask(new CbmTrackerInputQaTof());  // Tracker requirements to TRD
+    run->AddTask(new CbmTrackerInputQaTof());  // Tracker requirements to TOF
   }
   // ------------------------------------------------------------------------
 
diff --git a/reco/L1/qa/CbmTrackerInputQaTof.cxx b/reco/L1/qa/CbmTrackerInputQaTof.cxx
index 7679387ac6..adba0e012f 100644
--- a/reco/L1/qa/CbmTrackerInputQaTof.cxx
+++ b/reco/L1/qa/CbmTrackerInputQaTof.cxx
@@ -479,8 +479,9 @@ void CbmTrackerInputQaTof::ResolutionQa()
       CbmMatch* pHitMatch = static_cast<CbmMatch*>(fHitMatches->At(iHit));
       for (int iLink = 0; iLink < pHitMatch->GetNofLinks(); iLink++) {
         Int_t iMC  = pHitMatch->GetLink(iLink).GetIndex();
+        int iFile  = pHitMatch->GetLink(iLink).GetFile();
         int iEvent = pHitMatch->GetLink(iLink).GetEntry();
-        if (eventId != iEvent) continue;
+        if ((eventId != iEvent) || (fileId != iFile)) continue;
         isTofPointMatched[iMC] = 1;
       }
     }
-- 
GitLab