diff --git a/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h b/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h index 86caa1cd..a2002fcf 100644 --- a/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h +++ b/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h @@ -64,89 +64,89 @@ namespace edm4hep { namespace EDM4hep2LCIOConv { template - using TypeMapT = k4EDM4hep2LcioConv::MapT; + using ObjectMapT = k4EDM4hep2LcioConv::MapT; struct CollectionsPairVectors { - TypeMapT tracks {}; - TypeMapT trackerhits {}; - TypeMapT simtrackerhits {}; - TypeMapT calohits {}; - TypeMapT rawcalohits {}; - TypeMapT simcalohits {}; - TypeMapT tpchits {}; - TypeMapT clusters {}; - TypeMapT vertices {}; - TypeMapT recoparticles {}; - TypeMapT mcparticles {}; + ObjectMapT tracks {}; + ObjectMapT trackerhits {}; + ObjectMapT simtrackerhits {}; + ObjectMapT calohits {}; + ObjectMapT rawcalohits {}; + ObjectMapT simcalohits {}; + ObjectMapT tpchits {}; + ObjectMapT clusters {}; + ObjectMapT vertices {}; + ObjectMapT recoparticles {}; + ObjectMapT mcparticles {}; }; template< - typename TrackMapT = TypeMapT, - typename TrackerHitMapT = TypeMapT> + typename TrackMapT = ObjectMapT, + typename TrackerHitMapT = ObjectMapT> lcio::LCCollectionVec* convTracks( const edm4hep::TrackCollection* const tracks_coll, TrackMapT& tracks_vec, const TrackerHitMapT& trackerhits_vec); - template> + template> lcio::LCCollectionVec* convTrackerHits( const edm4hep::TrackerHitCollection* const trackerhits_coll, const std::string cellIDstr, TrackerHitMapT& trackerhits_vec); template< - typename SimTrHitMapT = TypeMapT, - typename MCParticleMapT = TypeMapT> + typename SimTrHitMapT = ObjectMapT, + typename MCParticleMapT = ObjectMapT> lcio::LCCollectionVec* convSimTrackerHits( const edm4hep::SimTrackerHitCollection* const simtrackerhits_coll, const std::string cellIDstr, SimTrHitMapT& simtrackerhits_vec, const MCParticleMapT& mcparticles_vec); - template> + template> lcio::LCCollectionVec* convCalorimeterHits( const edm4hep::CalorimeterHitCollection* const calohit_coll, const std::string cellIDstr, CaloHitMapT& calo_hits_vec); - template> + template> lcio::LCCollectionVec* convRawCalorimeterHits( const edm4hep::RawCalorimeterHitCollection* const rawcalohit_coll, RawCaloHitMapT& raw_calo_hits_vec); - template> + template> lcio::LCCollectionVec* convSimCalorimeterHits( const edm4hep::SimCalorimeterHitCollection* const simcalohit_coll, const std::string cellIDstr, SimCaloHitMapT& sim_calo_hits_vec, const MCParticleMapT& mcparticles); - template> + template> lcio::LCCollectionVec* convTPCHits( const edm4hep::RawTimeSeriesCollection* const tpchit_coll, TPCHitMapT& tpc_hits_vec); template< - typename ClusterMapT = TypeMapT, - typename CaloHitMapT = TypeMapT> + typename ClusterMapT = ObjectMapT, + typename CaloHitMapT = ObjectMapT> lcio::LCCollectionVec* convClusters( const edm4hep::ClusterCollection* const cluster_coll, ClusterMapT& cluster_vec, const CaloHitMapT& calohits_vec); template< - typename VertexMapT = TypeMapT, - typename RecoPartMapT = TypeMapT> + typename VertexMapT = ObjectMapT, + typename RecoPartMapT = ObjectMapT> lcio::LCCollectionVec* convVertices( const edm4hep::VertexCollection* const vertex_coll, VertexMapT& vertex_vec, const RecoPartMapT& recoparticles_vec); template< - typename RecoPartMapT = TypeMapT, - typename TrackMapT = TypeMapT, - typename VertexMapT = TypeMapT, - typename ClusterMapT = TypeMapT> + typename RecoPartMapT = ObjectMapT, + typename TrackMapT = ObjectMapT, + typename VertexMapT = ObjectMapT, + typename ClusterMapT = ObjectMapT> lcio::LCCollectionVec* convReconstructedParticles( const edm4hep::ReconstructedParticleCollection* const recos_coll, RecoPartMapT& recoparticles_vec, @@ -154,13 +154,14 @@ namespace EDM4hep2LCIOConv { const VertexMapT& vertex_vec, const ClusterMapT& clusters_vec); - template> + template> lcio::LCCollectionVec* convMCParticles( const edm4hep::MCParticleCollection* const mcparticle_coll, MCPartMapT& mc_particles_vec); void convEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event); + template void FillMissingCollections(ObjectMappingT& collection_pairs); bool collectionExist(const std::string& collection_name, const lcio::LCEventImpl* lcio_event); diff --git a/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4Lcio2EDM4hepConv.h b/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4Lcio2EDM4hepConv.h index 6df90c7b..cb5775bf 100644 --- a/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4Lcio2EDM4hepConv.h +++ b/k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4Lcio2EDM4hepConv.h @@ -63,26 +63,26 @@ namespace LCIO2EDM4hepConv { template - using TypeMapT = k4EDM4hep2LcioConv::MapT; + using ObjectMapT = k4EDM4hep2LcioConv::MapT; /** * Maping holding all the original and converted objects in a 1:1 mapping in a * way that makes the lookup from LCIO to EDM4hep easy. */ struct LcioEdmTypeMapping { - TypeMapT tracks {}; - TypeMapT trackerHits {}; - TypeMapT simTrackerHits {}; - TypeMapT caloHits {}; - TypeMapT rawCaloHits {}; - TypeMapT simCaloHits {}; - TypeMapT tpcHits {}; - TypeMapT clusters {}; - TypeMapT vertices {}; - TypeMapT recoParticles {}; - TypeMapT mcParticles {}; - TypeMapT trackerHitPlanes {}; - TypeMapT particleIDs {}; + ObjectMapT tracks {}; + ObjectMapT trackerHits {}; + ObjectMapT simTrackerHits {}; + ObjectMapT caloHits {}; + ObjectMapT rawCaloHits {}; + ObjectMapT simCaloHits {}; + ObjectMapT tpcHits {}; + ObjectMapT clusters {}; + ObjectMapT vertices {}; + ObjectMapT recoParticles {}; + ObjectMapT mcParticles {}; + ObjectMapT trackerHitPlanes {}; + ObjectMapT particleIDs {}; }; using CollNamePair = std::tuple>; @@ -181,7 +181,7 @@ namespace LCIO2EDM4hepConv { * Convert an MCParticle collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertMCParticles(const std::string& name, EVENT::LCCollection* LCCollection, MCParticleMapT& mcparticlesMap); @@ -194,8 +194,8 @@ namespace LCIO2EDM4hepConv { * _particleIDs */ template< - typename RecoMapT = TypeMapT, - typename PIDMapT = TypeMapT> + typename RecoMapT = ObjectMapT, + typename PIDMapT = ObjectMapT> std::vector convertReconstructedParticles( const std::string& name, EVENT::LCCollection* LCCollection, @@ -206,7 +206,7 @@ namespace LCIO2EDM4hepConv { * Convert a Vertex collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertVertices(const std::string& name, EVENT::LCCollection* LCCollection, VertexMapT& vertexMap); @@ -214,7 +214,7 @@ namespace LCIO2EDM4hepConv { * Convert a SimTrackerHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertSimTrackerHits(const std::string& name, EVENT::LCCollection* LCCollection, SimTrHitMapT& SimTrHitMap); @@ -222,7 +222,7 @@ namespace LCIO2EDM4hepConv { * Convert a TPCHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertTPCHits(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& TPCHitMap); @@ -230,7 +230,7 @@ namespace LCIO2EDM4hepConv { * Convert a TrackerHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertTrackerHits(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& TrackerHitMap); @@ -238,7 +238,7 @@ namespace LCIO2EDM4hepConv { * Convert a TrackerHitPlane collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertTrackerHitPlanes(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& TrackerHitPlaneMap); @@ -246,7 +246,7 @@ namespace LCIO2EDM4hepConv { * Convert a Track collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertTracks(const std::string& name, EVENT::LCCollection* LCCollection, TrackMapT& TrackMap); @@ -254,7 +254,7 @@ namespace LCIO2EDM4hepConv { * Convert a SimCalorimeterHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertSimCalorimeterHits(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& SimCaloHitMap); @@ -262,7 +262,7 @@ namespace LCIO2EDM4hepConv { * Convert a RawCalorimeterHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertRawCalorimeterHits(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& rawCaloHitMap); @@ -270,7 +270,7 @@ namespace LCIO2EDM4hepConv { * Convert a CalorimeterHit collection and return the resulting collection. * Simultaneously populates the mapping from LCIO to EDM4hep objects. */ - template> + template> std::unique_ptr convertCalorimeterHits(const std::string& name, EVENT::LCCollection* LCCollection, HitMapT& caloHitMap); @@ -283,8 +283,8 @@ namespace LCIO2EDM4hepConv { * _particleIDs */ template< - typename ClusterMapT = TypeMapT, - typename PIDMapT = TypeMapT> + typename ClusterMapT = ObjectMapT, + typename PIDMapT = ObjectMapT> std::vector convertClusters( const std::string& name, EVENT::LCCollection* LCCollection, @@ -391,8 +391,8 @@ namespace LCIO2EDM4hepConv { * The contributions are also attached to their corresponding SimCalorimeterHits. */ template< - typename HitMapT = TypeMapT, - typename MCParticleMapT = TypeMapT> + typename HitMapT = ObjectMapT, + typename MCParticleMapT = ObjectMapT> std::unique_ptr createCaloHitContributions( HitMapT& SimCaloHitMap, const MCParticleMapT& mcparticlesMap); @@ -400,25 +400,25 @@ namespace LCIO2EDM4hepConv { /** * Resolve the relations for the MCParticles. */ - template> + template> void resolveRelationsMCParticles(MCParticleMapT& mcparticlesMap); /** * Resolve the relations for SimTrackerHits */ template< - typename HitMapT = TypeMapT, - typename MCParticleMapT = TypeMapT> + typename HitMapT = ObjectMapT, + typename MCParticleMapT = ObjectMapT> void resolveRelationsSimTrackerHits(HitMapT& SimTrHitMap, const MCParticleMapT& mcparticlesMap); /** * Resolve the relations for ReconstructedParticles */ template< - typename RecoParticleMapT = TypeMapT, - typename VertexMapT = TypeMapT, - typename ClusterMapT = TypeMapT, - typename TrackMapT = TypeMapT> + typename RecoParticleMapT = ObjectMapT, + typename VertexMapT = ObjectMapT, + typename ClusterMapT = ObjectMapT, + typename TrackMapT = ObjectMapT> void resolveRelationsRecoParticles( RecoParticleMapT& recoparticlesMap, const VertexMapT& vertexMap, @@ -429,18 +429,18 @@ namespace LCIO2EDM4hepConv { * Resolve the relations for Clusters */ template< - typename ClusterMapT = TypeMapT, - typename CaloHitMapT = TypeMapT> + typename ClusterMapT = ObjectMapT, + typename CaloHitMapT = ObjectMapT> void resolveRelationsClusters(ClusterMapT& clustersMap, const CaloHitMapT& caloHitMap); /** * Resolve the relations for Tracks */ template< - typename TrackMapT = TypeMapT, - typename TrackHitMapT = TypeMapT, - typename TPCHitMapT = TypeMapT, - typename THPlaneHitMapT = TypeMapT> + typename TrackMapT = ObjectMapT, + typename TrackHitMapT = ObjectMapT, + typename TPCHitMapT = ObjectMapT, + typename THPlaneHitMapT = ObjectMapT> void resolveRelationsTracks( TrackMapT& tracksMap, const TrackHitMapT& trackerHitMap, @@ -451,8 +451,8 @@ namespace LCIO2EDM4hepConv { * Resolve the relations for Vertices */ template< - typename VertexMapT = TypeMapT, - typename RecoParticleMapT = TypeMapT> + typename VertexMapT = ObjectMapT, + typename RecoParticleMapT = ObjectMapT> void resolveRelationsVertices(VertexMapT& vertexMap, const RecoParticleMapT& recoparticleMap); template