From 3a4cbccf15d917ea79f392ed25e343eac1e88b45 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Wed, 15 Mar 2023 15:02:31 +0100
Subject: [PATCH] exporting symbols in release build; use momentum instead of
 Elab

---
 corsika/detail/modules/fluka/InteractionModel.inl | 14 ++++++--------
 modules/fluka/fluka.cpp                           | 10 +++++-----
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/corsika/detail/modules/fluka/InteractionModel.inl b/corsika/detail/modules/fluka/InteractionModel.inl
index a095a3740..801d8ff4b 100644
--- a/corsika/detail/modules/fluka/InteractionModel.inl
+++ b/corsika/detail/modules/fluka/InteractionModel.inl
@@ -92,17 +92,16 @@ namespace corsika::fluka {
     FourMomentum const projectileLab4mom = targetRestBoost.toCoM(projectileP4);
     HEPEnergyType const Elab = projectileLab4mom.getTimeLikeComponent();
     auto constexpr invGeV = 1 / 1_GeV;
-    double const EkinLab = (Elab - get_mass(projectileId)) * invGeV;
     double const labMomentum =
         projectileLab4mom.getSpaceLikeComponents().getNorm() * invGeV;
 
     auto const plab = projectileLab4mom.getSpaceLikeComponents();
 
     CORSIKA_LOGGER_DEBUG(logger_, fmt::format("Elab = {} GeV", Elab * invGeV));
-    CORSIKA_LOGGER_DEBUG(logger_, fmt::format("EkinLab = {} GeV", EkinLab * invGeV));
 
-    CrossSectionType const xs = ::fluka::sgmxyz_(&flukaCodeProj, &flukaMaterial, &EkinLab,
-                                                 &labMomentum, &iflxyz_) *
+    double const dummyEkin = 0;
+    CrossSectionType const xs = ::fluka::sgmxyz_(&flukaCodeProj, &flukaMaterial,
+                                                 &dummyEkin, &labMomentum, &iflxyz_) *
                                 1_mb;
     return xs;
   }
@@ -129,18 +128,17 @@ namespace corsika::fluka {
 
     COMBoost const targetRestBoost{targetP4.getSpaceLikeComponents(), get_mass(targetId)};
     FourMomentum const projectileLab4mom = targetRestBoost.toCoM(projectileP4);
-    HEPEnergyType const Elab = projectileLab4mom.getTimeLikeComponent();
     auto constexpr invGeV = 1 / 1_GeV;
-    double const EkinLab = (Elab - get_mass(projectileId)) * invGeV;
 
     auto const plab = projectileLab4mom.getSpaceLikeComponents();
     auto const& cs = plab.getCoordinateSystem();
     auto const labMomentum = plab.getNorm();
-    double const labMomentumGeV = labMomentum * invGeV * 0;
+    double const labMomentumGeV = labMomentum * invGeV;
 
     auto const direction = (plab / labMomentum).getComponents().getEigenVector();
 
-    ::fluka::evtxyz_(&flukaCodeProj, &flukaMaterial, &EkinLab, &labMomentumGeV,
+    double const dummyEkin = 0;
+    ::fluka::evtxyz_(&flukaCodeProj, &flukaMaterial, &dummyEkin, &labMomentumGeV,
                      &direction[0], &direction[1], &direction[2], &iflxyz_, cumsgx_.get(),
                      cumsgx_.get() + materials_.size(),
                      cumsgx_.get() + materials_.size() * 2);
diff --git a/modules/fluka/fluka.cpp b/modules/fluka/fluka.cpp
index 3c0599620..985bde38b 100644
--- a/modules/fluka/fluka.cpp
+++ b/modules/fluka/fluka.cpp
@@ -22,11 +22,11 @@ namespace fluka {
    * won't get dropped from the final file during linking.
    */
 
-  [[maybe_unused]] auto* const hepevt_ptr = &hepevt_;
-  [[maybe_unused]] auto* const stpxyc_ptr = &stpxyz_;
-  [[maybe_unused]] auto* const evtxyz_ptr = &evtxyz_;
-  [[maybe_unused]] auto* const sgmxyz_ptr = &sgmxyz_;
-  [[maybe_unused]] auto* const ndmhep_ptr = &ndmhep_;
+  [[maybe_unused]] extern auto* const hepevt_ptr = &hepevt_;
+  [[maybe_unused]] extern auto* const stpxyc_ptr = &stpxyz_;
+  [[maybe_unused]] extern auto* const evtxyz_ptr = &evtxyz_;
+  [[maybe_unused]] extern auto* const sgmxyz_ptr = &sgmxyz_;
+  [[maybe_unused]] extern auto* const ndmhep_ptr = &ndmhep_;
   }
 
 } // namespace fluka
-- 
GitLab