diff --git a/src/services/io/podio/JEventSourcePODIO.cc b/src/services/io/podio/JEventSourcePODIO.cc index ee4351a6fc..8a93d39bc8 100644 --- a/src/services/io/podio/JEventSourcePODIO.cc +++ b/src/services/io/podio/JEventSourcePODIO.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -199,12 +200,17 @@ void JEventSourcePODIO::GetEvent(std::shared_ptr _event) { auto frame_data = m_reader.readEntry("events", Nevents_read); auto frame = std::make_unique(std::move(frame_data)); - const auto& event_headers = frame->get("EventHeader"); // TODO: What is the collection name? - if (event_headers.size() != 1) { - throw JException("Bad event headers: Entry %d contains %d items, but 1 expected.", Nevents_read, event_headers.size()); + if(m_use_event_headers){ + const auto& event_headers = frame->get("EventHeader"); + if (event_headers.size() != 1) { + LOG_WARN(default_cerr_logger) << "Missing or bad event headers: Entry " << Nevents_read << " contains " << event_headers.size() << " items, but 1 expected. Will not use event and run numbers from header" << LOG_END; + m_use_event_headers = false; + } + else { + event.SetEventNumber(event_headers[0].getEventNumber()); + event.SetRunNumber(event_headers[0].getRunNumber()); + } } - event.SetEventNumber(event_headers[0].getEventNumber()); - event.SetRunNumber(event_headers[0].getRunNumber()); // Insert contents odf frame into JFactories VisitPodioCollection visit; diff --git a/src/services/io/podio/JEventSourcePODIO.h b/src/services/io/podio/JEventSourcePODIO.h index 6c81ede7fb..eef243d012 100644 --- a/src/services/io/podio/JEventSourcePODIO.h +++ b/src/services/io/podio/JEventSourcePODIO.h @@ -15,8 +15,6 @@ #include #endif #include -#include -#include #include #if ((JANA_VERSION_MAJOR == 2) && (JANA_VERSION_MINOR >= 3)) || (JANA_VERSION_MAJOR > 2) @@ -56,11 +54,8 @@ class JEventSourcePODIO : public JEventSource { size_t Nevents_in_file = 0; size_t Nevents_read = 0; - std::string m_include_collections_str; - std::string m_exclude_collections_str; - std::set m_INPUT_INCLUDE_COLLECTIONS; - std::set m_INPUT_EXCLUDE_COLLECTIONS; bool m_run_forever=false; + bool m_use_event_headers=true; };