From 61788aa911d8a77e8e04cc6008f3de17e681b201 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Mon, 10 Jul 2023 13:59:51 +0000
Subject: [PATCH] CA: cleanup CbmL1 interface

---
 macro/alignment/run_BbaAlignment.C |  2 +-
 macro/mcbm/mcbm_reco_event.C       |  2 +-
 macro/run/run_qa.C                 |  2 +-
 macro/run/run_reco.C               |  2 +-
 macro/sts/sts_reco_all.C           |  2 +-
 reco/L1/CbmL1.cxx                  | 25 ++++++------------
 reco/L1/CbmL1.h                    | 42 +++++++++++-------------------
 reco/L1/qa/CbmCaOutputQa.cxx       |  4 +--
 reco/offline/steer/TaskFactory.cxx |  2 +-
 9 files changed, 31 insertions(+), 52 deletions(-)

diff --git a/macro/alignment/run_BbaAlignment.C b/macro/alignment/run_BbaAlignment.C
index db1bf300e0..109356feab 100644
--- a/macro/alignment/run_BbaAlignment.C
+++ b/macro/alignment/run_BbaAlignment.C
@@ -144,7 +144,7 @@ void run_BbaAlignment(TString input = "", TString output = "", TString setup = "
   run->AddTask(kalman);
 
   // L1 tracking setup
-  auto l1 = new CbmL1("L1", 2, 3, 0);
+  auto l1 = new CbmL1("L1", 2, 3);
 
   // --- Material budget file names
   TString mvdGeoTag;
diff --git a/macro/mcbm/mcbm_reco_event.C b/macro/mcbm/mcbm_reco_event.C
index 86875f639f..c741e76129 100644
--- a/macro/mcbm/mcbm_reco_event.C
+++ b/macro/mcbm/mcbm_reco_event.C
@@ -375,7 +375,7 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test",
   run->AddTask(kalman);
 
   // L1 tracking
-  auto l1 = (debugWithMC) ? new CbmL1("CA", 5, 3, 4) : new CbmL1("CA", 0, 0, 4);
+  auto l1 = (debugWithMC) ? new CbmL1("CA", 5, 3) : new CbmL1("CA");
   l1->SetMcbmMode();
 
   if (strcmp(setupName, "mcbm_beam_2021_07_surveyed") == 0) l1->SetMissingHits(1);
diff --git a/macro/run/run_qa.C b/macro/run/run_qa.C
index 93afc8071e..054bbb3aa7 100644
--- a/macro/run/run_qa.C
+++ b/macro/run/run_qa.C
@@ -41,7 +41,7 @@
 void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "data/sis100_muon_jpsi_test",
             TString dataReco = "data/sis100_muon_jpsi_test", TString dataPar = "data/sis100_muon_jpsi_test",
             TString dataSink = "data/sis100_muon_jpsi_test", TString setup = "sis100_muon_jpsi", Int_t nEvents = -1,
-            TString dataTra2 = "", TString dataTra3 = "", const char* configName = "./qa_config.fcbm.yaml")
+            TString dataTra2 = "", TString dataTra3 = "", const char* configName = "./qa_config.cbm.yaml")
 {
 
   gROOT->SetBatch(kTRUE);
diff --git a/macro/run/run_reco.C b/macro/run/run_reco.C
index 06c5501f44..9f3be86520 100644
--- a/macro/run/run_reco.C
+++ b/macro/run/run_reco.C
@@ -388,7 +388,7 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice =
     run->AddTask(kalman);
 
     // L1 tracking
-    auto l1 = (debugWithMC) ? new CbmL1("CA", 2, 3, 4) : new CbmL1("CA", 0, 0, 4);
+    auto l1 = (debugWithMC) ? new CbmL1("CA", 2, 3) : new CbmL1("CA");
 
     // L1 configuration file (optional)
     // At the moment, the YAML configuration file defines different parameters for a sequence of track finder
diff --git a/macro/sts/sts_reco_all.C b/macro/sts/sts_reco_all.C
index 7589772695..f9de82d3fa 100644
--- a/macro/sts/sts_reco_all.C
+++ b/macro/sts/sts_reco_all.C
@@ -174,7 +174,7 @@ void sts_reco_all(Int_t nEvents, Float_t energy, Int_t index)
   run->AddTask(new CbmTrackingDetectorInterfaceInit());
   CbmKF* kalman = new CbmKF();
   run->AddTask(kalman);
-  CbmL1* l1 = new CbmL1("L1", 1, 3, 0);
+  CbmL1* l1 = new CbmL1("L1", 1, 3);
   run->AddTask(l1);
   CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder();
   FairTask* stsFindTracks           = new CbmStsFindTracks(iVerbose, stsTrackFinder);
diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx
index 0cc4dba49d..8b43f3d064 100644
--- a/reco/L1/CbmL1.cxx
+++ b/reco/L1/CbmL1.cxx
@@ -87,12 +87,7 @@ CbmL1::CbmL1() : CbmL1("L1") {}
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, const char* dataDir,
-             int findParticleMode)
-  : FairTask(name, verbose)
-  , fPerformance(performance)
-  , fSTAPDataMode(dataMode)
-  , fFindParticlesMode(findParticleMode)
+CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance) : FairTask(name, verbose), fPerformance(performance)
 {
   if (!fpInstance) fpInstance = this;
 
@@ -104,7 +99,7 @@ CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, c
 
   fpIODataManager = std::make_shared<L1IODataManager>();
 
-  this->DefineSTAPNames(dataDir);
+  this->DefineSTAPNames("");
 
   if (!CbmTrackingDetectorInterfaceInit::Instance()) {
     LOG(fatal) << "CbmL1: CbmTrackingDetectorInterfaceInit instance was not found. Please, add it as a task to your "
@@ -967,13 +962,6 @@ void CbmL1::Reconstruct(CbmEvent* event)
     }
   }
 
