From 9274d3cb4ec44d08ddbfb486f583dbb9d798b432 Mon Sep 17 00:00:00 2001
From: zoujh <zoujh@ihep.ac.cn>
Date: Wed, 18 Sep 2019 14:46:32 +0800
Subject: [PATCH] fix a bug when EvtMax is more than the event number in files

---
 FWCore/src/PodioDataSvc.cpp           | 2 +-
 FWCore/src/components/LCIODataSvc.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/FWCore/src/PodioDataSvc.cpp b/FWCore/src/PodioDataSvc.cpp
index 77da2e36..ce7d3699 100644
--- a/FWCore/src/PodioDataSvc.cpp
+++ b/FWCore/src/PodioDataSvc.cpp
@@ -67,7 +67,7 @@ void PodioDataSvc::endOfRead() {
   if (m_eventMax != -1) {
     m_provider.clearCaches();
     m_reader.endOfEvent();
-    if (m_eventNum++ > m_eventMax) {
+    if ( ++m_eventNum >= m_eventMax ) {
       info() << "Reached end of file with event " << m_eventMax << endmsg;
       IEventProcessor* eventProcessor;
       service("ApplicationMgr", eventProcessor);
diff --git a/FWCore/src/components/LCIODataSvc.cpp b/FWCore/src/components/LCIODataSvc.cpp
index b5ed5235..f31e1361 100644
--- a/FWCore/src/components/LCIODataSvc.cpp
+++ b/FWCore/src/components/LCIODataSvc.cpp
@@ -74,7 +74,7 @@ void LCIODataSvc::endOfRead() {
   if (m_eventMax != -1) {
     // m_provider.clearCaches();
     // m_reader.endOfEvent();
-    if (m_eventNum++ > m_eventMax) {
+    if ( ++m_eventNum >= m_eventMax ) {
       info() << "Reached end of file with event " << m_eventMax << endmsg;
       IEventProcessor* eventProcessor;
       service("ApplicationMgr", eventProcessor);
-- 
GitLab