IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 6fb12887 authored by ralfulrich's avatar ralfulrich
Browse files

fixed failing tests

parent 9d7f4bf5
No related branches found
No related tags found
No related merge requests found
...@@ -22,18 +22,19 @@ ...@@ -22,18 +22,19 @@
#include <corsika/geometry/Sphere.h> #include <corsika/geometry/Sphere.h>
#include <corsika/logging/Logging.h> #include <corsika/logging/Logging.h>
#include <corsika/process/ProcessSequence.h> #include <corsika/process/ProcessSequence.h>
#include <corsika/process/SwitchProcessSequence.h>
#include <corsika/process/StackProcess.h> #include <corsika/process/StackProcess.h>
#include <corsika/process/conex_source_cut/CONEXSourceCut.h>
#include <corsika/process/energy_loss/EnergyLoss.h> #include <corsika/process/energy_loss/EnergyLoss.h>
#include <corsika/process/longitudinal_profile/LongitudinalProfile.h> #include <corsika/process/longitudinal_profile/LongitudinalProfile.h>
#include <corsika/process/observation_plane/ObservationPlane.h> #include <corsika/process/observation_plane/ObservationPlane.h>
#include <corsika/process/on_shell_check/OnShellCheck.h> #include <corsika/process/on_shell_check/OnShellCheck.h>
#include <corsika/process/energy_loss/EnergyLoss.h>
#include <corsika/process/particle_cut/ParticleCut.h> #include <corsika/process/particle_cut/ParticleCut.h>
#include <corsika/process/pythia/Decay.h> #include <corsika/process/pythia/Decay.h>
#include <corsika/process/sibyll/Decay.h> #include <corsika/process/sibyll/Decay.h>
#include <corsika/process/sibyll/Interaction.h> #include <corsika/process/sibyll/Interaction.h>
#include <corsika/process/sibyll/NuclearInteraction.h> #include <corsika/process/sibyll/NuclearInteraction.h>
#include <corsika/process/switch_process/SwitchProcess.h>
#include <corsika/process/conex_source_cut/CONEXSourceCut.h>
#include <corsika/process/tracking_line/TrackingLine.h> #include <corsika/process/tracking_line/TrackingLine.h>
#include <corsika/process/urqmd/UrQMD.h> #include <corsika/process/urqmd/UrQMD.h>
#include <corsika/random/RNGManager.h> #include <corsika/random/RNGManager.h>
...@@ -73,16 +74,17 @@ void registerRandomStreams(const int seed) { ...@@ -73,16 +74,17 @@ void registerRandomStreams(const int seed) {
} }
template <typename T> template <typename T>
using MyExtraEnv = environment::MediumPropertyModel<environment::UniformMagneticField<T>>; using MEnv = environment::UniformMediumType<environment::UniformMagneticField<T>>;
int main(int argc, char** argv) { int main(int argc, char** argv) {
logging::SetLevel(logging::level::info); logging::SetLevel(logging::level::info);
C8LOG_INFO("hybrid_MC"); C8LOG_INFO("vertical_EAS");
if (argc < 4) { if (argc < 4) {
std::cerr << "usage: hybrid_MC <A> <Z> <energy/GeV> [seed]" << std::endl; std::cerr << "usage: vertical_EAS <A> <Z> <energy/GeV> [seed]" << std::endl;
std::cerr << " if no seed is given, a random seed is chosen" << std::endl; std::cerr << " if no seed is given, a random seed is chosen" << std::endl;
return 1; return 1;
} }
...@@ -98,20 +100,26 @@ int main(int argc, char** argv) { ...@@ -98,20 +100,26 @@ int main(int argc, char** argv) {
EnvType env; EnvType env;
const CoordinateSystem& rootCS = env.GetCoordinateSystem(); const CoordinateSystem& rootCS = env.GetCoordinateSystem();
Point const center{rootCS, 0_m, 0_m, 0_m}; Point const center{rootCS, 0_m, 0_m, 0_m};
auto builder = environment::make_layered_spherical_atmosphere_builder< environment::LayeredSphericalAtmosphereBuilder<setup::EnvironmentInterface> builder{center};
setup::EnvironmentInterface,
MyExtraEnv>::create(center, units::constants::EarthRadius::Mean,
environment::Medium::AirDry1Atm,
geometry::Vector{rootCS, 0_T, 0_T, 1_T});
builder.setNuclearComposition( builder.setNuclearComposition(
{{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);
// setup particle stack, and add primary particle // setup particle stack, and add primary particle
...@@ -223,23 +231,14 @@ int main(int argc, char** argv) { ...@@ -223,23 +231,14 @@ int main(int argc, char** argv) {
process::interaction_counter::InteractionCounter urqmdCounted{urqmd}; process::interaction_counter::InteractionCounter urqmdCounted{urqmd};
// assemble all processes into an ordered process list // assemble all processes into an ordered process list
struct EnergySwitch {
HEPEnergyType cutE_; auto sibyllSequence = sibyllNucCounted << sibyllCounted;
EnergySwitch(HEPEnergyType cutE) process::switch_process::SwitchProcess switchProcess(urqmdCounted, sibyllSequence,
: cutE_(cutE) {} 55_GeV);
process::SwitchResult operator()(const setup::Stack::ParticleType& p) { auto decaySequence = decayPythia << decaySibyll;
if (p.GetEnergy() < cutE_)
return process::SwitchResult::First; auto sequence = switchProcess << reset_particle_mass << decaySequence
else << eLoss << cut << conex << longprof << observationLevel;
return process::SwitchResult::Second;
}
};
auto hadronSequence =
process::select(urqmdCounted, process::sequence(sibyllNucCounted, sibyllCounted),
EnergySwitch(55_GeV));
auto decaySequence = process::sequence(decayPythia, decaySibyll);
auto sequence = process::sequence(hadronSequence, reset_particle_mass, decaySequence,
eLoss, cut, conex, longprof, observationLevel);
// define air shower object, run simulation // define air shower object, run simulation
tracking_line::TrackingLine tracking; tracking_line::TrackingLine tracking;
...@@ -252,21 +251,22 @@ int main(int argc, char** argv) { ...@@ -252,21 +251,22 @@ int main(int argc, char** argv) {
EAS.Run(); EAS.Run();
cut.ShowResults(); cut.ShowResults();
eLoss.showResults(); //eLoss.ShowResults();
observationLevel.ShowResults(); observationLevel.ShowResults();
const HEPEnergyType Efinal = cut.GetCutEnergy() + cut.GetInvEnergy() + const HEPEnergyType Efinal = cut.GetCutEnergy() + cut.GetInvEnergy() +
cut.GetEmEnergy() + eLoss.energyLost() + cut.GetEmEnergy() + //eLoss.GetEnergyLost() +
observationLevel.GetEnergyGround(); observationLevel.GetEnergyGround();
cout << "total cut energy (GeV): " << Efinal / 1_GeV << endl cout << "total cut energy (GeV): " << Efinal / 1_GeV << endl
<< "relative difference (%): " << (Efinal / E0 - 1) * 100 << endl; << "relative difference (%): " << (Efinal / E0 - 1) * 100 << endl;
observationLevel.Reset(); observationLevel.Reset();
cut.Reset(); cut.Reset();
eLoss.reset(); //eLoss.Reset();
//conex.addParticle(0, E0, 0_eV, emPosition, momentum.normalized(), 0_s);
conex.SolveCE(); conex.SolveCE();
auto const hists = sibyllCounted.GetHistogram() + sibyllNucCounted.GetHistogram() + auto const hists = sibyllCounted.GetHistogram() + sibyllNucCounted.GetHistogram() +
urqmdCounted.GetHistogram(); urqmdCounted.GetHistogram();
hists.saveLab("inthist_lab.txt"); hists.saveLab("inthist_lab.txt");
hists.saveCMS("inthist_cms.txt"); hists.saveCMS("inthist_cms.txt");
......
...@@ -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(*secViewPtr); [[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 / 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