ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParameterDefinitions.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParameterDefinitions.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 #include <cmath>
12 #include <type_traits>
13 
16 
17 // The user can override the (track) parameter ordering and underlying scalar
18 // type. If the variable is defined, it must point to a header file that
19 // contains the same enum and type definitions for bound and free track
20 // parameters as well as space points as given below.
21 #ifdef ACTS_PARAMETER_DEFINITIONS_HEADER
22 #include ACTS_PARAMETER_DEFINITIONS_HEADER
23 #else
24 namespace Acts {
25 
26 // Note:
27 // The named indices are use to access raw data vectors and matrices at the
28 // lowest level. Since the interpretation of some of the components, e.g. local
29 // position and the inverse-momentum-like component, depend on additional
30 // information the names have some ambiguity. This can only be resolved at a
31 // higher logical level and no attempt is made to resolve it here.
32 
39 enum BoundParametersIndices : unsigned int {
40  // Local position on the reference surface.
41  // This is intentionally named different from the position components in
42  // the other data vectors, to clarify that this is defined on a surface
43  // while the others are defined in free space.
46  // Direction angles
47  eBoundPhi = 2,
49  // Global inverse-momentum-like parameter, i.e. q/p or 1/p
50  // The naming is inconsistent for the case of neutral track parameters where
51  // the value is interpreted as 1/p not as q/p. This is intentional to avoid
52  // having multiple aliases for the same element and for lack of an acceptable
53  // common name.
56  // Last uninitialized value contains the total number of components
58  // The following aliases without prefix exist for historical reasons
59  // Generic spatial coordinates on the local surface
62  // Spatial coordinates on a disk in polar coordinates
65  // Spatial coordinates on a disk in Cartesian coordinates
68  // Spatial coordinates on a cylinder
71  // Closest approach coordinates on a virtual perigee surface
74  // Direction angles
79 };
80 
87 enum FreeParametersIndices : unsigned int {
88  // Spatial position
89  // The spatial position components must be stored as one continous block.
93  // Time
95  // (Unit) direction
96  // The direction components must be stored as one continous block.
100  // Global inverse-momentum-like parameter, i.e. q/p or 1/p
101  // See BoundParametersIndices for further information
103  // Last uninitialized value contains the total number of components
105 };
106 
116 enum SpacePointIndices : unsigned int {
117  // For position four-vectors
118  // The spatial position components must be stored as one continous block.
123  // Last uninitialized value contains the total number of components
125  // Aliases for momentum four-vectors to allow clearer code
130 };
131 
133 using BoundParametersScalar = double;
135 using FreeParametersScalar = double;
137 using SpacePointScalar = double;
138 
139 } // namespace Acts
140 #endif
141 
142 namespace Acts {
143 
144 // Ensure bound track parameters definition is valid.
145 static_assert(std::is_enum_v<BoundParametersIndices>,
146  "'BoundParametersIndices' must be an enum type");
147 static_assert(std::is_convertible_v<BoundParametersIndices, size_t>,
148  "'BoundParametersIndices' must be convertible to size_t");
150  "Bound track parameters must have at least two components");
151 static_assert(std::is_floating_point_v<BoundParametersScalar>,
152  "'BoundParametersScalar' must be a floating point type");
153 
154 // Ensure free track parameters definition is valid.
155 static_assert(std::is_enum_v<FreeParametersIndices>,
156  "'FreeParametersIndices' must be an enum type");
157 static_assert(std::is_convertible_v<FreeParametersIndices, size_t>,
158  "'FreeParametersIndices' must be convertible to size_t");
160  "Free track parameters must have at least six components");
161 static_assert(std::is_floating_point_v<FreeParametersScalar>,
162  "'FreeParametersScalar' must be a floating point type");
163 
164 // Ensure space point definition is valid.
165 static_assert(std::is_enum_v<SpacePointIndices>,
166  "'SpacePointIndices' is not an enum type");
167 static_assert(std::is_convertible_v<SpacePointIndices, size_t>,
168  "'SpacePointIndices' is not convertible to size_t");
169 static_assert(3 <= SpacePointIndices::eSpacePointSize,
170  "Space points must have at least three components");
171 static_assert(std::is_floating_point_v<SpacePointScalar>,
172  "'SpacePointScalar' must be a floating point type");
173 
174 // Ensure bound track parameter components/ indices are consistently defined.
175 static_assert(eLOC_0 != eLOC_1, "Local parameters must be differents");
176 static_assert(eLOC_R == eLOC_0 or eLOC_R == eLOC_1,
177  "Local radius must be a local parameter");
178 static_assert(eLOC_PHI == eLOC_0 or eLOC_PHI == eLOC_1,
179  "Local phi must be a local parameter");
180 static_assert(eLOC_RPHI == eLOC_0 or eLOC_RPHI == eLOC_1,
181  "Local r*phi must be a local parameter");
182 static_assert(eLOC_Z == eLOC_0 or eLOC_Z == eLOC_1,
183  "Local z must be a local parameter");
184 static_assert(eLOC_X == eLOC_0 or eLOC_X == eLOC_1,
185  "Local x must be a local parameter");
186 static_assert(eLOC_Y == eLOC_0 or eLOC_Y == eLOC_1,
187  "Local y must be a local parameter");
188 static_assert(eLOC_D0 == eLOC_0 or eLOC_D0 == eLOC_1,
189  "D0 must be a local parameter");
190 static_assert(eLOC_Z0 == eLOC_0 or eLOC_Z0 == eLOC_1,
191  "Z0 must be a local parameter");
192 
193 // Ensure free track parameter components/ indices are consistently defined.
194 static_assert(eFreePos1 == eFreePos0 + 1u, "Position must be continous");
195 static_assert(eFreePos2 == eFreePos0 + 2u, "Position must be continous");
196 static_assert(eFreeDir1 == eFreeDir0 + 1u, "Direction must be continous");
197 static_assert(eFreeDir2 == eFreeDir0 + 2u, "Direction must be continous");
198 
199 // Ensure space point components/ indices are consistently defined.
200 static_assert(eSpacePos1 == eSpacePos0 + 1u, "Position must be continous");
201 static_assert(eSpacePos2 == eSpacePos0 + 2u, "Position must be continous");
202 static_assert(eSpacePos0 == eSpaceMom0, "Inconsisten position and momentum");
203 static_assert(eSpacePos1 == eSpaceMom1, "Inconsisten position and momentum");
204 static_assert(eSpacePos2 == eSpaceMom2, "Inconsisten position and momentum");
205 static_assert(eSpaceTime == eSpaceEnergy, "Inconsistent time and energy");
206 
207 namespace detail {
208 template <BoundParametersIndices>
210 template <>
213 };
214 template <>
217 };
218 template <>
220  static constexpr double pMin() { return -M_PI; }
221  static constexpr double pMax() { return M_PI; }
223 };
224 template <>
226  static constexpr double pMin() { return 0; }
227  static constexpr double pMax() { return M_PI; }
229 };
230 template <>
233 };
234 template <>
237 };
238 } // namespace detail
239 
243 template <BoundParametersIndices kIndex>
244 using BoundParameterType = typename detail::BoundParameterTraits<kIndex>::type;
245 
246 // The following matrix and vector types are automatically derived from the
247 // indices enums and scalar typedefs.
248 
249 // Matrix and vector types related to bound track parameters.
250 
252 using BoundRowVector =
256 using BoundSymMatrix =
258 
259 // Matrix and vector types related to free track parameters.
260 
263 using FreeMatrix =
266 
267 // Matrix and vector types related to space points.
268 
271 using SpacePointSymMatrix =
274 
275 // Mapping to bound track parameters.
276 //
277 // Assumes that matrices represent maps from another space into the space of
278 // bound track parameters. Thus, the bound parameters scalar type is sufficient
279 // to retain accuracy.
280 
285 
286 // Mapping to free track parameters.
287 //
288 // Assumes that matrices represent maps from another space into the space of
289 // free track parameters. Thus, the free parameters scalar type is sufficient
290 // to retain accuracy.
291 
292 using BoundToFreeMatrix =
296 
297 // Mapping to space points.
298 //
299 // Assumes that matrices represent maps from another space into the space point
300 // space. Thus, the space point scalar type is sufficient to retain accuracy.
301 
306 
307 // For backward compatibility. New code must use the more explicit
308 // `BoundParameters{Indices,Scalar,Traits}...` types.
312 
313 } // namespace Acts