From 4b8674f95b83209bd25a8c9e6c7c581d43b284b8 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Sat, 30 Sep 2023 22:46:31 +0000
Subject: [PATCH] Ca: cleanup of algo/ca

---
 algo/ca/core/data/CaTrack.cxx            |   5 +
 algo/ca/core/data/CaTrack.h              |  71 +++---
 algo/ca/core/pars/CaConstants.h          | 285 ++++++++++++-----------
 reco/L1/CMakeLists.txt                   |   1 -
 reco/L1/CbmCaMCModule.cxx                |   4 +-
 reco/L1/CbmCaMCModule.h                  |  15 +-
 reco/L1/CbmCaTimeSliceReader.cxx         |  15 +-
 reco/L1/CbmCaTimeSliceReader.h           |   2 +-
 reco/L1/CbmL1MCTrack.cxx                 |   4 +-
 reco/L1/CbmL1Performance.cxx             |  23 +-
 reco/L1/CbmL1Track.h                     |   8 +-
 reco/L1/CbmL1TrackPar.h                  |   8 +-
 reco/L1/CbmL1Util.cxx                    |  56 ++---
 reco/L1/CbmL1Util.h                      |   8 +-
 reco/L1/L1Algo/L1Algo.cxx                |   4 +-
 reco/L1/L1Algo/L1Algo.h                  |  34 +--
 reco/L1/L1Algo/L1BaseStationInfo.cxx     |   4 +-
 reco/L1/L1Algo/L1CAIteration.cxx         |   8 +-
 reco/L1/L1Algo/L1CaTrackFinderSlice.cxx  |  19 +-
 reco/L1/L1Algo/L1ConfigRW.cxx            |   2 +-
 reco/L1/L1Algo/L1Field.cxx               |  14 +-
 reco/L1/L1Algo/L1Field.h                 |   5 +-
 reco/L1/L1Algo/L1Fit.h                   |   2 +-
 reco/L1/L1Algo/L1IODataManager.cxx       |   6 +-
 reco/L1/L1Algo/L1IODataManager.h         |   4 +-
 reco/L1/L1Algo/L1InitManager.cxx         |  35 +--
 reco/L1/L1Algo/L1InitManager.h           |   6 +-
 reco/L1/L1Algo/L1InputData.h             |   2 +-
 reco/L1/L1Algo/L1Material.h              |  19 +-
 reco/L1/L1Algo/L1MaterialMonitor.cxx     |  12 +-
 reco/L1/L1Algo/L1MaterialMonitor.h       |  18 +-
 reco/L1/L1Algo/L1Parameters.cxx          |  47 ++--
 reco/L1/L1Algo/L1Parameters.h            |  42 ++--
 reco/L1/L1Algo/L1Station.h               |  15 +-
 reco/L1/L1Algo/L1TrackFitter.cxx         |  24 +-
 reco/L1/L1Algo/L1TrackPar.h              |  52 ++---
 reco/L1/L1Algo/L1TripletConstructor.cxx  |   4 +-
 reco/L1/L1Algo/L1UMeasurementInfo.h      |   6 +-
 reco/L1/L1Algo/L1Undef.h                 |  70 ------
 reco/L1/L1Algo/L1XYMeasurementInfo.h     |  20 +-
 reco/L1/L1Algo/utils/CaUvConverter.h     |  18 +-
 reco/L1/L1Algo/utils/L1Utils.h           |  74 ------
 reco/L1/L1LinkDef.h                      |   1 -
 reco/L1/catools/CaToolsLinkKey.h         |   8 +-
 reco/L1/catools/CaToolsMCData.h          |   4 +-
 reco/L1/catools/CaToolsMCPoint.h         |  52 +++--
 reco/L1/catools/CaToolsMCTrack.h         |  40 ++--
 reco/L1/catools/CaToolsWindowFinder.cxx  |   8 +-
 reco/L1/qa/CbmCaInputQaBase.cxx          |   4 +-
 reco/L1/qa/CbmCaTrackFitQa.h             |   2 +-
 reco/L1/utils/CbmCaIdealHitProducerDet.h |  14 +-
 51 files changed, 548 insertions(+), 656 deletions(-)
 delete mode 100644 reco/L1/L1Algo/L1Undef.h
 delete mode 100644 reco/L1/L1Algo/utils/L1Utils.h

diff --git a/algo/ca/core/data/CaTrack.cxx b/algo/ca/core/data/CaTrack.cxx
index b8dca2126c..b44c681744 100644
--- a/algo/ca/core/data/CaTrack.cxx
+++ b/algo/ca/core/data/CaTrack.cxx
@@ -2,4 +2,9 @@
    SPDX-License-Identifier: GPL-3.0-only
    Authors: Sergei Zharko [committer] */
 
+/// \file   CaTrack.h
+/// \brief  source file for the ca::Track class
+/// \since  02.06.2022
+/// \author S.Zharko <s.zharko@gsi.de>
+
 #include "CaTrack.h"
diff --git a/algo/ca/core/data/CaTrack.h b/algo/ca/core/data/CaTrack.h
index cbb0788173..ce49832536 100644
--- a/algo/ca/core/data/CaTrack.h
+++ b/algo/ca/core/data/CaTrack.h
@@ -2,66 +2,52 @@
    SPDX-License-Identifier: GPL-3.0-only
    Authors: Ivan Kisel,  Sergey Gorbunov, Maksym Zyzak, Igor Kulakov [committer], Sergei Zharko */
 
-/*
- *====================================================================
- *
- *  CBM Level 1 Reconstruction 
- *  
- *  Authors: I.Kisel,  S.Gorbunov
- *
- *  e-mail : ikisel@kip.uni-heidelberg.de 
- *
- *====================================================================
- *
- *  L1 track class
- *
- *====================================================================
- */
+
+/// \file   CaTrack.h
+/// \brief  header file for the ca::Track class
+/// \since  02.06.2022
+/// \author S.Zharko <s.zharko@gsi.de>
 
 #ifndef CBM_ALGO_CA_TRACK
 #define CBM_ALGO_CA_TRACK 1
 
 #include <boost/serialization/access.hpp>
 
-#include <limits>
-
+#include "CaConstants.h"
 #include "CaSimd.h"
