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