ECCE @ EIC 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) 2018 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 
11 #include <array>
12 #include <cmath>
13 #include <limits>
14 
16 
17 namespace Acts {
18 template <typename SpacePoint>
21  // Public methods:
23 
24  public:
25  InternalSpacePoint() = delete;
26  InternalSpacePoint(const SpacePoint& sp, const Acts::Vector3D& globalPos,
27  const Acts::Vector2D& offsetXY,
28  const Acts::Vector2D& variance);
29 
31  ~InternalSpacePoint() = default;
32 
35 
36  const float& x() const { return m_x; }
37  const float& y() const { return m_y; }
38  const float& z() const { return m_z; }
39  const float& radius() const { return m_r; }
40  float phi() const { return atan2f(m_y, m_x); }
41  const float& varianceR() const { return m_varianceR; }
42  const float& varianceZ() const { return m_varianceZ; }
43  const SpacePoint& sp() const { return m_sp; }
44 
45  protected:
46  float m_x; // x-coordinate in beam system coordinates
47  float m_y; // y-coordinate in beam system coordinates
48  float m_z; // z-coordinate in beam system coordinetes
49  float m_r; // radius in beam system coordinates
50  float m_varianceR; //
51  float m_varianceZ; //
52  const SpacePoint& m_sp; // external space point
53 };
54 
56 // Inline methods
58 
59 template <typename SpacePoint>
61  const SpacePoint& sp, const Acts::Vector3D& globalPos,
62  const Acts::Vector2D& offsetXY, const Acts::Vector2D& variance)
63  : m_sp(sp) {
64  m_x = globalPos.x() - offsetXY.x();
65  m_y = globalPos.y() - offsetXY.y();
66  m_z = globalPos.z();
67  m_r = std::sqrt(m_x * m_x + m_y * m_y);
68  m_varianceR = variance.x();
69  m_varianceZ = variance.y();
70 }
71 
73 // Copy constructor
75 
76 template <typename SpacePoint>
79  : m_sp(sp.sp()) {
80  m_x = sp.m_x;
81  m_y = sp.m_y;
82  m_z = sp.m_z;
83  m_r = sp.m_r;
86 }
87 
88 } // end of namespace Acts