File indexing completed on 2025-01-30 09:32:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Common.hpp"
0013 #include "Acts/EventData/SourceLink.hpp"
0014 #include "ActsExamples/EventData/Index.hpp"
0015 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0016
0017 #include <cmath>
0018 #include <vector>
0019
0020 #include <boost/container/static_vector.hpp>
0021
0022 namespace ActsExamples {
0023
0024
0025 class SimSpacePoint {
0026 using Scalar = Acts::ActsScalar;
0027
0028 public:
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 template <typename position_t>
0046 SimSpacePoint(
0047 const Eigen::MatrixBase<position_t>& pos, std::optional<Scalar> t,
0048 Scalar varRho, Scalar varZ, std::optional<Scalar> varT,
0049 boost::container::static_vector<Acts::SourceLink, 2> sourceLinks,
0050 Scalar topHalfStripLength, Scalar bottomHalfStripLength,
0051 const Acts::Vector3& topStripDirection,
0052 const Acts::Vector3& bottomStripDirection,
0053 const Acts::Vector3& stripCenterDistance,
0054 const Acts::Vector3& topStripCenterPosition)
0055 : m_x(pos[Acts::ePos0]),
0056 m_y(pos[Acts::ePos1]),
0057 m_z(pos[Acts::ePos2]),
0058 m_t(t),
0059 m_rho(std::hypot(m_x, m_y)),
0060 m_varianceRho(varRho),
0061 m_varianceZ(varZ),
0062 m_varianceT(varT),
0063 m_sourceLinks(std::move(sourceLinks)),
0064 m_topHalfStripLength(topHalfStripLength),
0065 m_bottomHalfStripLength(bottomHalfStripLength),
0066 m_topStripDirection(topStripDirection),
0067 m_bottomStripDirection(bottomStripDirection),
0068 m_stripCenterDistance(stripCenterDistance),
0069 m_topStripCenterPosition(topStripCenterPosition),
0070 m_validDoubleMeasurementDetails(true) {
0071 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3);
0072 }
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 template <typename position_t>
0084 SimSpacePoint(
0085 const Eigen::MatrixBase<position_t>& pos, std::optional<Scalar> t,
0086 Scalar varRho, Scalar varZ, std::optional<Scalar> varT,
0087 boost::container::static_vector<Acts::SourceLink, 2> sourceLinks)
0088 : m_x(pos[Acts::ePos0]),
0089 m_y(pos[Acts::ePos1]),
0090 m_z(pos[Acts::ePos2]),
0091 m_t(t),
0092 m_rho(std::hypot(m_x, m_y)),
0093 m_varianceRho(varRho),
0094 m_varianceZ(varZ),
0095 m_varianceT(varT),
0096 m_sourceLinks(std::move(sourceLinks)) {
0097 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3);
0098 }
0099
0100 constexpr Scalar x() const { return m_x; }
0101 constexpr Scalar y() const { return m_y; }
0102 constexpr Scalar z() const { return m_z; }
0103 constexpr std::optional<Scalar> t() const { return m_t; }
0104 constexpr Scalar r() const { return m_rho; }
0105 constexpr Scalar varianceR() const { return m_varianceRho; }
0106 constexpr Scalar varianceZ() const { return m_varianceZ; }
0107 constexpr std::optional<Scalar> varianceT() const { return m_varianceT; }
0108
0109 const boost::container::static_vector<Acts::SourceLink, 2>& sourceLinks()
0110 const {
0111 return m_sourceLinks;
0112 }
0113
0114 constexpr float topHalfStripLength() const { return m_topHalfStripLength; }
0115 constexpr float bottomHalfStripLength() const {
0116 return m_bottomHalfStripLength;
0117 }
0118 Acts::Vector3 topStripDirection() const { return m_topStripDirection; }
0119 Acts::Vector3 bottomStripDirection() const { return m_bottomStripDirection; }
0120 Acts::Vector3 stripCenterDistance() const { return m_stripCenterDistance; }
0121 Acts::Vector3 topStripCenterPosition() const {
0122 return m_topStripCenterPosition;
0123 }
0124 constexpr bool validDoubleMeasurementDetails() const {
0125 return m_validDoubleMeasurementDetails;
0126 }
0127
0128 private:
0129
0130 Scalar m_x;
0131 Scalar m_y;
0132 Scalar m_z;
0133 std::optional<Scalar> m_t;
0134 Scalar m_rho;
0135
0136 Scalar m_varianceRho;
0137 Scalar m_varianceZ;
0138 std::optional<Scalar> m_varianceT;
0139
0140
0141 boost::container::static_vector<Acts::SourceLink, 2> m_sourceLinks;
0142
0143
0144 float m_topHalfStripLength = 0;
0145
0146 float m_bottomHalfStripLength = 0;
0147
0148 Acts::Vector3 m_topStripDirection = {0, 0, 0};
0149
0150 Acts::Vector3 m_bottomStripDirection = {0, 0, 0};
0151
0152 Acts::Vector3 m_stripCenterDistance = {0, 0, 0};
0153
0154 Acts::Vector3 m_topStripCenterPosition = {0, 0, 0};
0155 bool m_validDoubleMeasurementDetails = false;
0156 };
0157
0158 inline bool operator==(const SimSpacePoint& lhs, const SimSpacePoint& rhs) {
0159
0160
0161
0162
0163 return (std::equal(lhs.sourceLinks().begin(), lhs.sourceLinks().end(),
0164 rhs.sourceLinks().begin(),
0165 [](const auto& lsl, const auto& rsl) {
0166 return lsl.template get<IndexSourceLink>() ==
0167 rsl.template get<IndexSourceLink>();
0168 }) &&
0169 (lhs.x() == rhs.x()) && (lhs.y() == rhs.y()) &&
0170 (lhs.z() == rhs.z()) && (lhs.t() == rhs.t()) &&
0171 (lhs.varianceR() == rhs.varianceR()) &&
0172 (lhs.varianceZ() == rhs.varianceZ()) &&
0173 (lhs.varianceT() == rhs.varianceT()));
0174 }
0175
0176
0177 using SimSpacePointContainer = std::vector<SimSpacePoint>;
0178
0179 }