diff --git a/Framework/Particles/ParticleProperties.h b/Framework/Particles/ParticleProperties.h index 4bb3cda140f4b5c986d004a3c8c48fc3533deb53..d4edb3f63c62759c6f9d5ab95b0fa0cf9deeaa99 100644 --- a/Framework/Particles/ParticleProperties.h +++ b/Framework/Particles/ParticleProperties.h @@ -47,7 +47,7 @@ namespace corsika::particles { // forward declarations to be used in GeneratedParticleProperties int16_t constexpr GetElectricChargeNumber(Code const); corsika::units::si::ElectricChargeType constexpr GetElectricCharge(Code const); - corsika::units::si::MassType constexpr GetMass(Code const); + corsika::units::hep::MassType constexpr GetMass(Code const); PDGCodeType constexpr GetPDG(Code const); constexpr std::string const& GetName(Code const); corsika::units::si::TimeType constexpr GetLifetime(Code const); @@ -57,7 +57,7 @@ namespace corsika::particles { /*! * returns mass of particle */ - corsika::units::si::MassType constexpr GetMass(Code const p) { + corsika::units::hep::MassType constexpr GetMass(Code const p) { return masses[static_cast<CodeIntType const>(p)]; } diff --git a/Framework/Particles/pdxml_reader.py b/Framework/Particles/pdxml_reader.py index 39aaddd310dfeb51969660a7c17bcabdf9c6eb87..aa77d0c5a4e954f713c4cac0aeb938bcf00d8bff 100755 --- a/Framework/Particles/pdxml_reader.py +++ b/Framework/Particles/pdxml_reader.py @@ -231,9 +231,9 @@ def gen_properties(pythia_db): string += "\n" # particle masses table - string += "static constexpr std::array<corsika::units::si::MassType const, size> masses = {\n" + string += "static constexpr std::array<corsika::units::hep::MassType const, size> masses = {\n" for p in pythia_db.values(): - string += " {mass:f} * (1e9 * corsika::units::si::constants::eV / corsika::units::si::constants::cSquared), // {name:s}\n".format(mass = p['mass'], name = p['name']) + string += " {mass:f} * (1e9 * corsika::units::si::constants::eV), // {name:s}\n".format(mass = p['mass'], name = p['name']) string += "};\n\n" # PDG code table @@ -295,7 +295,7 @@ def gen_classes(pythia_db): string += "/** @class " + cname + "\n\n" string += " * Particle properties are taken from the PYTHIA8 ParticleData.xml file:<br>\n" string += " * - pdg=" + str(pythia_db[cname]['pdg']) +"\n" - string += " * - mass=" + str(pythia_db[cname]['mass']) + " GeV/c2 \n" + string += " * - mass=" + str(pythia_db[cname]['mass']) + " GeV \n" string += " * - charge= " + str(pythia_db[cname]['electric_charge']/3) + " \n" string += " * - name=" + str(cname) + "\n" string += " * - anti=" + str(antiP) + "\n" @@ -303,7 +303,7 @@ def gen_classes(pythia_db): string += "class " + cname + " {\n" string += " public:\n" string += " static constexpr Code GetCode() { return Type; }\n" - string += " static constexpr corsika::units::si::MassType GetMass() { return corsika::particles::GetMass(Type); }\n" + string += " static constexpr corsika::units::hep::MassType GetMass() { return corsika::particles::GetMass(Type); }\n" string += " static constexpr corsika::units::si::ElectricChargeType GetCharge() { return corsika::particles::GetElectricCharge(Type); }\n" string += " static constexpr int16_t GetChargeNumber() { return corsika::particles::GetElectricChargeNumber(Type); }\n" string += " static std::string const& GetName() { return corsika::particles::GetName(Type); }\n" diff --git a/Framework/Particles/testParticles.cc b/Framework/Particles/testParticles.cc index 283bb48c9dfe38db8225d5f8944c1fe7eeaec04c..59d9938260ca124cc5c760fc6dd0716c0ad627f5 100644 --- a/Framework/Particles/testParticles.cc +++ b/Framework/Particles/testParticles.cc @@ -31,7 +31,7 @@ TEST_CASE("ParticleProperties", "[Particles]") { } SECTION("Masses") { - REQUIRE(Electron::GetMass() / (511_keV / constants::cSquared) == Approx(1)); + REQUIRE(Electron::GetMass() / (511_keV) == Approx(1)); REQUIRE(Electron::GetMass() / GetMass(Code::Electron) == Approx(1)); }