Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-16 08:02:00

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 // for GNU: ignore this specific warning, otherwise just include Eigen/Dense
0012 #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
0013 #pragma GCC diagnostic push
0014 #pragma GCC diagnostic ignored "-Wmisleading-indentation"
0015 #if __GNUC__ >= 12
0016 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
0017 #endif
0018 #include <Eigen/Core>
0019 #include <Eigen/Geometry>
0020 #pragma GCC diagnostic pop
0021 #else
0022 #include <Eigen/Core>
0023 #include <Eigen/Geometry>
0024 #endif
0025 
0026 namespace Acts {
0027 
0028 /// @defgroup acts-algebra-types Vector/matrix types with a common scalar type
0029 ///
0030 /// These are the default vector/matrix types that should be used throughout the
0031 /// codebase. They all use the common Acts scalar type but support variable size
0032 /// either at compile- or runtime.
0033 ///
0034 /// Eigen does not have a distinct type for symmetric matrices. A typedef for
0035 /// fixed-size matrices is still defined to simplify definition (one template
0036 /// size vs two template size for generic matrices) and to clarify semantic
0037 /// meaning in interfaces. It also ensures that the matrix is square. However,
0038 /// the user is responsible for ensuring that the values are symmetric.
0039 ///
0040 /// Without a distinct type for symmetric matrices, there is no way to provide
0041 /// any conditions e.g. square size, for the dynamic-sized case. Consequently,
0042 /// no dynamic-sized symmetric matrix type is defined. Use the
0043 /// `ActsDynamicMatrix` instead.
0044 
0045 /// @brief Fixed-size vector type for N-dimensional vectors
0046 /// @tparam kSize The dimension of the vector
0047 template <unsigned int kSize>
0048 using ActsVector = Eigen::Matrix<double, kSize, 1>;
0049 
0050 /// @brief Fixed-size matrix type for NxM matrices
0051 /// @tparam kRows Number of rows
0052 /// @tparam kCols Number of columns
0053 template <unsigned int kRows, unsigned int kCols>
0054 using ActsMatrix = Eigen::Matrix<double, kRows, kCols>;
0055 
0056 /// @brief Fixed-size square matrix type for NxN matrices
0057 /// @tparam kSize The dimension of the square matrix
0058 template <unsigned int kSize>
0059 using ActsSquareMatrix = Eigen::Matrix<double, kSize, kSize>;
0060 
0061 /// @brief Dynamic-sized vector type
0062 using ActsDynamicVector = Eigen::Matrix<double, Eigen::Dynamic, 1>;
0063 
0064 /// @brief Dynamic-sized matrix type
0065 using ActsDynamicMatrix = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>;
0066 
0067 /// @defgroup coordinates-types Fixed-size vector/matrix types for coordinates
0068 ///
0069 /// These predefined types should always be used when handling coordinate
0070 /// vectors in different coordinate systems, i.e. on surfaces (2d), spatial
0071 /// position (3d), or space-time (4d).
0072 ///
0073 
0074 // coordinate vectors
0075 /// @brief 2-dimensional vector type for 2D coordinates
0076 using Vector2 = ActsVector<2>;
0077 /// @brief 3-dimensional vector type for e.g. spatial coordinates and momenta
0078 using Vector3 = ActsVector<3>;
0079 /// @brief 4-dimensional vector type for space-time coordinates
0080 using Vector4 = ActsVector<4>;
0081 
0082 // square matrices e.g. for coordinate covariance matrices
0083 /// @brief 2x2 square matrix type, typically used for 2D coordinate covariance
0084 using SquareMatrix2 = ActsSquareMatrix<2>;
0085 /// @brief 3x3 square matrix type, typically used for 3D coordinate covariance
0086 using SquareMatrix3 = ActsSquareMatrix<3>;
0087 /// @brief 4x4 square matrix type, typically used for 4D coordinate covariance
0088 using SquareMatrix4 = ActsSquareMatrix<4>;
0089 
0090 // pure translation transformations
0091 /// @brief 2D translation transformation
0092 using Translation2 = Eigen::Translation<double, 2>;
0093 /// @brief 3D translation transformation
0094 using Translation3 = Eigen::Translation<double, 3>;
0095 
0096 /// @brief 2D rotation matrix
0097 using RotationMatrix2 = SquareMatrix2;
0098 /// @brief 3D rotation matrix
0099 using RotationMatrix3 = SquareMatrix3;
0100 
0101 // pure rotation defined by a rotation angle around a rotation axis
0102 /// @brief Rotation defined by an angle around a rotation axis in 3D
0103 using AngleAxis3 = Eigen::AngleAxis<double>;
0104 
0105 /// @brief 2D affine transformation stored as a compact 2x3 matrix
0106 using Transform2 = Eigen::Transform<double, 2, Eigen::AffineCompact>;
0107 /// @brief 3D affine transformation stored as a 4x4 matrix
0108 using Transform3 = Eigen::Transform<double, 3, Eigen::Affine>;
0109 
0110 /// Tolerance for transform equivalence checks
0111 constexpr double s_transformEquivalentTolerance = 1e-9;
0112 
0113 }  // namespace Acts