From 2fb2c3ea05fcd59a854cb9bb345f51123b8652d1 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 1 Nov 2023 21:45:51 +0100 Subject: [PATCH 1/2] Use the new edm4hep::CellIDEncoding --- k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp | 10 ++++++---- k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp index 6d16d05f..5e242891 100644 --- a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp +++ b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp @@ -19,6 +19,8 @@ #include "k4MarlinWrapper/converters/EDM4hep2Lcio.h" #include "GlobalConvertedObjectsMap.h" +#include "edm4hep/Constants.h" + #include "k4FWCore/DataHandle.h" #include "k4FWCore/MetaDataHandle.h" @@ -94,7 +96,7 @@ void EDM4hep2LcioTool::convertTrackerHits(TrackerHitMap& trackerhits_vec, const DataHandle trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto trackerhits_coll = trackerhits_handle.get(); - MetaDataHandle cellIDStrHandle{trackerhits_handle, "CellIDEncoding", Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDStrHandle{trackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; auto* conv_trackerhits = convTrackerHits(trackerhits_coll, cellIDStrHandle.get(), trackerhits_vec); @@ -111,7 +113,7 @@ void EDM4hep2LcioTool::convertSimTrackerHits(SimTrackerHitMap& simtrackerhits_ve DataHandle simtrackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto simtrackerhits_coll = simtrackerhits_handle.get(); - MetaDataHandle cellIDHandle{simtrackerhits_handle, "CellIDEncoding", Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDHandle{simtrackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; const auto cellIDstr = cellIDHandle.get(); auto* conv_simtrackerhits = convSimTrackerHits(simtrackerhits_coll, cellIDstr, simtrackerhits_vec, mcparticles_vec); @@ -128,7 +130,7 @@ void EDM4hep2LcioTool::convertCalorimeterHits(CaloHitMap& calo_hits_vec, const s DataHandle calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto calohit_coll = calohit_handle.get(); - MetaDataHandle cellIDHandle{calohit_handle, "CellIDEncoding", Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDHandle{calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; const auto cellIDstr = cellIDHandle.get(); auto* conv_calohits = convCalorimeterHits(calohit_coll, cellIDstr, calo_hits_vec); @@ -160,7 +162,7 @@ void EDM4hep2LcioTool::convertSimCalorimeterHits(SimCaloHitMap& sim_calo_hits_ve DataHandle sim_calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto simcalohit_coll = sim_calohit_handle.get(); - MetaDataHandle cellIDHandle{sim_calohit_handle, "CellIDEncoding", Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDHandle{sim_calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; const auto cellIDstr = cellIDHandle.get(); // TODO mcparticles_vdc diff --git a/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp b/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp index 4a1857df..e5cadfdf 100644 --- a/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp +++ b/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -107,11 +108,11 @@ void Lcio2EDM4hepTool::registerCollection( lcioColl->getParameters().getStringKeys(string_keys); for (auto& elem : string_keys) { - if (elem == "CellIDEncoding") { + if (elem == edm4hep::CellIDEncoding) { const auto& lcio_coll_cellid_str = lcioColl->getParameters().getStringVal(lcio::LCIO::CellIDEncoding); auto& mdFrame = m_podioDataSvc->getMetaDataFrame(); - mdFrame.putParameter(podio::collMetadataParamName(name, "CellIDEncoding"), lcio_coll_cellid_str); - debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, "CellIDEncoding") + mdFrame.putParameter(podio::collMetadataParamName(name, edm4hep::CellIDEncoding), lcio_coll_cellid_str); + debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, edm4hep::CellIDEncoding) << " value: " << lcio_coll_cellid_str << endmsg; } else { // TODO: figure out where this actually needs to go From 0e61a69a0f00387dd1c2cf8e33e9f179c4f06696 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Fri, 3 Nov 2023 11:34:38 +0100 Subject: [PATCH 2/2] Add a minimum version of EDM4hep --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 727e82d8..1aea3971 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ include(GNUInstallDirs) find_package(Gaudi REQUIRED) find_package(LCIO REQUIRED) find_package(Marlin REQUIRED) -find_package(EDM4HEP REQUIRED) +find_package(EDM4HEP 0.10.1 REQUIRED) find_package(k4FWCore REQUIRED) find_package(k4EDM4hep2LcioConv REQUIRED)