From e4dca00660c53aac595bd848e2e634162c8a51e7 Mon Sep 17 00:00:00 2001
From: Felix Riehn <felix@matilda>
Date: Fri, 7 Jun 2019 09:48:49 +0100
Subject: [PATCH] removed IsNucleus from projectile test in nuclear interaction

---
 Processes/Sibyll/NuclearInteraction.cc | 28 ++++++++++++--------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/Processes/Sibyll/NuclearInteraction.cc b/Processes/Sibyll/NuclearInteraction.cc
index be970455f..057c07d2a 100644
--- a/Processes/Sibyll/NuclearInteraction.cc
+++ b/Processes/Sibyll/NuclearInteraction.cc
@@ -227,15 +227,20 @@ namespace corsika::process::sibyll {
         RootCoordinateSystem::GetInstance().GetRootCoordinateSystem();
 
     const particles::Code corsikaBeamId = vP.GetPID();
-    if (!particles::IsNucleus(corsikaBeamId)) {
-      // no nuclear interaction
-      return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm);
+
+    if (corsikaBeamId != particles::Code::Nucleus) {
+      // check if target-style nucleus (enum), these are not allowed as projectile
+      if (particles::IsNucleus(corsikaBeamId))
+        throw std::runtime_error(
+            "NuclearInteraction: GetInteractionLength: Wrong nucleus type. Nuclear "
+            "projectiles should use NuclearStackExtension!");
+      else {
+        // no nuclear interaction
+        cout << "NuclearInteraction::GetInteractionLength: non nuclear projectile: "
+             << corsikaBeamId << " set interaction length to inf" << endl;
+        return std::numeric_limits<double>::infinity() * 1_g / (1_cm * 1_cm);
+      }
     }
-    // check if target-style nucleus (enum)
-    if (corsikaBeamId != particles::Code::Nucleus)
-      throw std::runtime_error(
-          "NuclearInteraction: GetInteractionLength: Wrong nucleus type. Nuclear "
-          "projectiles should use NuclearStackExtension!");
 
     // read from cross section code table
 
@@ -333,13 +338,6 @@ namespace corsika::process::sibyll {
     //      const auto ProjMass = vP.GetMass();
     cout << "NuclearInteraction: DoInteraction: called with:" << ProjId << endl;
 
-    if (!IsNucleus(ProjId)) {
-      cout << "WARNING: non nuclear projectile in NUCLIB!" << endl;
-      // this should not happen
-      // throw std::runtime_error("Non nuclear projectile in NUCLIB!");
-      return process::EProcessReturn::eOk;
-    }
-
     // check if target-style nucleus (enum)
     if (ProjId != particles::Code::Nucleus)
       throw std::runtime_error(
-- 
GitLab