Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-07 07:45: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 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/EventData/SpacePointData.hpp"
0014 #include "Acts/EventData/SpacePointProxy.hpp"
0015 #include "Acts/EventData/Utils.hpp"
0016 #include "Acts/Utilities/Diagnostics.hpp"
0017 #include "Acts/Utilities/Holders.hpp"
0018 #include "Acts/Utilities/detail/ContainerIterator.hpp"
0019 
0020 #include <vector>
0021 
0022 ACTS_PUSH_IGNORE_DEPRECATED()
0023 
0024 namespace Acts {
0025 
0026 /// Configuration flags for the space point container.
0027 struct SpacePointContainerConfig {
0028   /// Whether to use detailed double measurement information
0029   bool useDetailedDoubleMeasurementInfo = false;
0030 
0031   /// Whether the space point data is in internal units
0032   bool isInInternalUnits = true;
0033 };
0034 
0035 /// Construction options for the space point container.
0036 struct SpacePointContainerOptions {
0037   /// Location of beam in x,y plane, used as offset for space points
0038   Acts::Vector2 beamPos{0 * Acts::UnitConstants::mm,
0039                         0 * Acts::UnitConstants::mm};
0040 
0041   /// Whether the space point data is in internal units
0042   bool isInInternalUnits = true;
0043 };
0044 
0045 /// Container wrapper providing space point proxy access.
0046 template <typename container_t, template <typename> class holder_t>
0047 class [[deprecated(
0048     "Will be dropped soon and is replaced by the new "
0049     "SpacePointContainer")]] SpacePointContainer {
0050  public:
0051   friend class Acts::SpacePointProxy<
0052       Acts::SpacePointContainer<container_t, holder_t>>;
0053 
0054  public:
0055   /// space point proxy type
0056   using SpacePointProxyType =
0057       Acts::SpacePointProxy<Acts::SpacePointContainer<container_t, holder_t>>;
0058 
0059   /// Iterator type
0060   using iterator = detail::ContainerIterator<
0061       Acts::SpacePointContainer<container_t, holder_t>, SpacePointProxyType&,
0062       std::size_t, false>;
0063   /// Const iterator type
0064   using const_iterator = detail::ContainerIterator<
0065       Acts::SpacePointContainer<container_t, holder_t>,
0066       const SpacePointProxyType&, std::size_t, true>;
0067 
0068   /// Value type of the underlying container
0069   using ValueType = typename container_t::ValueType;
0070   /// Proxy type
0071   using ProxyType = SpacePointProxyType;
0072   /// Value type
0073   using value_type = ProxyType;
0074   /// Size type
0075   using size_type = std::size_t;
0076 
0077  public:
0078   // Constructors
0079   // It makes sense to support both options of
0080   // taking or not the ownership
0081 
0082   // Do not take ownership
0083   // Activate only if holder_t is RefHolder
0084   /// Construct from config, options, and container reference
0085   /// @param config Configuration for the space point container
0086   /// @param options Options for the space point container
0087   /// @param container Reference to the underlying space point container
0088   template <template <typename> class H = holder_t,
0089             typename = std::enable_if_t<Acts::detail::is_same_template<
0090                 H, Acts::detail::RefHolder>::value>>
0091   SpacePointContainer(const Acts::SpacePointContainerConfig& config,
0092                       const Acts::SpacePointContainerOptions& options,
0093                       const container_t& container);
0094 
0095   // Take the ownership
0096   // Activate only if holder_t is ValueHolder
0097   /// Construct from config, options, and container by moving ownership
0098   /// @param config Configuration for the space point container
0099   /// @param options Options for the space point container
0100   /// @param container Rvalue reference to the underlying space point container
0101   template <template <typename> class H = holder_t,
0102             typename = std::enable_if_t<Acts::detail::is_same_template<
0103                 H, Acts::detail::ValueHolder>::value>>
0104   SpacePointContainer(const Acts::SpacePointContainerConfig& config,
0105                       const Acts::SpacePointContainerOptions& options,
0106                       container_t&& container);
0107 
0108   // No copy operations
0109   SpacePointContainer(SpacePointContainer& other) = delete;
0110   SpacePointContainer& operator=(SpacePointContainer& other) = delete;
0111 
0112   // move operations
0113   /// Move constructor
0114   /// @param other space point container to move from
0115   SpacePointContainer(SpacePointContainer&& other) noexcept = default;
0116   /// Move assignment operator
0117   /// @param other space point container to move from
0118   /// @return Reference to this container
0119   SpacePointContainer& operator=(SpacePointContainer&& other) noexcept =
0120       default;
0121 
0122   // Destructor
0123   ~SpacePointContainer() = default;
0124 
0125   /// Return the number of space points
0126   /// @return Number of space points
0127   std::size_t size() const;
0128 
0129   /// Return an iterator to the beginning
0130   /// @return Iterator to the first space point
0131   iterator begin();
0132   /// Return an iterator to the end
0133   /// @return Iterator to one past the last space point
0134   iterator end();
0135   /// Return a const iterator to the beginning
0136   /// @return Const iterator to the first space point
0137   const_iterator cbegin() const;
0138   /// Return a const iterator to the end
0139   /// @return Const iterator to one past the last space point
0140   const_iterator cend() const;
0141   /// Return a const iterator to the beginning
0142   /// @return Const iterator to the first space point
0143   const_iterator begin() const;
0144   /// Return a const iterator to the end
0145   /// @return Const iterator to one past the last space point
0146   const_iterator end() const;
0147 
0148   /// Access space point proxy at index n
0149   /// @param n Index of the space point
0150   /// @return Reference to the space point proxy
0151   ProxyType& at(const std::size_t n);
0152   /// Access const space point proxy at index n
0153   /// @param n Index of the space point
0154   /// @return Const reference to the space point proxy
0155   const ProxyType& at(const std::size_t n) const;
0156   /// Access underlying space point value at index n
0157   /// @param n Index of the space point
0158   /// @return Const reference to the underlying space point value
0159   const ValueType& sp(const std::size_t n) const;
0160 
0161  private:
0162   void initialize();
0163 
0164   const container_t& container() const;
0165   const ProxyType& proxy(const std::size_t n) const;
0166   std::vector<ProxyType>& proxies();
0167   const std::vector<ProxyType>& proxies() const;
0168 
0169   float x(const std::size_t n) const;
0170   float y(const std::size_t n) const;
0171   float z(const std::size_t n) const;
0172   float phi(const std::size_t n) const;
0173   float radius(const std::size_t n) const;
0174   float varianceR(const std::size_t n) const;
0175   float varianceZ(const std::size_t n) const;
0176 
0177   const Acts::Vector3& topStripVector(const std::size_t n) const;
0178   const Acts::Vector3& bottomStripVector(const std::size_t n) const;
0179   const Acts::Vector3& stripCenterDistance(const std::size_t n) const;
0180   const Acts::Vector3& topStripCenterPosition(const std::size_t n) const;
0181 
0182   Acts::SpacePointContainerConfig m_config;
0183   Acts::SpacePointContainerOptions m_options;
0184   Acts::SpacePointData m_data;
0185   holder_t<const container_t> m_container;
0186   std::vector<ProxyType> m_proxies;
0187 };
0188 
0189 }  // namespace Acts
0190 
0191 #include "Acts/EventData/SpacePointContainer.ipp"
0192 
0193 ACTS_POP_IGNORE_DEPRECATED()