From 31c9dba82743783a085520c0bf22cf234f61c060 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Fri, 24 Feb 2023 16:51:55 +0100
Subject: [PATCH] Set nb TRD stations in QA macro for SIS300, fixes warning in
 weekly tests

---
 macro/run/run_qa.C                            | 8 +++++++-
 reco/detectors/trd/qa/CbmTrdHitProducerQa.cxx | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/macro/run/run_qa.C b/macro/run/run_qa.C
index 13f94e9c6b..89a85c2105 100644
--- a/macro/run/run_qa.C
+++ b/macro/run/run_qa.C
@@ -181,7 +181,13 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
     //run->AddTask(new CbmTrdHitRateQa());  //opens lots of windows
     //run->AddTask(new CbmTrdDigitizerPRFQa()); //works put currently doesn't do anything
     //run->AddTask(new CbmTrdHitRateFastQa());  //opens lots of windows
-    run->AddTask(new CbmTrdHitProducerQa());
+    CbmTrdHitProducerQa* trdHitProducerQa = new CbmTrdHitProducerQa();
+    if ("sis300_electron" == setup) {
+      /// Larger number of stations, needed to fit geometry and avoid warning
+      /// => fast-fix to accomodate the 4+4+2 complexity of tentative SIS300 geometry
+      trdHitProducerQa->SetNumberStations(10);
+    }
+    run->AddTask(trdHitProducerQa);
     run->AddTask(new CbmTrdCalibTracker());
     run->AddTask(new CbmTrackerInputQaTrd());  // Tracker requirements to TRD
   }
diff --git a/reco/detectors/trd/qa/CbmTrdHitProducerQa.cxx b/reco/detectors/trd/qa/CbmTrdHitProducerQa.cxx
index 09f172d665..0ae609767b 100644
--- a/reco/detectors/trd/qa/CbmTrdHitProducerQa.cxx
+++ b/reco/detectors/trd/qa/CbmTrdHitProducerQa.cxx
@@ -174,7 +174,8 @@ void CbmTrdHitProducerQa::Exec(Option_t*)
     const int planeId = trdHit->GetPlaneId();
 
     if (planeId >= fNoTrdStations * fNoTrdPerStation) {
-      cout << GetName() << ": Warning, TRD plane out of bounds, skipping hit." << endl;
+      cout << GetName() << ": Warning, TRD plane out of bounds, skipping hit."
+           << " (" << planeId << " VS " << fNoTrdStations << " x " << fNoTrdPerStation << ")" << endl;
       continue;
     }
 
-- 
GitLab