Skip to content

Commit

Permalink
Register collections via DataSvc
Browse files Browse the repository at this point in the history
DataHandle is not properly initialized when used this way for some
reason, going through the DataSvc seems to work
  • Loading branch information
tmadlener committed Jun 1, 2023
1 parent 0d2debd commit 456b30a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ void Lcio2EDM4hepTool::registerCollection(
error() << "Could not convert collection " << name << endmsg;
return;
}
DataHandle<podio::CollectionBase> handle{name, Gaudi::DataHandle::Writer, this};
handle.put(e4hColl.release());

auto wrapper = new DataWrapper<podio::CollectionBase>();
wrapper->setData(e4hColl.release());

// No need to check for pre-existing collections, since we only ever end up
// here if that is not the case
auto sc = m_podioDataSvc->registerObject("/Event", "/" + std::string(name), wrapper);
if (sc == StatusCode::FAILURE) {
error() << "Could not register collection " << name << endmsg;
}

auto handle = DataHandle<podio::CollectionBase>{name, Gaudi::DataHandle::Reader, this};

// Convert metadata
if (lcioColl != nullptr) {
Expand Down Expand Up @@ -105,7 +115,10 @@ StatusCode Lcio2EDM4hepTool::convertCollections(lcio::LCEventImpl* the_event) {

for (const auto& [lcioName, edm4hepName] : collsToConvert) {
try {
auto* lcio_coll = the_event->getCollection(lcioName);
auto* lcio_coll = the_event->getCollection(lcioName);
if (collectionExist(edm4hepName)) {
continue; // No need to convert again
}
const auto& lcio_coll_type_str = lcio_coll->getTypeName();

// We deal with subset collections and LCRelations once we have all data
Expand Down

0 comments on commit 456b30a

Please sign in to comment.