From a3cc79e452b70db95a3c7682c4d9dab8640c2461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20G=C3=BCnther?= <p.gunther@cern.ch>
Date: Fri, 11 Oct 2019 18:08:52 +0200
Subject: [PATCH 1/6] protect against events with more than 1024 tracks

---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index 434012d3c89..6ce3207ac62 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1910,6 +1910,10 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
     result.store_nHits<I>( currentsize, id.size() );
 
     result.size() += 1;
+    if( UNLIKELY( result.size() == 1024 ) ) {
+      if ( msgLevel( MSG::DEBUG ) ) debug() << "Error: Number of tracks reached maximum" << endmsg;
+      break;
+    }
 
     // -- > Debug --------
     if ( msgLevel( MSG::DEBUG ) ) info() << "Store track  quality " << cand.quality() << endmsg;
-- 
GitLab


From cb1a2c31cad476eb5dd3cc66d2aedd2cb3c5bacb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20G=C3=BCnther?= <p.gunther@cern.ch>
Date: Sat, 12 Oct 2019 15:26:36 +0200
Subject: [PATCH 2/6] print error msg instead of debug

---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index 6ce3207ac62..a40925b5e7a 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1911,8 +1911,8 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
 
     result.size() += 1;
     if( UNLIKELY( result.size() == 1024 ) ) {
-      if ( msgLevel( MSG::DEBUG ) ) debug() << "Error: Number of tracks reached maximum" << endmsg;
-      break;
+      error() << "Number of tracks reached maximum, skipping the rest. Please fix me!" << endmsg;
+      break; //FIXME: do something smarter than this
     }
 
     // -- > Debug --------
-- 
GitLab


From bf3b305ae919471efaccf61aae8f9b54b3be121e Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Sat, 12 Oct 2019 13:27:52 +0000
Subject: [PATCH 3/6] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/5764783
---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index a40925b5e7a..346c7182c55 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1910,9 +1910,9 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
     result.store_nHits<I>( currentsize, id.size() );
 
     result.size() += 1;
-    if( UNLIKELY( result.size() == 1024 ) ) {
+    if ( UNLIKELY( result.size() == 1024 ) ) {
       error() << "Number of tracks reached maximum, skipping the rest. Please fix me!" << endmsg;
-      break; //FIXME: do something smarter than this
+      break; // FIXME: do something smarter than this
     }
 
     // -- > Debug --------
-- 
GitLab


From 82d7a16df2c3a5ddcb0f6f121f11c351e224b815 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20G=C3=BCnther?= <p.gunther@cern.ch>
Date: Mon, 14 Oct 2019 20:34:55 +0200
Subject: [PATCH 4/6] now using error counter

---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 2 +-
 Pr/PrAlgorithms/src/PrForwardTracking.h   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index 346c7182c55..28cb2edbbd5 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1911,7 +1911,7 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
 
     result.size() += 1;
     if ( UNLIKELY( result.size() == 1024 ) ) {
-      error() << "Number of tracks reached maximum, skipping the rest. Please fix me!" << endmsg;
+      ++m_maxTracksErr;
       break; // FIXME: do something smarter than this
     }
 
diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.h b/Pr/PrAlgorithms/src/PrForwardTracking.h
index e88f46e91ba..ef505286c5d 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.h
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.h
@@ -167,6 +167,10 @@ private:
   int                  m_timeExtend;
   int                  m_timeFinal;
 
+  using ErrorCounter = Gaudi::Accumulators::MsgCounter<MSG::ERROR>;
+
+  mutable ErrorCounter m_maxTracksErr{this, "Number of tracks reached maximum!"};
+
   mutable Gaudi::Accumulators::SummingCounter<unsigned int> m_nbOutputTracksCounter{this, "Nb output tracks"};
 
   // -- MAIN METHOD
-- 
GitLab


From 7001d28a8d36e90db6a85fba8e59411946071eb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20G=C3=BCnther?= <p.gunther@cern.ch>
Date: Tue, 15 Oct 2019 10:03:32 +0200
Subject: [PATCH 5/6] use max_tracks variable for error

---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index 28cb2edbbd5..28201d37dc0 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1910,7 +1910,7 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
     result.store_nHits<I>( currentsize, id.size() );
 
     result.size() += 1;
-    if ( UNLIKELY( result.size() == 1024 ) ) {
+    if ( UNLIKELY( result.size() == LHCb::Pr::Forward::Tracks::max_tracks ) ) { // FIXME: find a better way to define size of container
       ++m_maxTracksErr;
       break; // FIXME: do something smarter than this
     }
-- 
GitLab


From eea1b6a5b179491879c482867b7582e133857b57 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Tue, 15 Oct 2019 08:04:26 +0000
Subject: [PATCH 6/6] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/5787983
---
 Pr/PrAlgorithms/src/PrForwardTracking.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Pr/PrAlgorithms/src/PrForwardTracking.cpp b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
index 28201d37dc0..86825ea6c87 100644
--- a/Pr/PrAlgorithms/src/PrForwardTracking.cpp
+++ b/Pr/PrAlgorithms/src/PrForwardTracking.cpp
@@ -1910,7 +1910,8 @@ LHCb::Pr::Forward::Tracks PrForwardTracking<T>::makeLHCbTracks( PrForwardTracks
     result.store_nHits<I>( currentsize, id.size() );
 
     result.size() += 1;
-    if ( UNLIKELY( result.size() == LHCb::Pr::Forward::Tracks::max_tracks ) ) { // FIXME: find a better way to define size of container
+    if ( UNLIKELY( result.size() == LHCb::Pr::Forward::Tracks::max_tracks ) ) { // FIXME: find a better way to define
+                                                                                // size of container
       ++m_maxTracksErr;
       break; // FIXME: do something smarter than this
     }
-- 
GitLab