From 1cf2ff67cc26e46d7083fa71c88a0f6278519140 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Thu, 23 Feb 2023 17:27:38 +0100
Subject: [PATCH] Trigger fatal if Match invalid in
 CbmMatchRecoToMC::CbmMatchRecoToMC::MatchClusters, #2737

---
 core/base/CbmMatchRecoToMC.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/base/CbmMatchRecoToMC.cxx b/core/base/CbmMatchRecoToMC.cxx
index 548c543693..87679fd350 100644
--- a/core/base/CbmMatchRecoToMC.cxx
+++ b/core/base/CbmMatchRecoToMC.cxx
@@ -424,6 +424,10 @@ void CbmMatchRecoToMC::MatchClusters(ECbmModuleId systemId, const TClonesArray*
     for (Int_t iDigi = 0; iDigi < nofDigis; iDigi++) {
       Int_t digiIndex           = cluster->GetDigi(iDigi);
       const CbmMatch* digiMatch = fDigiManager->GetMatch(systemId, digiIndex);
+      if (nullptr == digiMatch) {
+        LOG(fatal) << "CbmMatchRecoToMC::MatchClusters => no Match found for system " << systemId << " digi index "
+                   << digiIndex << " (digi " << iDigi << " from cluster " << iCluster << ") !";
+      }
       clusterMatch->AddLinks(*digiMatch);
     }  //# digis in cluster
   }    //# clusters
-- 
GitLab