From 67a3c8892e8c45683c05858251a37cc35090f813 Mon Sep 17 00:00:00 2001
From: Felix Riehn <felix@matilda>
Date: Wed, 18 Jan 2023 13:08:23 +0100
Subject: [PATCH] photon always projectile

---
 corsika/detail/modules/sophia/InteractionModel.inl | 11 ++++-------
 tests/modules/testSophia.cpp                       |  5 -----
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/corsika/detail/modules/sophia/InteractionModel.inl b/corsika/detail/modules/sophia/InteractionModel.inl
index 27c623b9c..f43754142 100644
--- a/corsika/detail/modules/sophia/InteractionModel.inl
+++ b/corsika/detail/modules/sophia/InteractionModel.inl
@@ -70,16 +70,13 @@ namespace corsika::sophia {
       throw std::runtime_error("SOPHIA: Invalid target/projectile/energy combination");
     }
 
-    auto const nucleonId = (projectileId == Code::Photon ? targetId : projectileId);
-    auto const nucleonP4 = (projectileId == Code::Photon ? targetP4 : projectileP4);
-    auto const photonP4 = (projectileId == Code::Photon ? projectileP4 : targetP4);
     COMBoost const boost(projectileP4, targetP4);
 
-    int nucleonSophiaCode = convertToSophiaRaw(nucleonId); // either proton or neutron
+    int nucleonSophiaCode = convertToSophiaRaw(targetId); // either proton or neutron
     // initialize resonance spectrum
     initial_(nucleonSophiaCode);
-    double Enucleon = nucleonP4.getTimeLikeComponent() / 1_GeV;
-    double Ephoton = photonP4.getTimeLikeComponent() / 1_GeV;
+    double Enucleon = targetP4.getTimeLikeComponent() / 1_GeV;
+    double Ephoton = projectileP4.getTimeLikeComponent() / 1_GeV;
     double theta = 0.0; // set nucleon at rest in collision
     int Imode = -1;     // overwritten inside SOPHIA
     CORSIKA_LOGGER_DEBUG(logger_,
@@ -96,7 +93,7 @@ namespace corsika::sophia {
 
     auto const& originalCS = boost.getOriginalCS();
     // SOPHIA has photon along -z  and nucleon along +z (GZK calc..)
-    COMBoost const boostInternal(nucleonP4, photonP4);
+    COMBoost const boostInternal(targetP4, projectileP4);
     auto const& csPrime = boost.getRotatedCS();
     CoordinateSystemPtr csPrimePrime =
         make_rotation(csPrime, QuantityVector<length_d>{1_m, 0_m, 0_m}, M_PI);
diff --git a/tests/modules/testSophia.cpp b/tests/modules/testSophia.cpp
index fc843e653..da8bc633b 100644
--- a/tests/modules/testSophia.cpp
+++ b/tests/modules/testSophia.cpp
@@ -62,11 +62,6 @@ TEST_CASE("Sophia", "modules") {
     CHECK_FALSE(corsika::sophia::canInteract(Code::Helium));
   }
 
-  // SECTION("cross-section type") {
-  //   CHECK(corsika::sophia::getSophiaXSCode(Code::Proton) == 1);
-  //   CHECK(corsika::sophia::getSophiaXSCode(Code::Electron) == 0);
-  // }
-
   SECTION("sophia mass") {
     CHECK_FALSE(corsika::sophia::getSophiaMass(Code::Electron) == 0_GeV);
     // Nucleus not a particle
-- 
GitLab