Skip to content

Commit

Permalink
Enable CLI override for reading all collections
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Nov 21, 2023
1 parent bdea92f commit 9e4fde6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions k4FWCore/components/PodioInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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->getEventFrame().get(edm4hep::EventHeaderName)) {
m_readers[edm4hep::EventHeaderCollection::typeName](edm4hep::EventHeaderName);
Expand Down
2 changes: 2 additions & 0 deletions k4FWCore/components/PodioInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class PodioInput final : public Gaudi::Functional::Consumer<void(), BaseClass_t>
PodioInput(const std::string& name, ISvcLocator* svcLoc);
void operator()() const override;

StatusCode initialize() final;

private:
template <typename T> void maybeRead(std::string_view collName) const;
void fillReaders();
Expand Down
1 change: 1 addition & 0 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9e4fde6

Please sign in to comment.