From 47e1c92ee3749c618a3a5a373c22db8d2a1f41d9 Mon Sep 17 00:00:00 2001
From: "s.zharko@gsi.de" <s.zharko@gsi.de>
Date: Wed, 1 Mar 2023 16:36:36 +0100
Subject: [PATCH] CA: Cleaning up RW of L1Parameters instance; introducing
 parameters to the OutputQa task

---
 macro/run/run_qa.C                 | 47 +++++++++++++++++++++++----
 macro/run/run_reco.C               |  2 +-
 reco/L1/CbmCaTimeSliceReader.h     |  1 -
 reco/L1/CbmL1.cxx                  | 52 +++++++++++++-----------------
 reco/L1/CbmL1.h                    |  9 ++++--
 reco/L1/L1Algo/L1IODataManager.cxx | 17 ++++++++++
 reco/L1/L1Algo/L1IODataManager.h   |  5 +++
 reco/L1/L1Algo/L1InitManager.cxx   | 28 +++++++++++++---
 reco/L1/L1Algo/L1InitManager.h     |  5 +++
 reco/L1/qa/CbmCaOutputQa.cxx       | 21 +++++++++++-
 reco/L1/qa/CbmCaOutputQa.h         | 22 +++++++++----
 11 files changed, 155 insertions(+), 54 deletions(-)

diff --git a/macro/run/run_qa.C b/macro/run/run_qa.C
index 89a85c2105..5a2d18f6ed 100644
--- a/macro/run/run_qa.C
+++ b/macro/run/run_qa.C
@@ -18,6 +18,11 @@
 
 // Includes needed for IDE
 #if !defined(__CLING__)
+#include "CbmCaInputQaMuch.h"
+#include "CbmCaInputQaSts.h"
+#include "CbmCaInputQaTof.h"
+#include "CbmCaInputQaTrd.h"
+#include "CbmCaOutputQa.h"
 #include "CbmDefs.h"
 #include "CbmMCDataManager.h"
 #include "CbmMuchDigitizerQa.h"
@@ -73,7 +78,8 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
   // -----   Load the geometry setup   -------------------------------------
   std::cout << std::endl;
   std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl;
-  CbmSetup::Instance()->LoadSetup(setup);
+  CbmSetup* geo = CbmSetup::Instance();
+  geo->LoadSetup(setup);
   // You can modify the pre-defined setup by using
   // CbmSetup::Instance()->RemoveModule(ESystemId) or
   // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or
@@ -81,6 +87,17 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
   // See the class documentation of CbmSetup.
   // ------------------------------------------------------------------------
 
+  // -----   Some global switches   -----------------------------------------
+  //Bool_t eventBased = !sEvBuildRaw.IsNull();
+  bool bUseMvd  = geo->IsActive(ECbmModuleId::kMvd);
+  bool bUseSts  = geo->IsActive(ECbmModuleId::kSts);
+  bool bUseRich = geo->IsActive(ECbmModuleId::kRich);
+  bool bUseMuch = geo->IsActive(ECbmModuleId::kMuch);
+  bool bUseTrd  = geo->IsActive(ECbmModuleId::kTrd);
+  bool bUseTof  = geo->IsActive(ECbmModuleId::kTof);
+  bool bUsePsd  = geo->IsActive(ECbmModuleId::kPsd);
+  // ------------------------------------------------------------------------
+
   // -----   Parameter files as input to the runtime database   -------------
   std::cout << std::endl;
   std::cout << "-I- " << myName << ": Defining parameter files " << std::endl;
@@ -156,7 +173,6 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
   mcManager->AddFile(traFile);
   if (!dataTra2.IsNull()) mcManager->AddFile(tra2File);
   if (!dataTra3.IsNull()) mcManager->AddFile(tra3File);
-
   run->AddTask(mcManager);
   // ------------------------------------------------------------------------
 
@@ -195,21 +211,38 @@ void run_qa(TString dataTra = "data/sis100_muon_jpsi_test", TString dataRaw = "d
 
   // ----- TOF QA  ---------------------------------
   if (CbmSetup::Instance()->IsActive(ECbmModuleId::kTof)) {
-    run->AddTask(new CbmTrackerInputQaTof());  // Tracker requirements to TOF
+    //run->AddTask(new CbmTrackerInputQaTof());  // Tracker requirements to TOF
   }
   // ------------------------------------------------------------------------
 
   // ----- STS QA  ---------------------------------
   if (CbmSetup::Instance()->IsActive(ECbmModuleId::kSts)) {
     //run->AddTask(new CbmStsDigitizeQa()); //opens lots of windows
-    run->AddTask(new CbmStsFindTracksQa());
-    run->AddTask(new CbmTrackingInputQaSts());
+    //run->AddTask(new CbmStsFindTracksQa());
+    //run->AddTask(new CbmTrackingInputQaSts());
   }
   // ------------------------------------------------------------------------
 
-  // ----- Event builder QA  ---------------------------------
+  // ----- Event builder QA  ------------------------------------------------
   CbmBuildEventsQa* evBuildQA = new CbmBuildEventsQa();
-  run->AddTask(evBuildQA);
+  //run->AddTask(evBuildQA);
+  // ------------------------------------------------------------------------
+
+  // ----- Tracking QA ------------------------------------------------------
+  int verbose       = 3;
+  bool isMCUsed     = true;
+  TString caParFile = recFile;
+  caParFile.ReplaceAll(".root", ".L1Parameters.dat");
+
+  auto* pCaOutputQa = new cbm::ca::OutputQa(verbose, isMCUsed);
+  pCaOutputQa->SetStsTrackingMode();
+  pCaOutputQa->ReadParameters(caParFile.Data());
+  pCaOutputQa->SetUseMvd(bUseMvd);
+  pCaOutputQa->SetUseSts(bUseSts);
+  //pCaOutputQa->SetUseMuch(bUseMuch);
+  //pCaOutputQa->SetUseTrd(bUseTrd);
+  //pCaOutputQa->SetUseTof(bUseTof);
+  run->AddTask(pCaOutputQa);
   // ------------------------------------------------------------------------
 
   // -----  Parameter database   --------------------------------------------
diff --git a/macro/run/run_reco.C b/macro/run/run_reco.C
index 2ca3d4d968..19a4e638c8 100644
--- a/macro/run/run_reco.C
+++ b/macro/run/run_reco.C
@@ -382,7 +382,7 @@ void run_reco(TString input = "", Int_t nTimeSlices = -1, Int_t firstTimeSlice =
     run->AddTask(kalman);
 
     // L1 tracking
-    auto l1 = (debugWithMC) ? new CbmL1("L1", 2, 3, 0) : new CbmL1("L1", 0);
+    auto l1 = (debugWithMC) ? new CbmL1("L1", 2, 3, 4) : new CbmL1("L1", 0, 0, 4);
 
     // L1 configuration file (optional)
     // At the moment, the YAML configuration file defines different parameters for a sequence of track finder
diff --git a/reco/L1/CbmCaTimeSliceReader.h b/reco/L1/CbmCaTimeSliceReader.h
index 92ff3c3644..808bd6ada2 100644
--- a/reco/L1/CbmCaTimeSliceReader.h
+++ b/reco/L1/CbmCaTimeSliceReader.h
@@ -130,7 +130,6 @@ namespace cbm::ca
     /// @param pParameters  Pointer to the parameters instance
     void SetParameters(const L1Parameters* pParameters);
 
-
   private:
     /// @brief Reads hits for a given detector subsystem
     /// @tparam Detector ID
diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx
index 0efebbde01..f54e4cd40c 100644
--- a/reco/L1/CbmL1.cxx
+++ b/reco/L1/CbmL1.cxx
@@ -87,7 +87,7 @@ CbmL1::CbmL1() : CbmL1("L1") {}
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, const TString& dataDir,
+CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, const char* dataDir,
              int findParticleMode)
   : FairTask(name, verbose)
   , fPerformance(performance)
@@ -104,7 +104,7 @@ CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, c
 
   fpIODataManager = std::make_shared<L1IODataManager>();
 
-  if (1 == fSTAPDataMode || 2 == fSTAPDataMode) { this->DefineSTAPNames(dataDir); }
+  this->DefineSTAPNames(dataDir);
 
   if (!CbmTrackingDetectorInterfaceInit::Instance()) {
     LOG(fatal) << "CbmL1: CbmTrackingDetectorInterfaceInit instance was not found. Please, add it as a task to your "
@@ -844,7 +844,7 @@ InitStatus CbmL1::Init()
     if (!fInitManager.FormParametersContainer()) { return kFATAL; }
 
     // Write to file if needed
-    if (1 == fSTAPDataMode) { this->WriteSTAPParamObject(); }
+    if (1 == fSTAPDataMode || 4 == fSTAPDataMode) { this->WriteSTAPParamObject(); }
   }
 
 
@@ -1143,43 +1143,35 @@ void CbmL1::IdealTrackFinder()
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void CbmL1::DefineSTAPNames(TString dirName)
+void CbmL1::DefineSTAPNames(const char* dirName)
 {
+  // FIXME: SZh 01.03.2023: Clean STAP names
   namespace bfs = boost::filesystem;
 
-  // Check, if dirName path exists
-  if (!bfs::exists(dirName.Data())) {
-    LOG(warn) << "CbmL1: directory " << dirName.Data()
-              << " (full path: " << bfs::system_complete(dirName.Data()).string()
-              << ") for writing L1AlgoData object does not exist";
-    fSTAPDataDir = ".";
-  }
+  if (fSTAPDataMode == 0) { return; }
+
+  // Define file prefix (/path/to/data/setup.reco.root -> "setup.reco")
+  bfs::path pathToRecoOutput = FairRunAna::Instance()->GetUserOutputFileName().Data();
+  fSTAPDataPrefix            = pathToRecoOutput.filename().string();
+  fSTAPDataPrefix.ReplaceAll(".root", "");
+  fSTAPDataPrefix = fSTAPDataPrefix.Strip(TString::EStripType::kBoth, '.');
 
-  // Check, if dirName path is a directory
-  if (!bfs::is_directory(fSTAPDataDir.Data())) {
-    LOG(warn) << "CbmL1: path " << fSTAPDataDir.Data()
-              << " (full path: " << bfs::system_complete(fSTAPDataDir.Data()).string() << ") is not a directory";
+  TString sDirName = TString(dirName).Length();
+  if (!sDirName.Length()) { fSTAPDataDir = pathToRecoOutput.parent_path().string(); }
+  else if (bfs::exists(sDirName.Data()) && bfs::is_directory(sDirName.Data())) {
+    fSTAPDataDir = sDirName;
+  }
+  else {
     fSTAPDataDir = ".";
   }
 
-  // TODO: Prepare directory, if it is not defined?
-  //
   LOG(info) << "CbmL1: STAP data root directory is \033[1;32m" << bfs::system_complete(fSTAPDataDir.Data())
             << "\033[0m";
 
-  // Output prefix definition
-  bfs::path pathToOutput = FairRunAna::Instance()->GetUserOutputFileName().Data();
-  fSTAPDataPrefix        = pathToOutput.filename().string();
-  TString sOutputSuffix  = ".reco.root";
-  {
-    int suffixIdx = fSTAPDataPrefix.Index(sOutputSuffix);
-    if (suffixIdx != -1) { fSTAPDataPrefix.Remove(suffixIdx, sOutputSuffix.Length()); }
-  }
-  // Leave prefix without points on the edges, if there are any
-  fSTAPDataPrefix = fSTAPDataPrefix.Strip(TString::EStripType::kBoth, '.');
+  if (fSTAPDataMode == 4) { return; }
 
   // Directory for handling L1InputData objects
-  TString sInputDataDir = fSTAPDataDir + "/" + TString(kSTAPAlgoIDataDir.data());
+  TString sInputDataDir = fSTAPDataDir + "/" + fSTAPDataPrefix + "_cainputdata";
   if (!bfs::exists(sInputDataDir.Data())) {
     LOG(warn) << "CbmL1: directory for tracking input data does not exist. It will be created";
     bfs::create_directories(sInputDataDir.Data());
@@ -1200,8 +1192,8 @@ void CbmL1::WriteSTAPParamObject()
 //
 void CbmL1::WriteSTAPAlgoInputData(int iJob)  // must be called after ReadEvent
 {
-  TString filename = fSTAPDataDir + "/" + TString(kSTAPAlgoIDataDir.data()) + "/" + fSTAPDataPrefix + "."
-                     + TString::Format(kSTAPAlgoIDataSuffix.data(), iJob);
+  TString filename =
+    fSTAPDataDir + "/" + fSTAPDataPrefix + "_cainputdata/" + +TString::Format(kSTAPAlgoIDataSuffix.data(), iJob);
 
   // Write file
   fpIODataManager->WriteInputData(filename.Data());
diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h
index a5d550da97..9c6633e1f6 100644
--- a/reco/L1/CbmL1.h
+++ b/reco/L1/CbmL1.h
@@ -154,13 +154,14 @@ public:
   ///                           - #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 TString& dataDir = "./",
+  CbmL1(const char* name, Int_t verbose = 1, Int_t performance = 0, int dataMode = 0, const char* dataDir = "",
         int findParticleMode = 0);
 
   /// Copy constructor
@@ -397,14 +398,16 @@ private:
 
   // ** STandAlone Package service-functions **
 
+  /// @brief Defines names for output in STAP mode
+  /// @param dirName  Name of output directory for STAP data
+  ///
   /// Defines the name of input/output directory [dir] and prefix of the files [pref], which is used to define
   /// input and output data trees in the reconstruction macro. If the output TTree file has name
   /// /path/to/[pref].reco.root, the data files will be:
   ///   [dir]/input_hits/[pref].job[No].L1InputData.dat - hits input files, containing serialized L1InputData objects,
   ///     stored for each job (each call of CbmL1::ReadEvent function)
   ///   [dir]/[pref].L1Parameters.dat - parameters input files, containing serialized L1Parameters object
-  ///
-  void DefineSTAPNames(TString dirName);
+  void DefineSTAPNames(const char* dirName);
 
   /// Writes initialized L1Parameters object to file ""
   void WriteSTAPParamObject();
diff --git a/reco/L1/L1Algo/L1IODataManager.cxx b/reco/L1/L1Algo/L1IODataManager.cxx
index 73d9a572b9..a76fad40bb 100644
--- a/reco/L1/L1Algo/L1IODataManager.cxx
+++ b/reco/L1/L1Algo/L1IODataManager.cxx
@@ -34,6 +34,23 @@ bool L1IODataManager::SendInputData(L1Algo* pAlgo)
   return false;
 }
 
+// ---------------------------------------------------------------------------------------------------------------------
+//
+bool L1IODataManager::SendInputData(L1InputData& destination)
+{
+  // Set boundary hit indexes
+  InitData();
+
+  // Check data before input
+  if (CheckInputData<L1Constants::control::kInputDataQaLevel>()) {
+    destination = std::move(fInputData);
+    assert(this->GetNofHits() == 0);
+    return true;
+  }
+  LOG(error) << "L1: Attempt to set up inconsistent input data";
+  return false;
+}
+
 // ---------------------------------------------------------------------------------------------------------------------
 //
 void L1IODataManager::ReadInputData(const std::string& fileName)
diff --git a/reco/L1/L1Algo/L1IODataManager.h b/reco/L1/L1Algo/L1IODataManager.h
index 166972ecbe..49bcf6fa58 100644
--- a/reco/L1/L1Algo/L1IODataManager.h
+++ b/reco/L1/L1Algo/L1IODataManager.h
@@ -86,10 +86,15 @@ public:
   /// \return Success flag
   bool SendInputData(L1Algo* pAlgo);
 
+  /// @brief Sends (moves) input data to an object (alternative method of data sending)
+  /// @param destination  Destination object of input data
+  bool SendInputData(L1InputData& destination);
+
   /// Writes input data object to boost-serialized binary file
   /// \param  fileName  Name of input file
   void WriteInputData(const std::string& fileName) const;
 
+
 private:
   /// @brief Initializes data object
   ///
diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx
index 31e3400607..745fc35d86 100644
--- a/reco/L1/L1Algo/L1InitManager.cxx
+++ b/reco/L1/L1Algo/L1InitManager.cxx
@@ -18,6 +18,11 @@
 
 #include "L1Algo.h"
 #include "L1Assert.h"
+
+using L1Constants::clrs::kCL;   // end colored log
+using L1Constants::clrs::kGNb;  // bold green log
+using L1Constants::clrs::kRDb;  // bold red log
+
 // ----------------------------------------------------------------------------------------------------------------------
 //
 void L1InitManager::AddStation(const L1BaseStationInfo& inStation)
@@ -264,16 +269,17 @@ void L1InitManager::PushBackCAIteration(const L1CAIteration& iteration)
 void L1InitManager::ReadParametersObject(const std::string& fileName)
 {
   // Open input binary file
-  std::ifstream ifs(fileName);
-  if (!ifs) { LOG(fatal) << "L1InitManager: parameters data file \"" << fileName << "\" was not found"; }
+  std::ifstream ifs(fileName, std::ios::binary);
+  if (!ifs) { LOG(fatal) << "L1InitManager: parameters data file \"" << kGNb << fileName << kCL << "\" was not found"; }
 
   // Get L1InputData object
   try {
-    boost::archive::text_iarchive ia(ifs);
+    boost::archive::binary_iarchive ia(ifs);
     ia >> fParameters;
   }
   catch (const std::exception&) {
-    LOG(fatal) << "L1InitManager: parameters file \"" << fileName << "\" has incorrect data format or was corrupted";
+    LOG(fatal) << "L1InitManager: parameters file \"" << kGNb << fileName << kCL
+               << "\" has incorrect data format or was corrupted";
   }
 }
 
@@ -326,6 +332,16 @@ bool L1InitManager::SendParameters(L1Algo* pAlgo)
 {
   assert(pAlgo);
   pAlgo->ReceiveParameters(std::move(fParameters));
+  LOG(info) << "L1InitManager: parameters object was sent to the tracking algorithm";
+  return true;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+//
+bool L1InitManager::SendParameters(L1Parameters& destination)
+{
+  destination = std::move(fParameters);
+  LOG(info) << "L1InitManager: parameters object was sent to an external destination";
   return true;
 }
 
@@ -465,10 +481,12 @@ void L1InitManager::WriteParametersObject(const std::string& fileName) const
   // Open output binary file
   std::ofstream ofs(fileName, std::ios::binary);
   if (!ofs) {
-    LOG(error) << "L1InitManager: failed opening file \"" << fileName << " for writing parameters object\"";
+    LOG(error) << "L1InitManager: failed opening file \"" << kGNb << fileName << kCL << "\" to write parameters object";
     return;
   }
 
+  LOG(info) << "L1InitManager: writing CA parameters object to file \"" << kGNb << fileName << '\"' << kCL;
+
   // Serialize L1Parameters object and write
   boost::archive::binary_oarchive oa(ofs);
   oa << fParameters;
diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h
index 1a314f4059..9a2f76cae7 100644
--- a/reco/L1/L1Algo/L1InitManager.h
+++ b/reco/L1/L1Algo/L1InitManager.h
@@ -244,6 +244,11 @@ public:
   /// \return Success flag
   bool SendParameters(L1Algo* pAlgo);
 
+  /// @brief Sends (moves) parameters object to an external destination
+  /// @param destination  Reference to the parameters object of destination
+  /// @return  Success flag
+  bool SendParameters(L1Parameters& destination);
+
   /// Writes parameters object from boost-serialized binary file
   /// \param  fileName  Name of input file
   void WriteParametersObject(const std::string& fileName) const;
diff --git a/reco/L1/qa/CbmCaOutputQa.cxx b/reco/L1/qa/CbmCaOutputQa.cxx
index 2f6713f24d..72df21eb8a 100644
--- a/reco/L1/qa/CbmCaOutputQa.cxx
+++ b/reco/L1/qa/CbmCaOutputQa.cxx
@@ -11,6 +11,8 @@
 
 #include "Logger.h"
 
+#include "L1InitManager.h"
+
 using ca::tools::Debugger;
 using cbm::ca::OutputQa;
 
@@ -33,6 +35,7 @@ InitStatus OutputQa::InitDataBranches()
 
   if (!fpTSReader.get()) { fpTSReader = std::make_unique<TimeSliceReader>(fTrackingMode); }
 
+
   if (!fpDataManager.get()) { fpDataManager = std::make_shared<L1IODataManager>(); }
 
   // Initialize time slice reader instance
@@ -55,11 +58,27 @@ InitStatus OutputQa::InitDataBranches()
 //
 InitStatus OutputQa::InitTimeSlice()
 {
-  // Read hits
+  // Read hits: fill fvHitIds, fvDbgHits and fpDataManager
   fpTSReader->ReadHits();
+  fpDataManager->SendInputData(fInputData);
 
   // Read reconstructed tracks
   fpTSReader->ReadRecoTracks();
+  LOG(info) << fName << ": Time slice was read: " << fInputData.GetNhits() << " hits, " << fvRecoTracks.size()
+            << " tracks";
 
   return kSUCCESS;
 }
+
+// ---------------------------------------------------------------------------------------------------------------------
+//
+void OutputQa::ReadParameters(const char* filename)
+{
+  fpParameters = std::make_shared<L1Parameters>();
+
+  L1InitManager manager;
+  manager.ReadParametersObject(filename);
+  manager.SendParameters(*fpParameters);
+
+  LOG(info) << fpParameters->ToString(10);
+}
diff --git a/reco/L1/qa/CbmCaOutputQa.h b/reco/L1/qa/CbmCaOutputQa.h
index 6a0c6f01b3..09c2efbe96 100644
--- a/reco/L1/qa/CbmCaOutputQa.h
+++ b/reco/L1/qa/CbmCaOutputQa.h
@@ -10,11 +10,13 @@
 #ifndef CbmCaOutputQa_h
 #define CbmCaOutputQa_h 1
 
+#include "CbmCaMCModule.h"
 #include "CbmCaTimeSliceReader.h"
 #include "CbmL1DetectorID.h"
 #include "CbmQaTask.h"
 
 #include "CaToolsDebugger.h"
+#include "L1Parameters.h"
 
 namespace cbm::ca
 {
@@ -27,6 +29,17 @@ namespace cbm::ca
     /// @param  isMCUsed  Flag, if MC information is available for this task
     OutputQa(int verbose, bool isMCUsed);
 
+    /// @brief Enables debugger
+    /// @param filename  Name of output ROOT file
+    ///
+    /// Creates a debugger and enables its usage inside a QA task
+    void EnableDebugger(const char* filename);
+
+    /// @brief Reads defined parameters object from file
+    /// @param filename  Name of parameter file
+    /// @note  TEMPORARY FUNCTION, A SEPARATE PARAMETERS INITIALIZATION CLASS IS TO BE USED
+    void ReadParameters(const char* filename);
+
     /// @brief Sets MVD use flag
     /// @param flag  Boolean flag: true - detector subsystem is used, false - detector subsystem is ignored
     void SetUseMvd(bool flag = true) { fbUseMvd = flag; }
@@ -53,12 +66,6 @@ namespace cbm::ca
     /// @brief Sets mCBM global tracking mode
     void SetMcbmTrackingMode() { fTrackingMode = ECbmTrackingMode::kMCBM; }
 
-    /// @brief Enables debugger
-    /// @param filename  Name of output ROOT file
-    ///
-    /// Creates a debugger and enables its usage inside a QA task
-    void EnableDebugger(const char* filename);
-
 
     ClassDef(OutputQa, 0);
 
@@ -98,12 +105,15 @@ namespace cbm::ca
     ECbmTrackingMode fTrackingMode = ECbmTrackingMode::kSTS;  ///< Tracking mode
 
     std::unique_ptr<TimeSliceReader> fpTSReader       = nullptr;  ///< Reader of the time slice
+    std::unique_ptr<CbmCaMCModule> fpMCModule         = nullptr;  ///< MC module
     std::shared_ptr<L1IODataManager> fpDataManager    = nullptr;  ///< Data manager
     std::shared_ptr<::ca::tools::Debugger> fpDebugger = nullptr;  ///< Debugger
+    std::shared_ptr<L1Parameters> fpParameters        = nullptr;  ///< Tracking parameters object
 
     L1Vector<CbmL1HitId> fvHitIds {"CbmCaOutputQa::fvHitIds"};
     L1Vector<CbmL1HitDebugInfo> fvDbgHits {"CbmCaOutputQa::fvDbgHits"};
     L1Vector<CbmL1Track> fvRecoTracks {"CbmCaOutputQa::fvRecoTracks"};
+    L1InputData fInputData;  ///< Input hits to L1 algo
   };
 }  // namespace cbm::ca
 
-- 
GitLab