Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:00

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 
0013 #include <limits>
0014 #include <vector>
0015 
0016 namespace Acts {
0017 
0018 /// @class SpacePointData
0019 /// This class contains auxiliary and mutable data associated to the
0020 /// external space points provided by the customers
0021 /// These variables are used internally by the seeding algorithm, that
0022 /// reads and updates them
0023 /// The variables collected here are also dynamic variables only present
0024 /// for strip space points
0025 class SpacePointData {
0026  public:
0027   /// @brief Default constructor
0028   SpacePointData() = default;
0029 
0030   /// No copies
0031   SpacePointData(const SpacePointData& other) = delete;
0032   SpacePointData& operator=(const SpacePointData& other) = delete;
0033 
0034   /// @brief Move operations
0035   SpacePointData(SpacePointData&& other) noexcept = default;
0036   SpacePointData& operator=(SpacePointData&& other) noexcept = default;
0037 
0038   /// @brief Destructor
0039   ~SpacePointData() = default;
0040 
0041   /// @brief Getters
0042   float quality(std::size_t idx) const;
0043   float deltaR(std::size_t idx) const;
0044 
0045   /// @brief Setters
0046   void setQuality(std::size_t idx, const float value);
0047   void setDeltaR(std::size_t idx, const float value);
0048 
0049   /// @brief Resize vectors
0050   void resize(std::size_t n, bool resizeDynamic = false);
0051 
0052   /// @brief clear vectors
0053   void clear();
0054 
0055   ///
0056   bool hasDynamicVariable() const { return !m_topStripVector.empty(); }
0057 
0058   const Acts::Vector3& getTopStripVector(std::size_t idx) const {
0059     return m_topStripVector[idx];
0060   }
0061 
0062   const Acts::Vector3& getBottomStripVector(std::size_t idx) const {
0063     return m_bottomStripVector[idx];
0064   }
0065 
0066   const Acts::Vector3& getStripCenterDistance(std::size_t idx) const {
0067     return m_stripCenterDistance[idx];
0068   }
0069 
0070   const Acts::Vector3& getTopStripCenterPosition(std::size_t idx) const {
0071     return m_topStripCenterPosition[idx];
0072   }
0073 
0074   void setTopStripVector(std::size_t idx, const Acts::Vector3& value) {
0075     m_topStripVector[idx] = value;
0076   }
0077 
0078   void setBottomStripVector(std::size_t idx, const Acts::Vector3& value) {
0079     m_bottomStripVector[idx] = value;
0080   }
0081 
0082   void setStripCenterDistance(std::size_t idx, const Acts::Vector3& value) {
0083     m_stripCenterDistance[idx] = value;
0084   }
0085 
0086   void setTopStripCenterPosition(std::size_t idx, const Acts::Vector3& value) {
0087     m_topStripCenterPosition[idx] = value;
0088   }
0089 
0090  private:
0091   /// Mutable variables
0092   std::vector<float> m_quality{};
0093   std::vector<float> m_deltaR{};
0094 
0095   /// dynamic variables
0096   std::vector<Acts::Vector3> m_topStripVector{};
0097   std::vector<Acts::Vector3> m_bottomStripVector{};
0098   std::vector<Acts::Vector3> m_stripCenterDistance{};
0099   std::vector<Acts::Vector3> m_topStripCenterPosition{};
0100 };
0101 
0102 inline float SpacePointData::quality(std::size_t idx) const {
0103   return m_quality[idx];
0104 }
0105 
0106 inline float SpacePointData::deltaR(std::size_t idx) const {
0107   return m_deltaR[idx];
0108 }
0109 
0110 inline void SpacePointData::setQuality(std::size_t idx, const float value) {
0111   if (value > m_quality[idx]) {
0112     m_quality[idx] = value;
0113   }
0114 }
0115 
0116 inline void SpacePointData::setDeltaR(std::size_t idx, const float value) {
0117   m_deltaR[idx] = value;
0118 }
0119 
0120 inline void SpacePointData::resize(std::size_t n, bool resizeDynamic) {
0121   clear();
0122 
0123   m_quality.resize(n, -std::numeric_limits<float>::infinity());
0124   m_deltaR.resize(n, 0.);
0125 
0126   if (resizeDynamic) {
0127     m_topStripVector.resize(n, {0, 0, 0});
0128     m_bottomStripVector.resize(n, {0, 0, 0});
0129     m_stripCenterDistance.resize(n, {0, 0, 0});
0130     m_topStripCenterPosition.resize(n, {0, 0, 0});
0131   }
0132 }
0133 
0134 inline void SpacePointData::clear() {
0135   // mutable variables
0136   m_quality.clear();
0137   m_deltaR.clear();
0138   // dynamicvariables
0139   m_topStripVector.clear();
0140   m_bottomStripVector.clear();
0141   m_stripCenterDistance.clear();
0142   m_topStripCenterPosition.clear();
0143 }
0144 
0145 }  // namespace Acts