From 880e635b04c5b335d4f3213df8e520f4f4823dac Mon Sep 17 00:00:00 2001
From: Volker Friese <v.friese@gsi.de>
Date: Tue, 7 May 2024 09:46:18 +0200
Subject: [PATCH] Fix issue with empty evbuilder monitor data

---
 algo/evbuild/EventBuilder.cxx | 3 ++-
 algo/evbuild/EventBuilder.h   | 3 ++-
 algo/global/Reco.cxx          | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/algo/evbuild/EventBuilder.cxx b/algo/evbuild/EventBuilder.cxx
index 21b9eeaa06..a53e8f2772 100644
--- a/algo/evbuild/EventBuilder.cxx
+++ b/algo/evbuild/EventBuilder.cxx
@@ -48,7 +48,8 @@ namespace cbm::algo::evbuild
     monitor.psd.nDigis += ts.fPsd.size();
     monitor.fsd.nDigis += ts.fFsd.size();
     monitor.bmon.nDigis += ts.fBmon.size();
-    monitor.nEvents += result.first.size();
+    monitor.numTriggers += triggers.size();
+    monitor.numEvents += result.first.size();
 
     monitor.time = xpu::pop_timer();
     return result;
diff --git a/algo/evbuild/EventBuilder.h b/algo/evbuild/EventBuilder.h
index f2c79ac7e5..b3837384a4 100644
--- a/algo/evbuild/EventBuilder.h
+++ b/algo/evbuild/EventBuilder.h
@@ -48,7 +48,8 @@ namespace cbm::algo::evbuild
     EventBuilderDetectorMonitorData rich;   ///< Monitoring data for RICH
     EventBuilderDetectorMonitorData psd;    ///< Monitoring data for PSD
     EventBuilderDetectorMonitorData fsd;    ///< Monitoring data for FSD
-    size_t nEvents = 0;                     ///< Number of events found in TS
+    size_t numTriggers = 0;                 ///< Number of input triggers
+    size_t numEvents   = 0;                 ///< Number of built and selected events
     xpu::timings time;                      ///< Time for event building
   };
 
diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx
index b98a217a02..a6e2b98fe2 100644
--- a/algo/global/Reco.cxx
+++ b/algo/global/Reco.cxx
@@ -529,8 +529,8 @@ void Reco::QueueEvbuildMetrics(const evbuild::EventbuildChainMonitorData& mon)
                             {"v0TriggerThroughput", FilterNan(mon.v0Trigger.time.throughput())},
                             {"eventbuildTimeTotal", mon.evbuild.time.wall()},
                             {"eventbuildThroughput", FilterNan(mon.evbuild.time.throughput())},
-                            {"numTrigger", mon.digiMultTrigger.nTriggers},
-                            {"numEvents", mon.evbuild.nEvents},
+                            {"numTrigger", mon.evbuild.numTriggers},
+                            {"numEvents", mon.evbuild.numEvents},
                             {"totalEvSelectionRatio", totalSelectionRatio}});
 }
 
-- 
GitLab