Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:10

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <cmath>
0012 #include <optional>
0013 
0014 struct SpacePoint {
0015   // Member variables
0016   float m_x{};
0017   float m_y{};
0018   float m_z{};
0019   float m_r{};
0020   int layer{};
0021   float varianceR{};
0022   float varianceZ{};
0023   std::optional<float> m_t;
0024   std::optional<float> varianceT;
0025 
0026   // Default constructor
0027   SpacePoint() = default;
0028 
0029   // Constructor with parameters
0030   SpacePoint(float x, float y, float z, float r, int l, float varR, float varZ,
0031              std::optional<float> t, std::optional<float> varT)
0032       : m_x(x),
0033         m_y(y),
0034         m_z(z),
0035         m_r(r),
0036         layer(l),
0037         varianceR(varR),
0038         varianceZ(varZ),
0039         m_t(t),
0040         varianceT(varT) {}
0041 
0042   // Member functions
0043   float x() const { return m_x; }
0044   float y() const { return m_y; }
0045   float z() const { return m_z; }
0046   float r() const { return m_r; }
0047   std::optional<float> t() const { return m_t; }
0048 
0049   // Equality operator
0050   friend bool operator==(const SpacePoint &a, const SpacePoint &b) {
0051     return std::abs(a.m_x - b.m_x) < 1e-6 && std::abs(a.m_y - b.m_y) < 1e-6 &&
0052            std::abs(a.m_z - b.m_z) < 1e-6;
0053   }
0054 };