From edb6cf48ee0d44bffd49e4e03f4546094a5603b8 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 8 Feb 2021 18:04:13 +0100
Subject: [PATCH] Add TOF Hit to Digi match array alt name in MatchRecoToMC

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

diff --git a/core/base/CbmMatchRecoToMC.cxx b/core/base/CbmMatchRecoToMC.cxx
index 77308a5c9c..06cde85da1 100644
--- a/core/base/CbmMatchRecoToMC.cxx
+++ b/core/base/CbmMatchRecoToMC.cxx
@@ -397,7 +397,23 @@ void CbmMatchRecoToMC::ReadAndCreateDataBranches() {
 
   // TOF
   fTofPoints         = mcManager->InitBranch("TofPoint");
-  fTofHitDigiMatches = (TClonesArray*) ioman->GetObject("TofHitDigiMatch");
+  fTofHitDigiMatches =
+    static_cast<TClonesArray*>(ioman->GetObject("TofHitDigiMatch"));
+
+  /// FIXME: Temporary fix to catch all versions of the TOF Hit to Digi Match
+  ///        array. To be removed after a full review of the TOF reco
+  if (nullptr == fTofHitDigiMatches) {
+    fTofHitDigiMatches =
+      static_cast<TClonesArray*>(ioman->GetObject(" TofCalDigiMatch"));
+    if (nullptr == fTofHitDigiMatches) {
+      LOG(warning) << "CbmMatchRecoToMC::ReadAndCreateDataBranches()"
+                   << " no TOF Hit to Digi array found!";
+    }  // if (nullptr == fTofHitDigiMatches)
+    else {
+      LOG(info)
+        << "CbmMatchRecoToMC: Using alternative TOF Hit to Digi match array!";
+    }  // else of if (nullptr == fTofHitDigiMatches)
+  }    // if (nullptr == fTofHitDigiMatches)
 
   fTofHits = static_cast<TClonesArray*>(ioman->GetObject("TofHit"));
   if (nullptr != fTofHits) {
-- 
GitLab