Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:49

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 
0013 #include <cmath>
0014 #include <functional>
0015 #include <optional>
0016 
0017 namespace Acts {
0018 
0019 template <typename SpacePoint>
0020 class InternalSpacePoint {
0021   /////////////////////////////////////////////////////////////////////////////////
0022   // Public methods:
0023   /////////////////////////////////////////////////////////////////////////////////
0024 
0025  public:
0026   InternalSpacePoint() = delete;
0027   InternalSpacePoint(std::size_t index, const SpacePoint& sp,
0028                      const Acts::Vector3& globalPos,
0029                      const Acts::Vector2& offsetXY,
0030                      const Acts::Vector2& variance,
0031                      std::optional<float> globalTime);
0032 
0033   InternalSpacePoint(const InternalSpacePoint<SpacePoint>& sp);
0034   ~InternalSpacePoint() = default;
0035 
0036   InternalSpacePoint<SpacePoint>& operator=(
0037       const InternalSpacePoint<SpacePoint>&) = delete;
0038 
0039   std::size_t index() const { return m_index; }
0040   float x() const { return m_x; }
0041   float y() const { return m_y; }
0042   float z() const { return m_z; }
0043   std::optional<float> t() const { return m_t; }
0044   float radius() const { return m_r; }
0045   float phi() const { return m_phi; }
0046   float varianceR() const { return m_varianceR; }
0047   float varianceZ() const { return m_varianceZ; }
0048   const SpacePoint& sp() const { return m_sp; }
0049 
0050  protected:
0051   std::size_t m_index;
0052   float m_x;                 // x-coordinate in beam system coordinates
0053   float m_y;                 // y-coordinate in beam system coordinates
0054   float m_z;                 // z-coordinate in beam system coordinetes
0055   float m_r;                 // radius       in beam system coordinates
0056   float m_phi;               //
0057   float m_varianceR;         //
0058   float m_varianceZ;         //
0059   std::optional<float> m_t;  // time
0060   std::reference_wrapper<const SpacePoint> m_sp;  // external space point
0061 };
0062 
0063 /////////////////////////////////////////////////////////////////////////////////
0064 // Inline methods
0065 /////////////////////////////////////////////////////////////////////////////////
0066 
0067 template <typename SpacePoint>
0068 inline InternalSpacePoint<SpacePoint>::InternalSpacePoint(
0069     std::size_t index, const SpacePoint& sp, const Acts::Vector3& globalPos,
0070     const Acts::Vector2& offsetXY, const Acts::Vector2& variance,
0071     std::optional<float> globalTime)
0072     : m_index(index),
0073       m_x(globalPos.x() - offsetXY.x()),
0074       m_y(globalPos.y() - offsetXY.y()),
0075       m_z(globalPos.z()),
0076       m_r(std::hypot(m_x, m_y)),
0077       m_phi(std::atan2(m_y, m_x)),
0078       m_varianceR(variance.x()),
0079       m_varianceZ(variance.y()),
0080       m_t(globalTime),
0081       m_sp(sp) {}
0082 
0083 /////////////////////////////////////////////////////////////////////////////////
0084 // Copy constructor
0085 /////////////////////////////////////////////////////////////////////////////////
0086 
0087 template <typename SpacePoint>
0088 inline InternalSpacePoint<SpacePoint>::InternalSpacePoint(
0089     const InternalSpacePoint<SpacePoint>& sp) = default;
0090 
0091 }  // namespace Acts