Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:02:37

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "ActsFatras/Selectors/KinematicCasts.hpp"
0013 #include "ActsTests/CommonHelpers/FloatComparisons.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 // TODO why does this have to be so high to avoid failure in eta tests?
0025 constexpr auto eps = 128 * std::numeric_limits<double>::epsilon();
0026 }  // namespace
0027 
0028 namespace ActsTests {
0029 
0030 BOOST_AUTO_TEST_SUITE(SelectorsSuite)
0031 
0032 BOOST_AUTO_TEST_CASE(BackwardParticle) {
0033   const auto& particle = Dataset::backwardPion;
0034 
0035   CHECK_SMALL(Vrho()(particle), eps);
0036   CHECK_CLOSE_REL(Vz()(particle), -100_mm, eps);
0037   CHECK_CLOSE_REL(AbsVz()(particle), 100_mm, eps);
0038   CHECK_CLOSE_REL(Eta()(particle), -4.5, eps);
0039   CHECK_CLOSE_REL(AbsEta()(particle), 4.5, eps);
0040   CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV / std::cosh(4.5), eps);
0041   CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0042   // allow higher threshold to allow for potential mass term differences
0043   CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0044 }
0045 
0046 BOOST_AUTO_TEST_CASE(CentralParticle) {
0047   const auto& particle = Dataset::centralPion;
0048 
0049   CHECK_SMALL(Vrho()(particle), eps);
0050   CHECK_SMALL(Vz()(particle), eps);
0051   CHECK_SMALL(AbsVz()(particle), eps);
0052   CHECK_SMALL(Eta()(particle), eps);
0053   CHECK_SMALL(AbsEta()(particle), eps);
0054   CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV, eps);
0055   CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0056   // allow higher threshold to allow for potential mass term differences
0057   CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0058 }
0059 
0060 BOOST_AUTO_TEST_CASE(ForwardParticle) {
0061   const auto& particle = Dataset::forwardPion;
0062 
0063   CHECK_SMALL(Vrho()(particle), eps);
0064   CHECK_CLOSE_REL(Vz()(particle), 100_mm, eps);
0065   CHECK_CLOSE_REL(AbsVz()(particle), 100_mm, eps);
0066   CHECK_CLOSE_REL(Eta()(particle), 4.5, eps);
0067   CHECK_CLOSE_REL(AbsEta()(particle), 4.5, eps);
0068   CHECK_CLOSE_REL(Pt()(particle), 1.5_GeV / std::cosh(4.5), eps);
0069   CHECK_CLOSE_REL(P()(particle), 1.5_GeV, eps);
0070   // allow higher threshold to allow for potential mass term differences
0071   CHECK_CLOSE_REL(E()(particle), std::hypot(1.5_GeV, 139.57018_MeV), 1e-7);
0072 }
0073 
0074 BOOST_AUTO_TEST_SUITE_END()
0075 
0076 }  // namespace ActsTests