From 61c45a7388f4332cef7685cf00ed46563680eecf Mon Sep 17 00:00:00 2001
From: "s.zharko@gsi.de" <s.zharko@gsi.de>
Date: Tue, 5 Apr 2022 19:35:47 +0200
Subject: [PATCH] updates

---
 reco/L1/CbmL1.cxx            |  5 ++---
 reco/L1/CbmL1Performance.cxx | 37 ++++++++++--------------------------
 reco/L1/L1Algo/L1Assert.h    |  2 +-
 3 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx
index 784fb96e6b..3d17b13798 100644
--- a/reco/L1/CbmL1.cxx
+++ b/reco/L1/CbmL1.cxx
@@ -18,8 +18,6 @@
  *====================================================================
  */
 
-#include <boost/filesystem.hpp>
-
 #include "CbmL1.h"
 
 #include "CbmKF.h"
@@ -33,6 +31,7 @@
 #include "CbmMvdDetector.h"
 #include "CbmMvdStationPar.h"
 #include "CbmSetup.h"
+#include <boost/filesystem.hpp>
 // TODO: include of CbmSetup.h creates problems on Mac
 // #include "CbmSetup.h"
 #include "CbmMCDataObject.h"
@@ -1826,7 +1825,7 @@ void CbmL1::Finish()
 
   // Open output file and write histograms
   boost::filesystem::path p = (FairRunAna::Instance()->GetUserOutputFileName()).Data();
-  std::string histoOutName = p.parent_path().string() + "/L1_histo_" + p.filename().string();
+  std::string histoOutName  = p.parent_path().string() + "/L1_histo_" + p.filename().string();
   LOG(info) << "\033[31;1mHistograms will be saved to: \033[0m" << histoOutName;
 
   TFile* outfile = new TFile(histoOutName.c_str(), "RECREATE");
diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx
index b275ca3f6e..dea72465af 100644
--- a/reco/L1/CbmL1Performance.cxx
+++ b/reco/L1/CbmL1Performance.cxx
@@ -26,6 +26,7 @@
 #include "CbmMatch.h"
 #include "CbmMuchPixelHit.h"
 #include "CbmMuchPoint.h"
+#include "CbmQaTable.h"
 #include "CbmStsDigi.h"
 #include "CbmStsHit.h"
 #include "CbmStsPoint.h"
@@ -35,8 +36,6 @@
 #include "CbmTofPoint.h"
 #include "CbmTrdHit.h"
 #include "CbmTrdPoint.h"
-#include "CbmQaTable.h"
-
 
 #include "FairTrackParam.h"  // for vertex pulls
 
@@ -253,29 +252,13 @@ struct TL1PerfEfficiencies : public TL1Efficiencies {
     for (int iC = 0; iC < NCounters; ++iC) {
       rowNames[iC] = std::string(names[iC].Data());
     }
-    std::vector<std::string> colNames = {
-      "Eff.",
-      "Killed",
-      "Length",
-      "Fakes",
-      "Clones",
-      "All Reco",
-      "All MC",
-      "MCl(hits)",
-      "MCl(MCps)"
-    };
+    std::vector<std::string> colNames = {"Eff.",     "Killed", "Length",    "Fakes",    "Clones",
+                                         "All Reco", "All MC", "MCl(hits)", "MCl(MCps)"};
 
     TDirectory* curdir = gDirectory;
     gDirectory         = fOutDir;
-    
-    static int sTableNo = 0;
-    std::string nameOfTableNew = nameOfTable + "_no" + std::to_string(sTableNo);
-    LOG(info) << ">> Table No " << sTableNo;
-    ++sTableNo;
-
 
-
-    CbmQaTable* aTable = new CbmQaTable(nameOfTableNew.c_str(), "Track Efficiency", 20, 9);
+    CbmQaTable* aTable = new CbmQaTable(nameOfTable.c_str(), "Track Efficiency", 20, 9);
     aTable->SetNamesOfRows(rowNames);
     aTable->SetNamesOfCols(colNames);
     for (int iC = 0; iC < NCounters; iC++) {
@@ -289,13 +272,12 @@ struct TL1PerfEfficiencies : public TL1Efficiencies {
       aTable->SetCell(iC, 7, mc_length_hits.counters[iC] / double(mc.counters[iC]));
       aTable->SetCell(iC, 8, mc_length.counters[iC] / double(mc.counters[iC]));
     }
-    cout << *aTable;
+    cout << *aTable;  // print a table to log
     cout << "Ghost     probability  : " << ratio_ghosts << "  | " << ghosts << endl;
-  
+
     gDirectory = curdir;
   };
 
-  
 
   TL1TracksCatCounters<double> ratio_killed;
   TL1TracksCatCounters<double> ratio_clone;
@@ -308,8 +290,8 @@ struct TL1PerfEfficiencies : public TL1Efficiencies {
   TL1TracksCatCounters<double> reco_fakes;
   TL1TracksCatCounters<int> mc_length;
   TL1TracksCatCounters<int> mc_length_hits;
-  
-  TDirectory* fOutDir {nullptr};
+
+  TDirectory* fOutDir {nullptr};  // Specified for saving tables
 };
 
 
@@ -322,7 +304,8 @@ void CbmL1::EfficienciesPerformance()
 
 
   TL1PerfEfficiencies ntra;  // efficiencies for current event
-  ntra.fOutDir = fHistoDir; // Setup a pointer for output directory
+  ntra.fOutDir    = fHistoDir;  // Setup a pointer for output directory
+  L1_NTRA.fOutDir = fHistoDir;  // Save average efficiencies
 
   for (vector<CbmL1Track>::iterator rtraIt = vRTracks.begin(); rtraIt != vRTracks.end(); ++rtraIt) {
     ntra.ghosts += rtraIt->IsGhost();
diff --git a/reco/L1/L1Algo/L1Assert.h b/reco/L1/L1Algo/L1Assert.h
index d2cd46c43b..ae7080d1bf 100644
--- a/reco/L1/L1Algo/L1Assert.h
+++ b/reco/L1/L1Algo/L1Assert.h
@@ -53,7 +53,7 @@ namespace L1Assert
 
   /// Specialization in case of IsAsserted = false, i.e. the assertion is not made
   template<>
-  inline __attribute__((always_inline)) int DoAssertion<false>(int /*level*/, bool /*condition*/, const char* /*msg*/, 
+  inline __attribute__((always_inline)) int DoAssertion<false>(int /*level*/, bool /*condition*/, const char* /*msg*/,
                                                                const char* /*fileName*/, int /*lineNo*/)
   {
     return 0;
-- 
GitLab