File indexing completed on 2026-07-26 08:22:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/definitions/common.hpp"
0010 #include "traccc/definitions/primitives.hpp"
0011 #include "traccc/utils/ranges.hpp"
0012
0013
0014 #include <gtest/gtest.h>
0015
0016 using namespace traccc;
0017
0018
0019 TEST(ranges, eta_to_theta) {
0020
0021
0022 ASSERT_NEAR(eta_to_theta(2.3f), 11.451f * traccc::unit<scalar>::degree,
0023 1e-3f * traccc::unit<scalar>::degree);
0024 ASSERT_NEAR(eta_to_theta(-0.87f), 134.537f * traccc::unit<scalar>::degree,
0025 1e-3f * traccc::unit<scalar>::degree);
0026
0027 std::array<scalar, 2> eta_range{-2.44f, 3.13f};
0028 const auto theta_range = eta_to_theta_range(eta_range);
0029
0030 ASSERT_NEAR(theta_range[0], 5.007f * traccc::unit<scalar>::degree,
0031 1e-3f * traccc::unit<scalar>::degree);
0032 ASSERT_NEAR(theta_range[1], 170.037f * traccc::unit<scalar>::degree,
0033 1e-3f * traccc::unit<scalar>::degree);
0034 }
0035
0036
0037 TEST(ranges, theta_to_eta) {
0038
0039
0040 ASSERT_NEAR(theta_to_eta(132.8f * traccc::unit<scalar>::degree), -0.828f,
0041 1e-3f);
0042 ASSERT_NEAR(theta_to_eta(90.f * traccc::unit<scalar>::degree), 0.f, 1e-3f);
0043
0044 std::array<scalar, 2> theta_range{45.f * traccc::unit<scalar>::degree,
0045 175.f * traccc::unit<scalar>::degree};
0046 const auto eta_range = theta_to_eta_range(theta_range);
0047
0048 ASSERT_NEAR(eta_range[0], -3.131f, 1e-3f);
0049 ASSERT_NEAR(eta_range[1], 0.881f, 1e-3f);
0050 }