diff --git a/converter/include/k4SimDelphes/DelphesEDM4HepConverter.h b/converter/include/k4SimDelphes/DelphesEDM4HepConverter.h index 612c745d..b0d1e206 100644 --- a/converter/include/k4SimDelphes/DelphesEDM4HepConverter.h +++ b/converter/include/k4SimDelphes/DelphesEDM4HepConverter.h @@ -5,8 +5,8 @@ #include "podio/CollectionBase.h" // edm4hep -#include "edm4hep/MCParticleConst.h" -#include "edm4hep/ReconstructedParticle.h" +#include "edm4hep/MCParticle.h" +#include "edm4hep/MutableReconstructedParticle.h" #include "edm4hep/MCRecoParticleAssociationCollection.h" // ROOT @@ -92,7 +92,7 @@ class DelphesEDM4HepConverter { fillReferenceCollection(delphesCollection, branch, "electron"); } -edm4hep::MCRecoParticleAssociationCollection* createExternalRecoAssociations(const std::unordered_map& mc_map); +edm4hep::MCRecoParticleAssociationCollection* createExternalRecoAssociations(const std::unordered_map& mc_map); private: @@ -108,7 +108,7 @@ edm4hep::MCRecoParticleAssociationCollection* createExternalRecoAssociations(con // cannot mark DelphesT as const, because for Candidate* the GetCandidates() // method is not marked as const. template - std::optional getMatchingReco(/*const*/ DelphesT* delphesCand) const; + std::optional getMatchingReco(/*const*/ DelphesT* delphesCand) const; using ProcessFunction = void (DelphesEDM4HepConverter::*)(const TClonesArray*, std::string_view const); @@ -123,10 +123,10 @@ edm4hep::MCRecoParticleAssociationCollection* createExternalRecoAssociations(con std::string m_mcRecoAssocCollName; // map from UniqueIDs (delphes generated particles) to MCParticles - std::unordered_map m_genParticleIds; + std::unordered_map m_genParticleIds; // map from UniqueIDs (delphes generated particles) to (possibly multiple) // ReconstructedParticles - std::unordered_multimap m_recoParticleGenIds; + std::unordered_multimap m_recoParticleGenIds; }; template diff --git a/converter/include/k4SimDelphes/k4GenParticlesDelphesConverter.h b/converter/include/k4SimDelphes/k4GenParticlesDelphesConverter.h index f36f1ce6..707c9876 100644 --- a/converter/include/k4SimDelphes/k4GenParticlesDelphesConverter.h +++ b/converter/include/k4SimDelphes/k4GenParticlesDelphesConverter.h @@ -64,11 +64,11 @@ class k4GenParticlesDelphesConverter { // } - std::unordered_map getGenParticleIdMap() { return m_genParticleIds;} + std::unordered_map getGenParticleIdMap() { return m_genParticleIds;} private: -std::unordered_map m_genParticleIds; +std::unordered_map m_genParticleIds; }; diff --git a/converter/src/DelphesEDM4HepConverter.cc b/converter/src/DelphesEDM4HepConverter.cc index 58391178..d8623a72 100644 --- a/converter/src/DelphesEDM4HepConverter.cc +++ b/converter/src/DelphesEDM4HepConverter.cc @@ -49,10 +49,10 @@ template void sortBranchesProcessingOrder(std::vector& branches, std::array const& processingOrder); -edm4hep::Track convertTrack(Track const* cand, const double magFieldBz); +edm4hep::MutableTrack convertTrack(Track const* cand, const double magFieldBz); void setMotherDaughterRelations(GenParticle const* delphesCand, - edm4hep::MCParticle particle, + edm4hep::MutableMCParticle particle, edm4hep::MCParticleCollection& mcParticles); /** @@ -376,7 +376,7 @@ void DelphesEDM4HepConverter::processScalarHT(const TClonesArray* delphesCollect template -std::optional DelphesEDM4HepConverter::getMatchingReco(DelphesT* delphesCand) const +std::optional DelphesEDM4HepConverter::getMatchingReco(DelphesT* delphesCand) const { // Here we have to do some work to actually match the Delphes candidate to // the correct edm4hep::ReconstructedParticle because the possibility exists @@ -416,7 +416,7 @@ std::optional DelphesEDM4HepConverter::getMatchi return {}; } -edm4hep::MCRecoParticleAssociationCollection* DelphesEDM4HepConverter::createExternalRecoAssociations(const std::unordered_map& mc_map) { +edm4hep::MCRecoParticleAssociationCollection* DelphesEDM4HepConverter::createExternalRecoAssociations(const std::unordered_map& mc_map) { auto mcRecoRelations = new edm4hep::MCRecoParticleAssociationCollection(); for (const auto& particleID: mc_map) { @@ -469,9 +469,9 @@ void sortBranchesProcessingOrder(std::vector& branches, } -edm4hep::Track convertTrack(Track const* cand, const double magFieldBz) +edm4hep::MutableTrack convertTrack(Track const* cand, const double magFieldBz) { - edm4hep::Track track; + edm4hep::MutableTrack track; // Delphes does not really provide any information that would go into the // track itself. But some information can be used to at least partially // populate a TrackState @@ -535,7 +535,7 @@ edm4hep::Track convertTrack(Track const* cand, const double magFieldBz) } void setMotherDaughterRelations(GenParticle const* delphesCand, - edm4hep::MCParticle particle, + edm4hep::MutableMCParticle particle, edm4hep::MCParticleCollection& mcParticles) { // NOTE: it is in general probably not possible to handle all the different diff --git a/tests/src/compare_delphes_converter_outputs.cpp b/tests/src/compare_delphes_converter_outputs.cpp index 56fbfb20..f8a8849e 100644 --- a/tests/src/compare_delphes_converter_outputs.cpp +++ b/tests/src/compare_delphes_converter_outputs.cpp @@ -62,10 +62,10 @@ void assertSameKinematics(const DelphesT* delphesCand, const EDM4HepT& edm4hepCa * Get all MCParticles related to a given ReconstructedParticle * */ -std::vector -getAssociatedMCParticles(edm4hep::ConstReconstructedParticle reco, +std::vector +getAssociatedMCParticles(edm4hep::ReconstructedParticle reco, const edm4hep::MCRecoParticleAssociationCollection& associations) { - std::vector sims; + std::vector sims; // NOTE: looping over the whole collection of associations here is super // inefficient, but as long as there is no utility for this, implementing the // necessary caching is just too much work for this test case here @@ -102,7 +102,7 @@ std::vector getAssociatedMCParticles(const DelphesT* delphesCand) */ template bool compareMCRelations(const DelphesT* delphesCand, - edm4hep::ConstReconstructedParticle edm4hepCand, + edm4hep::ReconstructedParticle edm4hepCand, const edm4hep::MCRecoParticleAssociationCollection& associations) { const auto delphesGenParticles = getAssociatedMCParticles(delphesCand);