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) 2025-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Library include(s).
0011 #include "traccc/definitions/common.hpp"
0012 #include "traccc/definitions/math.hpp"
0013 
0014 namespace traccc::edm {
0015 
0016 template <typename BASE>
0017 template <std::integral TYPE>
0018 TRACCC_HOST_DEVICE void measurement<BASE>::set_subspace(
0019     const std::array<TYPE, 2u>& subs) {
0020   subspace()[0] = static_cast<std::uint8_t>(subs[0]);
0021   subspace()[1] = static_cast<std::uint8_t>(subs[1]);
0022 }
0023 
0024 template <typename BASE>
0025 template <typename T>
0026 TRACCC_HOST_DEVICE bool measurement<BASE>::operator==(
0027     const measurement<T>& other) const {
0028   return ((surface_link() == other.surface_link()) &&
0029           (math::abs(local_position()[0] - other.local_position()[0]) <
0030            float_epsilon) &&
0031           (math::abs(local_position()[1] - other.local_position()[1]) <
0032            float_epsilon) &&
0033           (math::abs(local_variance()[0] - other.local_variance()[0]) <
0034            float_epsilon) &&
0035           (math::abs(local_variance()[1] - other.local_variance()[1]) <
0036            float_epsilon));
0037 }
0038 
0039 template <typename BASE>
0040 template <typename T>
0041 TRACCC_HOST_DEVICE std::partial_ordering measurement<BASE>::operator<=>(
0042     const measurement<T>& other) const {
0043   if (surface_link() != other.surface_link()) {
0044     return (surface_link() <=> other.surface_link());
0045   } else if (local_position()[0] != other.local_position()[0]) {
0046     return (local_position()[0] <=> other.local_position()[0]);
0047   } else if (local_position()[1] != other.local_position()[1]) {
0048     return (local_position()[1] <=> other.local_position()[1]);
0049   } else if (local_variance()[0] != other.local_variance()[0]) {
0050     return (local_variance()[0] <=> other.local_variance()[0]);
0051   } else {
0052     return (local_variance()[1] <=> other.local_variance()[1]);
0053   }
0054 }
0055 
0056 }  // namespace traccc::edm