From ad85c2598d5fe4ac39d5019cdb388413a66b5c42 Mon Sep 17 00:00:00 2001
From: "s.zharko@gsi.de" <s.zharko@gsi.de>
Date: Tue, 23 Aug 2022 19:31:59 +0200
Subject: [PATCH] L1: improved L1 core parameters intialization

---
 reco/L1/CbmL1.cxx                        | 130 ++++++++++++-----------
 reco/L1/CbmL1.h                          |  18 ++--
 reco/L1/CbmL1Performance.cxx             |   7 +-
 reco/L1/L1Algo/L1Algo.cxx                |  44 ++++----
 reco/L1/L1Algo/L1Algo.h                  |  27 +----
 reco/L1/L1Algo/L1CATrackFinder.cxx       |  65 ++++++------
 reco/L1/L1Algo/L1InitManager.cxx         |  59 +++++-----
 reco/L1/L1Algo/L1InitManager.h           |  37 +++----
 reco/L1/L1Algo/L1Parameters.cxx          |  31 ++++--
 reco/L1/L1Algo/L1Parameters.h            |  51 ++++++---
 reco/L1/L1Algo/L1TrackExtender.cxx       |   4 +-
 reco/L1/L1Algo/L1TrackFitter.cxx         |   6 +-
 reco/L1/ParticleFinder/CbmL1PFFitter.cxx |   4 +-
 13 files changed, 242 insertions(+), 241 deletions(-)

diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx
index e8b67a0f13..d0385f5196 100644
--- a/reco/L1/CbmL1.cxx
+++ b/reco/L1/CbmL1.cxx
@@ -98,7 +98,6 @@ CbmL1::CbmL1(const char* name, Int_t verbose, Int_t performance, int dataMode, c
   , fFindParticlesMode(findParticleMode)
 {
   if (!fpInstance) fpInstance = this;
-  if (!fpInitManager) { fpInitManager = gAlgo.GetInitManager(); }
 
   if (!CbmTrackingDetectorInterfaceInit::Instance()) {
     LOG(fatal) << "CbmL1: CbmTrackingDetectorInterfaceInit instance was not found. Please, add it as a task to your "
@@ -169,9 +168,14 @@ InitStatus CbmL1::Init()
 #endif
   }
 
+  // Init L1 algo core
+
   fpAlgo    = &gAlgo;
+  fpAlgo->Init(fUseHitErrors, fTrackingMode, fMissingHits);
+
   fHistoDir = gROOT->mkdir("L1");
 
+
   // turn on reconstruction in sub-detectors
 
   fUseMVD  = true;
@@ -192,7 +196,7 @@ InitStatus CbmL1::Init()
     fUseMUCH = 1;
     fUseTRD  = 1;
     fUseTOF  = 1;
-    fpInitManager->DevSetIgnoreHitSearchAreas(true);
+    fInitManager.DevSetIgnoreHitSearchAreas(true);
   }
 
 
@@ -203,12 +207,12 @@ InitStatus CbmL1::Init()
     fUseMUCH = 0;
     fUseTRD  = 1;
     fUseTOF  = 0;
-    fpInitManager->DevSetIgnoreHitSearchAreas(true);
-    //fpInitManager->DevSetFitSingletsFromTarget(true);
-    //fpInitManager->DevSetIsMatchDoubletsViaMc(true);
-    //fpInitManager->DevSetIsMatchTripletsViaMc(true);
-    //fpInitManager->DevSetIsMatchNeighbourdViaMc(true);
-    fpInitManager->SetMaxTripletPerDoublets(1000);
+    fInitManager.DevSetIgnoreHitSearchAreas(true);
+    //fInitManager.DevSetFitSingletsFromTarget(true);
+    //fInitManager.DevSetIsMatchDoubletsViaMc(true);
+    //fInitManager.DevSetIsMatchTripletsViaMc(true);
+    //fInitManager.DevSetIsMatchNeighbourdViaMc(true);
+    fInitManager.SetMaxTripletPerDoublets(1000);
   }
 
   CheckDetectorPresence();
@@ -355,7 +359,7 @@ InitStatus CbmL1::Init()
    ** Field initialization **
    **************************/
 
