From 7919d72c19cd29a9e6d93114c7f718a5e71fc473 Mon Sep 17 00:00:00 2001 From: shahoian Date: Sun, 9 Aug 2026 14:52:49 +0400 Subject: [PATCH 1/2] Protect RecoContainer TRDtracklets access in absence of the TRD --- .../Detectors/GlobalTracking/src/RecoContainer.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx b/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx index 277466fb2e969..e1e11beae8c19 100644 --- a/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx +++ b/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx @@ -1276,12 +1276,12 @@ const o2::tpc::ClusterNativeAccess& RecoContainer::getTPCClusters() const gsl::span RecoContainer::getTRDTracklets() const { - return inputsTRD->mTracklets; + return inputsTRD ? inputsTRD->mTracklets : gsl::span(); } gsl::span RecoContainer::getTRDCalibratedTracklets() const { - return inputsTRD->mSpacePoints; + return inputsTRD ? inputsTRD->mSpacePoints : gsl::span(); } gsl::span RecoContainer::getTRDTriggerRecords() const @@ -1300,12 +1300,12 @@ gsl::span RecoContainer::getTRDTriggerRecords() co const o2::dataformats::MCTruthContainer* RecoContainer::getTRDTrackletsMCLabels() const { - return inputsTRD->mTrackletLabels.get(); + return inputsTRD ? inputsTRD->mTrackletLabels.get() : nullptr; } const o2::dataformats::ConstMCTruthContainerView* RecoContainer::getTPCClustersMCLabels() const { - return inputsTPCclusters->clusterIndex.clustersMCTruth; + return inputsTRD ? inputsTPCclusters->clusterIndex.clustersMCTruth : nullptr; } //__________________________________________________________ From 04178e8016f4fde9aa17703f568f81e353cc1305 Mon Sep 17 00:00:00 2001 From: shahoian Date: Sun, 9 Aug 2026 14:57:02 +0400 Subject: [PATCH 2/2] Check for TRD container before accessing it --- DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx | 2 +- Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx b/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx index e1e11beae8c19..141d4520229fe 100644 --- a/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx +++ b/DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx @@ -1305,7 +1305,7 @@ const o2::dataformats::MCTruthContainer* RecoContainer::getTRDT const o2::dataformats::ConstMCTruthContainerView* RecoContainer::getTPCClustersMCLabels() const { - return inputsTRD ? inputsTPCclusters->clusterIndex.clustersMCTruth : nullptr; + return inputsTPCclusters->clusterIndex.clustersMCTruth; } //__________________________________________________________ diff --git a/Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx b/Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx index 317db93985ce3..d9dc774de812e 100644 --- a/Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx +++ b/Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx @@ -316,8 +316,8 @@ class TPCTimeSeries : public Task // D2: build TPC track index → TRD tracklet data map (for unbinned output) // For each TPC track that has a TRD match, store the TrackTRD tracklet indices std::unordered_map tpcToTRDMap; - auto trdTracklets = mTPCOnly ? gsl::span() : recoData.getTRDTracklets(); - auto trdCalibTracklets = mTPCOnly ? gsl::span() : recoData.getTRDCalibratedTracklets(); + auto trdTracklets = (mTPCOnly || !recoData.inputsTRD) ? gsl::span() : recoData.getTRDTracklets(); + auto trdCalibTracklets = (mTPCOnly || !recoData.inputsTRD) ? gsl::span() : recoData.getTRDCalibratedTracklets(); if (mUnbinnedWriter && !mTPCOnly) { // scan ITS-TPC-TRD tracks auto itstpctrdTracks = recoData.getITSTPCTRDTracks();