Skip to content

Commit c5a3adf

Browse files
committed
Added getPDGCode convenience method to Particle class for PDG identification
1 parent 368a416 commit c5a3adf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/particlezoo/Particle.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ namespace ParticleZoo {
269269
* @return ParticleType The type of particle (electron, photon, proton, etc.)
270270
*/
271271
ParticleType getType() const;
272+
273+
/**
274+
* @brief Get the PDG identification code of the particle.
275+
*
276+
* @return std::int32_t The PDG code corresponding to the particle type
277+
*/
278+
std::int32_t getPDGCode() const;
272279

273280
/**
274281
* @brief Get the kinetic energy of the particle.
@@ -612,6 +619,7 @@ namespace ParticleZoo {
612619
}
613620

614621
inline ParticleType Particle::getType() const { return type_; }
622+
inline std::int32_t Particle::getPDGCode() const { return getPDGIDFromParticleType(type_); }
615623
inline float Particle::getKineticEnergy() const { return kineticEnergy_; }
616624
inline float Particle::getX() const { return x_; }
617625
inline float Particle::getY() const { return y_; }

0 commit comments

Comments
 (0)