File indexing completed on 2025-01-18 09:10:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <cmath>
0010
0011 namespace Acts {
0012
0013 template <typename container_t, template <typename> class holder_t>
0014 template <template <typename> class, typename>
0015 SpacePointContainer<container_t, holder_t>::SpacePointContainer(
0016 const Acts::SpacePointContainerConfig& config,
0017 const Acts::SpacePointContainerOptions& options,
0018 const container_t& container)
0019 : m_config(config.toInternalUnits()),
0020 m_options(options.toInternalUnits()),
0021 m_container(container) {
0022 initialize();
0023 }
0024
0025 template <typename container_t, template <typename> class holder_t>
0026 template <template <typename> class, typename>
0027 SpacePointContainer<container_t, holder_t>::SpacePointContainer(
0028 const Acts::SpacePointContainerConfig& config,
0029 const Acts::SpacePointContainerOptions& options, container_t&& container)
0030 : m_config(config.toInternalUnits()),
0031 m_options(options.toInternalUnits()),
0032 m_container(std::move(container)) {
0033 initialize();
0034 }
0035
0036 template <typename container_t, template <typename> class holder_t>
0037 void SpacePointContainer<container_t, holder_t>::initialize() {
0038 m_data.resize(size(), m_config.useDetailedDoubleMeasurementInfo);
0039 m_proxies.reserve(size());
0040 const auto& external_container = container();
0041 for (std::size_t i(0); i < size(); ++i) {
0042 m_data.setX(i, external_container.x_impl(i) - m_options.beamPos[0]);
0043 m_data.setY(i, external_container.y_impl(i) - m_options.beamPos[1]);
0044 m_data.setZ(i, external_container.z_impl(i));
0045 m_data.setRadius(
0046 i, std::sqrt(m_data.x(i) * m_data.x(i) + m_data.y(i) * m_data.y(i)));
0047 m_data.setPhi(i, std::atan2(m_data.y(i), m_data.x(i)));
0048 m_data.setVarianceR(i, external_container.varianceR_impl(i));
0049 m_data.setVarianceZ(i, external_container.varianceZ_impl(i));
0050
0051 m_proxies.emplace_back(*this, i);
0052 }
0053
0054
0055 if (m_config.useDetailedDoubleMeasurementInfo) {
0056 using namespace Acts::HashedStringLiteral;
0057 for (std::size_t i(0); i < size(); ++i) {
0058 m_data.setTopStripVector(
0059 i, std::any_cast<Acts::Vector3>(
0060 external_container.component_impl("TopStripVector"_hash, i)));
0061 m_data.setBottomStripVector(
0062 i, std::any_cast<Acts::Vector3>(external_container.component_impl(
0063 "BottomStripVector"_hash, i)));
0064 m_data.setStripCenterDistance(
0065 i, std::any_cast<Acts::Vector3>(external_container.component_impl(
0066 "StripCenterDistance"_hash, i)));
0067 m_data.setTopStripCenterPosition(
0068 i, std::any_cast<Acts::Vector3>(external_container.component_impl(
0069 "TopStripCenterPosition"_hash, i)));
0070 }
0071 }
0072 }
0073
0074 template <typename container_t, template <typename> class holder_t>
0075 const Acts::Vector3& SpacePointContainer<container_t, holder_t>::topStripVector(
0076 const std::size_t n) const {
0077 return m_data.topStripVector(n);
0078 }
0079
0080 template <typename container_t, template <typename> class holder_t>
0081 const Acts::Vector3&
0082 SpacePointContainer<container_t, holder_t>::bottomStripVector(
0083 const std::size_t n) const {
0084 return m_data.bottomStripVector(n);
0085 }
0086
0087 template <typename container_t, template <typename> class holder_t>
0088 const Acts::Vector3&
0089 SpacePointContainer<container_t, holder_t>::stripCenterDistance(
0090 const std::size_t n) const {
0091 return m_data.stripCenterDistance(n);
0092 }
0093
0094 template <typename container_t, template <typename> class holder_t>
0095 const Acts::Vector3&
0096 SpacePointContainer<container_t, holder_t>::topStripCenterPosition(
0097 const std::size_t n) const {
0098 return m_data.topStripCenterPosition(n);
0099 }
0100
0101 template <typename container_t, template <typename> class holder_t>
0102 std::size_t SpacePointContainer<container_t, holder_t>::size() const {
0103 return container().size_impl();
0104 }
0105
0106 template <typename container_t, template <typename> class holder_t>
0107 typename SpacePointContainer<container_t, holder_t>::iterator
0108 SpacePointContainer<container_t, holder_t>::begin() {
0109 return {*this, 0};
0110 }
0111
0112 template <typename container_t, template <typename> class holder_t>
0113 typename SpacePointContainer<container_t, holder_t>::iterator
0114 SpacePointContainer<container_t, holder_t>::end() {
0115 return {*this, size()};
0116 }
0117
0118 template <typename container_t, template <typename> class holder_t>
0119 typename SpacePointContainer<container_t, holder_t>::const_iterator
0120 SpacePointContainer<container_t, holder_t>::begin() const {
0121 return {*this, 0};
0122 }
0123
0124 template <typename container_t, template <typename> class holder_t>
0125 typename SpacePointContainer<container_t, holder_t>::const_iterator
0126 SpacePointContainer<container_t, holder_t>::end() const {
0127 return {*this, size()};
0128 }
0129
0130 template <typename container_t, template <typename> class holder_t>
0131 typename SpacePointContainer<container_t, holder_t>::const_iterator
0132 SpacePointContainer<container_t, holder_t>::cbegin() const {
0133 return {*this, 0};
0134 }
0135
0136 template <typename container_t, template <typename> class holder_t>
0137 typename SpacePointContainer<container_t, holder_t>::const_iterator
0138 SpacePointContainer<container_t, holder_t>::cend() const {
0139 return {*this, size()};
0140 }
0141
0142 template <typename container_t, template <typename> class holder_t>
0143 const container_t& SpacePointContainer<container_t, holder_t>::container()
0144 const {
0145 return *m_container;
0146 }
0147
0148 template <typename container_t, template <typename> class holder_t>
0149 typename SpacePointContainer<container_t, holder_t>::ProxyType&
0150 SpacePointContainer<container_t, holder_t>::at(const std::size_t n) {
0151 return proxies().at(n);
0152 }
0153
0154 template <typename container_t, template <typename> class holder_t>
0155 const typename SpacePointContainer<container_t, holder_t>::ProxyType&
0156 SpacePointContainer<container_t, holder_t>::at(const std::size_t n) const {
0157 return proxies().at(n);
0158 }
0159
0160 template <typename container_t, template <typename> class holder_t>
0161 const typename SpacePointContainer<container_t, holder_t>::ValueType&
0162 SpacePointContainer<container_t, holder_t>::sp(const std::size_t n) const {
0163 return container().get_impl(n);
0164 }
0165
0166 template <typename container_t, template <typename> class holder_t>
0167 float SpacePointContainer<container_t, holder_t>::x(const std::size_t n) const {
0168 return m_data.x(n);
0169 }
0170
0171 template <typename container_t, template <typename> class holder_t>
0172 float SpacePointContainer<container_t, holder_t>::y(const std::size_t n) const {
0173 return m_data.y(n);
0174 }
0175
0176 template <typename container_t, template <typename> class holder_t>
0177 float SpacePointContainer<container_t, holder_t>::z(const std::size_t n) const {
0178 return m_data.z(n);
0179 }
0180
0181 template <typename container_t, template <typename> class holder_t>
0182 float SpacePointContainer<container_t, holder_t>::phi(
0183 const std::size_t n) const {
0184 return m_data.phi(n);
0185 }
0186
0187 template <typename container_t, template <typename> class holder_t>
0188 float SpacePointContainer<container_t, holder_t>::radius(
0189 const std::size_t n) const {
0190 return m_data.radius(n);
0191 }
0192
0193 template <typename container_t, template <typename> class holder_t>
0194 float SpacePointContainer<container_t, holder_t>::varianceR(
0195 const std::size_t n) const {
0196 return m_data.varianceR(n);
0197 }
0198
0199 template <typename container_t, template <typename> class holder_t>
0200 float SpacePointContainer<container_t, holder_t>::varianceZ(
0201 const std::size_t n) const {
0202 return m_data.varianceZ(n);
0203 }
0204
0205 template <typename container_t, template <typename> class holder_t>
0206 const typename SpacePointContainer<container_t, holder_t>::ProxyType&
0207 SpacePointContainer<container_t, holder_t>::proxy(const std::size_t n) const {
0208 assert(n < proxies().size());
0209 return proxies()[n];
0210 }
0211
0212 template <typename container_t, template <typename> class holder_t>
0213 std::vector<typename SpacePointContainer<container_t, holder_t>::ProxyType>&
0214 SpacePointContainer<container_t, holder_t>::proxies() {
0215 return m_proxies;
0216 }
0217
0218 template <typename container_t, template <typename> class holder_t>
0219 const std::vector<
0220 typename SpacePointContainer<container_t, holder_t>::ProxyType>&
0221 SpacePointContainer<container_t, holder_t>::proxies() const {
0222 return m_proxies;
0223 }
0224
0225 }