From 8a073279b3f92a468b93a0f299be3a78036e943d Mon Sep 17 00:00:00 2001
From: Jean-Marco Alameddine <jean-marco.alameddine@tu-dortmund.de>
Date: Wed, 30 Mar 2022 12:42:19 +0200
Subject: [PATCH] Put projectile back on stack if no stochastic interaction is
 possible for the current energy

---
 corsika/detail/modules/proposal/Interaction.inl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/corsika/detail/modules/proposal/Interaction.inl b/corsika/detail/modules/proposal/Interaction.inl
index 72d406cc9..062aebe19 100644
--- a/corsika/detail/modules/proposal/Interaction.inl
+++ b/corsika/detail/modules/proposal/Interaction.inl
@@ -68,9 +68,13 @@ namespace corsika::proposal {
       auto [type, target_hash, v] = std::get<eINTERACTION>(c->second)->SampleLoss(
           projectile.getEnergy() / 1_MeV, rates, distr(RNG_));
 
-      // TODO: Is this case necessary?
-      // In this case, the original particle should not be altered and put back on the stack
+      // TODO: This should become obsolete as soon #482 is fixed
       if (type == PROPOSAL::InteractionType::Undefined) {
+        CORSIKA_LOG_WARN(
+            "PROPOSAL: No particle interaction possible. "
+            "Put initial particle back on stack.");
+        view.addSecondary(std::make_tuple(projectileId, projectile.getEnergy(),
+                                          projectile.getDirection()));
         return ProcessReturn::Ok;
       }
 
-- 
GitLab