Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conversion of associations to LCRelations
Browse files Browse the repository at this point in the history
tmadlener committed Jul 11, 2024
1 parent af28b7d commit 03ce12d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp
Original file line number Diff line number Diff line change
@@ -373,7 +373,15 @@ StatusCode EDM4hep2LcioTool::convertCollections(lcio::LCEventImpl* lcio_event) {
CollectionPairMappings collection_pairs{};
std::vector<EDM4hep2LCIOConv::ParticleIDConvData> pidCollections{};

std::vector<std::tuple<std::string, const podio::CollectionBase*>> associations{};

for (const auto& [edm4hepName, lcioName] : collsToConvert) {
const auto coll = edmEvent.get(edm4hepName);
if (coll->getTypeName().find("Association") != std::string_view::npos) {
debug() << edm4hepName << " is an association collection, converting it later" << endmsg;
associations.emplace_back(lcioName, coll);
continue;
}
debug() << "Converting collection " << edm4hepName << " (storing it as " << lcioName << ")" << endmsg;
if (!EDM4hep2LCIOConv::collectionExist(lcioName, lcio_event)) {
convertAdd(edm4hepName, lcioName, lcio_event, collection_pairs, pidCollections);
@@ -413,5 +421,10 @@ StatusCode EDM4hep2LcioTool::convertCollections(lcio::LCEventImpl* lcio_event) {

EDM4hep2LCIOConv::resolveRelations(collection_pairs, globalObjMap);

// Now we can convert the assocations and add them to the event
for (auto& [name, coll] : EDM4hep2LCIOConv::createLCRelationCollections(associations, globalObjMap)) {
lcio_event->addCollection(coll.release(), name);
}

return StatusCode::SUCCESS;
}

0 comments on commit 03ce12d

Please sign in to comment.