diff --git a/README.md b/README.md index 812b1ef2b..45f7a669c 100644 --- a/README.md +++ b/README.md @@ -27,28 +27,28 @@ A generic event data model for future HEP collider experiments. | [CalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L394) | [ParticleID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L405) | [Cluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L419) | | [TrackerHit3D](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L451) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L477) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L507) | | [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L521) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L538) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L584) | -| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L813) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L825) | | +| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L623) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L635) | | **Links** | | | | |-|-|-| -| [RecoMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L622) | [CaloHitSimCaloHitLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L649) | [TrackerHitSimTrackerHitLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L677) | -| [CaloHitMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L704) | [ClusterMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L731) | [TrackMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L758) | -| [VertexRecoParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L785) | | | +| [RecoMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L690) | [CaloHitSimCaloHitLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L714) | [TrackerHitSimTrackerHitLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L720) | +| [CaloHitMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L696) | [ClusterMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L702) | [TrackMCParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L708) | +| [VertexRecoParticleLink](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L726) | | | **Generator related (meta-)data** | | | | |-|-|-| -| [GeneratorEventParameters](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L837) | | | -| [GeneratorPdfInfo](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L853) | | | +| [GeneratorEventParameters](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L647) | | | +| [GeneratorPdfInfo](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L663) | | | **Interfaces** | | | | |-|-|-| -| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L864) | | | +| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L674) | | | The tests and examples in the `tests` directory show how to read, write, and use these types in your code. diff --git a/edm4hep.yaml b/edm4hep.yaml index 5fff0bc63..8c18127ca 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -1,5 +1,5 @@ --- -schema_version: 2 +schema_version: 3 options: getSyntax: True exposePODMembers: False @@ -619,196 +619,6 @@ datatypes: void setCovMatrix(float value, edm4hep::FourMomCoords dimI, edm4hep::FourMomCoords dimJ) { getCovMatrix().setValue(value, dimI, dimJ); }\n " - edm4hep::RecoMCParticleLink: - Description: "Link between a ReconstructedParticle and the corresponding MCParticle" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::ReconstructedParticle from // reference to the reconstructed particle - - edm4hep::MCParticle to // reference to the Monte-Carlo particle - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::ReconstructedParticle getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::MCParticle getSim() const;\n" - implementation: " - edm4hep::ReconstructedParticle {name}::getRec() const { return getFrom(); }\n - edm4hep::MCParticle {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::ReconstructedParticle& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::MCParticle& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::ReconstructedParticle& rec) { setFrom(rec); }\n - " - - edm4hep::CaloHitSimCaloHitLink: - Description: "Link between a CalorimeterHit and the corresponding SimCalorimeterHit" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::CalorimeterHit from // reference to the reconstructed hit - - edm4hep::SimCalorimeterHit to // reference to the simulated hit - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::CalorimeterHit getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::SimCalorimeterHit getSim() const;\n" - implementation: " - edm4hep::CalorimeterHit {name}::getRec() const { return getFrom(); }\n - edm4hep::SimCalorimeterHit {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::CalorimeterHit& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::SimCalorimeterHit& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::SimCalorimeterHit& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::CalorimeterHit& rec) { setFrom(rec); }\n - " - - - edm4hep::TrackerHitSimTrackerHitLink: - Description: "Link between a TrackerHit and the corresponding SimTrackerHit" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::TrackerHit from // reference to the reconstructed hit - - edm4hep::SimTrackerHit to // reference to the simulated hit - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::TrackerHit getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::SimTrackerHit getSim() const;\n" - implementation: " - edm4hep::TrackerHit {name}::getRec() const { return getFrom(); }\n - edm4hep::SimTrackerHit {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::TrackerHit& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::SimTrackerHit& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::SimTrackerHit& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::TrackerHit& rec) { setFrom(rec); }\n - " - - edm4hep::CaloHitMCParticleLink: - Description: "Link between a CalorimeterHit and the corresponding MCParticle" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::CalorimeterHit from // reference to the reconstructed hit - - edm4hep::MCParticle to // reference to the Monte-Carlo particle - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::CalorimeterHit getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::MCParticle getSim() const;\n" - implementation: " - edm4hep::CalorimeterHit {name}::getRec() const { return getFrom(); }\n - edm4hep::MCParticle {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::CalorimeterHit& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::MCParticle& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::CalorimeterHit& rec) { setFrom(rec); }\n - " - - edm4hep::ClusterMCParticleLink: - Description: "Link between a Cluster and the corresponding MCParticle" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::Cluster from // reference to the cluster - - edm4hep::MCParticle to // reference to the Monte-Carlo particle - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::Cluster getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::MCParticle getSim() const;\n" - implementation: " - edm4hep::Cluster {name}::getRec() const { return getFrom(); }\n - edm4hep::MCParticle {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::Cluster& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::MCParticle& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::Cluster& rec) { setFrom(rec); }\n - " - - edm4hep::TrackMCParticleLink: - Description: "Link between a Track and the corresponding MCParticle" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::Track from // reference to the track - - edm4hep::MCParticle to // reference to the Monte-Carlo particle - ExtraCode: - declaration: " - [[deprecated(\"use getFrom instead\")]] edm4hep::Track getRec() const;\n - [[deprecated(\"use getTo instead\")]] edm4hep::MCParticle getSim() const;\n" - implementation: " - edm4hep::Track {name}::getRec() const { return getFrom(); }\n - edm4hep::MCParticle {name}::getSim() const { return getTo(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setRec(const edm4hep::Track& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setSim(const edm4hep::MCParticle& sim);\n - " - implementation: " - void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n - void {name}::setRec(const edm4hep::Track& rec) { setFrom(rec); }\n - " - - edm4hep::VertexRecoParticleLink: - Description: "Link between a Vertex and a ReconstructedParticle" - Author: "EDM4hep authors" - Members: - - float weight // weight of this link - OneToOneRelations: - - edm4hep::ReconstructedParticle to // reference to the reconstructed particle - - edm4hep::Vertex from // reference to the vertex - ExtraCode: - declaration: " - [[deprecated(\"use getTo instead\")]] edm4hep::ReconstructedParticle getRec() const;\n - [[deprecated(\"use getFrom instead\")]] edm4hep::Vertex getVertex() const;\n" - implementation: " - edm4hep::ReconstructedParticle {name}::getRec() const { return getTo(); }\n - edm4hep::Vertex {name}::getVertex() const { return getFrom(); }\n" - MutableExtraCode: - declaration: " - [[deprecated(\"use setFrom instead\")]]\n - void setVertex(const edm4hep::Vertex& rec);\n - [[deprecated(\"use setTo instead\")]]\n - void setRec(const edm4hep::ReconstructedParticle& sim);\n - " - implementation: " - void {name}::setVertex(const edm4hep::Vertex& vertex) { setFrom(vertex); }\n - void {name}::setRec(const edm4hep::ReconstructedParticle& rec) { setTo(rec); }\n - " - edm4hep::TimeSeries: Description: "Calibrated Detector Data" @@ -875,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 229f04805..a74468e8c 100644 --- a/edm4hep/CMakeLists.txt +++ b/edm4hep/CMakeLists.txt @@ -27,6 +27,14 @@ endif() PODIO_ADD_ROOT_IO_DICT(edm4hepDict edm4hep "${headers}" src/selection.xml) add_library(EDM4HEP::edm4hepDict ALIAS edm4hepDict ) +add_library(edm4hepOldSchemas SHARED schema_evolution/src/OldLinkEvolution.cc) +target_include_directories(edm4hepOldSchemas PRIVATE + $ +) +target_link_libraries(edm4hepOldSchemas PUBLIC podio::podio EDM4HEP::edm4hep) + +PODIO_ADD_ROOT_IO_DICT(edm4hepOldSchemasDict edm4hepOldSchemas ${PROJECT_SOURCE_DIR}/edm4hep/schema_evolution/include/edm4hep/schema_evolution/OldLinkData.h schema_evolution/src/selection.xml) + list(APPEND EDM4HEP_INSTALL_LIBS edm4hep edm4hepDict) PODIO_ADD_SIO_IO_BLOCKS(edm4hep "${headers}" "${sources}") diff --git a/edm4hep/schema_evolution/include/edm4hep/schema_evolution/OldLinkData.h b/edm4hep/schema_evolution/include/edm4hep/schema_evolution/OldLinkData.h new file mode 100644 index 000000000..ae4ef8d6e --- /dev/null +++ b/edm4hep/schema_evolution/include/edm4hep/schema_evolution/OldLinkData.h @@ -0,0 +1,23 @@ +#ifndef EDM4HEP_SCHEMA_EVOLUTION_OLDLINKDATA_H +#define EDM4HEP_SCHEMA_EVOLUTION_OLDLINKDATA_H + +#define MAKE_DATA_STRUCT(name) \ + struct name { \ + float weight{}; \ + }; + +namespace edm4hep { + +MAKE_DATA_STRUCT(RecoMCParticleLinkData) +MAKE_DATA_STRUCT(CaloHitMCParticleLinkData) +MAKE_DATA_STRUCT(ClusterMCParticleLinkData) +MAKE_DATA_STRUCT(TrackMCParticleLinkData) +MAKE_DATA_STRUCT(CaloHitSimCaloHitLinkData) +MAKE_DATA_STRUCT(TrackerHitSimTrackerHitLinkData) +MAKE_DATA_STRUCT(VertexRecoParticleLinkData) + +} // namespace edm4hep + +#undef MAKE_DATA_STRUCT + +#endif // EDM4HEP_SCHEMA_EVOLUTION_OLDLINKDATA_H diff --git a/edm4hep/schema_evolution/src/OldLinkEvolution.cc b/edm4hep/schema_evolution/src/OldLinkEvolution.cc new file mode 100644 index 000000000..9b834888d --- /dev/null +++ b/edm4hep/schema_evolution/src/OldLinkEvolution.cc @@ -0,0 +1,162 @@ +#include "edm4hep/CalorimeterHitCollection.h" +#include "edm4hep/ClusterCollection.h" +#include "edm4hep/DatamodelDefinition.h" +#include "edm4hep/MCParticle.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/ReconstructedParticleCollection.h" +#include "edm4hep/SimCalorimeterHitCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#include "edm4hep/TrackerHit.h" +#include "edm4hep/VertexCollection.h" +#include "edm4hep/schema_evolution/OldLinkData.h" + +#include +#include +#include +#include +#include + +#include + +namespace edm4hep { +namespace { + using namespace std::string_view_literals; + + /// Evolution function for doing "schema evolution" on generated links to make + /// them consumable by templated links. + /// + /// This is mostly just redefining things from the oldBuffers in the new terms + /// of the templated links. The most important bit is the re-definition of + /// createCollection to actually create a templated LinkCollection + template + auto evolveLinks(podio::CollectionReadBuffers buffers, podio::SchemaVersionT) { + buffers.type = podio::detail::linkCollTypeName(); + buffers.schemaVersion = podio::LinkCollection::schemaVersion; + + buffers.createCollection = [](const podio::CollectionReadBuffers& buffs, bool isSubsetColl) { + podio::LinkCollectionData data(buffs, isSubsetColl); + return std::make_unique>(std::move(data), isSubsetColl); + }; + + buffers.recast = [](podio::CollectionReadBuffers& buffs) { + if (buffs.data) { + buffs.data = podio::CollectionWriteBuffers::asVector(buffs.data); + } + }; + + buffers.deleteBuffers = [](podio::CollectionReadBuffers& buffs) { + if (buffs.data) { + delete static_cast*>(buffs.data); + } + delete buffs.references; + delete buffs.vectorMembers; + }; + + return buffers; + } + + /// Function factory for stamping out buffer creation functions that can be + /// registered in the podio::CollectionBufferFactory to create buffers for + /// collections that have been written with the generated Link collections. + /// They will hit the buffer factory with the old type name so we have to make + /// sure that the factory can deal with that. In this case we simply create + /// the same buffers that we also do for templated Links. + template + auto makeCreateLinkBufferFunction(std::string_view typeName) { + auto createBuffers = [=](bool subsetColl) { + auto readBuffers = podio::CollectionReadBuffers{}; + readBuffers.type = typeName; + readBuffers.schemaVersion = 2; + readBuffers.data = subsetColl ? nullptr : new podio::LinkDataContainer(); + + // Either it is a subset collection or we have two relations + const auto nRefs = subsetColl ? 1 : 2; + readBuffers.references = new podio::CollRefCollection(nRefs); + for (auto& ref : *readBuffers.references) { + // Make sure to place usable buffer pointers here + ref = std::make_unique>(); + } + + readBuffers.createCollection = [](podio::CollectionReadBuffers buffers, bool isSubsetColl) { + podio::LinkCollectionData data(buffers, isSubsetColl); + return std::make_unique>(std::move(data), isSubsetColl); + }; + + readBuffers.recast = [](podio::CollectionReadBuffers& buffers) { + if (buffers.data) { + buffers.data = podio::CollectionWriteBuffers::asVector(buffers.data); + } + }; + + readBuffers.deleteBuffers = [](podio::CollectionReadBuffers& buffers) { + if (buffers.data) { + // If we have data then we are not a subset collection and we have + // to clean up all type erased buffers by casting them back to + // something that we can delete + delete static_cast(buffers.data); + } + delete buffers.references; + delete buffers.vectorMembers; + }; + + return readBuffers; + }; + + return createBuffers; + } + + /// Register all the functions to the appropriate factories / registries in + /// podio + template + bool registerTransition(std::string_view collTypeName) { + const static auto registerLinkReading = [=]() { + podio::CollectionBufferFactory::mutInstance().registerCreationFunc( + std::string(collTypeName), 2, makeCreateLinkBufferFunction(collTypeName)); + + podio::SchemaEvolution::mutInstance().registerEvolutionFunc(std::string(collTypeName), 2, + edm4hep::meta::schemaVersion, evolveLinks, + podio::SchemaEvolution::Priority::UserDefined); + + return true; + }(); + + return registerLinkReading; + } + + /// Small helper macro to avoid some of the cumbersome typing +#define REGISTER_EVOLUTION(NAME, FROM, TO) \ + static const auto reg_##NAME = registerTransition("edm4hep::" #NAME "Collection"sv); + + REGISTER_EVOLUTION(RecoMCParticleLink, ReconstructedParticle, MCParticle) + REGISTER_EVOLUTION(CaloHitMCParticleLink, CalorimeterHit, MCParticle) + REGISTER_EVOLUTION(ClusterMCParticleLink, Cluster, MCParticle) + REGISTER_EVOLUTION(TrackMCParticleLink, Track, MCParticle) + REGISTER_EVOLUTION(CaloHitSimCaloHitLink, CalorimeterHit, SimCalorimeterHit) + REGISTER_EVOLUTION(TrackerHitSimTrackerHitLink, TrackerHit, SimTrackerHit) + REGISTER_EVOLUTION(VertexRecoParticleLink, Vertex, ReconstructedParticle) + + /// Another registration is necessary to get all the branch names correct + bool registerRelationNames() { + const static auto reg = []() { + static const auto relNames = podio::RelationNameMapping{ + {"edm4hep::RecoMCParticleLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::CaloHitMCParticleLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::ClusterMCParticleLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::TrackMCParticleLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::CaloHitSimCaloHitLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::TrackerHitSimTrackerHitLink"sv, {"from"sv, "to"sv}, {}}, + {"edm4hep::VertexRecoParticleLink"sv, {"from"sv, "to"sv}, {}}, + }; + podio::DatamodelRegistry::mutInstance().registerDatamodel("edm4hep_link_metamodel", "{}", relNames); + + return true; + }(); + + return reg; + } + + const static auto reg_LinkEvolution = registerRelationNames(); +} // namespace + +} // namespace edm4hep diff --git a/edm4hep/schema_evolution/src/selection.xml b/edm4hep/schema_evolution/src/selection.xml new file mode 100644 index 000000000..e6b505be5 --- /dev/null +++ b/edm4hep/schema_evolution/src/selection.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/include/edm4hep/MCRecoCaloAssociation.h b/include/edm4hep/MCRecoCaloAssociation.h deleted file mode 100644 index cddcf29a5..000000000 --- a/include/edm4hep/MCRecoCaloAssociation.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef EDM4HEP_MCRecoCaloAssociation_H -#define EDM4HEP_MCRecoCaloAssociation_H - -#include "edm4hep/CaloHitSimCaloHitLink.h" - -namespace edm4hep { -using MCRecoCaloAssociation [[deprecated("use CaloHitSimCaloHitLink instead")]] = edm4hep::CaloHitSimCaloHitLink; -} - -#endif diff --git a/include/edm4hep/MCRecoCaloAssociationCollection.h b/include/edm4hep/MCRecoCaloAssociationCollection.h deleted file mode 100644 index fae6c27f7..000000000 --- a/include/edm4hep/MCRecoCaloAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoCaloAssociationCollection_H -#define EDM4HEP_MCRecoCaloAssociationCollection_H - -#include "edm4hep/CaloHitSimCaloHitLinkCollection.h" -#include "edm4hep/MCRecoCaloAssociation.h" -#include "edm4hep/MutableMCRecoCaloAssociation.h" - -namespace edm4hep { -using MCRecoCaloAssociationCollection [[deprecated("use CaloHitSimCaloHitLinkCollection instead")]] = - edm4hep::CaloHitSimCaloHitLinkCollection; -} - -#endif diff --git a/include/edm4hep/MCRecoCaloParticleAssociation.h b/include/edm4hep/MCRecoCaloParticleAssociation.h deleted file mode 100644 index 348c16a9a..000000000 --- a/include/edm4hep/MCRecoCaloParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MCRecoCaloParticleAssociation_H -#define EDM4HEP_MCRecoCaloParticleAssociation_H - -#include "edm4hep/CaloHitMCParticleLink.h" - -namespace edm4hep { -using MCRecoCaloParticleAssociation [[deprecated("use CaloHitMCParticleLink instead")]] = - edm4hep::CaloHitMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MCRecoCaloParticleAssociationCollection.h b/include/edm4hep/MCRecoCaloParticleAssociationCollection.h deleted file mode 100644 index 3e5d95ef5..000000000 --- a/include/edm4hep/MCRecoCaloParticleAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoCaloParticleAssociationCollection_H -#define EDM4HEP_MCRecoCaloParticleAssociationCollection_H - -#include "edm4hep/CaloHitMCParticleLinkCollection.h" -#include "edm4hep/MCRecoCaloParticleAssociation.h" -#include "edm4hep/MutableMCRecoCaloParticleAssociation.h" - -namespace edm4hep { -using MCRecoCaloParticleAssociationCollection [[deprecated("use CaloHitMCParticleLinkCollection instead")]] = - edm4hep::CaloHitMCParticleLinkCollection; -} - -#endif diff --git a/include/edm4hep/MCRecoClusterParticleAssociation.h b/include/edm4hep/MCRecoClusterParticleAssociation.h deleted file mode 100644 index ffca3d8c1..000000000 --- a/include/edm4hep/MCRecoClusterParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MCRecoClusterParticleAssociation_H -#define EDM4HEP_MCRecoClusterParticleAssociation_H - -#include "edm4hep/ClusterMCParticleLink.h" - -namespace edm4hep { -using MCRecoClusterParticleAssociation [[deprecated("use ClusterMCParticleLink instead")]] = - edm4hep::ClusterMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MCRecoClusterParticleAssociationCollection.h b/include/edm4hep/MCRecoClusterParticleAssociationCollection.h deleted file mode 100644 index 280641987..000000000 --- a/include/edm4hep/MCRecoClusterParticleAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoClusterParticleAssociationCollection_H -#define EDM4HEP_MCRecoClusterParticleAssociationCollection_H - -#include "edm4hep/ClusterMCParticleLinkCollection.h" -#include "edm4hep/MCRecoClusterParticleAssociation.h" -#include "edm4hep/MutableMCRecoClusterParticleAssociation.h" - -namespace edm4hep { -using MCRecoClusterParticleAssociationCollection [[deprecated("use ClusterMCParticleLinkCollection instead")]] = - edm4hep::ClusterMCParticleLinkCollection; -} - -#endif diff --git a/include/edm4hep/MCRecoParticleAssociation.h b/include/edm4hep/MCRecoParticleAssociation.h deleted file mode 100644 index ff3e6a6d8..000000000 --- a/include/edm4hep/MCRecoParticleAssociation.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef EDM4HEP_MCRecoParticleAssociation_H -#define EDM4HEP_MCRecoParticleAssociation_H - -#include "edm4hep/RecoMCParticleLink.h" - -namespace edm4hep { -using MCRecoParticleAssociation [[deprecated("use RecoMCParticleLink instead")]] = edm4hep::RecoMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MCRecoParticleAssociationCollection.h b/include/edm4hep/MCRecoParticleAssociationCollection.h deleted file mode 100644 index 8dd9e600c..000000000 --- a/include/edm4hep/MCRecoParticleAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoParticleAssociationCollection_H -#define EDM4HEP_MCRecoParticleAssociationCollection_H - -#include "edm4hep/MCRecoParticleAssociation.h" -#include "edm4hep/MutableMCRecoParticleAssociation.h" -#include "edm4hep/RecoMCParticleLinkCollection.h" - -namespace edm4hep { -using MCRecoParticleAssociationCollection [[deprecated("use RecoMCParticleLinkCollection instead")]] = - edm4hep::RecoMCParticleLinkCollection; -} - -#endif diff --git a/include/edm4hep/MCRecoTrackParticleAssociation.h b/include/edm4hep/MCRecoTrackParticleAssociation.h deleted file mode 100644 index abb25b0b2..000000000 --- a/include/edm4hep/MCRecoTrackParticleAssociation.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef EDM4HEP_MCRecoTrackParticleAssociation_H -#define EDM4HEP_MCRecoTrackParticleAssociation_H - -#include "edm4hep/TrackMCParticleLink.h" - -namespace edm4hep { -using MCRecoTrackParticleAssociation [[deprecated("use TrackMCParticleLink instead")]] = edm4hep::TrackMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MCRecoTrackParticleAssociationCollection.h b/include/edm4hep/MCRecoTrackParticleAssociationCollection.h deleted file mode 100644 index 393bd60a4..000000000 --- a/include/edm4hep/MCRecoTrackParticleAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoTrackParticleAssociationCollection_H -#define EDM4HEP_MCRecoTrackParticleAssociationCollection_H - -#include "edm4hep/MCRecoTrackParticleAssociation.h" -#include "edm4hep/MutableMCRecoTrackParticleAssociation.h" -#include "edm4hep/TrackMCParticleLinkCollection.h" - -namespace edm4hep { -using MCRecoTrackParticleAssociationCollection [[deprecated("use TrackMCParticleLinkCollection instead")]] = - edm4hep::TrackMCParticleLinkCollection; -} - -#endif diff --git a/include/edm4hep/MCRecoTrackerAssociation.h b/include/edm4hep/MCRecoTrackerAssociation.h deleted file mode 100644 index 7f0146155..000000000 --- a/include/edm4hep/MCRecoTrackerAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MCRecoTrackerAssociation_H -#define EDM4HEP_MCRecoTrackerAssociation_H - -#include "edm4hep/TrackerHitSimTrackerHitLink.h" - -namespace edm4hep { -using MCRecoTrackerAssociation [[deprecated("use TrackerHitSimTrackerHitLink instead")]] = - edm4hep::TrackerHitSimTrackerHitLink; -} - -#endif diff --git a/include/edm4hep/MCRecoTrackerAssociationCollection.h b/include/edm4hep/MCRecoTrackerAssociationCollection.h deleted file mode 100644 index c7326abb2..000000000 --- a/include/edm4hep/MCRecoTrackerAssociationCollection.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_MCRecoTrackerAssociationCollection_H -#define EDM4HEP_MCRecoTrackerAssociationCollection_H - -#include "edm4hep/MCRecoTrackerAssociation.h" -#include "edm4hep/MutableMCRecoTrackerAssociation.h" -#include "edm4hep/TrackerHitSimTrackerHitLinkCollection.h" - -namespace edm4hep { -using MCRecoTrackerAssociationCollection [[deprecated("use TrackerHitSimTrackerHitLinkCollection instead")]] = - edm4hep::TrackerHitSimTrackerHitLinkCollection; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoCaloAssociation.h b/include/edm4hep/MutableMCRecoCaloAssociation.h deleted file mode 100644 index 36733bab0..000000000 --- a/include/edm4hep/MutableMCRecoCaloAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoCaloAssociation_H -#define EDM4HEP_MutableMCRecoCaloAssociation_H - -#include "edm4hep/CaloHitSimCaloHitLink.h" - -namespace edm4hep { -using MutableMCRecoCaloAssociation [[deprecated("use MutableCaloHitSimCaloHitLink instead")]] = - edm4hep::MutableCaloHitSimCaloHitLink; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoCaloParticleAssociation.h b/include/edm4hep/MutableMCRecoCaloParticleAssociation.h deleted file mode 100644 index 9d92223bd..000000000 --- a/include/edm4hep/MutableMCRecoCaloParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoCaloParticleAssociation_H -#define EDM4HEP_MutableMCRecoCaloParticleAssociation_H - -#include "edm4hep/CaloHitMCParticleLink.h" - -namespace edm4hep { -using MutableMCRecoCaloParticleAssociation [[deprecated("use MutableCaloHitMCParticleLink instead")]] = - edm4hep::MutableCaloHitMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoClusterParticleAssociation.h b/include/edm4hep/MutableMCRecoClusterParticleAssociation.h deleted file mode 100644 index 12c9c9823..000000000 --- a/include/edm4hep/MutableMCRecoClusterParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoClusterParticleAssociation_H -#define EDM4HEP_MutableMCRecoClusterParticleAssociation_H - -#include "edm4hep/ClusterMCParticleLink.h" - -namespace edm4hep { -using MutableMCRecoClusterParticleAssociation [[deprecated("use MutableClusterMCParticleLink instead")]] = - edm4hep::MutableClusterMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoParticleAssociation.h b/include/edm4hep/MutableMCRecoParticleAssociation.h deleted file mode 100644 index 0231fdfa3..000000000 --- a/include/edm4hep/MutableMCRecoParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoParticleAssociation_H -#define EDM4HEP_MutableMCRecoParticleAssociation_H - -#include "edm4hep/RecoMCParticleLink.h" - -namespace edm4hep { -using MutableMCRecoParticleAssociation [[deprecated("use MutableRecoMCParticleLink instead")]] = - edm4hep::MutableRecoMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoTrackParticleAssociation.h b/include/edm4hep/MutableMCRecoTrackParticleAssociation.h deleted file mode 100644 index f40377894..000000000 --- a/include/edm4hep/MutableMCRecoTrackParticleAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoTrackParticleAssociation_H -#define EDM4HEP_MutableMCRecoTrackParticleAssociation_H - -#include "edm4hep/TrackMCParticleLink.h" - -namespace edm4hep { -using MutableMCRecoTrackParticleAssociation [[deprecated("use MutableTrackMCParticleLink instead")]] = - edm4hep::MutableTrackMCParticleLink; -} - -#endif diff --git a/include/edm4hep/MutableMCRecoTrackerAssociation.h b/include/edm4hep/MutableMCRecoTrackerAssociation.h deleted file mode 100644 index fc4b9e5e8..000000000 --- a/include/edm4hep/MutableMCRecoTrackerAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableMCRecoTrackerAssociation_H -#define EDM4HEP_MutableMCRecoTrackerAssociation_H - -#include "edm4hep/TrackerHitSimTrackerHitLink.h" - -namespace edm4hep { -using MutableMCRecoTrackerAssociation [[deprecated("use MutableTrackerHitSimTrackerHitLink instead")]] = - edm4hep::MutableTrackerHitSimTrackerHitLink; -} - -#endif diff --git a/include/edm4hep/MutableRecoParticleVertexAssociation.h b/include/edm4hep/MutableRecoParticleVertexAssociation.h deleted file mode 100644 index 33aefaade..000000000 --- a/include/edm4hep/MutableRecoParticleVertexAssociation.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_MutableRecoParticleVertexAssociation_H -#define EDM4HEP_MutableRecoParticleVertexAssociation_H - -#include "edm4hep/VertexRecoParticleLink.h" - -namespace edm4hep { -using MutableRecoParticleVertexAssociation [[deprecated("use MutableVertexRecoParticleLink instead")]] = - edm4hep::MutableVertexRecoParticleLink; -} - -#endif diff --git a/include/edm4hep/RecoParticleVertexAssociation.h b/include/edm4hep/RecoParticleVertexAssociation.h deleted file mode 100644 index 9e9c2ab91..000000000 --- a/include/edm4hep/RecoParticleVertexAssociation.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef EDM4HEP_RecoParticleVertexAssociation_H -#define EDM4HEP_RecoParticleVertexAssociation_H - -#include "edm4hep/MutableRecoParticleVertexAssociation.h" -#include "edm4hep/RecoParticleVertexAssociation.h" -#include "edm4hep/VertexRecoParticleLink.h" - -namespace edm4hep { -using RecoParticleVertexAssociation [[deprecated("use VertexRecoParticleLink instead")]] = - edm4hep::VertexRecoParticleLink; -} - -#endif diff --git a/include/edm4hep/RecoParticleVertexAssociationCollection.h b/include/edm4hep/RecoParticleVertexAssociationCollection.h deleted file mode 100644 index 98ef50efc..000000000 --- a/include/edm4hep/RecoParticleVertexAssociationCollection.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EDM4HEP_RecoParticleVertexAssociationCollection_H -#define EDM4HEP_RecoParticleVertexAssociationCollection_H - -#include "edm4hep/VertexRecoParticleLinkCollection.h" - -namespace edm4hep { -using RecoParticleVertexAssociationCollection [[deprecated("use VertexRecoParticleLinkCollection instead")]] = - edm4hep::VertexRecoParticleLinkCollection; -} - -#endif diff --git a/python/edm4hep/__init__.py b/python/edm4hep/__init__.py index 8880cdf59..30bb908ad 100644 --- a/python/edm4hep/__init__.py +++ b/python/edm4hep/__init__.py @@ -24,6 +24,11 @@ res = ROOT.gInterpreter.LoadFile("edm4hep/Constants.h") if res != 0: raise RuntimeError("Failed to load Constants.h") + +res = ROOT.gSystem.Load("libedm4hepOldSchemas") +if res != 0: + raise RuntimeError("Failed to load edm4hep legacy schemas library") + from ROOT import edm4hep # noqa: E402 from podio.pythonizations import load_pythonizations # noqa: E402 diff --git a/tools/include/edm4hep2json.hxx b/tools/include/edm4hep2json.hxx index 799e839fc..9fc29d2c6 100644 --- a/tools/include/edm4hep2json.hxx +++ b/tools/include/edm4hep2json.hxx @@ -106,19 +106,19 @@ nlohmann::json processEvent(const podio::Frame& frame, std::vector& insertIntoJson(jsonDict, coll, collList[i]); } // Associations - else if (coll->getTypeName() == "edm4hep::RecoMCParticleLinkCollection") { + else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::CaloHitSimCaloHitLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::TrackerHitSimTrackerHitLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::CaloHitMCParticleLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::ClusterMCParticleLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::TrackMCParticleLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::VertexRecoParticleLinkCollection") { + } else if (coll->getTypeName() == "podio::LinkCollection") { insertIntoJson(jsonDict, coll, collList[i]); } // Podio user data