![]() |
|
|||
File indexing completed on 2025-07-12 07:51:26
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/EventData/SourceLink.hpp" 0012 #include "Acts/EventData/Types.hpp" 0013 #include "Acts/Utilities/TypeTraits.hpp" 0014 0015 #include <cassert> 0016 #include <optional> 0017 #include <span> 0018 0019 #include <Eigen/Core> 0020 0021 namespace Acts::Experimental { 0022 0023 class SpacePointContainer2; 0024 0025 /// A proxy class for accessing individual space points. 0026 template <bool read_only> 0027 class SpacePointProxy2 { 0028 public: 0029 /// Indicates whether this space point proxy is read-only or data can be 0030 /// modified 0031 static constexpr bool ReadOnly = read_only; 0032 0033 using IndexType = SpacePointIndex2; 0034 0035 using ContainerType = const_if_t<ReadOnly, SpacePointContainer2>; 0036 0037 /// Constructs a space point proxy for the given container and index. 0038 /// @param container The container holding the space point. 0039 /// @param index The index of the space point in the container. 0040 SpacePointProxy2(ContainerType &container, IndexType index) noexcept 0041 : m_container(&container), m_index(index) {} 0042 0043 /// Copy construct a space point proxy. 0044 /// @param other The space point proxy to copy. 0045 SpacePointProxy2(const SpacePointProxy2 &other) noexcept = default; 0046 0047 /// Copy construct a mutable space point proxy. 0048 /// @param other The mutable space point proxy to copy. 0049 explicit SpacePointProxy2(const SpacePointProxy2<false> &other) noexcept 0050 requires ReadOnly 0051 : m_container(&other.container()), m_index(other.index()) {} 0052 0053 /// Gets the container holding the space point. 0054 /// @return A reference to the container holding the space point. 0055 SpacePointContainer2 &container() noexcept { return *m_container; } 0056 /// Gets the container holding the space point. 0057 /// @return A const reference to the container holding the space point. 0058 const SpacePointContainer2 &container() const noexcept { 0059 return *m_container; 0060 } 0061 /// Gets the index of the space point in the container. 0062 /// @return The index of the space point in the container. 0063 IndexType index() const noexcept { return m_index; } 0064 0065 /// Mutable access to the source links of the space point. 0066 /// @return A mutable span of source links associated with the space point. 0067 std::span<SourceLink> sourceLinks() noexcept 0068 requires(!ReadOnly) 0069 { 0070 return m_container->sourceLinks(m_index); 0071 } 0072 /// Mutable access to the x coordinate of the space point. 0073 /// @return A mutable reference to the x coordinate of the space point. 0074 float &x() noexcept 0075 requires(!ReadOnly) 0076 { 0077 return m_container->x(m_index); 0078 } 0079 /// Mutable access to the y coordinate of the space point. 0080 /// @return A mutable reference to the y coordinate of the space point. 0081 float &y() noexcept 0082 requires(!ReadOnly) 0083 { 0084 return m_container->y(m_index); 0085 } 0086 /// Mutable access to the z coordinate of the space point. 0087 /// @return A mutable reference to the z coordinate of the space point. 0088 float &z() noexcept 0089 requires(!ReadOnly) 0090 { 0091 return m_container->z(m_index); 0092 } 0093 0094 /// Mutable access to the extra r coordinate of the space point. 0095 /// @return A mutable reference to the r coordinate of the space point. 0096 float &r() noexcept 0097 requires(!ReadOnly) 0098 { 0099 return m_container->r(m_index); 0100 } 0101 /// Mutable access to the extra phi coordinate of the space point. 0102 /// @return A mutable reference to the phi coordinate of the space point. 0103 float &phi() noexcept 0104 requires(!ReadOnly) 0105 { 0106 return m_container->phi(m_index); 0107 } 0108 /// Mutable access to the extra time information of the space point. 0109 /// @return A mutable reference to the time information of the space point. 0110 std::optional<float> &time() noexcept 0111 requires(!ReadOnly) 0112 { 0113 return m_container->time(m_index); 0114 } 0115 /// Mutable access to the variance in Z direction of the space point. 0116 /// @return A mutable reference to the variance in Z direction of the space point. 0117 float &varianceZ() noexcept 0118 requires(!ReadOnly) 0119 { 0120 return m_container->varianceZ(m_index); 0121 } 0122 /// Mutable access to the variance in R direction of the space point. 0123 /// @return A mutable reference to the variance in R direction of the space point. 0124 float &varianceR() noexcept 0125 requires(!ReadOnly) 0126 { 0127 return m_container->varianceR(m_index); 0128 } 0129 /// Mutable access to the extra top strip vector of the space point. 0130 /// @return A mutable reference to the top strip vector of the space point. 0131 Eigen::Vector3f &topStripVector() noexcept 0132 requires(!ReadOnly) 0133 { 0134 return m_container->topStripVector(m_index); 0135 } 0136 /// Mutable access to the extra bottom strip vector of the space point. 0137 /// @return A mutable reference to the bottom strip vector of the space point. 0138 Eigen::Vector3f &bottomStripVector() noexcept 0139 requires(!ReadOnly) 0140 { 0141 return m_container->bottomStripVector(m_index); 0142 } 0143 /// Mutable access to the extra strip center distance of the space point. 0144 /// @return A mutable reference to the strip center distance of the space point. 0145 Eigen::Vector3f &stripCenterDistance() noexcept 0146 requires(!ReadOnly) 0147 { 0148 return m_container->stripCenterDistance(m_index); 0149 } 0150 /// Mutable access to the extra top strip center of the space point. 0151 /// @return A mutable reference to the top strip center of the space point. 0152 Eigen::Vector3f &topStripCenter() noexcept 0153 requires(!ReadOnly) 0154 { 0155 return m_container->topStripCenter(m_index); 0156 } 0157 /// Mutable access to the copy from index of the space point. 0158 /// @return A mutable reference to the copy from index of the space point. 0159 std::size_t ©FromIndex() noexcept 0160 requires(!ReadOnly) 0161 { 0162 return m_container->copyFromIndex(m_index); 0163 } 0164 0165 /// Mutable access to the extra column of data for the space point. 0166 /// @param column The extra column to access. 0167 /// @return A mutable reference to the value in the extra column for the space 0168 /// point. 0169 template <typename column_proxy> 0170 typename column_proxy::ValueType &extra(column_proxy column) noexcept 0171 requires(!ReadOnly) 0172 { 0173 return m_container->extra(column, m_index); 0174 } 0175 0176 /// Const access to the x coordinate of the space point. 0177 /// @return The x coordinate of the space point. 0178 float x() const noexcept { return m_container->x(m_index); } 0179 /// Const access to the y coordinate of the space point. 0180 /// @return The y coordinate of the space point. 0181 float y() const noexcept { return m_container->y(m_index); } 0182 /// Const access to the z coordinate of the space point. 0183 /// @return The z coordinate of the space point. 0184 float z() const noexcept { return m_container->z(m_index); } 0185 0186 /// Const access to the r coordinate of the space point. 0187 /// @return The r coordinate of the space point. 0188 float r() const noexcept { return m_container->r(m_index); } 0189 /// Const access to the phi coordinate of the space point. 0190 /// @return The phi coordinate of the space point. 0191 float phi() const noexcept { return m_container->phi(m_index); } 0192 /// Const access to the time information of the space point. 0193 /// @return An optional containing the time information of the space point, or 0194 std::optional<float> time() const noexcept { 0195 return m_container->time(m_index); 0196 } 0197 /// Const access to the variance in Z direction of the space point. 0198 /// @return The variance in Z direction of the space point. 0199 float varianceZ() const noexcept { return m_container->varianceZ(m_index); } 0200 /// Const access to the variance in R direction of the space point. 0201 /// @return The variance in R direction of the space point. 0202 float varianceR() const noexcept { return m_container->varianceR(m_index); } 0203 /// Const access to the extra top strip vector of the space point. 0204 /// @return A const reference to the top strip vector of the space point. 0205 const Eigen::Vector3f &topStripVector() const noexcept { 0206 return m_container->topStripVector(m_index); 0207 } 0208 /// Const access to the extra bottom strip vector of the space point. 0209 /// @return A const reference to the bottom strip vector of the space point. 0210 const Eigen::Vector3f &bottomStripVector() const noexcept { 0211 return m_container->bottomStripVector(m_index); 0212 } 0213 /// Const access to the extra strip center distance of the space point. 0214 /// @return A const reference to the strip center distance of the space point. 0215 const Eigen::Vector3f &stripCenterDistance() const noexcept { 0216 return m_container->stripCenterDistance(m_index); 0217 } 0218 /// Const access to the extra top strip center of the space point. 0219 /// @return A const reference to the top strip center of the space point. 0220 const Eigen::Vector3f &topStripCenter() const noexcept { 0221 return m_container->topStripCenter(m_index); 0222 } 0223 /// Const access to the copy from index of the space point. 0224 /// @return A const reference to the copy from index of the space point. 0225 std::size_t copyFromIndex() const noexcept { 0226 return m_container->copyFromIndex(m_index); 0227 } 0228 0229 /// Const access to the extra column of data for the space point. 0230 /// @param column The extra column to access. 0231 /// @return A const reference to the value in the extra column for the space 0232 /// point. 0233 template <typename column_proxy> 0234 const typename column_proxy::ValueType &extra( 0235 const column_proxy &column) const noexcept { 0236 return m_container->extra(column, m_index); 0237 } 0238 0239 private: 0240 ContainerType *m_container{}; 0241 IndexType m_index{}; 0242 }; 0243 0244 } // namespace Acts::Experimental
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |