Skip to content

Commit

Permalink
Make sure to only read and register collections once
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Nov 17, 2023
1 parent cf71277 commit 1570384
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions k4FWCore/include/k4FWCore/PodioDataSvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class PodioDataSvc : public DataSvc {
const std::string_view getCollectionType(const std::string& collName);

template <typename T> StatusCode readCollection(const std::string& collName) {
DataObject* objectPtr = nullptr;
if (DataSvc::findObject("/Event", "/" + collName, objectPtr)) {
debug() << "Collection " << collName << " already read, not reading it again" << endmsg;
return StatusCode::SUCCESS;
}
const T* collection(nullptr);
collection = static_cast<const T*>(m_eventframe.get(collName));
if (collection == nullptr) {
Expand Down

0 comments on commit 1570384

Please sign in to comment.