From 761248fd43040ca57dc534931c90f869410b1377 Mon Sep 17 00:00:00 2001 From: Felix Riehn <felix@matilda> Date: Thu, 13 May 2021 18:42:20 +0100 Subject: [PATCH] use conversion in interaction --- corsika/detail/modules/epos/Interaction.inl | 24 ++++++++++++++++----- corsika/modules/epos/Interaction.hpp | 4 ++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/corsika/detail/modules/epos/Interaction.inl b/corsika/detail/modules/epos/Interaction.inl index b0257cbee..c3053ba3c 100644 --- a/corsika/detail/modules/epos/Interaction.inl +++ b/corsika/detail/modules/epos/Interaction.inl @@ -263,15 +263,29 @@ namespace corsika::epos { // ::epos::nucl1_.laproj = projectile.get_nucleus_Z(); // Z // ::epos::nucl1_.maproj = projectile.get_nucleus_A();; // A // } else { - ::epos::hadr25_.idprojin = 1120 ; // id "NEXUS code" + ::epos::hadr25_.idprojin = convertToEposRaw(corsikaBeamId); //1120 ; // id "NEXUS code" ::epos::nucl1_.laproj = -1; // Z (-1 for hadron) ::epos::nucl1_.maproj = 1; // A //} + // target - //if(is_nucleus(targetCode)){ - ::epos::hadr25_.idtargin = 1120; // id "NEXUS code" - ::epos::nucl1_.latarg = 1; // Z (-1 with id 1220 for neutron) - ::epos::nucl1_.matarg = 1; // A + int targetMassNumber = 1; // proton + if (is_nucleus(targetCode)) { // nucleus + targetMassNumber = get_nucleus_A(targetCode); + if (targetMassNumber > maxTargetMassNumber_) + throw std::runtime_error("Epos target mass outside range."); + } else { + if (targetCode != Proton::code || targetCode != Neutron::code) + throw std::runtime_error("Epos target not possible."); + // proton or neutron target + ::epos::hadr25_.idtargin = convertToEposRaw(targetCode); + if (targetCode == Proton::code) + ::epos::nucl1_.latarg = 1; // Z + else + ::epos::nucl1_.latarg = -1; // Z (-1 with id 1220 for neutron) + ::epos::nucl1_.matarg = 1; // A + } + CORSIKA_LOG_DEBUG("Interaction: target epos code/A: {}", targetMassNumber); // hadron-nucleon momentum ::epos::hadr1_.pnll = float(200); diff --git a/corsika/modules/epos/Interaction.hpp b/corsika/modules/epos/Interaction.hpp index 9505e6145..61cdc6b2e 100644 --- a/corsika/modules/epos/Interaction.hpp +++ b/corsika/modules/epos/Interaction.hpp @@ -55,8 +55,8 @@ namespace corsika::epos { default_prng_type& RNG_ = RNGManager::getInstance().getRandomStream("epos"); HEPEnergyType const minEnergyCoM_ = -10. * 1e9 * electronvolt; HEPEnergyType const maxEnergyCoM_ = -1.e6 * 1e9 * electronvolt; - int const maxTargetMassNumber_ = -1; - int const minNuclearTargetA_ = -10; + int const maxTargetMassNumber_ = 20; + int const minNuclearTargetA_ = 4; }; } // namespace corsika::epos -- GitLab