From ae3c30b7267c67e7198f3295b495540cddeb15fa Mon Sep 17 00:00:00 2001
From: "s.zharko@gsi.de" <s.zharko@gsi.de>
Date: Wed, 22 May 2024 14:29:48 +0200
Subject: [PATCH] redo bugfix in order to apply in a separete merge request

---
 macro/mcbm/mcbm_qa.C            | 13 ++++++++++++-
 reco/L1/qa/CbmCaInputQaBase.cxx | 29 ++++++++++++++++-------------
 reco/L1/qa/CbmCaOutputQa.cxx    |  2 --
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/macro/mcbm/mcbm_qa.C b/macro/mcbm/mcbm_qa.C
index d0bcb8e4f9..703931640d 100644
--- a/macro/mcbm/mcbm_qa.C
+++ b/macro/mcbm/mcbm_qa.C
@@ -84,7 +84,7 @@ void mcbm_qa(Int_t nEvents = 0,
              TString geoFile = "data/mcbm_beam_2022_05_nickel.geo.root",
              TString sinkFile = "data/mcbm_beam_2022_05_nickel.qa.root",
              TString setupName = "mcbm_beam_2022_05_nickel",
-             TString bUseMC = kTRUE,
+             Bool_t bUseMC = kTRUE,
              TString config = "",
              TString benchmarkInput = "")
 /* clang-format on */
@@ -111,6 +111,17 @@ void mcbm_qa(Int_t nEvents = 0,
     qaConfig = srcDir + "/macro/qa/configs/qa_tasks_config_mcbm.yaml";
   }
   TString benchmarkOut = sinkFile + ".qa.benchmark.root";
+
+
+  std::cout << "Use MC?     " << (bUseMC ? "Yes" : "No") << '\n';
+  std::cout << "Digi input: " << rawFile << '\n';
+  std::cout << "Reco input: " << recFile << '\n';
+  std::cout << "Par input:  " << parFile << '\n';
+  std::cout << "Geo input:  " << geoFile << '\n';
+  if (bUseMC) {
+    std::cout << "\nTransport input:  " << traColFile << '\n';
+  }
+
   // ------------------------------------------------------------------------
 
   // -----   Load the geometry setup   -------------------------------------
diff --git a/reco/L1/qa/CbmCaInputQaBase.cxx b/reco/L1/qa/CbmCaInputQaBase.cxx
index 823787553c..65605d9dd4 100644
--- a/reco/L1/qa/CbmCaInputQaBase.cxx
+++ b/reco/L1/qa/CbmCaInputQaBase.cxx
@@ -83,14 +83,16 @@ void CbmCaInputQaBase<DetID>::Check()
 
   // Fill efficiency distributions
 
-  for (int iSt = 0; iSt < nSt; ++iSt) {
-    TProfile2D* effxy = fvpe_reco_eff_vs_xy[iSt];
-    for (int i = 1; i < effxy->GetNbinsX() - 1; i++) {
-      for (int j = 1; j < effxy->GetNbinsY() - 1; j++) {
-        int bin = effxy->GetBin(i, j);
-        if (effxy->GetBinEntries(bin) >= 1) {
-          fvph_reco_eff[iSt]->Fill(effxy->GetBinContent(bin));
-          fvph_reco_eff[nSt]->Fill(effxy->GetBinContent(bin));
+  if (IsMCUsed()) {
+    for (int iSt = 0; iSt < nSt; ++iSt) {
+      TProfile2D* effxy = fvpe_reco_eff_vs_xy[iSt];
+      for (int i = 1; i < effxy->GetNbinsX() - 1; i++) {
+        for (int j = 1; j < effxy->GetNbinsY() - 1; j++) {
+          int bin = effxy->GetBin(i, j);
+          if (effxy->GetBinEntries(bin) >= 1) {
+            fvph_reco_eff[iSt]->Fill(effxy->GetBinContent(bin));
+            fvph_reco_eff[nSt]->Fill(effxy->GetBinContent(bin));
+          }
         }
       }
     }
@@ -1149,7 +1151,7 @@ InitStatus CbmCaInputQaBase<DetID>::InitCanvases()
     fvph_hit_zy[nSt]->DrawCopy("colz", "");
   }
 
-  {
+  if (IsMCUsed()) {
     auto* canv = MakeQaObject<TCanvas>("occ_point", "Point Occupancy", 1600, 800);
     DivideCanvas(canv, 3);
 
@@ -1161,7 +1163,7 @@ InitStatus CbmCaInputQaBase<DetID>::InitCanvases()
     fvph_point_zy[nSt]->DrawCopy("colz", "");
   }
 
-  {
+  if (IsMCUsed()) {
     auto* canv = MakeQaObject<TCanvas>("residual", "Hit Residuals", 1600, 800);
     DivideCanvas(canv, 6);
     canv->cd(1);
@@ -1176,7 +1178,7 @@ InitStatus CbmCaInputQaBase<DetID>::InitCanvases()
     fvph_res_v[nSt]->DrawCopy("colz", "");
   }
 
-  {
+  if (IsMCUsed()) {
     auto* canv = MakeQaObject<TCanvas>("pull", "Hit Pulls", 1600, 800);
     DivideCanvas(canv, 6);
     canv->cd(1);
@@ -1191,7 +1193,7 @@ InitStatus CbmCaInputQaBase<DetID>::InitCanvases()
     fvph_pull_v[nSt]->DrawCopy("colz", "");
   }
 
-  {
+  if (IsMCUsed()) {
     auto* canv = MakeQaObject<TCanvas>("eff", "Hit Reconstruction Efficiency", 1600, 800);
     DivideCanvas(canv, 2);
     canv->cd(1);
@@ -1217,7 +1219,8 @@ InitStatus CbmCaInputQaBase<DetID>::InitCanvases()
     fvph_hit_kuv[nSt]->DrawCopy();
   }
 
-  {
+  // TODO: Split the histograms for MC and real data
+  if (IsMCUsed()) {
     auto* canv = MakeQaObject<TCanvas>("other", "Other histograms", 1600, 800);
     DivideCanvas(canv, 3);
     canv->cd(1);
diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx
index 1e0cba6d71..815754cd5c 100644
--- a/reco/L1/qa/CbmCaOutputQa.cxx
+++ b/reco/L1/qa/CbmCaOutputQa.cxx
@@ -77,8 +77,6 @@ OutputQa::OutputQa(int verbose, bool isMCUsed, ECbmRecoMode recoMode)
 
   // Init track type histograms drawing attributes
   InitDrawingAttributes();
-
-  SetProcessFullTs(false);  // If CbmEvent branch exists, the routine will run in event-based regime
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
-- 
GitLab