File indexing completed on 2026-09-27 09:20:10
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef PANDORA_PDG_TABLE_H
0009 #define PANDORA_PDG_TABLE_H 1
0010
0011 #include "Pandora/StatusCodes.h"
0012
0013 #include <string>
0014
0015 namespace pandora
0016 {
0017
0018
0019 #define PARTICLE_DATA_TABLE(d) \
0020 d(PHOTON, 22, 0.E+00f, 0.E+00f, 0) \
0021 d(E_MINUS, 11, 5.10998902E-04f, 0.E+00f, -1) \
0022 d(E_PLUS, -11, 5.10998902E-04f, 0.E+00f, +1) \
0023 d(MU_MINUS, 13, 1.05658357E-01f, 2.99591E-19f, -1) \
0024 d(MU_PLUS, -13, 1.05658357E-01f, 2.99591E-19f, +1) \
0025 d(TAU_MINUS, 15, 1.77699E+00f, 2.265E-12f, -1) \
0026 d(TAU_PLUS, -15, 1.77699E+00f, 2.265E-12f, +1) \
0027 d(NU_E, 12, 0.E+00f, 0.E+00f, 0) \
0028 d(NU_E_BAR, -12, 0.E+00f, 0.E+00f, 0) \
0029 d(NU_MU, 14, 0.E+00f, 0.E+00f, 0) \
0030 d(NU_MU_BAR, -14, 0.E+00f, 0.E+00f, 0) \
0031 d(NU_TAU, 16, 0.E+00f, 0.E+00f, 0) \
0032 d(NU_TAU_BAR, -16, 0.E+00f, 0.E+00f, 0) \
0033 d(PI_PLUS, 211, 1.3957018E-01f, 2.5284E-17f, +1) \
0034 d(PI_MINUS, -211, 1.3957018E-01f, 2.5284E-17f, -1) \
0035 d(PI_ZERO, 111, 1.349766E-01f, 7.8E-09f, 0) \
0036 d(LAMBDA, 3122, 1.115683E+00f, 2.501E-15f, 0) \
0037 d(LAMBDA_BAR, -3122, 1.115683E+00f, 2.501E-15f, 0) \
0038 d(K_PLUS, 321, 4.93677E-01f, 5.315E-17f, +1) \
0039 d(K_MINUS, -321, 4.93677E-01f, 5.315E-17f, -1) \
0040 d(K_SHORT, 310, 4.97672E-01f, 7.367E-15f, 0) \
0041 d(K_LONG, 130, 4.97672E-01f, 1.272E-17f, 0) \
0042 d(SIGMA_MINUS, 3112, 1.1975E+00f, 8.28E-15f, -1) \
0043 d(SIGMA_PLUS, 3222, 1.1975E+00f, 8.28E-15f, +1) \
0044 d(SIGMA_MINUS_BAR, -3112, 1.1975E+00f, 8.28E-15f, +1) \
0045 d(SIGMA_PLUS_BAR, -3222, 1.1975E+00f, 8.28E-15f, -1) \
0046 d(HYPERON_ZERO , 3322, 1.31483E+00f, 2.28E-15f, 0) \
0047 d(HYPERON_ZERO_BAR, -3322, 1.31483E+00f, 2.28E-15f, 0) \
0048 d(HYPERON_MINUS, 3312, 1.32131E+00f, 4.04E-15f, -1) \
0049 d(HYPERON_MINUS_BAR, -3312, 1.32131E+00f, 4.04E-15f, +1) \
0050 d(PROTON, 2212, 9.3827200E-01f, 0.E+00f, +1) \
0051 d(PROTON_BAR, -2212, 9.3827200E-01f, 0.E+00f, -1) \
0052 d(NEUTRON, 2112, 9.3956533E-01f, 7.432E-28f, 0) \
0053 d(NEUTRON_BAR, -2112, 9.3956533E-01f, 7.432E-28f, 0)
0054
0055
0056
0057
0058 #define GET_PARTICLE_TYPE_ENTRY(a, b, c, d, e) \
0059 a = b,
0060
0061
0062
0063
0064 #define GET_PARTICLE_TYPE_SWITCH(a, b, c, d, e) \
0065 case b : return a;
0066
0067
0068
0069
0070 #define GET_PARTICLE_NAME_SWITCH(a, b, c, d, e) \
0071 case a : return std::string(#a);
0072
0073
0074
0075
0076 #define GET_PARTICLE_PDG_CODE_SWITCH(a, b, c, d, e) \
0077 case a : return b;
0078
0079
0080
0081
0082 #define GET_PARTICLE_MASS_SWITCH(a, b, c, d, e) \
0083 case a : return c;
0084
0085
0086
0087
0088 #define GET_PARTICLE_WIDTH_SWITCH(a, b, c, d, e) \
0089 case a : return d;
0090
0091
0092
0093
0094 #define GET_PARTICLE_CHARGE_SWITCH(a, b, c, d, e) \
0095 case a : return e;
0096
0097
0098
0099
0100 enum ParticleType
0101 {
0102 PARTICLE_DATA_TABLE(GET_PARTICLE_TYPE_ENTRY)
0103 UNKNOWN_PARTICLE_TYPE = 0
0104 };
0105
0106
0107
0108
0109
0110
0111
0112 class PdgTable
0113 {
0114 public:
0115
0116
0117
0118
0119
0120
0121
0122 static ParticleType GetParticleType(const int pdgCode);
0123
0124
0125
0126
0127
0128
0129
0130
0131 static std::string GetParticleName(const int pdgCode);
0132
0133
0134
0135
0136
0137
0138
0139
0140 static int GetParticlePdgCode(const int pdgCode);
0141
0142
0143
0144
0145
0146
0147
0148
0149 static float GetParticleMass(const int pdgCode);
0150
0151
0152
0153
0154
0155
0156
0157
0158 static float GetParticleWidth(const int pdgCode);
0159
0160
0161
0162
0163
0164
0165
0166
0167 static int GetParticleCharge(const int pdgCode);
0168 };
0169
0170
0171
0172 inline ParticleType PdgTable::GetParticleType(const int pdgCode)
0173 {
0174 switch (pdgCode)
0175 {
0176 PARTICLE_DATA_TABLE(GET_PARTICLE_TYPE_SWITCH)
0177 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0178 }
0179 }
0180
0181
0182
0183 inline std::string PdgTable::GetParticleName(const int pdgCode)
0184 {
0185 switch (pdgCode)
0186 {
0187 PARTICLE_DATA_TABLE(GET_PARTICLE_NAME_SWITCH)
0188 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0189 }
0190 }
0191
0192
0193
0194 inline int PdgTable::GetParticlePdgCode(const int pdgCode)
0195 {
0196 switch (pdgCode)
0197 {
0198 PARTICLE_DATA_TABLE(GET_PARTICLE_PDG_CODE_SWITCH)
0199 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0200 }
0201 }
0202
0203
0204
0205 inline float PdgTable::GetParticleMass(const int pdgCode)
0206 {
0207 switch (pdgCode)
0208 {
0209 PARTICLE_DATA_TABLE(GET_PARTICLE_MASS_SWITCH)
0210 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0211 }
0212 }
0213
0214
0215
0216 inline float PdgTable::GetParticleWidth(const int pdgCode)
0217 {
0218 switch (pdgCode)
0219 {
0220 PARTICLE_DATA_TABLE(GET_PARTICLE_WIDTH_SWITCH)
0221 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0222 }
0223 }
0224
0225
0226
0227 inline int PdgTable::GetParticleCharge(const int pdgCode)
0228 {
0229 switch (pdgCode)
0230 {
0231 PARTICLE_DATA_TABLE(GET_PARTICLE_CHARGE_SWITCH)
0232 default : throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
0233 }
0234 }
0235
0236 }
0237
0238 #endif