File indexing completed on 2025-08-06 08:11:40
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0013 #include "Acts/Tests/CommonHelpers/PredefinedMaterials.hpp"
0014 #include "ActsFatras/EventData/Particle.hpp"
0015 #include "ActsFatras/Physics/ElectroMagnetic/Scattering.hpp"
0016
0017 #include <cstdint>
0018 #include <limits>
0019 #include <random>
0020
0021 #include "Dataset.hpp"
0022
0023 namespace {
0024 constexpr auto eps = std::numeric_limits<double>::epsilon();
0025
0026
0027 template <typename Scattering>
0028 void test(const Scattering& scattering, uint32_t seed,
0029 const ActsFatras::Particle& before) {
0030 std::ranlux48 gen(seed);
0031 ActsFatras::Particle after = before;
0032
0033 const auto outgoing = scattering(gen, Acts::Test::makePercentSlab(), after);
0034
0035 CHECK_CLOSE_REL(after.absoluteMomentum(), before.absoluteMomentum(), eps);
0036 CHECK_CLOSE_REL(after.energy(), before.energy(), eps);
0037
0038 BOOST_CHECK_LT(before.direction().dot(after.direction()), 1);
0039
0040 BOOST_CHECK(outgoing.empty());
0041 }
0042 }
0043
0044 BOOST_AUTO_TEST_SUITE(FatrasScattering)
0045
0046 BOOST_DATA_TEST_CASE(GeneralMixture, Dataset::parameters, pdg, phi, lambda, p,
0047 seed) {
0048 test(ActsFatras::GeneralMixtureScattering(), seed,
0049 Dataset::makeParticle(pdg, phi, lambda, p));
0050 }
0051
0052 BOOST_DATA_TEST_CASE(GaussianMixture, Dataset::parameters, pdg, phi, lambda, p,
0053 seed) {
0054 test(ActsFatras::GaussianMixtureScattering(), seed,
0055 Dataset::makeParticle(pdg, phi, lambda, p));
0056 }
0057
0058 BOOST_DATA_TEST_CASE(Highland, Dataset::parameters, pdg, phi, lambda, p, seed) {
0059 test(ActsFatras::HighlandScattering(), seed,
0060 Dataset::makeParticle(pdg, phi, lambda, p));
0061 }
0062
0063 BOOST_AUTO_TEST_SUITE_END()