diff --git a/Core/include/Acts/Definitions/PdgParticle.hpp b/Core/include/Acts/Definitions/PdgParticle.hpp index 4cbf6ed31dd..bdb17ee0597 100644 --- a/Core/include/Acts/Definitions/PdgParticle.hpp +++ b/Core/include/Acts/Definitions/PdgParticle.hpp @@ -26,6 +26,8 @@ enum PdgParticle : std::int32_t { ePionZero = 111, ePionPlus = 211, ePionMinus = -ePionPlus, + eKaonPlus = 321, + eKaonMinus = -eKaonPlus, eNeutron = 2112, eAntiNeutron = -eNeutron, eProton = 2212, diff --git a/Core/include/Acts/EventData/ParticleHypothesis.hpp b/Core/include/Acts/EventData/ParticleHypothesis.hpp index 3494c63c470..e2865e41d13 100644 --- a/Core/include/Acts/EventData/ParticleHypothesis.hpp +++ b/Core/include/Acts/EventData/ParticleHypothesis.hpp @@ -44,6 +44,9 @@ class SinglyChargedParticleHypothesis static SinglyChargedParticleHypothesis electron() { return SinglyChargedParticleHypothesis(PdgParticle::eElectron); } + static SinglyChargedParticleHypothesis kaon() { + return SinglyChargedParticleHypothesis(PdgParticle::eKaonPlus); + } static SinglyChargedParticleHypothesis proton() { return SinglyChargedParticleHypothesis(PdgParticle::eProton); } @@ -106,6 +109,9 @@ class NonNeutralChargedParticleHypothesis static NonNeutralChargedParticleHypothesis electron() { return SinglyChargedParticleHypothesis::electron(); } + static NonNeutralChargedParticleHypothesis kaon() { + return SinglyChargedParticleHypothesis::kaon(); + } static NonNeutralChargedParticleHypothesis proton() { return SinglyChargedParticleHypothesis::proton(); } @@ -147,6 +153,9 @@ class ParticleHypothesis : public GenericParticleHypothesis { static ParticleHypothesis electron() { return SinglyChargedParticleHypothesis::electron(); } + static ParticleHypothesis kaon() { + return SinglyChargedParticleHypothesis::kaon(); + } static ParticleHypothesis proton() { return SinglyChargedParticleHypothesis::proton(); } diff --git a/Core/src/Definitions/ParticleData.cpp b/Core/src/Definitions/ParticleData.cpp index 58d3c614cfc..7254dd11dfe 100644 --- a/Core/src/Definitions/ParticleData.cpp +++ b/Core/src/Definitions/ParticleData.cpp @@ -126,6 +126,9 @@ std::optional Acts::pdgToShortAbsString(PdgParticle pdg) { if (pdg == ePionPlus) { return "pi"; } + if (pdg == eKaonPlus) { + return "K"; + } if (pdg == eNeutron) { return "n"; } diff --git a/Examples/Python/src/Base.cpp b/Examples/Python/src/Base.cpp index 702a63316b1..329cf7792ee 100644 --- a/Examples/Python/src/Base.cpp +++ b/Examples/Python/src/Base.cpp @@ -228,6 +228,8 @@ void addPdgParticle(Acts::Python::Context& ctx) { .value("ePionZero", Acts::PdgParticle::ePionZero) .value("ePionPlus", Acts::PdgParticle::ePionPlus) .value("ePionMinus", Acts::PdgParticle::ePionMinus) + .value("eKaonPlus", Acts::PdgParticle::eKaonPlus) + .value("eKaonMinus", Acts::PdgParticle::eKaonMinus) .value("eNeutron", Acts::PdgParticle::eNeutron) .value("eAntiNeutron", Acts::PdgParticle::eAntiNeutron) .value("eProton", Acts::PdgParticle::eProton) diff --git a/Examples/Python/src/EventData.cpp b/Examples/Python/src/EventData.cpp index 6e44b19ef57..98861ed8840 100644 --- a/Examples/Python/src/EventData.cpp +++ b/Examples/Python/src/EventData.cpp @@ -57,6 +57,10 @@ void addEventData(Context& ctx) { [](py::object /* self */) { return Acts::ParticleHypothesis::electron(); }) + .def_property_readonly_static("kaon", + [](py::object /* self */) { + return Acts::ParticleHypothesis::kaon(); + }) .def_property_readonly_static("proton", [](py::object /* self */) { return Acts::ParticleHypothesis::proton(); diff --git a/Examples/Python/tests/test_base.py b/Examples/Python/tests/test_base.py index f14e04df7e8..50af8ee07ee 100644 --- a/Examples/Python/tests/test_base.py +++ b/Examples/Python/tests/test_base.py @@ -12,7 +12,7 @@ def test_logging(): def test_pgd_particle(): - assert len(acts.PdgParticle.__members__) == 17 + assert len(acts.PdgParticle.__members__) == 19 def test_algebra(): diff --git a/Examples/Python/tests/test_event_data.py b/Examples/Python/tests/test_event_data.py index c56d4db2d39..29b89abd9ee 100644 --- a/Examples/Python/tests/test_event_data.py +++ b/Examples/Python/tests/test_event_data.py @@ -6,20 +6,20 @@ def test_particle_hypothesis(): pion = acts.ParticleHypothesis.pion electron = acts.ParticleHypothesis.electron proton = acts.ParticleHypothesis.proton + kaon = acts.ParticleHypothesis.kaon geantino = acts.ParticleHypothesis.geantino chargedGeantino = acts.ParticleHypothesis.chargedGeantino # create new particle hypothesis - kaon = acts.ParticleHypothesis(321, 0.493677, 1) # check pdg assert muon.absolutePdg() == acts.PdgParticle.eMuon assert pion.absolutePdg() == acts.PdgParticle.ePionPlus assert electron.absolutePdg() == acts.PdgParticle.eElectron + assert kaon.absolutePdg() == acts.PdgParticle.eKaonPlus assert proton.absolutePdg() == acts.PdgParticle.eProton assert geantino.absolutePdg() == acts.PdgParticle.eInvalid assert chargedGeantino.absolutePdg() == acts.PdgParticle.eInvalid - assert kaon.absolutePdg() == 321 # check mass assert electron.mass() != 0 @@ -45,6 +45,7 @@ def test_particle_hypothesis(): assert ( str(electron) == "ParticleHypothesis{absPdg=e, mass=0.000510999, absCharge=1}" ) + assert str(kaon) == "ParticleHypothesis{absPdg=K, mass=0.493677, absCharge=1}" assert str(proton) == "ParticleHypothesis{absPdg=p, mass=0.938272, absCharge=1}" assert str(geantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=0}" assert str(chargedGeantino) == "ParticleHypothesis{absPdg=0, mass=0, absCharge=1}"