From 55fdf2b1fb4b411ff8362279b9bd38c74d9347f4 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Fri, 20 Nov 2020 18:54:30 +0100
Subject: [PATCH] updated to get_* in modules

---
 .../framework/core/ParticleProperties.inl     |  8 +-
 corsika/detail/modules/pythia8/Decay.inl      |  2 +-
 .../detail/modules/qgsjetII/Interaction.inl   |  7 +-
 corsika/detail/modules/sibyll/Decay.inl       |  2 +-
 corsika/detail/modules/sibyll/Interaction.inl | 73 ++++++++++---------
 .../modules/sibyll/NuclearInteraction.inl     | 10 ++-
 corsika/detail/modules/urqmd/UrQMD.inl        |  6 +-
 7 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/corsika/detail/framework/core/ParticleProperties.inl b/corsika/detail/framework/core/ParticleProperties.inl
index b8c5f3f90..17cb182cb 100644
--- a/corsika/detail/framework/core/ParticleProperties.inl
+++ b/corsika/detail/framework/core/ParticleProperties.inl
@@ -58,20 +58,20 @@ namespace corsika {
 
   int constexpr get_nucleus_A(Code const code) {
     if (code == Code::Nucleus) {
-      throw std::runtime_error("nucleus_A(Code::Nucleus) is impossible!");
+      throw std::runtime_error("get_nucleus_A(Code::Nucleus) is impossible!");
     }
     return particle::detail::nucleusA[static_cast<CodeIntType>(code)];
   }
 
   int constexpr get_nucleus_Z(Code const code) {
     if (code == Code::Nucleus) {
-      throw std::runtime_error("nucleus_Z(Code::Nucleus) is impossible!");
+      throw std::runtime_error("get_nucleus_Z(Code::Nucleus) is impossible!");
     }
     return particle::detail::nucleusZ[static_cast<CodeIntType>(code)];
   }
 
   bool constexpr is_nucleus(Code const code) {
-    return (code == Code::Nucleus) || (nucleus_A(code) != 0);
+    return (code == Code::Nucleus) || (get_nucleus_A(code) != 0);
   }
 
   inline std::ostream& operator<<(std::ostream& stream, corsika::Code const code) {
@@ -93,7 +93,7 @@ namespace corsika {
   inline HEPMassType nucleus_mass(const int A, const int Z) {
     auto const absA = std::abs(A);
     auto const absZ = std::abs(Z);
-    return mass(Code::Proton) * absZ + (absA - absZ) * mass(Code::Neutron);
+    return get_mass(Code::Proton) * absZ + (absA - absZ) * get_mass(Code::Neutron);
   }
 
 } // namespace corsika
diff --git a/corsika/detail/modules/pythia8/Decay.inl b/corsika/detail/modules/pythia8/Decay.inl
index 08f994091..c39909159 100644
--- a/corsika/detail/modules/pythia8/Decay.inl
+++ b/corsika/detail/modules/pythia8/Decay.inl
@@ -66,7 +66,7 @@ namespace corsika::pythia8 {
 
     const double gamma = E / m;
 
-    const TimeType t0 = corsika::lifetime(p.GetPID());
+    const TimeType t0 = corsika::get_lifetime(p.GetPID());
     auto const lifetime = gamma * t0;
 
     return lifetime;
diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl
index e384bcd6f..8ae1e0f8b 100644
--- a/corsika/detail/modules/qgsjetII/Interaction.inl
+++ b/corsika/detail/modules/qgsjetII/Interaction.inl
@@ -134,7 +134,7 @@ namespace corsika::qgsjetII {
       CrossSectionType weightedProdCrossSection =
           mediumComposition.WeightedSum([=](corsika::Code targetID) -> CrossSectionType {
             int targetA = 0;
-            if (corsika::is_nucleus(targetID)) targetA = corsika::nucleus_A(targetID);
+            if (corsika::is_nucleus(targetID)) targetA = corsika::get_nucleus_A(targetID);
             return GetCrossSection(corsikaBeamId, targetID, Elab, Abeam, targetA);
           });
 
@@ -217,7 +217,7 @@ namespace corsika::qgsjetII {
       for (size_t i = 0; i < compVec.size(); ++i) {
         auto const targetId = compVec[i];
         int targetA = 0;
-        if (corsika::is_nucleus(targetId)) targetA = corsika::nucleus_A(targetId);
+        if (corsika::is_nucleus(targetId)) targetA = corsika::get_nucleus_A(targetId);
         const auto sigProd =
             GetCrossSection(corsikaBeamId, targetId, projectileEnergyLab, beamA, targetA);
         cross_section_of_components[i] = sigProd;
@@ -228,7 +228,8 @@ namespace corsika::qgsjetII {
       std::cout << "Interaction: target selected: " << targetCode << std::endl;
 
       int targetQgsCode = -1;
-      if (corsika::is_nucleus(targetCode)) targetQgsCode = corsika::nucleus_A(targetCode);
+      if (corsika::is_nucleus(targetCode))
+        targetQgsCode = corsika::get_nucleus_A(targetCode);
       if (targetCode == corsika::Code::Proton) targetQgsCode = 1;
       std::cout << "Interaction: target qgsjetII code/A: " << targetQgsCode << std::endl;
       if (targetQgsCode > maxMassNumber_ || targetQgsCode < 1)
diff --git a/corsika/detail/modules/sibyll/Decay.inl b/corsika/detail/modules/sibyll/Decay.inl
index ae4e738e2..8e82b65ca 100644
--- a/corsika/detail/modules/sibyll/Decay.inl
+++ b/corsika/detail/modules/sibyll/Decay.inl
@@ -90,7 +90,7 @@ namespace corsika::sibyll {
 
     const double gamma = E / m;
 
-    const TimeType t0 = corsika::lifetime(vP.GetPID());
+    const TimeType t0 = corsika::get_lifetime(vP.GetPID());
     auto const lifetime = gamma * t0;
 
     const auto mkin =
diff --git a/corsika/detail/modules/sibyll/Interaction.inl b/corsika/detail/modules/sibyll/Interaction.inl
index cbd8b9f3a..d6ce573d3 100644
--- a/corsika/detail/modules/sibyll/Interaction.inl
+++ b/corsika/detail/modules/sibyll/Interaction.inl
@@ -76,8 +76,7 @@ namespace corsika::sibyll {
   }
 
   tuple<corsika::CrossSectionType, corsika::CrossSectionType>
-  Interaction::GetCrossSection(const corsika::Code BeamId,
-                               const corsika::Code TargetId,
+  Interaction::GetCrossSection(const corsika::Code BeamId, const corsika::Code TargetId,
                                const corsika::HEPEnergyType CoMenergy) const {
     double sigProd, sigEla, dummy, dum1, dum3, dum4;
     double dumdif[3];
@@ -88,7 +87,7 @@ namespace corsika::sibyll {
     }
     const double dEcm = CoMenergy / 1_GeV;
     if (corsika::is_nucleus(TargetId)) {
-      const int iTarget = corsika::nucleus_A(TargetId);
+      const int iTarget = corsika::get_nucleus_A(TargetId);
       if (iTarget > maxTargetMassNumber_ || iTarget == 0)
         throw std::runtime_error(
             "Sibyll target outside range. Only nuclei with A<18 are allowed.");
@@ -103,10 +102,8 @@ namespace corsika::sibyll {
     return std::make_tuple(sigProd * 1_mb, sigEla * 1_mb);
   }
 
-
   template <>
-  corsika::GrammageType Interaction::GetInteractionLength(
-      SetupParticle const& vP) const {
+  corsika::GrammageType Interaction::GetInteractionLength(SetupParticle const& vP) const {
 
     // coordinate system, get global frame of reference
     CoordinateSystem& rootCS =
@@ -132,9 +129,9 @@ namespace corsika::sibyll {
         (Elab + pTotLabNorm) * (Elab - pTotLabNorm)); // binomial for numerical accuracy
 
     std::cout << "Interaction: LambdaInt: \n"
-         << " input energy: " << vP.GetEnergy() / 1_GeV << std::endl
-         << " beam can interact:" << kInteraction << std::endl
-         << " beam pid:" << vP.GetPID() << std::endl;
+              << " input energy: " << vP.GetEnergy() / 1_GeV << std::endl
+              << " beam can interact:" << kInteraction << std::endl
+              << " beam pid:" << vP.GetPID() << std::endl;
 
     // TODO: move limits into variables
     // FR: removed && Elab >= 8.5_GeV
@@ -157,15 +154,15 @@ namespace corsika::sibyll {
           });
 
       std::cout << "Interaction: "
-           << "IntLength: weighted CrossSection (mb): " << weightedProdCrossSection / 1_mb
-           << std::endl;
+                << "IntLength: weighted CrossSection (mb): "
+                << weightedProdCrossSection / 1_mb << std::endl;
 
       // calculate interaction length in medium
       GrammageType const int_length = mediumComposition.GetAverageMassNumber() *
                                       constants::u / weightedProdCrossSection;
       std::cout << "Interaction: "
-           << "interaction length (g/cm2): " << int_length / (0.001_kg) * 1_cm * 1_cm
-           << std::endl;
+                << "interaction length (g/cm2): " << int_length / (0.001_kg) * 1_cm * 1_cm
+                << std::endl;
 
       return int_length;
     }
@@ -183,8 +180,8 @@ namespace corsika::sibyll {
 
     const auto corsikaBeamId = vP.GetPID();
     std::cout << "ProcessSibyll: "
-         << "DoInteraction: " << corsikaBeamId << " interaction? "
-         << corsika::sibyll::CanInteract(corsikaBeamId) << std::endl;
+              << "DoInteraction: " << corsikaBeamId << " interaction? "
+              << corsika::sibyll::CanInteract(corsikaBeamId) << std::endl;
 
     if (corsika::is_nucleus(corsikaBeamId)) {
       // nuclei handled by different process, this should not happen
@@ -211,10 +208,11 @@ namespace corsika::sibyll {
       auto const pProjectileLab = vP.GetMomentum();
 
       std::cout << "Interaction: ebeam lab: " << eProjectileLab / 1_GeV << std::endl
-           << "Interaction: pbeam lab: " << pProjectileLab.GetComponents() / 1_GeV
-           << std::endl;
+                << "Interaction: pbeam lab: " << pProjectileLab.GetComponents() / 1_GeV
+                << std::endl;
       std::cout << "Interaction: etarget lab: " << eTargetLab / 1_GeV << std::endl
-           << "Interaction: ptarget lab: " << pTargetLab.GetComponents() / 1_GeV << std::endl;
+                << "Interaction: ptarget lab: " << pTargetLab.GetComponents() / 1_GeV
+                << std::endl;
 
       const FourVector PprojLab(eProjectileLab, pProjectileLab);
 
@@ -231,15 +229,16 @@ namespace corsika::sibyll {
       auto const PtargCoM = boost.toCoM(PtargLab);
 
       std::cout << "Interaction: ebeam CoM: " << PprojCoM.GetTimeLikeComponent() / 1_GeV
-           << std::endl
-           << "Interaction: pbeam CoM: "
-           << PprojCoM.GetSpaceLikeComponents().GetComponents() / 1_GeV << std::endl;
+                << std::endl
+                << "Interaction: pbeam CoM: "
+                << PprojCoM.GetSpaceLikeComponents().GetComponents() / 1_GeV << std::endl;
       std::cout << "Interaction: etarget CoM: " << PtargCoM.GetTimeLikeComponent() / 1_GeV
-           << std::endl
-           << "Interaction: ptarget CoM: "
-           << PtargCoM.GetSpaceLikeComponents().GetComponents() / 1_GeV << std::endl;
+                << std::endl
+                << "Interaction: ptarget CoM: "
+                << PtargCoM.GetSpaceLikeComponents().GetComponents() / 1_GeV << std::endl;
 
-      std::cout << "Interaction: position of interaction: " << pOrig.GetCoordinates() << std::endl;
+      std::cout << "Interaction: position of interaction: " << pOrig.GetCoordinates()
+                << std::endl;
       std::cout << "Interaction: time: " << tOrig << std::endl;
 
       HEPEnergyType Etot = eProjectileLab + eTargetLab;
@@ -276,7 +275,7 @@ namespace corsika::sibyll {
         allowed air in atmosphere also contains some Argon.
       */
       int targetSibCode = -1;
-      if (is_nucleus(targetCode)) targetSibCode = nucleus_A(targetCode);
+      if (is_nucleus(targetCode)) targetSibCode = get_nucleus_A(targetCode);
       if (targetCode == corsika::Code::Proton) targetSibCode = 1;
       std::cout << "Interaction: sibyll code: " << targetSibCode << std::endl;
       if (targetSibCode > maxTargetMassNumber_ || targetSibCode < 1)
@@ -288,22 +287,23 @@ namespace corsika::sibyll {
       const int kBeam = corsika::sibyll::ConvertToSibyllRaw(corsikaBeamId);
 
       std::cout << "Interaction: "
-           << " DoInteraction: E(GeV):" << eProjectileLab / 1_GeV
-           << " Ecm(GeV): " << Ecm / 1_GeV << std::endl;
+                << " DoInteraction: E(GeV):" << eProjectileLab / 1_GeV
+                << " Ecm(GeV): " << Ecm / 1_GeV << std::endl;
       if (Ecm > GetMaxEnergyCoM())
         throw std::runtime_error("Interaction::DoInteraction: CoM energy too high!");
       // FR: removed eProjectileLab < 8.5_GeV ||
       if (Ecm < GetMinEnergyCoM()) {
         std::cout << "Interaction: "
-             << " DoInteraction: should have dropped particle.. "
-             << "THIS IS AN ERROR" << std::endl;
+                  << " DoInteraction: should have dropped particle.. "
+                  << "THIS IS AN ERROR" << std::endl;
         throw std::runtime_error("energy too low for SIBYLL");
       } else {
         count_++;
         // Sibyll does not know about units..
         const double sqs = Ecm / 1_GeV;
         // running sibyll, filling stack
-        std::cout << "kBeam " << kBeam << " targetSibCode " << targetSibCode << " sqs " << sqs << std::endl;
+        std::cout << "kBeam " << kBeam << " targetSibCode " << targetSibCode << " sqs "
+                  << sqs << std::endl;
         sibyll_(kBeam, targetSibCode, sqs);
         if (internalDecays_) {
           // corsika that decay internally will never appear on the corsika stack
@@ -338,8 +338,8 @@ namespace corsika::sibyll {
 
           // add to corsika stack
           auto pnew = vP.AddSecondary(
-          std::tuple<corsika::Code, corsika::HEPEnergyType, corsika::MomentumVector,
-                    corsika::Point, corsika::TimeType>{
+              std::tuple<corsika::Code, corsika::HEPEnergyType, corsika::MomentumVector,
+                         corsika::Point, corsika::TimeType>{
                   corsika::sibyll::ConvertFromSibyll(psib.GetPID()),
                   Plab.GetTimeLikeComponent(), Plab.GetSpaceLikeComponents(), pOrig,
                   tOrig});
@@ -348,9 +348,10 @@ namespace corsika::sibyll {
           Elab_final += pnew.GetEnergy();
           Ecm_final += psib.GetEnergy();
         }
-        std::cout << "conservation (all GeV): Ecm_final=" << Ecm_final / 1_GeV << std::endl
-             << "Elab_final=" << Elab_final / 1_GeV
-             << ", Plab_final=" << (Plab_final / 1_GeV).GetComponents() << std::endl;
+        std::cout << "conservation (all GeV): Ecm_final=" << Ecm_final / 1_GeV
+                  << std::endl
+                  << "Elab_final=" << Elab_final / 1_GeV
+                  << ", Plab_final=" << (Plab_final / 1_GeV).GetComponents() << std::endl;
       }
     }
     return corsika::EProcessReturn::eOk;
diff --git a/corsika/detail/modules/sibyll/NuclearInteraction.inl b/corsika/detail/modules/sibyll/NuclearInteraction.inl
index 37daa68f3..7c9e74b5a 100644
--- a/corsika/detail/modules/sibyll/NuclearInteraction.inl
+++ b/corsika/detail/modules/sibyll/NuclearInteraction.inl
@@ -50,7 +50,7 @@ namespace corsika::sibyll {
     for (unsigned int i = 0; i < GetNEnergyBins(); ++i) {
       std::cout << " " << i << "  ";
       for (auto& n : pNuclei) {
-        auto const j = corsika::nucleus_A(n);
+        auto const j = corsika::get_nucleus_A(n);
         std::cout << " " << std::setprecision(5) << std::setw(8)
                   << cnucsignuc_.sigma[j - 1][k][i];
       }
@@ -85,7 +85,7 @@ namespace corsika::sibyll {
     for (auto& ptarg : allElementsInUniverse) {
       ++k;
       std::cout << "NuclearInteraction: init target component: " << ptarg << std::endl;
-      const int ib = corsika::nucleus_A(ptarg);
+      const int ib = corsika::get_nucleus_A(ptarg);
       if (!hadronicInteraction_.IsValidTarget(ptarg)) {
         std::cout
             << "NuclearInteraction::InitializeNuclearCrossSections: target nucleus? id="
@@ -445,8 +445,10 @@ namespace corsika::sibyll {
       allowed air in atmosphere also contains some Argon.
     */
     int kATarget = -1;
-    if (corsika::is_nucleus(targetCode)) kATarget = corsika::nucleus_A(targetCode);
-    else if (targetCode == corsika::Code::Proton) kATarget = 1;
+    if (corsika::is_nucleus(targetCode))
+      kATarget = corsika::get_nucleus_A(targetCode);
+    else if (targetCode == corsika::Code::Proton)
+      kATarget = 1;
     std::cout << "NuclearInteraction: nuclib target code: " << kATarget << std::endl;
     if (!hadronicInteraction_.IsValidTarget(targetCode))
       throw std::runtime_error("target outside range. ");
diff --git a/corsika/detail/modules/urqmd/UrQMD.inl b/corsika/detail/modules/urqmd/UrQMD.inl
index 3539f0f30..d5ced9b50 100644
--- a/corsika/detail/modules/urqmd/UrQMD.inl
+++ b/corsika/detail/modules/urqmd/UrQMD.inl
@@ -59,7 +59,7 @@ namespace corsika::urqmd {
       return ::urqmd::sigtot_(one, two, sqrtS) * 1_mb;
     } else {
       int const Ap = vAProjectile;
-      int const At = is_nucleus(vTargetCode) ? corsika::nucleus_A(vTargetCode) : 1;
+      int const At = is_nucleus(vTargetCode) ? corsika::get_nucleus_A(vTargetCode) : 1;
 
       double const maxImpact = ::urqmd::nucrad_(Ap) + ::urqmd::nucrad_(At) +
                                2 * ::urqmd::options_.CTParam[30 - 1];
@@ -147,8 +147,8 @@ namespace corsika::urqmd {
     });
 
     auto const targetCode = mediumComposition.SampleTarget(componentCrossSections, fRNG);
-    auto const targetA = corsika::nucleus_A(targetCode);
-    auto const targetZ = corsika::nucleus_Z(targetCode);
+    auto const targetA = corsika::get_nucleus_A(targetCode);
+    auto const targetZ = corsika::get_nucleus_Z(targetCode);
 
     ::urqmd::inputs_.nevents = 1;
     ::urqmd::sys_.eos = 0; // could be configurable in principle
-- 
GitLab