-  //
-  // tracker input performance is moved to external QA tasks.
-  // InputPerformance() method is not optimised to run with the event builder
-  // TODO: verify QA tasks and remove InputPerformance()
-  // if ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); }
-  //
-
   //  FieldApproxCheck();
   //  FieldIntegralCheck();
 
@@ -1026,13 +1014,16 @@ void CbmL1::Reconstruct(CbmEvent* event)
   LOG(debug) << "CA Track Finder: " << fpAlgo->fCaRecoTime << " s/sub-ts";
 
 
-  if ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); }
-
-
   // output performance
   if (fPerformance) {
     if (fVerbose > 1) { LOG(info) << "Performance..."; }
 
+    //
+    // tracker input performance is moved to external QA tasks.
+    // InputPerformance() method is not optimised to run with the event builder
+    // TODO: verify QA tasks and remove InputPerformance()
+    // InputPerformance();
+    //
 
     TrackMatch();
     EfficienciesPerformance();
diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h
index 31efe477b3..afd5bd5dec 100644
--- a/reco/L1/CbmL1.h
+++ b/reco/L1/CbmL1.h
@@ -104,7 +104,6 @@ namespace std
 }  // namespace std
 
 
-
 // TODO: insert documentation! (S.Zh.)
 //
 /// L1Algo runtime constants modification can be performed in run_reco.C. Example:
@@ -148,22 +147,10 @@ public:
   /// \param  verbose           Verbosity level
   /// \param  performance       Performance run flag:
   ///                           - #0 run without performance measurement
-  ///                           - #1 standard efficiency definition
-  ///                           - #2 QA efficiency definition
-  /// \param  dataMode          Option to work with files for the standalone mode
-  ///                           - #0 standalone mode is not used
-  ///                           - #1 data for standalone mode is written to configuration file (currently does not work)
-  ///                           - #2 tracking runs in standalone mode using configuration file (currently does not work)
-  ///                           - #3 data is written and read (currently does not work)
-  ///                           - #4 parameters file is saved, but the data does not
-  /// \param  dataDir           Name of directory for configuration file
-  /// \param  findParticleMode  Find particle utility mode
-  ///                           - #0 FindParticles is not used
-  ///                           - #1 All MC particles are reconstructable
-  ///                           - #2 MC particles are reconstructable if created from reconstructable tracks
-  ///                           - #3: MC particles are reconstructable if created from reconstructed tracks
-  CbmL1(const char* name, Int_t verbose = 1, Int_t performance = 0, int dataMode = 0, const char* dataDir = "",
-        int findParticleMode = 0);
+  ///                           - #1 require 4 consecutive hits on reconstructible mc track
+  ///                           - #2 require 4 hits on reconstructible mc track
+  ///                           - #3 require 4 consecutive mc points on reconstructible mc track
+  CbmL1(const char* name, Int_t verbose = 1, Int_t performance = 0);
 
   /// Copy constructor
   CbmL1(const CbmL1&) = delete;
@@ -493,7 +480,7 @@ private:
   int fNpointsTrdAll  = 0;  ///< Number of MC points for TRD
   int fNpointsTofAll  = 0;  ///< Number of MC points for TOF
 
