From 1a9eefa169dd808b92444bd0dfce7ed4e29c58ec Mon Sep 17 00:00:00 2001 From: tmadlener Date: Mon, 27 Nov 2023 14:14:36 +0100 Subject: [PATCH 1/5] Rename TrackerHit to TrackerHit3D for the concrete type --- k4FWCore/components/PodioInput.cpp | 6 +++--- .../src/components/ExampleFunctionalConsumerMultiple.cpp | 4 ++-- .../src/components/ExampleFunctionalProducerMultiple.cpp | 6 +++--- .../src/components/ExampleFunctionalTransformerMultiple.cpp | 4 ++-- .../src/components/k4FWCoreTest_CheckExampleEventData.cpp | 2 +- .../src/components/k4FWCoreTest_CreateExampleEventData.cpp | 6 +++--- .../src/components/k4FWCoreTest_CreateExampleEventData.h | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index 1af6a0b2..ca141de9 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -45,7 +45,7 @@ #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TimeSeriesCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #include "edm4hep/TrackerHitPlaneCollection.h" #include "edm4hep/TrackerPulseCollection.h" #include "edm4hep/VertexCollection.h" @@ -85,8 +85,8 @@ void PodioInput::fillReaders() { m_readers["edm4hep::ClusterCollection"] = [&](std::string_view collName) { maybeRead(collName); }; - m_readers["edm4hep::TrackerHitCollection"] = [&](std::string_view collName) { - maybeRead(collName); + m_readers["edm4hep::TrackerHit3DCollection"] = [&](std::string_view collName) { + maybeRead(collName); }; m_readers["edm4hep::TrackerHitPlaneCollection"] = [&](std::string_view collName) { maybeRead(collName); diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp index 1f4e6447..fe6890c7 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp @@ -23,7 +23,7 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #include "podio/UserDataCollection.h" // Define BaseClass_t @@ -37,7 +37,7 @@ using FloatColl = podio::UserDataCollection; using ParticleColl = edm4hep::MCParticleCollection; using SimTrackerHitColl = edm4hep::SimTrackerHitCollection; -using TrackerHitColl = edm4hep::TrackerHitCollection; +using TrackerHitColl = edm4hep::TrackerHit3DCollection; using TrackColl = edm4hep::TrackCollection; struct ExampleFunctionalConsumerMultiple final diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp index 7f892560..69b8c8a5 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp @@ -24,7 +24,7 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #include "podio/UserDataCollection.h" #include @@ -33,7 +33,7 @@ using Float = podio::UserDataCollection; using Particle = edm4hep::MCParticleCollection; using SimTrackerHit = edm4hep::SimTrackerHitCollection; -using TrackerHit = edm4hep::TrackerHitCollection; +using TrackerHit = edm4hep::TrackerHit3DCollection; using Track = edm4hep::TrackCollection; struct ExampleFunctionalProducerMultiple final @@ -71,7 +71,7 @@ struct ExampleFunctionalProducerMultiple final auto hit = simTrackerHits.create(); hit.setPosition({3, 4, 5}); - auto trackerHits = edm4hep::TrackerHitCollection(); + auto trackerHits = edm4hep::TrackerHit3DCollection(); auto trackerHit = trackerHits.create(); trackerHit.setPosition({3, 4, 5}); diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp index 3a5876b5..f2bb1f70 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp @@ -23,7 +23,7 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #include "podio/UserDataCollection.h" // Define BaseClass_t @@ -35,7 +35,7 @@ using FloatColl = podio::UserDataCollection; using ParticleColl = edm4hep::MCParticleCollection; using SimTrackerHitColl = edm4hep::SimTrackerHitCollection; -using TrackerHitColl = edm4hep::TrackerHitCollection; +using TrackerHitColl = edm4hep::TrackerHit3DCollection; using TrackColl = edm4hep::TrackCollection; // As a simple example, we'll write an integer and a collection of MCParticles diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp index 9d918329..78d675a8 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp @@ -23,7 +23,7 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" DECLARE_COMPONENT(k4FWCoreTest_CheckExampleEventData) diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp index 402fffb1..88d869b5 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp @@ -24,7 +24,7 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #if __has_include("edm4hep/EDM4hepVersion.h") #include "edm4hep/EDM4hepVersion.h" #else @@ -74,8 +74,8 @@ StatusCode k4FWCoreTest_CreateExampleEventData::execute() { auto hit = simTrackerHits->create(); hit.setPosition({3, 4, 5}); - edm4hep::TrackerHitCollection* trackerHits = m_TrackerHitHandle.createAndPut(); - auto trackerHit = trackerHits->create(); + edm4hep::TrackerHit3DCollection* trackerHits = m_TrackerHitHandle.createAndPut(); + auto trackerHit = trackerHits->create(); trackerHit.setPosition({3, 4, 5}); edm4hep::TrackCollection* tracks = m_trackHandle.createAndPut(); diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h index ed1b8ee9..7d260743 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h @@ -32,7 +32,7 @@ namespace edm4hep { class MCParticleCollection; class SimTrackerHitCollection; - class TrackerHitCollection; + class TrackerHit3DCollection; class SimCaloHitCollection; class TrackCollection; } // namespace edm4hep @@ -69,7 +69,7 @@ class k4FWCoreTest_CreateExampleEventData : public GaudiAlgorithm { DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; /// Handle for the SimTrackerHits to be written DataHandle m_simTrackerHitHandle{"SimTrackerHits", Gaudi::DataHandle::Writer, this}; - DataHandle m_TrackerHitHandle{"TrackerHits", Gaudi::DataHandle::Writer, this}; + DataHandle m_TrackerHitHandle{"TrackerHits", Gaudi::DataHandle::Writer, this}; /// Handle for the Tracks to be written DataHandle m_trackHandle{"Tracks", Gaudi::DataHandle::Writer, this}; From 1402de9a4b8b7dea2a323471898876f35587e65e Mon Sep 17 00:00:00 2001 From: tmadlener Date: Mon, 5 Feb 2024 15:34:29 +0100 Subject: [PATCH 2/5] Make transition transparent --- k4FWCore/components/PodioInput.cpp | 7 +++++++ .../components/ExampleFunctionalConsumerMultiple.cpp | 8 ++++++++ .../components/ExampleFunctionalProducerMultiple.cpp | 8 ++++++++ .../ExampleFunctionalTransformerMultiple.cpp | 8 ++++++++ .../k4FWCoreTest_CheckExampleEventData.cpp | 8 ++++++++ .../components/k4FWCoreTest_CheckExampleEventData.h | 4 ---- .../k4FWCoreTest_CreateExampleEventData.cpp | 1 - .../components/k4FWCoreTest_CreateExampleEventData.h | 12 +++++++++++- 8 files changed, 50 insertions(+), 6 deletions(-) diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index ca141de9..54f44886 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -45,7 +45,14 @@ #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TimeSeriesCollection.h" #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") #include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif #include "edm4hep/TrackerHitPlaneCollection.h" #include "edm4hep/TrackerPulseCollection.h" #include "edm4hep/VertexCollection.h" diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp index fe6890c7..34ef2588 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp @@ -23,7 +23,15 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") #include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif +#include "edm4hep/TrackerHitPlaneCollection.h" #include "podio/UserDataCollection.h" // Define BaseClass_t diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp index 69b8c8a5..e63f1e64 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp @@ -24,7 +24,15 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") #include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif +#include "edm4hep/TrackerHitPlaneCollection.h" #include "podio/UserDataCollection.h" #include diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp index f2bb1f70..e84587fa 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalTransformerMultiple.cpp @@ -23,6 +23,14 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif #include "edm4hep/TrackerHit3DCollection.h" #include "podio/UserDataCollection.h" diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp index 78d675a8..38be7565 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp @@ -23,7 +23,15 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") #include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif +#include "edm4hep/TrackerHitPlaneCollection.h" DECLARE_COMPONENT(k4FWCoreTest_CheckExampleEventData) diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h index 7c507d4b..92fe7ba0 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h @@ -29,10 +29,6 @@ // datamodel namespace edm4hep { class MCParticleCollection; - class SimTrackerHitCollection; - class TrackerHitCollection; - class SimCaloHitCollection; - class TrackCollection; } // namespace edm4hep class k4FWCoreTest_CheckExampleEventData : public GaudiAlgorithm { diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp index 88d869b5..aac738e9 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp @@ -24,7 +24,6 @@ #include "edm4hep/MCParticleCollection.h" #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHit3DCollection.h" #if __has_include("edm4hep/EDM4hepVersion.h") #include "edm4hep/EDM4hepVersion.h" #else diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h index 7d260743..71431a6f 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h @@ -25,6 +25,17 @@ // key4hep #include "k4FWCore/DataHandle.h" +// edm4hep +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else +#include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif +#include "edm4hep/TrackerHitPlaneCollection.h" + // podio #include "podio/UserDataCollection.h" @@ -32,7 +43,6 @@ namespace edm4hep { class MCParticleCollection; class SimTrackerHitCollection; - class TrackerHit3DCollection; class SimCaloHitCollection; class TrackCollection; } // namespace edm4hep From 9de9e487dd60bdc39771d577b7630889dd3b4711 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Mon, 5 Feb 2024 16:58:40 +0100 Subject: [PATCH 3/5] Fix runtime issue --- k4FWCore/components/PodioInput.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index 54f44886..9f030f8f 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -95,6 +95,11 @@ void PodioInput::fillReaders() { m_readers["edm4hep::TrackerHit3DCollection"] = [&](std::string_view collName) { maybeRead(collName); }; + m_readers["edm4hep::TrackerHitCollection"] = [&](std::string_view collName) { + warning() << "Reading a TrackerHitCollection via TrackerHit3DCollection (" << collName + << "). Make sure to transition properly" << endmsg; + maybeRead(collName); + }; m_readers["edm4hep::TrackerHitPlaneCollection"] = [&](std::string_view collName) { maybeRead(collName); }; From 3d81265d8c0a65333584a23215923afad3a625ef Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Thu, 22 Feb 2024 14:49:57 +0100 Subject: [PATCH 4/5] Remove unnecessary includes Co-authored-by: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> --- .../src/components/ExampleFunctionalConsumerMultiple.cpp | 1 - .../src/components/ExampleFunctionalProducerMultiple.cpp | 1 - .../src/components/k4FWCoreTest_CreateExampleEventData.h | 1 - 3 files changed, 3 deletions(-) diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp index 34ef2588..440d8f85 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalConsumerMultiple.cpp @@ -31,7 +31,6 @@ namespace edm4hep { using TrackerHit3DCollection = edm4hep::TrackerHitCollection; } // namespace edm4hep #endif -#include "edm4hep/TrackerHitPlaneCollection.h" #include "podio/UserDataCollection.h" // Define BaseClass_t diff --git a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp index e63f1e64..fab16140 100644 --- a/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp +++ b/test/k4FWCoreTest/src/components/ExampleFunctionalProducerMultiple.cpp @@ -32,7 +32,6 @@ namespace edm4hep { using TrackerHit3DCollection = edm4hep::TrackerHitCollection; } // namespace edm4hep #endif -#include "edm4hep/TrackerHitPlaneCollection.h" #include "podio/UserDataCollection.h" #include diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h index 71431a6f..2aa3d3bd 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h @@ -34,7 +34,6 @@ namespace edm4hep { using TrackerHit3DCollection = edm4hep::TrackerHitCollection; } // namespace edm4hep #endif -#include "edm4hep/TrackerHitPlaneCollection.h" // podio #include "podio/UserDataCollection.h" From 95ad58424c921c71151b76974aaaa3347b778a52 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Thu, 22 Feb 2024 16:45:19 +0100 Subject: [PATCH 5/5] Remove slightly misleading warning --- k4FWCore/components/PodioInput.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index 9f030f8f..dd0c6d18 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -96,8 +96,6 @@ void PodioInput::fillReaders() { maybeRead(collName); }; m_readers["edm4hep::TrackerHitCollection"] = [&](std::string_view collName) { - warning() << "Reading a TrackerHitCollection via TrackerHit3DCollection (" << collName - << "). Make sure to transition properly" << endmsg; maybeRead(collName); }; m_readers["edm4hep::TrackerHitPlaneCollection"] = [&](std::string_view collName) {