From 0190a9682a13779216beb4b625d637bb0ac8cf53 Mon Sep 17 00:00:00 2001
From: Moritz Kiehn <msmk@cern.ch>
Date: Fri, 13 Mar 2020 17:12:04 +0100
Subject: [PATCH] Utilities: add free parameters index enum

---
 .../detail/DefaultParameterDefinitions.hpp    | 31 +++++++++++++++++--
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp b/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp
index 4663c06ac..a54e3af8d 100644
--- a/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp
+++ b/Core/include/Acts/Utilities/detail/DefaultParameterDefinitions.hpp
@@ -34,8 +34,33 @@ enum ParDef : unsigned int {
   BoundParsDim  /// < The local dimensions
 };
 
-/// The dimensions of tracks in free coordinates
-constexpr unsigned int FreeParsDim = 8;
+/// Components of a free track parameters vector.
+///
+/// To be used to access components by named indices instead of just numbers.
+/// This must be a regular `enum` and not a scoped `enum class` to allow
+/// implicit conversion to an integer. The enum value are thus visible directly
+/// in `namespace Acts` and are prefixed to avoid naming collisions.
+enum FreeParametersIndices : unsigned int {
+  // Spatial position
+  // The spatial position components must be stored as one continous block.
+  eFreePos0 = 0u,
+  eFreePos1 = eFreePos0 + 1u,
+  eFreePos2 = eFreePos0 + 2u,
+  // Time
+  eFreeTime = 3u,
+  // (Unit) direction
+  // The direction components must be stored as one continous block.
+  eFreeDir0 = 4u,
+  eFreeDir1 = eFreeDir0 + 1u,
+  eFreeDir2 = eFreeDir0 + 2u,
+  // Global inverse-momentum-like parameter, i.e. q/p or 1/p
+  // See BoundParametersIndices for further information
+  eFreeQOverP = 7u,
+  // Last uninitialized value contains the total number of components
+  eFreeParametersSize,
+  // For backward compatibility
+  FreeParsDim = eFreeParametersSize,
+};
 
 /// The dimension of a space point
 constexpr unsigned int SpacePointDim = 4;
@@ -135,4 +160,4 @@ template <>
 struct par_type<ParDef::eT> {
   using type = unbound_parameter;
 };
-}  // namespace Acts
\ No newline at end of file
+}  // namespace Acts
-- 
GitLab