diff --git a/Documentation/Examples/particle_list_example.cc b/Documentation/Examples/particle_list_example.cc index ec3fba9e68664ea41bd99795903b621bef448dd4..d51efa039f826e1ca017e04d9f32c90f9df26f55 100644 --- a/Documentation/Examples/particle_list_example.cc +++ b/Documentation/Examples/particle_list_example.cc @@ -9,10 +9,10 @@ */ #include <corsika/particles/ParticleProperties.h> -#include <corsika/units/PhysicalUnits.h> #include <corsika/process/ProcessSequence.h> -#include <corsika/setup/SetupEnvironment.h> #include <corsika/process/sibyll/ParticleConversion.h> +#include <corsika/setup/SetupEnvironment.h> +#include <corsika/units/PhysicalUnits.h> #include <iomanip> #include <iostream> @@ -30,18 +30,19 @@ int main() { << "--------------------" << endl; cout << std::setw(20) << "Name" << " | " << std::setw(10) << "PDG-id" - << " | " << std::setw(10) << "mass (GeV)" << " | " << std::setw(10) << "SIBYLL-id" - << endl; + << " | " << std::setw(18) << "PDG-mass (GeV)" + << " | " << std::setw(18) << "SIBYLL-mass (GeV)" + << " | " << endl; cout << std::setw(58) << std::setfill('-') << "-" << endl; for (auto p : corsika::particles::detail::all_particles) { if (p != Code::Unknown && !IsNucleus(p)) - cout << std::setw(20) << std::setfill(' ') << p << " | " - << std::setw(10) << static_cast<int>(GetPDG(p)) << " | " - << std::setw(10) << GetMass(p) / 1_GeV << " | " - << std::setw(10) << static_cast<int>(corsika::process::sibyll::ConvertToSibyll(p)) << " | " - - << endl; + cout << std::setw(20) << std::setfill(' ') << p << " | " << std::setw(10) + << static_cast<int>(GetPDG(p)) << " | " << std::setw(10) + << static_cast<int>(corsika::process::sibyll::ConvertToSibyll(p)) << " | " + << std::setw(18) << GetMass(p) / 1_GeV << " | " + << std::setw(18) << corsika::process::sibyll::GetSibyllMass(p) / 1_GeV << " | " + << endl; } cout << std::setw(54) << std::setfill('-') << "-" << endl; } diff --git a/Processes/Sibyll/ParticleConversion.cc b/Processes/Sibyll/ParticleConversion.cc index 4a19f2fb92fc91880f93812f8215119c5772ea09..fd15e2aa0ecb07eb90d3b39e2c362655485695fc 100644 --- a/Processes/Sibyll/ParticleConversion.cc +++ b/Processes/Sibyll/ParticleConversion.cc @@ -13,6 +13,15 @@ using namespace corsika::process::sibyll; +corsika::units::si::HEPMassType corsika::process::sibyll::GetSibyllMass(corsika::particles::Code const pCode) { + using namespace corsika::units; + using namespace corsika::units::si; + if (pCode == corsika::particles::Code::Nucleus) + throw std::runtime_error("Cannot GetMass() of particle::Nucleus -> unspecified"); + auto sCode = ConvertToSibyllRaw(pCode); + return sqrt(get_sibyll_mass2(sCode)) * 1_GeV; +} + // const std::map<sibyll::PID, ParticleProperties::InternalParticleCode> // process::sibyll::Sibyll2Corsika = { // {PID::E_MINUS, InternalParticleCode::Electron}, diff --git a/Processes/Sibyll/ParticleConversion.h b/Processes/Sibyll/ParticleConversion.h index 62ccdda99f9a6d2f57a0e2b53437d8389f2e71e6..26f6b3b1453e0d96841d84bf2301e7d4d969fc48 100644 --- a/Processes/Sibyll/ParticleConversion.h +++ b/Processes/Sibyll/ParticleConversion.h @@ -11,7 +11,9 @@ #ifndef _include_processes_sibyll_particles_h_ #define _include_processes_sibyll_particles_h_ +#include <corsika/units/PhysicalUnits.h> #include <corsika/particles/ParticleProperties.h> +#include <corsika/process/sibyll/sibyll2.3c.h> #include <string> @@ -50,6 +52,9 @@ namespace corsika::process::sibyll { return GetSibyllXSCode(pCode) > 0; } + corsika::units::si::HEPMassType GetSibyllMass(corsika::particles::Code const); + + } // namespace corsika::process::sibyll #endif diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc index 0453220f4593d55a5250e2cfddbd1f5942f90854..a8dd5488ebe93411f1ea8e12a875f791f56a19c6 100644 --- a/Processes/Sibyll/testSibyll.cc +++ b/Processes/Sibyll/testSibyll.cc @@ -24,6 +24,8 @@ using namespace corsika; using namespace corsika::process::sibyll; +using namespace corsika::units; +using namespace corsika::units::si; TEST_CASE("Sibyll", "[processes]") { @@ -60,6 +62,12 @@ TEST_CASE("Sibyll", "[processes]") { REQUIRE(process::sibyll::GetSibyllXSCode(particles::Code::SigmaPlus) == 1); REQUIRE(process::sibyll::GetSibyllXSCode(particles::Code::PiMinus) == 2); } + + SECTION("sibyll mass") { + + REQUIRE_FALSE(process::sibyll::GetSibyllMass(particles::Code::Electron) == 0_GeV); + } + } #include <corsika/geometry/Point.h>