+
 namespace cbm::algo::ca
 {
   /// @class cbm::algo::ca::Track
-  /// @brief Class representing a track in the L1 tracking algorithm
+  /// @brief Class representing an output track in the CA tracking algorithm
   ///
-  /// Track parameters vector: {x, y, tx, ty, q/p, z, t}
+  /// Track parameters vector: {x, y, tx, ty, q/p, z, t, vi}
   /// Covariation matrix: C[20] (C55) corresponds to the time variance
   ///
   class Track {
   public:
-    static constexpr float kNaN {std::numeric_limits<float>::signaling_NaN()};
-    static constexpr int kNparTr {8};
-    static constexpr int kNparCov {28};
+    friend class boost::serialization::access;
 
-    // TODO: SZh. 14.09.2023: Replace with std::array
-    unsigned char fNofHits {0};        ///< Number of hits in track
-    fscal fParFirst[kNparTr] {kNaN};   ///< Track parameters on the first station
-    fscal fCovFirst[kNparCov] {kNaN};  ///< Track parameter covariation matrix elements on the first station
-    fscal fParLast[kNparTr] {kNaN};    ///< Track parameters on the last station
-    fscal fCovLast[kNparCov] {kNaN};   ///< Track parameter covariation matrix elements on the second station
-    fscal fParPV[kNparTr] {kNaN};      ///< Track parameters in the primary vertex
-    fscal fCovPV[kNparCov] {kNaN};     ///< Track parameter covariation matrix elements in the primary vertex
-    fscal fChi2 {kNaN};                ///< Track fit chi-square value
-    short int fNDF {0};                ///< Track fit NDF value
+    Track()
+    {
+      fParFirst.fill(constants::undef::Fscal);
+      fParLast.fill(constants::undef::Fscal);
+      fParPV.fill(constants::undef::Fscal);
+      fCovFirst.fill(constants::undef::Fscal);
+      fCovLast.fill(constants::undef::Fscal);
+      fCovPV.fill(constants::undef::Fscal);
+    }
 
-    friend class boost::serialization::access;
     template<class Archive>
     void serialize(Archive& ar, const unsigned int /*version*/)
     {
       ar& fNofHits;
-      for (int i = 0; i < kNparTr; ++i) {
+      for (int i = 0; i < NparTr; ++i) {
         ar& fParFirst[i];
         ar& fParLast[i];
         ar& fParPV[i];
       }
-      for (int i = 0; i < kNparCov; ++i) {
+      for (int i = 0; i < NparCov; ++i) {
         ar& fCovFirst[i];
         ar& fCovLast[i];
         ar& fCovPV[i];
@@ -69,6 +55,21 @@ namespace cbm::algo::ca
       ar& fChi2;
       ar& fNDF;
     }
+
+  public:
+    static constexpr int NparTr {8};
+    static constexpr int NparCov {28};
+
+    int fNofHits {constants::undef::Int};  ///< Number of hits in track
+
+    std::array<fscal, NparTr> fParFirst;    ///< Track parameters on the first station
+    std::array<fscal, NparCov> fCovFirst;   ///< Track parameter covariation matrix elements on the first station
+    std::array<fscal, NparTr> fParLast;     ///< Track parameters on the last station
+    std::array<fscal, NparCov> fCovLast;    ///< Track parameter covariation matrix elements on the second station
+    std::array<fscal, NparTr> fParPV;       ///< Track parameters in the primary vertex
+    std::array<fscal, NparCov> fCovPV;      ///< Track parameter covariation matrix elements in the primary vertex
+    fscal fChi2 {constants::undef::Fscal};  ///< Track fit chi-square value
+    int fNDF {constants::undef::Int};       ///< Track fit NDF value
   };
 }  // namespace cbm::algo::ca
 
diff --git a/algo/ca/core/pars/CaConstants.h b/algo/ca/core/pars/CaConstants.h
index d21238b7e4..0e233fbebc 100644
--- a/algo/ca/core/pars/CaConstants.h
+++ b/algo/ca/core/pars/CaConstants.h
@@ -2,48 +2,46 @@
    SPDX-License-Identifier: GPL-3.0-only
    Authors: Sergey Gorbunov, Sergei Zharko [committer] */
 
-/************************************************************************************************************
- * @file   L1Constants.h
- * @brief  Compile-time constants definition for the L1 tracking algorithm
- * @since  02.06.2022
- * @author S.Zharko <s.zharko@gsi.de>
- ***********************************************************************************************************/
+/// \file   CaConstants.h
+/// \brief  Compile-time constants definition for the CA tracking algorithm
+/// \since  02.06.2022
+/// \author S.Zharko <s.zharko@gsi.de>
 
 #ifndef CA_CORE_CONSTANTS
 #define CA_CORE_CONSTANTS 1
 
+#include <limits>
+
 #include "CaSimd.h"
-using cbm::algo::ca::fmask;
-using cbm::algo::ca::fscal;  // TODO: remove "using" from headers
-using cbm::algo::ca::fvec;   // TODO: remove "using" from headers
 
-/// Namespace contains compile-time constants definition for the L1 tracking algorithm
+/// Namespace contains compile-time constants definition for the CA tracking algorithm
+///
 namespace cbm::algo::ca::constants
 {
-  using cbm::algo::ca::fvec;
 
   /// Array sizes
   namespace size
   {
-    /// Amount of coefficients in field approximations
-    constexpr int kMaxNFieldApproxCoefficients {21};  // TODO: May be it is better to use the polynomial
-                                                      // order instead of this?
     /// Order of polynomial to approximate field in the vicinity of station plane
-    constexpr int kMaxFieldApproxPolynomialOrder {5};
+    constexpr int MaxFieldApproxPolynomialOrder {5};
 
-    /// Amount of bits to code a station, thread or triplet. This values determine the ma
-    constexpr unsigned int kStationBits = 6u;                  ///< Amount of bits to code one station
-    constexpr unsigned int kTripletBits = 32u - kStationBits;  ///< Amount of bits to code one triplet
+    /// Amount of coefficients in field approximations
+    constexpr int MaxNFieldApproxCoefficients {(MaxFieldApproxPolynomialOrder + 1) * (MaxFieldApproxPolynomialOrder + 2)
+                                               / 2};
 
-    constexpr int kMaxNdetectors = 5;                   ///< Max number of tracking detectors
-    constexpr int kMaxNstations  = 1u << kStationBits;  ///< Max number of stations, 2^6  = 64
-    constexpr int kMaxNtriplets  = 1u << kTripletBits;  ///< Max number of triplets, 2^26 = 67,108,864
+    /// Amount of bits to code a station or triplet. This values determine the maximum number of stations and tripülets
+    constexpr unsigned int StationBits = 6u;                 ///< Amount of bits to code one station
+    constexpr unsigned int TripletBits = 32u - StationBits;  ///< Amount of bits to code one triplet
 
-    constexpr uint8_t kDetBits = 4u;  // Max 16 detectors
+    constexpr int MaxNdetectors = 5;                  ///< Max number of tracking detectors
+    constexpr int MaxNstations  = 1u << StationBits;  ///< Max number of stations, 2^6  = 64
+    constexpr int MaxNtriplets  = 1u << TripletBits;  ///< Max number of triplets, 2^26 = 67,108,864
+
+    constexpr uint8_t DetBits = 4u;  ///< Maximum 16 detector systems
 
     /// Max number of track groups
-    /// NOTE: For a "track group" definition see L1Parameters.h, GetSearchWindow function
-    constexpr int kMaxNtrackGroups = 4;
+    /// NOTE: For a "track group" definition see CaParameters.h, GetSearchWindow function
+    constexpr int MaxNtrackGroups = 4;
 
   }  // namespace size
 
@@ -51,149 +49,172 @@ namespace cbm::algo::ca::constants
   /// Control flags
   namespace control
   {
-    /// Flag for calling the CAMergeClones procedure ... TODO
-    constexpr bool kIfMergeClones {true};
-
-    /// Flag: input data QA level
+    /// \brief Flag: input data QA level
     ///  - 0: no checks will be done
     ///  - 1: only number of hits and strips as well as validity of hits first and last indexes will be checked
     ///  - 2: hits sorting is checked
     ///  - 3: every hit is checked for consistency
     /// \note The larger Level corresponds to more precise checks, but is followed by larger time penalty
-    constexpr int kInputDataQaLevel = 0;  // WARNING: other options does not work properly, more tests are needed!
+    /// \warning other options than 0 do not work properly, more tests are needed!
+    constexpr int InputDataQaLevel = 0;
 
   }  // namespace control
 
-  // Physics constants
+  /// Physics constants
   namespace phys
   {
-    /* Particle masses used for track fit */
-    constexpr float kMuonMass      = 0.10565800f;  ///< Muon mass     [GeV/c2]  !! TODO: discrepancy in last two digits
-    constexpr float kPionMass      = 0.13957039f;  ///< Pion mass     [GeV/c2]
-    constexpr float kKaonMass      = 0.493677f;    ///< Kaon mass     [GeV/c2] (PDG 22.08.2023)
-    constexpr float kElectronMass  = 0.000511f;    ///< Electron mass [GeV/c2]
-    constexpr float kProtonMass    = 0.93827209f;  ///< Proton mass [GeV/c2] (0.93827208816 - PDG 11.08.2022)
-    constexpr double kSpeedOfLight = 29.9792458;   ///< Speed of light [cm/ns]
-    constexpr float kSpeedOfLightF = 29.9792;      ///< Speed of light [cm/ns] (single precision)
-
-    constexpr double kSpeedOfLightInv = 1 / kSpeedOfLight;   ///< Inverse speed of light [cm/ns]
-    constexpr float kSpeedOfLightInvF = 1 / kSpeedOfLightF;  ///< Inverse speed of light [cm/ns] (single precision)
-  }                                                          // namespace phys
-
-  // Math constants
+    /// Particle masses used for track fit
+    constexpr float MuonMass      = 0.10565800f;  ///< Muon mass     [GeV/c2]  !! TODO: discrepancy in last two digits
+    constexpr float PionMass      = 0.13957039f;  ///< Pion mass     [GeV/c2]
+    constexpr float KaonMass      = 0.493677f;    ///< Kaon mass     [GeV/c2] (PDG 22.08.2023)
+    constexpr float ElectronMass  = 0.000511f;    ///< Electron mass [GeV/c2]
+    constexpr float ProtonMass    = 0.93827209f;  ///< Proton mass [GeV/c2] (0.93827208816 - PDG 11.08.2022)
+    constexpr double SpeedOfLight = 29.9792458;   ///< Speed of light [cm/ns]
+    constexpr float SpeedOfLightF = 29.9792;      ///< Speed of light [cm/ns] (single precision)
+
+    constexpr double SpeedOfLightInv = 1 / SpeedOfLight;   ///< Inverse speed of light [cm/ns]
+    constexpr float SpeedOfLightInvF = 1 / SpeedOfLightF;  ///< Inverse speed of light [cm/ns] (single precision)
+
+  }  // namespace phys
+
+  /// Math constants
   namespace math
   {
-    constexpr double kPi = 3.14159265358979323846;  ///< Value of PI, used in ROOT TMath
-  }
+    constexpr double Pi = 3.14159265358979323846;  ///< Value of PI, used in ROOT TMath
+  }                                                // namespace math
 
-  // Miscellaneous constants
+  /// Miscellaneous constants
   namespace misc
   {
-    constexpr int kAssertionLevel = 0;   ///< Assertion level
-    constexpr int kAlignment      = 16;  ///< Default alignment of data (bytes)
-  }                                      // namespace misc
+    constexpr int AssertionLevel = 0;   ///< Assertion level
+    constexpr int Alignment      = 16;  ///< Default alignment of data (bytes)
+  }                                     // namespace misc
+                                        // Colors of terminal log
+
+  /// Undefined values for different types
+  namespace undef
+  {
+    constexpr int Int       = std::numeric_limits<int>::min();
+    constexpr unsigned Uint = std::numeric_limits<unsigned>::max();
+    constexpr float Float   = std::numeric_limits<float>::signaling_NaN();
+    constexpr double Double = std::numeric_limits<double>::signaling_NaN();
+    constexpr fscal Fscal   = std::numeric_limits<fscal>::signaling_NaN();
+
+    /// Checks whether a variable of a particular type defined
+    template<typename T>
+    bool IsUndefined(T val)
+    {
+      if constexpr (std::is_same_v<T, int>) { return val == undef::Int; }
+      if constexpr (std::is_same_v<T, unsigned>) { return val == undef::Uint; }
+      if constexpr (std::is_same_v<T, float>) { return std::isnan(val); }
+      if constexpr (std::is_same_v<T, double>) { return std::isnan(val); }
+      if constexpr (std::is_same_v<T, fscal>) { return std::isnan(val); }
+      if constexpr (std::is_same_v<T, fvec>) { return isnan(val).isNotEmpty(); }
+      return true;
+    }
+
+  }  // namespace undef
 
-  // Colors of terminal log
   namespace clrs
   {
     // NOTE: To be used first, because different users may have different console bg and fg colors
-    constexpr char kCL[]   = "\e[0m";    ///< clear
-    constexpr char kCLb[]  = "\e[1m";    ///< clear bold
-    constexpr char kCLi[]  = "\e[3m";    ///< clear italic
-    constexpr char kCLu[]  = "\e[4m";    ///< clear underline
-    constexpr char kCLr[]  = "\e[7m";    ///< clear reverse
-    constexpr char kCLbi[] = "\e[1;3m";  ///< clear bold-italic
-    constexpr char kCLbu[] = "\e[1;4m";  ///< clear bold-underline
-    constexpr char kCLbr[] = "\e[1;7m";  ///< clear bold-reverse
+    constexpr char CL[]   = "\e[0m";    ///< clear
+    constexpr char CLb[]  = "\e[1m";    ///< clear bold
+    constexpr char CLi[]  = "\e[3m";    ///< clear italic
+    constexpr char CLu[]  = "\e[4m";    ///< clear underline
+    constexpr char CLr[]  = "\e[7m";    ///< clear reverse
+    constexpr char CLbi[] = "\e[1;3m";  ///< clear bold-italic
+    constexpr char CLbu[] = "\e[1;4m";  ///< clear bold-underline
+    constexpr char CLbr[] = "\e[1;7m";  ///< clear bold-reverse
 
     // regular
-    constexpr char kBK[] = "\e[30m";  ///< normal black
-    constexpr char kRD[] = "\e[31m";  ///< normal red
-    constexpr char kGN[] = "\e[32m";  ///< normal green
-    constexpr char kYL[] = "\e[33m";  ///< normal yellow
-    constexpr char kBL[] = "\e[34m";  ///< normal blue
-    constexpr char kMG[] = "\e[35m";  ///< normal magenta
-    constexpr char kCY[] = "\e[36m";  ///< normal cyan
-    constexpr char kGY[] = "\e[37m";  ///< normal grey
-    constexpr char kWT[] = "\e[38m";  ///< normal white
+    constexpr char BK[] = "\e[30m";  ///< normal black
+    constexpr char RD[] = "\e[31m";  ///< normal red
+    constexpr char GN[] = "\e[32m";  ///< normal green
+    constexpr char YL[] = "\e[33m";  ///< normal yellow
+    constexpr char BL[] = "\e[34m";  ///< normal blue
+    constexpr char MG[] = "\e[35m";  ///< normal magenta
+    constexpr char CY[] = "\e[36m";  ///< normal cyan
+    constexpr char GY[] = "\e[37m";  ///< normal grey
+    constexpr char WT[] = "\e[38m";  ///< normal white
 
     // bold
-    constexpr char kBKb[] = "\e[1;30m";  ///< bold black
-    constexpr char kRDb[] = "\e[1;31m";  ///< bold red
-    constexpr char kGNb[] = "\e[1;32m";  ///< bold green
-    constexpr char kYLb[] = "\e[1;33m";  ///< bold yellow
-    constexpr char kBLb[] = "\e[1;34m";  ///< bold blue
-    constexpr char kMGb[] = "\e[1;35m";  ///< bold magenta
-    constexpr char kCYb[] = "\e[1;36m";  ///< bold cyan
-    constexpr char kGYb[] = "\e[1;37m";  ///< bold grey
-    constexpr char kWTb[] = "\e[1;38m";  ///< bold white
+    constexpr char BKb[] = "\e[1;30m";  ///< bold black
+    constexpr char RDb[] = "\e[1;31m";  ///< bold red
+    constexpr char GNb[] = "\e[1;32m";  ///< bold green
+    constexpr char YLb[] = "\e[1;33m";  ///< bold yellow
+    constexpr char BLb[] = "\e[1;34m";  ///< bold blue
+    constexpr char MGb[] = "\e[1;35m";  ///< bold magenta
+    constexpr char CYb[] = "\e[1;36m";  ///< bold cyan
+    constexpr char GYb[] = "\e[1;37m";  ///< bold grey
+    constexpr char WTb[] = "\e[1;38m";  ///< bold white
 
     // italic
-    constexpr char kBKi[] = "\e[3;30m";  ///< italic black
-    constexpr char kRDi[] = "\e[3;31m";  ///< italic red
-    constexpr char kGNi[] = "\e[3;32m";  ///< italic green
-    constexpr char kYLi[] = "\e[3;33m";  ///< italic yellow
-    constexpr char kBLi[] = "\e[3;34m";  ///< italic blue
-    constexpr char kMGi[] = "\e[3;35m";  ///< italic magenta
-    constexpr char kCYi[] = "\e[3;36m";  ///< italic cyan
-    constexpr char kGYi[] = "\e[3;37m";  ///< italic grey
-    constexpr char kWTi[] = "\e[3;38m";  ///< italic white
+    constexpr char BKi[] = "\e[3;30m";  ///< italic black
+    constexpr char RDi[] = "\e[3;31m";  ///< italic red
+    constexpr char GNi[] = "\e[3;32m";  ///< italic green
+    constexpr char YLi[] = "\e[3;33m";  ///< italic yellow
+    constexpr char BLi[] = "\e[3;34m";  ///< italic blue
+    constexpr char MGi[] = "\e[3;35m";  ///< italic magenta
+    constexpr char CYi[] = "\e[3;36m";  ///< italic cyan
+    constexpr char GYi[] = "\e[3;37m";  ///< italic grey
+    constexpr char WTi[] = "\e[3;38m";  ///< italic white
 
     // underline
-    constexpr char kBKu[] = "\e[4;30m";  ///< underline black
-    constexpr char kRDu[] = "\e[4;31m";  ///< underline red
-    constexpr char kGNu[] = "\e[4;32m";  ///< underline green
-    constexpr char kYLu[] = "\e[4;33m";  ///< underline yellow
-    constexpr char kBLu[] = "\e[4;34m";  ///< underline blue
-    constexpr char kMGu[] = "\e[4;35m";  ///< underline magenta
-    constexpr char kCYu[] = "\e[4;36m";  ///< underline cyan
-    constexpr char kGYu[] = "\e[4;37m";  ///< underline grey
-    constexpr char kWTu[] = "\e[4;38m";  ///< underline white
+    constexpr char BKu[] = "\e[4;30m";  ///< underline black
+    constexpr char RDu[] = "\e[4;31m";  ///< underline red
+    constexpr char GNu[] = "\e[4;32m";  ///< underline green
+    constexpr char YLu[] = "\e[4;33m";  ///< underline yellow
+    constexpr char BLu[] = "\e[4;34m";  ///< underline blue
+    constexpr char MGu[] = "\e[4;35m";  ///< underline magenta
+    constexpr char CYu[] = "\e[4;36m";  ///< underline cyan
+    constexpr char GYu[] = "\e[4;37m";  ///< underline grey
+    constexpr char WTu[] = "\e[4;38m";  ///< underline white
 
     // reverse
-    constexpr char kBKr[] = "\e[7;30m";  ///< reverse black
-    constexpr char kRDr[] = "\e[7;31m";  ///< reverse red
-    constexpr char kGNr[] = "\e[7;32m";  ///< reverse green
-    constexpr char kYLr[] = "\e[7;33m";  ///< reverse yellow
-    constexpr char kBLr[] = "\e[7;34m";  ///< reverse blue
-    constexpr char kMGr[] = "\e[7;35m";  ///< reverse magenta
-    constexpr char kCYr[] = "\e[7;36m";  ///< reverse cyan
-    constexpr char kGYr[] = "\e[7;37m";  ///< reverse grey
-    constexpr char kWTr[] = "\e[7;38m";  ///< reverse white
+    constexpr char BKr[] = "\e[7;30m";  ///< reverse black
+    constexpr char RDr[] = "\e[7;31m";  ///< reverse red
+    constexpr char GNr[] = "\e[7;32m";  ///< reverse green
+    constexpr char YLr[] = "\e[7;33m";  ///< reverse yellow
+    constexpr char BLr[] = "\e[7;34m";  ///< reverse blue
+    constexpr char MGr[] = "\e[7;35m";  ///< reverse magenta
+    constexpr char CYr[] = "\e[7;36m";  ///< reverse cyan
+    constexpr char GYr[] = "\e[7;37m";  ///< reverse grey
+    constexpr char WTr[] = "\e[7;38m";  ///< reverse white
 
     // bold-underline
-    constexpr char kBKbu[] = "\e[1;4;30m";  ///< bold-underline black
-    constexpr char kRDbu[] = "\e[1;4;31m";  ///< bold-underline red
-    constexpr char kGNbu[] = "\e[1;4;32m";  ///< bold-underline green
-    constexpr char kYLbu[] = "\e[1;4;33m";  ///< bold-underline yellow
-    constexpr char kBLbu[] = "\e[1;4;34m";  ///< bold-underline blue
-    constexpr char kMGbu[] = "\e[1;4;35m";  ///< bold-underline magenta
-    constexpr char kCYbu[] = "\e[1;4;36m";  ///< bold-underline cyan
-    constexpr char kGYbu[] = "\e[1;4;37m";  ///< bold-underline grey
-    constexpr char kWTbu[] = "\e[1;4;38m";  ///< bold-underline white
+    constexpr char BKbu[] = "\e[1;4;30m";  ///< bold-underline black
+    constexpr char RDbu[] = "\e[1;4;31m";  ///< bold-underline red
+    constexpr char GNbu[] = "\e[1;4;32m";  ///< bold-underline green
+    constexpr char YLbu[] = "\e[1;4;33m";  ///< bold-underline yellow
+    constexpr char BLbu[] = "\e[1;4;34m";  ///< bold-underline blue
+    constexpr char MGbu[] = "\e[1;4;35m";  ///< bold-underline magenta
+    constexpr char CYbu[] = "\e[1;4;36m";  ///< bold-underline cyan
+    constexpr char GYbu[] = "\e[1;4;37m";  ///< bold-underline grey
+    constexpr char WTbu[] = "\e[1;4;38m";  ///< bold-underline white
 
     // bold-italic
-    constexpr char kBKbi[] = "\e[1;3;30m";  ///< bold-italic black
-    constexpr char kRDbi[] = "\e[1;3;31m";  ///< bold-italic red
-    constexpr char kGNbi[] = "\e[1;3;32m";  ///< bold-italic green
-    constexpr char kYLbi[] = "\e[1;3;33m";  ///< bold-italic yellow
-    constexpr char kBLbi[] = "\e[1;3;34m";  ///< bold-italic blue
-    constexpr char kMGbi[] = "\e[1;3;35m";  ///< bold-italic magenta
-    constexpr char kCYbi[] = "\e[1;3;36m";  ///< bold-italic cyan
-    constexpr char kGYbi[] = "\e[1;3;37m";  ///< bold-italic grey
-    constexpr char kWTbi[] = "\e[1;3;38m";  ///< bold-italic white
+    constexpr char BKbi[] = "\e[1;3;30m";  ///< bold-italic black
+    constexpr char RDbi[] = "\e[1;3;31m";  ///< bold-italic red
+    constexpr char GNbi[] = "\e[1;3;32m";  ///< bold-italic green
+    constexpr char YLbi[] = "\e[1;3;33m";  ///< bold-italic yellow
+    constexpr char BLbi[] = "\e[1;3;34m";  ///< bold-italic blue
+    constexpr char MGbi[] = "\e[1;3;35m";  ///< bold-italic magenta
+    constexpr char CYbi[] = "\e[1;3;36m";  ///< bold-italic cyan
+    constexpr char GYbi[] = "\e[1;3;37m";  ///< bold-italic grey
+    constexpr char WTbi[] = "\e[1;3;38m";  ///< bold-italic white
 
     // bold-reverse
-    constexpr char kBKbr[] = "\e[1;7;30m";  ///< bold-reverse black
-    constexpr char kRDbr[] = "\e[1;7;31m";  ///< bold-reverse red
-    constexpr char kGNbr[] = "\e[1;7;32m";  ///< bold-reverse green
-    constexpr char kYLbr[] = "\e[1;7;33m";  ///< bold-reverse yellow
-    constexpr char kBLbr[] = "\e[1;7;34m";  ///< bold-reverse blue
-    constexpr char kMGbr[] = "\e[1;7;35m";  ///< bold-reverse magenta
-    constexpr char kCYbr[] = "\e[1;7;36m";  ///< bold-reverse cyan
-    constexpr char kGYbr[] = "\e[1;7;37m";  ///< bold-reverse grey
-    constexpr char kWTbr[] = "\e[1;7;38m";  ///< bold-reverse white
-  }                                         // namespace clrs
+    constexpr char BKbr[] = "\e[1;7;30m";  ///< bold-reverse black
+    constexpr char RDbr[] = "\e[1;7;31m";  ///< bold-reverse red
+    constexpr char GNbr[] = "\e[1;7;32m";  ///< bold-reverse green
+    constexpr char YLbr[] = "\e[1;7;33m";  ///< bold-reverse yellow
+    constexpr char BLbr[] = "\e[1;7;34m";  ///< bold-reverse blue
+    constexpr char MGbr[] = "\e[1;7;35m";  ///< bold-reverse magenta
+    constexpr char CYbr[] = "\e[1;7;36m";  ///< bold-reverse cyan
+    constexpr char GYbr[] = "\e[1;7;37m";  ///< bold-reverse grey
+    constexpr char WTbr[] = "\e[1;7;38m";  ///< bold-reverse white
+  }                                        // namespace clrs
 }  // namespace cbm::algo::ca::constants
 
 /// TEMPORARY !!!!
diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt
index 6ec4f9ab04..c91ad51763 100644
--- a/reco/L1/CMakeLists.txt
+++ b/reco/L1/CMakeLists.txt
@@ -112,7 +112,6 @@ set(HEADERS
   L1Algo/L1Def.h
   L1Algo/L1Vector.h
   L1Algo/L1EArray.h
-  L1Algo/L1Undef.h
   L1Algo/utils/CaUvConverter.h
   L1Algo/utils/CaMonitor.h
   catools/CaToolsWindowFinder.h
diff --git a/reco/L1/CbmCaMCModule.cxx b/reco/L1/CbmCaMCModule.cxx
index 3087db20f2..869ec615c1 100644
--- a/reco/L1/CbmCaMCModule.cxx
+++ b/reco/L1/CbmCaMCModule.cxx
@@ -45,8 +45,8 @@
 // ** Action definition functions **
 // *********************************
 
-using cbm::algo::ca::constants::clrs::kCL;   // clear log
-using cbm::algo::ca::constants::clrs::kRDb;  // red bold log
+using cbm::algo::ca::constants::clrs::CL;   // clear log
+using cbm::algo::ca::constants::clrs::RDb;  // red bold log
 using cbm::ca::MCModule;
 
 // ---------------------------------------------------------------------------------------------------------------------
diff --git a/reco/L1/CbmCaMCModule.h b/reco/L1/CbmCaMCModule.h
index d1d97861a1..6cb47fec93 100644
--- a/reco/L1/CbmCaMCModule.h
+++ b/reco/L1/CbmCaMCModule.h
@@ -39,13 +39,11 @@
 #include <string_view>
 #include <type_traits>
 
-#include "CaConstants.h"
 #include "CaMonitor.h"
 #include "CaToolsMCData.h"
 #include "CaToolsMCPoint.h"
 #include "L1InputData.h"
 #include "L1Parameters.h"
-#include "L1Undef.h"
 
 class CbmEvent;
 class CbmMCDataObject;
@@ -56,6 +54,7 @@ enum class L1DetectorID;
 
 namespace cbm::ca
 {
+
   /// @brief Class CbmCaPerformance is an interface to communicate between
   ///
   class MCModule {
@@ -124,7 +123,7 @@ namespace cbm::ca
 
     /// @brief Sets first hit indexes container in different detectors
     /// @param source Array of indexes
-    void RegisterFirstHitIndexes(const std::array<int, constants::size::kMaxNdetectors + 1>& source)
+    void RegisterFirstHitIndexes(const std::array<int, constants::size::MaxNdetectors + 1>& source)
     {
       fpvFstHitId = &source;
     }
@@ -261,7 +260,7 @@ namespace cbm::ca
     /// @brief Pointer to array of first hit indexes in the detector subsystem
     ///
     /// This array must be initialized in the run initialization function.
-    const std::array<int, constants::size::kMaxNdetectors + 1>* fpvFstHitId = nullptr;
+    const std::array<int, constants::size::MaxNdetectors + 1>* fpvFstHitId = nullptr;
   };
 }  // namespace cbm::ca
 
@@ -327,10 +326,10 @@ std::optional<::ca::tools::MCPoint> cbm::ca::MCModule::FillMCPoint(int iExtId, i
   auto oPoint = std::make_optional<::ca::tools::MCPoint>();
 
   // ----- Get positions, momenta, time and track ID
-  TVector3 posIn;             // Position at entrance to station [cm]
-  TVector3 posOut;            // Position at exist of station [cm]
-  TVector3 momIn;             // 3-momentum at entrance to station [GeV/c]
-  TVector3 momOut;            // 3-momentum at exit of station [GeV/c]
+  TVector3 posIn;   // Position at entrance to station [cm]
+  TVector3 posOut;  // Position at exist of station [cm]
+  TVector3 momIn;   // 3-momentum at entrance to station [GeV/c]
+  TVector3 momOut;  // 3-momentum at exit of station [GeV/c]
 
   auto* pBrPoints = fvpBrPoints[DetID];
 
diff --git a/reco/L1/CbmCaTimeSliceReader.cxx b/reco/L1/CbmCaTimeSliceReader.cxx
index 5857683c41..19b89ec680 100644
--- a/reco/L1/CbmCaTimeSliceReader.cxx
+++ b/reco/L1/CbmCaTimeSliceReader.cxx
@@ -27,9 +27,9 @@
 #include "L1Parameters.h"
 
 using ca::tools::HitRecord;
-using cbm::algo::ca::constants::clrs::kCL;   // clear log
-using cbm::algo::ca::constants::clrs::kGNb;  // green bold log
-using cbm::algo::ca::constants::clrs::kRDb;  // red bold log
+
+using namespace cbm::algo::ca::constants;
+
 using cbm::ca::TimeSliceReader;
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -155,11 +155,16 @@ try {
   // Check initialization
   this->CheckInit();
 
-  LOG(info) << "TimeSliceReader: initializing run ... " << kGNb << "done" << kCL;
+  //clrs::CL - clear log
+  //clrs::GNb - green bold log
+  //clrs::RDb - red bold log
+
+  LOG(info) << "TimeSliceReader: initializing run ... " << clrs::GNb << "done" << clrs::CL;
   return true;
 }
 catch (const std::logic_error& error) {
-  LOG(info) << "TimeSliceReader: initializing run ... " << kRDb << "failed" << kCL << "\nReason: " << error.what();
+  LOG(info) << "TimeSliceReader: initializing run ... " << clrs::RDb << "failed" << clrs::CL
+            << "\nReason: " << error.what();
   return false;
 }
 
diff --git a/reco/L1/CbmCaTimeSliceReader.h b/reco/L1/CbmCaTimeSliceReader.h
index 823a5d0a9a..70d02fa5f6 100644
--- a/reco/L1/CbmCaTimeSliceReader.h
+++ b/reco/L1/CbmCaTimeSliceReader.h
@@ -200,7 +200,7 @@ namespace cbm::ca
     int fNofHitKeys  = 0;  ///< Recorded number of hit keys
     int fFirstHitKey = 0;  ///< First index of hit key for the detector subsystem
 
-    std::array<int, constants::size::kMaxNdetectors + 1> fvHitFirstIndexDet = {{0}};  ///< First hit index in detector
+    std::array<int, constants::size::MaxNdetectors + 1> fvHitFirstIndexDet = {{0}};  ///< First hit index in detector
   };
 }  // namespace cbm::ca
 
diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx
index c61997e712..6895895335 100644
--- a/reco/L1/CbmL1MCTrack.cxx
+++ b/reco/L1/CbmL1MCTrack.cxx
@@ -30,7 +30,7 @@
 #include "L1Algo/L1Algo.h"
 #include "L1Algo/L1Hit.h"
 
-using cbm::algo::ca::constants::size::kMaxNstations;
+using cbm::algo::ca::constants::size::MaxNstations;
 
 CbmL1MCTrack::CbmL1MCTrack(double mass_, double q_, TVector3 vr, TLorentzVector vp, int _ID, int _mother_ID, int _pdg,
                            unsigned int _process_ID)
@@ -111,7 +111,7 @@ void CbmL1MCTrack::CountHitStations()
 {
   CbmL1* L1 = CbmL1::Instance();
 
-  int stationNhits[kMaxNstations] {0};
+  int stationNhits[MaxNstations] {0};
 
   for (unsigned int iH = 0; iH < Hits.size(); iH++) {
     CbmL1HitDebugInfo& sh = L1->fvHitDebugInfo[Hits[iH]];
diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx
index 4568b07212..4189bf933e 100644
--- a/reco/L1/CbmL1Performance.cxx
+++ b/reco/L1/CbmL1Performance.cxx
@@ -1140,8 +1140,7 @@ void CbmL1::HistoPerformance()  // TODO: check if works correctly. Change vHitFa
 void CbmL1::TrackFitPerformance()
 {
   const int Nh_fit = 17;
-  static TH1F *h_fit[Nh_fit], *h_fitL[Nh_fit], *h_fitSV[Nh_fit], *h_fitPV[Nh_fit], *h_fitTrd[Nh_fit], *h_fitTof[Nh_fit],
-    *h_fit_chi2;  //, *h_smoothed[12][Nh_fit];
+  static TH1F *h_fit[Nh_fit], *h_fitL[Nh_fit], *h_fitSV[Nh_fit], *h_fitPV[Nh_fit], *h_fit_chi2;
 
   static TH2F *PRes2D, *PRes2DPrim, *PRes2DSec;
 
@@ -1272,26 +1271,6 @@ void CbmL1::TrackFitPerformance()
         sprintf(t, "Primary vertex point %s", TableVertex[i].title);
         h_fitPV[i] = new TH1F(n, t, TableVertex[i].n, TableVertex[i].l, TableVertex[i].r);
 
-        sprintf(n, "trd_%s", TableVertex[i].name);
-        sprintf(t, "Last Trd point %s", TableVertex[i].title);
-        if (i == 12) { h_fitTrd[i] = new TH1F(n, t, Table[i].n, -30., 30.); }
-        else if (i == 13) {
-          h_fitTrd[i] = new TH1F(n, t, Table[i].n, -5., 5.);
-        }
-        else {
-          h_fitTrd[i] = new TH1F(n, t, Table[i].n, Table[i].l, Table[i].r);
-        }
-
-        sprintf(n, "tof_%s", TableVertex[i].name);
-        sprintf(t, "Last Tof point %s", TableVertex[i].title);
-        if (i == 12) { h_fitTof[i] = new TH1F(n, t, Table[i].n, -30., 30.); }
-        else if (i == 13) {
-          h_fitTof[i] = new TH1F(n, t, Table[i].n, -5., 5.);
-        }
-        else {
-          h_fitTof[i] = new TH1F(n, t, Table[i].n, Table[i].l, Table[i].r);
-        }
-
         for (int j = 0; j < 12; j++) {
           sprintf(n, "smth_%s_sta_%i", Table[i].name, j);
           sprintf(t, "Station %i %s", j, Table[i].title);
diff --git a/reco/L1/CbmL1Track.h b/reco/L1/CbmL1Track.h
index bad57d9da3..a605d60fd0 100644
--- a/reco/L1/CbmL1Track.h
+++ b/reco/L1/CbmL1Track.h
@@ -156,11 +156,11 @@ public:
   /// @param header   If true, header will be printed
   std::string ToString(int verbose = 10, bool header = false) const;
 
-  double Tpv[L1TrackPar::kNparTr];   ///< Track parameters at primary vertex
-  double Cpv[L1TrackPar::kNparCov];  ///< Track covariance matrix at primary vertex
+  std::array<double, L1TrackPar::kNparTr> Tpv;   ///< Track parameters at primary vertex
+  std::array<double, L1TrackPar::kNparCov> Cpv;  ///< Track covariance matrix at primary vertex
 
-  double TLast[L1TrackPar::kNparTr];   ///< Track parameters in the end of the track
-  double CLast[L1TrackPar::kNparCov];  ///< Track covariance matrix at the end of the track
+  std::array<double, L1TrackPar::kNparTr> TLast;   ///< Track parameters in the end of the track
+  std::array<double, L1TrackPar::kNparCov> CLast;  ///< Track covariance matrix at the end of the track
 
   vector<int> Hits;  ///< Indexes of hits of this track
   int nStations;     ///< Number of stations with hits of this track
diff --git a/reco/L1/CbmL1TrackPar.h b/reco/L1/CbmL1TrackPar.h
index 9233e73b8f..5d603f57f5 100644
--- a/reco/L1/CbmL1TrackPar.h
+++ b/reco/L1/CbmL1TrackPar.h
@@ -10,8 +10,8 @@
 struct CbmL1TrackPar {
 public:
   CbmL1TrackPar() : chi2(0), NDF(0), mass(0), is_electron(0) {}
-  double* GetTrack() { return T; }
-  double* GetCovMatrix() { return C; }
+  std::array<double, L1TrackPar::kNparTr>& GetTrack() { return T; }
+  std::array<double, L1TrackPar::kNparCov>& GetCovMatrix() { return C; }
   double& GetRefChi2() { return chi2; }
   int& GetRefNDF() { return NDF; }
   double GetMass() const { return mass; }
@@ -24,8 +24,8 @@ public:
 
 public:
   int fId;
-  double T[L1TrackPar::kNparTr];
-  double C[L1TrackPar::kNparCov];
+  std::array<double, L1TrackPar::kNparTr> T;
+  std::array<double, L1TrackPar::kNparCov> C;
   double chi2;
   int NDF;
   double mass;  // mass hypothesis
diff --git a/reco/L1/CbmL1Util.cxx b/reco/L1/CbmL1Util.cxx
index 53bfe81db7..3f91937ed8 100644
--- a/reco/L1/CbmL1Util.cxx
+++ b/reco/L1/CbmL1Util.cxx
@@ -8,39 +8,41 @@
 
 namespace cbm::L1Util
 {
-
-  void CopyTC2TrackParam(FairTrackParam* par, Double_t T[], Double_t C[])
+  void CopyTrackParam2TC(const FairTrackParam* par, std::array<double, L1TrackPar::kNparTr>& T,
+                         std::array<double, L1TrackPar::kNparCov>& C)
   {
-    if (T) {
-      par->SetX(T[0]);
-      par->SetY(T[1]);
-      par->SetZ(T[5]);
-      par->SetTx(T[2]);
-      par->SetTy(T[3]);
-      par->SetQp(T[4]);
-    }
-    if (C) {
-      for (Int_t i = 0, iCov = 0; i < 5; i++)
-        for (Int_t j = 0; j <= i; j++, iCov++)
-          par->SetCovariance(i, j, C[iCov]);
+
+    T[0] = par->GetX();
+    T[1] = par->GetY();
+    T[2] = par->GetTx();
+    T[3] = par->GetTy();
+    T[4] = par->GetQp();
+    T[5] = par->GetZ();
+
+    for (Int_t i = 0, iCov = 0; i < 5; i++) {
+      for (Int_t j = 0; j <= i; j++, iCov++) {
+        C[iCov] = par->GetCovariance(i, j);
+      }
     }
   }
 
-  void CopyTrackParam2TC(const FairTrackParam* par, Double_t T[], Double_t C[])
+  void CopyTC2TrackParam(FairTrackParam* par, const std::array<double, L1TrackPar::kNparTr>& T,
+                         const std::array<double, L1TrackPar::kNparCov>& C)
   {
-    if (T) {
-      T[0] = par->GetX();
-      T[1] = par->GetY();
-      T[2] = par->GetTx();
-      T[3] = par->GetTy();
-      T[4] = par->GetQp();
-      T[5] = par->GetZ();
-    }
-    if (C) {
-      for (Int_t i = 0, iCov = 0; i < 5; i++)
-        for (Int_t j = 0; j <= i; j++, iCov++)
-          C[iCov] = par->GetCovariance(i, j);
+
+    par->SetX(T[0]);
+    par->SetY(T[1]);
+    par->SetZ(T[5]);
+    par->SetTx(T[2]);
+    par->SetTy(T[3]);
+    par->SetQp(T[4]);
+
+    for (Int_t i = 0, iCov = 0; i < 5; i++) {
+      for (Int_t j = 0; j <= i; j++, iCov++) {
+        par->SetCovariance(i, j, C[iCov]);
+      }
     }
   }
 
+
 }  // namespace cbm::L1Util
diff --git a/reco/L1/CbmL1Util.h b/reco/L1/CbmL1Util.h
index 75cc3fc09a..a7479d0593 100644
--- a/reco/L1/CbmL1Util.h
+++ b/reco/L1/CbmL1Util.h
@@ -7,6 +7,8 @@
 
 #include "Rtypes.h"
 
+#include "L1TrackPar.h"
+
 class FairTrackParam;
 
 ///
@@ -17,11 +19,13 @@ namespace cbm::L1Util
 
   /// copy fair track param to arrays
   // TODO: reorganize
-  void CopyTrackParam2TC(const FairTrackParam* par, Double_t T[], Double_t C[]);
+  void CopyTrackParam2TC(const FairTrackParam* par, std::array<double, L1TrackPar::kNparTr>& T,
+                         std::array<double, L1TrackPar::kNparCov>& C);
 
   /// copy arrays to fair track param
   // TODO: reorganize
-  void CopyTC2TrackParam(FairTrackParam* par, Double_t T[], Double_t C[]);
+  void CopyTC2TrackParam(FairTrackParam* par, const std::array<double, L1TrackPar::kNparTr>& T,
+                         const std::array<double, L1TrackPar::kNparCov>& C);
 
 }  // namespace cbm::L1Util
 
diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx
index a5757b368f..45120bef14 100644
--- a/reco/L1/L1Algo/L1Algo.cxx
+++ b/reco/L1/L1Algo/L1Algo.cxx
@@ -12,7 +12,7 @@
 
 L1Algo::L1Algo()
 {
-  for (unsigned int i = 0; i < constants::size::kMaxNstations; i++) {
+  for (unsigned int i = 0; i < constants::size::MaxNstations; i++) {
     vGridTime[i].AllocateMemory();
     fTriplets[i].SetName(std::stringstream() << "L1Algo::fTriplets[" << i << "]");
   }
@@ -62,7 +62,7 @@ void L1Algo::ResetSliceData()
 
   fTrackCandidates.clear();
   fTrackCandidates.reserve(nHits / 10);
-  for (unsigned int iS = 0; iS < constants::size::kMaxNstations; iS++) {
+  for (unsigned int iS = 0; iS < constants::size::MaxNstations; iS++) {
     int nHitsStation = fSliceHitIds[iS].size();
     fTriplets[iS].clear();
     fTriplets[iS].reserve(2 * nHitsStation);
diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h
index ec05275691..c223882d60 100644
--- a/reco/L1/L1Algo/L1Algo.h
+++ b/reco/L1/L1Algo/L1Algo.h
@@ -51,8 +51,8 @@ class CbmL1MCTrack;
 // ** Types definition (global) **
 // *******************************
 
-using L1StationsArray_t = std::array<L1Station, constants::size::kMaxNstations>;
-using L1MaterialArray_t = std::array<L1Material, constants::size::kMaxNstations>;
+using L1StationsArray_t = std::array<L1Station, constants::size::MaxNstations>;
+using L1MaterialArray_t = std::array<L1Material, constants::size::MaxNstations>;
 using Tindex            = int;  // TODO: Replace with L1HitIndex_t, if suitable
 
 #ifdef PULLS
@@ -267,7 +267,7 @@ private:
   int fNfieldStations {0};       ///< number of stations in the field region
   //alignas(16) L1StationsArray_t fStations {};  ///< array of L1Station objects
   //alignas(16) L1MaterialArray_t fRadThick {};  ///< material for each station
-  float fDefaultMass {constants::phys::kMuonMass};  ///< mass of the propagated particle [GeV/c2]
+  float fDefaultMass {constants::phys::MuonMass};  ///< mass of the propagated particle [GeV/c2]
 
 
   // ***************************
@@ -283,12 +283,12 @@ private:
 public:
   L1Vector<L1HitTimeInfo> fHitTimeInfo;
 
-  L1Grid vGrid[constants::size::kMaxNstations];      ///<
-  L1Grid vGridTime[constants::size::kMaxNstations];  ///<
+  L1Grid vGrid[constants::size::MaxNstations];      ///<
+  L1Grid vGridTime[constants::size::MaxNstations];  ///<
 
-  fscal fMaxRangeX[constants::size::kMaxNstations];
-  fscal fMaxRangeY[constants::size::kMaxNstations];
-  fscal fMaxRangeT[constants::size::kMaxNstations];
+  fscal fMaxRangeX[constants::size::MaxNstations];
+  fscal fMaxRangeY[constants::size::MaxNstations];
+  fscal fMaxRangeT[constants::size::MaxNstations];
 
   double fCaRecoTime {0.};  // time of the track finder + fitter
 
@@ -300,14 +300,14 @@ public:
   L1Vector<L1HitIndex_t> fSliceRecoHits {"L1Algo::fSliceRecoHits"};  ///< packed hits of reconstructed tracks
 
   /// Created triplets vs station index
-  L1Vector<L1Triplet> fTriplets[constants::size::kMaxNstations] {{"L1Algo::fTriplets"}};
+  L1Vector<L1Triplet> fTriplets[constants::size::MaxNstations] {{"L1Algo::fTriplets"}};
 
   /// Track candidates created out of adjacent triplets before the final track selection.
   /// The candidates may share any amount of hits.
   L1Vector<L1Branch> fTrackCandidates {"L1Algo::fTrackCandidates"};
 
   ///< indices of the sub-slice hits
-  L1Vector<L1HitIndex_t> fSliceHitIds[constants::size::kMaxNstations] {"L1Algo::fSliceHitIds"};
+  L1Vector<L1HitIndex_t> fSliceHitIds[constants::size::MaxNstations] {"L1Algo::fSliceHitIds"};
 
   L1Vector<L1Hit> fGridHits {"L1Algo::fGridHits"};        ///< hits, ordered with respect to their grid bins
   L1Vector<L1Hit> fGridHitsBuf {"L1Algo::fGridHitsBuf"};  ///< hits, ordered with respect to their grid bins
@@ -318,8 +318,8 @@ public:
   L1Vector<L1HitPoint> fGridPoints {"L1Algo::fGridPoints"};  ///< grid points parallel to fGridHits
   L1Vector<L1HitPoint> fGridPointsBuf {"L1Algo::fGridPointsBuf"};
 
-  L1HitIndex_t fGridHitStartIndex[constants::size::kMaxNstations + 1] {0};
-  L1HitIndex_t fGridHitStopIndex[constants::size::kMaxNstations + 1] {0};
+  L1HitIndex_t fGridHitStartIndex[constants::size::MaxNstations + 1] {0};
+  L1HitIndex_t fGridHitStopIndex[constants::size::MaxNstations + 1] {0};
 
   L1Vector<int> fStripToTrack {"L1Algo::fStripToTrack"};  // strip to track pointers
 
@@ -403,10 +403,10 @@ private:
 [[gnu::always_inline]] inline unsigned int L1Algo::PackTripletId(unsigned int iStation, unsigned int iTriplet)
 {
 #ifndef FAST_CODE
-  assert(iStation < constants::size::kMaxNstations);
-  assert(iTriplet < constants::size::kMaxNtriplets);
+  assert(iStation < constants::size::MaxNstations);
+  assert(iTriplet < constants::size::MaxNtriplets);
 #endif
-  constexpr unsigned int kMoveStation = constants::size::kTripletBits;
+  constexpr unsigned int kMoveStation = constants::size::TripletBits;
   return (iStation << kMoveStation) + iTriplet;
 }
 
@@ -414,7 +414,7 @@ private:
 //
 [[gnu::always_inline]] inline unsigned int L1Algo::TripletId2Station(unsigned int id)
 {
-  constexpr unsigned int kMoveStation = constants::size::kTripletBits;
+  constexpr unsigned int kMoveStation = constants::size::TripletBits;
   return id >> kMoveStation;
 }
 
@@ -422,7 +422,7 @@ private:
 //
 [[gnu::always_inline]] inline unsigned int L1Algo::TripletId2Triplet(unsigned int id)
 {
-  constexpr unsigned int kTripletMask = (1u << constants::size::kTripletBits) - 1u;
+  constexpr unsigned int kTripletMask = (1u << constants::size::TripletBits) - 1u;
   return id & kTripletMask;
 }
 
diff --git a/reco/L1/L1Algo/L1BaseStationInfo.cxx b/reco/L1/L1Algo/L1BaseStationInfo.cxx
index 8792fa2c3c..fa94eeb27e 100644
--- a/reco/L1/L1Algo/L1BaseStationInfo.cxx
+++ b/reco/L1/L1Algo/L1BaseStationInfo.cxx
@@ -139,8 +139,8 @@ void L1BaseStationInfo::SetFieldFunction(
   L1MASSERT(0, fInitController.GetFlag(EInitKey::kYmax),
             "Attempt to set magnetic field slice before Ymax size of the station");
   // TODO: Change names of variables according to convention (S.Zh.)
-  constexpr int M = constants::size::kMaxFieldApproxPolynomialOrder;
-  constexpr int N = constants::size::kMaxNFieldApproxCoefficients;
+  constexpr int M = constants::size::MaxFieldApproxPolynomialOrder;
+  constexpr int N = constants::size::MaxNFieldApproxCoefficients;
   constexpr int D = 3;  ///> number of dimensions
 
   // SLE initialization
diff --git a/reco/L1/L1Algo/L1CAIteration.cxx b/reco/L1/L1Algo/L1CAIteration.cxx
index 9483a27565..7066cbd3f8 100644
--- a/reco/L1/L1Algo/L1CAIteration.cxx
+++ b/reco/L1/L1Algo/L1CAIteration.cxx
@@ -25,7 +25,7 @@ L1CAIteration::L1CAIteration(const std::string& name) : fName(name) {}
 //
 bool L1CAIteration::Check() const
 {
-  using constants::size::kMaxNstations;
+  using constants::size::MaxNstations;
   constexpr float kMaxFloat = std::numeric_limits<float>::max();
   bool res                  = true;
   // TODO: SZh 06.10.2022: These values should be tuned. At the moment the std::numeric_limits<T>::max value is used for
@@ -40,9 +40,9 @@ bool L1CAIteration::Check() const
   res = this->CheckValueLimits<float>("max_slope_pv", fMaxSlopePV, 0.f, kMaxFloat) && res;
   res = this->CheckValueLimits<float>("max_slope", fMaxSlope, 0.f, kMaxFloat) && res;
   res = this->CheckValueLimits<float>("max_dz", fMaxDZ, 0.f, kMaxFloat) && res;
-  res = this->CheckValueLimits<int>("min_n_hits", fMinNhits, 3, kMaxNstations) && res;
-  res = this->CheckValueLimits<int>("min_n_hits_sta_0", fMinNhitsStation0, 3, kMaxNstations) && res;
-  res = this->CheckValueLimits<int>("first_station_index", fFirstStationIndex, 0, kMaxNstations) && res;
+  res = this->CheckValueLimits<int>("min_n_hits", fMinNhits, 3, MaxNstations) && res;
+  res = this->CheckValueLimits<int>("min_n_hits_sta_0", fMinNhitsStation0, 3, MaxNstations) && res;
+  res = this->CheckValueLimits<int>("first_station_index", fFirstStationIndex, 0, MaxNstations) && res;
   res = this->CheckValueLimits<float>("target_pos_sigma_x", fTargetPosSigmaX, 0.f, kMaxFloat) && res;
   res = this->CheckValueLimits<float>("target_pos_sigma_y", fTargetPosSigmaY, 0.f, kMaxFloat) && res;
   return res;
diff --git a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx
index 9f14b1b5df..94dcaf6fb7 100644
--- a/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx
+++ b/reco/L1/L1Algo/L1CaTrackFinderSlice.cxx
@@ -165,9 +165,9 @@ void L1Algo::CaTrackFinderSlice()
   //  static Tindex stat_nDoublets[fNFindIterations] = {0};
   static Tindex stat_nTriplets[fNFindIterations] = {0};
 
-  static Tindex stat_nLevels[constants::size::kMaxNstations - 2][fNFindIterations]   = {{0}};
-  static Tindex stat_nCalls[fNFindIterations]                                        = {0};  // n calls of CAFindTrack
-  static Tindex stat_nTrCandidates[fNFindIterations]                                 = {0};
+  static Tindex stat_nLevels[constants::size::MaxNstations - 2][fNFindIterations] = {{0}};
+  static Tindex stat_nCalls[fNFindIterations]                                     = {0};  // n calls of CAFindTrack
+  static Tindex stat_nTrCandidates[fNFindIterations]                              = {0};
 
   for (int iS = 0; iS < fParameters.GetNstationsActive(); ++iS) {
     stat_nStartHits += fSliceHitIds[iS].size();
@@ -441,7 +441,7 @@ void L1Algo::CaTrackFinderSlice()
     if (fpCurrentIteration->GetTrackFromTripletsFlag()) { min_level = 0; }
 
     L1Branch curr_tr;
-    L1Branch new_tr[constants::size::kMaxNstations];
+    L1Branch new_tr[constants::size::MaxNstations];
     L1Branch best_tr;
     fscal curr_chi2 = 0;
 
@@ -742,14 +742,11 @@ void L1Algo::CaTrackFinderSlice()
   }          // for (int isec
   // ---- Loop over Track Finder iterations: END -----------------------------------------------------------//
 
-  if constexpr (constants::control::kIfMergeClones) {
-    //CAMergeClones();
-    // Fit tracks
-    this->L1KFTrackFitter();
+  // Fit tracks
+  this->L1KFTrackFitter();
 
-    // Merge clones
-    fCloneMerger.Exec(fSliceRecoTracks, fSliceRecoHits);
-  }
+  // Merge clones
+  fCloneMerger.Exec(fSliceRecoTracks, fSliceRecoHits);
 
   //==================================
 
diff --git a/reco/L1/L1Algo/L1ConfigRW.cxx b/reco/L1/L1Algo/L1ConfigRW.cxx
index ffb911eb84..9fa417a9d0 100644
--- a/reco/L1/L1Algo/L1ConfigRW.cxx
+++ b/reco/L1/L1Algo/L1ConfigRW.cxx
@@ -214,7 +214,7 @@ std::vector<std::set<int>> L1ConfigRW::ReadInactiveStationMap()
 
   if (node && node.size()) {
     std::unordered_map<std::string, int> mDetNameToID;
-    for (int iDet = 0; iDet < constants::size::kMaxNdetectors; ++iDet) {
+    for (int iDet = 0; iDet < constants::size::MaxNdetectors; ++iDet) {
       auto detName = boost::algorithm::to_lower_copy(fpInitManager->GetDetectorName(static_cast<L1DetectorID>(iDet)));
       if (!detName.size()) { continue; }
       mDetNameToID[detName] = iDet;
diff --git a/reco/L1/L1Algo/L1Field.cxx b/reco/L1/L1Algo/L1Field.cxx
index 7d68667756..470facb7ee 100644
--- a/reco/L1/L1Algo/L1Field.cxx
+++ b/reco/L1/L1Algo/L1Field.cxx
@@ -60,12 +60,12 @@ std::ostream& operator<<(std::ostream& out, const L1FieldValue& B)
 //
 L1FieldSlice::L1FieldSlice()
 {
-  for (int i = 0; i < constants::size::kMaxNFieldApproxCoefficients; ++i) {
-    cx[i] = undef::kFvc;
-    cy[i] = undef::kFvc;
-    cz[i] = undef::kFvc;
+  for (int i = 0; i < constants::size::MaxNFieldApproxCoefficients; ++i) {
+    cx[i] = constants::undef::Fscal;
+    cy[i] = constants::undef::Fscal;
+    cz[i] = constants::undef::Fscal;
   }
-  z = undef::kFvc;
+  z = constants::undef::Fscal;
 }
 
 //----------------------------------------------------------------------------------------------------------------------
@@ -73,7 +73,7 @@ L1FieldSlice::L1FieldSlice()
 void L1FieldSlice::CheckConsistency() const
 {
   /* Check SIMD data vectors for consistent initialization */
-  for (int i = 0; i < constants::size::kMaxNFieldApproxCoefficients; ++i) {
+  for (int i = 0; i < constants::size::MaxNFieldApproxCoefficients; ++i) {
     L1Utils::CheckSimdVectorEquality(cx[i], "L1FieldSlice: cx");
     L1Utils::CheckSimdVectorEquality(cy[i], "L1FieldSlice: cy");
     L1Utils::CheckSimdVectorEquality(cz[i], "L1FieldSlice: cz");
@@ -135,7 +135,7 @@ std::string L1FieldSlice::ToString(int indentLevel) const
   constexpr char indentChar = '\t';
   std::string indent(indentLevel, indentChar);
   aStream << indent << "idx           CX           CY           CZ";
-  for (int i = 0; i < constants::size::kMaxNFieldApproxCoefficients; ++i) {
+  for (int i = 0; i < constants::size::MaxNFieldApproxCoefficients; ++i) {
     aStream << '\n' << indent;
     aStream << std::setw(3) << std::setfill(' ') << i << ' ';
     aStream << std::setw(12) << std::setfill(' ') << cx[i][0] << ' ';
diff --git a/reco/L1/L1Algo/L1Field.h b/reco/L1/L1Algo/L1Field.h
index 55cd1da5c8..353933a021 100644
--- a/reco/L1/L1Algo/L1Field.h
+++ b/reco/L1/L1Algo/L1Field.h
@@ -10,7 +10,6 @@
 #include "CaConstants.h"
 #include "L1Def.h"
 #include "L1SimdSerializer.h"
-#include "L1Undef.h"
 
 class L1TrackPar;
 
@@ -92,12 +91,12 @@ public:
   // NOTE: We don't use an initialization of arrays here because we cannot be sure
   //       if the underlying type (fvec) has a default constructor, but
   //       we are sure, that it can be initialized with a float. (S.Zharko)
-  static constexpr auto kMaxNFieldApproxCoefficients = constants::size::kMaxNFieldApproxCoefficients;
+  static constexpr auto kMaxNFieldApproxCoefficients = constants::size::MaxNFieldApproxCoefficients;
   fvec cx[kMaxNFieldApproxCoefficients];  ///< Polynomial coefficients for x-component of the field value
   fvec cy[kMaxNFieldApproxCoefficients];  ///< Polynomial coefficients for y-component of the field value
   fvec cz[kMaxNFieldApproxCoefficients];  ///< Polynomial coefficients for z-component of the field value
 
-  fvec z {undef::kFvc};  ///< z coordinate of the slice
+  fvec z {constants::undef::Fscal};  ///< z coordinate of the slice
 
   /// Serialization function
   friend class boost::serialization::access;
diff --git a/reco/L1/L1Algo/L1Fit.h b/reco/L1/L1Algo/L1Fit.h
index a3540cf85c..91817846a0 100644
--- a/reco/L1/L1Algo/L1Fit.h
+++ b/reco/L1/L1Algo/L1Fit.h
@@ -44,7 +44,7 @@ public:
   }
 
   template<typename T>
-  void SetTrack(const T p[8], const T c[28])
+  void SetTrack(const std::array<T, L1TrackPar::kNparTr>& p, const std::array<T, L1TrackPar::kNparCov>& c)
   {
     fTr.copyFromArrays(p, c);
     fQp0 = fTr.qp;
diff --git a/reco/L1/L1Algo/L1IODataManager.cxx b/reco/L1/L1Algo/L1IODataManager.cxx
index bdb5d46ce7..dff5254d3e 100644
--- a/reco/L1/L1Algo/L1IODataManager.cxx
+++ b/reco/L1/L1Algo/L1IODataManager.cxx
@@ -25,7 +25,7 @@ bool L1IODataManager::SendInputData(L1Algo* pAlgo)
   InitData();
 
   // Check data before input
-  if (CheckInputData<constants::control::kInputDataQaLevel>()) {
+  if (CheckInputData<constants::control::InputDataQaLevel>()) {
     assert(pAlgo);
     pAlgo->ReceiveInputData(std::move(fInputData));
     return true;
@@ -42,7 +42,7 @@ bool L1IODataManager::SendInputData(L1InputData& destination)
   InitData();
 
   // Check data before input
-  if (CheckInputData<constants::control::kInputDataQaLevel>()) {
+  if (CheckInputData<constants::control::InputDataQaLevel>()) {
     destination = std::move(fInputData);
     assert(this->GetNofHits() == 0);
     return true;
@@ -111,7 +111,7 @@ void L1IODataManager::InitData()
 void L1IODataManager::WriteInputData(const std::string& fileName) const
 {
   // Check current data object for consistency
-  if (!CheckInputData<constants::control::kInputDataQaLevel>()) {
+  if (!CheckInputData<constants::control::InputDataQaLevel>()) {
     LOG(error) << "L1: input data writer: attempt to write invalid input data object to file \"" << fileName << "\"";
     return;
   }
diff --git a/reco/L1/L1Algo/L1IODataManager.h b/reco/L1/L1Algo/L1IODataManager.h
index 0787d8b1a8..7b03dc3ca7 100644
--- a/reco/L1/L1Algo/L1IODataManager.h
+++ b/reco/L1/L1Algo/L1IODataManager.h
@@ -18,7 +18,7 @@ class L1Algo;
 
 /// Class L1IODataManager defines the interface for input and output data flow in the L1 tracking algorithm
 ///
-class alignas(constants::misc::kAlignment) L1IODataManager {
+class alignas(constants::misc::Alignment) L1IODataManager {
 public:
   // ***************************
   // ** Member functions list **
@@ -119,7 +119,7 @@ private:
 
   L1InputData fInputData {};  ///< Object of input data
 
-  int64_t fLastStreamId {-1};  ///< data stream Id of the last hit added
+  int64_t fLastStreamId {-1};   ///< data stream Id of the last hit added
   int fNofActiveStations = -1;  ///< Number of active stations
 };
 
diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx
index 49d602b0af..b68f493bd2 100644
--- a/reco/L1/L1Algo/L1InitManager.cxx
+++ b/reco/L1/L1Algo/L1InitManager.cxx
@@ -20,9 +20,7 @@
 #include "L1Assert.h"
 #include "L1ConfigRW.h"
 
-using constants::clrs::kCL;   // end colored log
-using constants::clrs::kGNb;  // bold green log
-using constants::clrs::kRDb;  // bold red log
+using namespace constants;
 
 // ----------------------------------------------------------------------------------------------------------------------
 //
@@ -304,9 +302,15 @@ void L1InitManager::ReadInputConfigs()
 //
 void L1InitManager::ReadParametersObject(const std::string& fileName)
 {
+  // clrs::CL  - end colored log
+  // clrs::GNb - bold green log
+  // clrs::RDb - bold red log
+
   // Open input binary file
   std::ifstream ifs(fileName, std::ios::binary);
-  if (!ifs) { LOG(fatal) << "L1InitManager: parameters data file \"" << kGNb << fileName << kCL << "\" was not found"; }
+  if (!ifs) {
+    LOG(fatal) << "L1InitManager: parameters data file \"" << clrs::GNb << fileName << clrs::CL << "\" was not found";
+  }
 
   // Get L1InputData object
   try {
@@ -314,7 +318,7 @@ void L1InitManager::ReadParametersObject(const std::string& fileName)
     ia >> fParameters;
   }
   catch (const std::exception&) {
-    LOG(fatal) << "L1InitManager: parameters file \"" << kGNb << fileName << kCL
+    LOG(fatal) << "L1InitManager: parameters file \"" << clrs::GNb << fileName << clrs::CL
                << "\" has incorrect data format or was corrupted";
   }
 }
@@ -340,15 +344,15 @@ void L1InitManager::ReadSearchWindows(const std::string& fileName)
       ia >> swBuffer;
       int iStationID = swBuffer.GetStationID();
       int iTrackGrID = swBuffer.GetTrackGroupID();
-      if (iStationID < 0 || iStationID > constants::size::kMaxNstations) {
+      if (iStationID < 0 || iStationID > constants::size::MaxNstations) {
         errMsg << "\t- wrong station id for entry " << iW << ": " << iStationID << " (should be between 0 and "
-               << constants::size::kMaxNstations << ")\n";
+               << constants::size::MaxNstations << ")\n";
       }
-      if (iTrackGrID < 0 || iTrackGrID > constants::size::kMaxNtrackGroups) {
+      if (iTrackGrID < 0 || iTrackGrID > constants::size::MaxNtrackGroups) {
         errMsg << "\t- wrong track group id for entry " << iW << ": " << iTrackGrID << " (should be between 0 and "
-               << constants::size::kMaxNtrackGroups << ")\n";
+               << constants::size::MaxNtrackGroups << ")\n";
       }
-      fParameters.fSearchWindows[iTrackGrID * constants::size::kMaxNstations + iStationID] = swBuffer;
+      fParameters.fSearchWindows[iTrackGrID * constants::size::MaxNstations + iStationID] = swBuffer;
     }
     if (errMsg.str().size()) {
       LOG(fatal) << "L1InitManager: some errors occurred while reading search windows: " << errMsg.str();
@@ -464,11 +468,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 \"" << kGNb << fileName << kCL << "\" to write parameters object";
+    LOG(error) << "L1InitManager: failed opening file \"" << clrs::GNb << fileName << clrs::CL
+               << "\" to write parameters object";
     return;
   }
 
-  LOG(info) << "L1InitManager: writing CA parameters object to file \"" << kGNb << fileName << '\"' << kCL;
+  LOG(info) << "L1InitManager: writing CA parameters object to file \"" << clrs::GNb << fileName << '\"' << clrs::CL;
 
   // Serialize L1Parameters object and write
   boost::archive::binary_oarchive oa(ofs);
@@ -508,11 +513,11 @@ void L1InitManager::CheckStationsInfoInit()
     if (!bStationsFinalized) { LOG(fatal) << "At least one of the L1BaseStationInfo objects is not finalized"; }
 
     // (2) Check for maximum allowed number of stations
-    if (fParameters.GetNstationsGeometry() > constants::size::kMaxNstations) {
+    if (fParameters.GetNstationsGeometry() > constants::size::MaxNstations) {
       LOG(fatal) << "Actual total number of registered stations in geometry (" << fParameters.GetNstationsGeometry()
-                 << ") is larger then possible (" << constants::size::kMaxNstations
+                 << ") is larger then possible (" << constants::size::MaxNstations
                  << "). Please, select another set of active tracking detectors or recompile the code with enlarged"
-                 << " constants::size::kMaxNstations value";
+                 << " constants::size::MaxNstations value";
     }
   }
   fInitController.SetFlag(EInitKey::kStationsInfo, ifInitPassed);
diff --git a/reco/L1/L1Algo/L1InitManager.h b/reco/L1/L1Algo/L1InitManager.h
index 65cd46ca05..6322a03ddb 100644
--- a/reco/L1/L1Algo/L1InitManager.h
+++ b/reco/L1/L1Algo/L1InitManager.h
@@ -95,7 +95,7 @@ private:
   using L1FieldFunction_t    = std::function<void(const double (&xyz)[3], double (&B)[3])>;
   using InitController_t     = L1ObjectInitController<static_cast<int>(EInitKey::kEnd), EInitKey>;
   template<typename T>
-  using L1DetectorIDArr_t = std::array<T, constants::size::kMaxNdetectors>;
+  using L1DetectorIDArr_t = std::array<T, constants::size::MaxNdetectors>;
 
 public:
   /// Default constructor
@@ -227,8 +227,8 @@ public:
   template<size_t Size>
   void SetDetectorNames(const std::array<const char*, Size>& container)
   {
-    static_assert(Size <= constants::size::kMaxNdetectors,
-                  "Please, be ensured that the constants::size::kMaxNdetectors is not lower then the "
+    static_assert(Size <= constants::size::MaxNdetectors,
+                  "Please, be ensured that the constants::size::MaxNdetectors is not lower then the "
                   "L1DetectorID::kEND value, provided by your setup");
     std::copy(container.begin(), container.end(), fvDetectorNames.begin());
   }
diff --git a/reco/L1/L1Algo/L1InputData.h b/reco/L1/L1Algo/L1InputData.h
index 75f2917486..35afbd0a60 100644
--- a/reco/L1/L1Algo/L1InputData.h
+++ b/reco/L1/L1Algo/L1InputData.h
@@ -20,7 +20,7 @@
 /// Class L1InputData represents a block of the input data to the L1 tracking algorithm per event or time slice.
 /// Filling of the L1InputData is carried out with L1IODataManager class
 ///
-class alignas(constants::misc::kAlignment) L1InputData {
+class alignas(constants::misc::Alignment) L1InputData {
 public:
   // **************************
   // ** Friend classes list  **
diff --git a/reco/L1/L1Algo/L1Material.h b/reco/L1/L1Algo/L1Material.h
index 2570fe9065..5c3ef784bb 100644
--- a/reco/L1/L1Algo/L1Material.h
+++ b/reco/L1/L1Algo/L1Material.h
@@ -12,9 +12,11 @@
 #include <string>
 #include <vector>
 
+#include "CaConstants.h"
 #include "L1Def.h"
 #include "L1SimdSerializer.h"
-#include "L1Undef.h"
+
+using namespace cbm::algo::ca;
 
 /// Class L1Material describes a map of station thickness in units of radiation length (X0) to the specific point in XY plane
 class L1Material {
@@ -75,6 +77,7 @@ public:
   /// Checks, if the fields are NaN
   bool IsNaN() const
   {
+    using namespace cbm::algo::ca::constants;
     return undef::IsUndefined(fNbins) || undef::IsUndefined(fXYmax) || undef::IsUndefined(fFactor)
            || undef::IsUndefined(fZref) || undef::IsUndefined(fZmin) || undef::IsUndefined(fZmax);
   }
@@ -103,13 +106,13 @@ public:
   int GetBin(float x, float y) const;
 
 private:
-  int fNbins    = undef::kI32;   ///< Number of rows (== N columns) in the material budget table
-  float fXYmax  = undef::kF;     ///< Size of the station in x and y dimensions [cm]
-  float fFactor = undef::kF;     ///< Factor used in the recalculation of point coordinates to row/column id
-  float fZref   = undef::kF;     ///< Reference Z of the collected material [cm]
-  float fZmin   = undef::kF;     ///< Minimal Z of the collected material [cm]
-  float fZmax   = undef::kF;     ///< Minimal Z of the collected material [cm]
-  std::vector<float> fTable {};  ///< Material budget table
+  int fNbins    = constants::undef::Int;    ///< Number of rows (== N columns) in the material budget table
+  float fXYmax  = constants::undef::Float;  ///< Size of the station in x and y dimensions [cm]
+  float fFactor = constants::undef::Float;  ///< Factor used in the recalculation of point coordinates to row/column id
+  float fZref   = constants::undef::Float;  ///< Reference Z of the collected material [cm]
+  float fZmin   = constants::undef::Float;  ///< Minimal Z of the collected material [cm]
+  float fZmax   = constants::undef::Float;  ///< Minimal Z of the collected material [cm]
+  std::vector<float> fTable {};             ///< Material budget table
 
   /// Serialization function
   friend class boost::serialization::access;
diff --git a/reco/L1/L1Algo/L1MaterialMonitor.cxx b/reco/L1/L1Algo/L1MaterialMonitor.cxx
index f42567447a..11b4f72c94 100644
--- a/reco/L1/L1Algo/L1MaterialMonitor.cxx
+++ b/reco/L1/L1Algo/L1MaterialMonitor.cxx
@@ -49,13 +49,13 @@ void L1MaterialMonitor::EvaluateStatistics()
   fActiveNbins  = 0;
   fPassiveNbins = 0;
 
-  fActiveRadThickMin  = undef::kD;
-  fActiveRadThickMax  = undef::kD;
-  fActiveRadThickMean = undef::kD;
+  fActiveRadThickMin  = constants::undef::Double;
+  fActiveRadThickMax  = constants::undef::Double;
+  fActiveRadThickMean = constants::undef::Double;
 
-  fPassiveRadThickMin  = undef::kD;
-  fPassiveRadThickMax  = undef::kD;
-  fPassiveRadThickMean = undef::kD;
+  fPassiveRadThickMin  = constants::undef::Double;
+  fPassiveRadThickMax  = constants::undef::Double;
+  fPassiveRadThickMean = constants::undef::Double;
 
   if (!fMaterial) { return; }
 
diff --git a/reco/L1/L1Algo/L1MaterialMonitor.h b/reco/L1/L1Algo/L1MaterialMonitor.h
index 63cf63c059..48d3f5977c 100644
--- a/reco/L1/L1Algo/L1MaterialMonitor.h
+++ b/reco/L1/L1Algo/L1MaterialMonitor.h
@@ -10,8 +10,10 @@
 
 #include <vector>
 
+#include "CaConstants.h"
 #include "L1Material.h"
 
+using namespace cbm::algo::ca;
 
 /// Class to collect statistics for L1Material
 ///
@@ -88,15 +90,15 @@ private:
 
   std::vector<char> fActiveBinMap {};  ///< Map of active bins in the material map (bins where hits appear)
 
-  int fActiveNbins {undef::kI32};          ///< Active material: number of bins
-  double fActiveRadThickMin {undef::kD};   ///< Active material: minimal thickness
-  double fActiveRadThickMax {undef::kD};   ///< Active material: maximal thickness
-  double fActiveRadThickMean {undef::kD};  ///< Active material: average thickness
+  int fActiveNbins {constants::undef::Int};               ///< Active material: number of bins
+  double fActiveRadThickMin {constants::undef::Double};   ///< Active material: minimal thickness
+  double fActiveRadThickMax {constants::undef::Double};   ///< Active material: maximal thickness
+  double fActiveRadThickMean {constants::undef::Double};  ///< Active material: average thickness
 
-  int fPassiveNbins {undef::kI32};          ///< Passive material: number of bins
-  double fPassiveRadThickMin {undef::kD};   ///< Passive material: minimal thickness
-  double fPassiveRadThickMax {undef::kD};   ///< Passive material: maximal thickness
-  double fPassiveRadThickMean {undef::kD};  ///< Passive material: average thickness
+  int fPassiveNbins {constants::undef::Int};               ///< Passive material: number of bins
+  double fPassiveRadThickMin {constants::undef::Double};   ///< Passive material: minimal thickness
+  double fPassiveRadThickMax {constants::undef::Double};   ///< Passive material: maximal thickness
+  double fPassiveRadThickMean {constants::undef::Double};  ///< Passive material: average thickness
 
   unsigned long fNhitsTotal {0};    ///< number of hits in statistics
   unsigned long fNhitsOutside {0};  ///< number of hits outside the material map
diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx
index 5b74c59a66..ef04298fc1 100644
--- a/reco/L1/L1Algo/L1Parameters.cxx
+++ b/reco/L1/L1Algo/L1Parameters.cxx
@@ -206,10 +206,7 @@ void L1Parameters::Print(int /*verbosityLevel*/) const { LOG(info) << ToString()
 //
 std::string L1Parameters::ToString(int verbosity, int indentLevel) const
 {
-  using constants::clrs::kCL;  // color the log text
-  using constants::clrs::kCLb;
-  using constants::clrs::kGN;
-  using constants::clrs::kRD;
+  using namespace constants;
   using std::setfill;
   using std::setw;
   std::stringstream msg {};
@@ -219,63 +216,63 @@ std::string L1Parameters::ToString(int verbosity, int indentLevel) const
   std::string indent(indentLevel, indentCh);
 
   /// Sets red/green color dependently from flag
-  auto ClrFlg = [&](bool flag) { return (flag ? kGN : kRD); };
+  auto ClrFlg = [&](bool flag) { return (flag ? clrs::GN : clrs::RD); };
 
   msg << " ----- CA parameters list -----\n";
-  msg << indent << kCLb << "COMPILE TIME CONSTANTS:\n" << kCL;
-  msg << indent << indentCh << "Bits to code one station:           " << constants::size::kStationBits << '\n';
-  msg << indent << indentCh << "Bits to code one triplet:           " << constants::size::kTripletBits << '\n';
-  msg << indent << indentCh << "Max number of detectors:            " << constants::size::kMaxNdetectors << '\n';
-  msg << indent << indentCh << "Max number of stations:             " << constants::size::kMaxNstations << '\n';
-  msg << indent << indentCh << "Max number of triplets:             " << constants::size::kMaxNtriplets << '\n';
-  msg << indent << kCLb << "RUNTIME CONSTANTS:\n" << kCL;
+  msg << indent << clrs::CLb << "COMPILE TIME CONSTANTS:\n" << clrs::CL;
+  msg << indent << indentCh << "Bits to code one station:           " << constants::size::StationBits << '\n';
+  msg << indent << indentCh << "Bits to code one triplet:           " << constants::size::TripletBits << '\n';
+  msg << indent << indentCh << "Max number of detectors:            " << constants::size::MaxNdetectors << '\n';
+  msg << indent << indentCh << "Max number of stations:             " << constants::size::MaxNstations << '\n';
+  msg << indent << indentCh << "Max number of triplets:             " << constants::size::MaxNtriplets << '\n';
+  msg << indent << clrs::CLb << "RUNTIME CONSTANTS:\n" << clrs::CL;
   msg << indent << indentCh << "Random seed:                        " << fRandomSeed << '\n';
   msg << indent << indentCh << "Max number of doublets per singlet: " << fMaxDoubletsPerSinglet << '\n';
   msg << indent << indentCh << "Max number of triplets per doublet: " << fMaxTripletPerDoublets << '\n';
   msg << indent << indentCh << "Ghost suppresion:                   " << fGhostSuppression << '\n';
-  msg << indent << kCLb << "CA TRACK FINDER ITERATIONS:\n" << kCL;
+  msg << indent << clrs::CLb << "CA TRACK FINDER ITERATIONS:\n" << clrs::CL;
   msg << L1CAIteration::ToTableFromVector(fCAIterations);
-  msg << indent << kCLb << "GEOMETRY:\n" << kCL;
-  msg << indent << indentCh << kCLb << "TARGET:\n" << kCL;
+  msg << indent << clrs::CLb << "GEOMETRY:\n" << clrs::CL;
+  msg << indent << indentCh << clrs::CLb << "TARGET:\n" << clrs::CL;
   msg << indent << indentCh << indentCh << "Position:\n";
   for (int dim = 0; dim < 3 /*nDimensions*/; ++dim) {
     msg << indent << indentCh << indentCh << indentCh << char(120 + dim) << " = " << fTargetPos[dim][0] << " cm\n";
   }
-  msg << indent << indentCh << kCLb << "NUMBER OF STATIONS:\n" << kCL;
+  msg << indent << indentCh << clrs::CLb << "NUMBER OF STATIONS:\n" << clrs::CL;
   msg << indent << indentCh << indentCh << "Number of stations (Geometry): ";
-  for (int iDet = 0; iDet < constants::size::kMaxNdetectors; ++iDet) {
+  for (int iDet = 0; iDet < constants::size::MaxNdetectors; ++iDet) {
     msg << setw(2) << setfill(' ') << this->GetNstationsGeometry(static_cast<L1DetectorID>(iDet)) << ' ';
   }
   msg << " | total = " << setw(2) << setfill(' ') << this->GetNstationsGeometry();
   msg << '\n';
   msg << indent << indentCh << indentCh << "Number of stations (Active):   ";
-  for (int iDet = 0; iDet < constants::size::kMaxNdetectors; ++iDet) {
+  for (int iDet = 0; iDet < constants::size::MaxNdetectors; ++iDet) {
     msg << setw(2) << setfill(' ') << this->GetNstationsActive(static_cast<L1DetectorID>(iDet)) << ' ';
   }
   msg << " | total = " << setw(2) << setfill(' ') << this->GetNstationsActive();
-  msg << '\n' << indent << indentCh << indentCh << kCL << "Geometry station indices: ";
+  msg << '\n' << indent << indentCh << indentCh << clrs::CL << "Geometry station indices: ";
   for (int iStGeo = 0; iStGeo < this->GetNstationsGeometry(); ++iStGeo) {
     bool isActive = fvGeoToActiveMap[iStGeo] != -1;
     msg << ClrFlg(isActive) << setw(3) << setfill(' ') << iStGeo << ' ';
   }
-  msg << '\n' << indent << indentCh << indentCh << kCL << "Local station indices:    ";
+  msg << '\n' << indent << indentCh << indentCh << clrs::CL << "Local station indices:    ";
   for (int iStGeo = 0; iStGeo < this->GetNstationsGeometry(); ++iStGeo) {
     bool isActive = fvGeoToActiveMap[iStGeo] != -1;
     msg << ClrFlg(isActive) << setw(3) << setfill(' ') << static_cast<int>(fvGeoToLocalIdMap[iStGeo].second) << ' ';
   }
-  msg << '\n' << indent << indentCh << indentCh << kCL << "Detector indices:         ";
+  msg << '\n' << indent << indentCh << indentCh << clrs::CL << "Detector indices:         ";
   for (int iStGeo = 0; iStGeo < this->GetNstationsGeometry(); ++iStGeo) {
     bool isActive = fvGeoToActiveMap[iStGeo] != -1;
     msg << ClrFlg(isActive) << setw(3) << setfill(' ') << static_cast<int>(fvGeoToLocalIdMap[iStGeo].first) << ' ';
   }
-  msg << '\n' << indent << indentCh << indentCh << kCL << "Active station indices:   ";
+  msg << '\n' << indent << indentCh << indentCh << clrs::CL << "Active station indices:   ";
   for (int iStGeo = 0; iStGeo < this->GetNstationsGeometry(); ++iStGeo) {
     bool isActive = fvGeoToActiveMap[iStGeo] != -1;
     msg << ClrFlg(isActive) << setw(3) << setfill(' ') << fvGeoToActiveMap[iStGeo] << ' ';
   }
-  msg << kCL << '\n';
+  msg << clrs::CL << '\n';
 
-  msg << indent << indentCh << kCLb << "STATIONS:\n" << kCL;
+  msg << indent << indentCh << clrs::CLb << "STATIONS:\n" << clrs::CL;
   msg << indent << indentCh << setw(9) << setfill(' ') << "Active ID" << ' ';
   msg << fStations[0].ToString(1, 0, true) << '\n';
   for (int iStAct = 0; iStAct < this->GetNstationsActive(); ++iStAct) {
@@ -283,7 +280,7 @@ std::string L1Parameters::ToString(int verbosity, int indentLevel) const
     msg << fStations[iStAct].ToString(verbosity, 0) << '\n';
   }
 
-  msg << indent << kCLb << "DEV FLAGS:" << kCL << " (for debug only)\n";
+  msg << indent << clrs::CLb << "DEV FLAGS:" << clrs::CL << " (for debug only)\n";
   msg << indent << indentCh << "Hits search area is ignored:     " << fDevIsIgnoreHitSearchAreas << '\n';
   msg << indent << indentCh << "Non-approx. field is used:       " << fDevIsMatchDoubletsViaMc << '\n';
   msg << indent << indentCh << "Doublets matching via MC:        " << fDevIsMatchDoubletsViaMc << '\n';
diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h
index 5b27bc361f..077a62ce89 100644
--- a/reco/L1/L1Algo/L1Parameters.h
+++ b/reco/L1/L1Algo/L1Parameters.h
@@ -31,15 +31,15 @@ enum class L1DetectorID;
 
 /// Type definitions for used containers
 using L1IterationsContainer_t = L1Vector<L1CAIteration>;
-using L1StationsContainer_t   = std::array<L1Station, constants::size::kMaxNstations>;
-using L1MaterialContainer_t   = std::array<L1Material, constants::size::kMaxNstations>;
+using L1StationsContainer_t   = std::array<L1Station, constants::size::MaxNstations>;
+using L1MaterialContainer_t   = std::array<L1Material, constants::size::MaxNstations>;
 
 
 /// Class L1Parameters represents a container for all external parameters of the L1 tracking algorithm,
 /// including geometry parameters and physics cuts. The instance of the L1Parameters is constructed inside
 /// L1InitManager class and then moved to the L1Algo instance.
 ///
-class alignas(constants::misc::kAlignment) L1Parameters {
+class alignas(constants::misc::Alignment) L1Parameters {
 
   // ********************************
   // ** Friend classes declaration **
@@ -49,7 +49,7 @@ class alignas(constants::misc::kAlignment) L1Parameters {
 
   using L1DetectorID_t = std::underlying_type_t<L1DetectorID>;
   template<typename T>
-  using StationArray_t = std::array<T, constants::size::kMaxNstations>;
+  using StationArray_t = std::array<T, constants::size::MaxNstations>;
 
 public:
   /// Default constructor
@@ -144,7 +144,7 @@ public:
   {
     assert(iStation < fNstationsActiveTotal && iStation > 0);
     assert(iTrackGr < int(fCAIterations.size()));
-    return fSearchWindows[iTrackGr * constants::size::kMaxNstations + iStation];
+    return fSearchWindows[iTrackGr * constants::size::MaxNstations + iStation];
   }
 
   /// @brief Gets reference to the array of station thickness map
@@ -221,41 +221,41 @@ private:
   unsigned int fMaxDoubletsPerSinglet {150};  ///< Upper-bound cut on max number of doublets per one singlet
   unsigned int fMaxTripletPerDoublets {15};   ///< Upper-bound cut on max number of triplets per one doublet
 
-  alignas(constants::misc::kAlignment) L1IterationsContainer_t fCAIterations {};  ///< L1 tracking iterations vector
+  alignas(constants::misc::Alignment) L1IterationsContainer_t fCAIterations {};  ///< L1 tracking iterations vector
 
   /*************************
    ** Geometry parameters **
    *************************/
   /// Target position
-  alignas(constants::misc::kAlignment) std::array<fvec, /*nDimensions*/ 3> fTargetPos {L1Utils::kNaN, L1Utils::kNaN,
-                                                                                       L1Utils::kNaN};
+  alignas(constants::misc::Alignment) std::array<fvec, /*nDimensions*/ 3> fTargetPos {L1Utils::kNaN, L1Utils::kNaN,
+                                                                                      L1Utils::kNaN};
 
   /// Field value object at primary vertex (between target and the first station)
-  alignas(constants::misc::kAlignment) L1FieldValue fVertexFieldValue {};
+  alignas(constants::misc::Alignment) L1FieldValue fVertexFieldValue {};
 
   /// Field region object at primary vertex (between target and the first station)
-  alignas(constants::misc::kAlignment) L1FieldRegion fVertexFieldRegion {};
+  alignas(constants::misc::Alignment) L1FieldRegion fVertexFieldRegion {};
 
   /// Array of stations
-  alignas(constants::misc::kAlignment) L1StationsContainer_t fStations {};
+  alignas(constants::misc::Alignment) L1StationsContainer_t fStations {};
 
   /// Array of station thickness map
-  alignas(constants::misc::kAlignment) L1MaterialContainer_t fThickMap {};
+  alignas(constants::misc::Alignment) L1MaterialContainer_t fThickMap {};
 
   // ** Station layout arrays **
   /// @brief First index of the station on the particular detector
   /// The last element of the array corresponds to the total number of geometry stations
-  alignas(constants::misc::kAlignment) std::array<int, constants::size::kMaxNdetectors + 1> fvFirstGeoId {};
+  alignas(constants::misc::Alignment) std::array<int, constants::size::MaxNdetectors + 1> fvFirstGeoId {};
 
   /// @brief Map of (local, det) to geo indices
   ///
   /// @note Usage:
   ///      iStGeo = fvLocaToGeoIdMap[fvFirstGeoId[iDet] + iStLocal];
   ///      geo index.
-  alignas(constants::misc::kAlignment) StationArray_t<int> fvLocalToGeoIdMap {};
+  alignas(constants::misc::Alignment) StationArray_t<int> fvLocalToGeoIdMap {};
 
   /// @brief Map of geo to (local, det) indices
-  alignas(constants::misc::kAlignment) StationArray_t<std::pair<L1DetectorID, int>> fvGeoToLocalIdMap {};
+  alignas(constants::misc::Alignment) StationArray_t<std::pair<L1DetectorID, int>> fvGeoToLocalIdMap {};
 
   /// @brief Map of geo to active indices
   ///
@@ -264,25 +264,25 @@ private:
   /// @example Let stations 1 and 4 be inactive. Then:
   ///   geometry index:  0  1  2  3  4  5  6  7  8  9  0  0  0  0
   ///   active index:    0 -1  1  2 -1  3  4  5  6  7  0  0  0  0
-  alignas(constants::misc::kAlignment) StationArray_t<int> fvGeoToActiveMap {};
+  alignas(constants::misc::Alignment) StationArray_t<int> fvGeoToActiveMap {};
 
   /// @brief Map of active to geo indices
-  alignas(constants::misc::kAlignment) StationArray_t<int> fvActiveToGeoMap {};
+  alignas(constants::misc::Alignment) StationArray_t<int> fvActiveToGeoMap {};
 
 
-  alignas(constants::misc::kAlignment) int fNstationsActiveTotal = -1;  ///< total number of active tracking stations
+  alignas(constants::misc::Alignment) int fNstationsActiveTotal = -1;  ///< total number of active tracking stations
 
 
   /// @brief Map of search windows vs. active station global index and tracks group
   ///
   /// The tracks group can be defined by minimum momentum (fast/all tracks), origin (primary/secondary) and particle
   /// type (electron, muon, all). Other options also can be added
-  alignas(constants::misc::kAlignment)
-    std::array<L1SearchWindow, constants::size::kMaxNstations* constants::size::kMaxNtrackGroups> fSearchWindows = {};
+  alignas(constants::misc::Alignment)
+    std::array<L1SearchWindow, constants::size::MaxNstations* constants::size::MaxNtrackGroups> fSearchWindows = {};
 
   int fGhostSuppression = 0;  ///< flag: if true, ghost tracks are suppressed
   int fRandomSeed       = 1;  ///< random seed
-  float fDefaultMass    = constants::phys::kMuonMass;
+  float fDefaultMass    = constants::phys::MuonMass;
 
   // ***************************
   // ** Flags for development **
diff --git a/reco/L1/L1Algo/L1Station.h b/reco/L1/L1Algo/L1Station.h
index 61a13ad21c..b5b04cb559 100644
--- a/reco/L1/L1Algo/L1Station.h
+++ b/reco/L1/L1Algo/L1Station.h
@@ -8,11 +8,11 @@
 #include <string>
 #include <type_traits>
 
+#include "CaConstants.h"
 #include "L1Field.h"
 #include "L1Material.h"
 #include "L1SimdSerializer.h"
 #include "L1UMeasurementInfo.h"
-#include "L1Undef.h"
 #include "L1Utils.h"
 #include "L1XYMeasurementInfo.h"
 
@@ -24,12 +24,13 @@ public:
   // TODO: SZh 12.05.2022: Rewrite type into L1DetectorID, change detector indexing scheme
   // TODO: SZh 12.05.2022: Provide getters to stations
 
-  int type        = undef::kI32;
-  int timeInfo    = undef::kI32;  ///< flag: if time information can be used
-  int fieldStatus = undef::kI32;  ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field
-  fvec fZ         = undef::kFvc;  ///< z position of station     [cm]
-  fvec Xmax       = undef::kFvc;  ///< min radius of the station [cm]
-  fvec Ymax       = undef::kFvc;  ///< max radius of the station [cm]
+  int type     = cbm::algo::ca::constants::undef::Int;
+  int timeInfo = cbm::algo::ca::constants::undef::Int;  ///< flag: if time information can be used
+  int fieldStatus =
+    cbm::algo::ca::constants::undef::Int;  ///< flag: 1 - station is INSIDE the field, 0 - station is OUTSIDE the field
+  fvec fZ   = cbm::algo::ca::constants::undef::Fscal;  ///< z position of station     [cm]
+  fvec Xmax = cbm::algo::ca::constants::undef::Fscal;  ///< min radius of the station [cm]
+  fvec Ymax = cbm::algo::ca::constants::undef::Fscal;  ///< max radius of the station [cm]
 
   L1FieldSlice fieldSlice {};
 
diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx
index b594b4eb7b..85fe214696 100644
--- a/reco/L1/L1Algo/L1TrackFitter.cxx
+++ b/reco/L1/L1Algo/L1TrackFitter.cxx
@@ -49,14 +49,14 @@ void L1Algo::L1KFTrackFitter()
 
   // Spatial-time position of a hit vs. station and track in the portion
 
-  fvec x[constants::size::kMaxNstations];                      // Hit position along the x-axis [cm]
-  fvec y[constants::size::kMaxNstations];                      // Hit position along the y-axis [cm]
-  L1XYMeasurementInfo cov_xy[constants::size::kMaxNstations];  // Covariance matrix for x,y
+  fvec x[constants::size::MaxNstations];                      // Hit position along the x-axis [cm]
+  fvec y[constants::size::MaxNstations];                      // Hit position along the y-axis [cm]
+  L1XYMeasurementInfo cov_xy[constants::size::MaxNstations];  // Covariance matrix for x,y
 
-  fvec z[constants::size::kMaxNstations];  // Hit position along the z-axis (precised) [cm]
+  fvec z[constants::size::MaxNstations];  // Hit position along the z-axis (precised) [cm]
 
-  fvec time[constants::size::kMaxNstations];  // Hit time [ns]
-  fvec dt2[constants::size::kMaxNstations];   // Hit time uncertainty [ns] squared
+  fvec time[constants::size::MaxNstations];  // Hit time [ns]
+  fvec dt2[constants::size::MaxNstations];   // Hit time uncertainty [ns] squared
 
   fvec x_first;
   fvec y_first;
@@ -75,9 +75,9 @@ void L1Algo::L1KFTrackFitter()
   fvec dt2_last;
   //  fvec dt2_lst;  /// TODO: Why are there two different variables for the time error on the last station?
 
-  fvec By[constants::size::kMaxNstations];
-  fmask w[constants::size::kMaxNstations];
-  fmask w_time[constants::size::kMaxNstations];  // !!!
+  fvec By[constants::size::MaxNstations];
+  fmask w[constants::size::MaxNstations];
+  fmask w_time[constants::size::MaxNstations];  // !!!
 
   fvec y_temp;
   fvec x_temp;
@@ -87,10 +87,10 @@ void L1Algo::L1KFTrackFitter()
   fvec z_start;
   fvec z_end;
 
-  L1FieldValue fB[constants::size::kMaxNstations], fB_temp _fvecalignment;
+  L1FieldValue fB[constants::size::MaxNstations], fB_temp _fvecalignment;
 
 
-  fvec ZSta[constants::size::kMaxNstations];
+  fvec ZSta[constants::size::MaxNstations];
   for (int ista = 0; ista < nStations; ista++) {
     ZSta[ista]       = sta[ista].fZ;
     cov_xy[ista].C00 = 1.f;
@@ -125,7 +125,7 @@ void L1Algo::L1KFTrackFitter()
     for (int iVec = 0; iVec < nTracks_SIMD; iVec++) {
 
       int nHitsTrack = t[iVec]->fNofHits;
-      int iSta[constants::size::kMaxNstations];
+      int iSta[constants::size::MaxNstations];
 
       for (int ih = 0; ih < nHitsTrack; ih++) {
 
diff --git a/reco/L1/L1Algo/L1TrackPar.h b/reco/L1/L1Algo/L1TrackPar.h
index 46e2ec7e73..84e5f269b9 100644
--- a/reco/L1/L1Algo/L1TrackPar.h
+++ b/reco/L1/L1Algo/L1TrackPar.h
@@ -5,11 +5,11 @@
 #ifndef L1TrackPar_h
 #define L1TrackPar_h 1
 
+#include "CaConstants.h"
 #include "CaSimd.h"
-#include "L1Def.h"
-#include "L1Undef.h"
 
 using namespace cbm::algo::ca;
+using namespace cbm::algo::ca::constants;
 
 class L1TrackPar {
 
@@ -40,10 +40,9 @@ public:
   L1TrackPar() = default;
 
   template<typename T>
-  L1TrackPar(const T* tr, const T* C)
+  L1TrackPar(const std::array<T, kNparTr>& p, const std::array<T, kNparCov>& c)
   {
-    //Set(tr, C); // Not implemented
-    copyFromArrays(tr, C);
+    copyFromArrays(p, c);
   }
 
   //template<typename T>
@@ -71,43 +70,43 @@ public:
   fscal GetX() const { return x[0]; }
 
   /// @brief Gets x position error [cm]
-  fscal GetXErr() const { return (std::isfinite(C00[0]) && C00[0] > 0) ? std::sqrt(C00[0]) : undef::kF; }
+  fscal GetXErr() const { return (std::isfinite(C00[0]) && C00[0] > 0) ? std::sqrt(C00[0]) : undef::Fscal; }
 
   /// @brief Gets y position [cm]
   fscal GetY() const { return y[0]; }
 
   /// @brief Gets y position error [cm]
-  fscal GetYErr() const { return (std::isfinite(C11[0]) && C11[0] > 0) ? std::sqrt(C11[0]) : undef::kF; }
+  fscal GetYErr() const { return (std::isfinite(C11[0]) && C11[0] > 0) ? std::sqrt(C11[0]) : undef::Fscal; }
 
   /// @brief Gets slope along x-axis
   fscal GetTx() const { return tx[0]; }
 
   /// @brief Gets error of slope along x-axis
-  fscal GetTxErr() const { return (std::isfinite(C22[0]) && C22[0] > 0) ? std::sqrt(C22[0]) : undef::kF; }
+  fscal GetTxErr() const { return (std::isfinite(C22[0]) && C22[0] > 0) ? std::sqrt(C22[0]) : undef::Fscal; }
 
   /// @brief Gets slope along y-axis
   fscal GetTy() const { return ty[0]; }
 
   /// @brief Gets error of slope along y-axis
-  fscal GetTyErr() const { return (std::isfinite(C33[0]) && C33[0] > 0) ? std::sqrt(C33[0]) : undef::kF; }
+  fscal GetTyErr() const { return (std::isfinite(C33[0]) && C33[0] > 0) ? std::sqrt(C33[0]) : undef::Fscal; }
 
   /// @brief Gets charge over momentum [ec/GeV]
   fscal GetQp() const { return qp[0]; }
 
   /// @brief Gets error of charge over momentum [ec/GeV]
-  fscal GetQpErr() const { return (std::isfinite(C44[0]) && C44[0] > 0) ? std::sqrt(C44[0]) : undef::kF; }
+  fscal GetQpErr() const { return (std::isfinite(C44[0]) && C44[0] > 0) ? std::sqrt(C44[0]) : undef::Fscal; }
 
   /// @brief Gets time [ns]
   fscal GetTime() const { return t[0]; }
 
   /// @brief Gets time error [ns]
-  fscal GetTimeErr() const { return (std::isfinite(C55[0]) && C55[0] > 0) ? std::sqrt(C55[0]) : undef::kF; }
+  fscal GetTimeErr() const { return (std::isfinite(C55[0]) && C55[0] > 0) ? std::sqrt(C55[0]) : undef::Fscal; }
 
   /// @brief Gets inverse speed [ns/cm]
   fscal GetInvSpeed() const { return vi[0]; }
 
   /// @brief Gets inverse speed error [ns/cm]
-  fscal GetInvSpeedErr() const { return (std::isfinite(C66[0]) && C66[0] > 0) ? std::sqrt(C66[0]) : undef::kF; }
+  fscal GetInvSpeedErr() const { return (std::isfinite(C66[0]) && C66[0] > 0) ? std::sqrt(C66[0]) : undef::Fscal; }
 
   /// @brief Gets azimuthal angle [rad]
   fscal GetPhi() const { return std::atan2(-GetTy(), -GetTx()); }
@@ -142,13 +141,13 @@ public:
   bool IsConsistent(bool printWhenWrong, int nFilled) const;
 
   template<typename T>
-  void copyToArrays(const int iVec, T p[kNparTr], T c[kNparCov]) const;
+  void copyToArrays(const int iVec, std::array<T, kNparTr>& p, std::array<T, kNparCov>& c) const;
 
   template<typename T>
-  void copyFromArrays(const int iVec, const T p[kNparTr], const T c[kNparCov]);
+  void copyFromArrays(const int iVec, const std::array<T, kNparTr>& p, const std::array<T, kNparCov>& c);
 
   template<typename T>
-  void copyFromArrays(const T p[kNparTr], const T c[kNparCov]);
+  void copyFromArrays(const std::array<T, kNparTr>& p, const std::array<T, kNparCov>& c);
 
   void InitVelocityRange(fscal minP);
 
@@ -174,9 +173,9 @@ inline fscal L1TrackPar::GetPhiErr() const
   fscal phiDTx     = -phiDFactor * GetTy();  // partial derivative of phi over Tx
   fscal phiDTy     = +phiDFactor * GetTx();  // partial derivative of phi over Ty
 
-  fscal varTx   = (std::isfinite(C22[0]) && C22[0] > 0) ? C22[0] : undef::kF;  // variance of Tx
-  fscal varTy   = (std::isfinite(C33[0]) && C33[0] > 0) ? C33[0] : undef::kF;  // variance of Ty
-  fscal covTxTy = std::isfinite(C32[0]) ? C32[0] : undef::kF;                  // covariance of Tx and Ty
+  fscal varTx   = (std::isfinite(C22[0]) && C22[0] > 0) ? C22[0] : undef::Fscal;  // variance of Tx
+  fscal varTy   = (std::isfinite(C33[0]) && C33[0] > 0) ? C33[0] : undef::Fscal;  // variance of Ty
+  fscal covTxTy = std::isfinite(C32[0]) ? C32[0] : undef::Fscal;                  // covariance of Tx and Ty
 
   fscal varPhi = phiDTx * phiDTx * varTx + phiDTy * phiDTy * varTy + 2 * phiDTx * phiDTy * covTxTy;
   return std::sqrt(varPhi);
@@ -191,9 +190,9 @@ inline fscal L1TrackPar::GetThetaErr() const
   fscal thetaDTx     = thetaDFactor * GetTx();
   fscal thetaDTy     = thetaDFactor * GetTy();
 
-  fscal varTx   = (std::isfinite(C22[0]) && C22[0] > 0) ? C22[0] : undef::kF;  // variance of Tx
-  fscal varTy   = (std::isfinite(C33[0]) && C33[0] > 0) ? C33[0] : undef::kF;  // variance of Ty
-  fscal covTxTy = std::isfinite(C32[0]) ? C32[0] : undef::kF;                  // covariance of Tx and Ty
+  fscal varTx   = (std::isfinite(C22[0]) && C22[0] > 0) ? C22[0] : undef::Fscal;  // variance of Tx
+  fscal varTy   = (std::isfinite(C33[0]) && C33[0] > 0) ? C33[0] : undef::Fscal;  // variance of Ty
+  fscal covTxTy = std::isfinite(C32[0]) ? C32[0] : undef::Fscal;                  // covariance of Tx and Ty
 
   fscal varTheta = thetaDTx * thetaDTx * varTx + thetaDTy * thetaDTy * varTy + 2 * thetaDTx * thetaDTy * covTxTy;
   return std::sqrt(varTheta);
@@ -202,7 +201,7 @@ inline fscal L1TrackPar::GetThetaErr() const
 // ---------------------------------------------------------------------------------------------------------------------
 //
 template<typename T>
-inline void L1TrackPar::copyToArrays(const int iVec, T p[kNparTr], T c[kNparCov]) const
+inline void L1TrackPar::copyToArrays(const int iVec, std::array<T, kNparTr>& p, std::array<T, kNparCov>& c) const
 {
   p[0] = x[iVec];
   p[1] = y[iVec];
@@ -222,7 +221,8 @@ inline void L1TrackPar::copyToArrays(const int iVec, T p[kNparTr], T c[kNparCov]
 // ---------------------------------------------------------------------------------------------------------------------
 //
 template<typename T>
-inline void L1TrackPar::copyFromArrays(const int iVec, const T p[kNparTr], const T c[kNparCov])
+inline void L1TrackPar::copyFromArrays(const int iVec, const std::array<T, kNparTr>& p,
+                                       const std::array<T, kNparCov>& c)
 {
   x[iVec]  = p[0];
   y[iVec]  = p[1];
@@ -245,7 +245,7 @@ inline void L1TrackPar::copyFromArrays(const int iVec, const T p[kNparTr], const
 // ---------------------------------------------------------------------------------------------------------------------
 //
 template<typename T>
-inline void L1TrackPar::copyFromArrays(const T p[kNparTr], const T c[kNparCov])
+inline void L1TrackPar::copyFromArrays(const std::array<T, kNparTr>& p, const std::array<T, kNparCov>& c)
 {
   x  = p[0];
   y  = p[1];
@@ -330,8 +330,8 @@ inline void L1TrackPar::ResetErrors(fvec c00, fvec c11, fvec c22, fvec c33, fvec
   C55 = c55;
   C66 = c66;
 
-  chi2 = 0.;
-  NDF  = -6.;
+  chi2              = 0.;
+  NDF               = -6.;
   nTimeMeasurements = 0.;
 }
 
diff --git a/reco/L1/L1Algo/L1TripletConstructor.cxx b/reco/L1/L1Algo/L1TripletConstructor.cxx
index 3e4785f836..3acf332ab1 100644
--- a/reco/L1/L1Algo/L1TripletConstructor.cxx
+++ b/reco/L1/L1Algo/L1TripletConstructor.cxx
@@ -70,7 +70,7 @@ void L1TripletConstructor::InitStations(int istal, int istam, int istar)
   }
 
   fFit.SetParticleMass(fAlgo->GetDefaultParticleMass());
-  if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fFit.SetParticleMass(constants::phys::kElectronMass); }
+  if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fFit.SetParticleMass(constants::phys::ElectronMass); }
   fFit.SetMask(fmask::One());
 
   fIsInitialized = true;
@@ -383,7 +383,7 @@ void L1TripletConstructor::FitTriplets()
   L1Fit fit;
   fit.SetMask(fmask::One());
 
-  if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fit.SetParticleMass(constants::phys::kElectronMass); }
+  if (fAlgo->fpCurrentIteration->GetElectronFlag()) { fit.SetParticleMass(constants::phys::ElectronMass); }
   else {
     fit.SetParticleMass(fAlgo->GetDefaultParticleMass());
   }
diff --git a/reco/L1/L1Algo/L1UMeasurementInfo.h b/reco/L1/L1Algo/L1UMeasurementInfo.h
index bb1b775469..7390e4af74 100644
--- a/reco/L1/L1Algo/L1UMeasurementInfo.h
+++ b/reco/L1/L1Algo/L1UMeasurementInfo.h
@@ -7,16 +7,16 @@
 
 #include <string>
 
+#include "CaConstants.h"
 #include "L1Def.h"
 #include "L1SimdSerializer.h"
-#include "L1Undef.h"
 #include "L1Utils.h"
 
 class L1UMeasurementInfo {
 
 public:
-  cbm::algo::ca::fvec cos_phi = undef::kFvc;
-  cbm::algo::ca::fvec sin_phi = undef::kFvc;
+  cbm::algo::ca::fvec cos_phi = cbm::algo::ca::constants::undef::Fscal;
+  cbm::algo::ca::fvec sin_phi = cbm::algo::ca::constants::undef::Fscal;
 
   /// String representation of class contents
   /// \param indentLevel      number of indent characters in the output
diff --git a/reco/L1/L1Algo/L1Undef.h b/reco/L1/L1Algo/L1Undef.h
deleted file mode 100644
index adc32adf41..0000000000
--- a/reco/L1/L1Algo/L1Undef.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
-   SPDX-License-Identifier: GPL-3.0-only
-   Authors: Sergey Gorbunov, Sergei Zharko [committer] */
-
-/// \file   L1Undef.h
-/// \brief  Namespace L1Undef provides undefined values for different types
-/// \since  18.11.2022
-/// \author S.Zharko <s.zharko@gsi.de>
-
-#ifndef L1Undef_h
-#define L1Undef_h 1
-
-#include <limits>
-
-#include "CaSimd.h"
-
-// NOTE: SZh 18.11.2022:
-//
-// A temporary solution. Previously, it was found that "using namespace cbm::algo::ca;" was introduced into a L1NaN.h
-// header. This had an influence on every class in L1Algo directory (each of them has at least one fvec or fscal
-// variable). In future classes inside this directory will be placed in the cbm::algo:;ca namespace, so the following
-// lines will not be needed anymore.
-using cbm::algo::ca::fmask;
-using cbm::algo::ca::fscal;
-using cbm::algo::ca::fvec;
-
-namespace undef
-{
-  constexpr int kI32      = -1;
-  constexpr unsigned kU32 = 4294967295;
-  constexpr float kF      = std::numeric_limits<float>::quiet_NaN();
-  constexpr double kD     = std::numeric_limits<double>::quiet_NaN();
-  constexpr fscal kFvc    = std::numeric_limits<fscal>::quiet_NaN();
-
-  /// Checks whether a variable of a particular type defined
-  template<typename T>
-  bool IsUndefined(T val);
-}  // namespace undef
-
-template<>
-inline bool undef::IsUndefined<int>(int val)
-{
-  return val == undef::kI32;
-}
-
-template<>
-inline bool undef::IsUndefined<unsigned>(unsigned val)
-{
-  return val == undef::kU32;
-}
-
-template<>
-inline bool undef::IsUndefined<float>(float val)
-{
-  return std::isnan(val);
-}
-
-template<>
-inline bool undef::IsUndefined<double>(double val)
-{
-  return std::isnan(val);
-}
-
-template<>
-inline bool undef::IsUndefined<cbm::algo::ca::fvec>(cbm::algo::ca::fvec val)
-{
-  return isnan(val).isNotEmpty();
-}
-
-#endif  // L1Undef_h
diff --git a/reco/L1/L1Algo/L1XYMeasurementInfo.h b/reco/L1/L1Algo/L1XYMeasurementInfo.h
index 41a82401be..6580a59ae0 100644
--- a/reco/L1/L1Algo/L1XYMeasurementInfo.h
+++ b/reco/L1/L1Algo/L1XYMeasurementInfo.h
@@ -7,16 +7,14 @@
 
 #include <string>
 
+#include "CaConstants.h"
 #include "L1Def.h"
 #include "L1SimdSerializer.h"
-#include "L1Undef.h"
+
+using namespace cbm::algo::ca;
 
 class L1XYMeasurementInfo {
 public:
-  cbm::algo::ca::fvec C00 = undef::kFvc;
-  cbm::algo::ca::fvec C10 = undef::kFvc;
-  cbm::algo::ca::fvec C11 = undef::kFvc;
-
   /// Consistency checker
   void CheckConsistency() const;
 
@@ -25,7 +23,11 @@ public:
   std::string ToString(int indentLevel = 0) const;
 
   /// Checks, if the fields are NaN
-  bool IsNaN() const { return undef::IsUndefined(C00) || undef::IsUndefined(C10) || undef::IsUndefined(C11); }
+  bool IsNaN() const
+  {
+    return constants::undef::IsUndefined(C00) || constants::undef::IsUndefined(C10)
+           || constants::undef::IsUndefined(C11);
+  }
 
   /// Serialization function
   friend class boost::serialization::access;
@@ -36,6 +38,12 @@ public:
     ar& C10;
     ar& C11;
   }
+
+public:
+  fvec C00 {constants::undef::Fscal};
+  fvec C10 {constants::undef::Fscal};
+  fvec C11 {constants::undef::Fscal};
+
 } _fvecalignment;
 
 
diff --git a/reco/L1/L1Algo/utils/CaUvConverter.h b/reco/L1/L1Algo/utils/CaUvConverter.h
index 9b6e519435..4e9ca9aa48 100644
--- a/reco/L1/L1Algo/utils/CaUvConverter.h
+++ b/reco/L1/L1Algo/utils/CaUvConverter.h
@@ -6,8 +6,8 @@
 #define CaUvConverter_h 1
 
 
+#include "CaConstants.h"
 #include "L1Def.h"
-#include "L1Undef.h"
 
 namespace cbm::ca
 {
@@ -72,17 +72,17 @@ namespace cbm::ca
 
 
   private:
-    double fcosU {undef::kD};  ///< U coordinate in XY
-    double fsinU {undef::kD};
+    double fcosU {constants::undef::Double};  ///< U coordinate in XY
+    double fsinU {constants::undef::Double};
 
-    double fcosV {undef::kD};  ///< V coordinate in XY
-    double fsinV {undef::kD};
+    double fcosV {constants::undef::Double};  ///< V coordinate in XY
+    double fsinV {constants::undef::Double};
 
-    double fcosX {undef::kD};  ///< X coordinate in UV
-    double fsinX {undef::kD};
+    double fcosX {constants::undef::Double};  ///< X coordinate in UV
+    double fsinX {constants::undef::Double};
 
-    double fcosY {undef::kD};  ///< Y coordinate in UV
-    double fsinY {undef::kD};
+    double fcosY {constants::undef::Double};  ///< Y coordinate in UV
+    double fsinY {constants::undef::Double};
   };
 
 }  // namespace cbm::ca
diff --git a/reco/L1/L1Algo/utils/L1Utils.h b/reco/L1/L1Algo/utils/L1Utils.h
deleted file mode 100644
index 064a36c356..0000000000
--- a/reco/L1/L1Algo/utils/L1Utils.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2016-2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
-   SPDX-License-Identifier: GPL-3.0-only
-   Authors: Sergey Gorbunov, Sergei Zharko [committer] */
-
-/************************************************************************************************************
- * @file  L1Utilities.h
- * @brief File contains some general purpose functions for 
- * @since 12.01.2022
- ***********************************************************************************************************/
-
-#include <iomanip>
-#include <map>
-#include <sstream>
-#include <string>
-#include <unordered_map>
-
-/// Class contains some usefull functions, which could be used in any other classes
-struct L1Utils {
-
-  /// Hash for unordered_map with enum class keys
-  struct EnumClassHash {
-    template<typename T>
-    int operator()(T t) const
-    {
-      return static_cast<int>(t);
-    }
-  };
-
-
-  /// Template function, which sets a value to an element of the map with a particular key
-  /// \param key    Key of the element to be modified
-  /// \param value  New value of the element under the selected key
-  /// \param aMap   A reference to the map, which element is to be modified
-  template<class Key, class T, class Hash = std::hash<Key>>
-  static void SetSingleValueToMap(Key key, T value, std::unordered_map<Key, T, Hash>& aMap)
-  {
-    aMap[key] = value;
-  }
-
-  /// Template function, which sets a value to ALL elements of the map
-  /// \param value  New value of the element under the selected key
-  /// \param aMap   A reference to the map, which element is to be modified
-  template<class Key, class T, class Hash = std::hash<Key>>
-  static void SetSameValueToMap(T value, std::unordered_map<Key, T, Hash>& aMap)
-  {
-    for (auto it = aMap.begin(); it != aMap.end(); ++it) {
-      it->second = value;
-    }
-  }
-
-  /// Template function, which resets the elements of one map with the values defined in another map
-  /// \param inMap  A constant reference to the map containing new parameters
-  /// \param aMap   A reference to the map, which is going to be modified
-  template<class Key, class T, class Hash = std::hash<Key>>
-  static void SetMappedValuesToMap(const std::unordered_map<Key, T, Hash>& inMap,
-                                   std::unordered_map<Key, T, Hash>& aMap)
-  {
-    for (auto it = aMap.begin(); it != aMap.end(); ++it) {
-      if (inMap.find(it->first) != inMap.end()) { it->second = inMap.at(it->first); }
-    }
-  }
-
-  /// Template function to represent mapped contents into std::string
-  /// NOTE: operator<< must be defined for value of the map
-  template<class Key, class T, class Hash = std::hash<Key>>
-  static std::string RepresentMapWithString(const std::unordered_map<Key, T, Hash>& aMap, int entryWidth = 15)
-  {
-    std::stringstream token;
-    for (auto it = aMap.begin(); it != aMap.end(); ++it) {
-      token << std::setw(entryWidth) << std::setfill(' ') << it->second << ' ';
-    }
-    return token.str();
-  }
-};
diff --git a/reco/L1/L1LinkDef.h b/reco/L1/L1LinkDef.h
index 3e23299179..b56c0faefb 100644
--- a/reco/L1/L1LinkDef.h
+++ b/reco/L1/L1LinkDef.h
@@ -24,7 +24,6 @@
 //#pragma link C++ class  CbmL1SttTrack+;
 #pragma link C++ class CbmTrackerInputQaTrd + ;
 #pragma link C++ class CbmTrackerInputQaTof + ;
-#pragma link C++ class CbmCaInputQaBase + ;
 #pragma link C++ class CbmCaInputQaMvd + ;
 #pragma link C++ class CbmCaInputQaMuch + ;
 #pragma link C++ class CbmCaInputQaSts + ;
diff --git a/reco/L1/catools/CaToolsLinkKey.h b/reco/L1/catools/CaToolsLinkKey.h
index 7f9ce0560f..3cd440f933 100644
--- a/reco/L1/catools/CaToolsLinkKey.h
+++ b/reco/L1/catools/CaToolsLinkKey.h
@@ -12,7 +12,7 @@
 
 #include <boost/functional/hash.hpp>
 
-#include "L1Undef.h"
+#include "CaConstants.h"
 
 namespace ca::tools
 {
@@ -29,9 +29,9 @@ namespace ca::tools
       return lhs.fFile == rhs.fFile && lhs.fEvent == rhs.fEvent && lhs.fIndex == rhs.fIndex;
     }
 
-    int fIndex = undef::kI32;  ///< Index of MC point/track in external data structures
-    int fEvent = undef::kI32;  ///< Index of MC event
-    int fFile  = undef::kI32;  ///< Index of MC file
+    int fIndex = cbm::algo::ca::constants::undef::Int;  ///< Index of MC point/track in external data structures
+    int fEvent = cbm::algo::ca::constants::undef::Int;  ///< Index of MC event
+    int fFile  = cbm::algo::ca::constants::undef::Int;  ///< Index of MC file
   };
 }  // namespace ca::tools
 
diff --git a/reco/L1/catools/CaToolsMCData.h b/reco/L1/catools/CaToolsMCData.h
index dedd743afc..d09577ab77 100644
--- a/reco/L1/catools/CaToolsMCData.h
+++ b/reco/L1/catools/CaToolsMCData.h
@@ -184,8 +184,8 @@ namespace ca::tools
     L1Vector<MCPoint> fvPoints = {"ca::tools::MCData::fvPoints"};  ///< Container of points
     L1Vector<MCTrack> fvTracks = {"ca::tools::MCData::fvTracks"};  ///< Container of tracks
 
-    std::array<int, constants::size::kMaxNdetectors> fvNofPointsOrig = {0};  ///< Total number of points by detector
-    std::array<int, constants::size::kMaxNdetectors> fvNofPointsUsed = {0};  ///< Number of points used vs. detector
+    std::array<int, constants::size::MaxNdetectors> fvNofPointsOrig = {0};  ///< Total number of points by detector
+    std::array<int, constants::size::MaxNdetectors> fvNofPointsUsed = {0};  ///< Number of points used vs. detector
 
     std::unordered_map<LinkKey, int> fmPointLinkMap = {};  ///< MC point internal index vs. link
     std::unordered_map<LinkKey, int> fmTrackLinkMap = {};  ///< MC track internal index vs. link
diff --git a/reco/L1/catools/CaToolsMCPoint.h b/reco/L1/catools/CaToolsMCPoint.h
index a2744b2fce..d0f7deb010 100644
--- a/reco/L1/catools/CaToolsMCPoint.h
+++ b/reco/L1/catools/CaToolsMCPoint.h
@@ -14,14 +14,14 @@
 
 #include "CaConstants.h"
 #include "CaToolsLinkKey.h"
-#include "L1Undef.h"
 #include "L1Vector.h"
 
 enum class L1DetectorID;
 
 namespace ca::tools
 {
-  namespace phys = cbm::algo::ca::constants::phys;
+  namespace phys  = cbm::algo::ca::constants::phys;
+  namespace undef = cbm::algo::ca::constants::undef;
 
   /// @brief Class describes a unified MC-point, used in CA tracking QA analysis
   ///
@@ -78,19 +78,19 @@ namespace ca::tools
     /// @brief Gets inverse speed at reference z of station [ns/cm]
     int GetInvSpeed() const
     {
-      return std::sqrt(1. + GetMass() * GetMass() / GetP() / GetP()) * constants::phys::kSpeedOfLightInv;
+      return std::sqrt(1. + GetMass() * GetMass() / GetP() / GetP()) * constants::phys::SpeedOfLightInv;
     }
 
     /// @brief Gets inverse speed at entrance to station [ns/cm]
     int GetInvSpeedIn() const
     {
-      return std::sqrt(1. + GetMass() * GetMass() / GetPIn() / GetPIn()) * constants::phys::kSpeedOfLightInv;
+      return std::sqrt(1. + GetMass() * GetMass() / GetPIn() / GetPIn()) * constants::phys::SpeedOfLightInv;
     }
 
     /// @brief Gets inverse speed at exit of station [ns/cm]
     int GetInvSpeedOut() const
     {
-      return std::sqrt(1. + GetMass() * GetMass() / GetPOut() / GetPOut()) * constants::phys::kSpeedOfLightInv;
+      return std::sqrt(1. + GetMass() * GetMass() / GetPOut() / GetPOut()) * constants::phys::SpeedOfLightInv;
     }
 
     /// @brief Gets container of matched hit indexes
@@ -336,24 +336,30 @@ namespace ca::tools
     // ****************************
 
   private:
-    std::array<double, 3> fPos    = {undef::kD, undef::kD, undef::kD};  ///< Position at reference z of station [cm]
-    std::array<double, 3> fPosIn  = {undef::kD, undef::kD, undef::kD};  ///< Position at entrance to station [cm]
-    std::array<double, 3> fPosOut = {undef::kD, undef::kD, undef::kD};  ///< Position at exit of station [cm]
-    std::array<double, 3> fMom    = {undef::kD, undef::kD, undef::kD};  ///< Momentum at reference z of station [cm]
-    std::array<double, 3> fMomIn  = {undef::kD, undef::kD, undef::kD};  ///< Momentum at entrance to station [cm]
-    std::array<double, 3> fMomOut = {undef::kD, undef::kD, undef::kD};  ///< Momentum at exit of station [cm]
-
-    double fMass   = undef::kD;  ///< Particle mass [GeV/c2]
-    double fCharge = undef::kD;  ///< Particle charge [e]
-    double fTime   = undef::kD;  ///< Point time [ns]
-
-    LinkKey fLinkKey = {undef::kI32, undef::kI32, undef::kI32};  ///< Link key of point
-
-    int fPdgCode   = undef::kI32;  ///< Particle PDG code
-    int fId        = undef::kI32;  ///< Index of MC point in the external MC point container
-    int fTrackId   = undef::kI32;  ///< Index of associated MC track in CA internal track container within TS/event
-    int fMotherId  = undef::kI32;  ///< Index of mother track in CA internal data structures (within event/TS)
-    int fStationId = undef::kI32;  ///< Global index of active tracking station
+    std::array<double, 3> fPos    = {undef::Double, undef::Double,
+                                  undef::Double};  ///< Position at reference z of station [cm]
+    std::array<double, 3> fPosIn  = {undef::Double, undef::Double,
+                                    undef::Double};  ///< Position at entrance to station [cm]
+    std::array<double, 3> fPosOut = {undef::Double, undef::Double,
+                                     undef::Double};  ///< Position at exit of station [cm]
+    std::array<double, 3> fMom    = {undef::Double, undef::Double,
+                                  undef::Double};  ///< Momentum at reference z of station [cm]
+    std::array<double, 3> fMomIn  = {undef::Double, undef::Double,
+                                    undef::Double};  ///< Momentum at entrance to station [cm]
+    std::array<double, 3> fMomOut = {undef::Double, undef::Double,
+                                     undef::Double};  ///< Momentum at exit of station [cm]
+
+    double fMass   = undef::Double;  ///< Particle mass [GeV/c2]
+    double fCharge = undef::Double;  ///< Particle charge [e]
+    double fTime   = undef::Double;  ///< Point time [ns]
+
+    LinkKey fLinkKey = {undef::Int, undef::Int, undef::Int};  ///< Link key of point
+
+    int fPdgCode   = undef::Int;  ///< Particle PDG code
+    int fId        = undef::Int;  ///< Index of MC point in the external MC point container
+    int fTrackId   = undef::Int;  ///< Index of associated MC track in CA internal track container within TS/event
+    int fMotherId  = undef::Int;  ///< Index of mother track in CA internal data structures (within event/TS)
+    int fStationId = undef::Int;  ///< Global index of active tracking station
 
     L1DetectorID fDetectorId;  ///< Detector ID of MC point
 
diff --git a/reco/L1/catools/CaToolsMCTrack.h b/reco/L1/catools/CaToolsMCTrack.h
index 7d11d749f0..6b55029a0e 100644
--- a/reco/L1/catools/CaToolsMCTrack.h
+++ b/reco/L1/catools/CaToolsMCTrack.h
@@ -16,14 +16,16 @@
 
 #include <functional>
 
+#include "CaConstants.h"
 #include "CaToolsLinkKey.h"
-#include "L1Undef.h"
 #include "L1Vector.h"
 
 class CbmL1HitDebugInfo;
 
 namespace ca::tools
 {
+  using namespace cbm::algo::ca::constants;
+
   class MCPoint;
   class MCTrack {
   public:
@@ -331,35 +333,35 @@ namespace ca::tools
     // **     Data variables     **
     // ****************************
 
-    double fMass   = undef::kD;  ///< Particle mass [GeV/c2]
-    double fCharge = undef::kD;  ///< Particle charge [e]
-    double fTime   = undef::kD;  ///< Time of track [cm]
+    double fMass   = undef::Double;  ///< Particle mass [GeV/c2]
+    double fCharge = undef::Double;  ///< Particle charge [e]
+    double fTime   = undef::Double;  ///< Time of track [cm]
 
-    std::array<double, 3> fPos = {undef::kD, undef::kD, undef::kD};  ///< Track vertex components [cm]
-    std::array<double, 3> fMom = {undef::kD, undef::kD, undef::kD};  ///< Momentum components [GeV/c]
+    std::array<double, 3> fPos = {undef::Double, undef::Double, undef::Double};  ///< Track vertex components [cm]
+    std::array<double, 3> fMom = {undef::Double, undef::Double, undef::Double};  ///< Momentum components [GeV/c]
 
-    int fPdgCode     = undef::kI32;  ///< PDG encoding
-    unsigned fProcId = undef::kU32;  ///< Process ID (from ROOT::TProcessID)
+    int fPdgCode     = undef::Int;   ///< PDG encoding
+    unsigned fProcId = undef::Uint;  ///< Process ID (from ROOT::TProcessID)
 
     // Track address
-    int fId       = undef::kI32;  ///< Index of MC track in internal container for TS/event
-    int fMotherId = undef::kI32;  ///< Index of mother MC track in the external tracks container
+    int fId       = undef::Int;  ///< Index of MC track in internal container for TS/event
+    int fMotherId = undef::Int;  ///< Index of mother MC track in the external tracks container
 
-    LinkKey fLinkKey = {undef::kI32, undef::kI32,
-                        undef::kI32};  ///< A link key of this track in the external data structures
+    LinkKey fLinkKey = {undef::Int, undef::Int,
+                        undef::Int};  ///< A link key of this track in the external data structures
 
     bool fIsSignal          = false;  ///< If the track comes from signal
     bool fIsReconstructable = false;  ///< If track is reconstructable
     bool fIsAdditional      = false;  ///< If track is not reconstructable, but still interesting
 
     // Arrangement of hits and points within the stations
-    int fNofConsStationsWithHit   = undef::kI32;  ///< Number of consecutive stations with hits
-    int fNofConsStationsWithPoint = undef::kI32;  ///< Number of consecutive stations with points
-    int fTotNofStationsWithHit    = undef::kI32;  ///< Total number of stations with hits
-    int fTotNofStationsWithPoint  = undef::kI32;  ///< Total number of stations with MC points
-    int fMaxNofPointsOnStation    = undef::kI32;  ///< Max number of MC points on a station
-    int fMaxNofPointsOnSensor     = undef::kI32;  ///< Max number of MC points with same Z (means on same sensor)
-    int fMaxNofHitsOnStation      = undef::kI32;  ///< Max number of hits on a station
+    int fNofConsStationsWithHit   = undef::Int;  ///< Number of consecutive stations with hits
+    int fNofConsStationsWithPoint = undef::Int;  ///< Number of consecutive stations with points
+    int fTotNofStationsWithHit    = undef::Int;  ///< Total number of stations with hits
+    int fTotNofStationsWithPoint  = undef::Int;  ///< Total number of stations with MC points
+    int fMaxNofPointsOnStation    = undef::Int;  ///< Max number of MC points on a station
+    int fMaxNofPointsOnSensor     = undef::Int;  ///< Max number of MC points with same Z (means on same sensor)
+    int fMaxNofHitsOnStation      = undef::Int;  ///< Max number of hits on a station
 
     L1Vector<int> fvPointIndexes      = {"ca::tools::fvPointIndexes"};       ///< Indexes of MC points in ext.container
     L1Vector<int> fvHitIndexes        = {"ca::tools::fvHitIndexes"};         ///< Indexes of hits in int.container
diff --git a/reco/L1/catools/CaToolsWindowFinder.cxx b/reco/L1/catools/CaToolsWindowFinder.cxx
index fe51859d19..b837294204 100644
--- a/reco/L1/catools/CaToolsWindowFinder.cxx
+++ b/reco/L1/catools/CaToolsWindowFinder.cxx
@@ -30,7 +30,7 @@
 #include "L1SearchWindow.h"
 
 using namespace ca::tools;
-using namespace cbm::algo::ca::constants::clrs;  // for colored logs
+using namespace cbm::algo::ca::constants;  // for colored logs
 
 ClassImp(ca::tools::WindowFinder);
 
@@ -38,7 +38,7 @@ ClassImp(ca::tools::WindowFinder);
 //
 WindowFinder::WindowFinder() : fpMcTripletsTree(new TChain(kTreeName))
 {
-  LOG(info) << kGNb << "Call" << kCLb << "WindowFinder constructor\n" << kCL;
+  LOG(info) << clrs::GNb << "Call" << clrs::CLb << "WindowFinder constructor\n" << clrs::CL;
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -254,8 +254,8 @@ void WindowFinder::Process(Option_t* /*opt*/)
   oa << int(fvStationIndexes.size() * fvCaIters.size());
   for (auto iStation : fvStationIndexes) {
     for (const auto& iter : fvCaIters) {
-      LOG(info) << "WindowFinder: processing global active station index " << kCLb << iStation << kCL
-                << " and track finder iteration " << kCLb << iter.GetName() << kCL;
+      LOG(info) << "WindowFinder: processing global active station index " << clrs::CLb << iStation << clrs::CL
+                << " and track finder iteration " << clrs::CLb << iter.GetName() << clrs::CL;
       auto sw = CreateSW(iStation, iter);
       oa << sw;
     }
diff --git a/reco/L1/qa/CbmCaInputQaBase.cxx b/reco/L1/qa/CbmCaInputQaBase.cxx
index 5c5ef2a9fb..dea0fb1c17 100644
--- a/reco/L1/qa/CbmCaInputQaBase.cxx
+++ b/reco/L1/qa/CbmCaInputQaBase.cxx
@@ -57,7 +57,7 @@
 
 #include "CaConstants.h"
 
-using cbm::algo::ca::constants::phys::kSpeedOfLight;
+using namespace cbm::algo::ca::constants;
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
@@ -487,7 +487,7 @@ void CbmCaInputQaBase<DetID>::FillHistograms()
       double shiftZ = fHitQaData.GetHitZ() - zMC;  // Difference between hit and point z positions
       double xMCs   = xMC + shiftZ * pxMC / pzMC;
       double yMCs   = yMC + shiftZ * pyMC / pzMC;
-      double tMCs   = tMC + shiftZ / (pzMC * kSpeedOfLight) * sqrt(mass * mass + pMC * pMC);
+      double tMCs   = tMC + shiftZ / (pzMC * phys::SpeedOfLight) * sqrt(mass * mass + pMC * pMC);
 
       fHitQaData.SetPointTime(tMCs);
       fHitQaData.SetPointX(xMCs);
diff --git a/reco/L1/qa/CbmCaTrackFitQa.h b/reco/L1/qa/CbmCaTrackFitQa.h
index cf346daff1..90c1f11699 100644
--- a/reco/L1/qa/CbmCaTrackFitQa.h
+++ b/reco/L1/qa/CbmCaTrackFitQa.h
@@ -199,7 +199,7 @@ namespace cbm::ca
 
     TString fsTitle = "";  ///< Title of the point
 
-    double fMass = constants::phys::kMuonMass;  /// Mass of particle
+    double fMass = constants::phys::MuonMass;  /// Mass of particle
   };
 
   // *****************************
diff --git a/reco/L1/utils/CbmCaIdealHitProducerDet.h b/reco/L1/utils/CbmCaIdealHitProducerDet.h
index 60c28c88d0..4916c6fe63 100644
--- a/reco/L1/utils/CbmCaIdealHitProducerDet.h
+++ b/reco/L1/utils/CbmCaIdealHitProducerDet.h
@@ -54,12 +54,14 @@
 #include <yaml-cpp/yaml.h>
 
 #include "CaAlgoRandom.h"
+#include "CaConstants.h"
 #include "CaUvConverter.h"
 #include "L1Def.h"
-#include "L1Undef.h"
 
 namespace cbm::ca
 {
+  using namespace cbm::algo::ca::constants;
+
   /// @brief Ideal hit producer class
   ///
   ///
@@ -128,12 +130,12 @@ namespace cbm::ca
     /// @brief A structure to keep hit adjustment/creation settings for each station
     struct HitParameters {
 
-      double fPhiU {undef::kD};  ///< Angle of the first independent measured coordinate [rad]
-      double fPhiV {undef::kD};  ///< Angle of the second independent measured coordinate [rad]
+      double fPhiU {undef::Double};  ///< Angle of the first independent measured coordinate [rad]
+      double fPhiV {undef::Double};  ///< Angle of the second independent measured coordinate [rad]
 
-      double fDu = undef::kD;  ///< Error of u-coordinate measurement [cm]
-      double fDv = undef::kD;  ///< Error of v-coordinate measurement [cm]
-      double fDt = undef::kD;  ///< Error of time measurement [ns]
+      double fDu = undef::Double;  ///< Error of u-coordinate measurement [cm]
+      double fDv = undef::Double;  ///< Error of v-coordinate measurement [cm]
+      double fDt = undef::Double;  ///< Error of time measurement [ns]
 
       /// PDFs selection for different quantities
       /// - 0: Bounded Gaussian distribution
-- 
GitLab