Skip to content

Commit

Permalink
Rename FillMissingCollections to resolveRelations
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Feb 21, 2024
1 parent bf6e405 commit 22dc7b5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ auto* lcio_converted_sim_tracker_hit_ptr = convSimTrackerHits(
// 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.
FillMissingCollections(collection_pairs);
```
resolveRelations(collection_pairs);
```
25 changes: 21 additions & 4 deletions k4EDM4hep2LcioConv/include/k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,30 @@ namespace EDM4hep2LCIOConv {
template<typename ClusterMapT, typename CaloHitMapT>
void resolveRelationsClusters(ClusterMapT& clustersMap, const CaloHitMapT& caloHitMap);

/**
* Resolve all relations in all converted objects that are held in the map.
* Dispatch to the correpsonding implementation for all the types that have
* relations
*/
template<typename ObjectMappingT>
void resolveRelations(ObjectMappingT& typeMapping);

template<typename ObjectMappingT, typename ObjectMappingU>
void resolveRelations(ObjectMappingT& updateMaps, const ObjectMappingU& lookupMaps);

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

/// Update the relations of the objects in the update_pairs map, by linking
/// them according to the contents of the lookup_pairs map
template<typename ObjectMappingT, typename ObjectMappingU>
void FillMissingCollections(ObjectMappingT& update_pairs, const ObjectMappingU& lookup_pairs);
[[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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ namespace EDM4hep2LCIOConv {
edm_sim_calohit.getPosition()[0], edm_sim_calohit.getPosition()[1], edm_sim_calohit.getPosition()[2]};
lcio_simcalohit->setPosition(positions.data());

// Contributions are converted in FillMissingCollections to make it a higher probability that we have the
// Contributions are converted in resolveRelations to make it a higher probability that we have the
// MCParticles converted

// Save Sim Calorimeter Hits LCIO and EDM4hep collections
Expand Down Expand Up @@ -760,16 +760,16 @@ namespace EDM4hep2LCIOConv {
}

template<typename ObjectMappingT>
void FillMissingCollections(ObjectMappingT& collection_pairs)
void resolveRelations(ObjectMappingT& collection_pairs)
{
FillMissingCollections(collection_pairs, collection_pairs);
resolveRelations(collection_pairs, collection_pairs);
}

// Depending on the order of the collections in the parameters,
// and for the mutual dependencies between some collections,
// go over the possible missing associated collections and fill them.
template<typename ObjectMappingT, typename ObjectMappingU>
void FillMissingCollections(ObjectMappingT& update_pairs, const ObjectMappingU& lookup_pairs)
void resolveRelations(ObjectMappingT& update_pairs, const ObjectMappingU& lookup_pairs)
{
resolveRelationsMCParticles(update_pairs.mcParticles, lookup_pairs.mcParticles);
resolveRelationsTracks(
Expand Down
2 changes: 1 addition & 1 deletion k4EDM4hep2LcioConv/src/k4EDM4hep2LcioConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace EDM4hep2LCIOConv {
}
}

FillMissingCollections(objectMappings);
resolveRelations(objectMappings);

return lcioEvent;
}
Expand Down

0 comments on commit 22dc7b5

Please sign in to comment.