Skip to content

Commit

Permalink
Remove deprecated functions (#91)
Browse files Browse the repository at this point in the history
* Remove deprecated conversion functions

* Remove deprecated functions for link creation

* Purge mentions of associations from variable names and documentation
  • Loading branch information
tmadlener authored Sep 9, 2024
1 parent 5cd9a07 commit acbcac3
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 297 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ auto* lcio_converted_sim_tracker_hit_ptr = convSimTrackerHits(
collection_pairs.simtrackerhits,
collection_pairs.mcparticles);

// Run function to fix missing associations between collections.
// Run function to fix missing links between collections.
// Some collections that need to be linked to other collections may be converted
// after these are linked. Running this function after all conversions guarantees correct links
// between collections.
Expand Down
2 changes: 1 addition & 1 deletion doc/LCIO2EDM4hep.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ handles all the type details and can obviously also be used directly.
available in EDM4hep. They use the `"FromType"` and `"ToType"` collection
parameters to get the necessary type information.

The AssociationCollections in EDM4hep are then created using `createAssociations`.
The LinkCollections in EDM4hep are then created using `createLinks`.

## Converting entire events
Converting an entire event can be done calling the `convertEvent`. This can also
Expand Down
127 changes: 7 additions & 120 deletions k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ namespace EDM4hep2LCIOConv {
template <typename T1, typename T2>
using ObjectMapT = k4EDM4hep2LcioConv::VecMapT<T1, T2>;

template <typename T1, typename T2>
using vec_pair [[deprecated("Use a more descriptive alias")]] = ObjectMapT<T1, T2>;

using CellIDStrType = const std::optional<std::string>;

struct CollectionsPairVectors {
Expand Down Expand Up @@ -144,12 +141,6 @@ template <typename TrackMapT>
std::unique_ptr<lcio::LCCollectionVec> convertTracks(const edm4hep::TrackCollection* const edmCollection,
TrackMapT& trackMap);

template <typename TrackMapT, typename TrackerHitMapT>
[[deprecated("Use convertTracks instead")]] lcio::LCCollectionVec*
convTracks(const edm4hep::TrackCollection* const tracks_coll, TrackMapT& tracks_vec, const TrackerHitMapT&) {
return convertTracks(tracks_coll, tracks_vec).release();
}

/**
* Convert EDM4hep TrackerHits to LCIO. Simultaneously populate mapping from
* EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -159,13 +150,6 @@ std::unique_ptr<lcio::LCCollectionVec> convertTrackerHits(const edm4hep::Tracker
const CellIDStrType& cellIDStr,
TrackerHitMapT& trackerHitMap);

template <typename TrackerHitMapT>
[[deprecated("Use convertTrackerHits instead")]] lcio::LCCollectionVec*
convTrackerHits(const edm4hep::TrackerHit3DCollection* const trackerhits_coll, const CellIDStrType& cellIDstr,
TrackerHitMapT& trackerhits_vec) {
return convertTrackerHits(trackerhits_coll, cellIDstr, trackerhits_vec).release();
}

/**
* Convert EDM4hep TrackerHitPlanes to LCIO. Simultaneously populate mapping
* from EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -175,13 +159,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertTrackerHitPlanes(const edm4hep::TrackerHitPlaneCollection* const edmCollection, const CellIDStrType& cellIDstr,
TrackerHitPlaneMapT& trackerHitsMap);

template <typename TrackerHitPlaneMapT>
[[deprecated("Use convertTrackerHitPlanes instead")]] lcio::LCCollectionVec*
convTrackerHitPlanes(const edm4hep::TrackerHitPlaneCollection* const trackerhits_coll, const CellIDStrType& cellIDstr,
TrackerHitPlaneMapT& trackerhits_vec) {
return convertTrackerHitPlanes(trackerhits_coll, cellIDstr, trackerhits_vec).release();
}

/**
* Convert EDM4hep SimTrackerHits to LCIO. Simultaneously populate mapping
* from EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -191,13 +168,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertSimTrackerHits(const edm4hep::SimTrackerHitCollection* const edmCollection, const CellIDStrType& cellIDstr,
SimTrHitMapT& simTrHitMap);

template <typename SimTrHitMapT, typename MCParticleMapT>
[[deprecated("Use convertSimTrackerHits instead")]] lcio::LCCollectionVec*
convSimTrackerHits(const edm4hep::SimTrackerHitCollection* const simtrackerhits_coll, const CellIDStrType& cellIDstr,
SimTrHitMapT& simtrackerhits_vec, const MCParticleMapT&) {
return convertSimTrackerHits(simtrackerhits_coll, cellIDstr, simtrackerhits_vec).release();
}

/**
* Convert EDM4hep CalorimeterHits to LCIO. Simultaneously populate mapping
* from EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -207,13 +177,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertCalorimeterHits(const edm4hep::CalorimeterHitCollection* const edmCollection, const CellIDStrType& cellIDstr,
CaloHitMapT& caloHitMap);

template <typename CaloHitMapT>
[[deprecated("Use convertCalorimeterHits instead")]] lcio::LCCollectionVec*
convCalorimeterHits(const edm4hep::CalorimeterHitCollection* const calohit_coll, const CellIDStrType& cellIDstr,
CaloHitMapT& calo_hits_vec) {
return convertCalorimeterHits(calohit_coll, cellIDstr, calo_hits_vec).release();
}

/**
* Convert EDM4hep RawCalorimeterHits to LCIO. Simultaneously populate mapping
* from EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -223,13 +186,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertRawCalorimeterHits(const edm4hep::RawCalorimeterHitCollection* const edmCollection,
RawCaloHitMapT& rawCaloHitMap);

template <typename RawCaloHitMapT>
[[deprecated("use convertRawCalorimeterHits instead")]] lcio::LCCollectionVec*
convRawCalorimeterHits(const edm4hep::RawCalorimeterHitCollection* const rawcalohit_coll,
RawCaloHitMapT& raw_calo_hits_vec) {
return convertRawCalorimeterHits(rawcalohit_coll, raw_calo_hits_vec).release();
}

/**
* Convert EDM4hep SimCalorimeterHits to LCIO. Simultaneously populate mapping
* from EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -239,19 +195,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertSimCalorimeterHits(const edm4hep::SimCalorimeterHitCollection* const edmCollection,
const CellIDStrType& cellIDstr, SimCaloHitMapT& simCaloHitMap);

template <typename SimCaloHitMapT>
lcio::LCCollectionVec* convSimCalorimeterHits(const edm4hep::SimCalorimeterHitCollection* const simcalohit_coll,
const CellIDStrType& cellIDstr, SimCaloHitMapT& sim_calo_hits_vec) {
return convertSimCalorimeterHits(simcalohit_coll, cellIDstr, sim_calo_hits_vec).release();
}

template <typename SimCaloHitMapT, typename MCParticleMapT>
[[deprecated("remove MCParticleMap argument since it is unused")]] lcio::LCCollectionVec*
convSimCalorimeterHits(const edm4hep::SimCalorimeterHitCollection* const simcalohit_coll,
const CellIDStrType& cellIDstr, SimCaloHitMapT& sim_calo_hits_vec, const MCParticleMapT&) {
return convSimCalorimeterHits(simcalohit_coll, cellIDstr, sim_calo_hits_vec);
}

/**
* Convert EDM4hep TPC Hits to LCIO. Simultaneously populate mapping from
* EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -260,12 +203,6 @@ template <typename TPCHitMapT>
std::unique_ptr<lcio::LCCollectionVec> convertTPCHits(const edm4hep::RawTimeSeriesCollection* const edmCollection,
TPCHitMapT& tpcHitMap);

template <typename TPCHitMapT>
[[deprecated("Use convertTPCHits instead")]] lcio::LCCollectionVec*
convTPCHits(const edm4hep::RawTimeSeriesCollection* const tpchit_coll, TPCHitMapT& tpc_hits_vec) {
return convertTPCHits(tpchit_coll, tpc_hits_vec).release();
}

/**
* Convert EDM4hep Clusters to LCIO. Simultaneously populate mapping from
* EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -274,18 +211,6 @@ template <typename ClusterMapT>
std::unique_ptr<lcio::LCCollectionVec> convertClusters(const edm4hep::ClusterCollection* const edmCollection,
ClusterMapT& clusterMap);

template <typename ClusterMapT>
[[deprecated("Use convertClusters instead")]] lcio::LCCollectionVec*
convClusters(const edm4hep::ClusterCollection* const cluster_coll, ClusterMapT& cluster_vec) {
return convertClusters(cluster_coll, cluster_vec).release();
}

template <typename ClusterMapT, typename CaloHitMapT>
[[deprecated("remove CaloHitMap argument since it is unused")]] lcio::LCCollectionVec*
convClusters(const edm4hep::ClusterCollection* const cluster_coll, ClusterMapT& cluster_vec, const CaloHitMapT&) {
return convClusters(cluster_coll, cluster_vec);
}

/**
* Convert EDM4hep Vertices to LCIO. Simultaneously populate mapping from
* EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -294,12 +219,6 @@ template <typename VertexMapT>
std::unique_ptr<lcio::LCCollectionVec> convertVertices(const edm4hep::VertexCollection* const edmCollection,
VertexMapT& vertexMap);

template <typename VertexMapT, typename RecoPartMapT>
[[deprecated("Use convertVertices instead")]] lcio::LCCollectionVec*
convVertices(const edm4hep::VertexCollection* const vertex_coll, VertexMapT& vertex_vec, const RecoPartMapT&) {
return convertVertices(vertex_coll, vertex_vec).release();
}

/**
* Convert EDM4hep ReconstructedParticles to LCIO. Simultaneously populate
* mapping from EDM4hep to LCIO objects for relation resolving in a second
Expand All @@ -310,13 +229,6 @@ std::unique_ptr<lcio::LCCollectionVec>
convertReconstructedParticles(const edm4hep::ReconstructedParticleCollection* const edmCollection,
RecoParticleMapT& recoParticleMap);

template <typename RecoPartMapT, typename TrackMapT, typename VertexMapT, typename ClusterMapT>
[[deprecated("Use convertReconstructedParticle instead")]] lcio::LCCollectionVec*
convReconstructedParticles(const edm4hep::ReconstructedParticleCollection* const recos_coll,
RecoPartMapT& recoparticles_vec, const TrackMapT&, const VertexMapT&, const ClusterMapT&) {
return convertReconstructedParticles(recos_coll, recoparticles_vec).release();
}

/**
* Convert EDM4hep MCParticles to LCIO. Simultaneously populate mapping from
* EDM4hep to LCIO objects for relation resolving in a second step.
Expand All @@ -325,12 +237,6 @@ template <typename MCPartMapT>
std::unique_ptr<lcio::LCCollectionVec> convertMCParticles(const edm4hep::MCParticleCollection* const edmCollection,
MCPartMapT& mcParticleMap);

template <typename MCPartMapT>
[[deprecated("Use convertMCParticles")]] lcio::LCCollectionVec*
convMCParticles(const edm4hep::MCParticleCollection* const mcparticle_coll, MCPartMapT& mc_particles_vec) {
return convertMCParticles(mcparticle_coll, mc_particles_vec).release();
}

/**
* Convert EDM4hep ParticleIDs to LCIO. NOTE: Since ParticleIDs cannot live in
* their own collections in LCIO this simply populates the pidMap that maps
Expand All @@ -347,9 +253,6 @@ void convertParticleIDs(const edm4hep::ParticleIDCollection* const edmCollection
*/
void convertEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event);

[[deprecated("Use convertEventheader instead")]] void
convEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event);

/**
* Resolve the relations for MCParticles
*/
Expand Down Expand Up @@ -429,31 +332,20 @@ template <typename ObjectMappingT, typename ObjectMappingU>
void resolveRelations(ObjectMappingT& updateMaps, const ObjectMappingU& lookupMaps);

/**
* Convert the passed associatoin collections to LCRelation collections
* Convert the passed link collections to LCRelation collections
*/
template <typename ObjectMappingT>
std::vector<std::tuple<std::string, std::unique_ptr<lcio::LCCollection>>> createLCRelationCollections(
const std::vector<std::tuple<std::string, const podio::CollectionBase*>>& associationCollections,
const ObjectMappingT& objectMaps);
std::vector<std::tuple<std::string, std::unique_ptr<lcio::LCCollection>>>
createLCRelationCollections(const std::vector<std::tuple<std::string, const podio::CollectionBase*>>& linkCollections,
const ObjectMappingT& objectMaps);

/**
* Create an LCRelation collection from the passed Association Collection
* Create an LCRelation collection from the passed Link Collection
*/
template <typename AssocCollT, typename FromMapT, typename ToMapT>
std::unique_ptr<lcio::LCCollection> createLCRelationCollection(const AssocCollT& associations, const FromMapT& fromMap,
template <typename LinkCollT, typename FromMapT, typename ToMapT>
std::unique_ptr<lcio::LCCollection> createLCRelationCollection(const LinkCollT& links, const FromMapT& fromMap,
const ToMapT& toMap);

template <typename ObjectMappingT>
[[deprecated("Use resolveRelations instead")]] void FillMissingCollections(ObjectMappingT& update_pairs) {
resolveRelations(update_pairs);
}

template <typename ObjectMappingT, typename ObjectMappingU>
[[deprecated("Use resolveRelations instead")]] void FillMissingCollections(ObjectMappingT& update_pairs,
const ObjectMappingU& lookup_pairs) {
resolveRelations(update_pairs, lookup_pairs);
}

bool collectionExist(const std::string& collection_name, const lcio::LCEventImpl* lcio_event);

/**
Expand All @@ -462,11 +354,6 @@ bool collectionExist(const std::string& collection_name, const lcio::LCEventImpl
std::unique_ptr<lcio::LCEventImpl> convertEvent(const podio::Frame& edmEvent,
const podio::Frame& metadata = podio::Frame{});

[[deprecated("Use convertEvent")]] std::unique_ptr<lcio::LCEventImpl>
convEvent(const podio::Frame& edmEvent, const podio::Frame& metadata = podio::Frame{}) {
return convertEvent(edmEvent, metadata);
}

/**
* Get the radius of the TrackState at the first from the given track. This is
* used to set the radiusOfInnermostHit in the LCIO track during the conversion
Expand Down
Loading

0 comments on commit acbcac3

Please sign in to comment.