IAP GITLAB

Skip to content
Snippets Groups Projects
Commit d529421a authored by Jean-Marco Alameddine's avatar Jean-Marco Alameddine Committed by Maximilian Reininghaus
Browse files

Adapt `ProcessSequence` so that if cx_select and cx_sum are zero, we don't...

Adapt `ProcessSequence` so that if cx_select and cx_sum are zero, we don't select any interaction instead of the first one.

Adapt `Cascade`. In case a discrete interaction has been selected, it will only delete the initial particle from the stack
if `interaction` or `decay` have actually returned that they have called an interaction process or a decay process.
If this is not the case, which means we did not call `doInteract` or `doDecay`, we will keep the particle on the stack.
parent ac005310
No related branches found
No related tags found
1 merge request!507Add two tests dealing with 0_mb cross sections in Cascade and ProcessSequence
......@@ -299,15 +299,20 @@ namespace corsika {
FourMomentum const projectileP4Post{particle.getEnergy(), particle.getMomentum()};
bool eraseParticle =
false; // only erase original particle if it decayed or interacted
if (distance_interact < distance_decay) {
CrossSectionType const total_cx_post = composition.getWeightedSum(xs_function);
interaction(secondaries, projectileP4Post, composition, total_cx_post);
eraseParticle = isInteracted(
interaction(secondaries, projectileP4Post, composition, total_cx_post));
} else {
[[maybe_unused]] auto projectile = secondaries.getProjectile();
InverseTimeType const total_inv_lifetime_post =
sequence_.getInverseLifetime(particle);
if (decay(secondaries, total_inv_lifetime_post) == ProcessReturn::Decayed) {
eraseParticle = true;
if (secondaries.getSize() == 1 &&
projectile.getPID() == secondaries.getNextParticle().getPID()) {
throw std::runtime_error(fmt::format("Particle {} decays into itself!",
......@@ -317,7 +322,7 @@ namespace corsika {
}
sequence_.doSecondaries(secondaries);
particle.erase();
if (eraseParticle) particle.erase();
}
template <typename TTracking, typename TProcessList, typename TOutput, typename TStack>
......
......@@ -508,7 +508,7 @@ namespace corsika {
}
// check if we should execute THIS process and then EXIT
if (cx_select <= cx_sum) {
if (cx_select < cx_sum) {
if constexpr (has_signature_cx1) {
// now also sample targetId from weighted cross sections
......@@ -594,7 +594,7 @@ namespace corsika {
}
// check if we should execute THIS process and then EXIT
if (cx_select <= cx_sum) {
if (cx_select < cx_sum) {
if constexpr (has_signature_cx1) {
......
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