Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:21:57

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2021-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Local include(s).
0011 #include "traccc/definitions/math.hpp"
0012 
0013 namespace traccc::edm {
0014 
0015 template <typename BASE>
0016 TRACCC_HOST_DEVICE auto& spacepoint<BASE>::x() {
0017   return global()[0];
0018 }
0019 
0020 template <typename BASE>
0021 TRACCC_HOST_DEVICE const auto& spacepoint<BASE>::x() const {
0022   return global()[0];
0023 }
0024 
0025 template <typename BASE>
0026 TRACCC_HOST_DEVICE auto& spacepoint<BASE>::y() {
0027   return global()[1];
0028 }
0029 
0030 template <typename BASE>
0031 TRACCC_HOST_DEVICE const auto& spacepoint<BASE>::y() const {
0032   return global()[1];
0033 }
0034 
0035 template <typename BASE>
0036 TRACCC_HOST_DEVICE auto& spacepoint<BASE>::z() {
0037   return global()[2];
0038 }
0039 
0040 template <typename BASE>
0041 TRACCC_HOST_DEVICE const auto& spacepoint<BASE>::z() const {
0042   return global()[2];
0043 }
0044 
0045 template <typename BASE>
0046 TRACCC_HOST_DEVICE auto spacepoint<BASE>::radius() const {
0047   const float xx = x();
0048   const float yy = y();
0049   return math::sqrt(xx * xx + yy * yy);
0050 }
0051 
0052 template <typename BASE>
0053 TRACCC_HOST_DEVICE auto spacepoint<BASE>::phi() const {
0054   return math::atan2(y(), x());
0055 }
0056 
0057 template <typename BASE>
0058 template <typename T>
0059 TRACCC_HOST_DEVICE bool spacepoint<BASE>::operator==(
0060     const spacepoint<T>& other) const {
0061   return ((measurement_index_1() == other.measurement_index_1()) &&
0062           (measurement_index_2() == other.measurement_index_2()) &&
0063           (math::fabs(x() - other.x()) < 1e-6f) &&
0064           (math::fabs(y() - other.y()) < 1e-6f) &&
0065           (math::fabs(z() - other.z()) < 1e-6f) &&
0066           (z_variance() == other.z_variance()) &&
0067           (radius_variance() == other.radius_variance()));
0068 }
0069 
0070 template <typename BASE>
0071 template <typename T>
0072 TRACCC_HOST_DEVICE std::weak_ordering spacepoint<BASE>::operator<=>(
0073     const spacepoint<T>& other) const {
0074   return (radius() <=> other.radius());
0075 }
0076 
0077 }  // namespace traccc::edm