From eab2e2be6f00af7b2ce0fb659239abf0c5901e90 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Fri, 30 Jun 2023 14:56:32 +0200 Subject: [PATCH 1/2] Only create an internal pointer if necessary --- k4FWCore/include/k4FWCore/DataHandle.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/k4FWCore/include/k4FWCore/DataHandle.h b/k4FWCore/include/k4FWCore/DataHandle.h index 8485fe54..8a21e8ae 100644 --- a/k4FWCore/include/k4FWCore/DataHandle.h +++ b/k4FWCore/include/k4FWCore/DataHandle.h @@ -77,7 +77,9 @@ DataHandle::DataHandle(const std::string& descriptor, Gaudi::DataHandle::Mode podio_data_service = dynamic_cast(m_eds.get()); if (nullptr != podio_data_service) { - m_dataPtr = new T(); + if constexpr (std::is_integral_v || std::is_floating_point_v) { + m_dataPtr = new T(); + } } else { // This is the legacy implementation kept for a transition period PodioLegacyDataSvc* plds; From f97890a3e6d89b40b6bd22ebf3686a82759e5930 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Mon, 3 Jul 2023 17:19:16 +0200 Subject: [PATCH 2/2] Revive cellID functionality for legacy data svc --- k4FWCore/include/k4FWCore/DataHandle.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/k4FWCore/include/k4FWCore/DataHandle.h b/k4FWCore/include/k4FWCore/DataHandle.h index 8a21e8ae..99285dde 100644 --- a/k4FWCore/include/k4FWCore/DataHandle.h +++ b/k4FWCore/include/k4FWCore/DataHandle.h @@ -193,8 +193,13 @@ template T* DataHandle::createAndPut() { // Temporary workaround for k4MarlinWrapper template const std::string DataHandle::getCollMetadataCellID(const unsigned int id) { - std::cerr << "k4FWCore: getCollMetadataCellID is not implemented!" << std::endl; - return ""; + if (auto lpds = dynamic_cast(m_eds.get())) { + auto colMD = lpds->getProvider().getCollectionMetaData(id); + return colMD.getValue("CellIDEncodingString"); + } + + throw GaudiException("getCollMetadataCellID is only implemented for the legacy data svc", + "Cannot get collection metadata", StatusCode::FAILURE); } // temporary to allow property declaration