From 4b9728a8d62eef0c4b66813d15191734afe3a53e Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 1 Oct 2024 11:16:57 +0200 Subject: [PATCH] Use new links category to define links --- edm4hep.yaml | 43 +++++++++++++++++++ edm4hep/CMakeLists.txt | 2 - edm4hep/src/LinkCollectionDeclarations.cc | 15 ------- .../edm4hep/CaloHitMCParticleLinkCollection.h | 13 ------ .../edm4hep/CaloHitSimCaloHitLinkCollection.h | 13 ------ .../edm4hep/ClusterMCParticleLinkCollection.h | 13 ------ .../edm4hep/RecoMCParticleLinkCollection.h | 13 ------ .../edm4hep/TrackMCParticleLinkCollection.h | 13 ------ .../TrackerHitSimTrackerHitLinkCollection.h | 13 ------ .../VertexRecoParticleLinkCollection.h | 13 ------ python/edm4hep/__init__.py | 14 ------ 11 files changed, 43 insertions(+), 122 deletions(-) delete mode 100644 edm4hep/src/LinkCollectionDeclarations.cc delete mode 100644 include/edm4hep/CaloHitMCParticleLinkCollection.h delete mode 100644 include/edm4hep/CaloHitSimCaloHitLinkCollection.h delete mode 100644 include/edm4hep/ClusterMCParticleLinkCollection.h delete mode 100644 include/edm4hep/RecoMCParticleLinkCollection.h delete mode 100644 include/edm4hep/TrackMCParticleLinkCollection.h delete mode 100644 include/edm4hep/TrackerHitSimTrackerHitLinkCollection.h delete mode 100644 include/edm4hep/VertexRecoParticleLinkCollection.h diff --git a/edm4hep.yaml b/edm4hep.yaml index d121abc8d..7cb8240da 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -685,3 +685,46 @@ interfaces: Types: - edm4hep::TrackerHit3D - edm4hep::TrackerHitPlane + +links: + edm4hep::RecoMCParticleLink: + Description: "Link between a ReconstructedParticle and an MCParticle" + Author: "EDM4hep authors" + From: edm4hep::ReconstructedParticle + To: edm4hep::MCParticle + + edm4hep::CaloHitMCParticleLink: + Description: "Link between a CalorimeterHit and an MCParticle" + Author: "EDM4hep authors" + From: edm4hep::CalorimeterHit + To: edm4hep::MCParticle + + edm4hep::ClusterMCParticleLink: + Description: "Link between a Cluster and an MCParticle" + Author: "EDM4hep authors" + From: edm4hep::Cluster + To: edm4hep::MCParticle + + edm4hep::TrackMCParticleLink: + Description: "Link between a Track and an MCParticle" + Author: "EDM4hep authors" + From: edm4hep::Track + To: edm4hep::MCParticle + + edm4hep::CaloHitSimCaloHitLink: + Description: "Link between a CalorimeterHit and a SimCalorimeterHit" + Author: "EDM4hep authors" + From: edm4hep::CalorimeterHit + To: edm4hep::SimCalorimeterHit + + edm4hep::TrackerHitSimTrackerHitLink: + Description: "Link between a TrackerHit and a SimTrackerHit" + Author: "EDM4hep authors" + From: edm4hep::TrackerHit + To: edm4hep::SimTrackerHit + + edm4hep::VertexRecoParticleLink: + Description: "Link between a Vertex and a ReconstructedParticle" + Author: "EDM4hep authors" + From: edm4hep::Vertex + To: edm4hep::ReconstructedParticle diff --git a/edm4hep/CMakeLists.txt b/edm4hep/CMakeLists.txt index da15f8bf6..570022441 100644 --- a/edm4hep/CMakeLists.txt +++ b/edm4hep/CMakeLists.txt @@ -18,8 +18,6 @@ add_library(EDM4HEP::edm4hep ALIAS edm4hep) file(GLOB_RECURSE top_headers ${PROJECT_SOURCE_DIR}/include/*.h) target_sources(edm4hep PUBLIC FILE_SET headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/include FILES ${top_headers}) -target_sources(edm4hep PRIVATE src/LinkCollectionDeclarations.cc) - if (nlohmann_json_FOUND) target_compile_definitions(edm4hep PUBLIC PODIO_JSON_OUTPUT) target_link_libraries(edm4hep PUBLIC nlohmann_json::nlohmann_json) diff --git a/edm4hep/src/LinkCollectionDeclarations.cc b/edm4hep/src/LinkCollectionDeclarations.cc deleted file mode 100644 index 1b463de45..000000000 --- a/edm4hep/src/LinkCollectionDeclarations.cc +++ /dev/null @@ -1,15 +0,0 @@ -#include "edm4hep/CaloHitMCParticleLinkCollection.h" -#include "edm4hep/CaloHitSimCaloHitLinkCollection.h" -#include "edm4hep/ClusterMCParticleLinkCollection.h" -#include "edm4hep/RecoMCParticleLinkCollection.h" -#include "edm4hep/TrackMCParticleLinkCollection.h" -#include "edm4hep/TrackerHitSimTrackerHitLinkCollection.h" -#include "edm4hep/VertexRecoParticleLinkCollection.h" - -PODIO_DECLARE_LINK(edm4hep::ReconstructedParticle, edm4hep::MCParticle) -PODIO_DECLARE_LINK(edm4hep::TrackerHit, edm4hep::SimTrackerHit) -PODIO_DECLARE_LINK(edm4hep::Track, edm4hep::MCParticle) -PODIO_DECLARE_LINK(edm4hep::Cluster, edm4hep::MCParticle) -PODIO_DECLARE_LINK(edm4hep::CalorimeterHit, edm4hep::SimCalorimeterHit) -PODIO_DECLARE_LINK(edm4hep::CalorimeterHit, edm4hep::MCParticle) -PODIO_DECLARE_LINK(edm4hep::Vertex, edm4hep::ReconstructedParticle) diff --git a/include/edm4hep/CaloHitMCParticleLinkCollection.h b/include/edm4hep/CaloHitMCParticleLinkCollection.h deleted file mode 100644 index 4483893fd..000000000 --- a/include/edm4hep/CaloHitMCParticleLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_CALOHITMCPARTICLELINKCOLLECTION_H -#define EDM4HEP_CALOHITMCPARTICLELINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using CaloHitMCParticleLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_CALOHITMCPARTICLELINKCOLLECTION_H diff --git a/include/edm4hep/CaloHitSimCaloHitLinkCollection.h b/include/edm4hep/CaloHitSimCaloHitLinkCollection.h deleted file mode 100644 index 4881e20f0..000000000 --- a/include/edm4hep/CaloHitSimCaloHitLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_CALOHITSIMCALOHITLINKCOLLECTION_H -#define EDM4HEP_CALOHITSIMCALOHITLINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using CaloHitSimCaloHitLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_CALOHITSIMCALOHITLINKCOLLECTION_H diff --git a/include/edm4hep/ClusterMCParticleLinkCollection.h b/include/edm4hep/ClusterMCParticleLinkCollection.h deleted file mode 100644 index 92efb9f80..000000000 --- a/include/edm4hep/ClusterMCParticleLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_CLUSTERMCPARTICLELINKCOLLECTION_H -#define EDM4HEP_CLUSTERMCPARTICLELINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using ClusterMCParticleLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_CLUSTERMCPARTICLELINKCOLLECTION_H diff --git a/include/edm4hep/RecoMCParticleLinkCollection.h b/include/edm4hep/RecoMCParticleLinkCollection.h deleted file mode 100644 index d3ae39168..000000000 --- a/include/edm4hep/RecoMCParticleLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_RECOMCPARTICLELINKCOLLECTION_H -#define EDM4HEP_RECOMCPARTICLELINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using RecoMCParticleLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_RECOMCPARTICLELINKCOLLECTION_H diff --git a/include/edm4hep/TrackMCParticleLinkCollection.h b/include/edm4hep/TrackMCParticleLinkCollection.h deleted file mode 100644 index 2dde85cdd..000000000 --- a/include/edm4hep/TrackMCParticleLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_TRACKMCPARTICLELINKCOLLECTION_H -#define EDM4HEP_TRACKMCPARTICLELINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using TrackMCParticleLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_CLUSTERMCPARTICLELINKCOLLECTION_H diff --git a/include/edm4hep/TrackerHitSimTrackerHitLinkCollection.h b/include/edm4hep/TrackerHitSimTrackerHitLinkCollection.h deleted file mode 100644 index d0928c9e1..000000000 --- a/include/edm4hep/TrackerHitSimTrackerHitLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_TRACKERHITSIMTRACKERHITLINKCOLLECTION_H -#define EDM4HEP_TRACKERHITSIMTRACKERHITLINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using TrackerHitSimTrackerHitLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_TRACKERHITSIMTRACKERHITLINKCOLLECTION_H diff --git a/include/edm4hep/VertexRecoParticleLinkCollection.h b/include/edm4hep/VertexRecoParticleLinkCollection.h deleted file mode 100644 index 11729960d..000000000 --- a/include/edm4hep/VertexRecoParticleLinkCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_CLUSTERRECONSTRUCTEDPARTICLELINKCOLLECTION_H -#define EDM4HEP_CLUSTERRECONSTRUCTEDPARTICLELINKCOLLECTION_H - -#include - -#include -#include - -namespace edm4hep { -using VertexRecoParticleLinkCollection = podio::LinkCollection; -} // namespace edm4hep - -#endif // EDM4HEP_CLUSTERRECONSTRUCTEDPARTICLELINKCOLLECTION_H diff --git a/python/edm4hep/__init__.py b/python/edm4hep/__init__.py index e0ac99b00..42f27473c 100644 --- a/python/edm4hep/__init__.py +++ b/python/edm4hep/__init__.py @@ -29,20 +29,6 @@ if res != 0: raise RuntimeError("Failed to load edm4hep v2 legacy library") -_LINK_COLLS = [ - "RecoMCParticle", - "CaloHitMCParticle", - "CaloHitSimCaloHit", - "ClusterMCParticle", - "TrackMCParticle", - "TrackerHitSimTrackerHit", - "VertexRecoParticle", -] - -for lc in _LINK_COLLS: - if ROOT.gInterpreter.LoadFile(f"edm4hep/{lc}LinkCollection.h") != 0: - raise RuntimeError(f"Failed to load {lc}LinkCollection.h") - from ROOT import edm4hep # noqa: E402 from podio.pythonizations import load_pythonizations # noqa: E402