IAP GITLAB

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

removed redundant isNucleus array

parent e3db1b1d
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ namespace corsika::particles {
corsika::units::si::ElectricChargeType constexpr GetCharge(Code const p) {
if (p == Code::Nucleus)
throw std::runtime_error("Cannot GetCharge() of particle::Nucleus -> unspecified");
return GetChargeNumber(p) * (corsika::units::constants::e);
return GetChargeNumber(p) * corsika::units::constants::e;
}
constexpr std::string const& GetName(Code const p) {
......@@ -131,11 +131,13 @@ namespace corsika::particles {
return detail::nucleusZ[static_cast<CodeIntType>(p)];
}
bool constexpr IsNucleus(Code const p) { return GetNucleusA(p) != 0; }
/**
* the output operator for particles
* the output operator for humand-readable particle codes
**/
std::ostream& operator<<(std::ostream& stream, corsika::particles::Code const p);
std::ostream& operator<<(std::ostream&, corsika::particles::Code);
Code ConvertFromPDG(PDGCode);
......
......@@ -369,38 +369,23 @@ def gen_properties(particle_db):
### nuclear data ###
# is nucleus flag
string += "static constexpr std::array<bool, size> isNucleus = {\n"
for p in particle_db.values():
value = 'false'
if p['isNucleus']:
value = 'true'
string += " {val},\n".format(val = value)
string += "};\n"
# nucleus mass number A
string += "static constexpr std::array<int16_t, size> nucleusA = {\n"
for p in particle_db.values():
A = 0
if p['isNucleus']:
A = p['A']
A = p.get('A', 0)
string += " {val},\n".format(val = A)
string += "};\n"
# nucleus charge number Z
string += "static constexpr std::array<int16_t, size> nucleusZ = {\n"
for p in particle_db.values():
Z = 0
if p['isNucleus']:
Z = p['Z']
Z = p.get('Z', 0)
string += " {val},\n".format(val = Z)
string += "};\n"
return string
###############################################################
#
# return string with a list of classes for 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