IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 356354fe authored by Felix Riehn's avatar Felix Riehn Committed by Maximilian Reininghaus
Browse files

fixed sampling

parent a0178551
No related branches found
No related tags found
1 merge request!465Resolve "SOPHIA for low energy photo-hadronic interaction"
...@@ -91,13 +91,15 @@ namespace corsika::proposal { ...@@ -91,13 +91,15 @@ namespace corsika::proposal {
"LE photo-hadronic interaction! implemented via SOPHIA " "LE photo-hadronic interaction! implemented via SOPHIA "
"assuming a single nucleon as target"); "assuming a single nucleon as target");
// sample nucleon from nucleus A,Z // sample nucleon from nucleus A,Z
double const fProtons = get_nucleus_Z(targetId) / get_nucleus_A(targetId); double const fProtons = get_nucleus_Z(targetId) / double(get_nucleus_A(targetId));
double const fNeutrons = 1. - fProtons; double const fNeutrons = 1. - fProtons;
std::discrete_distribution<int> nucleonChannelDist{fProtons, fNeutrons}; std::discrete_distribution<int> nucleonChannelDist{fProtons, fNeutrons};
static corsika::default_prng_type& rng = corsika::default_prng_type& rng =
corsika::RNGManager<>::getInstance().getRandomStream("proposal"); corsika::RNGManager<>::getInstance().getRandomStream("proposal");
Code const nucleonId = (nucleonChannelDist(rng) ? Code::Proton : Code::Neutron); Code const nucleonId = (nucleonChannelDist(rng) ? Code::Neutron : Code::Proton);
CORSIKA_LOGGER_DEBUG(logger_, "selected {} as target nucleon", nucleonId); CORSIKA_LOGGER_DEBUG(logger_,
"selected {} as target nucleon (f_proton, f_neutron)={},{}",
nucleonId, fProtons, fNeutrons);
if (!leHadronicInteraction_.isValid(Code::Photon, nucleonId, sqrtSNN)) { if (!leHadronicInteraction_.isValid(Code::Photon, nucleonId, sqrtSNN)) {
CORSIKA_LOGGER_WARN( CORSIKA_LOGGER_WARN(
......
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