IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 635ee0b1 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

new get_name() function for printing nuclear A,Z

parent 49513970
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,14 @@ namespace corsika {
return particle::detail::names[static_cast<CodeIntType>(code)];
}
inline std::string get_name(Code code, full_name) {
if (is_nucleus(code)) {
return fmt::format("nucleus ({},{})", get_nucleus_A(code), get_nucleus_Z(code));
}
return std::string{get_name(code)};
}
inline TimeType constexpr get_lifetime(Code const p) {
return particle::detail::lifetime[static_cast<CodeIntType>(p)] * second;
}
......
......@@ -108,6 +108,7 @@ namespace corsika {
namespace corsika {
// forward declarations to be used in GeneratedParticleProperties
struct full_name {}; //!< tag class for get_name()
int16_t constexpr get_charge_number(Code const); //!< electric charge in units of e
ElectricChargeType constexpr get_charge(Code const); //!< electric charge
......@@ -146,7 +147,9 @@ namespace corsika {
PDGCode constexpr get_PDG(Code const);
PDGCode constexpr get_PDG(unsigned int const A, unsigned int const Z);
std::string_view constexpr get_name(Code const); //!< name of the particle as string
TimeType constexpr get_lifetime(Code const); //!< lifetime
std::string get_name(Code,
full_name); //!< get name of particle, including (A,Z) for nuclei
TimeType constexpr get_lifetime(Code const); //!< lifetime
bool constexpr is_hadron(Code const); //!< true if particle is hadron
bool constexpr is_em(Code const); //!< true if particle is electron, positron or photon
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment