Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:20

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2023-2024 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Project include(s).
0011 #include "traccc/definitions/math.hpp"
0012 #include "traccc/definitions/qualifiers.hpp"
0013 
0014 // System include(s).
0015 #include <cmath>
0016 
0017 namespace traccc {
0018 
0019 template <typename scalar_t>
0020 TRACCC_HOST_DEVICE inline scalar_t eta_to_theta(const scalar_t eta) {
0021   return 2.f * math::atan(std::exp(-eta));
0022 }
0023 
0024 template <typename scalar_t>
0025 TRACCC_HOST_DEVICE inline scalar_t theta_to_eta(const scalar_t theta) {
0026   return -math::log(math::tan(theta * 0.5f));
0027 }
0028 
0029 template <typename range_t>
0030 TRACCC_HOST_DEVICE inline range_t eta_to_theta_range(const range_t& eta_range) {
0031   // @NOTE: eta_range[0] is converted to theta_range[1] and eta_range[1]
0032   // to theta_range[0] because theta(minEta) > theta(maxEta)
0033   return {eta_to_theta(eta_range[1]), eta_to_theta(eta_range[0])};
0034 }
0035 
0036 template <typename range_t>
0037 TRACCC_HOST_DEVICE inline range_t theta_to_eta_range(
0038     const range_t& theta_range) {
0039   // @NOTE: theta_range[0] is converted to eta_range[1] and theta_range[1]
0040   // to eta_range[0]
0041   return {theta_to_eta(theta_range[1]), theta_to_eta(theta_range[0])};
0042 }
0043 
0044 }  // namespace traccc