diff --git a/tests/modules/testEpos.cpp b/tests/modules/testEpos.cpp index 68435ba8c2b4692d5665af6c1f0a9ac4f2aef512..3b219df6a9edeec534f25d9cbaa3a9fa83214bec 100644 --- a/tests/modules/testEpos.cpp +++ b/tests/modules/testEpos.cpp @@ -149,6 +149,7 @@ TEST_CASE("Epos", "modules") { CHECK(model.isValid(Code::Proton, Code::Hydrogen, 100_GeV)); CHECK(model.isValid(Code::Proton, Code::Helium, 100_GeV)); CHECK_FALSE(model.isValid(Code::Proton, Code::Iron, 10_EeV)); + CHECK_FALSE(model.isValid(Code::Proton, get_nucleus_code(240, 120), 10_EeV)); CHECK(model.isValid(Code::Proton, Code::Oxygen, 100_GeV)); } @@ -239,51 +240,53 @@ TEST_CASE("Epos", "modules") { CHECK(xs_prod2 / 1_mb == Approx(1076.7).margin(3.1)); } - /* - SECTION("InteractionInterface - invalid") { - Code const pid = Code::Electron; - HEPEnergyType const P0 = 10_TeV; - auto [stack, viewPtr] = setup::testing::setup_stack( - pid, P0, (setup::Environment::BaseNodeType* const)nodePtr, cs); - setup::StackView& view = *viewPtr; - CHECK_THROWS(model.doInteraction( - view, pid, Code::Oxygen, - {sqrt(static_pow<2>(P0) + static_pow<2>(get_mass(pid))), {cs, P0, 0_GeV, - 0_GeV}}, {Oxygen::mass, {cs, 0_GeV, 0_GeV, 0_GeV}})); - } - */ - /* - SECTION("InteractionInterface - nuclear projectile") { - - HEPEnergyType const P0 = 10_TeV; - Code const pid = get_nucleus_code(40, 20); - auto [stack, viewPtr] = setup::testing::setup_stack( - pid, P0, (setup::Environment::BaseNodeType* const)nodePtr, cs); - MomentumVector plab = - MomentumVector(cs, {P0, 0_eV, 0_eV}); // this is secret knowledge about - setupStack setup::StackView& view = *viewPtr; - - // @todo This is very obscure since it fails for -O2, but for both clang and gcc ??? - model.doInteraction(view, pid, Code::Oxygen, - {sqrt(static_pow<2>(P0) + static_pow<2>(get_mass(pid))), plab}, - {Oxygen::mass, {cs, 0_GeV, 0_GeV, 0_GeV}}); - - auto const pSum = sumMomentum(view, cs); - - CHECK(pSum.getComponents(cs).getX() / P0 == Approx(1).margin(0.05)); - CHECK(pSum.getComponents(cs).getY() / 1_GeV == - Approx(0).margin(0.5)); // this is not physics validation - CHECK(pSum.getComponents(cs).getZ() / 1_GeV == - Approx(0).margin(0.5)); // this is not physics validation - - CHECK((pSum - plab).getNorm() / 1_GeV == - Approx(0).margin(plab.getNorm() * 0.05 / 1_GeV)); - CHECK(pSum.getNorm() / P0 == Approx(1).margin(0.05)); - // [[maybe_unused]] const GrammageType length = - // model.getInteractionLength(particle); - // CHECK(length / 1_g * 1_cm * 1_cm == - // Approx(30).margin(20)); // this is no physics validation - }*/ + SECTION("InteractionInterface - invalid") { + Code const pid = Code::Electron; + HEPEnergyType const P0 = 10_TeV; + auto [stack, viewPtr] = setup::testing::setup_stack( + pid, P0, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); + test::StackView& view = *viewPtr; + CHECK_THROWS(model.doInteraction( + view, pid, Code::Oxygen, + {sqrt(static_pow<2>(P0) + static_pow<2>(get_mass(pid))), {cs, P0, 0_GeV, 0_GeV}}, + {Oxygen::mass, {cs, 0_GeV, 0_GeV, 0_GeV}})); + } + + SECTION("InteractionInterface - nuclear projectile") { + + HEPEnergyType const P0 = 10_TeV; + Code const pid = get_nucleus_code(40, 20); + auto [stack, viewPtr] = setup::testing::setup_stack( + pid, P0, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); + MomentumVector plab = + MomentumVector(cs, {P0, 0_eV, 0_eV}); // this is secret knowledge about + test::StackView& view = *viewPtr; + + // @todo This is very obscure since it fails for -O2, but for both clang and gcc ??? + model.doInteraction(view, pid, Code::Oxygen, + {sqrt(static_pow<2>(P0) + static_pow<2>(get_mass(pid))), plab}, + {Oxygen::mass, {cs, 0_GeV, 0_GeV, 0_GeV}}); + + // simply check if stack is not empty after the event. Energy and momentum + // conservation will be tested elsewhere + CHECK(view.getSize() > 0); + + // auto const pSum = sumMomentum(view, cs); + + // CHECK(pSum.getComponents(cs).getX() / P0 == Approx(1).margin(0.05)); + // CHECK(pSum.getComponents(cs).getY() / 1_GeV == + // Approx(0).margin(0.5)); // this is not physics validation + // CHECK(pSum.getComponents(cs).getZ() / 1_GeV == + // Approx(0).margin(0.5)); // this is not physics validation + + // CHECK((pSum - plab).getNorm() / 1_GeV == + // Approx(0).margin(plab.getNorm() * 0.05 / 1_GeV)); + // CHECK(pSum.getNorm() / P0 == Approx(1).margin(0.05)); + // [[maybe_unused]] const GrammageType length = + // model.getInteractionLength(particle); + // CHECK(length / 1_g * 1_cm * 1_cm == + // Approx(30).margin(20)); // this is no physics validation + } // SECTION("InteractionInterface") {