From 94f1dc5180d73983ef5d1f0b03b2552e3a36f27a Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Fri, 21 Jul 2023 11:13:26 +0200 Subject: [PATCH 1/7] core examples tests --- Examples/Python/python/acts/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Examples/Python/python/acts/__init__.py b/Examples/Python/python/acts/__init__.py index 98c8af5929f..85d487de6f9 100644 --- a/Examples/Python/python/acts/__init__.py +++ b/Examples/Python/python/acts/__init__.py @@ -26,7 +26,6 @@ else: warnings.warn(error + "\nThe compile-time threshold will be used in this case!") - def Propagator(stepper, navigator): for prefix in ("Eigen", "Atlas", "StraightLine"): _stepper = getattr(ActsPythonBindings, f"{prefix}Stepper") From 12b2824855497aa5ba691e37b79a5d8c906b1ccb Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Fri, 21 Jul 2023 11:16:49 +0200 Subject: [PATCH 2/7] python formatting --- Examples/Python/python/acts/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Examples/Python/python/acts/__init__.py b/Examples/Python/python/acts/__init__.py index 85d487de6f9..98c8af5929f 100644 --- a/Examples/Python/python/acts/__init__.py +++ b/Examples/Python/python/acts/__init__.py @@ -26,6 +26,7 @@ else: warnings.warn(error + "\nThe compile-time threshold will be used in this case!") + def Propagator(stepper, navigator): for prefix in ("Eigen", "Atlas", "StraightLine"): _stepper = getattr(ActsPythonBindings, f"{prefix}Stepper") From 9eeeb332f4ca3fc22e9e2d011f3d4904a229021c Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Wed, 1 Nov 2023 10:14:57 +0100 Subject: [PATCH 3/7] acessing index of podio::ObjectID directly --- Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp | 2 +- Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp | 2 +- Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp | 4 ++-- Examples/Io/EDM4hep/src/EDM4hepUtil.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp index 3719c7bb5ce..9f12813c6e5 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp @@ -79,7 +79,7 @@ ProcessCode EDM4hepMeasurementReader::read(const AlgorithmContext& ctx) { m_outputMeasurements(ctx, std::move(measurements)); m_outputMeasurementSimHitsMap(ctx, std::move(measurementSimHitsMap)); m_outputSourceLinks(ctx, std::move(sourceLinks)); - if (!m_cfg.outputClusters.empty()) { + if (not m_cfg.outputClusters.empty()) { m_outputClusters(ctx, std::move(clusters)); } diff --git a/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp index 6c46112bbbb..8834d565a91 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp @@ -55,7 +55,7 @@ ProcessCode EDM4hepParticleReader::read(const AlgorithmContext& ctx) { EDM4hepUtil::readParticle(mcParticle, [](const edm4hep::MCParticle& p) { ActsFatras::Barcode result; // TODO dont use podio internal id - result.setParticle(p.id()); + result.setParticle(p.id().index); return result; }); unordered.push_back(particle); diff --git a/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp index 9f58fa1f3fd..b05a256c919 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp @@ -54,7 +54,7 @@ ProcessCode EDM4hepSimHitReader::read(const AlgorithmContext& ctx) { mcParticle, [](const edm4hep::MCParticle& p) { ActsFatras::Barcode result; // TODO dont use podio internal id - result.setParticle(p.id()); + result.setParticle(p.id().index); return result; }); unordered.push_back(particle); @@ -78,7 +78,7 @@ ProcessCode EDM4hepSimHitReader::read(const AlgorithmContext& ctx) { [](const edm4hep::MCParticle& particle) { ActsFatras::Barcode result; // TODO dont use podio internal id - result.setParticle(particle.id()); + result.setParticle(particle.id().index); return result; }, [&](std::uint64_t cellId) { diff --git a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp index 7332f3d5796..8b0acd17419 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp @@ -152,7 +152,7 @@ Measurement EDM4hepUtil::readMeasurement( // no need for digitization as we only want to identify the sensor Acts::GeometryIdentifier geometryId = geometryMapper(from.getCellID()); - IndexSourceLink sourceLink{geometryId, from.id()}; + IndexSourceLink sourceLink{geometryId, static_cast(from.id().index)}; auto pos = from.getPosition(); auto cov = from.getCovMatrix(); From 708346fd0e2b1cd1f2011e27f23be1278a816f9c Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Wed, 1 Nov 2023 10:17:48 +0100 Subject: [PATCH 4/7] not is ! --- Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp index 9f12813c6e5..3719c7bb5ce 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp @@ -79,7 +79,7 @@ ProcessCode EDM4hepMeasurementReader::read(const AlgorithmContext& ctx) { m_outputMeasurements(ctx, std::move(measurements)); m_outputMeasurementSimHitsMap(ctx, std::move(measurementSimHitsMap)); m_outputSourceLinks(ctx, std::move(sourceLinks)); - if (not m_cfg.outputClusters.empty()) { + if (!m_cfg.outputClusters.empty()) { m_outputClusters(ctx, std::move(clusters)); } From 7e6f3ced85c0e7aa47c3918b1682268f8717cc26 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Tue, 21 Nov 2023 14:15:37 +0100 Subject: [PATCH 5/7] bump minimum podio version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 946452b2bd3..6c0beaa16b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ set(_acts_autodiff_version 0.6) set(_acts_boost_version 1.71.0) set(_acts_dd4hep_version 1.21) set(_acts_edm4hep_version 0.7) -set(_acts_podio_version 0.16) +set(_acts_podio_version 0.17.1) set(_acts_doxygen_version 1.9.4) set(_acts_eigen3_version 3.3.7) set(_acts_hepmc3_version 3.2.1) From 69865b1521f5835ed43563fd4a3bf8f2b1850fc1 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Tue, 21 Nov 2023 15:13:04 +0100 Subject: [PATCH 6/7] Revert "bump minimum podio version" This reverts commit 7e6f3ced85c0e7aa47c3918b1682268f8717cc26. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c0beaa16b1..946452b2bd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ set(_acts_autodiff_version 0.6) set(_acts_boost_version 1.71.0) set(_acts_dd4hep_version 1.21) set(_acts_edm4hep_version 0.7) -set(_acts_podio_version 0.17.1) +set(_acts_podio_version 0.16) set(_acts_doxygen_version 1.9.4) set(_acts_eigen3_version 3.3.7) set(_acts_hepmc3_version 3.2.1) From 309560d5207277bf36d962e66b9f75ba2ce7c5cd Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Tue, 21 Nov 2023 15:23:06 +0100 Subject: [PATCH 7/7] add helper to unpack ID itself or index --- .../ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp | 14 ++++++++++++++ Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp | 3 +-- Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp | 7 +++---- Examples/Io/EDM4hep/src/EDM4hepUtil.cpp | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp b/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp index 4574b0c0407..11b731125bc 100644 --- a/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp +++ b/Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp @@ -118,5 +118,19 @@ void writeTrajectory(const Acts::GeometryContext& gctx, double Bz, const Acts::ParticleHypothesis& particleHypothesis, const IndexMultimap& hitParticlesMap); +/// Helper function to either return an id as is, or unpack an index from it +/// if it is a podio::ObjectID. +/// @tparam T The type of the id. +/// @param o The id to convert. +/// @return The id as an unsigned integer. +template +uint64_t podioObjectIDToInteger(T&& o) { + if constexpr (!std::is_same_v) { + return o; + } else { + return o.index; + } +} + } // namespace EDM4hepUtil } // namespace ActsExamples diff --git a/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp index a2f71bfa13f..96c6d5572b2 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepParticleReader.cpp @@ -55,8 +55,7 @@ ProcessCode EDM4hepParticleReader::read(const AlgorithmContext& ctx) { auto particle = EDM4hepUtil::readParticle(mcParticle, [](const edm4hep::MCParticle& p) { ActsFatras::Barcode result; - // TODO dont use podio internal id - result.setParticle(p.id().index); + result.setParticle(EDM4hepUtil::podioObjectIDToInteger(p.id())); return result; }); unordered.push_back(particle); diff --git a/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp index b3a95389a8a..aa036811f3f 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepSimHitReader.cpp @@ -54,8 +54,7 @@ ProcessCode EDM4hepSimHitReader::read(const AlgorithmContext& ctx) { auto particle = EDM4hepUtil::readParticle( mcParticle, [](const edm4hep::MCParticle& p) { ActsFatras::Barcode result; - // TODO dont use podio internal id - result.setParticle(p.id().index); + result.setParticle(EDM4hepUtil::podioObjectIDToInteger(p.id())); return result; }); unordered.push_back(particle); @@ -78,8 +77,8 @@ ProcessCode EDM4hepSimHitReader::read(const AlgorithmContext& ctx) { simTrackerHit, [](const edm4hep::MCParticle& particle) { ActsFatras::Barcode result; - // TODO dont use podio internal id - result.setParticle(particle.id().index); + result.setParticle( + EDM4hepUtil::podioObjectIDToInteger(particle.id())); return result; }, [&](std::uint64_t cellId) { diff --git a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp index 87ede6e2445..aef0d6cb191 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepUtil.cpp @@ -152,7 +152,8 @@ Measurement EDM4hepUtil::readMeasurement( // no need for digitization as we only want to identify the sensor Acts::GeometryIdentifier geometryId = geometryMapper(from.getCellID()); - IndexSourceLink sourceLink{geometryId, static_cast(from.id().index)}; + IndexSourceLink sourceLink{ + geometryId, static_cast(podioObjectIDToInteger(from.id()))}; auto pos = from.getPosition(); auto cov = from.getCovMatrix();