-  L1Vector<CbmL1MCPoint> fvMCPoints = {"CbmL1::fvMCPoints"};          ///< Container of MC points
+  L1Vector<CbmL1MCPoint> fvMCPoints = {"CbmL1::fvMCPoints"};  ///< Container of MC points
 
   int fNStations     = 0;  ///< number of total active detector stations
   int fNMvdStations  = 0;  ///< number of active MVD stations
@@ -513,11 +500,17 @@ private:
   Int_t fPerformance   = 0;   ///< performance mode: 0 - w\o perf. 1 - L1-Efficiency definition. 2 - QA-Eff.definition
   double fTrackingTime = 0.;  ///< time of track finding procedure
 
-  /// Option to work with file for standalone package (currently does not work)
-  /// 0 (off) , 1 (write), 2 (read data and work only with it), 3 (debug - write and read)
-  int fSTAPDataMode = 0;
+  /// Option to work with files for the standalone mode
+  ///  - #0 standalone mode is not used
+  ///  - #1 data for standalone mode is written to configuration file (currently does not work)
+  ///  - #2 tracking runs in standalone mode using configuration file (currently does not work)
+  ///  - #3 data is written and read (currently does not work)
+  ///  - #4 parameter file is saved, but the data does not
+  ///
+  int fSTAPDataMode = 4;  ///< Option to work with files for the standalone mode
+
+  TString fSTAPDataDir = ".";  ///< Name of input/output directory for running in a STAP mode
 
-  TString fSTAPDataDir    = ".";     ///< Name of input/output directory for running in a STAP mode
   TString fSTAPDataPrefix = "test";  ///< Name of input/output file prefix. The prefix is defined by output TTree file
 
   /// Extension for IO of the L1Parameters object
@@ -644,11 +637,6 @@ private:
   TTree* fpMcTripletsTree                = nullptr;  ///< Tree to save MC-triplets
   std::string fsMcTripletsOutputFilename = "";       ///< Name of file to save MC-triplets tree
 
-  int fFindParticlesMode {0};  // 0 - don't run FindParticles
-                               // 1 - run, all MC particle is reco-able
-                               // 2 - run, MC particle is reco-able if created from reco-able tracks
-                               // 3 - run, MC particle is reco-able if created from reconstructed tracks
-
   std::unordered_map<L1DetectorID, TString>
     fMatBudgetFileName {};  ///< Map for material budget file names vs. detectorID
 
diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx
index f2dc7dab18..af18ada55a 100644
--- a/reco/L1/qa/CbmCaOutputQa.cxx
+++ b/reco/L1/qa/CbmCaOutputQa.cxx
@@ -385,8 +385,8 @@ InitStatus OutputQa::InitCanvases()
     DrawTrackDistributions(pc_mc_yMC, [&](ETrackType t) -> TH1F* { return fvpTrackHistograms[t]->fph_mc_yMC; });
 
     // MC rapidity vs. MC momentum
-    auto* pc_mc_pMC_yMC =
-      MakeCanvas<CbmQaCanvas>("mc_pMC_yMC", "MC track MC mom. vs. rapidity ", kCXSIZEPX * 3, kCYSIZEPX * 2);
+    // auto* pc_mc_pMC_yMC =
+    MakeCanvas<CbmQaCanvas>("mc_pMC_yMC", "MC track MC mom. vs. rapidity ", kCXSIZEPX * 3, kCYSIZEPX * 2);
     DrawSetOf<TH2F>(vCmpTypesGeneral, [&](ETrackType t) -> TH2F* { return fvpTrackHistograms[t]->fph_reco_pMC_yMC; });
 
     // **  Efficiencies  **
diff --git a/reco/offline/steer/TaskFactory.cxx b/reco/offline/steer/TaskFactory.cxx
index 565d4b4cf1..44fbc2b397 100644
--- a/reco/offline/steer/TaskFactory.cxx
+++ b/reco/offline/steer/TaskFactory.cxx
@@ -61,7 +61,7 @@ namespace cbm::reco::offline
     fRun->AddTask(kf);
 
     // --- CA Track Finder
-    auto ca = new CbmL1("CA Track Finder", 0, 0, 4);
+    auto ca = new CbmL1("CA Track Finder");
     if (fRun->IsDataPresent(ECbmModuleId::kMvd)) {
       TString mvdGeoTag;
       if (CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kMvd, mvdGeoTag)) {
-- 
GitLab