From 26da741b4f47e29269ca619e2770f7cd4438221f Mon Sep 17 00:00:00 2001 From: Felix Riehn <felix@matilda> Date: Sun, 30 Dec 2018 19:12:50 +0000 Subject: [PATCH] removed conversion map added ifs --- Processes/Sibyll/Interaction.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h index cce83551..68171003 100644 --- a/Processes/Sibyll/Interaction.h +++ b/Processes/Sibyll/Interaction.h @@ -244,12 +244,9 @@ namespace corsika::process::sibyll { const auto mediumComposition = currentNode->GetModelProperties().GetNuclearComposition(); // get cross sections and nucleon number for target materials std::vector<si::CrossSectionType> cross_section_components; - // conversion map for target code, should be in ParticleConversion.h - std::map<corsika::particles::Code,int> corsika2sibyll_target_code; for(auto targetId: mediumComposition.GetComponents() ){ const auto [sigProd, nNuc] = GetCrossSection( corsikaBeamId, targetId, Ecm); cross_section_components.push_back( sigProd ); - corsika2sibyll_target_code.insert( std::pair<corsika::particles::Code,int>(targetId , nNuc)) ; } // this routine could be moved to the environment as GetTarget( std::vector<si::CrossSectionType> ) @@ -277,8 +274,20 @@ namespace corsika::process::sibyll { }; const auto targetCode = sample_target( mediumComposition, cross_section_components ); cout << "Interaction: target selected: " << targetCode << endl; - const auto targetSibCode = corsika2sibyll_target_code.at( targetCode ); + /* + FOR NOW: allow nuclei with A<18 or protons only. + when medium composition becomes more complex, approximations will have to be allowed + air in atmosphere also contains some Argon. + */ + int targetSibCode = -1; + if( IsNucleus(targetCode)) + targetSibCode = GetNucleusA( targetCode ); + if( targetCode == corsika::particles::Proton::GetCode()) + targetSibCode = 1; cout << "Interaction: sibyll code: " << targetSibCode << endl; + if(targetSibCode>18||targetSibCode<1) + throw std::runtime_error("Sibyll target outside range. Only nuclei with A<18 or protons are allowed."); + /* get transformation between Stack-frame and SibStack-frame for EAS Stack-frame is lab. frame, could be different for CRMC-mode -- GitLab