From ed7de18ce36c60613b8116659edd316705d6ea80 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Fri, 18 Jun 2021 14:42:10 +0200
Subject: [PATCH] added pdg codes for nuclei

---
 corsika/detail/framework/core/ParticleProperties.inl | 4 ++++
 corsika/framework/core/ParticleProperties.hpp        | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/corsika/detail/framework/core/ParticleProperties.inl b/corsika/detail/framework/core/ParticleProperties.inl
index d385ad5b9..7339a81ee 100644
--- a/corsika/detail/framework/core/ParticleProperties.inl
+++ b/corsika/detail/framework/core/ParticleProperties.inl
@@ -32,6 +32,10 @@ namespace corsika {
     return particle::detail::pdg_codes[static_cast<CodeIntType>(p)];
   }
 
+  inline PDGCode constexpr get_PDG(unsigned int A, unsigned int Z) {
+    return static_cast<PDGCode>(1000000000 + Z * 10000 + A + 10); // 10LZZZAAAI
+  }
+
   inline int16_t constexpr get_charge_number(Code const code) {
     if (code == Code::Nucleus)
       throw std::runtime_error("charge of particle::Nucleus undefined");
diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp
index 6ec30d748..d81312565 100644
--- a/corsika/framework/core/ParticleProperties.hpp
+++ b/corsika/framework/core/ParticleProperties.hpp
@@ -88,6 +88,8 @@ namespace corsika {
 
   //! Particle code according to PDG, "Monte Carlo Particle Numbering Scheme"
   PDGCode constexpr get_PDG(Code const);
+  PDGCode constexpr get_PDG(unsigned int A, unsigned int Z);
+  
   std::string_view constexpr get_name(Code const); //!< name of the particle as string
   TimeType constexpr get_lifetime(Code const);     //!< lifetime
 
-- 
GitLab