From fda887837714f4d0724196ee323e8da41da2f1e7 Mon Sep 17 00:00:00 2001
From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de>
Date: Wed, 8 May 2024 21:11:24 +0000
Subject: [PATCH] online: Reduce log messages per TS.

---
 algo/ca/TrackingChain.cxx               |  4 ++--
 algo/ca/core/tracking/CaTrackFinder.cxx | 14 +++++++-------
 algo/detectors/sts/HitfinderChain.cxx   |  2 +-
 algo/detectors/tof/Hitfind.cxx          |  1 -
 algo/detectors/trd/Hitfind.cxx          |  1 -
 algo/global/Reco.cxx                    |  9 ++++-----
 algo/test/realdata_test.sh              |  4 +---
 7 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx
index a572e708e2..ee2a90edf7 100644
--- a/algo/ca/TrackingChain.cxx
+++ b/algo/ca/TrackingChain.cxx
@@ -146,7 +146,7 @@ void TrackingChain::PrepareInput(Input_t recoResults)
 {
   fNofHitKeys  = 0;
   int nHitsTot = recoResults.stsHits.NElements() + recoResults.tofHits.NElements() + recoResults.trdHits.NElements();
-  L_(info) << "Tracking chain: input has " << nHitsTot << " hits";
+  L_(debug) << "Tracking chain: input has " << nHitsTot << " hits";
   fCaDataManager.ResetInputData(nHitsTot);
   faHitExternalIndices.clear();
   faHitExternalIndices.reserve(nHitsTot);
@@ -161,7 +161,7 @@ void TrackingChain::PrepareInput(Input_t recoResults)
   }
   faHitExternalIndices.shrink_to_fit();
   fCaDataManager.SetNhitKeys(fNofHitKeys);
-  L_(info) << "Tracking chain: " << fCaDataManager.GetNofHits() << " hits will be passed to the ca::Framework";
+  L_(debug) << "Tracking chain: " << fCaDataManager.GetNofHits() << " hits will be passed to the ca::Framework";
   fCaFramework.ReceiveInputData(fCaDataManager.TakeInputData());
 }
 
diff --git a/algo/ca/core/tracking/CaTrackFinder.cxx b/algo/ca/core/tracking/CaTrackFinder.cxx
index 7884a02050..1892ea5fbb 100644
--- a/algo/ca/core/tracking/CaTrackFinder.cxx
+++ b/algo/ca/core/tracking/CaTrackFinder.cxx
@@ -196,8 +196,8 @@ void TrackFinder::FindTracks()
     fStatTsEnd = fStatTsStart + 500.e6;
   }
 
-  LOG(info) << "CA tracker process time slice " << fStatTsStart * 1.e-6 << " -- " << fStatTsEnd * 1.e-6 << " [ms] with "
-            << fStatNhitsTotal << " hits";
+  LOG(debug) << "CA tracker process time slice " << fStatTsStart * 1.e-6 << " -- " << fStatTsEnd * 1.e-6
+             << " [ms] with " << fStatNhitsTotal << " hits";
 
   int nWindows = static_cast<int>((fStatTsEnd - fStatTsStart - fWindowOverlap - fWindowMargin)
                                   / (fWindowLength - fWindowOverlap - fWindowMargin))
@@ -282,8 +282,8 @@ void TrackFinder::FindTracks()
   for (int iThread = 0; iThread < frAlgo.GetNofThreads(); ++iThread) {
     double start = fvWindowStartThread[iThread] * 1.e-6;
     double end   = fvWindowEndThread[iThread] * 1.e-6;
-    LOG(info) << "Thread: " << iThread << " from " << start << " ms  to " << end << " ms (delta = " << end - start
-              << " ms)";
+    LOG(trace) << "Thread: " << iThread << " from " << start << " ms  to " << end << " ms (delta = " << end - start
+               << " ms)";
   }
 
   frAlgo.fMonitorData.StopTimer(ETimer::PrepareTimeslice);
@@ -346,9 +346,9 @@ void TrackFinder::FindTracks()
 
   frAlgo.fMonitorData.StopTimer(ETimer::Tracking);
 
