Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:45

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 
0013 #include <type_traits>
0014 
0015 // The user can override the track parameters ordering. If the preprocessor
0016 // variable is defined, it must point to a header file that contains the same
0017 // enum definitions for bound and free track parameters as given below.
0018 #ifdef ACTS_PARAMETER_DEFINITIONS_HEADER
0019 #include ACTS_PARAMETER_DEFINITIONS_HEADER
0020 #else
0021 
0022 namespace Acts {
0023 
0024 // Note:
0025 // The named indices are used to access raw data vectors and matrices at the
0026 // lowest level. Since the interpretation of some components, e.g. local
0027 // position and the inverse-momentum-like component, depend on additional
0028 // information the names have some ambiguity. This can only be resolved at a
0029 // higher logical level and no attempt is made to resolve it here.
0030 
0031 /// Components of a bound track parameters vector.
0032 ///
0033 /// To be used to access components by named indices instead of just numbers.
0034 /// This must be a regular `enum` and not a scoped `enum class` to allow
0035 /// implicit conversion to an integer. The enum value are thus visible directly
0036 /// in `namespace Acts` and are prefixed to avoid naming collisions.
0037 enum BoundIndices : unsigned int {
0038   // Local position on the reference surface.
0039   // This is intentionally named different from the position components in
0040   // the other data vectors, to clarify that this is defined on a surface
0041   // while the others are defined in free space.
0042   eBoundLoc0 = 0,
0043   eBoundLoc1 = 1,
0044   // Direction angles
0045   eBoundPhi = 2,
0046   eBoundTheta = 3,
0047   // Global inverse-momentum-like parameter, i.e. q/p or 1/p
0048   // The naming is inconsistent for the case of neutral track parameters where
0049   // the value is interpreted as 1/p not as q/p. This is intentional to avoid
0050   // having multiple aliases for the same element and for lack of an acceptable
0051   // common name.
0052   eBoundQOverP = 4,
0053   eBoundTime = 5,
0054   // Last uninitialized value contains the total number of components
0055   eBoundSize,
0056 };
0057 
0058 /// Components of a free track parameters vector.
0059 ///
0060 /// To be used to access components by named indices instead of just numbers.
0061 /// This must be a regular `enum` and not a scoped `enum class` to allow
0062 /// implicit conversion to an integer. The enum value are thus visible directly
0063 /// in `namespace Acts` and are prefixed to avoid naming collisions.
0064 enum FreeIndices : unsigned int {
0065   // Spatial position
0066   // The spatial position components must be stored as one continuous block.
0067   eFreePos0 = 0u,
0068   eFreePos1 = eFreePos0 + 1u,
0069   eFreePos2 = eFreePos0 + 2u,
0070   // Time
0071   eFreeTime = 3u,
0072   // (Unit) direction
0073   // The direction components must be stored as one continuous block.
0074   eFreeDir0 = 4u,
0075   eFreeDir1 = eFreeDir0 + 1u,
0076   eFreeDir2 = eFreeDir0 + 2u,
0077   // Global inverse-momentum-like parameter, i.e. q/p or 1/p
0078   // See BoundIndices for further information
0079   eFreeQOverP = 7u,
0080   // Last uninitialized value contains the total number of components
0081   eFreeSize,
0082 };
0083 
0084 }  // namespace Acts
0085 #endif
0086 
0087 namespace Acts {
0088 
0089 // Ensure bound track parameters definition is valid.
0090 static_assert(std::is_enum_v<BoundIndices>,
0091               "'BoundIndices' must be an enum type");
0092 static_assert(std::is_convertible_v<BoundIndices, std::size_t>,
0093               "'BoundIndices' must be convertible to std::size_t");
0094 // Only the order can be user-defined
0095 static_assert(BoundIndices::eBoundSize == 6u,
0096               "Bound track parameters must have six components");
0097 
0098 // Ensure free track parameters definition is valid.
0099 static_assert(std::is_enum_v<FreeIndices>,
0100               "'FreeIndices' must be an enum type");
0101 static_assert(std::is_convertible_v<FreeIndices, std::size_t>,
0102               "'FreeIndices' must be convertible to std::size_t");
0103 // Only the order can be user-defined
0104 static_assert(FreeIndices::eFreeSize == 8u,
0105               "Free track parameters must have eight components");
0106 
0107 // Ensure bound track parameter indices are consistently defined.
0108 static_assert(eBoundLoc0 != eBoundLoc1, "Local parameters must be different");
0109 
0110 // Ensure free track parameter indices are consistently defined.
0111 static_assert(eFreePos1 == eFreePos0 + 1u, "Position must be continuous");
0112 static_assert(eFreePos2 == eFreePos0 + 2u, "Position must be continuous");
0113 static_assert(eFreeDir1 == eFreeDir0 + 1u, "Direction must be continuous");
0114 static_assert(eFreeDir2 == eFreeDir0 + 2u, "Direction must be continuous");
0115 
0116 // Shorthand vector/matrix types related to bound track parameters.
0117 using BoundVector = ActsVector<eBoundSize>;
0118 using BoundMatrix = ActsMatrix<eBoundSize, eBoundSize>;
0119 using BoundSquareMatrix = ActsSquareMatrix<eBoundSize>;
0120 // Mapping from bound track parameters.
0121 using BoundToFreeMatrix = ActsMatrix<eFreeSize, eBoundSize>;
0122 
0123 // Shorthand vector/matrix types related to free track parameters.
0124 using FreeVector = ActsVector<eFreeSize>;
0125 using FreeMatrix = ActsMatrix<eFreeSize, eFreeSize>;
0126 using FreeSquareMatrix = ActsSquareMatrix<eFreeSize>;
0127 // Mapping from free track parameters.
0128 using FreeToBoundMatrix = ActsMatrix<eBoundSize, eFreeSize>;
0129 using FreeToPathMatrix = ActsMatrix<1, eFreeSize>;
0130 
0131 }  // namespace Acts