Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimSpacePoint.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimSpacePoint.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
16 
17 #include <cmath>
18 #include <vector>
19 
20 #include <boost/container/static_vector.hpp>
21 
22 namespace ActsExamples {
23 
27 
28  public:
43  template <typename position_t>
45  const Eigen::MatrixBase<position_t>& pos, float varRho, float varZ,
46  boost::container::static_vector<Acts::SourceLink, 2> sourceLinks,
47  const float topHalfStripLength, const float bottomHalfStripLength,
52  : m_x(pos[Acts::ePos0]),
53  m_y(pos[Acts::ePos1]),
54  m_z(pos[Acts::ePos2]),
55  m_rho(std::hypot(m_x, m_y)),
56  m_varianceRho(varRho),
57  m_varianceZ(varZ),
58  m_sourceLinks(std::move(sourceLinks)),
59  m_topHalfStripLength(topHalfStripLength),
60  m_bottomHalfStripLength(bottomHalfStripLength),
61  m_topStripDirection(topStripDirection),
62  m_bottomStripDirection(bottomStripDirection),
63  m_stripCenterDistance(stripCenterDistance),
64  m_topStripCenterPosition(topStripCenterPosition),
66  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3);
67  }
68 
76  template <typename position_t>
78  const Eigen::MatrixBase<position_t>& pos, Scalar varRho, Scalar varZ,
79  boost::container::static_vector<Acts::SourceLink, 2> sourceLinks)
80  : m_x(pos[Acts::ePos0]),
81  m_y(pos[Acts::ePos1]),
82  m_z(pos[Acts::ePos2]),
83  m_rho(std::hypot(m_x, m_y)),
84  m_varianceRho(varRho),
85  m_varianceZ(varZ),
86  m_sourceLinks(std::move(sourceLinks)) {
87  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3);
88  }
89 
90  constexpr Scalar x() const { return m_x; }
91  constexpr Scalar y() const { return m_y; }
92  constexpr Scalar z() const { return m_z; }
93  constexpr Scalar r() const { return m_rho; }
94  constexpr Scalar varianceR() const { return m_varianceRho; }
95  constexpr Scalar varianceZ() const { return m_varianceZ; }
96 
97  const boost::container::static_vector<Acts::SourceLink, 2>& sourceLinks()
98  const {
99  return m_sourceLinks;
100  }
101 
102  constexpr float topHalfStripLength() const { return m_topHalfStripLength; }
103  constexpr float bottomHalfStripLength() const {
105  }
111  }
112  constexpr bool validDoubleMeasurementDetails() const {
114  }
115 
116  private:
117  // Global position
122  // Variance in rho/z of the global coordinates
125  // SourceLinks of the corresponding measurements. A Pixel (strip) SP has one
126  // (two) sourceLink(s).
127  boost::container::static_vector<Acts::SourceLink, 2> m_sourceLinks;
128 
129  // half of the length of the top strip
131  // half of the length of the bottom strip
133  // direction of the top strip
135  // direction of the bottom strip
137  // distance between the center of the two strips
139  // position of the center of the bottom strip
142 };
143 
144 inline bool operator==(const SimSpacePoint& lhs, const SimSpacePoint& rhs) {
145  // TODO would it be sufficient to check just the index under the assumption
146  // that the same measurement index always produces the same space point?
147  // no need to check r since it is fully defined by x/y
148 
149  return (std::equal(lhs.sourceLinks().begin(), lhs.sourceLinks().end(),
150  rhs.sourceLinks().begin(),
151  [](const auto& lsl, const auto& rsl) {
152  return lsl.template get<IndexSourceLink>() ==
153  rsl.template get<IndexSourceLink>();
154  }) and
155  (lhs.x() == rhs.x()) and (lhs.y() == rhs.y()) and
156  (lhs.z() == rhs.z()) and (lhs.varianceR() == rhs.varianceR()) and
157  (lhs.varianceZ() == rhs.varianceZ()));
158 }
159 
161 using SimSpacePointContainer = std::vector<SimSpacePoint>;
162 
163 } // namespace ActsExamples