IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 63d562a0 authored by ralfulrich's avatar ralfulrich
Browse files

const

parent 831f9b29
No related branches found
No related tags found
No related merge requests found
......@@ -53,15 +53,15 @@ namespace corsika {
return particle::detail::isHadron[static_cast<CodeIntType>(p)];
}
inline bool constexpr is_em(Code c) {
inline bool constexpr is_em(Code const c) {
return c == Code::Electron || c == Code::Positron || c == Code::Gamma;
}
inline bool constexpr is_muon(Code c) {
inline bool constexpr is_muon(Code const c) {
return c == Code::MuPlus || c == Code::MuMinus;
}
inline bool constexpr is_neutrino(Code c) {
inline bool constexpr is_neutrino(Code const c) {
return c == Code::NuE || c == Code::NuMu || c == Code::NuTau || c == Code::NuEBar ||
c == Code::NuMuBar || c == Code::NuTauBar;
}
......@@ -88,7 +88,7 @@ namespace corsika {
return stream << get_name(code);
}
inline Code convert_from_PDG(PDGCode p) {
inline Code convert_from_PDG(PDGCode const p) {
static_assert(particle::detail::conversionArray.size() % 2 == 1);
// this will fail, for the strange case where the maxPDG is negative...
int constexpr maxPDG{(particle::detail::conversionArray.size() - 1) >> 1};
......
......@@ -48,9 +48,9 @@ namespace corsika {
using PDGCodeType = std::underlying_type<PDGCode>::type;
// forward declarations to be used in GeneratedParticleProperties
int16_t constexpr get_charge_number(Code); //!< electric charge in units of e
ElectricChargeType constexpr get_charge(Code); //!< electric charge
HEPMassType constexpr get_mass(Code); //!< mass
int16_t constexpr get_charge_number(Code const); //!< electric charge in units of e
ElectricChargeType constexpr get_charge(Code const); //!< electric charge
HEPMassType constexpr get_mass(Code const); //!< mass
HEPEnergyType constexpr get_energy_threshold(
Code const); //!< get energy threshold below which the particle is discarded, by
//!< default set to particle mass
......@@ -67,24 +67,24 @@ namespace corsika {
}
//! Particle code according to PDG, "Monte Carlo Particle Numbering Scheme"
PDGCode constexpr get_PDG(Code);
std::string_view constexpr get_name(Code); //!< name of the particle as string
TimeType constexpr get_lifetime(Code); //!< lifetime
PDGCode constexpr get_PDG(Code const);
std::string_view constexpr get_name(Code const); //!< name of the particle as string
TimeType constexpr get_lifetime(Code const); //!< lifetime
//! true iff the particle is a hard-coded nucleus or Code::Nucleus
bool constexpr is_nucleus(Code);
bool constexpr is_hadron(Code); //!< true iff particle is hadron
bool constexpr is_em(Code); //!< true iff particle is electron, positron or gamma
bool constexpr is_muon(Code); //!< true iff particle is mu+ or mu-
bool constexpr is_neutrino(Code); //!< true iff particle is (anti-) neutrino
int constexpr get_nucleus_A(Code); //!< returns A for hard-coded nucleus, otherwise 0
int constexpr get_nucleus_Z(Code); //!< returns Z for hard-coded nucleus, otherwise 0
bool constexpr is_nucleus(Code const);
bool constexpr is_hadron(Code const); //!< true iff particle is hadron
bool constexpr is_em(Code const); //!< true iff particle is electron, positron or gamma
bool constexpr is_muon(Code const); //!< true iff particle is mu+ or mu-
bool constexpr is_neutrino(Code const); //!< true iff particle is (anti-) neutrino
int constexpr get_nucleus_A(Code const); //!< returns A for hard-coded nucleus, otherwise 0
int constexpr get_nucleus_Z(Code const); //!< returns Z for hard-coded nucleus, otherwise 0
//! returns mass of (A,Z) nucleus, disregarding binding energy
HEPMassType get_nucleus_mass(unsigned int const, unsigned int const);
//! convert PDG code to CORSIKA 8 internal code
Code convert_from_PDG(PDGCode);
Code convert_from_PDG(PDGCode const);
std::initializer_list<Code> constexpr get_all_particles();
......
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