From fd5189c9957066b492ff676122e926d47f5fdf54 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Thu, 19 Nov 2020 16:51:51 +0100
Subject: [PATCH] replaced usage of particle properties functions by constants

---
 corsika/detail/modules/energy_loss/BetheBlochPDG.inl | 2 +-
 corsika/detail/modules/qgsjetII/Interaction.inl      | 4 ++--
 corsika/framework/core/ParticleProperties.hpp        | 7 ++++---
 tests/modules/testPythia8.cpp                        | 4 ++--
 tests/modules/testQGSJetII.cpp                       | 2 +-
 tests/modules/testSibyll.cpp                         | 6 +++---
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl
index a1f36ea07..add5d8bcd 100644
--- a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl
+++ b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl
@@ -70,7 +70,7 @@ namespace corsika::energy_loss {
     double const gamma = E / m;
     int const Z = p.GetChargeNumber();
     int const Z2 = Z * Z;
-    HEPMassType constexpr me = corsika::Electron::mass();
+    HEPMassType constexpr me = corsika::Electron::mass;
     auto const m2 = m * m;
     auto constexpr me2 = me * me;
     double const gamma2 = gamma * gamma;
diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl
index 0f5a55591..2acf1e55d 100644
--- a/corsika/detail/modules/qgsjetII/Interaction.inl
+++ b/corsika/detail/modules/qgsjetII/Interaction.inl
@@ -291,8 +291,8 @@ namespace corsika::qgsjetII {
             auto momentum = corsika::Vector(
                 zAxisFrame, corsika::QuantityVector<hepmomentum_d>{
                                 0.0_GeV, 0.0_GeV,
-                                sqrt((projectileEnergyLab + corsika::Proton::mass()) *
-                                     (projectileEnergyLab - corsika::Proton::mass()))});
+                                sqrt((projectileEnergyLab + corsika::Proton::mass) *
+                                     (projectileEnergyLab - corsika::Proton::mass))});
 
             auto const energy =
                 sqrt(momentum.squaredNorm() + square(corsika::mass(idFragm)));
diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp
index 041424e79..a6ef84a7c 100644
--- a/corsika/framework/core/ParticleProperties.hpp
+++ b/corsika/framework/core/ParticleProperties.hpp
@@ -7,7 +7,7 @@
  */
 
 /**
-   @file Particles.h
+   @file ParticleProperties.hpp
 
    Interface to particle properties
  */
@@ -56,8 +56,9 @@ namespace corsika {
   bool constexpr is_neutrino(Code); //!< true iff particle is (anti-) neutrino
   int constexpr nucleus_A(Code);    //!< returns A for hard-coded nucleus, otherwise 0
   int constexpr nucleus_Z(Code);    //!< returns Z for hard-coded nucleus, otherwise 0
-  inline HEPMassType nucleus_mass(
-      int, int); //! returns mass of (A,Z) nucleus, disregarding binding energy
+
+  //! returns mass of (A,Z) nucleus, disregarding binding energy
+  inline HEPMassType nucleus_mass(int, int);
 } // namespace corsika
 
 // data arrays, etc.
diff --git a/tests/modules/testPythia8.cpp b/tests/modules/testPythia8.cpp
index ea0f3c4c6..59eb2d1d6 100644
--- a/tests/modules/testPythia8.cpp
+++ b/tests/modules/testPythia8.cpp
@@ -111,7 +111,7 @@ TEST_CASE("pythia process") {
     setup::Stack stack;
     const HEPEnergyType E0 = 10_GeV;
     HEPMomentumType P0 =
-        sqrt(E0 * E0 - corsika::PiPlus::mass() * corsika::PiPlus::mass());
+        sqrt(E0 * E0 - corsika::PiPlus::mass * corsika::PiPlus::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
     auto particle = stack.AddParticle(
@@ -139,7 +139,7 @@ TEST_CASE("pythia process") {
     setup::Stack stack;
     const HEPEnergyType E0 = 100_GeV;
     HEPMomentumType P0 =
-        sqrt(E0 * E0 - corsika::PiPlus::mass() * corsika::PiPlus::mass());
+        sqrt(E0 * E0 - corsika::PiPlus::mass * corsika::PiPlus::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
     auto particle = stack.AddParticle(
diff --git a/tests/modules/testQGSJetII.cpp b/tests/modules/testQGSJetII.cpp
index e145b73d1..d138930d8 100644
--- a/tests/modules/testQGSJetII.cpp
+++ b/tests/modules/testQGSJetII.cpp
@@ -95,7 +95,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
     setup::Stack stack;
     const HEPEnergyType E0 = 100_GeV;
     HEPMomentumType P0 =
-        sqrt(E0 * E0 - corsika::Proton::mass() * corsika::Proton::mass());
+        sqrt(E0 * E0 - corsika::Proton::mass * corsika::Proton::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
     auto particle = stack.AddParticle(
diff --git a/tests/modules/testSibyll.cpp b/tests/modules/testSibyll.cpp
index c6666ab41..4c49aabf9 100644
--- a/tests/modules/testSibyll.cpp
+++ b/tests/modules/testSibyll.cpp
@@ -101,7 +101,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
 
     corsika::setup::Stack stack;
     const HEPEnergyType E0 = 100_GeV;
-    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass() * Proton::mass());
+    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass * Proton::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
     auto particle = stack.AddParticle(
@@ -123,7 +123,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
 
     setup::Stack stack;
     const HEPEnergyType E0 = 400_GeV;
-    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass() * Proton::mass());
+    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass * Proton::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
 
@@ -147,7 +147,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
 
     setup::Stack stack;
     const HEPEnergyType E0 = 10_GeV;
-    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass() * Proton::mass());
+    HEPMomentumType P0 = sqrt(E0 * E0 - Proton::mass * Proton::mass);
     auto plab = corsika::MomentumVector(cs, {0_GeV, 0_GeV, -P0});
     corsika::Point pos(cs, 0_m, 0_m, 0_m);
     auto particle = stack.AddParticle(
-- 
GitLab