File indexing completed on 2025-01-18 09:13:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0013 #include "ActsFatras/Selectors/KinematicCasts.hpp"
0014
0015 #include <cmath>
0016 #include <limits>
0017
0018 #include "Dataset.hpp"
0019
0020 using namespace Acts::UnitLiterals;
0021 using namespace ActsFatras::Casts;
0022
0023 namespace {
0024
0025 constexpr auto eps = 128 * std::numeric_limits<double>::epsilon();
0026 }
0027
0028 BOOST_AUTO_TEST_SUITE(FatrasKinematicCasts)
0029
0030 BOOST_AUTO_TEST_CASE(BackwardParticle) {
0031 const auto& particle = Dataset::backwardPion;
0032
0033 CHECK_SMALL(Vrho()(particle), eps);
0034 CHECK_CLOSE_REL(Vz()(particle), -100_mm, eps);
0035 CHECK_CLOSE_REL(AbsVz()(particle), 100_mm, eps);
0036 CHECK_CLOSE_REL(Eta()(particle), -4.5, eps);
0037 CHECK_CLOSE_REL(AbsEta()(particle), 4.5, eps);
0038 CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV / std::cosh(4.5), eps);
0039 CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0040
0041 CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0042 }
0043
0044 BOOST_AUTO_TEST_CASE(CentralParticle) {
0045 const auto& particle = Dataset::centralPion;
0046
0047 CHECK_SMALL(Vrho()(particle), eps);
0048 CHECK_SMALL(Vz()(particle), eps);
0049 CHECK_SMALL(AbsVz()(particle), eps);
0050 CHECK_SMALL(Eta()(particle), eps);
0051 CHECK_SMALL(AbsEta()(particle), eps);
0052 CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV, eps);
0053 CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0054
0055 CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0056 }
0057
0058 BOOST_AUTO_TEST_CASE(ForwardParticle) {
0059 const auto& particle = Dataset::forwardPion;
0060
0061 CHECK_SMALL(Vrho()(particle), eps);
0062 CHECK_CLOSE_REL(Vz()(particle), 100_mm, eps);
0063 CHECK_CLOSE_REL(AbsVz()(particle), 100_mm, eps);
0064 CHECK_CLOSE_REL(Eta()(particle), 4.5, eps);
0065 CHECK_CLOSE_REL(AbsEta()(particle), 4.5, eps);
0066 CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV / std::cosh(4.5), eps);
0067 CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0068
0069 CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0070 }
0071
0072 BOOST_AUTO_TEST_SUITE_END()