diff --git a/corsika/detail/stack/NuclearStackExtension.inl b/corsika/detail/stack/NuclearStackExtension.inl index 9bb5843d1809992751e9a9cade1e4efa5a546a7e..fa0d5941fb0d7a8fc38a6371bb5475a3015e3689 100644 --- a/corsika/detail/stack/NuclearStackExtension.inl +++ b/corsika/detail/stack/NuclearStackExtension.inl @@ -193,6 +193,14 @@ namespace corsika::nuclear_stack { (isNucleus() ? fmt::format("A={}, Z={}", getNuclearA(), getNuclearZ()) : "n/a")); } + template <template <typename> class InnerParticleInterface, + typename StackIteratorInterface> + inline PDGCode NuclearParticleInterface<InnerParticleInterface, + StackIteratorInterface>::getPDG() const { + return (isNucleus() ? PDGCode(1000000000 + getNuclearZ() * 10000 + getNuclearA() * 10) + : super_type::getPDG()); + } + template <template <typename> class InnerParticleInterface, typename StackIteratorInterface> inline void diff --git a/corsika/stack/NuclearStackExtension.hpp b/corsika/stack/NuclearStackExtension.hpp index 0f14c68e970a44e4e6ef8667f7992f3440d25cd5..6c928656642959d93bf07a469a98e04637884bc8 100644 --- a/corsika/stack/NuclearStackExtension.hpp +++ b/corsika/stack/NuclearStackExtension.hpp @@ -142,6 +142,11 @@ namespace corsika::nuclear_stack { } /// @} + /** + * Overwrite normal getPDG function with nuclear version + */ + PDGCode getPDG() const; + /** * Overwrite normal setMomentum function with nuclear version */ diff --git a/corsika/stack/VectorStack.hpp b/corsika/stack/VectorStack.hpp index 47b503c8f57f6d54a6e00b9eb9ced081ada2cc7b..223d651f90a6a3d37c5d45e362fa8702e21e9c54 100644 --- a/corsika/stack/VectorStack.hpp +++ b/corsika/stack/VectorStack.hpp @@ -130,6 +130,8 @@ namespace corsika { Code getPID() const { return super_type::getStackData().getPID(super_type::getIndex()); } + //! Get PDG code + PDGCode getPDG() const { return get_PDG(getPID()); } //! Get kinetic energy HEPEnergyType getKineticEnergy() const { return super_type::getStackData().getKineticEnergy(super_type::getIndex()); diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index d6f5e98f5ee82e4c4ff842906027ee46961c239b..a8916b55e67a245f7aac1f01cdf8d3a3c3a81689 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -394,7 +394,7 @@ int main(int argc, char** argv) { Plane const obsPlane(showerCore, DirectionVector(rootCS, {0., 0., 1.})); ObservationPlane observationLevel(obsPlane, DirectionVector(rootCS, {1., 0., 0.})); // register the observation plane with the output - output.add("obsplane", observationLevel); + output.add("particles", observationLevel); auto sequence = make_sequence(stackInspect, hadronSequence, reset_particle_mass, decaySequence,