|
|
|||
File indexing completed on 2025-12-14 09:39:47
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 #include "Acts/Utilities/AlgebraHelpers.hpp" 0013 #include "Acts/Utilities/ArrayHelpers.hpp" 0014 0015 #include <cstdint> 0016 0017 namespace Acts::detail { 0018 /// @brief Helper to describe a line in 3D space. The line is described 0019 /// by a point on the line and a corresponding direction vector with unit 0020 /// length. Additionally, the `Line3DWithPartialDerivatives` holds the 0021 /// first and second derivative of the line with respect to the 0022 /// parameters `x0`, `y0`, `theta`, and `phi` (the parameters are defined 0023 /// in the enum `ParIndex`). 0024 template <std::floating_point T> 0025 class Line3DWithPartialDerivatives { 0026 public: 0027 /// @brief Abrivation of the Vector 0028 using Vector = Eigen::Matrix<T, 3, 1>; 0029 /// @brief Enum to map the indices of the parameter vector 0030 enum class ParIndex : std::uint8_t { 0031 y0 = 0, /// y-axis intercept at z=0 0032 theta = 1, /// polar angle w.r.t the z-axis 0033 x0 = 2, /// x-axis intercept at z=0 0034 phi = 3, /// Azimuthal angle in the x-y plane 0035 nPars = 4, /// Number of line parameters 0036 }; 0037 static constexpr auto s_nPars = static_cast<std::size_t>(ParIndex::nPars); 0038 /// @brief Abrivation of the parameter vector type 0039 using ParamVector = std::array<T, s_nPars>; 0040 /// @brief default constructor 0041 Line3DWithPartialDerivatives() = default; 0042 /// @brief Default copy constructor 0043 Line3DWithPartialDerivatives( 0044 const Line3DWithPartialDerivatives& other) noexcept = default; 0045 /// @brief Default move constructor 0046 Line3DWithPartialDerivatives(Line3DWithPartialDerivatives&& other) noexcept = 0047 default; 0048 /// @brief Default assignment operator 0049 Line3DWithPartialDerivatives& operator=( 0050 const Line3DWithPartialDerivatives& other) noexcept = default; 0051 /// @brief Default move assignemt operator 0052 Line3DWithPartialDerivatives& operator=( 0053 Line3DWithPartialDerivatives&& other) noexcept = default; 0054 /// @brief Constructor taking a parameter array which is at least as big as the ParamVector 0055 /// The first 4 indices are interpreted as the corresponding line 0056 /// parameters 0057 template <std::size_t N> 0058 explicit Line3DWithPartialDerivatives( 0059 const std::array<T, N>& initPars) noexcept; 0060 0061 /// @brief Update the line & derivatives with the new parameters 0062 /// @param newPars The new parameters to update the line with 0063 template <std::size_t N> 0064 void updateParameters(const std::array<T, N>& newPars) noexcept 0065 requires(N >= s_nPars); 0066 /// @brief Returns a point on the line 0067 const Vector& position() const; 0068 /// @brief Returns the direction of the line 0069 const Vector& direction() const; 0070 /// @brief Returns the first derivative of the line with respect to the passed 0071 /// @param param: Index of the parameter to get the derivative for 0072 const Vector& gradient(const ParIndex param) const; 0073 /// @brief Returns the second derivative of the line with respect to the passed 0074 /// @param param1: Index of the first parameter to get the derivative for 0075 /// @param param2: Index of the second parameter to get the derivative for 0076 const Vector& hessian(const ParIndex param1, const ParIndex param2) const; 0077 /// @brief Returns a point along the line which is by lambda apart from 0078 /// the line reference 0079 /// @param lambda: Separation from the reference 0080 Vector point(const double lambda) const; 0081 /// @brief Returns the currently set parameters 0082 ParamVector parameters() const; 0083 0084 private: 0085 Vector m_pos{Vector::Zero()}; 0086 Vector m_dir{Vector::UnitZ()}; 0087 std::array<Vector, s_nPars> m_gradient{ 0088 filledArray<Vector, s_nPars>(Vector::Zero())}; 0089 0090 std::array<Vector, sumUpToN(s_nPars)> m_hessian{ 0091 filledArray<Vector, sumUpToN(s_nPars)>(Vector::Zero())}; 0092 }; 0093 } // namespace Acts::detail 0094 #include "Acts/Utilities/detail/Line3DWithPartialDerivatives.ipp"
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|