diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc index 9167ffcd5aafd01f047c046dd093b7928fcc0ad8..7a9ede7166b73de4c1cd41ad4c5104a77e0469df 100644 --- a/Documentation/Examples/cascade_example.cc +++ b/Documentation/Examples/cascade_example.cc @@ -223,7 +223,7 @@ int main() { // setup processes, decays and interactions tracking_line::TrackingLine<setup::Stack> tracking(env); stack_inspector::StackInspector<setup::Stack> p0(true); - corsika::process::sibyll::Interaction sibyll; + corsika::process::sibyll::Interaction sibyll(env); corsika::process::sibyll::Decay decay; ProcessCut cut(8_GeV); corsika::process::TrackWriter::TrackWriter trackWriter("tracks.dat"); diff --git a/Processes/Sibyll/CMakeLists.txt b/Processes/Sibyll/CMakeLists.txt index ab8f9b3e094a42b00a63899442774d6b42c1b1f7..bf89db756b5aaca2be901596c1015b5d724245e7 100644 --- a/Processes/Sibyll/CMakeLists.txt +++ b/Processes/Sibyll/CMakeLists.txt @@ -69,6 +69,7 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty CORSIKAgeometry + CORSIKAenvironment ) target_include_directories ( diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h index fef98eb924f2a0a2d537766eebc3cfa309742aa1..8595e05ee5331d9ecdbc41282f2b508415c2b884 100644 --- a/Processes/Sibyll/Interaction.h +++ b/Processes/Sibyll/Interaction.h @@ -21,6 +21,7 @@ #include <corsika/particles/ParticleProperties.h> #include <corsika/random/RNGManager.h> #include <corsika/units/PhysicalUnits.h> +#include <corsika/environment/Environment.h> namespace corsika::process::sibyll { @@ -28,9 +29,8 @@ namespace corsika::process::sibyll { int fCount = 0; int fNucCount = 0; - public: - Interaction() {} + Interaction(corsika::environment::Environment const& env) : fEnvironment(env) { } ~Interaction() { std::cout << "Sibyll::Interaction n=" << fCount << " Nnuc=" << fNucCount << std::endl; @@ -337,6 +337,10 @@ namespace corsika::process::sibyll { } return process::EProcessReturn::eOk; } + + private: + corsika::environment::Environment const& fEnvironment; + }; } // namespace corsika::process::sibyll diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 8c171cdce00edf619cd0fbd968d3495233ca66f9..7d818d6983cc2bba32272262480a917126e47cc0 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -18,6 +18,10 @@ #include <corsika/geometry/Point.h> #include <corsika/units/PhysicalUnits.h> +#include <corsika/environment/Environment.h> +#include <corsika/environment/HomogeneousMedium.h> +#include <corsika/environment/NuclearComposition.h> + #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one // cpp file #include <catch2/catch.hpp> @@ -79,20 +83,39 @@ using namespace corsika::units; TEST_CASE("SibyllInterface", "[processes]") { - auto const& cs = - geometry::RootCoordinateSystem::GetInstance().GetRootCoordinateSystem(); + // setup environment, geometry + corsika::environment::Environment env; + auto& universe = *(env.GetUniverse()); + + auto theMedium = corsika::environment::Environment::CreateNode<geometry::Sphere>( + geometry::Point{env.GetCoordinateSystem(), 0_m, 0_m, 0_m}, + 1_km * std::numeric_limits<double>::infinity()); + + using MyHomogeneousModel = + corsika::environment::HomogeneousMedium<corsika::environment::IMediumModel>; + theMedium->SetModelProperties<MyHomogeneousModel>( + 1_kg / (1_m * 1_m * 1_m), + corsika::environment::NuclearComposition( + std::vector<corsika::particles::Code>{corsika::particles::Code::Oxygen}, + std::vector<float>{1.})); + + universe.AddChild(std::move(theMedium)); + + const geometry::CoordinateSystem& cs = env.GetCoordinateSystem(); + geometry::Point const origin(cs, {0_m, 0_m, 0_m}); geometry::Vector<corsika::units::si::SpeedType::dimension_type> v( cs, 0_m / second, 0_m / second, 1_m / second); geometry::Line line(origin, v); geometry::Trajectory<geometry::Line> track(line, 10_s); + SECTION("InteractionInterface") { setup::Stack stack; auto particle = stack.NewParticle(); - Interaction model; + Interaction model(env); model.Init(); [[maybe_unused]] const process::EProcessReturn ret =