-  fpInitManager->SetFieldFunction([](const double(&inPos)[3], double(&outB)[3]) {
+  fInitManager.SetFieldFunction([](const double(&inPos)[3], double(&outB)[3]) {
     CbmKF::Instance()->GetMagneticField()->GetFieldValue(inPos, outB);
   });
 
@@ -364,13 +368,13 @@ InitStatus CbmL1::Init()
    ***************************/
 
   auto& target = CbmKF::Instance()->vTargets[0];
-  fpInitManager->SetTargetPosition(target.x, target.y, target.z);
+  fInitManager.SetTargetPosition(target.x, target.y, target.z);
 
   /*********************************
    ** Target field initialization **
    *********************************/
 
-  fpInitManager->InitTargetField(/*zStep = */ 2.5 /*cm*/);  // Replace zStep -> sizeZfieldRegion = 2 * zStep (TODO)
+  fInitManager.InitTargetField(/*zStep = */ 2.5 /*cm*/);  // Replace zStep -> sizeZfieldRegion = 2 * zStep (TODO)
 
   /**************************************
    **                                  **
@@ -390,7 +394,7 @@ InitStatus CbmL1::Init()
   if (fUseMUCH) { vActiveTrackingDetectorIDs.insert(L1DetectorID::kMuch); }
   if (fUseTRD) { vActiveTrackingDetectorIDs.insert(L1DetectorID::kTrd); }
   if (fUseTOF) { vActiveTrackingDetectorIDs.insert(L1DetectorID::kTof); }
-  fpInitManager->SetActiveDetectorIDs(vActiveTrackingDetectorIDs);
+  fInitManager.SetActiveDetectorIDs(vActiveTrackingDetectorIDs);
 
   /*********************************************************************
    ** Counting numbers of stations for different detector subsystems  **
@@ -414,12 +418,12 @@ InitStatus CbmL1::Init()
   fNTofStationsGeom  = (fUseTOF) ? tofInterface->GetNtrackingStations() : 0;
   fNStationsGeom = fNMvdStationsGeom + fNStsStationsGeom + fNMuchStationsGeom + fNTrdStationsGeom + fNTofStationsGeom;
 
-  // Provide crosscheck number of stations for the fpInitManagera
-  fpInitManager->SetNstations(L1DetectorID::kMvd, fNMvdStationsGeom);
-  fpInitManager->SetNstations(L1DetectorID::kSts, fNStsStationsGeom);
-  fpInitManager->SetNstations(L1DetectorID::kMuch, fNMuchStationsGeom);
-  fpInitManager->SetNstations(L1DetectorID::kTrd, fNTrdStationsGeom);
-  fpInitManager->SetNstations(L1DetectorID::kTof, fNTofStationsGeom);
+  // Provide crosscheck number of stations for the fInitManagera
+  fInitManager.SetNstations(L1DetectorID::kMvd, fNMvdStationsGeom);
+  fInitManager.SetNstations(L1DetectorID::kSts, fNStsStationsGeom);
+  fInitManager.SetNstations(L1DetectorID::kMuch, fNMuchStationsGeom);
+  fInitManager.SetNstations(L1DetectorID::kTrd, fNTrdStationsGeom);
+  fInitManager.SetNstations(L1DetectorID::kTof, fNTofStationsGeom);
 
   {
     if (fSTAPDataMode % 2 == 1) {  // 1,3
@@ -498,7 +502,7 @@ InitStatus CbmL1::Init()
         (fscal) mvdInterface->GetStripsStereoAngleFront(iSt), (fscal) mvdInterface->GetStripsSpatialRmsFront(iSt),
         (fscal) mvdInterface->GetStripsStereoAngleBack(iSt), (fscal) mvdInterface->GetStripsSpatialRmsBack(iSt));
       stationInfo.SetTrackingStatus(target.z < stationInfo.GetZdouble() ? true : false);
-      fpInitManager->AddStation(stationInfo);
+      fInitManager.AddStation(stationInfo);
       LOG(info) << "- MVD station " << iSt << " at z = " << stationInfo.GetZdouble() << " cm";
     }
   }
@@ -523,7 +527,7 @@ InitStatus CbmL1::Init()
         (fscal) stsInterface->GetStripsStereoAngleFront(iSt), (fscal) stsInterface->GetStripsSpatialRmsFront(iSt),
         (fscal) stsInterface->GetStripsStereoAngleBack(iSt), (fscal) stsInterface->GetStripsSpatialRmsBack(iSt));
       stationInfo.SetTrackingStatus(target.z < stationInfo.GetZdouble() ? true : false);
-      fpInitManager->AddStation(stationInfo);
+      fInitManager.AddStation(stationInfo);
       LOG(info) << "- STS station " << iSt << " at z = " << stationInfo.GetZdouble() << " cm";
     }
   }
@@ -548,7 +552,7 @@ InitStatus CbmL1::Init()
         (fscal) muchInterface->GetStripsStereoAngleFront(iSt), (fscal) muchInterface->GetStripsSpatialRmsFront(iSt),
         (fscal) muchInterface->GetStripsStereoAngleBack(iSt), (fscal) muchInterface->GetStripsSpatialRmsBack(iSt));
       stationInfo.SetTrackingStatus(target.z < stationInfo.GetZdouble() ? true : false);
-      fpInitManager->AddStation(stationInfo);
+      fInitManager.AddStation(stationInfo);
       LOG(info) << "- MuCh station " << iSt << " at z = " << stationInfo.GetZdouble() << " cm";
     }
   }
@@ -583,7 +587,7 @@ InitStatus CbmL1::Init()
       if (iSt == 1 && L1Algo::TrackingMode::kMcbm == fTrackingMode && fMissingHits) {
         stationInfo.SetTrackingStatus(false);
       }
-      fpInitManager->AddStation(stationInfo);
+      fInitManager.AddStation(stationInfo);
       LOG(info) << "- TRD station " << iSt << " at z = " << stationInfo.GetZdouble() << " cm";
     }
   }
@@ -611,7 +615,7 @@ InitStatus CbmL1::Init()
       fscal tofBackSigma  = tofInterface->GetStripsSpatialRmsBack(iSt);
       stationInfo.SetFrontBackStripsGeometry(tofFrontPhi, tofFrontSigma, tofBackPhi, tofBackSigma);
       stationInfo.SetTrackingStatus(target.z < stationInfo.GetZdouble() ? true : false);
-      fpInitManager->AddStation(stationInfo);
+      fInitManager.AddStation(stationInfo);
       LOG(info) << "- TOF station " << iSt << " at z = " << stationInfo.GetZdouble() << " cm";
     }
   }
@@ -762,12 +766,12 @@ InitStatus CbmL1::Init()
     trackingIterAllPrimJump.SetMaxInvMom(1.0 / 0.3);
     trackingIterAllSecJump.SetMaxInvMom(1.0 / 0.3);
 
-    fpInitManager->SetCAIterationsNumberCrosscheck(4);
+    fInitManager.SetCAIterationsNumberCrosscheck(4);
     // Initialize CA track finder iterations sequence
-    fpInitManager->PushBackCAIteration(trackingIterFastPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrimJump);
-    fpInitManager->PushBackCAIteration(trackingIterAllSec);
+    fInitManager.PushBackCAIteration(trackingIterFastPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrimJump);
+    fInitManager.PushBackCAIteration(trackingIterAllSec);
   }
   else if (L1Algo::TrackingMode::kGlobal == fTrackingMode) {
     // SGtrd2d!!
@@ -804,50 +808,50 @@ InitStatus CbmL1::Init()
 
     // Initialize CA track finder iterations sequence
 
-    fpInitManager->SetCAIterationsNumberCrosscheck(1);
+    fInitManager.SetCAIterationsNumberCrosscheck(1);
     /*
-    fpInitManager->SetCAIterationsNumberCrosscheck(5);
-    fpInitManager->PushBackCAIteration(trackingIterFastPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrimJump);
-    fpInitManager->PushBackCAIteration(trackingIterAllSec);
+    fInitManager.SetCAIterationsNumberCrosscheck(5);
+    fInitManager.PushBackCAIteration(trackingIterFastPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrimJump);
+    fInitManager.PushBackCAIteration(trackingIterAllSec);
      */
-    fpInitManager->PushBackCAIteration(trd2dIter2);
+    fInitManager.PushBackCAIteration(trd2dIter2);
   }
   else {
-    fpInitManager->SetCAIterationsNumberCrosscheck(4);
+    fInitManager.SetCAIterationsNumberCrosscheck(4);
     // Initialize CA track finder iterations sequence
-    fpInitManager->PushBackCAIteration(trackingIterFastPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrim);
-    fpInitManager->PushBackCAIteration(trackingIterAllPrimJump);
-    fpInitManager->PushBackCAIteration(trackingIterAllSec);
-    //fpInitManager->PushBackCAIteration(trackingIterAllPrimE);
-    //fpInitManager->PushBackCAIteration(trackingIterAllSecE);
-    //fpInitManager->PushBackCAIteration(trackingIterFastPrimJump);
-    //fpInitManager->PushBackCAIteration(trackingIterFastPrim2);
-    //fpInitManager->PushBackCAIteration(trackingIterAllSecJump);
+    fInitManager.PushBackCAIteration(trackingIterFastPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrim);
+    fInitManager.PushBackCAIteration(trackingIterAllPrimJump);
+    fInitManager.PushBackCAIteration(trackingIterAllSec);
+    //fInitManager.PushBackCAIteration(trackingIterAllPrimE);
+    //fInitManager.PushBackCAIteration(trackingIterAllSecE);
+    //fInitManager.PushBackCAIteration(trackingIterFastPrimJump);
+    //fInitManager.PushBackCAIteration(trackingIterFastPrim2);
+    //fInitManager.PushBackCAIteration(trackingIterAllSecJump);
   }
 
   /**********************
    ** Set special cuts **
    **********************/
 
-  fpInitManager->SetGhostSuppression(fGhostSuppression);
-  fpInitManager->SetTrackingLevel(fTrackingLevel);
-  fpInitManager->SetMomentumCutOff(fMomentumCutOff);
+  fInitManager.SetGhostSuppression(fGhostSuppression);
+  fInitManager.SetTrackingLevel(fTrackingLevel);
+  fInitManager.SetMomentumCutOff(fMomentumCutOff);
 
-  /**********************/
+  /*** Get numbers of active stations ***/
 
-  fpAlgo->Init(fUseHitErrors, fTrackingMode, fMissingHits);
+  fNMvdStations  = fInitManager.GetNstationsActive(L1DetectorID::kMvd);
+  fNStsStations  = fInitManager.GetNstationsActive(L1DetectorID::kSts);
+  fNTrdStations  = fInitManager.GetNstationsActive(L1DetectorID::kTrd);
+  fNMuchStations = fInitManager.GetNstationsActive(L1DetectorID::kMuch);
+  fNTofStations  = fInitManager.GetNstationsActive(L1DetectorID::kTof);
+  fNStations     = fInitManager.GetNstationsActive();
 
-  /*** Get numbers of active stations ***/
 
-  fNMvdStations  = fpInitManager->GetNstationsActive(L1DetectorID::kMvd);
-  fNStsStations  = fpInitManager->GetNstationsActive(L1DetectorID::kSts);
-  fNTrdStations  = fpInitManager->GetNstationsActive(L1DetectorID::kTrd);
-  fNMuchStations = fpInitManager->GetNstationsActive(L1DetectorID::kMuch);
-  fNTofStations  = fpInitManager->GetNstationsActive(L1DetectorID::kTof);
-  fNStations     = fpInitManager->GetNstationsActive();
+  // Send formed parameters object to L1Algo instance
+  fInitManager.SendParameters(fpAlgo);
 
   LOG(info) << "----- Numbers of stations active in tracking -----";
   LOG(info) << "  MVD:    " << fNMvdStations;
@@ -1253,7 +1257,7 @@ void CbmL1::IdealTrackFinder()
     L1Track algoTr;
     algoTr.NHits = 0;
 
-    L1Vector<int> hitIndices("CbmL1::hitIndices", fpAlgo->GetNstations(), -1);
+    L1Vector<int> hitIndices("CbmL1::hitIndices", fpAlgo->GetParameters()->GetNstationsActive(), -1);
 
     for (unsigned int iH = 0; iH < MC.Hits.size(); iH++) {
       const int hitI      = MC.Hits[iH];
@@ -1265,7 +1269,7 @@ void CbmL1::IdealTrackFinder()
     }
 
 
-    for (int iH = 0; iH < fpAlgo->GetNstations(); iH++) {
+    for (int iH = 0; iH < fpAlgo->GetParameters()->GetNstationsActive(); iH++) {
       const int hitI = hitIndices[iH];
       if (hitI < 0) continue;
 
@@ -1276,7 +1280,7 @@ void CbmL1::IdealTrackFinder()
 
     if (algoTr.NHits < 3) continue;
 
-    for (int iH = 0; iH < fpAlgo->GetNstations(); iH++) {
+    for (int iH = 0; iH < fpAlgo->GetParameters()->GetNstationsActive(); iH++) {
       const int hitI = hitIndices[iH];
       if (hitI < 0) continue;
       fpAlgo->fRecoHits.push_back(hitI);
@@ -1580,7 +1584,7 @@ void CbmL1::WriteSIMDKFData()
   }
 }
 
-
+// NOTE: this function should be called before fInitManager.SendParameters(fpAlgo)
 std::vector<L1Material> CbmL1::ReadMaterialBudget(L1DetectorID detectorID)
 {
   std::vector<L1Material> result {};
@@ -1595,11 +1599,11 @@ std::vector<L1Material> CbmL1::ReadMaterialBudget(L1DetectorID detectorID)
                 << fMatBudgetFileName.at(detectorID);
     }
 
-    result.resize(fpInitManager->GetNstationsGeometry(detectorID));
+    result.resize(fInitManager.GetNstationsGeometry(detectorID));
     TString stationNamePrefix = "Radiation Thickness [%], Station";
 
     // NOTE: Loop over geometry stations. We probably do not know which stations are active/inactive (S.Zharko)
-    for (int iSt = 0; iSt < fpInitManager->GetNstationsGeometry(detectorID); ++iSt) {
+    for (int iSt = 0; iSt < fInitManager.GetNstationsGeometry(detectorID); ++iSt) {
       // TODO: Unify material table names (S.Zharko)
       TString stationName = stationNamePrefix + (detectorID == L1DetectorID::kMvd ? iSt : iSt + 1);
       auto* hStaRadLen    = rlFile.Get<TProfile2D>(stationName);
diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h
index 7a44a100e2..eaf828052b 100644
--- a/reco/L1/CbmL1.h
+++ b/reco/L1/CbmL1.h
@@ -52,6 +52,7 @@
 #include "L1Algo/L1Vector.h"
 #include "L1EventEfficiencies.h"
 #include "L1IODataManager.h"
+#include "L1InitManager.h"
 
 class L1Algo;
 class L1Event;
@@ -225,17 +226,11 @@ public:
   /// If the file is undefined, default tracking parameters will be used. Otherwise, the default parameters will be
   /// overridden with ones from the configuration file
   /// \param filename  Name of the input tracking configuration file
-  void SetInputConfigName(const char* filename)
-  {
-    if (fpInitManager) { fpInitManager->SetInputConfigName(std::string(filename)); }
-  }
+  void SetInputConfigName(const char* filename) { fInitManager.SetInputConfigName(std::string(filename)); }
 
   /// \brief Sets a name for the output configuration file
   /// \param filename  Name of the input tracking configuration file
-  void SetOutputConfigName(const char* filename)
-  {
-    if (fpInitManager) { fpInitManager->SetOutputConfigName(std::string(filename)); }
-  }
+  void SetOutputConfigName(const char* filename) { fInitManager.SetOutputConfigName(std::string(filename)); }
 
   /// Sets flag: to correct input hits on MC or not
   /// \param flag: true - hits will be corrected on MC information
@@ -375,7 +370,7 @@ private:
   void WriteSIMDKFData();
 
   /// Gets a pointer to L1InitManager (for an access in run_reco.C)
-  L1InitManager* GetInitManager() { return fpInitManager; }
+  L1InitManager* GetInitManager() { return &fInitManager; }
 
   void SetUseMcHit(int StsUseMcHit = 0, int MuchUseMcHit = 0, int TrdUseMcHit = 0, int TofUseMcHit = 0)
   {
@@ -400,12 +395,11 @@ private:
 public:
   // ** Basic data members **
 
-  L1Algo* fpAlgo               = nullptr;  ///< Pointer to the L1 track finder algorithm
-  L1InitManager* fpInitManager = nullptr;  ///< Pointer to the initialization manager for the L1 algorithm
+  L1Algo* fpAlgo = nullptr;  ///< Pointer to the L1 track finder algorithm
 
+  L1InitManager fInitManager;      ///< Tracking parameters data manager
   L1IODataManager fIODataManager;  ///< Input-output data manager
 
-
   bool fUseHitErrors = true;   ///<
   bool fMissingHits  = false;  ///< Turns on several ad-hock settings for "mcbm_beam_2021_07_surveyed.100ev" setup
 
diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx
index 15fc5ffd90..5e5de1d3f5 100644
--- a/reco/L1/CbmL1Performance.cxx
+++ b/reco/L1/CbmL1Performance.cxx
@@ -306,9 +306,10 @@ void CbmL1::EfficienciesPerformance()
     }
   }
 
-  int sta_nhits[fpAlgo->GetNstations()], sta_nfakes[fpAlgo->GetNstations()];
+  int sta_nhits[fpAlgo->GetParameters()->GetNstationsActive()];
+  int sta_nfakes[fpAlgo->GetParameters()->GetNstationsActive()];
 
-  for (int i = 0; i < fpAlgo->GetNstations(); i++) {
+  for (int i = 0; i < fpAlgo->GetParameters()->GetNstationsActive(); i++) {
     sta_nhits[i]  = 0;
     sta_nfakes[i] = 0;
   }
@@ -445,7 +446,7 @@ void CbmL1::EfficienciesPerformance()
     if (fVerbose > 1) {
       ntra.PrintEff(true, true);
       cout << "Number of true and fake hits in stations: " << endl;
-      for (int i = 0; i < fpAlgo->GetNstations(); i++) {
+      for (int i = 0; i < fpAlgo->GetParameters()->GetNstationsActive(); i++) {
         cout << sta_nhits[i] - sta_nfakes[i] << "+" << sta_nfakes[i] << "   ";
       }
       cout << endl;
diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx
index 473e6f1a51..e1e7ed0e8b 100644
--- a/reco/L1/L1Algo/L1Algo.cxx
+++ b/reco/L1/L1Algo/L1Algo.cxx
@@ -77,27 +77,6 @@ void L1Algo::Init(const bool UseHitErrors, const TrackingMode mode, const bool M
   fUseHitErrors = UseHitErrors;
   fTrackingMode = mode;
   fMissingHits  = MissingHits;
-
-
-  //int NMvdStations = static_cast<int>(geo[ind++]);  // TODO: get rid of NMbdStations (S. Zh.)
-  int nStationsSts     = fInitManager.GetNstationsActive(static_cast<L1DetectorID>(1));
-  fNstationsBeforePipe = fInitManager.GetNstationsActive(static_cast<L1DetectorID>(0));
-  //int NStsStations = static_cast<int>(geo[ind++]);  // TODO: get rid of NStsStations (S. Zh.)
-
-  fNfieldStations = nStationsSts + fNstationsBeforePipe;  // TODO: Provide special getter for it (S.Zharko, 12.05.2022)
-
-  if (fTrackingMode == kMcbm) { fNfieldStations = -1; }
-
-
-  fInitManager.TransferParametersContainer(fParameters);
-  LOG(info) << fParameters.ToString(3);
-
-  // Get number of station
-  fNstations = fParameters.GetNstationsActive();
-
-  fTrackingLevel    = fInitManager.GetTrackingLevel();
-  fGhostSuppression = fInitManager.GetGhostSuppression();
-  fMomentumCutOff   = fInitManager.GetMomentumCutOff();
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -151,6 +130,29 @@ void L1Algo::ReceiveInputData(L1InputData&& inputData)
   }
 }
 
+// ---------------------------------------------------------------------------------------------------------------------
+//
+void L1Algo::ReceiveParameters(L1Parameters&& parameters)
+{
+  fParameters = std::move(parameters);
+
+  //int NMvdStations = static_cast<int>(geo[ind++]);  // TODO: get rid of NMbdStations (S. Zh.)
+  int nStationsSts     = fParameters.GetNstationsActive(static_cast<L1DetectorID>(1));
+  fNstationsBeforePipe = fParameters.GetNstationsActive(static_cast<L1DetectorID>(0));
+  //int NStsStations = static_cast<int>(geo[ind++]);  // TODO: get rid of NStsStations (S. Zh.)
+
+  fNfieldStations = nStationsSts + fNstationsBeforePipe;  // TODO: Provide special getter for it (S.Zharko, 12.05.2022)
+
+  if (fTrackingMode == kMcbm) { fNfieldStations = -1; }
+
+
+  LOG(info) << fParameters.ToString(3);
+
+  fTrackingLevel    = fParameters.GetTrackingLevel();
+  fGhostSuppression = fParameters.GetGhostSuppression();
+  fMomentumCutOff   = fParameters.GetMomentumCutOff();
+}
+
 /// TODO: Move to L1Hit
 void L1Algo::GetHitCoor(const L1Hit& _h, fscal& _x, fscal& _y, char iS)
 {
diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h
index 714e968777..6fa8838d3f 100644
--- a/reco/L1/L1Algo/L1Algo.h
+++ b/reco/L1/L1Algo/L1Algo.h
@@ -49,7 +49,6 @@ class L1AlgoDraw;
 #include "L1Hit.h"
 #include "L1HitPoint.h"
 #include "L1HitsSortHelper.h"
-#include "L1InitManager.h"
 #include "L1InputData.h"
 #include "L1Parameters.h"
 #include "L1Portion.h"
@@ -169,12 +168,12 @@ public:
   /// Gets a pointer to the L1Algo parameters object
   const L1Parameters* GetParameters() const { return &fParameters; }
 
-  /// Gets a pointer to the L1Algo initialization object
-  L1InitManager* GetInitManager() { return &fInitManager; }
-
   /// Receives input data
   void ReceiveInputData(L1InputData&& inputData);
 
+  /// Receives tracking parameters
+  void ReceiveParameters(L1Parameters&& parameters);
+
   /// Gets pointer to input data object for external access
   const L1InputData* GetInputData() const { return &fInputData; }
 
@@ -191,11 +190,6 @@ public:
   inline int PackIndex(const int& a, const int& b, const int& c);
 
   inline int UnPackIndex(const int& i, int& a, int& b, int& c);
-  /// -- Flags routines --
-  [[gnu::always_inline]] static unsigned char GetFStation(unsigned char flag) { return flag / 4; }
-  [[gnu::always_inline]] static bool GetFUsed(unsigned char flag) { return (flag & 0x02) != 0; }
-  //   bool GetFUsedD  ( unsigned char flag ){ return (flag&0x01)!=0; }
-
 
   /// \brief Sets a default particle mass for the track fit
   /// It is used during reconstruction
@@ -278,12 +272,6 @@ public:
     flag = iStation * 4 + (flag % 4);
   }
 
-  [[gnu::always_inline]] void SetFUsed(unsigned char& flag) { flag |= 0x02; }
-  //   void SetFUsedD   ( unsigned char &flag ){ flag |= 0x01; }
-
-  [[gnu::always_inline]] void SetFUnUsed(unsigned char& flag) { flag &= 0xFC; }
-  //   void SetFUnUsedD ( unsigned char &flag ){ flag &= 0xFE; }
-
   /// Prepare the portion of left hits data
   void findSingletsStep0(  // input
     Tindex start_lh, Tindex n1_l, L1HitPoint* Hits_l,
@@ -427,9 +415,6 @@ public:
   void SetNThreads(unsigned int n);
 
 public:
-  /// Gets total number of stations used in tracking
-  int GetNstations() const { return fNstations; }
-
   /// Gets number of stations before the pipe (MVD stations in CBM)
   int GetNstationsBeforePipe() const { return fNstationsBeforePipe; }
 
@@ -443,7 +428,6 @@ public:
   int GetMcTrackIdForUnusedHit(int iHit);
 
 private:
-  int fNstations {0};            ///< number of all detector stations
   int fNstationsBeforePipe {0};  ///< number of stations before pipe (MVD stations in CBM)
   int fNfieldStations {0};       ///< number of stations in the field region
   //alignas(16) L1StationsArray_t fStations {};  ///< array of L1Station objects
@@ -455,7 +439,8 @@ private:
   // ** Member variables list **
   // ***************************
 
-  L1InputData fInputData;  ///< Tracking input data
+  L1Parameters fParameters;  ///< Object of L1Algo parameters class
+  L1InputData fInputData;    ///< Tracking input data
 
   L1Vector<unsigned char> fvHitKeyFlags {
     "L1Algo::fvHitKeyFlags"};  ///< List of key flags: has been this hit or cluster already used
@@ -559,8 +544,6 @@ public:
 
 
 private:
-  L1Parameters fParameters {};           ///< Object of L1Algo parameters class
-  L1InitManager fInitManager {};         ///< Object of L1Algo initialization manager class
   L1ClonesMerger fClonesMerger {*this};  ///< Object of L1Algo clones merger algorithm
 
 #ifdef TBB
diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx
index 174c40869b..c8b3f7909e 100644
--- a/reco/L1/L1Algo/L1CATrackFinder.cxx
+++ b/reco/L1/L1Algo/L1CATrackFinder.cxx
@@ -605,9 +605,9 @@ inline void L1Algo::findTripletsStep0(  // input
   timeR.push_back(fvec_0);
   timeER.push_back(fvec_1);
 
-  assert(istar < fNstations);  //TODO SG!!! check if it is needed
+  assert(istar < fParameters.GetNstationsActive());  //TODO SG!!! check if it is needed
 
-  if (istar >= fNstations) return;
+  if (istar >= fParameters.GetNstationsActive()) return;
 
   // ---- Add the middle hits to parameters estimation. Propagate to right station. ----
 
@@ -1297,7 +1297,7 @@ inline void L1Algo::findTripletsStep3(  // input
 
     fHitNtriplets[ihitl]++;
 
-    if (istal > (fNstations - 4)) continue;
+    if (istal > (fParameters.GetNstationsActive() - 4)) continue;
 
     unsigned int nNeighbours = fHitNtriplets[ihitm];
 
@@ -1339,13 +1339,13 @@ inline void L1Algo::f5(  // input
   if (isec != TRACKS_FROM_TRIPLETS_ITERATION)
 #endif
 
-    for (int istal = fNstations - 4; istal >= fFirstCAstation; istal--) {
+    for (int istal = fParameters.GetNstationsActive() - 4; istal >= fFirstCAstation; istal--) {
       for (int tripType = 0; tripType < 3; tripType++)  // tT = 0 - 123triplet, tT = 1 - 124triplet, tT = 2 - 134triplet
       {
         if ((((isec != kFastPrimJumpIter) && (isec != kAllPrimJumpIter) && (isec != kAllSecJumpIter))
              && (tripType != 0))
             || (((isec == kFastPrimJumpIter) || (isec == kAllPrimJumpIter) || (isec == kAllSecJumpIter))
-                && (tripType != 0) && (istal == fNstations - 4)))
+                && (tripType != 0) && (istal == fParameters.GetNstationsActive() - 4)))
           continue;
 
         int istam = istal + 1;
@@ -1442,7 +1442,7 @@ inline void L1Algo::DupletsStaPort(
   ///   @&i1_2 - index of 1st hit in portion indexed by doublet index
   ///   @&hitsm_2 - index of middle hit in hits array indexed by doublet index
 
-  if (istam < fNstations) {
+  if (istam < fParameters.GetNstationsActive()) {
     const L1Station& stal = fParameters.GetStation(istal);
     const L1Station& stam = fParameters.GetStation(istam);
 
@@ -1550,7 +1550,7 @@ inline void L1Algo::TripletsStaPort(  /// creates triplets:
 
 )
 {
-  if (istar < fNstations) {
+  if (istar < fParameters.GetNstationsActive()) {
     // prepare data
     const L1Station& stam = fParameters.GetStation(istam);
     const L1Station& star = fParameters.GetStation(istar);
@@ -1790,12 +1790,12 @@ void L1Algo::CATrackFinder()
   fRecoHits.clear();
 
   fRecoHits.reserve(2 * fInputData.GetNhits());
-  fTracks.reserve(2 * fInputData.GetNhits() / fNstations);
+  fTracks.reserve(2 * fInputData.GetNhits() / fParameters.GetNstationsActive());
 
   int nNotUsedHits = 0;
 
   // #pragma omp parallel for  reduction(+:nNotUsedHits)
-  for (int ista = 0; ista < fNstations; ++ista) {
+  for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) {
     nNotUsedHits += (fInputData.GetStopHitIndex(ista) - fInputData.GetStartHitIndex(ista));
     HitsUnusedStartIndex[ista] = fInputData.GetStartHitIndex(ista);
     HitsUnusedStopIndex[ista]  = fInputData.GetStopHitIndex(ista);
@@ -1804,7 +1804,7 @@ void L1Algo::CATrackFinder()
   float lasttime  = 0;
   float starttime = std::numeric_limits<float>::max();
 
-  for (int ist = 0; ist < fNstations; ++ist)
+  for (int ist = 0; ist < fParameters.GetNstationsActive(); ++ist)
     for (L1HitIndex_t ih = fInputData.GetStartHitIndex(ist); ih < fInputData.GetStopHitIndex(ist); ++ih) {
 
       const float& time = fInputData.GetHit(ih).t;
@@ -1837,7 +1837,7 @@ void L1Algo::CATrackFinder()
   vHitsUnused = &vNotUsedHits_Buf;
 
 
-  for (int iS = 0; iS < fNstations; ++iS) {
+  for (int iS = 0; iS < fParameters.GetNstationsActive(); ++iS) {
 
     vGridTime[iS].BuildBins(-1, 1, -0.6, 0.6, starttime, lasttime, xStep, yStep, (lasttime - starttime + 1));
     int start = HitsUnusedStartIndex[iS];
@@ -1852,7 +1852,7 @@ void L1Algo::CATrackFinder()
   }
 
 
-  for (int ist = 0; ist < fNstations; ++ist)
+  for (int ist = 0; ist < fParameters.GetNstationsActive(); ++ist)
     for (L1HitIndex_t ih = fInputData.GetStartHitIndex(ist); ih < fInputData.GetStopHitIndex(ist); ++ih) {
       const L1Hit& h = fInputData.GetHit(ih);
       //SetFUnUsed((*fStripFlag)[h.f]);
@@ -1865,7 +1865,7 @@ void L1Algo::CATrackFinder()
       fvHitKeyFlags[h.b] = 0;
     }
 
-  for (int ista = 0; ista < fNstations; ++ista) {
+  for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) {
 #ifdef _OPENMP
 #pragma omp parallel for schedule(dynamic, 5)
 #endif
@@ -1909,7 +1909,7 @@ void L1Algo::CATrackFinder()
     fpCurrentIteration = &caIteration;  // select current iteration
 
     for (int n = 0; n < fNThreads; n++) {
-      for (int j = 0; j < fNstations; j++) {
+      for (int j = 0; j < fParameters.GetNstationsActive(); j++) {
         fTriplets[j][n].clear();
       }
     }
@@ -1932,7 +1932,7 @@ void L1Algo::CATrackFinder()
       vHitPointsUnused_buf                    = vHitsUnused_temp2;
     }
     // TODO: Replace NStations with fInitManager.GetNstationsGeom() (S.Zharko)
-    for (int ist = 0; ist < fNstations; ++ist) {
+    for (int ist = 0; ist < fParameters.GetNstationsActive(); ++ist) {
       for (L1HitIndex_t ih = HitsUnusedStartIndex[ist]; ih < HitsUnusedStopIndex[ist]; ++ih) {
         //SG!!
         fHitFirstTriplet[ih] = 0;
@@ -1940,8 +1940,8 @@ void L1Algo::CATrackFinder()
       }
     }
     /*
-   fHitFirstTriplet.assign(HitsUnusedStopIndex[fNstations-1],0);
-   fHitNtriplets.assign(HitsUnusedStopIndex[fNstations-1],0);
+   fHitFirstTriplet.assign(HitsUnusedStopIndex[fParameters.GetNstationsActive() - 1],0);
+   fHitNtriplets.assign(HitsUnusedStopIndex[fParameters.GetNstationsActive() - 1],0);
 */
     {
       // #pragma omp  task
@@ -1983,7 +1983,7 @@ void L1Algo::CATrackFinder()
       }
 
 #ifndef L1_NO_ASSERT
-      for (int istal = fNstations - 1; istal >= 0; istal--) {
+      for (int istal = fParameters.GetNstationsActive() - 1; istal >= 0; istal--) {
         L1_ASSERT(HitsUnusedStopIndex[istal] >= HitsUnusedStartIndex[istal],
                   HitsUnusedStopIndex[istal] << " >= " << HitsUnusedStartIndex[istal]);
         L1_ASSERT(HitsUnusedStopIndex[istal] <= (*vHitsUnused).size(),
@@ -1995,9 +1995,10 @@ void L1Algo::CATrackFinder()
 
     {
       /// possible left hits of triplets are splited in portions of 16 (4 SIMDs) to use memory faster
-      fDupletPortionStopIndex[fNstations - 1] = 0;
+      fDupletPortionStopIndex[fParameters.GetNstationsActive() - 1] = 0;
       fDupletPortionSize.clear();
-      for (int istal = fNstations - 2; istal >= fFirstCAstation; istal--) {  //start downstream chambers
+      for (int istal = fParameters.GetNstationsActive() - 2; istal >= fFirstCAstation;
+           istal--) {  //start downstream chambers
         int NHits_l   = HitsUnusedStopIndex[istal] - HitsUnusedStartIndex[istal];
         int nPortions = NHits_l / L1Constants::size::kPortionLeftHits;
         int rest      = NHits_l - nPortions * L1Constants::size::kPortionLeftHits;
@@ -2016,10 +2017,10 @@ void L1Algo::CATrackFinder()
 
     /*    {
          /// possible left hits of triplets are splited in portions of 16 (4 SIMDs) to use memory faster
-         fDupletPortionStopIndex[fNstations-1] = 0;
+         fDupletPortionStopIndex[fParameters.GetNstationsActive() - 1] = 0;
          unsigned int ip = 0;  //index of curent portion
 
-         for (int istal = fNstations-2; istal >= fFirstCAstation; istal--)  //start downstream chambers
+         for (int istal = fParameters.GetNstationsActive() - 2; istal >= fFirstCAstation; istal--)  //start downstream chambers
          {
          int nHits = HitsUnusedStopIndex[istal] - HitsUnusedStartIndex[istal];
          
@@ -2072,7 +2073,7 @@ void L1Algo::CATrackFinder()
     /// is exist a doublet started from indexed by left hit
     L1Vector<char> lmDupletsG[L1Constants::size::kMaxNstations] {"L1CATrackFinder::lmDupletsG"};
 
-    for (int i = 0; i < fNstations; i++) {
+    for (int i = 0; i < fParameters.GetNstationsActive(); i++) {
       lmDuplets[i].SetName(std::stringstream() << "L1CATrackFinder::lmDuplets[" << i << "]");
       lmDupletsG[i].SetName(std::stringstream() << "L1CATrackFinder::lmDupletsG[" << i << "]");
     }
@@ -2082,7 +2083,8 @@ void L1Algo::CATrackFinder()
     hitsmG_2.reserve(9000);
     i1G_2.reserve(9000);
 
-    for (int istal = fNstations - 2; istal >= fFirstCAstation; istal--)  // start downstream chambers
+    for (int istal = fParameters.GetNstationsActive() - 2; istal >= fFirstCAstation;
+         istal--)  // start downstream chambers
     {
 
 #ifdef _OPENMP
@@ -2151,7 +2153,7 @@ void L1Algo::CATrackFinder()
     }
 
     //     int nlevels[L1Constants::size::kMaxNstations];  // number of triplets with some number of neighbours.
-    //     for (int il = 0; il < fNstations; ++il) nlevels[il] = 0;
+    //     for (int il = 0; il < fParameters.GetNstationsActive(); ++il) nlevels[il] = 0;
     //
     //      f5(   // input
     //           // output
@@ -2189,7 +2191,7 @@ void L1Algo::CATrackFinder()
     //     int min_level = 1; // min level for start triplet. So min track length = min_level+3.
     //     if (isec == kAllPrimJumpIter) min_level = 1;
     //     if ( (isec == kAllSecIter) || (isec == kAllSecJumpIter) ) min_level = 2; // only the long low momentum tracks
-    // //    if (isec == -1) min_level = fNstations-3 - 3; //only the longest tracks
+    // //    if (isec == -1) min_level = fParameters.GetNstationsActive() - 3 - 3; //only the longest tracks
 
 
     L1Branch curr_tr;
@@ -2205,12 +2207,13 @@ void L1Algo::CATrackFinder()
 
 
     // collect consequtive: the longest tracks, shorter, more shorter and so on
-    for (int firstTripletLevel = fNstations - 3; firstTripletLevel >= min_level; firstTripletLevel--) {
+    for (int firstTripletLevel = fParameters.GetNstationsActive() - 3; firstTripletLevel >= min_level;
+         firstTripletLevel--) {
       // choose length in triplets number - firstTripletLevel - the maximum possible triplet level among all triplets in the searched candidate
       TStopwatch Time;
 
       //  how many levels to check
-      int nlevel = (fNstations - 2) - firstTripletLevel + 1;
+      int nlevel = (fParameters.GetNstationsActive() - 2) - firstTripletLevel + 1;
 
       const unsigned char min_best_l =
         (firstTripletLevel > min_level) ? firstTripletLevel + 2 : min_level + 3;  // loose maximum
@@ -2224,7 +2227,7 @@ void L1Algo::CATrackFinder()
 
       //== Loop over triplets with the required level, find and store track candidates
 
-      for (int istaF = fFirstCAstation; istaF <= fNstations - 3 - firstTripletLevel; ++istaF) {
+      for (int istaF = fFirstCAstation; istaF <= fParameters.GetNstationsActive() - 3 - firstTripletLevel; ++istaF) {
 
         if (--nlevel == 0) break;  //TODO: SG: this is not needed
 
@@ -2453,7 +2456,7 @@ void L1Algo::CATrackFinder()
           }
 #ifdef EXTEND_TRACKS
           if (kGlobal != fTrackingMode && kMcbm != fTrackingMode) {
-            if (tr.NHits != fNstations) BranchExtender(tr);
+            if (tr.NHits != fParameters.GetNstationsActive()) BranchExtender(tr);
           }
 #endif
           float sumTime = 0;
@@ -2542,7 +2545,7 @@ void L1Algo::CATrackFinder()
     if (isec < (fNFindIterations - 1)) {
       int NHitsOnStation = 0;
 
-      for (int ista = 0; ista < fNstations; ++ista) {
+      for (int ista = 0; ista < fParameters.GetNstationsActive(); ++ista) {
         int start                   = HitsUnusedStartIndex[ista];
         int Nelements               = HitsUnusedStopIndex[ista] - start;
         L1Hit* staHits              = nullptr;  // to avoid out-of-range error in ..[start]
diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx
index 718d5037a4..4c15cc8733 100644
--- a/reco/L1/L1Algo/L1InitManager.cxx
+++ b/reco/L1/L1Algo/L1InitManager.cxx
@@ -11,8 +11,8 @@
 #include <algorithm>
 #include <sstream>
 
+#include "L1Algo.h"
 #include "L1Assert.h"
-
 // ----------------------------------------------------------------------------------------------------------------------
 //
 void L1InitManager::AddStation(const L1BaseStationInfo& inStation)
@@ -65,16 +65,14 @@ void L1InitManager::AddStation(const L1BaseStationInfo& inStation)
                  << ")";
     }
 
-    int index = fStationsInfo.size() - 1
-                + (fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
+    int index = fStationsInfo.size() - 1 + fParameters.fNstationsGeometryTotal - fParameters.fNstationsActiveTotal;
     fParameters.fActiveStationGlobalIDs[index] = fStationsInfo.size() - 1;
   }
   else {
-    int index = fStationsInfo.size()
-                + (fNstationsGeometry[fNstationsGeometry.size() - 1] - fNstationsActive[fNstationsActive.size() - 1]);
+    int index = fStationsInfo.size() + fParameters.fNstationsGeometryTotal - fParameters.fNstationsActiveTotal;
     fParameters.fActiveStationGlobalIDs[index] = -1;
-    fNstationsActive[static_cast<L1DetectorID_t>(inStation.GetDetectorID())]--;
-    fNstationsActive[fNstationsActive.size() - 1]--;
+    fParameters.fNstationsActive[static_cast<L1DetectorID_t>(inStation.GetDetectorID())]--;
+    fParameters.fNstationsActiveTotal--;
   }
   LOG(debug) << "L1InitManager: adding a station with stationID = " << inStation.GetStationID()
              << " and detectorID = " << static_cast<int>(inStation.GetDetectorID())
@@ -99,7 +97,7 @@ void L1InitManager::ClearCAIterations()
 }
 
 // ----------------------------------------------------------------------------------------------------------------------
-// NOTE: this function should be called once in the TransferParametersContainer
+// NOTE: this function should be called once in the SendParameters
 void L1InitManager::FormParametersContainer()
 {
   // Read configuration file
@@ -115,10 +113,6 @@ void L1InitManager::FormParametersContainer()
                << fInitController.ToString();
   }
 
-  // Copy station numbers
-  std::copy(fNstationsActive.begin(), fNstationsActive.end(), fParameters.fNstationsActive.begin());
-  std::copy(fNstationsGeometry.begin(), fNstationsGeometry.end(), fParameters.fNstationsGeometry.begin());
-
   // Form array of stations
   auto destinationArrayIterator = fParameters.fStations.begin();
   for (const auto& item : fStationsInfo) {
@@ -193,6 +187,18 @@ void L1InitManager::PushBackCAIteration(const L1CAIteration& iteration)
   fParameters.fCAIterations.push_back(iteration);
 }
 
+// ---------------------------------------------------------------------------------------------------------------------
+//
+bool L1InitManager::SendParameters(L1Algo* pAlgo)
+{
+  // Form parameters cotainer
+  this->FormParametersContainer();
+
+  assert(pAlgo);
+  pAlgo->ReceiveParameters(std::move(fParameters));
+  return true;
+}
+
 // ----------------------------------------------------------------------------------------------------------------------
 //
 void L1InitManager::SetActiveDetectorIDs(const L1DetectorIDSet_t& detectorIDs)
@@ -235,7 +241,7 @@ void L1InitManager::SetGhostSuppression(int ghostSuppression)
     LOG(warn) << "L1InitManager::SetGhostSuppression: attempt of reinitializating the ghost suppresion flag. Ignore";
     return;
   }
-  fGhostSuppression = ghostSuppression;
+  fParameters.fGhostSuppression = ghostSuppression;
   fInitController.SetFlag(EInitKey::kGhostSuppression);
 }
 
@@ -247,7 +253,7 @@ void L1InitManager::SetMomentumCutOff(float momentumCutOff)
     LOG(warn) << "L1InitManager::SetMomentumCutOff: attempt of reinitializating the momentum cutoff value. Ignore";
     return;
   }
-  fMomentumCutOff = momentumCutOff;
+  fParameters.fMomentumCutOff = momentumCutOff;
   fInitController.SetFlag(EInitKey::kMomentumCutOff);
 }
 
@@ -263,8 +269,8 @@ void L1InitManager::SetNstations(L1DetectorID detectorID, int nStations)
   // but it will be ignored inside L1InitManager.
   if (fActiveDetectorIDs.find(detectorID) != fActiveDetectorIDs.end()) {
     if (nStations) {
-      fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)] = nStations;
-      fNstationsActive[static_cast<L1DetectorID_t>(detectorID)]   = nStations;
+      fParameters.fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)] = nStations;
+      fParameters.fNstationsActive[static_cast<L1DetectorID_t>(detectorID)]   = nStations;
     }
     else {
       // TODO: Probably it is better to replace fatal with warn and remove the detectorID from active detectors (S.Zharko)
@@ -278,7 +284,7 @@ void L1InitManager::SetNstations(L1DetectorID detectorID, int nStations)
   if (!fInitController.GetFlag(EInitKey::kStationsNumberCrosscheck)) {
     bool ifInitialized = true;
     for (auto item : fActiveDetectorIDs) {
-      if (fNstationsGeometry[static_cast<L1DetectorID_t>(item)] == 0) {
+      if (fParameters.fNstationsGeometry[static_cast<L1DetectorID_t>(item)] == 0) {
         ifInitialized = false;
         break;
       }
@@ -286,9 +292,9 @@ void L1InitManager::SetNstations(L1DetectorID detectorID, int nStations)
     fInitController.SetFlag(EInitKey::kStationsNumberCrosscheck, ifInitialized);
   }
   if (fInitController.GetFlag(EInitKey::kStationsNumberCrosscheck)) {
-    fNstationsGeometry[L1Constants::size::kMaxNdetectors] =
-      std::accumulate(fNstationsGeometry.begin(), fNstationsGeometry.end() - 1, 0);
-    fNstationsActive[L1Constants::size::kMaxNdetectors] = fNstationsGeometry[L1Constants::size::kMaxNdetectors];
+    fParameters.fNstationsGeometryTotal =
+      std::accumulate(fParameters.fNstationsGeometry.begin(), fParameters.fNstationsGeometry.end(), 0);
+    fParameters.fNstationsActiveTotal = fParameters.fNstationsGeometryTotal;
   }
 }
 
@@ -318,19 +324,10 @@ void L1InitManager::SetTrackingLevel(int trackingLevel)
     LOG(warn) << "L1InitManager::SetTrackingLevel: attempt of reinitialization the tracking level. Ignore";
     return;
   }
-  fTrackingLevel = trackingLevel;
+  fParameters.fTrackingLevel = trackingLevel;
   fInitController.SetFlag(EInitKey::kTrackingLevel);
 }
 
-// ----------------------------------------------------------------------------------------------------------------------
-//
-void L1InitManager::TransferParametersContainer(L1Parameters& destination)
-{
-  this->FormParametersContainer();
-  destination = std::move(fParameters);
-  LOG(info) << "Parameters object transfered to L1Algo core";
-}
-
 //
 // INIT CHECKERS
 //
@@ -383,7 +380,7 @@ void L1InitManager::CheckStationsInfoInit()
     //
     // 2) Check for maximum allowed number of stations
     //
-    int nStationsTotal = fNstationsGeometry[fNstationsGeometry.size() - 1];
+    int nStationsTotal = fParameters.fNstationsGeometryTotal;
     if (nStationsTotal > L1Constants::size::kMaxNstations) {
       LOG(fatal) << "Actual total number of registered stations in geometry (" << nStationsTotal
                  << ") is larger then possible (" << L1Constants::size::kMaxNstations
diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h
index 16e80fb3e7..0f66af6dc8 100644
--- a/reco/L1/L1Algo/L1InitManager.h
+++ b/reco/L1/L1Algo/L1InitManager.h
@@ -30,6 +30,7 @@
 #include <set>
 
 class L1ConfigRW;
+class L1Algo;
 
 /// Forward declaration of the tracking detectors scoped enumeration. Concrete realization of this enumeration must be
 /// determined in the concrete setup class (i.e. CbmL1/BmnL1)
@@ -134,43 +135,40 @@ public:
   void ClearCAIterations();
 
   /// Gets ghost suppression flag
-  int GetGhostSuppression() const { return fGhostSuppression; }
+  int GetGhostSuppression() const { return fParameters.fGhostSuppression; }
 
   /// Gets a name of the input configuration file
   const std::string& GetInputConfigName() const { return fConfigInputName; }
 
   /// Gets momentum cutoff
-  float GetMomentumCutOff() const { return fMomentumCutOff; }
+  float GetMomentumCutOff() const { return fParameters.fMomentumCutOff; }
 
   /// Gets a const reference to L1ObjectInitController
   const InitController_t& GetInitController() const { return fInitController; }
 
-  /// Gets a pointer to L1Parameters instance with a possibility of its fields modification
-  //const L1Parameters* GetParameters() const { return fpParameters; }
-
   /// Gets total number of active stations
-  int GetNstationsActive() const { return fNstationsActive[fNstationsActive.size() - 1]; }
+  int GetNstationsActive() const { return fParameters.fNstationsActiveTotal; }
 
   /// Gets number of active stations for given detector ID
   int GetNstationsActive(L1DetectorID detectorID) const
   {
-    return fNstationsActive[static_cast<L1DetectorID_t>(detectorID)];
+    return fParameters.fNstationsActive[static_cast<L1DetectorID_t>(detectorID)];
   }
 
   /// Gets total number of stations, provided by setup geometry
-  int GetNstationsGeometry() const { return fNstationsGeometry[fNstationsGeometry.size() - 1]; }
+  int GetNstationsGeometry() const { return fParameters.fNstationsGeometryTotal; }
 
   /// Gets number of stations, provided by setup geometry for given detector ID
   int GetNstationsGeometry(L1DetectorID detectorID) const
   {
-    return fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)];
+    return fParameters.fNstationsGeometry[static_cast<L1DetectorID_t>(detectorID)];
   }
 
   /// Gets a name of the output configuration file
   const std::string& GetOutputConfigName() const { return fConfigOutputName; }
 
   /// Gets tracking level
-  int GetTrackingLevel() const { return fTrackingLevel; }
+  int GetTrackingLevel() const { return fParameters.fTrackingLevel; }
 
   /// Calculates L1FieldValue and L1FieldReference values for a selected step in z-axis from the target position
   /// \param zStep step between nodal points
@@ -228,9 +226,10 @@ public:
   /// Sets upper-bound cut on max number of triplets per one doublet
   void SetMaxTripletPerDoublets(unsigned int value) { fParameters.fMaxTripletPerDoublets = value; }
 
-  /// Transfers L1Parameters object to the destination
-  /// \param  destination  Reference to the destination of the L1 object
-  void TransferParametersContainer(L1Parameters& destination);
+  /// Sends (moves) parameters object to the destination reference
+  /// \param  pAlgo  Pointer to the L1 tracking algorithm main class
+  /// \return Success flag
+  bool SendParameters(L1Algo* pAlgo);
 
   // ***************************
   // ** Flags for development **
@@ -282,14 +281,6 @@ private:
 
   std::set<L1BaseStationInfo> fStationsInfo {};  ///< Set of L1BaseStationInfo objects
 
-  /// Numbers of stations, which are active in tracking. Index of an array element (except the last one) corresponds to a given
-  /// L1DetectorID of the detector subsystem. The last array element corresponds to the total number of stations.
-  std::array<int, L1Constants::size::kMaxNdetectors + 1> fNstationsActive {};
-
-  /// Actual numbers of stations, provided by geometry. Index of an array element (except the last one) corresponds to a given
-  /// L1DetectorID of the detector subsystem. The last array element corresponds to the total number of stations.
-  std::array<int, L1Constants::size::kMaxNdetectors + 1> fNstationsGeometry {};
-
   /// A function which returns magnetic field vector B in a radius-vector xyz
   L1FieldFunction_t fFieldFunction {[](const double (&)[3], double (&)[3]) {}};
   // NOTE: Stations of detectors which will not be assigned as active, will not be included in the tracking!
@@ -300,10 +291,6 @@ private:
 
   L1Parameters fParameters {};  ///< L1Algo parameters object
 
-  int fTrackingLevel {0};     ///< tracking level
-  int fGhostSuppression {0};  ///< flag: if true, ghost tracks are suppressed
-  float fMomentumCutOff {0};  ///< minimum momentum of tracks
-
   // * Configuration related *
   std::string fConfigInputName {""};              ///< name for the input configuration file
   std::string fConfigOutputName {""};             ///< name for the output configuration file
diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx
index 1ec8e92e60..ca1b313ab9 100644
--- a/reco/L1/L1Algo/L1Parameters.cxx
+++ b/reco/L1/L1Algo/L1Parameters.cxx
@@ -33,9 +33,14 @@ L1Parameters::L1Parameters(const L1Parameters& other) noexcept
   , fVertexFieldRegion(other.fVertexFieldRegion)
   , fStations(other.fStations)
   , fThickMap(other.fThickMap)
-  , fNstationsActive(other.fNstationsActive)
+  , fNstationsGeometryTotal(other.fNstationsGeometryTotal)
+  , fNstationsActiveTotal(other.fNstationsActiveTotal)
   , fNstationsGeometry(other.fNstationsGeometry)
+  , fNstationsActive(other.fNstationsActive)
   , fActiveStationGlobalIDs(other.fActiveStationGlobalIDs)
+  , fTrackingLevel(other.fTrackingLevel)
+  , fGhostSuppression(other.fGhostSuppression)
+  , fMomentumCutOff(other.fMomentumCutOff)
   , fDevIsIgnoreHitSearchAreas(other.fDevIsIgnoreHitSearchAreas)
   , fDevIsFitSingletsFromTarget(other.fDevIsFitSingletsFromTarget)
   , fDevIsMatchDoubletsViaMc(other.fDevIsMatchDoubletsViaMc)
@@ -78,9 +83,14 @@ void L1Parameters::Swap(L1Parameters& other) noexcept
   std::swap(fVertexFieldRegion, other.fVertexFieldRegion);
   std::swap(fStations, other.fStations);
   std::swap(fThickMap, other.fThickMap);
-  std::swap(fNstationsActive, other.fNstationsActive);
+  std::swap(fNstationsGeometryTotal, other.fNstationsGeometryTotal);
+  std::swap(fNstationsActiveTotal, other.fNstationsActiveTotal);
   std::swap(fNstationsGeometry, other.fNstationsGeometry);
+  std::swap(fNstationsActive, other.fNstationsActive);
   std::swap(fActiveStationGlobalIDs, other.fActiveStationGlobalIDs);
+  std::swap(fTrackingLevel, other.fTrackingLevel);
+  std::swap(fGhostSuppression, other.fGhostSuppression);
+  std::swap(fMomentumCutOff, other.fMomentumCutOff);
   std::swap(fDevIsIgnoreHitSearchAreas, other.fDevIsIgnoreHitSearchAreas);
   std::swap(fDevIsFitSingletsFromTarget, other.fDevIsFitSingletsFromTarget);
   std::swap(fDevIsMatchDoubletsViaMc, other.fDevIsMatchDoubletsViaMc);
@@ -101,13 +111,12 @@ void L1Parameters::CheckConsistency() const
    *
    */
 
-  if (std::accumulate(fNstationsGeometry.cbegin(), fNstationsGeometry.cend() - 1, 0)
-      != *(fNstationsGeometry.cend() - 1)) {
+  if (std::accumulate(fNstationsGeometry.cbegin(), fNstationsGeometry.cend(), 0) != fNstationsGeometryTotal) {
     throw std::logic_error("L1Parameters: invalid object condition: total number of stations provided by geometry "
                            "differs from the sum of the station numbers for individual detector subsystems");
   };
 
-  if (std::accumulate(fNstationsActive.cbegin(), fNstationsActive.cend() - 1, 0) != *(fNstationsActive.cend() - 1)) {
+  if (std::accumulate(fNstationsActive.cbegin(), fNstationsActive.cend(), 0) != fNstationsActiveTotal) {
     throw std::logic_error("L1Parameters: invalid object condition: total number of stations active in tracking "
                            "differs from the sum of the station numbers for individual detector subsystems");
   };
@@ -123,10 +132,10 @@ void L1Parameters::CheckConsistency() const
   auto filterInactiveStationIDs = [](int x) { return x != -1; };
   int nStationsCheck =
     std::count_if(fActiveStationGlobalIDs.cbegin(), fActiveStationGlobalIDs.cend(), filterInactiveStationIDs);
-  if (nStationsCheck != *(fNstationsActive.cend() - 1)) {
+  if (nStationsCheck != fNstationsActiveTotal) {
     std::stringstream msg;
     msg << "L1Parameters: invalid object condition: array of active station IDs is not consistent "
-        << "with the total number of stations (" << nStationsCheck << " vs. " << *(fNstationsActive.cend() - 1) << ' '
+        << "with the total number of stations (" << nStationsCheck << " vs. " << fNstationsActiveTotal << ' '
         << "expected)";
     throw std::logic_error(msg.str());
   }
@@ -177,7 +186,7 @@ void L1Parameters::CheckConsistency() const
    *       L1MaterialInfo, etc. (S.Zharko)
    */
 
-  for (int iSt = 0; iSt < *(fNstationsActive.cend() - 1); ++iSt) {
+  for (int iSt = 0; iSt < fNstationsActiveTotal; ++iSt) {
     fStations[iSt].CheckConsistency();
     if (fStations[iSt].z[0] < fTargetPos[2][0]) {
       std::stringstream msg;
@@ -194,7 +203,7 @@ void L1Parameters::CheckConsistency() const
    *       all the stations in array but only until *(fNstationsActive.cend() - 1) (== NstationsActiveTotal).
    */
 
-  for (int iSt = 0; iSt < *(fNstationsActive.cend() - 1); ++iSt) {
+  for (int iSt = 0; iSt < fNstationsActiveTotal; ++iSt) {
     fThickMap[iSt].CheckConsistency();
   }
 
@@ -247,15 +256,15 @@ std::string L1Parameters::ToString(int verbosity, int indentLevel) const
   aStream << indent << indentChar << "NUMBER OF STATIONS:\n";
   aStream << indent << indentChar << indentChar << "Number of stations (Geometry): ";
   for (int idx = 0; idx < int(fNstationsGeometry.size()); ++idx) {
-    if (int(fNstationsGeometry.size() - 1) == idx) { aStream << " | total = "; }
     aStream << std::setw(2) << std::setfill(' ') << fNstationsGeometry[idx] << ' ';
   }
+  aStream << " | total = " << std::setw(2) << std::setfill(' ') << fNstationsGeometryTotal;
   aStream << '\n';
   aStream << indent << indentChar << indentChar << "Number of stations (Active):   ";
   for (int idx = 0; idx < int(fNstationsActive.size()); ++idx) {
-    if (int(fNstationsActive.size() - 1) == idx) { aStream << " | total = "; }
     aStream << std::setw(2) << std::setfill(' ') << fNstationsActive[idx] << ' ';
   }
+  aStream << " | total = " << std::setw(2) << std::setfill(' ') << fNstationsActiveTotal;
   aStream << '\n';
   aStream << indent << indentChar << indentChar << "Active station indeces: ";
   for (int idx = 0; idx < *(fNstationsActive.end() - 1); ++idx) {
diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h
index 650cbc0829..ddf9daf02a 100644
--- a/reco/L1/L1Algo/L1Parameters.h
+++ b/reco/L1/L1Algo/L1Parameters.h
@@ -35,6 +35,13 @@ using L1MaterialContainer_t   = std::array<L1Material, L1Constants::size::kMaxNs
 /// L1InitManager class and then moved to the L1Algo instance.
 ///
 class alignas(L1Constants::misc::kAlignment) L1Parameters {
+
+  // ********************************
+  // ** Friend classes declaration **
+  // ********************************
+
+  friend class L1InitManager;
+
   using L1DetectorID_t = std::underlying_type_t<L1DetectorID>;
 
 public:
@@ -78,7 +85,7 @@ public:
   unsigned int GetMaxTripletPerDoublets() const { return fMaxTripletPerDoublets; }
 
   /// Gets total number of active stations
-  int GetNstationsActive() const { return fNstationsActive[fNstationsActive.size() - 1]; }
+  int GetNstationsActive() const { return fNstationsActiveTotal; }
 
   /// Gets number of active stations for given detector ID
   int GetNstationsActive(L1DetectorID detectorID) const
@@ -87,7 +94,7 @@ public:
   }
 
   /// Gets total number of stations, provided by setup geometry
-  int GetNstationsGeometry() const { return fNstationsGeometry[fNstationsGeometry.size() - 1]; }
+  int GetNstationsGeometry() const { return fNstationsGeometryTotal; }
 
   /// Gets number of stations, provided by setup geometry for given detector ID
   int GetNstationsGeometry(L1DetectorID detectorID) const
@@ -98,7 +105,7 @@ public:
   /// Calculates global index of station among geometry (accounts for inactive stations)
   /// \param localIndex  index of the detector subsystem module/station/layer provided by detector subsystem experts
   /// \param detectorID  ID of the detector subsystem
-  __attribute__((always_inline)) int GetStationIndexGeometry(int localIndex, L1DetectorID detectorID) const
+  [[gnu::always_inline]] int GetStationIndexGeometry(int localIndex, L1DetectorID detectorID) const
   {
     return localIndex
            + std::accumulate(fNstationsGeometry.cbegin(), fNstationsGeometry.cbegin() + static_cast<int>(detectorID),
@@ -108,7 +115,7 @@ public:
   /// Calculates global index of station used by track finder
   /// \param localIndex  index of the detector subsystem module/station/layer provided by detector subsystem experts
   /// \param detectorID  ID of the detector subsystem
-  __attribute__((always_inline)) int GetStationIndexActive(int localIndex, L1DetectorID detectorID) const
+  [[gnu::always_inline]] int GetStationIndexActive(int localIndex, L1DetectorID detectorID) const
   {
     return fActiveStationGlobalIDs[GetStationIndexGeometry(localIndex, detectorID)];
   }
@@ -147,10 +154,13 @@ public:
     return fThickMap[iStActive].GetRadThick(xPos, yPos);
   }
 
-  /// Gets target position
-  /// \param iDimension  Component of target position: 0 - x, 1 - y, 2 - z
+  /// Gets X component of target position
   fvec GetTargetPositionX() const { return fTargetPos[0]; }
+
+  /// Gets Y component of target position
   fvec GetTargetPositionY() const { return fTargetPos[1]; }
+
+  /// Gets Z component of target position
   fvec GetTargetPositionZ() const { return fTargetPos[2]; }
 
   /// Gets L1FieldRegion object at primary vertex
@@ -159,6 +169,15 @@ public:
   /// Gets L1FieldValue object at primary vertex
   const L1FieldValue& GetVertexFieldValue() const { return fVertexFieldValue; }
 
+  /// Gets ghost suppression flag
+  int GetGhostSuppression() const { return fGhostSuppression; }
+
+  /// Gets tracking level
+  int GetTrackingLevel() const { return fTrackingLevel; }
+
+  /// Gets momentum cutoff
+  float GetMomentumCutOff() const { return fMomentumCutOff; }
+
   /// Class invariant checker
   void CheckConsistency() const;
 
@@ -203,13 +222,16 @@ private:
   /// Array of station thickness map
   alignas(L1Constants::misc::kAlignment) L1MaterialContainer_t fThickMap {};
 
-  /// Numbers of stations, which are active in tracking. Index of an array element (except the last one) corresponds to a given
-  /// L1DetectorID of the detector subsystem. The last array element corresponds to the total number of stations.
-  alignas(L1Constants::misc::kAlignment) std::array<int, (L1Constants::size::kMaxNdetectors + 1)> fNstationsActive {};
+  int fNstationsGeometryTotal = -1;  ///< total number of stations, provided by geometry
+  int fNstationsActiveTotal   = -1;  ///< total number of active tracking stations
 
   /// Actual numbers of stations, provided by geometry. Index of an array element (except the last one) corresponds to a given
   /// L1DetectorID of the detector subsystem. The last array element corresponds to the total number of stations.
-  alignas(L1Constants::misc::kAlignment) std::array<int, (L1Constants::size::kMaxNdetectors + 1)> fNstationsGeometry {};
+  alignas(L1Constants::misc::kAlignment) std::array<int, L1Constants::size::kMaxNdetectors> fNstationsGeometry = {};
+
+  /// Numbers of stations, which are active in tracking. Index of an array element (except the last one) corresponds to a given
+  /// L1DetectorID of the detector subsystem. The last array element corresponds to the total number of stations.
+  alignas(L1Constants::misc::kAlignment) std::array<int, L1Constants::size::kMaxNdetectors> fNstationsActive = {};
 
   /// Map of the actual detector indexes to the active detector indexes
   /// The vector maps actual station index (which is defined by ) to the index of station in tracking. If the station is inactive,
@@ -218,6 +240,10 @@ private:
   ///   active index:  0 -1  1  2 -1  3  4  5  6  7  0  0  0  0
   alignas(L1Constants::misc::kAlignment) std::array<int, L1Constants::size::kMaxNstations> fActiveStationGlobalIDs {};
 
+  int fTrackingLevel    = 0;  ///< tracking level
+  int fGhostSuppression = 0;  ///< flag: if true, ghost tracks are suppressed
+  float fMomentumCutOff = 0;  ///< minimum momentum of tracks
+
   // ***************************
   // ** Flags for development **
   // ***************************
@@ -230,11 +256,6 @@ private:
 
   bool fDevIsMatchTripletsViaMc {false};  ///< Flag to match triplets using Mc information
 
-  // ********************************
-  // ** Friend classes declaration **
-  // ********************************
-
-  friend class L1InitManager;
 };
 
 #endif  // L1Parameters_h
diff --git a/reco/L1/L1Algo/L1TrackExtender.cxx b/reco/L1/L1Algo/L1TrackExtender.cxx
index 6c8effd6f3..c3c212081e 100644
--- a/reco/L1/L1Algo/L1TrackExtender.cxx
+++ b/reco/L1/L1Algo/L1TrackExtender.cxx
@@ -193,7 +193,7 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir,
                           const fvec qp0)  // TODO take into account pipe
 {
   L1Vector<L1HitIndex_t> newHits {"L1TrackExtender::newHits"};
-  newHits.reserve(fNstations);
+  newHits.reserve(fParameters.GetNstationsActive());
   L1Fit fit;
   fit.SetParticleMass(GetDefaultParticleMass());
 
@@ -243,7 +243,7 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir,
 
   const fvec pickGather2 = fPickGather * fPickGather;
 
-  for (; (ista < fNstations) && (ista >= 0); ista += step) {  // CHECKME why ista2?
+  for (; (ista < fParameters.GetNstationsActive()) && (ista >= 0); ista += step) {  // CHECKME why ista2?
 
     const L1Station& sta = fParameters.GetStation(ista);
 
diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx
index 7a53988da7..a7f9cd30e4 100644
--- a/reco/L1/L1Algo/L1TrackFitter.cxx
+++ b/reco/L1/L1Algo/L1TrackFitter.cxx
@@ -331,7 +331,7 @@ void L1Algo::L1KFTrackFitter()
   L1FieldValue fldB01, fldB11, fldB21 _fvecalignment;
   L1FieldRegion fld1 _fvecalignment;
 
-  const int nHits = fNstations;
+  const int nHits = fParameters.GetNstationsActive();
   int iVec = 0, i = 0;
   int nTracks_SIMD = fvecLen;
   L1TrackPar T;  // fitting parametr coresponding to current track
@@ -796,7 +796,7 @@ void L1Algo::L1KFTrackFitterMuch()
   L1FieldValue fldB01, fldB11, fldB21 _fvecalignment;
   L1FieldRegion fld1 _fvecalignment;
 
-  const int nHits = fNstations;
+  const int nHits = fParameters.GetNstationsActive();
   int iVec = 0, i = 0;
   int nTracks_SIMD = fvecLen;
   L1TrackPar T;  // fitting parametr coresponding to current track
@@ -882,7 +882,7 @@ void L1Algo::L1KFTrackFitterMuch()
     }
 
     for (iVec = 0; iVec < nTracks_SIMD; iVec++) {
-      for (i = 0; i < fNstations; i++) {
+      for (i = 0; i < fParameters.GetNstationsActive(); i++) {
         d_xx[i][iVec] = 0;
         d_yy[i][iVec] = 0;
       }
diff --git a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
index 5038852749..64c0b43332 100644
--- a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
+++ b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
@@ -96,7 +96,7 @@ void CbmL1PFFitter::Fit(vector<CbmStsTrack>& Tracks, vector<int>& pidHypo)
   TClonesArray* listMvdHits = 0;
   if (NMvdStations > 0.) listMvdHits = (TClonesArray*) fManger->GetObject("MvdHit");
 
-  static int nHits = CbmL1::Instance()->fpAlgo->GetNstations();
+  static int nHits = CbmL1::Instance()->fpAlgo->GetParameters()->GetNstationsActive();
   int iVec = 0, i = 0;
   int nTracks_SIMD = fvecLen;
   L1TrackPar T;  // fitting parametr coresponding to current track
@@ -406,7 +406,7 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<L1FieldRe
 
   CbmStsTrack* t[fvecLen];
 
-  int nStations        = CbmL1::Instance()->fpAlgo->GetNstations();
+  int nStations        = CbmL1::Instance()->fpAlgo->GetParameters()->GetNstationsActive();
   int NMvdStations     = CbmL1::Instance()->fpAlgo->GetNstationsBeforePipe();
   const L1Station* sta = CbmL1::Instance()->fpAlgo->GetParameters()->GetStations().begin();
   fvec* zSta       = new fvec[nStations];
-- 
GitLab