Rivet API documentation

Rivet 4.1.5
ParticleName.hh
1// -*- C++ -*-
2#ifndef RIVET_PARTICLENAME_HH
3#define RIVET_PARTICLENAME_HH
4
5#include "Rivet/Particle.fhh"
6#include "Rivet/Tools/Exceptions.hh"
7
8// Cython includes termio.h on some systems,
9// which #defines a B0 = 0 macro
10#undef B0
11
12namespace Rivet {
13
14 namespace PID {
15
16
18
20 constexpr PdgId ANY = 10000;
21
24 constexpr PdgId ELECTRON = 11;
25 constexpr PdgId POSITRON = -ELECTRON;
26 constexpr PdgId EMINUS = ELECTRON;
27 constexpr PdgId EPLUS = POSITRON;
28 constexpr PdgId MUON = 13;
29 constexpr PdgId ANTIMUON = -MUON;
30 constexpr PdgId TAU = 15;
31 constexpr PdgId ANTITAU = -TAU;
33
36 constexpr PdgId NU_E = 12;
37 constexpr PdgId NU_EBAR = -NU_E;
38 constexpr PdgId NU_MU = 14;
39 constexpr PdgId NU_MUBAR = -NU_MU;
40 constexpr PdgId NU_TAU = 16;
41 constexpr PdgId NU_TAUBAR = -NU_TAU;
43
46 constexpr PdgId PHOTON = 22;
47 constexpr PdgId GAMMA = PHOTON;
48 constexpr PdgId GLUON = 21;
49 constexpr PdgId WPLUSBOSON = 24;
50 constexpr PdgId WMINUSBOSON = -WPLUSBOSON;
51 constexpr PdgId WPLUS = WPLUSBOSON;
52 constexpr PdgId WMINUS = WMINUSBOSON;
53 constexpr PdgId WBOSON = WPLUSBOSON;
54 constexpr PdgId Z0BOSON = 23;
55 constexpr PdgId ZBOSON = Z0BOSON;
56 constexpr PdgId Z0 = Z0BOSON;
57 constexpr PdgId HIGGSBOSON = 25;
58 constexpr PdgId HIGGS = HIGGSBOSON;
59 constexpr PdgId H0BOSON = HIGGSBOSON;
60 constexpr PdgId HBOSON = HIGGSBOSON;
62
65 constexpr PdgId DQUARK = 1;
66 constexpr PdgId UQUARK = 2;
67 constexpr PdgId SQUARK = 3;
68 constexpr PdgId CQUARK = 4;
69 constexpr PdgId BQUARK = 5;
70 constexpr PdgId TQUARK = 6;
72
75 constexpr PdgId PROTON = 2212;
76 constexpr PdgId ANTIPROTON = -PROTON;
77 constexpr PdgId PBAR = ANTIPROTON;
78 constexpr PdgId NEUTRON = 2112;
79 constexpr PdgId ANTINEUTRON = -NEUTRON;
81
84 constexpr PdgId PI0 = 111;
85 constexpr PdgId PIPLUS = 211;
86 constexpr PdgId PIMINUS = -PIPLUS;
87 constexpr PdgId RHO0 = 113;
88 constexpr PdgId RHOPLUS = 213;
89 constexpr PdgId RHOMINUS = -RHOPLUS;
90 constexpr PdgId K0L = 130;
91 constexpr PdgId K0S = 310;
92 constexpr PdgId K0 = 311;
93 constexpr PdgId KPLUS = 321;
94 constexpr PdgId KMINUS = -KPLUS;
95 constexpr PdgId ETA = 221;
96 constexpr PdgId ETAPRIME = 331;
97 constexpr PdgId PHI = 333;
98 constexpr PdgId OMEGA = 223;
100
103 constexpr PdgId ETAC = 441;
104 constexpr PdgId JPSI = 443;
105 constexpr PdgId PSI2S = 100443;
107
110 constexpr PdgId D0 = 421;
111 constexpr PdgId D0BAR = -421;
112 constexpr PdgId DPLUS = 411;
113 constexpr PdgId DMINUS = -DPLUS;
114 constexpr PdgId DSTARPLUS = 413;
115 constexpr PdgId DSTARMINUS = -DSTARPLUS;
116 constexpr PdgId DSPLUS = 431;
117 constexpr PdgId DSMINUS = -DSPLUS;
119
122 constexpr PdgId ETAB = 551;
123 constexpr PdgId UPSILON1S = 553;
124 constexpr PdgId UPSILON2S = 100553;
125 constexpr PdgId UPSILON3S = 200553;
126 constexpr PdgId UPSILON4S = 300553;
128
131 constexpr PdgId B0 = 511;
132 constexpr PdgId B0BAR = -B0;
134 constexpr PdgId BPLUS = 521;
135 constexpr PdgId BMINUS = -BPLUS;
136 constexpr PdgId BSTAR0 = 513;
137 constexpr PdgId BSTAR0BAR = -BSTAR0;
138 constexpr PdgId BSTARPLUS = 523;
139 constexpr PdgId BSTARMINUS = -BSTARPLUS;
140 constexpr PdgId BS0 = 531;
141 constexpr PdgId BS0BAR = -BS0;
142 constexpr PdgId B0S = BS0;
143 constexpr PdgId BSSTAR0 = 533;
144 constexpr PdgId BSSTAR0BAR = -BSSTAR0;
145 constexpr PdgId BCPLUS = 541;
146 constexpr PdgId BCMINUS = -BCPLUS;
148
151 constexpr PdgId LAMBDA = 3122;
152 constexpr PdgId SIGMA0 = 3212;
153 constexpr PdgId SIGMAPLUS = 3222;
154 constexpr PdgId SIGMAMINUS = 3112;
155 constexpr PdgId SIGMAB = 5212;
156 constexpr PdgId SIGMABPLUS = 5222;
157 constexpr PdgId SIGMABMINUS = 5112;
158 constexpr PdgId LAMBDACPLUS = 4122;
159 constexpr PdgId LAMBDACMINUS = -4122;
160 constexpr PdgId LAMBDAB = 5122;
161 constexpr PdgId XI0 = 3322;
162 constexpr PdgId XIMINUS = 3312;
163 constexpr PdgId XIPLUS = -XIMINUS;
164 constexpr PdgId XI0B = 5232;
165 constexpr PdgId XIBMINUS = 5132;
166 constexpr PdgId XI0C = 4132;
167 constexpr PdgId XICPLUS = 4232;
168 constexpr PdgId OMEGAMINUS = 3334;
169 constexpr PdgId OMEGAPLUS = -OMEGAMINUS;
170 constexpr PdgId OMEGABMINUS = 5332;
171 constexpr PdgId OMEGA0C = 4332;
173
176 constexpr PdgId REGGEON = 110;
177 constexpr PdgId POMERON = 990;
178 constexpr PdgId ODDERON = 9990;
179 constexpr PdgId GRAVITON = 39;
180 constexpr PdgId NEUTRALINO1 = 1000022;
181 constexpr PdgId GRAVITINO = 1000039;
182 constexpr PdgId GLUINO = 1000021;
183 constexpr int BPRIME = 7;
184 constexpr int TPRIME = 8;
185 constexpr int LPRIME = 17;
186 constexpr int NUPRIME = 18;
187 // constexpr int DARKMATTERSCALAR = 1000051;
188 // constexpr int DARKMATTERFERMION = 1000052;
189 // constexpr int DARKMATTERVECTOR = 1000053;
192
195 constexpr PdgId DEUTERON = 1000010020;
196 constexpr PdgId ALUMINIUM = 1000130270;
197 constexpr PdgId COPPER = 1000290630;
198 constexpr PdgId XENON = 1000541290;
199 constexpr PdgId GOLD = 1000791970;
200 constexpr PdgId LEAD = 1000822080;
201 constexpr PdgId OXYGEN = 1000080160;
202 constexpr PdgId URANIUM = 1000922380;
205
206
210 class ParticleNames {
211 public:
212
213 static std::string particleName(PdgId pid) {
214 if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
215 return _instance->_particleName(pid);
216 }
217
218 static PdgId particleID(const std::string& pname) {
219 if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
220 return _instance->_particleID(pname);
221 }
222
223 std::string _particleName(PdgId pid);
224
225 PdgId _particleID(const std::string& pname);
226
227
228 private:
229
230 ParticleNames() {
231 // charged leptons
232 _add_pid_name(ELECTRON, "ELECTRON");
233 _add_pid_name(POSITRON, "POSITRON");
234 _add_pid_name(MUON, "MUON");
235 _add_pid_name(ANTIMUON, "ANTIMUON");
236 _add_pid_name(TAU, "TAU");
237 _add_pid_name(ANTITAU, "ANTITAU");
238 // neutrinos
239 _add_pid_name(NU_E, "NU_E");
240 _add_pid_name(NU_EBAR, "NU_EBAR");
241 _add_pid_name(NU_MU, "NU_MU");
242 _add_pid_name(NU_MUBAR, "NU_MUBAR");
243 _add_pid_name(NU_TAU, "NU_TAU");
244 _add_pid_name(NU_TAUBAR, "NU_TAUBAR");
245 // bosons
246 _add_pid_name(GLUON, "GLUON");
247 _add_pid_name(PHOTON, "PHOTON");
248 _add_pid_name(WPLUSBOSON, "WPLUSBOSON");
249 _add_pid_name(WMINUSBOSON, "WMINUSBOSON");
250 _add_pid_name(ZBOSON, "ZBOSON");
251 _add_pid_name(HIGGS, "HIGGS");
252 // quarks
253 _add_pid_name(DQUARK, "DOWN");
254 _add_pid_name(UQUARK, "UP");
255 _add_pid_name(SQUARK, "STRANGE");
256 _add_pid_name(CQUARK, "CHARM");
257 _add_pid_name(BQUARK, "BOTTOM");
258 _add_pid_name(TQUARK, "TOP");
259 _add_pid_name(-DQUARK, "ANTIDOWN");
260 _add_pid_name(-UQUARK, "ANTIUP");
261 _add_pid_name(-SQUARK, "ANTISTRANGE");
262 _add_pid_name(-CQUARK, "ANTICHARM");
263 _add_pid_name(-BQUARK, "ANTIBOTTOM");
264 _add_pid_name(-TQUARK, "ANTITOP");
265 // nucleons
266 _add_pid_name(PROTON, "PROTON");
267 _add_pid_name(ANTIPROTON, "ANTIPROTON");
268 _add_pid_name(NEUTRON, "NEUTRON");
269 _add_pid_name(ANTINEUTRON, "ANTINEUTRON");
270 // light mesons
271 _add_pid_name(PI0, "PI0");
272 _add_pid_name(PIPLUS, "PIPLUS");
273 _add_pid_name(PIMINUS, "PIMINUS");
274 _add_pid_name(RHO0, "RHO0");
275 _add_pid_name(RHOPLUS, "RHOPLUS");
276 _add_pid_name(RHOMINUS, "RHOMINUS");
277 _add_pid_name(K0, "K0");
278 _add_pid_name(-K0, "K0BAR");
279 _add_pid_name(K0L, "K0L");
280 _add_pid_name(K0S, "K0S");
281 _add_pid_name(KPLUS, "KPLUS");
282 _add_pid_name(KMINUS, "KMINUS");
283 _add_pid_name(ETA, "ETA");
284 _add_pid_name(PHI, "PHI");
285 // charm mesons
286 _add_pid_name(D0, "D0");
287 _add_pid_name(D0BAR, "D0BAR");
288 _add_pid_name(DPLUS, "DPLUS");
289 _add_pid_name(DMINUS, "DMINUS");
290 // B mesons
291 _add_pid_name(B0, "B0");
292 _add_pid_name(B0BAR, "B0BAR");
293 _add_pid_name(BPLUS, "BPLUS");
294 _add_pid_name(BMINUS, "BMINUS");
295 _add_pid_name(BSTAR0, "BSTAR0");
296 _add_pid_name(BSTAR0BAR, "BSTAR0BAR");
297 _add_pid_name(BSTARPLUS, "BSTARPLUS");
298 _add_pid_name(BSTARMINUS, "BSTARMINUS");
299 _add_pid_name(BS0, "BS0");
300 _add_pid_name(BS0BAR, "BS0BAR");
301 _add_pid_name(BSSTAR0, "BSSTAR0");
302 _add_pid_name(BSSTAR0BAR, "BSSTAR0BAR");
303 _add_pid_name(BCPLUS, "BCPLUS");
304 _add_pid_name(BCMINUS, "BCMINUS");
305 // baryons
306 _add_pid_name(LAMBDA, "LAMBDA");
307 _add_pid_name(SIGMA0, "SIGMA0");
308 _add_pid_name(SIGMAPLUS, "SIGMAPLUS");
309 _add_pid_name(SIGMAMINUS, "SIGMAMINUS");
310 _add_pid_name(XI0, "XI0");
311 _add_pid_name(XIPLUS, "XIPLUS");
312 _add_pid_name(XIMINUS, "XIMINUS");
313 // exotics
314 _add_pid_name(REGGEON, "REGGEON");
315 _add_pid_name(POMERON, "POMERON");
316 // nuclei
317 _add_pid_name(DEUTERON, "DEUTERON");
318 _add_pid_name(ALUMINIUM, "ALUMINIUM");
319 _add_pid_name(COPPER, "COPPER");
320 _add_pid_name(XENON, "XENON");
321 _add_pid_name(GOLD, "GOLD");
322 _add_pid_name(LEAD, "LEAD");
323 _add_pid_name(URANIUM, "URANIUM");
324 // wildcard
325 _add_pid_name(ANY, "*");
326 }
327
328 void _add_pid_name(PdgId pid, const std::string& pname) {
329 _ids_names[pid] = pname;
330 _names_ids[pname] = pid;
331 }
332
333 static unique_ptr<ParticleNames> _instance;
334
335 std::map<PdgId, std::string> _ids_names;
336
337 std::map<std::string, PdgId> _names_ids;
338 };
339
340
342 inline std::string toParticleName(PdgId p) {
343 return ParticleNames::particleName(p);
344 }
345
346
348 inline PdgId toParticleID(const std::string& pname) {
349 return ParticleNames::particleID(pname);
350 }
351
352
354 inline std::pair<PdgId, PdgId> make_pdgid_pair(PdgId a, PdgId b) {
355 return make_pair(a, b);
356 }
357
358
360 inline std::pair<PdgId, PdgId> make_pdgid_pair(const std::string& a, const std::string& b) {
361 const PdgId pa = toParticleID(a);
362 const PdgId pb = toParticleID(b);
363 return make_pair(pa, pb);
364 }
365
366
368 inline std::string toBeamsString(const PdgIdPair& pair) {
369 string out = "[" + toParticleName(pair.first) + ", " + toParticleName(pair.second) + "]";
370 return out;
371 }
372
373
374 }
375
376}
377
378#endif
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
Definition LHCbCommon.hh:9