Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestSpacePoint.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TestSpacePoint.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 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 
14 
15 #include <cmath>
16 #include <vector>
17 
18 #include <boost/container/static_vector.hpp>
19 namespace Acts {
20 namespace Test {
21 
24  public:
32  template <typename position_t>
34  const Eigen::MatrixBase<position_t>& pos, float varRho, float varZ,
35  boost::container::static_vector<Acts::SourceLink, 2> sourceLinks)
36  : m_x(pos[Acts::ePos0]),
37  m_y(pos[Acts::ePos1]),
38  m_z(pos[Acts::ePos2]),
39  m_rho(std::hypot(m_x, m_y)),
40  m_varianceRho(varRho),
41  m_varianceZ(varZ),
42  m_sourceLinks(std::move(sourceLinks)) {
43  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(position_t, 3);
44  }
45  TestSpacePoint() = default;
46  constexpr float x() const { return m_x; }
47  constexpr float y() const { return m_y; }
48  constexpr float z() const { return m_z; }
49  constexpr float r() const { return m_rho; }
50  constexpr float varianceR() const { return m_varianceRho; }
51  constexpr float varianceZ() const { return m_varianceZ; }
52 
53  const boost::container::static_vector<Acts::SourceLink, 2>& sourceLinks()
54  const {
55  return m_sourceLinks;
56  }
57 
58  private:
59  // Global position
60  float m_x = 0;
61  float m_y = 0;
62  float m_z = 0;
63  float m_rho = 0;
64  // Variance in rho/z of the global coordinates
65  float m_varianceRho = 0;
66  float m_varianceZ = 0;
67  // source links. A Pixel (strip) SP has one (two) sourceLink(s).
68  boost::container::static_vector<Acts::SourceLink, 2> m_sourceLinks;
69 };
70 
71 inline bool operator==(const TestSpacePoint& lhs, const TestSpacePoint& rhs) {
72  return (std::equal(lhs.sourceLinks().begin(), lhs.sourceLinks().end(),
73  rhs.sourceLinks().begin(),
74  [](const auto& lsl, const auto& rsl) {
75  return lsl.template get<TestSourceLink>() ==
76  rsl.template get<TestSourceLink>();
77  }) and
78  lhs.x() == rhs.x()) and
79  (lhs.y() == rhs.y()) and (lhs.z() == rhs.z()) and
80  (lhs.varianceR() == rhs.varianceR()) and
81  (lhs.varianceZ() == rhs.varianceZ());
82 }
83 
85 using TestSpacePointContainer = std::vector<TestSpacePoint>;
86 
87 } // namespace Test
88 } // namespace Acts