From 264f62196558946742fdeb732ce2dfd8c3b00856 Mon Sep 17 00:00:00 2001
From: Jean-Marco Alameddine <jean-marco.alameddine@tu-dortmund.de>
Date: Wed, 2 Feb 2022 16:52:36 +0100
Subject: [PATCH] Update PROPOSAL to most recent version

---
 conanfile.txt                                   |  2 +-
 corsika/detail/modules/proposal/Interaction.inl | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/conanfile.txt b/conanfile.txt
index d2928fbcb..514f5d0a7 100644
--- a/conanfile.txt
+++ b/conanfile.txt
@@ -4,7 +4,7 @@ catch2/2.13.8
 eigen/3.3.8
 boost/1.76.0
 zlib/1.2.11
-proposal/7.0.5
+proposal/7.2.1
 yaml-cpp/0.6.3
 arrow/2.0.0
 cli11/1.9.1
diff --git a/corsika/detail/modules/proposal/Interaction.inl b/corsika/detail/modules/proposal/Interaction.inl
index 9b2e23138..72d406cc9 100644
--- a/corsika/detail/modules/proposal/Interaction.inl
+++ b/corsika/detail/modules/proposal/Interaction.inl
@@ -68,6 +68,12 @@ 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
+      if (type == PROPOSAL::InteractionType::Undefined) {
+        return ProcessReturn::Ok;
+      }
+
       // Read how much random numbers are required to calculate the secondaries.
       // Calculate the secondaries and deploy them on the corsika stack.
       auto rnd = std::vector<double>(
@@ -86,7 +92,9 @@ namespace corsika::proposal {
       auto loss = PROPOSAL::StochasticLoss(
           static_cast<int>(type), v * projectile.getEnergy() / 1_MeV, point, direction,
           projectile.getTime() / 1_s, 0., projectile.getEnergy() / 1_MeV);
-      auto target = PROPOSAL::Component::component_map->operator[](target_hash);
+      PROPOSAL::Component target;
+      if (type != PROPOSAL::InteractionType::Ioniz)
+        target = PROPOSAL::Component::GetComponentForHash(target_hash);
       auto sec =
           std::get<eSECONDARIES>(c->second)->CalculateSecondaries(loss, target, rnd);
       for (auto& s : sec) {
-- 
GitLab