diff --git a/tests/modules/testCONEX.cpp b/tests/modules/testCONEX.cpp index 9596a8acab4bbed0f42a059d855488900e7e8b97..17f55ec2e6f92c7a3a4db94aec6353b90f0532d4 100644 --- a/tests/modules/testCONEX.cpp +++ b/tests/modules/testCONEX.cpp @@ -6,7 +6,8 @@ * the license. */ -#include <corsika/setup/SetupEnvironment.hpp> +//#include <corsika/setup/SetupEnvironment.hpp> +#include <SetupTestEnvironment.hpp> #include <corsika/media/Environment.hpp> #include <corsika/media/LayeredSphericalAtmosphereBuilder.hpp> @@ -42,6 +43,9 @@ using namespace corsika; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + const std::string refDataDir = std::string(REFDATADIR); // from cmake template <typename T> @@ -60,12 +64,12 @@ TEST_CASE("CONEX") { feenableexcept(FE_INVALID); // setup environment, geometry - setup::Environment env; + DummyEnvironment env; CoordinateSystemPtr const& rootCS = env.getCoordinateSystem(); Point const center{rootCS, 0_m, 0_m, 0_m}; auto builder = make_layered_spherical_atmosphere_builder< - setup::EnvironmentInterface, MExtraEnvirnoment>::create(center, + DummyEnvironmentInterface, MExtraEnvirnoment>::create(center, corsika::conex::earthRadius, Medium::AirDry1Atm, Vector{rootCS, 0_T, 50_mT, diff --git a/tests/modules/testEpos.cpp b/tests/modules/testEpos.cpp index d0f13d94fa941ae6931b9874b43d208240d9b5ad..44168578652834f809cdf5106f0112c577b18687 100644 --- a/tests/modules/testEpos.cpp +++ b/tests/modules/testEpos.cpp @@ -13,6 +13,8 @@ #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/random/RNGManager.hpp> +#include <SetupTestEnvironment.hpp> + #include <catch2/catch.hpp> #include <tuple> @@ -29,6 +31,9 @@ using namespace corsika; using namespace corsika::epos; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + TEST_CASE("EposBasics", "module,process") { logging::set_level(logging::level::trace); @@ -284,10 +289,10 @@ TEST_CASE("Epos", "modules") { HEPEnergyType const P0 = 10_TeV; Code const pid = Code::Proton; auto [stack, viewPtr] = setup::testing::setup_stack( - pid, P0, (setup::Environment::BaseNodeType* const)nodePtr, cs); + pid, P0, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); MomentumVector plab = MomentumVector(cs, {P0, 0_eV, 0_eV}); // this is secret knowledge about - setup::StackView& view = *viewPtr; + 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, diff --git a/tests/modules/testObservationPlane.cpp b/tests/modules/testObservationPlane.cpp index 5432c0946fcb9c56dd509ee80b710dfdfd08c93e..0f006ac4040aee990b7abfa4647853349f4a5d2e 100644 --- a/tests/modules/testObservationPlane.cpp +++ b/tests/modules/testObservationPlane.cpp @@ -40,7 +40,7 @@ TEST_CASE("ObservationPlane", "interface") { ObservationPlane has origin at 10,0,0 and a normal in x-direction */ auto [stack, viewPtr] = setup::testing::setup_stack(Code::NuE, 1_GeV, nodePtr, cs); - [[maybe_unused]] setup::StackView& view = *viewPtr; + [[maybe_unused]] test::StackView& view = *viewPtr; auto particle = stack->getNextParticle(); // dummy track. Not used for calculation! diff --git a/tests/modules/testParticleCut.cpp b/tests/modules/testParticleCut.cpp index 3d3c7e666e6c29928a6880119ef267ec8cbc26c5..9915783274b1d93b7e2c2d139c778c199264c07c 100644 --- a/tests/modules/testParticleCut.cpp +++ b/tests/modules/testParticleCut.cpp @@ -18,24 +18,28 @@ #include <SetupTestStack.hpp> #include <SetupTestTrajectory.hpp> +#include <SetupTestEnvironment.hpp> #include <corsika/setup/SetupTrajectory.hpp> #include <catch2/catch.hpp> using namespace corsika; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + TEST_CASE("ParticleCut", "process,continuous,secondary") { logging::set_level(logging::level::info); feenableexcept(FE_INVALID); - using EnvType = setup::Environment; + using EnvType = DummyEnvironment; EnvType env; CoordinateSystemPtr const& rootCS = env.getCoordinateSystem(); // setup empty particle stack - setup::Stack stack; + test::Stack stack; stack.clear(); // two energies HEPEnergyType const Eabove = 1_TeV; @@ -60,7 +64,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { std::make_tuple(Code::Proton, Eabove, DirectionVector(rootCS, {1, 0, 0}), Point(rootCS, 0_m, 0_m, 0_m), 0_ns)); // view on secondary particles - setup::StackView view(particle); + test::StackView view(particle); // ref. to primary particle through the secondary view. // only this way the secondary view is populated auto projectile = view.getProjectile(); @@ -85,7 +89,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto particle = stack.addParticle(std::make_tuple( Code::Proton, Eabove, DirectionVector(rootCS, {1, 0, 0}), point0, 0_ns)); // view on secondary particles - setup::StackView view(particle); + test::StackView view(particle); // ref. to primary particle through the secondary view. // only this way the secondary view is populated auto projectile = view.getProjectile(); @@ -107,7 +111,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto particle = stack.addParticle(std::make_tuple( Code::Proton, Eabove, DirectionVector(rootCS, {1, 0, 0}), point0, 0_ns)); // view on secondary particles - setup::StackView view(particle); + test::StackView view(particle); // ref. to primary particle through the secondary view. // only this way the secondary view is populated auto projectile = view.getProjectile(); @@ -137,7 +141,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { DirectionVector(rootCS, {1, 0, 0}), point0, 0_ns)); // view on secondary particles - setup::StackView view(particle); + test::StackView view(particle); // ref. to primary particle through the secondary view. // only this way the secondary view is populated auto projectile = view.getProjectile(); @@ -180,7 +184,7 @@ TEST_CASE("ParticleCut", "process,continuous,secondary") { auto particle = stack.addParticle(std::make_tuple( Code::Proton, Eabove, DirectionVector(rootCS, {1, 0, 0}), point0, too_late)); // view on secondary particles - setup::StackView view(particle); + test::StackView view(particle); // ref. to primary particle through the secondary view. // only this way the secondary view is populated auto projectile = view.getProjectile(); diff --git a/tests/modules/testPythia8.cpp b/tests/modules/testPythia8.cpp index d54324be5dc00409defa1fc183c2f545f5263350..f1b9892a51412ca963d0636726c97a449a1e00c7 100644 --- a/tests/modules/testPythia8.cpp +++ b/tests/modules/testPythia8.cpp @@ -20,6 +20,9 @@ using namespace corsika; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + TEST_CASE("Pythia8", "modules") { logging::set_level(logging::level::info); @@ -106,7 +109,7 @@ TEST_CASE("Pythia8Interface", "modules") { SECTION("pythia decay") { HEPEnergyType const P0 = 10_GeV; auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::PiPlus, P0, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::PiPlus, P0, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); auto& stack = *stackPtr; auto& view = *secViewPtr; @@ -166,7 +169,7 @@ TEST_CASE("Pythia8Interface", "modules") { // this will be a p-p collision at sqrts=3.5TeV -> no problem for pythia auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Proton, 7_TeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::Proton, 7_TeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); auto& view = *secViewPtr; corsika::pythia8::Interaction collision; @@ -200,7 +203,7 @@ TEST_CASE("Pythia8Interface", "modules") { // this is a projectile neutron with very little energy auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Neutron, 1_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::Neutron, 1_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); auto& view = *secViewPtr; corsika::pythia8::Interaction collision; @@ -224,7 +227,7 @@ TEST_CASE("Pythia8Interface", "modules") { // resonable projectile, but tool low energy auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Proton, 1_GeV, (setup::Environment::BaseNodeType* const)nodePtr_Fe, + Code::Proton, 1_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr_Fe, *csPtr_Fe); auto& view = *secViewPtr; { [[maybe_unused]] auto const& dummy_StackPtr = stackPtr; } @@ -250,7 +253,7 @@ TEST_CASE("Pythia8Interface", "modules") { // resonable projectile, but tool low energy auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Iron, 1_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::Iron, 1_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); { [[maybe_unused]] auto const& dummy_StackPtr = stackPtr; } corsika::pythia8::Interaction collision; diff --git a/tests/modules/testQGSJetII.cpp b/tests/modules/testQGSJetII.cpp index f39fecc1f04159cb3f405a005bf03d55d3a66f27..e0676e68fd8a575d7324c67e75c20bf9bd794334 100644 --- a/tests/modules/testQGSJetII.cpp +++ b/tests/modules/testQGSJetII.cpp @@ -13,6 +13,8 @@ #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/random/RNGManager.hpp> +#include <SetupTestEnvironment.hpp> + #include <catch2/catch.hpp> #include <string> @@ -31,6 +33,9 @@ using namespace corsika; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + template <typename TStackView> auto sumCharge(TStackView const& view) { int totalCharge = 0; @@ -136,8 +141,8 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { SECTION("InteractionInterface") { auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Proton, 110_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); - setup::StackView& view = *(secViewPtr.get()); + Code::Proton, 110_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); + test::StackView& view = *(secViewPtr.get()); auto projectile = secViewPtr->getProjectile(); auto const projectileMomentum = projectile.getMomentum(); @@ -168,8 +173,8 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { MomentumVector const plab = MomentumVector(cs, {P0, 0_eV, 0_eV}); Code const pid = get_nucleus_code(60, 30); auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - pid, P0, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); - setup::StackView& view = *(secViewPtr.get()); + pid, P0, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); + test::StackView& view = *(secViewPtr.get()); HEPEnergyType const Elab = sqrt(static_pow<2>(P0) + static_pow<2>(get_mass(pid))); FourMomentum const projectileP4(Elab, plab); @@ -189,8 +194,8 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { auto [stackPtr, secViewPtr] = setup::testing::setup_stack( get_nucleus_code(1000, 1000), 1100_GeV, - (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); - setup::StackView& view = *(secViewPtr.get()); + (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); + test::StackView& view = *(secViewPtr.get()); auto projectile = secViewPtr->getProjectile(); auto const projectileMomentum = projectile.getMomentum(); @@ -213,8 +218,8 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { { // pi0 is internally converted into pi+/pi- auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Pi0, 1000_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); - [[maybe_unused]] setup::StackView& view = *(secViewPtr.get()); + Code::Pi0, 1000_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); + [[maybe_unused]] test::StackView& view = *(secViewPtr.get()); [[maybe_unused]] auto particle = stackPtr->first(); corsika::qgsjetII::InteractionModel model; model.doInteraction(view, Code::Pi0, Code::Oxygen, @@ -225,8 +230,8 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { } { // rho0 is internally converted into pi-/pi+ auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Rho0, 1000_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); - [[maybe_unused]] setup::StackView& view = *(secViewPtr.get()); + Code::Rho0, 1000_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); + [[maybe_unused]] test::StackView& view = *(secViewPtr.get()); [[maybe_unused]] auto particle = stackPtr->first(); corsika::qgsjetII::InteractionModel model; model.doInteraction(view, Code::Rho0, Code::Oxygen, @@ -237,9 +242,9 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { } { // Lambda is internally converted into neutron auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Lambda0, 100_GeV, (setup::Environment::BaseNodeType* const)nodePtr, + Code::Lambda0, 100_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); - [[maybe_unused]] setup::StackView& view = *(secViewPtr.get()); + [[maybe_unused]] test::StackView& view = *(secViewPtr.get()); [[maybe_unused]] auto particle = stackPtr->first(); corsika::qgsjetII::InteractionModel model; model.doInteraction(view, Code::Lambda0, Code::Oxygen, @@ -250,9 +255,9 @@ TEST_CASE("QgsjetIIInterface", "interaction,processes") { } { // AntiLambda is internally converted into anti neutron auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::Lambda0Bar, 1000_GeV, (setup::Environment::BaseNodeType* const)nodePtr, + Code::Lambda0Bar, 1000_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); - [[maybe_unused]] setup::StackView& view = *(secViewPtr.get()); + [[maybe_unused]] test::StackView& view = *(secViewPtr.get()); [[maybe_unused]] auto particle = stackPtr->first(); corsika::qgsjetII::InteractionModel model; model.doInteraction(view, Code::Lambda0Bar, Code::Oxygen, diff --git a/tests/modules/testSibyll.cpp b/tests/modules/testSibyll.cpp index c0e07be86cb0410a2f4f6d13b2cd55b00934cc3a..a4dbdd4a1a1c1113dc037f93b72361a3e5107460 100644 --- a/tests/modules/testSibyll.cpp +++ b/tests/modules/testSibyll.cpp @@ -15,6 +15,7 @@ #include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/utility/COMBoost.hpp> +#include <SetupTestEnvironment.hpp> #include <catch2/catch.hpp> #include <tuple> @@ -31,6 +32,9 @@ using namespace corsika; using namespace corsika::sibyll; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + TEST_CASE("Sibyll", "modules") { logging::set_level(logging::level::info); @@ -110,8 +114,8 @@ TEST_CASE("SibyllInterface", "modules") { { [[maybe_unused]] auto const& env_dummy = env; } auto [stack, viewPtr] = setup::testing::setup_stack( - Code::Proton, 10_GeV, (setup::Environment::BaseNodeType* const)nodePtr, cs); - setup::StackView& view = *viewPtr; + Code::Proton, 10_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); + test::StackView& view = *viewPtr; RNGManager<>::getInstance().registerRandomStream("sibyll"); @@ -304,8 +308,8 @@ TEST_CASE("SibyllDecayInterface", "modules") { SECTION("DecayInterface") { auto [stackPtr, viewPtr] = setup::testing::setup_stack( - Code::Lambda0, 10_GeV, (setup::Environment::BaseNodeType* const)nodePtr, cs); - setup::StackView& view = *viewPtr; + Code::Lambda0, 10_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); + test::StackView& view = *viewPtr; auto& stack = *stackPtr; auto particle = stack.first(); @@ -323,8 +327,8 @@ TEST_CASE("SibyllDecayInterface", "modules") { SECTION("DecayInterface - decay not handled") { // sibyll does not know the higgs for example auto [stackPtr, viewPtr] = setup::testing::setup_stack( - Code::H0, 10_GeV, (setup::Environment::BaseNodeType* const)nodePtr, cs); - setup::StackView& view = *viewPtr; + Code::H0, 10_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, cs); + test::StackView& view = *viewPtr; auto& stack = *stackPtr; auto particle = stack.first(); diff --git a/tests/modules/testTracking.cpp b/tests/modules/testTracking.cpp index 02de4348240275c04000b69b10aa5eff08131558..8479ccb5300ad226fa6a571a5523c8c5575428b1 100644 --- a/tests/modules/testTracking.cpp +++ b/tests/modules/testTracking.cpp @@ -24,6 +24,9 @@ using namespace corsika; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + struct NonExistingDummyObject : public IVolume { NonExistingDummyObject const& getVolume() const { return *this; } bool contains(Point const&) const { return false; } @@ -114,28 +117,28 @@ TEMPLATE_TEST_CASE("Tracking", "tracking", tracking_leapfrog_curved::Tracking, TestType tracking; Point const center(cs, {0_m, 0_m, 0_m}); - auto target = setup::Environment::createNode<Sphere>(center, radius); + auto target = DummyEnvironment::createNode<Sphere>(center, radius); // every particle should hit target_2 // it is very close to injection and not so small - auto target_2 = setup::Environment::createNode<Sphere>( + auto target_2 = DummyEnvironment::createNode<Sphere>( Point(cs, {-radius * 3 / 4, 0_m, 0_m}), radius * 0.2); // only neutral particles hit_target_neutral // this is far from injection and really small - auto target_neutral = setup::Environment::createNode<Sphere>( + auto target_neutral = DummyEnvironment::createNode<Sphere>( Point(cs, {radius / 2, 0_m, 0_m}), radius * 0.1); // target to be overlapped entirely by target_2 - auto target_2_behind = setup::Environment::createNode<Sphere>( + auto target_2_behind = DummyEnvironment::createNode<Sphere>( Point(cs, {-radius * 3 / 4, 0_m, 0_m}), radius * 0.1); // target to be overlapped partly by target_2 - auto target_2_partly_behind = setup::Environment::createNode<Sphere>( + auto target_2_partly_behind = DummyEnvironment::createNode<Sphere>( Point(cs, {-radius * 3 / 4 + radius * 0.1, 0_m, 0_m}), radius * 0.2); using MyHomogeneousModel = MediumPropertyModel< - UniformMagneticField<HomogeneousMedium<setup::EnvironmentInterface>>>; + UniformMagneticField<HomogeneousMedium<DummyEnvironmentInterface>>>; MagneticFieldVector magneticfield(cs, 0_T, 0_T, Bfield); target->setModelProperties<MyHomogeneousModel>( @@ -244,7 +247,7 @@ TEST_CASE("TrackingLeapFrogCurved") { corsika::Code PID = Code::MuPlus; using MyHomogeneousModel = MediumPropertyModel< - UniformMagneticField<HomogeneousMedium<setup::EnvironmentInterface>>>; + UniformMagneticField<HomogeneousMedium<DummyEnvironmentInterface>>>; SECTION("infinite sphere / universe") { @@ -281,7 +284,7 @@ TEST_CASE("TrackingLeapFrogCurved") { tracking_leapfrog_curved::Tracking tracking; Point const center(cs, {0_m, 0_m, 0_m}); - auto target = setup::Environment::createNode<Sphere>(center, 10_km); + auto target = DummyEnvironment::createNode<Sphere>(center, 10_km); MagneticFieldVector magneticfield(cs, 100_T, 0_T, 0_uT); target->setModelProperties<MyHomogeneousModel>( diff --git a/tests/modules/testUrQMD.cpp b/tests/modules/testUrQMD.cpp index 10f5954330887a57a09c7b4095311c99849feb31..62c285c53f75e55c1a29727d25092aa71a07113f 100644 --- a/tests/modules/testUrQMD.cpp +++ b/tests/modules/testUrQMD.cpp @@ -42,6 +42,9 @@ using namespace corsika; using namespace corsika::urqmd; +using DummyEnvironmentInterface = IMediumPropertyModel<IMagneticFieldModel<IMediumModel>>; +using DummyEnvironment = Environment<DummyEnvironmentInterface>; + template <typename TStackView> auto sumCharge(TStackView const& view) { int totalCharge = 0; @@ -120,7 +123,7 @@ TEST_CASE("UrQMD") { [[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::PiPlus, 40_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::PiPlus, 40_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); // must be assigned to variable, cannot be used as rvalue?! auto projectile = secViewPtr->getProjectile(); @@ -147,7 +150,7 @@ TEST_CASE("UrQMD") { [[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings auto [stackPtr, secViewPtr] = setup::testing::setup_stack( - Code::K0Long, 40_GeV, (setup::Environment::BaseNodeType* const)nodePtr, *csPtr); + Code::K0Long, 40_GeV, (DummyEnvironment::BaseNodeType* const)nodePtr, *csPtr); CHECK(stackPtr->getEntries() == 1); CHECK(secViewPtr->getEntries() == 0);