Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalSpacePoint.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InternalSpacePoint.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2023 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 
12 
13 #include <array>
14 #include <cmath>
15 #include <functional>
16 #include <limits>
17 
18 namespace Acts {
19 template <typename SpacePoint>
22  // Public methods:
24 
25  public:
26  InternalSpacePoint() = delete;
27  InternalSpacePoint(std::size_t index, const SpacePoint& sp,
28  const Acts::Vector3& globalPos,
29  const Acts::Vector2& offsetXY,
30  const Acts::Vector2& variance);
31 
33  ~InternalSpacePoint() = default;
34 
36  const InternalSpacePoint<SpacePoint>&) = delete;
37 
38  std::size_t index() const { return m_index; }
39  float x() const { return m_x; }
40  float y() const { return m_y; }
41  float z() const { return m_z; }
42  float radius() const { return m_r; }
43  float phi() const { return m_phi; }
44  float varianceR() const { return m_varianceR; }
45  float varianceZ() const { return m_varianceZ; }
46  const SpacePoint& sp() const { return m_sp; }
47 
48  protected:
49  std::size_t m_index;
50  float m_x; // x-coordinate in beam system coordinates
51  float m_y; // y-coordinate in beam system coordinates
52  float m_z; // z-coordinate in beam system coordinetes
53  float m_r; // radius in beam system coordinates
54  float m_phi; //
55  float m_varianceR; //
56  float m_varianceZ; //
57  std::reference_wrapper<const SpacePoint> m_sp; // external space point
58 };
59 
61 // Inline methods
63 
64 template <typename SpacePoint>
66  std::size_t index, const SpacePoint& sp, const Acts::Vector3& globalPos,
67  const Acts::Vector2& offsetXY, const Acts::Vector2& variance)
68  : m_index(index),
69  m_x(globalPos.x() - offsetXY.x()),
70  m_y(globalPos.y() - offsetXY.y()),
71  m_z(globalPos.z()),
72  m_r(std::hypot(m_x, m_y)),
73  m_phi(std::atan2(m_y, m_x)),
74  m_varianceR(variance.x()),
75  m_varianceZ(variance.y()),
76  m_sp(sp) {}
77 
79 // Copy constructor
81 
82 template <typename SpacePoint>
84  const InternalSpacePoint<SpacePoint>& sp) = default;
85 
86 } // end of namespace Acts