From c498e9f17a5377173e052bc08a86edf772f8699e Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Sat, 8 Dec 2018 11:03:02 +0100
Subject: [PATCH] use unit::hep for particle masses

---
 Framework/Particles/ParticleProperties.h | 4 ++--
 Framework/Particles/pdxml_reader.py      | 8 ++++----
 Framework/Particles/testParticles.cc     | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Framework/Particles/ParticleProperties.h b/Framework/Particles/ParticleProperties.h
index 4bb3cda1..d4edb3f6 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 39aaddd3..aa77d0c5 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 283bb48c..59d99382 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));
   }
 
-- 
GitLab