IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 9d7f4bf5 authored by ralfulrich's avatar ralfulrich
Browse files

use new setupEnvironment and setupStack everywhere

parent 50b12aae
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <corsika/environment/LayeredSphericalAtmosphereBuilder.h> #include <corsika/environment/LayeredSphericalAtmosphereBuilder.h>
#include <corsika/environment/MediumPropertyModel.h> #include <corsika/environment/MediumPropertyModel.h>
#include <corsika/environment/UniformMagneticField.h> #include <corsika/environment/UniformMagneticField.h>
#include <corsika/environment/UniformMediumType.h>
#include <corsika/geometry/Point.h> #include <corsika/geometry/Point.h>
#include <corsika/geometry/RootCoordinateSystem.h> #include <corsika/geometry/RootCoordinateSystem.h>
...@@ -62,11 +63,20 @@ TEST_CASE("CONEXSourceCut") { ...@@ -62,11 +63,20 @@ TEST_CASE("CONEXSourceCut") {
{{particles::Code::Nitrogen, particles::Code::Oxygen}, {{particles::Code::Nitrogen, particles::Code::Oxygen},
{0.7847f, 1.f - 0.7847f}}); // values taken from AIRES manual, Ar removed for now {0.7847f, 1.f - 0.7847f}}); // values taken from AIRES manual, Ar removed for now
builder.addExponentialLayer(1222.6562_g / (1_cm * 1_cm), 994186.38_cm, 4_km); builder.addExponentialLayer<MEnv>(1222.6562_g / (1_cm * 1_cm), 994186.38_cm, 4_km,
builder.addExponentialLayer(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km); environment::EMediumType::eAir,
builder.addExponentialLayer(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km); geometry::Vector(rootCS, 0_T, 0_T, 1_T));
builder.addExponentialLayer(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km); builder.addExponentialLayer<MEnv>(1144.9069_g / (1_cm * 1_cm), 878153.55_cm, 10_km,
builder.addLinearLayer(1e9_cm, 112.8_km); environment::EMediumType::eAir,
geometry::Vector(rootCS, 0_T, 0_T, 1_T));
builder.addExponentialLayer<MEnv>(1305.5948_g / (1_cm * 1_cm), 636143.04_cm, 40_km,
environment::EMediumType::eAir,
geometry::Vector(rootCS, 0_T, 0_T, 1_T));
builder.addExponentialLayer<MEnv>(540.1778_g / (1_cm * 1_cm), 772170.16_cm, 100_km,
environment::EMediumType::eAir,
geometry::Vector(rootCS, 0_T, 0_T, 1_T));
builder.addLinearLayer<MEnv>(1e9_cm, 112.8_km, environment::EMediumType::eAir,
geometry::Vector(rootCS, 0_T, 0_T, 1_T));
builder.assemble(env); builder.assemble(env);
......
/*
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <catch2/catch.hpp>
#include <corsika/process/null_model/NullModel.h>
#include <corsika/geometry/Point.h>
#include <corsika/geometry/RootCoordinateSystem.h>
#include <corsika/geometry/Vector.h>
#include <corsika/units/PhysicalUnits.h>
#include <corsika/setup/SetupStack.h>
#include <corsika/setup/SetupTrajectory.h>
using namespace corsika::units::si;
using namespace corsika::process::null_model;
using namespace corsika;
TEST_CASE("NullModel", "[processes]") {
auto [env, csPtr, nodePtr] = setup::testing::setupEnvironment(particles::Code::Oxygen);
auto const& cs = *csPtr;
[[maybe_unused]] auto const& env_dummy = env;
[[maybe_unused]] auto const& node_dummy = nodePtr;
auto [stack, view] = setup::testing::setupStack(particles::Code::Electron, 0,0, 100_GeV, nodePtr, cs);
[[maybe_unused]] const auto& dummyView = view;
auto particle = stack->first();
geometry::Point const origin(cs, {0_m, 0_m, 0_m});
geometry::Vector<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("interface") {
NullModel model(10_m);
[[maybe_unused]] const process::EProcessReturn ret =
model.DoContinuous(particle, track);
LengthType const length = model.MaxStepLength(particle, track);
CHECK((length / 10_m) == Approx(1));
}
}
...@@ -137,7 +137,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") { ...@@ -137,7 +137,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
Interaction model; Interaction model;
[[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(view); [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(*secViewPtr);
[[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle);
CHECK(length / (1_g / square(1_cm)) == Approx(93.04).margin(0.1)); CHECK(length / (1_g / square(1_cm)) == Approx(93.04).margin(0.1));
......
...@@ -115,8 +115,8 @@ TEST_CASE("SibyllInterface", "[processes]") { ...@@ -115,8 +115,8 @@ TEST_CASE("SibyllInterface", "[processes]") {
Interaction model; Interaction model;
[[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(view); [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(*view);
auto const pSum = sumMomentum(view, cs); auto const pSum = sumMomentum(*view, cs);
/* /*
Interactions between hadrons (h) and nuclei (A) in Sibyll are treated in the Interactions between hadrons (h) and nuclei (A) in Sibyll are treated in the
...@@ -195,7 +195,7 @@ TEST_CASE("SibyllInterface", "[processes]") { ...@@ -195,7 +195,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
Interaction hmodel; Interaction hmodel;
NuclearInteraction model(hmodel, *env); NuclearInteraction model(hmodel, *env);
[[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(view); [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(*view);
[[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle); [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle);
CHECK(length / 1_g * 1_cm * 1_cm == Approx(44.2).margin(.1)); CHECK(length / 1_g * 1_cm * 1_cm == Approx(44.2).margin(.1));
CHECK(view.getSize() == 11); CHECK(view.getSize() == 11);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment