From 41284dc3410480cada92128cc0b5471c8ae48942 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Mon, 13 Nov 2023 08:19:18 +0100 Subject: [PATCH] Use the new edm4hep::CellIDEncoding (#157) --- k4FWCore/include/k4FWCore/DataHandle.h | 4 +++- test/k4FWCoreTest/CMakeLists.txt | 2 +- test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h | 4 +++- test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/k4FWCore/include/k4FWCore/DataHandle.h b/k4FWCore/include/k4FWCore/DataHandle.h index bc308d3b..3c6c6829 100644 --- a/k4FWCore/include/k4FWCore/DataHandle.h +++ b/k4FWCore/include/k4FWCore/DataHandle.h @@ -26,6 +26,8 @@ #include "Gaudi/Algorithm.h" #include "GaudiKernel/DataObjectHandle.h" +#include "edm4hep/Constants.h" + #include "TTree.h" #include @@ -213,7 +215,7 @@ template T* DataHandle::createAndPut() { template const std::string DataHandle::getCollMetadataCellID(const unsigned int id) { if (auto lpds = dynamic_cast(m_eds.get())) { auto colMD = lpds->getProvider().getCollectionMetaData(id); - return colMD.getValue("CellIDEncodingString"); + return colMD.getValue(edm4hep::CellIDEncoding); } throw GaudiException("getCollMetadataCellID is only implemented for the legacy data svc", diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index fd5a244b..c461c88b 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -21,7 +21,7 @@ limitations under the License. # Package: k4FWCoreTest ################################################################################ -find_package(EDM4HEP) +find_package(EDM4HEP 0.10.01 REQUIRED) set(k4fwcoretest_plugin_sources src/components/TestDataHandleUniquePtr.cpp diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h index c40f8b3d..8c66fdb8 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h @@ -26,6 +26,8 @@ #include "k4FWCore/DataHandle.h" #include "k4FWCore/MetaDataHandle.h" +#include "edm4hep/Constants.h" + // datamodel #include "edm4hep/SimTrackerHitCollection.h" @@ -53,7 +55,7 @@ class k4FWCoreTest_cellID_reader : public GaudiAlgorithm { /// Handle for the SimTrackerHits to be read DataHandle m_simTrackerHitReaderHandle{"SimTrackerHits", Gaudi::DataHandle::Reader, this}; - MetaDataHandle m_cellIDHandle{m_simTrackerHitReaderHandle, "CellIDEncodingString", + MetaDataHandle m_cellIDHandle{m_simTrackerHitReaderHandle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; }; #endif /* K4FWCORE_K4FWCORETEST_CELLID */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h index ef7c7a33..3f3e975a 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h @@ -26,6 +26,8 @@ #include "k4FWCore/DataHandle.h" #include "k4FWCore/MetaDataHandle.h" +#include "edm4hep/Constants.h" + // datamodel #include "edm4hep/SimTrackerHitCollection.h" @@ -55,7 +57,7 @@ class k4FWCoreTest_cellID_writer : public GaudiAlgorithm { /// Handle for the SimTrackerHits to be written DataHandle m_simTrackerHitWriterHandle{"SimTrackerHits", Gaudi::DataHandle::Writer, this}; - MetaDataHandle m_cellIDHandle{m_simTrackerHitWriterHandle, "CellIDEncodingString", + MetaDataHandle m_cellIDHandle{m_simTrackerHitWriterHandle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Writer}; }; #endif /* K4FWCORE_K4FWCORETEST_CELLID_WRITER */