Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
particleType.h
Go to the documentation of this file.
1 /*
2  * particleType.h
3 */
4 
5 #ifndef particleTypeH_INCLUDED
6 #define particleTypeH_INCLUDED
7 
8 #include <math.h>
9 #include <stdio.h>
10 #include <string.h>
11 
12 typedef enum {
13 
14  /* An extensive list of the GEANT3 particle
15  * codes can be found here:
16  * http://wwwasdoc.web.cern.ch/wwwasdoc/geant/node72.html
17  */
18 
19  Unknown = 0,
20  Gamma = 1,
21  Positron = 2,
22  Electron = 3,
23  Neutrino = 4,
24  MuonPlus = 5,
25  MuonMinus = 6,
26  Pi0 = 7,
27  PiPlus = 8,
28  PiMinus = 9,
29  KLong = 10,
30  KPlus = 11,
31  KMinus = 12,
32  Neutron = 13,
33  Proton = 14,
34  AntiProton = 15,
35  KShort = 16,
36  Eta = 17,
37  Lambda = 18,
38  SigmaPlus = 19,
39  Sigma0 = 20,
40  SigmaMinus = 21,
41  Xi0 = 22,
42  XiMinus = 23,
43  OmegaMinus = 24,
45  AntiLambda = 26,
47  AntiSigma0 = 28,
49  AntiXi0 = 30,
50  AntiXiPlus = 31,
52  Deuteron = 45,
53  Triton = 46,
54  Helium = 47,
55  Geantino = 48,
56  He3 = 49,
57 
58  Pb208 = 111,
59 
60  /* the constants defined by GEANT end here */
61 
62  /*
63  * Several particle codes are added below which did
64  * not overlap with the original GEANT particle list.
65  * However, the link above has several other particle
66  * codes added which do actually overlap. Because of
67  * this, each of the values below was increased by
68  * 100 so that they don't overlap with any of the new
69  * codes and they can be used.
70  */
71 
72 
73  /* These are E852-defined constants */
74  Rho0 = 44, // was 157
75  RhoPlus = 42, // was 158
76  RhoMinus = 43, // was 159
77  omega = 33, // was 160
78  phiMeson = 34, // was 162
79  EtaPrime = 35, // was 161
80  //Rho0 = 157,
81  //RhoPlus = 158,
82  //RhoMinus = 159,
83  //omega = 160,
84  //EtaPrime = 161,
85  //phiMeson = 162,
86  a0_980 = 163,
87  f0_980 = 164,
88 
89  /* These are GlueX-defined constants */
90 
91  KStar_892_0 = 165,
95 
96  K1_1400_Plus = 169,
98 
99  b1_1235_Plus = 171,
103 
104  Jpsi = 83,
105  Eta_c = 84,
106  Chi_c0 = 85,
107  Chi_c1 = 86,
108  Chi_c2 = 87,
109  Psi2s = 88,
110  D0 = 89,
111  DPlus = 90,
112  Dstar0 = 91,
113  DstarPlus = 92,
114  Lambda_c = 93,
115  AntiD0 = 94,
116 
117  /* These are defined in pythia-geant.map in bggen */
118 
119  //Rho0 = 80, // already defined above (44)
120  //omega = 81, // already defined above (33)
122 
123 
124 } Particle_t;
125 
127 {
128  // bggen defines these in pythia-geant.dat. However,
129  // they are not the same as the definitions used from
130  // E-852 in the enum above. Remap them using this routine
131  // which is called from several of the routines below.
132  if(p==80) return Rho0;
133  if(p==81) return omega;
134  return p;
135 }
136 
137 inline static int IsLepton(Particle_t p)
138 {
139  return ((p == Electron) || (p == Positron) || (p == MuonPlus) || (p == MuonMinus) || (p == Neutrino));
140 }
141 
142 inline static char* ParticleType(Particle_t p)
143 {
144  p = RemapParticleID(p);
145 
146  switch (p) {
147  case Unknown:
148  return (char*)"Unknown";
149  case Gamma:
150  return (char*)"Photon";
151  case Positron:
152  return (char*)"Positron";
153  case Electron:
154  return (char*)"Electron";
155  case Neutrino:
156  return (char*)"Neutrino";
157  case MuonPlus:
158  return (char*)"Muon+";
159  case MuonMinus:
160  return (char*)"Muon-";
161  case Pi0:
162  return (char*)"Pi0";
163  case PiPlus:
164  return (char*)"Pi+";
165  case PiMinus:
166  return (char*)"Pi-";
167  case KLong:
168  return (char*)"KLong";
169  case KPlus:
170  return (char*)"K+";
171  case KMinus:
172  return (char*)"K-";
173  case Neutron:
174  return (char*)"Neutron";
175  case Proton:
176  return (char*)"Proton";
177  case AntiProton:
178  return (char*)"AntiProton";
179  case KShort:
180  return (char*)"KShort";
181  case Eta:
182  return (char*)"Eta";
183  case Lambda:
184  return (char*)"Lambda";
185  case SigmaPlus:
186  return (char*)"Sigma+";
187  case Sigma0:
188  return (char*)"Sigma0";
189  case SigmaMinus:
190  return (char*)"Sigma-";
191  case Xi0:
192  return (char*)"Xi0";
193  case XiMinus:
194  return (char*)"Xi-";
195  case OmegaMinus:
196  return (char*)"Omega-";
197  case AntiNeutron:
198  return (char*)"AntiNeutron";
199  case AntiLambda:
200  return (char*)"AntiLambda";
201  case AntiSigmaMinus:
202  return (char*)"AntiSigma-";
203  case AntiSigma0:
204  return (char*)"AntiSigma0";
205  case AntiSigmaPlus:
206  return (char*)"AntiSigma+";
207  case AntiXi0:
208  return (char*)"AntiXi0";
209  case AntiXiPlus:
210  return (char*)"AntiXi+";
211  case AntiOmegaPlus:
212  return (char*)"AntiOmega+";
213  case Geantino:
214  return (char*)"Geantino";
215  case Rho0:
216  return (char*)"Rho0";
217  case RhoPlus:
218  return (char*)"Rho+";
219  case RhoMinus:
220  return (char*)"Rho-";
221  case omega:
222  return (char*)"Omega";
223  case EtaPrime:
224  return (char*)"EtaPrime";
225  case phiMeson:
226  return (char*)"Phi";
227  case a0_980:
228  return (char*)"a0(980)";
229  case f0_980:
230  return (char*)"f0(980)";
231  case KStar_892_0:
232  return (char*)"K*(892)0";
233  case KStar_892_Plus:
234  return (char*)"K*(892)+";
235  case KStar_892_Minus:
236  return (char*)"K*(892)-";
237  case AntiKStar_892_0:
238  return (char*)"antiK*(892)0";
239  case K1_1400_Plus:
240  return (char*)"K1(1400)+";
241  case K1_1400_Minus:
242  return (char*)"K1(1400)-";
243  case b1_1235_Plus:
244  return (char*)"b1(1235)+";
245  case Sigma_1385_Minus:
246  return (char*)"Sigma(1385)-";
247  case Sigma_1385_0:
248  return (char*)"Sigma(1385)0";
249  case Sigma_1385_Plus:
250  return (char*)"Sigma(1385)+";
251  case Deuteron:
252  return (char*)"Deuteron";
253  case Triton:
254  return (char*)"Triton";
255  case Helium:
256  return (char*)"Helium";
257  case He3:
258  return (char*)"Helium-3";
259  case Pb208:
260  return (char*)"Pb208";
261  case DeltaPlusPlus:
262  return (char*)"Delta++";
263  case Jpsi:
264  return (char*)"Jpsi";
265  case Eta_c:
266  return (char*)"EtaC";
267  case Chi_c0:
268  return (char*)"ChiC0";
269  case Chi_c1:
270  return (char*)"ChiC1";
271  case Chi_c2:
272  return (char*)"ChiC2";
273  case Psi2s:
274  return (char*)"Psi(2S)";
275  case D0:
276  return (char*)"D0";
277  case AntiD0:
278  return (char*)"AntiD0";
279  case DPlus:
280  return (char*)"D+";
281  case Dstar0:
282  return (char*)"D*0";
283  case DstarPlus:
284  return (char*)"D*+";
285  case Lambda_c:
286  return (char*)"LambdaC";
287  default:
288  return (char*)"Unknown";
289  }
290 }
291 
292 inline static char* EnumString(Particle_t p)
293 {
294  //returns string that is exact match to enum name. for auto-generating code
295  p = RemapParticleID(p);
296 
297  switch (p) {
298  case Unknown:
299  return (char*)"Unknown";
300  case Gamma:
301  return (char*)"Gamma";
302  case Positron:
303  return (char*)"Positron";
304  case Electron:
305  return (char*)"Electron";
306  case Neutrino:
307  return (char*)"Neutrino";
308  case MuonPlus:
309  return (char*)"MuonPlus";
310  case MuonMinus:
311  return (char*)"MuonMinus";
312  case Pi0:
313  return (char*)"Pi0";
314  case PiPlus:
315  return (char*)"PiPlus";
316  case PiMinus:
317  return (char*)"PiMinus";
318  case KLong:
319  return (char*)"KLong";
320  case KPlus:
321  return (char*)"KPlus";
322  case KMinus:
323  return (char*)"KMinus";
324  case Neutron:
325  return (char*)"Neutron";
326  case Proton:
327  return (char*)"Proton";
328  case AntiProton:
329  return (char*)"AntiProton";
330  case KShort:
331  return (char*)"KShort";
332  case Eta:
333  return (char*)"Eta";
334  case Lambda:
335  return (char*)"Lambda";
336  case SigmaPlus:
337  return (char*)"SigmaPlus";
338  case Sigma0:
339  return (char*)"Sigma0";
340  case SigmaMinus:
341  return (char*)"SigmaMinus";
342  case Xi0:
343  return (char*)"Xi0";
344  case XiMinus:
345  return (char*)"XiMinus";
346  case OmegaMinus:
347  return (char*)"OmegaMinus";
348  case AntiNeutron:
349  return (char*)"AntiNeutron";
350  case AntiLambda:
351  return (char*)"AntiLambda";
352  case AntiSigmaMinus:
353  return (char*)"AntiSigmaMinus";
354  case AntiSigma0:
355  return (char*)"AntiSigma0";
356  case AntiSigmaPlus:
357  return (char*)"AntiSigmaPlus";
358  case AntiXi0:
359  return (char*)"AntiXi0";
360  case AntiXiPlus:
361  return (char*)"AntiXiPlus";
362  case AntiOmegaPlus:
363  return (char*)"AntiOmegaPlus";
364  case Geantino:
365  return (char*)"Geantino";
366  case Rho0:
367  return (char*)"Rho0";
368  case RhoPlus:
369  return (char*)"RhoPlus";
370  case RhoMinus:
371  return (char*)"RhoMinus";
372  case omega:
373  return (char*)"omega";
374  case EtaPrime:
375  return (char*)"EtaPrime";
376  case phiMeson:
377  return (char*)"phiMeson";
378  case a0_980:
379  return (char*)"a0_980";
380  case f0_980:
381  return (char*)"f0_980";
382  case KStar_892_0:
383  return (char*)"KStar_892_0";
384  case KStar_892_Plus:
385  return (char*)"KStar_892_Plus";
386  case KStar_892_Minus:
387  return (char*)"KStar_892_Minus";
388  case AntiKStar_892_0:
389  return (char*)"AntiKStar_892_0";
390  case K1_1400_Plus:
391  return (char*)"K1_1400_Plus";
392  case K1_1400_Minus:
393  return (char*)"K1_1400_Minus";
394  case b1_1235_Plus:
395  return (char*)"b1_1235_Plus";
396  case Sigma_1385_Minus:
397  return (char*)"Sigma_1385_Minus";
398  case Sigma_1385_0:
399  return (char*)"Sigma_1385_0";
400  case Sigma_1385_Plus:
401  return (char*)"Sigma_1385_Plus";
402  case Deuteron:
403  return (char*)"Deuteron";
404  case Triton:
405  return (char*)"Triton";
406  case Helium:
407  return (char*)"Helium";
408  case He3:
409  return (char*)"Helium-3";
410  case Pb208:
411  return (char*)"Pb208";
412  case DeltaPlusPlus:
413  return (char*)"DeltaPlusPlus";
414  case Jpsi:
415  return (char*)"Jpsi";
416  case Eta_c:
417  return (char*)"Eta_c";
418  case Chi_c0:
419  return (char*)"Chi_c0";
420  case Chi_c1:
421  return (char*)"Chi_c1";
422  case Chi_c2:
423  return (char*)"Chi_c2";
424  case Psi2s:
425  return (char*)"Psi2s";
426  case D0:
427  return (char*)"D0";
428  case AntiD0:
429  return (char*)"AntiD0";
430  case DPlus:
431  return (char*)"DPlus";
432  case Dstar0:
433  return (char*)"Dstar0";
434  case DstarPlus:
435  return (char*)"DstarPlus";
436  case Lambda_c:
437  return (char*)"Lambda_c";
438  default:
439  return (char*)"Unknown";
440  }
441 }
442 
443 inline static char* ShortName(Particle_t locPID)
444 {
445  //returns string that is exact match to enum name. for auto-generating code
446  locPID = RemapParticleID(locPID);
447 
448  switch (locPID) {
449  case Unknown:
450  return (char*)"x";
451  case Gamma:
452  return (char*)"g";
453  case Positron:
454  return (char*)"ep";
455  case Electron:
456  return (char*)"em";
457  case Neutrino:
458  return (char*)"nu";
459  case MuonPlus:
460  return (char*)"mup";
461  case MuonMinus:
462  return (char*)"mum";
463  case Pi0:
464  return (char*)"pi0";
465  case PiPlus:
466  return (char*)"pip";
467  case PiMinus:
468  return (char*)"pim";
469  case KLong:
470  return (char*)"kl";
471  case KPlus:
472  return (char*)"kp";
473  case KMinus:
474  return (char*)"km";
475  case Neutron:
476  return (char*)"n";
477  case Proton:
478  return (char*)"prot";
479  case AntiProton:
480  return (char*)"antip";
481  case KShort:
482  return (char*)"ks";
483  case Eta:
484  return (char*)"eta";
485  case Lambda:
486  return (char*)"lamb";
487  case SigmaPlus:
488  return (char*)"sigp";
489  case Sigma0:
490  return (char*)"sig0";
491  case SigmaMinus:
492  return (char*)"sigm";
493  case Xi0:
494  return (char*)"xi0";
495  case XiMinus:
496  return (char*)"xim";
497  case OmegaMinus:
498  return (char*)"omegam";
499  case AntiNeutron:
500  return (char*)"antin";
501  case AntiLambda:
502  return (char*)"antilamb";
503  case AntiSigmaMinus:
504  return (char*)"antisigm";
505  case AntiSigma0:
506  return (char*)"antisig0";
507  case AntiSigmaPlus:
508  return (char*)"antisigp";
509  case AntiXi0:
510  return (char*)"antixi0";
511  case AntiXiPlus:
512  return (char*)"antixip";
513  case AntiOmegaPlus:
514  return (char*)"antiomegap";
515  case Geantino:
516  return (char*)"geant";
517  case omega:
518  return (char*)"omega";
519  case EtaPrime:
520  return (char*)"etapr";
521  case phiMeson:
522  return (char*)"phi";
523  case Deuteron:
524  return (char*)"d";
525  case Triton:
526  return (char*)"tri";
527  case Helium:
528  return (char*)"he";
529  case He3:
530  return (char*)"he3";
531  case Pb208:
532  return (char*)"pb208";
533  case Jpsi:
534  return (char*)"jpsi";
535  case Eta_c:
536  return (char*)"etac";
537  case Chi_c0:
538  return (char*)"chic0";
539  case Chi_c1:
540  return (char*)"chic1";
541  case Chi_c2:
542  return (char*)"chic2";
543  case Psi2s:
544  return (char*)"psi2s";
545  case D0:
546  return (char*)"d0";
547  case AntiD0:
548  return (char*)"antid0";
549  case DPlus:
550  return (char*)"dp";
551  case Dstar0:
552  return (char*)"ds0";
553  case DstarPlus:
554  return (char*)"dsp";
555  case Lambda_c:
556  return (char*)"lambc";
557 
558  //not really supported
559  case Rho0:
560  return (char*)"Rho0";
561  case RhoPlus:
562  return (char*)"RhoPlus";
563  case RhoMinus:
564  return (char*)"RhoMinus";
565  case a0_980:
566  return (char*)"a0_980";
567  case f0_980:
568  return (char*)"f0_980";
569  case KStar_892_0:
570  return (char*)"KStar_892_0";
571  case KStar_892_Plus:
572  return (char*)"KStar_892_Plus";
573  case KStar_892_Minus:
574  return (char*)"KStar_892_Minus";
575  case AntiKStar_892_0:
576  return (char*)"AntiKStar_892_0";
577  case K1_1400_Plus:
578  return (char*)"K1_1400_Plus";
579  case K1_1400_Minus:
580  return (char*)"K1_1400_Minus";
581  case b1_1235_Plus:
582  return (char*)"b1_1235_Plus";
583  case Sigma_1385_Minus:
584  return (char*)"Sigma_1385_Minus";
585  case Sigma_1385_0:
586  return (char*)"Sigma_1385_0";
587  case Sigma_1385_Plus:
588  return (char*)"Sigma_1385_Plus";
589  case DeltaPlusPlus:
590  return (char*)"DeltaPlusPlus";
591 
592  default:
593  return (char*)"x";
594  }
595 }
596 
597 inline static Particle_t ParticleEnum(const char* locParticleName)
598 {
599  if(strcmp(locParticleName, "Unknown") == 0)
600  return Unknown;
601  else if(strcmp(locParticleName, "Photon") == 0)
602  return Gamma;
603  else if(strcmp(locParticleName, "Positron") == 0)
604  return Positron;
605  else if(strcmp(locParticleName, "Electron") == 0)
606  return Electron;
607  else if(strcmp(locParticleName, "Neutrino") == 0)
608  return Neutrino;
609  else if(strcmp(locParticleName, "Muon+") == 0)
610  return MuonPlus;
611  else if(strcmp(locParticleName, "Muon-") == 0)
612  return MuonMinus;
613  else if(strcmp(locParticleName, "Pi0") == 0)
614  return Pi0;
615  else if(strcmp(locParticleName, "Pi+") == 0)
616  return PiPlus;
617  else if(strcmp(locParticleName, "Pi-") == 0)
618  return PiMinus;
619  else if(strcmp(locParticleName, "KLong") == 0)
620  return KLong;
621  else if(strcmp(locParticleName, "K+") == 0)
622  return KPlus;
623  else if(strcmp(locParticleName, "K-") == 0)
624  return KMinus;
625  else if(strcmp(locParticleName, "Neutron") == 0)
626  return Neutron;
627  else if(strcmp(locParticleName, "Proton") == 0)
628  return Proton;
629  else if(strcmp(locParticleName, "AntiProton") == 0)
630  return AntiProton;
631  else if(strcmp(locParticleName, "KShort") == 0)
632  return KShort;
633  else if(strcmp(locParticleName, "Eta") == 0)
634  return Eta;
635  else if(strcmp(locParticleName, "Lambda") == 0)
636  return Lambda;
637  else if(strcmp(locParticleName, "Sigma+") == 0)
638  return SigmaPlus;
639  else if(strcmp(locParticleName, "Sigma0") == 0)
640  return Sigma0;
641  else if(strcmp(locParticleName, "Sigma-") == 0)
642  return SigmaMinus;
643  else if(strcmp(locParticleName, "Xi0") == 0)
644  return Xi0;
645  else if(strcmp(locParticleName, "Xi-") == 0)
646  return XiMinus;
647  else if(strcmp(locParticleName, "Omega-") == 0)
648  return OmegaMinus;
649  else if(strcmp(locParticleName, "AntiNeutron") == 0)
650  return AntiNeutron;
651  else if(strcmp(locParticleName, "AntiLambda") == 0)
652  return AntiLambda;
653  else if(strcmp(locParticleName, "AntiSigma-") == 0)
654  return AntiSigmaMinus;
655  else if(strcmp(locParticleName, "AntiSigma0") == 0)
656  return AntiSigma0;
657  else if(strcmp(locParticleName, "AntiSigma+") == 0)
658  return AntiSigmaPlus;
659  else if(strcmp(locParticleName, "AntiXi0") == 0)
660  return AntiXi0;
661  else if(strcmp(locParticleName, "AntiXi+") == 0)
662  return AntiXiPlus;
663  else if(strcmp(locParticleName, "AntiOmega+") == 0)
664  return AntiOmegaPlus;
665  else if(strcmp(locParticleName, "Geantino") == 0)
666  return Geantino;
667  else if(strcmp(locParticleName, "Rho0") == 0)
668  return Rho0;
669  else if(strcmp(locParticleName, "Rho+") == 0)
670  return RhoPlus;
671  else if(strcmp(locParticleName, "Rho-") == 0)
672  return RhoMinus;
673  else if(strcmp(locParticleName, "Omega") == 0)
674  return omega;
675  else if(strcmp(locParticleName, "EtaPrime") == 0)
676  return EtaPrime;
677  else if(strcmp(locParticleName, "Phi") == 0)
678  return phiMeson;
679  else if(strcmp(locParticleName, "a0(980)") == 0)
680  return a0_980;
681  else if(strcmp(locParticleName, "f0(980)") == 0)
682  return f0_980;
683  else if(strcmp(locParticleName, "K*(892)0") == 0)
684  return KStar_892_0;
685  else if(strcmp(locParticleName, "K*(892)+") == 0)
686  return KStar_892_Plus;
687  else if(strcmp(locParticleName, "K*(892)-") == 0)
688  return KStar_892_Minus;
689  else if(strcmp(locParticleName, "antiK*(892)0") == 0)
690  return AntiKStar_892_0;
691  else if(strcmp(locParticleName, "K1(1400)+") == 0)
692  return K1_1400_Plus;
693  else if(strcmp(locParticleName, "K1(1400)-") == 0)
694  return K1_1400_Minus;
695  else if(strcmp(locParticleName, "b1(1235)+") == 0)
696  return b1_1235_Plus;
697  else if(strcmp(locParticleName, "Sigma(1385)-") == 0)
698  return Sigma_1385_Minus;
699  else if(strcmp(locParticleName, "Sigma(1385)0") == 0)
700  return Sigma_1385_0;
701  else if(strcmp(locParticleName, "Sigma(1385)+") == 0)
702  return Sigma_1385_Plus;
703  else if(strcmp(locParticleName, "Deuteron") == 0)
704  return Deuteron;
705  else if(strcmp(locParticleName, "Triton") == 0)
706  return Triton;
707  else if(strcmp(locParticleName, "Helium") == 0)
708  return Helium;
709  else if(strcmp(locParticleName, "Helium-3") == 0)
710  return He3;
711  else if(strcmp(locParticleName, "Pb208") == 0)
712  return Pb208;
713  else if(strcmp(locParticleName, "Delta++") == 0)
714  return DeltaPlusPlus;
715  else if(strcmp(locParticleName, "Jpsi") == 0)
716  return Jpsi;
717  else if(strcmp(locParticleName, "EtaC") == 0)
718  return Eta_c;
719  else if(strcmp(locParticleName, "ChiC0") == 0)
720  return Chi_c0;
721  else if(strcmp(locParticleName, "ChiC1") == 0)
722  return Chi_c1;
723  else if(strcmp(locParticleName, "ChiC2") == 0)
724  return Chi_c2;
725  else if(strcmp(locParticleName, "Psi(2S)") == 0)
726  return Psi2s;
727  else if(strcmp(locParticleName, "D0") == 0)
728  return D0;
729  else if(strcmp(locParticleName, "AntiD0") == 0)
730  return AntiD0;
731  else if(strcmp(locParticleName, "D+") == 0)
732  return DPlus;
733  else if(strcmp(locParticleName, "D*0") == 0)
734  return Dstar0;
735  else if(strcmp(locParticleName, "D*+") == 0)
736  return DstarPlus;
737  else if(strcmp(locParticleName, "LambdaC") == 0)
738  return Lambda_c;
739  else
740  return Unknown;
741 }
742 
743 inline static unsigned short int IsFixedMass(Particle_t p)
744 {
745  switch (p)
746  {
747  case Gamma: return 1;
748  case Positron: return 1;
749  case Electron: return 1;
750  case Neutrino: return 1;
751  case MuonPlus: return 1;
752  case MuonMinus: return 1;
753  case Pi0: return 1;
754  case PiPlus: return 1;
755  case PiMinus: return 1;
756  case KShort: return 1;
757  case KLong: return 1;
758  case KPlus: return 1;
759  case KMinus: return 1;
760  case Neutron: return 1;
761  case Proton: return 1;
762  case AntiProton: return 1;
763  case Eta: return 1;
764  case Lambda: return 1;
765  case SigmaPlus: return 1;
766  case Sigma0: return 1;
767  case SigmaMinus: return 1;
768  case Xi0: return 1;
769  case XiMinus: return 1;
770  case OmegaMinus: return 1;
771  case AntiNeutron: return 1;
772  case AntiLambda: return 1;
773  case AntiSigmaMinus: return 1;
774  case AntiSigma0: return 1;
775  case AntiSigmaPlus: return 1;
776  case AntiXi0: return 1;
777  case AntiXiPlus: return 1;
778  case AntiOmegaPlus: return 1;
779  case Geantino: return 1;
780  case EtaPrime: return 1;
781  case Deuteron: return 1;
782  case Triton: return 1;
783  case Helium: return 1;
784  case He3: return 1;
785  case Pb208: return 1;
786  case Jpsi: return 1;
787  //case eta_c: return 1;
788  //case chi_c0: return 1;
789  case Chi_c1: return 1;
790  case Chi_c2: return 1;
791  case Psi2s: return 1;
792  case D0: return 1;
793  case AntiD0: return 1;
794  case DPlus: return 1;
795  case Dstar0: return 1;
796  case DstarPlus: return 1;
797  case Lambda_c: return 1;
798  default: return 0;
799  }
800 }
801 
802 inline static unsigned short int IsResonance(Particle_t p)
803 {
804  p = RemapParticleID(p);
805 
806  if(IsFixedMass(p) == 1)
807  return 0;
808  if(p == Unknown)
809  return 0;
810  if(p == phiMeson)
811  return 0;
812  if(p == omega)
813  return 0;
814  return 1;
815 }
816 
817 inline static unsigned short int IsDetachedVertex(Particle_t p)
818 {
819  switch (p)
820  {
821  case MuonPlus: return 1;
822  case MuonMinus: return 1;
823  case PiPlus: return 1;
824  case PiMinus: return 1;
825  case KShort: return 1;
826  case KLong: return 1;
827  case KPlus: return 1;
828  case KMinus: return 1;
829  case Neutron: return 1;
830  case Lambda: return 1;
831  case SigmaPlus: return 1;
832  case SigmaMinus: return 1;
833  case Xi0: return 1;
834  case XiMinus: return 1;
835  case OmegaMinus: return 1;
836  case AntiNeutron: return 1;
837  case AntiLambda: return 1;
838  case AntiSigmaMinus: return 1;
839  case AntiSigmaPlus: return 1;
840  case AntiXi0: return 1;
841  case AntiXiPlus: return 1;
842  case AntiOmegaPlus: return 1;
843  case Deuteron: return 1;
844  case Triton: return 1;
845  case Helium: return 1;
846  case He3: return 1;
847  default: return 0;
848  }
849 }
850 
851 inline static char* ParticleName_ROOT(Particle_t p)
852 {
853  p = RemapParticleID(p);
854 
855  switch (p) {
856  case Unknown:
857  return (char*)"X";
858  case Gamma:
859  return (char*)"#gamma";
860  case Positron:
861  return (char*)"e^{#plus}";
862  case Electron:
863  return (char*)"e^{#minus}";
864  case Neutrino:
865  return (char*)"#nu";
866  case MuonPlus:
867  return (char*)"#mu^{#plus}";
868  case MuonMinus:
869  return (char*)"#mu^{#minus}";
870  case Pi0:
871  return (char*)"#pi^{0}";
872  case PiPlus:
873  return (char*)"#pi^{#plus}";
874  case PiMinus:
875  return (char*)"#pi^{#minus}";
876  case KLong:
877  return (char*)"K^{0}_{L}";
878  case KPlus:
879  return (char*)"K^{#plus}";
880  case KMinus:
881  return (char*)"K^{#minus}";
882  case Neutron:
883  return (char*)"n";
884  case Proton:
885  return (char*)"p";
886  case AntiProton:
887  return (char*)"#bar{p}";
888  case KShort:
889  return (char*)"K^{0}_{S}";
890  case Eta:
891  return (char*)"#eta";
892  case Lambda:
893  return (char*)"#Lambda";
894  case SigmaPlus:
895  return (char*)"#Sigma^{#plus}";
896  case Sigma0:
897  return (char*)"#Sigma^{0}";
898  case SigmaMinus:
899  return (char*)"#Sigma^{#minus}";
900  case Xi0:
901  return (char*)"#Xi^{0}";
902  case XiMinus:
903  return (char*)"#Xi^{#minus}";
904  case OmegaMinus:
905  return (char*)"#Omega^{#minus}";
906  case AntiNeutron:
907  return (char*)"#bar^{n}";
908  case AntiLambda:
909  return (char*)"#bar^{#Lambda}";
910  case AntiSigmaMinus:
911  return (char*)"#bar{#Sigma}^{#minus}";
912  case AntiSigma0:
913  return (char*)"#bar{#Sigma}^{0}";
914  case AntiSigmaPlus:
915  return (char*)"#bar{#Sigma}^{#plus}";
916  case AntiXi0:
917  return (char*)"#bar{#Xi}^{0}";
918  case AntiXiPlus:
919  return (char*)"#bar{#Xi}^{#plus}";
920  case AntiOmegaPlus:
921  return (char*)"#bar{#Omega}^{#plus}";
922  case Geantino:
923  return (char*)"geantino";
924  case Rho0:
925  return (char*)"#rho^{0}";
926  case RhoPlus:
927  return (char*)"#rho^{#plus}";
928  case RhoMinus:
929  return (char*)"#rho^{#minus}";
930  case omega:
931  return (char*)"#omega";
932  case EtaPrime:
933  return (char*)"#eta'";
934  case phiMeson:
935  return (char*)"#phi";
936  case a0_980:
937  return (char*)"a_{0}(980)";
938  case f0_980:
939  return (char*)"f_{0}(980)";
940  case KStar_892_0:
941  return (char*)"K*(892)^{0}";
942  case KStar_892_Plus:
943  return (char*)"K*(892)^{#plus}";
944  case KStar_892_Minus:
945  return (char*)"K*(892)^{#minus}";
946  case AntiKStar_892_0:
947  return (char*)"#bar{K*}(892)^{0}";
948  case K1_1400_Plus:
949  return (char*)"K_{1}(1400)^{#plus}";
950  case K1_1400_Minus:
951  return (char*)"K_{1}(1400)^{#minus}";
952  case b1_1235_Plus:
953  return (char*)"b_{1}(1235)^{#plus}";
954  case Deuteron:
955  return (char*)"d";
956  case Triton:
957  return (char*)"t";
958  case Helium:
959  return (char*)"He";
960  case He3:
961  return (char*)"3He";
962  case Pb208:
963  return (char*)"Pb^{208}";
964  case Sigma_1385_Minus:
965  return (char*)"#Sigma(1385)^{#minus}";
966  case Sigma_1385_0:
967  return (char*)"#Sigma(1385)^{0}";
968  case Sigma_1385_Plus:
969  return (char*)"#Sigma(1385)^{#plus}";
970  case DeltaPlusPlus:
971  return (char*)"#Delta(1232)^{#plus#plus}";
972  case Jpsi:
973  return (char*)"J/#psi";
974  case Eta_c:
975  return (char*)"#eta_{c}";
976  case Chi_c0:
977  return (char*)"#chi_{c0}";
978  case Chi_c1:
979  return (char*)"#chi_{c1}";
980  case Chi_c2:
981  return (char*)"#chi_{c2}";
982  case Psi2s:
983  return (char*)"#psi(2S)";
984  case D0:
985  return (char*)"D^{0}";
986  case AntiD0:
987  return (char*)"#bar{D^{0}}";
988  case DPlus:
989  return (char*)"D{^+}";
990  case Dstar0:
991  return (char*)"D^{*0}";
992  case DstarPlus:
993  return (char*)"D^{*+}";
994  case Lambda_c:
995  return (char*)"#Lambda_{c}";
996 
997  default:
998  return (char*)"X";
999  }
1000 }
1001 
1002 inline static double ParticleMass(Particle_t p)
1003 {
1004  p = RemapParticleID(p);
1005 
1006  switch (p) {
1007  case Unknown: return HUGE_VAL;
1008  case Gamma: return 0;
1009  case Positron: return 0.000510998928;
1010  case Electron: return 0.000510998928;
1011  case Neutrino: return 0;
1012  case MuonPlus: return 0.1056583715;
1013  case MuonMinus: return 0.1056583715;
1014  case Pi0: return 0.1349766;
1015  case PiPlus: return 0.13957018;
1016  case PiMinus: return 0.13957018;
1017  case KShort: return 0.497614;
1018  case KLong: return 0.497614;
1019  case KPlus: return 0.493677;
1020  case KMinus: return 0.493677;
1021  case Neutron: return 0.939565379;
1022  case Proton: return 0.938272046;
1023  case AntiProton: return 0.938272046;
1024  case Eta: return 0.547862;
1025  case Lambda: return 1.115683;
1026  case SigmaPlus: return 1.18937;
1027  case Sigma0: return 1.192642;
1028  case SigmaMinus: return 1.197449;
1029  case Xi0: return 1.31486;
1030  case XiMinus: return 1.32171;
1031  case OmegaMinus: return 1.67245;
1032  case AntiNeutron: return 0.939565379;
1033  case AntiLambda: return 1.115683;
1034  case AntiSigmaMinus: return 1.18937;
1035  case AntiSigma0: return 1.192642;
1036  case AntiSigmaPlus: return 1.197449;
1037  case AntiXi0: return 1.31486;
1038  case AntiXiPlus: return 1.32171;
1039  case AntiOmegaPlus: return 1.67245;
1040  case Geantino: return 0.0;
1041  case Rho0: return 0.7690; // neutral only, photoproduced and other reactions. e+ e- gives 775.26
1042  case RhoPlus: return 0.7665; // charged only, hadroproduced. tau decays and e+ e- gives 775.11
1043  case RhoMinus: return 0.7665;
1044  case omega: return 0.78265;
1045  case EtaPrime: return 0.95778;
1046  case phiMeson: return 1.019455;
1047  case a0_980: return 0.980;
1048  case f0_980: return 0.990;
1049  case KStar_892_0: return 0.89581; // neutral only
1050  case KStar_892_Plus: return 0.89166; // charged only, hadroproduced
1051  case KStar_892_Minus: return 0.89166; // charged only, hadroproduced
1052  case AntiKStar_892_0: return 0.89581; // neutral only
1053  case K1_1400_Plus: return 1.403;
1054  case K1_1400_Minus: return 1.403;
1055  case b1_1235_Plus: return 1.2295;
1056  case Deuteron: return 1.875612859; // from NIST
1057  case Triton: return 2.808921004; // from NIST 5.00735630 x 10^-27 kg
1058  case Helium: return 3.727379238; // from NIST 6.64465675 x 10-27 kg
1059  case He3: return 2.809413498;
1060  case Pb208: return 193.72899; // NIST gives 207.976627 AMU
1061  case Sigma_1385_Minus: return 1.3872;
1062  case Sigma_1385_0: return 1.3837;
1063  case Sigma_1385_Plus: return 1.38280;
1064  case DeltaPlusPlus: return 1.232;
1065  case Jpsi: return 3.069916;
1066  case Eta_c: return 2.9836;
1067  case Chi_c0: return 3.41475;
1068  case Chi_c1: return 3.51066;
1069  case Chi_c2: return 3.55620;
1070  case Psi2s: return 3.686109;
1071  case D0: return 1.86484;
1072  case AntiD0: return 1.86484;
1073  case DPlus: return 1.86961;
1074  case Dstar0: return 2.01026;
1075  case DstarPlus: return 2.00696;
1076  case Lambda_c: return 2.28646;
1077  default:
1078  fprintf(stderr,"ParticleMass: Error: Unknown particle type %d,",p);
1079  fprintf(stderr," returning HUGE_VAL...\n");
1080  return HUGE_VAL;
1081  }
1082 }
1083 
1084 inline static int ParticleCharge(Particle_t p)
1085 {
1086  p = RemapParticleID(p);
1087 
1088  switch (p) {
1089  case Unknown: return 0;
1090  case Gamma: return 0;
1091  case Positron: return +1;
1092  case Electron: return -1;
1093  case Neutrino: return 0;
1094  case MuonPlus: return +1;
1095  case MuonMinus: return -1;
1096  case Pi0: return 0;
1097  case PiPlus: return +1;
1098  case PiMinus: return -1;
1099  case KShort: return 0;
1100  case KLong: return 0;
1101  case KPlus: return +1;
1102  case KMinus: return -1;
1103  case Neutron: return 0;
1104  case Proton: return +1;
1105  case AntiProton: return -1;
1106  case Eta: return 0;
1107  case Lambda: return 0;
1108  case SigmaPlus: return +1;
1109  case Sigma0: return 0;
1110  case SigmaMinus: return -1;
1111  case Xi0: return 0;
1112  case XiMinus: return -1;
1113  case OmegaMinus: return -1;
1114  case AntiNeutron: return 0;
1115  case AntiLambda: return 0;
1116  case AntiSigmaMinus: return -1;
1117  case AntiSigma0: return 0;
1118  case AntiSigmaPlus: return +1;
1119  case AntiXi0: return 0;
1120  case AntiXiPlus: return +1;
1121  case AntiOmegaPlus: return +1;
1122  case Geantino: return 0;
1123  case Rho0: return 0;
1124  case RhoPlus: return +1;
1125  case RhoMinus: return -1;
1126  case omega: return 0;
1127  case EtaPrime: return 0;
1128  case phiMeson: return 0;
1129  case a0_980: return 0;
1130  case f0_980: return 0;
1131  case KStar_892_0: return 0;
1132  case KStar_892_Plus: return 1;
1133  case KStar_892_Minus: return -1;
1134  case AntiKStar_892_0: return 0;
1135  case K1_1400_Plus: return 1;
1136  case K1_1400_Minus: return -1;
1137  case b1_1235_Plus: return 1;
1138  case Deuteron: return 1;
1139  case Triton: return 1;
1140  case Helium: return 2;
1141  case He3: return 2;
1142  case Pb208: return 82;
1143  case Sigma_1385_Minus: return -1;
1144  case Sigma_1385_0: return 0;
1145  case Sigma_1385_Plus: return 1;
1146  case DeltaPlusPlus: return 2;
1147  case Jpsi: return 0;
1148  case Eta_c: return 0;
1149  case Chi_c0: return 0;
1150  case Chi_c1: return 0;
1151  case Chi_c2: return 0;
1152  case Psi2s: return 0;
1153  case D0: return 0;
1154  case AntiD0: return 0;
1155  case DPlus: return 1;
1156  case Dstar0: return 0;
1157  case DstarPlus: return 1;
1158  case Lambda_c: return 1;
1159 
1160  default:
1161  fprintf(stderr,"ParticleCharge: Error: Unknown particle type %d,",p);
1162  fprintf(stderr," returning 0...\n");
1163  return 0;
1164  }
1165 }
1166 
1167 inline static int PDGtype(Particle_t p)
1168 {
1169  p = RemapParticleID(p);
1170 
1171  switch (p) {
1172  case Unknown: return 0;
1173  case Gamma: return 22;
1174  case Positron: return -11;
1175  case Electron: return 11;
1176  case Neutrino: return 121416;
1177  case MuonPlus: return -13;
1178  case MuonMinus: return 13;
1179  case Pi0: return 111;
1180  case PiPlus: return 211;
1181  case PiMinus: return -211;
1182  case KShort: return 310;
1183  case KLong: return 130;
1184  case KPlus: return 321;
1185  case KMinus: return -321;
1186  case Neutron: return 2112;
1187  case Proton: return 2212;
1188  case AntiProton: return -2212;
1189  case Eta: return 221;
1190  case Lambda: return 3122;
1191  case SigmaPlus: return 3222;
1192  case Sigma0: return 3212;
1193  case SigmaMinus: return 3112;
1194  case Xi0: return 3322;
1195  case XiMinus: return 3312;
1196  case OmegaMinus: return 3334;
1197  case AntiNeutron: return -2112;
1198  case AntiLambda: return -3122;
1199  case AntiSigmaMinus: return -3112;
1200  case AntiSigma0: return -3212;
1201  case AntiSigmaPlus: return -3222;
1202  case AntiXi0: return -3322;
1203  case AntiXiPlus: return -3312;
1204  case AntiOmegaPlus: return -3334;
1205  case Geantino: return 0;
1206  case Rho0: return 113;
1207  case RhoPlus: return 213;
1208  case RhoMinus: return -213;
1209  case omega: return 223;
1210  case EtaPrime: return 331;
1211  case phiMeson: return 333;
1212  case a0_980: return 9000110;
1213  case f0_980: return 9010221;
1214  case KStar_892_0: return 313;
1215  case AntiKStar_892_0: return -313;
1216  case KStar_892_Plus: return 323;
1217  case KStar_892_Minus: return -323;
1218  case K1_1400_Plus: return 20323;
1219  case K1_1400_Minus: return -20323;
1220  case b1_1235_Plus: return 10213;
1221  case Deuteron: return 45;
1222  case Triton: return 46;
1223  case Helium: return 47;
1224  case He3: return 49;
1225  case Sigma_1385_Minus: return 3114;
1226  case Sigma_1385_0: return 3214;
1227  case Sigma_1385_Plus: return 3224;
1228  case Pb208: return 1000822080; // see note 14 in PDG (pg. 416 of 2012 full listing)
1229  case DeltaPlusPlus: return 2224;
1230  case Jpsi: return 443;
1231  case Eta_c: return 441;
1232  case Chi_c0: return 10441;
1233  case Chi_c1: return 20443;
1234  case Chi_c2: return 445;
1235  case Psi2s: return 100443;
1236  case D0: return 421;
1237  case AntiD0: return -421; //FIX!!
1238  case DPlus: return 411;
1239  case Dstar0: return 423;
1240  case DstarPlus: return 413;
1241  case Lambda_c: return 4122;
1242  default: return 0;
1243  }
1244 }
1245 
1246 inline static Particle_t PDGtoPType(int locPDG_PID)
1247 {
1248  switch (locPDG_PID) {
1249  case 0: return Unknown;
1250  case 22: return Gamma;
1251  case -11: return Positron;
1252  case 11: return Electron;
1253  case 121416: return Neutrino;
1254  case -13: return MuonPlus;
1255  case 13: return MuonMinus;
1256  case 111: return Pi0;
1257  case 211: return PiPlus;
1258  case -211: return PiMinus;
1259  case 310: return KShort;
1260  case 130: return KLong;
1261  case 321: return KPlus;
1262  case -321: return KMinus;
1263  case 2112: return Neutron;
1264  case 2212: return Proton;
1265  case -2212: return AntiProton;
1266  case 221: return Eta;
1267  case 3122: return Lambda;
1268  case 3222: return SigmaPlus;
1269  case 3212: return Sigma0;
1270  case 3112: return SigmaMinus;
1271  case 3322: return Xi0;
1272  case 3312: return XiMinus;
1273  case 3334: return OmegaMinus;
1274  case -2112: return AntiNeutron;
1275  case -3122: return AntiLambda;
1276  case -3112: return AntiSigmaMinus;
1277  case -3212: return AntiSigma0;
1278  case -3222: return AntiSigmaPlus;
1279  case -3322: return AntiXi0;
1280  case -3312: return AntiXiPlus;
1281  case -3334: return AntiOmegaPlus;
1282  case 113: return Rho0;
1283  case 213: return RhoPlus;
1284  case -213: return RhoMinus;
1285  case 223: return omega;
1286  case 331: return EtaPrime;
1287  case 333: return phiMeson;
1288  case 9000110: return a0_980;
1289  case 9010221: return f0_980;
1290  case 313: return KStar_892_0;
1291  case -313: return AntiKStar_892_0;
1292  case 323: return KStar_892_Plus;
1293  case -323: return KStar_892_Minus;
1294  case 20323: return K1_1400_Plus;
1295  case -20323: return K1_1400_Minus;
1296  case 10213: return b1_1235_Plus;
1297  case 45: return Deuteron;
1298  case 46: return Triton;
1299  case 47: return Helium;
1300  case 49: return He3;
1301  case 3114: return Sigma_1385_Minus;
1302  case 3214: return Sigma_1385_0;
1303  case 3224: return Sigma_1385_Plus;
1304  case 1000822080: return Pb208; // see note 14 in PDG (pg. 416 of 2012 full listing)
1305  case 2224: return DeltaPlusPlus;
1306  case 443: return Jpsi;
1307  case 441: return Eta_c;
1308  case 10441: return Chi_c0;
1309  case 20443: return Chi_c1;
1310  case 445: return Chi_c2;
1311  case 100443: return Psi2s;
1312  case 421: return D0;
1313  case -421: return AntiD0;
1314  case 411: return DPlus;
1315  case 423: return Dstar0;
1316  case 413: return DstarPlus;
1317  case 4122: return Lambda_c;
1318  default: return Unknown;
1319  }
1320 }
1321 
1322 inline static int Is_FinalStateParticle(Particle_t locPID)
1323 {
1324  switch(locPID)
1325  {
1326  case Gamma: return 1;
1327  case Positron: return 1;
1328  case Electron: return 1;
1329  case Neutrino: return 1;
1330  case MuonPlus: return 1;
1331  case MuonMinus: return 1;
1332  case PiPlus: return 1;
1333  case PiMinus: return 1;
1334  case KLong: return 1;
1335  case KPlus: return 1;
1336  case KMinus: return 1;
1337  case Neutron: return 1;
1338  case Proton: return 1;
1339  case AntiProton: return 1;
1340  case AntiNeutron: return 1;
1341  case Deuteron: return 1;
1342  case Triton: return 1;
1343  case Helium: return 1;
1344  case He3: return 1;
1345  case Pb208: return 1;
1346  default: return 0; //decaying
1347  }
1348 }
1349 
1350 inline static char* Get_ShortName(Particle_t locPID)
1351 {
1352  switch (locPID) {
1353  case Gamma:
1354  return (char*)"g";
1355  case Positron:
1356  return (char*)"ep";
1357  case Electron:
1358  return (char*)"em";
1359  case Neutrino:
1360  return (char*)"neut";
1361  case MuonPlus:
1362  return (char*)"mup";
1363  case MuonMinus:
1364  return (char*)"mum";
1365  case Pi0:
1366  return (char*)"pi0";
1367  case PiPlus:
1368  return (char*)"pip";
1369  case PiMinus:
1370  return (char*)"pim";
1371  case KLong:
1372  return (char*)"kl";
1373  case KPlus:
1374  return (char*)"kp";
1375  case KMinus:
1376  return (char*)"km";
1377  case Neutron:
1378  return (char*)"n";
1379  case Proton:
1380  return (char*)"p";
1381  case AntiProton:
1382  return (char*)"pbar";
1383  case KShort:
1384  return (char*)"ks";
1385  case Eta:
1386  return (char*)"eta";
1387 
1388  case Lambda:
1389  return (char*)"lamb";
1390  case SigmaPlus:
1391  return (char*)"sigp";
1392  case Sigma0:
1393  return (char*)"sig0";
1394  case SigmaMinus:
1395  return (char*)"sigm";
1396  case Xi0:
1397  return (char*)"xi0";
1398  case XiMinus:
1399  return (char*)"xim";
1400  case OmegaMinus:
1401  return (char*)"omgm";
1402 
1403  case AntiNeutron:
1404  return (char*)"nbar";
1405  case AntiLambda:
1406  return (char*)"lbar";
1407  case AntiSigmaMinus:
1408  return (char*)"sigmbar";
1409  case AntiSigma0:
1410  return (char*)"sig0bar";
1411  case AntiSigmaPlus:
1412  return (char*)"sigpbar";
1413  case AntiXi0:
1414  return (char*)"xi0bar";
1415  case AntiXiPlus:
1416  return (char*)"xipbar";
1417  case AntiOmegaPlus:
1418  return (char*)"omgpbar";
1419 
1420  case omega:
1421  return (char*)"omg";
1422  case EtaPrime:
1423  return (char*)"etap";
1424  case phiMeson:
1425  return (char*)"phi";
1426 
1427  case Deuteron:
1428  return (char*)"d";
1429  case Triton:
1430  return (char*)"tri";
1431  case Helium:
1432  return (char*)"he";
1433  case He3:
1434  return (char*)"he3";
1435  case Pb208:
1436  return (char*)"pb";
1437 
1438  case Jpsi:
1439  return (char*)"jpsi";
1440  case Eta_c:
1441  return (char*)"etac";
1442  case Chi_c0:
1443  return (char*)"chic0";
1444  case Chi_c1:
1445  return (char*)"chic1";
1446  case Chi_c2:
1447  return (char*)"chic2";
1448  case Psi2s:
1449  return (char*)"psi2S";
1450  case D0:
1451  return (char*)"d0";
1452  case AntiD0:
1453  return (char*)"d0bar";
1454  case DPlus:
1455  return (char*)"dp";
1456  case Lambda_c:
1457  return (char*)"lambc";
1458 
1459  default:
1460  return (char*)"Unknown";
1461  }
1462 }
1463 
1464 inline static int ParticleMultiplexPower(Particle_t locPID)
1465 {
1466  locPID = RemapParticleID(locPID);
1467 
1468  switch(locPID)
1469  {
1470  //FINAL-STATE PARTICLES (+ pi0) (decimal: 10^power):
1471  case Gamma: return 0;
1472  case Positron: return 1;
1473  case Electron: return 2;
1474  case Neutrino: return 3;
1475  case MuonPlus: return 4;
1476  case MuonMinus: return 5;
1477  case Pi0: return 6;
1478  case PiPlus: return 7;
1479  case PiMinus: return 8;
1480  case KLong: return 9;
1481  case KPlus: return 10;
1482  case KMinus: return 11;
1483  case Neutron: return 12;
1484  case Proton: return 13;
1485  case AntiProton: return 14;
1486  case AntiNeutron: return 15;
1487 
1488  //DECAYING PARTICLES (- pi0): (binary: 2^power)
1489  case KShort: return 0;
1490  case Eta: return 1;
1491  case Lambda: return 2;
1492  case SigmaPlus: return 3;
1493  case Sigma0: return 4;
1494  case SigmaMinus: return 5;
1495  case Xi0: return 6;
1496  case XiMinus: return 7;
1497  case OmegaMinus: return 8;
1498  case AntiLambda: return 9;
1499  case AntiSigmaMinus: return 10;
1500  case AntiSigma0: return 11;
1501  case AntiSigmaPlus: return 12;
1502  case AntiXi0: return 13;
1503  case AntiXiPlus: return 14;
1504  case AntiOmegaPlus: return 15;
1505  case Deuteron: return 16;
1506  case Rho0: return 17;
1507  case RhoPlus: return 18;
1508  case RhoMinus: return 19;
1509  case omega: return 20;
1510  case EtaPrime: return 21;
1511  case phiMeson: return 22;
1512  case a0_980: return 23;
1513  case f0_980: return 24;
1514  case KStar_892_0: return 25;
1515  case KStar_892_Plus: return 26;
1516  case KStar_892_Minus: return 27;
1517  case AntiKStar_892_0: return 28;
1518  case K1_1400_Plus: return 29;
1519  case K1_1400_Minus: return 30;
1520  case b1_1235_Plus: return 31;
1521  case Sigma_1385_Minus: return 32;
1522  case Sigma_1385_0: return 33;
1523  case Sigma_1385_Plus: return 34;
1524  case DeltaPlusPlus: return 35;
1525  case Jpsi: return 36;
1526  case Eta_c: return 37;
1527  case Chi_c0: return 38;
1528  case Chi_c1: return 39;
1529  case Chi_c2: return 40;
1530  case Psi2s: return 41;
1531  case D0: return 42;
1532  case DPlus: return 43;
1533  case Dstar0: return 44;
1534  case DstarPlus: return 45;
1535  case Lambda_c: return 46;
1536  case AntiD0: return 47;
1537  default: return -1;
1538  }
1539 }
1540 
1541 inline static Particle_t DemultiplexPID(int locBit, int locIsDecayingFlag)
1542 {
1543  //FINAL-STATE PARTICLES (+ pi0) (decimal: 10^power):
1544  if(locIsDecayingFlag == 0)
1545  {
1546  switch(locBit)
1547  {
1548  case 0: return Gamma;
1549  case 1: return Positron;
1550  case 2: return Electron;
1551  case 3: return Neutrino;
1552  case 4: return MuonPlus;
1553  case 5: return MuonMinus;
1554  case 6: return Pi0;
1555  case 7: return PiPlus;
1556  case 8: return PiMinus;
1557  case 9: return KLong;
1558  case 10: return KPlus;
1559  case 11: return KMinus;
1560  case 12: return Neutron;
1561  case 13: return Proton;
1562  case 14: return AntiProton;
1563  case 15: return AntiNeutron;
1564  default: return Unknown;
1565  }
1566  }
1567 
1568  //DECAYING PARTICLES (- pi0): (binary: 2^power)
1569  switch(locBit)
1570  {
1571  case 0: return KShort;
1572  case 1: return Eta;
1573  case 2: return Lambda;
1574  case 3: return SigmaPlus;
1575  case 4: return Sigma0;
1576  case 5: return SigmaMinus;
1577  case 6: return Xi0;
1578  case 7: return XiMinus;
1579  case 8: return OmegaMinus;
1580  case 9: return AntiLambda;
1581  case 10: return AntiSigmaMinus;
1582  case 11: return AntiSigma0;
1583  case 12: return AntiSigmaPlus;
1584  case 13: return AntiXi0;
1585  case 14: return AntiXiPlus;
1586  case 15: return AntiOmegaPlus;
1587  case 16: return Deuteron;
1588  case 17: return Rho0;
1589  case 18: return RhoPlus;
1590  case 19: return RhoMinus;
1591  case 20: return omega;
1592  case 21: return EtaPrime;
1593  case 22: return phiMeson;
1594  case 23: return a0_980;
1595  case 24: return f0_980;
1596  case 25: return KStar_892_0;
1597  case 26: return KStar_892_Plus;
1598  case 27: return KStar_892_Minus;
1599  case 28: return AntiKStar_892_0;
1600  case 29: return K1_1400_Plus;
1601  case 30: return K1_1400_Minus;
1602  case 31: return b1_1235_Plus;
1603  case 32: return Sigma_1385_Minus;
1604  case 33: return Sigma_1385_0;
1605  case 34: return Sigma_1385_Plus;
1606  case 35: return DeltaPlusPlus;
1607  case 36: return Jpsi;
1608  case 37: return Eta_c;
1609  case 38: return Chi_c0;
1610  case 39: return Chi_c1;
1611  case 40: return Chi_c2;
1612  case 41: return Psi2s;
1613  case 42: return D0;
1614  case 43: return DPlus;
1615  case 44: return Dstar0;
1616  case 45: return DstarPlus;
1617  case 46: return Lambda_c;
1618  case 47: return AntiD0;
1619  default: return Unknown;
1620  }
1621 }
1622 
1623 typedef enum
1624 {
1630 } Charge_t;
1631 
1632 inline static int Is_CorrectCharge(Particle_t locPID, Charge_t locCharge)
1633 {
1634  if(locPID == Unknown)
1635  return (locCharge == d_AllCharges);
1636  int locIntCharge = ParticleCharge(locPID);
1637  switch(locCharge)
1638  {
1639  case d_Neutral:
1640  return (locIntCharge == 0);
1641  case d_Positive:
1642  return (locIntCharge > 0);
1643  case d_Negative:
1644  return (locIntCharge < 0);
1645  case d_Charged:
1646  return (locIntCharge != 0);
1647  case d_AllCharges:
1648  return 1;
1649  default:
1650  return 0;
1651  }
1652 }
1653 
1654 // Deduce particle type from charge and mass
1655 inline static Particle_t IDTrack(float locCharge, float locMass)
1656 {
1657  float locMassTolerance = 0.010;
1658  if (locCharge > 0.1) // Positive particles
1659  {
1660  if (fabs(locMass - ParticleMass(Proton)) < locMassTolerance) return Proton;
1661  if (fabs(locMass - ParticleMass(PiPlus)) < locMassTolerance) return PiPlus;
1662  if (fabs(locMass - ParticleMass(KPlus)) < locMassTolerance) return KPlus;
1663  if (fabs(locMass - ParticleMass(Positron)) < locMassTolerance) return Positron;
1664  if (fabs(locMass - ParticleMass(MuonPlus)) < locMassTolerance) return MuonPlus;
1665  }
1666  else if(locCharge < -0.1) // Negative particles
1667  {
1668  if (fabs(locMass - ParticleMass(PiMinus)) < locMassTolerance) return PiMinus;
1669  if (fabs(locMass - ParticleMass(KMinus)) < locMassTolerance) return KMinus;
1670  if (fabs(locMass - ParticleMass(MuonMinus)) < locMassTolerance) return MuonMinus;
1671  if (fabs(locMass - ParticleMass(Electron)) < locMassTolerance) return Electron;
1672  if (fabs(locMass - ParticleMass(AntiProton)) < locMassTolerance) return AntiProton;
1673  }
1674  else //Neutral Track
1675  {
1676  if (fabs(locMass - ParticleMass(Gamma)) < locMassTolerance) return Gamma;
1677  if (fabs(locMass - ParticleMass(Neutron)) < locMassTolerance) return Neutron;
1678  }
1679  return Unknown;
1680 }
1681 
1682 
1683 #endif
static char * ParticleName_ROOT(Particle_t p)
Definition: particleType.h:851
static Particle_t ParticleEnum(const char *locParticleName)
Definition: particleType.h:597
static Particle_t RemapParticleID(Particle_t p)
Definition: particleType.h:126
static unsigned short int IsResonance(Particle_t p)
Definition: particleType.h:802
static Particle_t PDGtoPType(int locPDG_PID)
static unsigned short int IsDetachedVertex(Particle_t p)
Definition: particleType.h:817
static char * ParticleType(Particle_t p)
Definition: particleType.h:142
static int ParticleMultiplexPower(Particle_t locPID)
static int ParticleCharge(Particle_t p)
static int PDGtype(Particle_t p)
Charge_t
static Particle_t DemultiplexPID(int locBit, int locIsDecayingFlag)
static unsigned short int IsFixedMass(Particle_t p)
Definition: particleType.h:743
static char * Get_ShortName(Particle_t locPID)
static int IsLepton(Particle_t p)
Definition: particleType.h:137
static int Is_FinalStateParticle(Particle_t locPID)
static int Is_CorrectCharge(Particle_t locPID, Charge_t locCharge)
static double ParticleMass(Particle_t p)
static char * ShortName(Particle_t locPID)
Definition: particleType.h:443
static char * EnumString(Particle_t p)
Definition: particleType.h:292
static Particle_t IDTrack(float locCharge, float locMass)
Particle_t
Definition: particleType.h:12