-  LOG(info) << "CA tracker: time slice finished. Reconstructed " << frAlgo.fRecoTracks.size() << " tracks with "
-            << frAlgo.fRecoHits.size() << " hits. Processed " << statNhitsProcessedTotal << " hits in "
-            << statNwindowsTotal << " time windows. Reco time " << frAlgo.fCaRecoTime / 1.e9 << " s";
+  LOG(debug) << "CA tracker: time slice finished. Reconstructed " << frAlgo.fRecoTracks.size() << " tracks with "
+             << frAlgo.fRecoHits.size() << " hits. Processed " << statNhitsProcessedTotal << " hits in "
+             << statNwindowsTotal << " time windows. Reco time " << frAlgo.fCaRecoTime / 1.e9 << " s";
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
diff --git a/algo/detectors/sts/HitfinderChain.cxx b/algo/detectors/sts/HitfinderChain.cxx
index f638a6ac79..d999d96290 100644
--- a/algo/detectors/sts/HitfinderChain.cxx
+++ b/algo/detectors/sts/HitfinderChain.cxx
@@ -245,7 +245,7 @@ sts::HitfinderChain::Result sts::HitfinderChain::operator()(gsl::span<const CbmS
   if (storeClusters) clusters = FlattenClusters(queue);
 
   size_t nHitsTotal = std::accumulate(nHits.begin(), nHits.end(), 0);
-  L_(info) << "Timeslice contains " << nHitsTotal << " STS hits and " << nClustersTotal << " STS clusters";
+  L_(debug) << "Timeslice contains " << nHitsTotal << " STS hits and " << nClustersTotal << " STS clusters";
 
   result.hits                  = std::move(hits);
   result.clusters              = std::move(clusters);
diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx
index 44ddba8d7d..64c84e533c 100644
--- a/algo/detectors/tof/Hitfind.cxx
+++ b/algo/detectors/tof/Hitfind.cxx
@@ -66,7 +66,6 @@ namespace cbm::algo::tof
       }
     }
     L_(info) << "--- Configured hitfinder algorithms for TOF.";
-    L_(info) << "==================================================";
   }
   // ----------------------------------------------------------------------------
 
diff --git a/algo/detectors/trd/Hitfind.cxx b/algo/detectors/trd/Hitfind.cxx
index 467767dcf8..e0f0cb9043 100644
--- a/algo/detectors/trd/Hitfind.cxx
+++ b/algo/detectors/trd/Hitfind.cxx
@@ -97,7 +97,6 @@ namespace cbm::algo::trd
     }
 
     L_(info) << "--- Configured hitfinder algorithms for TRD.";
-    L_(info) << "==================================================";
   }
   // ----------------------------------------------------------------------------
 
diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx
index d922ba9ebd..fcfdc634aa 100644
--- a/algo/global/Reco.cxx
+++ b/algo/global/Reco.cxx
@@ -265,11 +265,9 @@ RecoResults Reco::Run(const fles::Timeslice& ts)
       auto stsResults     = (*fStsHitFinder)(digis.fSts, storeClusters);
       stsHitfinderMonitor = std::move(stsResults.monitor);
       recoData.stsHits    = stsResults.hits;
-      ;
       recoData.stsClusters = std::move(stsResults.clusters);
       QueueStsRecoMetrics(stsHitfinderMonitor);
     }
-    L_(info) << "TS contains " << recoData.stsHits.NElements() << " STS Hits";
 
     PartitionedVector<tof::Hit> tofHits;
     if (Opts().Has(Step::LocalReco) && Opts().Has(fles::Subsystem::TOF)) {
@@ -285,8 +283,6 @@ RecoResults Reco::Run(const fles::Timeslice& ts)
       QueueTofCalibMetrics(calmonitor);
       QueueTofRecoMetrics(hitmonitor);
     }
-    L_(info) << "TS contains " << recoData.tofHits.NElements() << " TOF Hits";
-
 
     PartitionedVector<trd::Hit> trdHits;
     if (fTrdHitfind) {
@@ -302,9 +298,12 @@ RecoResults Reco::Run(const fles::Timeslice& ts)
       auto trdResults  = (*fTrdHitfind)(allDigis);
       recoData.trdHits = std::move(std::get<0>(trdResults));
       QueueTrdRecoMetrics(std::get<1>(trdResults));
-      L_(info) << "TS has " << recoData.trdHits.NElements() << " TRD hits.";
     }
 
+    L_(info) << "TS contains Hits: STS=" << recoData.stsHits.NElements() << " TOF=" << recoData.tofHits.NElements()
+             << " TRD=" << recoData.trdHits.NElements();
+
+
     // --- Tracking
     TrackingChain::Output_t trackingOutput{};
     if (Opts().Has(Step::Tracking)) {
diff --git a/algo/test/realdata_test.sh b/algo/test/realdata_test.sh
index be5b2feeb8..440f293b95 100755
--- a/algo/test/realdata_test.sh
+++ b/algo/test/realdata_test.sh
@@ -85,9 +85,7 @@ ensure_gt_zero "$log" "TS contains Digis: STS=%1 MUCH=%2 TOF=%3 BMON=%4 TRD=%5 T
 ensure_gt_zero "$log" "Triggers: %1, events %2"
 
 # Check Hits
-ensure_gt_zero "$log" "TS contains %1 TOF Hits"
-ensure_gt_zero "$log" "Timeslice contains %1 STS hits and %2 STS clusters"
-ensure_gt_zero "$log" "TS has %1 TRD hits."
+ensure_gt_zero "$log" "TS contains Hits: STS=%1 TOF=%2 TRD=%3"
 
 # Check Tracks
 ensure_gt_zero "$log" "TrackingChain: Timeslice contains %1 tracks, with %2 sts hits, %3 tof hits, 0 trd hits;"
-- 
GitLab