diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index 5288a95e..d1b619e0 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -186,6 +186,17 @@ PodioInput::PodioInput(const std::string& name, ISvcLocator* svcLoc) : Consumer( fillReaders(); } +StatusCode PodioInput::initialize() { + // If someone uses the collections property from the command line and passes + // an empty string we assume they want all collections (as a simple way to + // override whatever is in the options file) + if (m_collectionNames.size() == 1 && m_collectionNames[0].empty()) { + m_collectionNames.clear(); + } + + return StatusCode::SUCCESS; +} + void PodioInput::operator()() const { if (m_podioDataSvc->hasCollection(edm4hep::EventHeaderName)) { m_readers[edm4hep::EventHeaderCollection::typeName](edm4hep::EventHeaderName); diff --git a/k4FWCore/components/PodioInput.h b/k4FWCore/components/PodioInput.h index 978d821e..a8c4a59f 100644 --- a/k4FWCore/components/PodioInput.h +++ b/k4FWCore/components/PodioInput.h @@ -42,6 +42,8 @@ class PodioInput final : public Gaudi::Functional::Consumer PodioInput(const std::string& name, ISvcLocator* svcLoc); void operator()() const override; + StatusCode initialize() final; + private: template void maybeRead(std::string_view collName) const; void fillReaders(); diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index 8343d4f2..38ed4283 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -60,6 +60,7 @@ endfunction() add_test_with_env(CreateExampleEventData options/createExampleEventData.py) add_test_with_env(CheckExampleEventData options/checkExampleEventData.py PROPERTIES DEPENDS CreateExampleEventData) +add_test_with_env(CheckExampleEventData_noCollections options/checkExampleEventData.py --PodioInput.collections= PROPERTIES DEPENDS CreateExampleEventData) add_test_with_env(CheckExampleEventData_toolong -n 999 options/checkExampleEventData.py PROPERTIES PASS_REGULAR_EXPRESSION "Application Manager Terminated successfully with a user requested ScheduledStop" DEPENDS CreateExampleEventData) add_test_with_env(CheckExampleEventData_unbounded options/checkExampleEventData.py -n 999 PROPERTIES PASS_REGULAR_EXPRESSION