Skip to content

Commit 35b08a0

Browse files
authored
Add PDG particle 0 to model errors (#932)
This commit reserves PDG particle 0 to denote invalid particles, in accordance with the numbering scheme used in ACTS.
1 parent 2d6be93 commit 35b08a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/include/detray/definitions/pdg_particle.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ struct pdg_particle {
3737
DETRAY_HOST_DEVICE
3838
constexpr scalar_type charge() const { return m_charge; }
3939

40+
DETRAY_HOST_DEVICE
41+
constexpr bool is_valid() const { return m_pdg_num != 0; }
42+
4043
private:
4144
std::int32_t m_pdg_num;
4245
scalar_type m_mass;
@@ -69,6 +72,8 @@ DETRAY_HOST_DEVICE constexpr pdg_particle<scalar_t> update_particle_hypothesis(
6972
constexpr PARTICLE_NAME() : base_type(PDG_NUM, MASS, CHARGE) {} \
7073
}
7174

75+
// Declare PDG number 0 to be invalid
76+
DETRAY_DECLARE_PARTICLE(invalid, 0, 0.f, 0.f);
7277
// Declare some predefined particles
7378
DETRAY_DECLARE_PARTICLE(electron, 11, constant<float>::m_e,
7479
-1.f * unit<float>::e);

0 commit comments

Comments
 (0)