Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:02

0001 /*
0002  * particleType.h
0003 */
0004 
0005 #ifndef particleTypeH_INCLUDED
0006 #define particleTypeH_INCLUDED
0007 
0008 #include <math.h>
0009 #include <stdio.h>
0010 #include <string.h>
0011 
0012 typedef enum {
0013 
0014   /* An extensive list of the GEANT3 particle
0015    * codes can be found here:
0016    * http://wwwasdoc.web.cern.ch/wwwasdoc/geant/node72.html
0017   */
0018 
0019   Unknown        =  0,
0020   Gamma          =  1,
0021   Positron       =  2,
0022   Electron       =  3,
0023   Neutrino       =  4,
0024   MuonPlus       =  5,
0025   MuonMinus      =  6,
0026   Pi0            =  7,
0027   PiPlus         =  8,
0028   PiMinus        =  9,
0029   KLong          = 10,
0030   KPlus          = 11,
0031   KMinus         = 12,
0032   Neutron        = 13,
0033   Proton         = 14,
0034   AntiProton     = 15,
0035   KShort         = 16,
0036   Eta            = 17,
0037   Lambda         = 18,
0038   SigmaPlus      = 19,
0039   Sigma0         = 20,
0040   SigmaMinus     = 21,
0041   Xi0            = 22,
0042   XiMinus        = 23,
0043   OmegaMinus     = 24,
0044   AntiNeutron    = 25,
0045   AntiLambda     = 26,
0046   AntiSigmaMinus = 27,
0047   AntiSigma0     = 28,
0048   AntiSigmaPlus  = 29,
0049   AntiXi0        = 30,
0050   AntiXiPlus     = 31,
0051   AntiOmegaPlus  = 32,
0052   Deuteron       = 45,
0053   Triton         = 46,
0054   Helium         = 47,
0055   Geantino       = 48,
0056   He3            = 49,
0057 
0058   Li6            = 61,
0059   Li7            = 62,
0060   Be7            = 63,
0061   Be9            = 64,
0062   B10            = 65,
0063   B11            = 66,
0064   C12            = 67,
0065   N14            = 68,
0066   O16            = 69,
0067   F19            = 70,
0068   Ne20           = 71,
0069   Na23           = 72,
0070   Mg24           = 73,
0071   Al27           = 74,
0072   Si28           = 75,
0073   P31            = 76,
0074   S32            = 77,
0075   Cl35           = 78,
0076   Ar36           = 79,
0077   K39            = 80,
0078   Ca40           = 81,
0079   Sc45           = 82,
0080   Ti48           = 83,
0081   V51            = 84,
0082   Cr52           = 85,
0083   Mn55           = 86,
0084   Fe56           = 87,
0085   Co59           = 88,
0086   Ni58           = 89,
0087   Cu63           = 90,
0088   Zn64           = 91,
0089   Ge74           = 92,
0090   Se80           = 93,
0091   Kr84           = 94,
0092   Sr88           = 95,
0093   Zr90           = 96,
0094   Mo98           = 97,
0095   Pd106          = 98,
0096   Cd114          = 99,
0097   Sn120          = 100,
0098   Xe132          = 101,
0099   Ba138          = 102,
0100   Ce140          = 103,
0101   Sm152          = 104,
0102   Dy164          = 105,
0103   Yb174          = 106,
0104   W184           = 107,
0105   Pt194          = 108,
0106   Au197          = 109,
0107   Hg202          = 110,
0108   Pb208          = 111,
0109   U238           = 112,
0110 
0111   /* the constants defined by GEANT end here */
0112   
0113   /*
0114    * Several particle codes are added below which did
0115    * not overlap with the original GEANT particle list.
0116    * However, the link above has several other particle
0117    * codes added which do actually overlap. Because of 
0118    * this, each of the values below was increased by
0119    * 100 so that they don't overlap with any of the new
0120    * codes and they can be used.
0121   */
0122   
0123 
0124   /* These are E852-defined constants */
0125   Rho0           = 44, // was 157
0126   RhoPlus        = 42, // was 158
0127   RhoMinus       = 43, // was 159
0128   omega          = 33,  // was 160
0129   phiMeson       = 34,  // was 162
0130   EtaPrime       = 35,  // was 161
0131   //Rho0           = 157,
0132   //RhoPlus        = 158,
0133   //RhoMinus       = 159,
0134   //omega          = 160,
0135   //EtaPrime       = 161,
0136   //phiMeson       = 162,
0137   a0_980     = 163,
0138   f0_980     = 164,
0139 
0140   /* These are GlueX-defined constants */
0141 
0142   KStar_892_0 = 165,
0143   KStar_892_Plus = 166,
0144   KStar_892_Minus = 167,
0145   AntiKStar_892_0 = 168,
0146 
0147   K1_1400_Plus = 169,
0148   K1_1400_Minus = 170,
0149 
0150   b1_1235_Plus = 171,
0151   Sigma_1385_Minus = 172,
0152   Sigma_1385_0 = 173,
0153   Sigma_1385_Plus = 174,
0154 
0155   Jpsi = 183,
0156   Eta_c = 184,
0157   Chi_c0 = 185,
0158   Chi_c1 = 186,
0159   Chi_c2 = 187,
0160   Psi2s = 188,
0161   D0 = 189,
0162   DPlus = 190,
0163   Dstar0 = 191,
0164   DstarPlus = 192,
0165   Lambda_c = 193,
0166   AntiD0 = 194, 
0167 
0168   /* These are defined in pythia-geant.map in bggen */
0169 
0170   //Rho0          = 80,  // already defined above (44)
0171   //omega         = 81,  // already defined above (33)
0172   DeltaPlusPlus = 182
0173 
0174 
0175 } Particle_t;
0176 
0177 static inline Particle_t RemapParticleID(Particle_t p)
0178 {
0179   // bggen defines these in pythia-geant.dat. However,
0180   // they are not the same as the definitions used from
0181   // E-852 in the enum above. Remap them using this routine
0182   // which is called from several of the routines below.
0183   //if(p==80) return Rho0;
0184   //if(p==81) return omega;
0185   return p;
0186 }
0187 
0188 inline static int IsLepton(Particle_t p)
0189 {
0190     return ((p == Electron) || (p == Positron) || (p == MuonPlus) || (p == MuonMinus) || (p == Neutrino));
0191 }
0192 
0193 inline static char* ParticleType(Particle_t p)
0194 {
0195   p = RemapParticleID(p);
0196 
0197   switch (p) {
0198   case Unknown:
0199     return (char*)"Unknown";
0200   case Gamma:
0201     return (char*)"Photon";
0202   case Positron:
0203     return (char*)"Positron";
0204   case Electron:
0205     return (char*)"Electron";
0206   case Neutrino:
0207     return (char*)"Neutrino";
0208   case MuonPlus:
0209     return (char*)"Muon+";
0210   case MuonMinus:
0211     return (char*)"Muon-";
0212   case Pi0:
0213     return (char*)"Pi0";
0214   case PiPlus:
0215     return (char*)"Pi+";
0216   case PiMinus:
0217     return (char*)"Pi-";
0218   case KLong:
0219     return (char*)"KLong";
0220   case KPlus:
0221     return (char*)"K+";
0222   case KMinus:
0223     return (char*)"K-";
0224   case Neutron:
0225     return (char*)"Neutron";
0226   case Proton:
0227     return (char*)"Proton";
0228   case AntiProton:
0229     return (char*)"AntiProton";
0230   case KShort:
0231     return (char*)"KShort";
0232   case Eta:
0233     return (char*)"Eta";
0234   case Lambda:
0235     return (char*)"Lambda";
0236   case SigmaPlus:
0237     return (char*)"Sigma+";
0238   case Sigma0:
0239     return (char*)"Sigma0";
0240   case SigmaMinus:
0241     return (char*)"Sigma-";
0242   case Xi0:
0243     return (char*)"Xi0";
0244   case XiMinus:
0245     return (char*)"Xi-";
0246   case OmegaMinus:
0247     return (char*)"Omega-";
0248   case AntiNeutron:
0249     return (char*)"AntiNeutron";
0250   case AntiLambda:
0251     return (char*)"AntiLambda";
0252   case AntiSigmaMinus:
0253     return (char*)"AntiSigma-";
0254   case AntiSigma0:
0255     return (char*)"AntiSigma0";
0256   case AntiSigmaPlus:
0257     return (char*)"AntiSigma+";
0258   case AntiXi0:
0259     return (char*)"AntiXi0";
0260   case AntiXiPlus:
0261     return (char*)"AntiXi+";
0262   case AntiOmegaPlus:
0263     return (char*)"AntiOmega+";
0264   case Geantino:
0265     return (char*)"Geantino";
0266   case Rho0:
0267     return (char*)"Rho0";
0268   case RhoPlus:
0269     return (char*)"Rho+";
0270   case RhoMinus:
0271     return (char*)"Rho-";
0272   case omega:
0273     return (char*)"Omega";
0274   case EtaPrime:
0275     return (char*)"EtaPrime";
0276   case phiMeson:
0277     return (char*)"Phi";
0278   case a0_980:
0279     return (char*)"a0(980)";
0280   case f0_980:
0281     return (char*)"f0(980)";
0282   case KStar_892_0:
0283     return (char*)"K*(892)0";
0284   case KStar_892_Plus:
0285     return (char*)"K*(892)+";
0286   case KStar_892_Minus:
0287     return (char*)"K*(892)-";
0288   case AntiKStar_892_0:
0289     return (char*)"antiK*(892)0";
0290   case K1_1400_Plus:
0291     return (char*)"K1(1400)+";
0292   case K1_1400_Minus:
0293     return (char*)"K1(1400)-";
0294   case b1_1235_Plus:
0295     return (char*)"b1(1235)+";
0296   case Sigma_1385_Minus:
0297     return (char*)"Sigma(1385)-";
0298   case Sigma_1385_0:
0299     return (char*)"Sigma(1385)0";
0300   case Sigma_1385_Plus:
0301     return (char*)"Sigma(1385)+";
0302   case Deuteron:
0303     return (char*)"Deuteron";
0304   case Triton:
0305     return (char*)"Triton";
0306   case Helium:
0307     return (char*)"Helium";
0308   case He3:
0309     return (char*)"Helium-3";
0310   case Li6:
0311     return (char*)"Lithium-6";
0312   case Li7:
0313     return (char*)"Lithium-7";
0314   case Be7:
0315     return (char*)"Beryllium-7";
0316   case Be9:
0317     return (char*)"Beryllium-9";
0318   case B10:
0319     return (char*)"Boron-10";
0320   case B11:
0321     return (char*)"Boron-11";
0322   case C12:
0323     return (char*)"Carbon";
0324   case N14:
0325     return (char*)"Nitrogen";
0326   case O16:
0327     return (char*)"Oxygen";
0328   case F19:
0329     return (char*)"Fluorine";
0330   case Ne20:
0331     return (char*)"Neon";
0332   case Na23:
0333     return (char*)"Sodium";
0334   case Mg24:
0335     return (char*)"Magnesium";
0336   case Al27:
0337     return (char*)"Aluminum";
0338   case Si28:
0339     return (char*)"Silicon";
0340   case P31:
0341     return (char*)"Phosphorous";
0342   case S32:
0343     return (char*)"Sulphur";
0344   case Cl35:
0345     return (char*)"Chlorine";
0346   case Ar36:
0347     return (char*)"Argon";
0348   case K39:
0349     return (char*)"Potassium";
0350   case Ca40:
0351     return (char*)"Calcium";
0352   case Sc45:
0353     return (char*)"Scandium";
0354   case Ti48:
0355     return (char*)"Titanium";
0356   case V51:
0357     return (char*)"Vanadium";
0358   case Cr52:
0359     return (char*)"Chromium";
0360   case Mn55:
0361     return (char*)"Manganese";
0362   case Fe56:
0363     return (char*)"Iron";
0364   case Co59:
0365     return (char*)"Cobalt";
0366   case Ni58:
0367     return (char*)"Nickel";
0368   case Cu63:
0369     return (char*)"Copper";
0370   case Zn64:
0371     return (char*)"Zinc";
0372   case Ge74:
0373     return (char*)"Germanium";
0374   case Se80:
0375     return (char*)"Selenium";
0376   case Kr84:
0377     return (char*)"Krypton";
0378   case Sr88:
0379     return (char*)"Strontium";
0380   case Zr90:
0381     return (char*)"Zirconium";
0382   case Mo98:
0383     return (char*)"Molybdenum";
0384   case Pd106:
0385     return (char*)"Palladium";
0386   case Cd114:
0387     return (char*)"Cadmium";
0388   case Sn120:
0389     return (char*)"Tin";
0390   case Xe132:
0391     return (char*)"Xenon";
0392   case Ba138:
0393     return (char*)"Barium";
0394   case Ce140:
0395     return (char*)"Cesium";
0396   case Sm152:
0397     return (char*)"Samerium";
0398   case Dy164:
0399     return (char*)"Dysprosium";
0400   case Yb174:
0401     return (char*)"Ytterbium";
0402   case W184:
0403     return (char*)"Tungsten";
0404   case Pt194:
0405     return (char*)"Platium";
0406   case Au197:
0407     return (char*)"Gold";
0408   case Hg202:
0409     return (char*)"Mercury";
0410   case Pb208:
0411     return (char*)"Lead";
0412   case U238:
0413     return (char*)"Uranium";
0414   case DeltaPlusPlus:
0415     return (char*)"Delta++";
0416   case Jpsi:
0417     return (char*)"Jpsi";
0418   case Eta_c:
0419     return (char*)"EtaC";
0420   case Chi_c0:
0421     return (char*)"ChiC0";
0422   case Chi_c1:
0423     return (char*)"ChiC1";
0424   case Chi_c2:
0425     return (char*)"ChiC2";
0426   case Psi2s:
0427     return (char*)"Psi(2S)";
0428   case D0:
0429     return (char*)"D0";
0430   case AntiD0:
0431     return (char*)"AntiD0";
0432   case DPlus:
0433     return (char*)"D+";
0434   case Dstar0:
0435     return (char*)"D*0";
0436   case DstarPlus:
0437     return (char*)"D*+";
0438   case Lambda_c:
0439     return (char*)"LambdaC";
0440   default:
0441     return (char*)"Unknown";
0442   }
0443 }
0444 
0445 inline static char* EnumString(Particle_t p)
0446 {
0447   //returns string that is exact match to enum name. for auto-generating code
0448   p = RemapParticleID(p);
0449 
0450   switch (p) {
0451   case Unknown:
0452     return (char*)"Unknown";
0453   case Gamma:
0454     return (char*)"Gamma";
0455   case Positron:
0456     return (char*)"Positron";
0457   case Electron:
0458     return (char*)"Electron";
0459   case Neutrino:
0460     return (char*)"Neutrino";
0461   case MuonPlus:
0462     return (char*)"MuonPlus";
0463   case MuonMinus:
0464     return (char*)"MuonMinus";
0465   case Pi0:
0466     return (char*)"Pi0";
0467   case PiPlus:
0468     return (char*)"PiPlus";
0469   case PiMinus:
0470     return (char*)"PiMinus";
0471   case KLong:
0472     return (char*)"KLong";
0473   case KPlus:
0474     return (char*)"KPlus";
0475   case KMinus:
0476     return (char*)"KMinus";
0477   case Neutron:
0478     return (char*)"Neutron";
0479   case Proton:
0480     return (char*)"Proton";
0481   case AntiProton:
0482     return (char*)"AntiProton";
0483   case KShort:
0484     return (char*)"KShort";
0485   case Eta:
0486     return (char*)"Eta";
0487   case Lambda:
0488     return (char*)"Lambda";
0489   case SigmaPlus:
0490     return (char*)"SigmaPlus";
0491   case Sigma0:
0492     return (char*)"Sigma0";
0493   case SigmaMinus:
0494     return (char*)"SigmaMinus";
0495   case Xi0:
0496     return (char*)"Xi0";
0497   case XiMinus:
0498     return (char*)"XiMinus";
0499   case OmegaMinus:
0500     return (char*)"OmegaMinus";
0501   case AntiNeutron:
0502     return (char*)"AntiNeutron";
0503   case AntiLambda:
0504     return (char*)"AntiLambda";
0505   case AntiSigmaMinus:
0506     return (char*)"AntiSigmaMinus";
0507   case AntiSigma0:
0508     return (char*)"AntiSigma0";
0509   case AntiSigmaPlus:
0510     return (char*)"AntiSigmaPlus";
0511   case AntiXi0:
0512     return (char*)"AntiXi0";
0513   case AntiXiPlus:
0514     return (char*)"AntiXiPlus";
0515   case AntiOmegaPlus:
0516     return (char*)"AntiOmegaPlus";
0517   case Geantino:
0518     return (char*)"Geantino";
0519   case Rho0:
0520     return (char*)"Rho0";
0521   case RhoPlus:
0522     return (char*)"RhoPlus";
0523   case RhoMinus:
0524     return (char*)"RhoMinus";
0525   case omega:
0526     return (char*)"omega";
0527   case EtaPrime:
0528     return (char*)"EtaPrime";
0529   case phiMeson:
0530     return (char*)"phiMeson";
0531   case a0_980:
0532     return (char*)"a0_980";
0533   case f0_980:
0534     return (char*)"f0_980";
0535   case KStar_892_0:
0536     return (char*)"KStar_892_0";
0537   case KStar_892_Plus:
0538     return (char*)"KStar_892_Plus";
0539   case KStar_892_Minus:
0540     return (char*)"KStar_892_Minus";
0541   case AntiKStar_892_0:
0542     return (char*)"AntiKStar_892_0";
0543   case K1_1400_Plus:
0544     return (char*)"K1_1400_Plus";
0545   case K1_1400_Minus:
0546     return (char*)"K1_1400_Minus";
0547   case b1_1235_Plus:
0548     return (char*)"b1_1235_Plus";
0549   case Sigma_1385_Minus:
0550     return (char*)"Sigma_1385_Minus";
0551   case Sigma_1385_0:
0552     return (char*)"Sigma_1385_0";
0553   case Sigma_1385_Plus:
0554     return (char*)"Sigma_1385_Plus";
0555   case Deuteron:
0556     return (char*)"Deuteron";
0557   case Triton:
0558     return (char*)"Triton";
0559   case Helium:
0560     return (char*)"Helium";
0561   case He3:
0562     return (char*)"Helium-3";
0563   case Li6:
0564     return (char*)"Lithium-6";
0565   case Li7:
0566     return (char*)"Lithium-7";
0567   case Be7:
0568     return (char*)"Beryllium-7";
0569   case Be9:
0570     return (char*)"Beryllium-9";
0571   case B10:
0572     return (char*)"Boron-10";
0573   case B11:
0574     return (char*)"Boron-11";
0575   case C12:
0576     return (char*)"Carbon";
0577   case N14:
0578     return (char*)"Nitrogen";
0579   case O16:
0580     return (char*)"Oxygen";
0581   case F19:
0582     return (char*)"Fluorine";
0583   case Ne20:
0584     return (char*)"Neon";
0585   case Na23:
0586     return (char*)"Sodium";
0587   case Mg24:
0588     return (char*)"Magnesium";
0589   case Al27:
0590     return (char*)"Aluminum";
0591   case Si28:
0592     return (char*)"Silicon";
0593   case P31:
0594     return (char*)"Phosphorous";
0595   case S32:
0596     return (char*)"Sulphur";
0597   case Cl35:
0598     return (char*)"Chlorine";
0599   case Ar36:
0600     return (char*)"Argon";
0601   case K39:
0602     return (char*)"Potassium";
0603   case Ca40:
0604     return (char*)"Calcium";
0605   case Sc45:
0606     return (char*)"Scandium";
0607   case Ti48:
0608     return (char*)"Titanium";
0609   case V51:
0610     return (char*)"Vanadium";
0611   case Cr52:
0612     return (char*)"Chromium";
0613   case Mn55:
0614     return (char*)"Manganese";
0615   case Fe56:
0616     return (char*)"Iron";
0617   case Co59:
0618     return (char*)"Cobalt";
0619   case Ni58:
0620     return (char*)"Nickel";
0621   case Cu63:
0622     return (char*)"Copper";
0623   case Zn64:
0624     return (char*)"Zinc";
0625   case Ge74:
0626     return (char*)"Germanium";
0627   case Se80:
0628     return (char*)"Selenium";
0629   case Kr84:
0630     return (char*)"Krypton";
0631   case Sr88:
0632     return (char*)"Strontium";
0633   case Zr90:
0634     return (char*)"Zirconium";
0635   case Mo98:
0636     return (char*)"Molybdenum";
0637   case Pd106:
0638     return (char*)"Palladium";
0639   case Cd114:
0640     return (char*)"Cadmium";
0641   case Sn120:
0642     return (char*)"Tin";
0643   case Xe132:
0644     return (char*)"Xenon";
0645   case Ba138:
0646     return (char*)"Barium";
0647   case Ce140:
0648     return (char*)"Cesium";
0649   case Sm152:
0650     return (char*)"Samerium";
0651   case Dy164:
0652     return (char*)"Dysprosium";
0653   case Yb174:
0654     return (char*)"Ytterbium";
0655   case W184:
0656     return (char*)"Tungsten";
0657   case Pt194:
0658     return (char*)"Platium";
0659   case Au197:
0660     return (char*)"Gold";
0661   case Hg202:
0662     return (char*)"Mercury";
0663   case Pb208:
0664     return (char*)"Lead";
0665   case U238:
0666     return (char*)"Uranium";
0667   case DeltaPlusPlus:
0668     return (char*)"DeltaPlusPlus";
0669   case Jpsi:
0670     return (char*)"Jpsi";
0671   case Eta_c:
0672     return (char*)"Eta_c";
0673   case Chi_c0:
0674     return (char*)"Chi_c0";
0675   case Chi_c1:
0676     return (char*)"Chi_c1";
0677   case Chi_c2:
0678     return (char*)"Chi_c2";
0679   case Psi2s:
0680     return (char*)"Psi2s";
0681   case D0:
0682     return (char*)"D0";
0683   case AntiD0:
0684     return (char*)"AntiD0";
0685   case DPlus:
0686     return (char*)"DPlus";
0687   case Dstar0:
0688     return (char*)"Dstar0";
0689   case DstarPlus:
0690     return (char*)"DstarPlus";
0691   case Lambda_c:
0692     return (char*)"Lambda_c";
0693   default:
0694     return (char*)"Unknown";
0695   }
0696 }
0697 
0698 inline static char* EvtGenString(Particle_t p)
0699 {
0700   //returns string that is exact match to enum name. for auto-generating code
0701   p = RemapParticleID(p);
0702 
0703   switch (p) {
0704   case Unknown:
0705     return (char*)"Unknown";
0706   case Gamma:
0707     return (char*)"gamma";
0708   case Positron:
0709     return (char*)"e+";
0710   case Electron:
0711     return (char*)"e-";
0712   case Neutrino:
0713     return (char*)"nu_e";
0714   case MuonPlus:
0715     return (char*)"mu+";
0716   case MuonMinus:
0717     return (char*)"mu-";
0718   case Pi0:
0719     return (char*)"pi0";
0720   case PiPlus:
0721     return (char*)"pi+";
0722   case PiMinus:
0723     return (char*)"pi-";
0724   case KLong:
0725     return (char*)"K_L0";
0726   case KPlus:
0727     return (char*)"K+";
0728   case KMinus:
0729     return (char*)"K-";
0730   case Neutron:
0731     return (char*)"n0";
0732   case Proton:
0733     return (char*)"p+";
0734   case AntiProton:
0735     return (char*)"anti-p-";
0736   case KShort:
0737     return (char*)"K_S0";
0738   case Eta:
0739     return (char*)"eta";
0740   case Lambda:
0741     return (char*)"Lambda0";
0742   case SigmaPlus:
0743     return (char*)"Sigma+";
0744   case Sigma0:
0745     return (char*)"Sigma0";
0746   case SigmaMinus:
0747     return (char*)"Sigma-";
0748   case Xi0:
0749     return (char*)"Xi0";
0750   case XiMinus:
0751     return (char*)"Xi-";
0752   case OmegaMinus:
0753     return (char*)"Omega-";
0754   case AntiNeutron:
0755     return (char*)"anti-n0";
0756   case AntiLambda:
0757     return (char*)"anti-Lambda0";
0758   case AntiSigmaMinus:
0759     return (char*)"anti-Sigma-";
0760   case AntiSigma0:
0761     return (char*)"anti-Sigma0";
0762   case AntiSigmaPlus:
0763     return (char*)"anti-Sigma+";
0764   case AntiXi0:
0765     return (char*)"anti-Xi0";
0766   case AntiXiPlus:
0767     return (char*)"anti-Xi+";
0768   case AntiOmegaPlus:
0769     return (char*)"anti-Omega+";
0770   case Geantino:
0771     return (char*)"geantino";
0772   case Rho0:
0773     return (char*)"rho0";
0774   case RhoPlus:
0775     return (char*)"rho+";
0776   case RhoMinus:
0777     return (char*)"rho-";
0778   case omega:
0779     return (char*)"omega";
0780   case EtaPrime:
0781     return (char*)"eta'";
0782   case phiMeson:
0783     return (char*)"phi";
0784   case a0_980:
0785     return (char*)"a_0";
0786   case f0_980:
0787     return (char*)"f_0";
0788   case KStar_892_0:
0789     return (char*)"K*0";
0790   case KStar_892_Plus:
0791     return (char*)"K*+";
0792   case KStar_892_Minus:
0793     return (char*)"K*-";
0794   case AntiKStar_892_0:
0795     return (char*)"anti-K*0";
0796   case K1_1400_Plus:
0797     return (char*)"K'_1+";
0798   case K1_1400_Minus:
0799     return (char*)"K'_1-";
0800   case b1_1235_Plus:
0801     return (char*)"b_1+";
0802   case Sigma_1385_Minus:
0803     return (char*)"Sigma_1385_Minus";
0804   case Sigma_1385_0:
0805     return (char*)"Sigma_1385_0";
0806   case Sigma_1385_Plus:
0807     return (char*)"Sigma_1385_Plus";
0808   case Deuteron:
0809     return (char*)"deuteron";
0810   case Triton:
0811     return (char*)"Triton";  // FIX
0812   case Helium:
0813     return (char*)"Helium";  // FIX
0814   case He3:
0815     return (char*)"He3";
0816   case Li6:
0817     return (char*)"Lithium-6";
0818   case Li7:
0819     return (char*)"Lithium-7";
0820   case Be7:
0821     return (char*)"Beryllium-7";
0822   case Be9:
0823     return (char*)"Beryllium-9";
0824   case B10:
0825     return (char*)"Boron-10";
0826   case B11:
0827     return (char*)"Boron-11";
0828   case C12:
0829     return (char*)"Carbon";
0830   case N14:
0831     return (char*)"Nitrogen";
0832   case O16:
0833     return (char*)"Oxygen";
0834   case F19:
0835     return (char*)"Fluorine";
0836   case Ne20:
0837     return (char*)"Neon";
0838   case Na23:
0839     return (char*)"Sodium";
0840   case Mg24:
0841     return (char*)"Magnesium";
0842   case Al27:
0843     return (char*)"Aluminum";
0844   case Si28:
0845     return (char*)"Silicon";
0846   case P31:
0847     return (char*)"Phosphorous";
0848   case S32:
0849     return (char*)"Sulphur";
0850   case Cl35:
0851     return (char*)"Chlorine";
0852   case Ar36:
0853     return (char*)"Argon";
0854   case K39:
0855     return (char*)"Potassium";
0856   case Ca40:
0857     return (char*)"Calcium";
0858   case Sc45:
0859     return (char*)"Scandium";
0860   case Ti48:
0861     return (char*)"Titanium";
0862   case V51:
0863     return (char*)"Vanadium";
0864   case Cr52:
0865     return (char*)"Chromium";
0866   case Mn55:
0867     return (char*)"Manganese";
0868   case Fe56:
0869     return (char*)"Iron";
0870   case Co59:
0871     return (char*)"Cobalt";
0872   case Ni58:
0873     return (char*)"Nickel";
0874   case Cu63:
0875     return (char*)"Copper";
0876   case Zn64:
0877     return (char*)"Zinc";
0878   case Ge74:
0879     return (char*)"Germanium";
0880   case Se80:
0881     return (char*)"Selenium";
0882   case Kr84:
0883     return (char*)"Krypton";
0884   case Sr88:
0885     return (char*)"Strontium";
0886   case Zr90:
0887     return (char*)"Zirconium";
0888   case Mo98:
0889     return (char*)"Molybdenum";
0890   case Pd106:
0891     return (char*)"Palladium";
0892   case Cd114:
0893     return (char*)"Cadmium";
0894   case Sn120:
0895     return (char*)"Tin";
0896   case Xe132:
0897     return (char*)"Xenon";
0898   case Ba138:
0899     return (char*)"Barium";
0900   case Ce140:
0901     return (char*)"Cesium";
0902   case Sm152:
0903     return (char*)"Samerium";
0904   case Dy164:
0905     return (char*)"Dysprosium";
0906   case Yb174:
0907     return (char*)"Ytterbium";
0908   case W184:
0909     return (char*)"Tungsten";
0910   case Pt194:
0911     return (char*)"Platium";
0912   case Au197:
0913     return (char*)"Gold";
0914   case Hg202:
0915     return (char*)"Mercury";
0916   case Pb208:
0917     return (char*)"Lead";
0918   case U238:
0919     return (char*)"Uranium";
0920   case DeltaPlusPlus:
0921     return (char*)"Delta++";
0922   case Jpsi:
0923     return (char*)"J/psi";
0924   case Eta_c:
0925     return (char*)"eta_c";
0926   case Chi_c0:
0927     return (char*)"chi_c0";
0928   case Chi_c1:
0929     return (char*)"chi_c1";
0930   case Chi_c2:
0931     return (char*)"chi_c2";
0932   case Psi2s:
0933     return (char*)"psi(2S)";
0934   case D0:
0935     return (char*)"D0";
0936   case AntiD0:
0937     return (char*)"anti-D0";
0938   case DPlus:
0939     return (char*)"D+";
0940   case Dstar0:
0941     return (char*)"D*0";
0942   case DstarPlus:
0943     return (char*)"D*+";
0944   case Lambda_c:
0945     return (char*)"Lambda_c0";
0946   default:
0947     return (char*)"Unknown";
0948   }
0949 }
0950 
0951 inline static char* ShortName(Particle_t locPID)
0952 {
0953   //returns string that is exact match to enum name. for auto-generating code
0954   locPID = RemapParticleID(locPID);
0955 
0956   switch (locPID) {
0957   case Unknown:
0958     return (char*)"x";
0959   case Gamma:
0960     return (char*)"g";
0961   case Positron:
0962     return (char*)"ep";
0963   case Electron:
0964     return (char*)"em";
0965   case Neutrino:
0966     return (char*)"nu";
0967   case MuonPlus:
0968     return (char*)"mup";
0969   case MuonMinus:
0970     return (char*)"mum";
0971   case Pi0:
0972     return (char*)"pi0";
0973   case PiPlus:
0974     return (char*)"pip";
0975   case PiMinus:
0976     return (char*)"pim";
0977   case KLong:
0978     return (char*)"kl";
0979   case KPlus:
0980     return (char*)"kp";
0981   case KMinus:
0982     return (char*)"km";
0983   case Neutron:
0984     return (char*)"n";
0985   case Proton:
0986     return (char*)"prot";
0987   case AntiProton:
0988     return (char*)"antip";
0989   case KShort:
0990     return (char*)"ks";
0991   case Eta:
0992     return (char*)"eta";
0993   case Lambda:
0994     return (char*)"lamb";
0995   case SigmaPlus:
0996     return (char*)"sigp";
0997   case Sigma0:
0998     return (char*)"sig0";
0999   case SigmaMinus:
1000     return (char*)"sigm";
1001   case Xi0:
1002     return (char*)"xi0";
1003   case XiMinus:
1004     return (char*)"xim";
1005   case OmegaMinus:
1006     return (char*)"omegam";
1007   case AntiNeutron:
1008     return (char*)"antin";
1009   case AntiLambda:
1010     return (char*)"antilamb";
1011   case AntiSigmaMinus:
1012     return (char*)"antisigm";
1013   case AntiSigma0:
1014     return (char*)"antisig0";
1015   case AntiSigmaPlus:
1016     return (char*)"antisigp";
1017   case AntiXi0:
1018     return (char*)"antixi0";
1019   case AntiXiPlus:
1020     return (char*)"antixip";
1021   case AntiOmegaPlus:
1022     return (char*)"antiomegap";
1023   case Geantino:
1024     return (char*)"geant";
1025   case omega:
1026     return (char*)"omega";
1027   case EtaPrime:
1028     return (char*)"etapr";
1029   case phiMeson:
1030     return (char*)"phi";
1031   case Deuteron:
1032     return (char*)"d";
1033   case Triton:
1034     return (char*)"tri";
1035   case Helium:
1036     return (char*)"he";
1037   case He3:
1038     return (char*)"he3";
1039   case Li6:
1040     return (char*)"li6";
1041   case Li7:
1042     return (char*)"li7";
1043   case Be7:
1044     return (char*)"be7";
1045   case Be9:
1046     return (char*)"be9";
1047   case B10:
1048     return (char*)"b10";
1049   case B11:
1050     return (char*)"b11";
1051   case C12:
1052     return (char*)"c12";
1053   case N14:
1054     return (char*)"n14";
1055   case O16:
1056     return (char*)"o16";
1057   case F19:
1058     return (char*)"f19";
1059   case Ne20:
1060     return (char*)"ne20";
1061   case Na23:
1062     return (char*)"na23";
1063   case Mg24:
1064     return (char*)"mg24";
1065   case Al27:
1066     return (char*)"al27";
1067   case Si28:
1068     return (char*)"si28";
1069   case P31:
1070     return (char*)"p31";
1071   case S32:
1072     return (char*)"s32";
1073   case Cl35:
1074     return (char*)"cl35";
1075   case Ar36:
1076     return (char*)"ar36";
1077   case K39:
1078     return (char*)"k39";
1079   case Ca40:
1080     return (char*)"ca40";
1081   case Sc45:
1082     return (char*)"sc45";
1083   case Ti48:
1084     return (char*)"ti48";
1085   case V51:
1086     return (char*)"v51";
1087   case Cr52:
1088     return (char*)"cr52";
1089   case Mn55:
1090     return (char*)"mn55";
1091   case Fe56:
1092     return (char*)"fe56";
1093   case Co59:
1094     return (char*)"co59";
1095   case Ni58:
1096     return (char*)"ni58";
1097   case Cu63:
1098     return (char*)"cu63";
1099   case Zn64:
1100     return (char*)"zn64";
1101   case Ge74:
1102     return (char*)"ge74";
1103   case Se80:
1104     return (char*)"se80";
1105   case Kr84:
1106     return (char*)"kr84";
1107   case Sr88:
1108     return (char*)"sr88";
1109   case Zr90:
1110     return (char*)"zr90";
1111   case Mo98:
1112     return (char*)"mo98";
1113   case Pd106:
1114     return (char*)"pd106";
1115   case Cd114:
1116     return (char*)"cd114";
1117   case Sn120:
1118     return (char*)"sn120";
1119   case Xe132:
1120     return (char*)"xe132";
1121   case Ba138:
1122     return (char*)"ba138";
1123   case Ce140:
1124     return (char*)"ce140";
1125   case Sm152:
1126     return (char*)"sm152";
1127   case Dy164:
1128     return (char*)"dy164";
1129   case Yb174:
1130     return (char*)"yb174";
1131   case W184:
1132     return (char*)"w184";
1133   case Pt194:
1134     return (char*)"pt194";
1135   case Au197:
1136     return (char*)"au197";
1137   case Hg202:
1138     return (char*)"hg202";
1139   case Pb208:
1140     return (char*)"pb208";
1141   case U238:
1142     return (char*)"u238";
1143   case Jpsi:
1144     return (char*)"jpsi";
1145   case Eta_c:
1146     return (char*)"etac";
1147   case Chi_c0:
1148     return (char*)"chic0";
1149   case Chi_c1:
1150     return (char*)"chic1";
1151   case Chi_c2:
1152     return (char*)"chic2";
1153   case Psi2s:
1154     return (char*)"psi2s";
1155   case D0:
1156     return (char*)"d0";
1157   case AntiD0:
1158     return (char*)"antid0";
1159   case DPlus:
1160     return (char*)"dp";
1161   case Dstar0:
1162     return (char*)"ds0";
1163   case DstarPlus:
1164     return (char*)"dsp";
1165   case Lambda_c:
1166     return (char*)"lambc";
1167 
1168   //not really supported
1169   case Rho0:
1170     return (char*)"Rho0";
1171   case RhoPlus:
1172     return (char*)"RhoPlus";
1173   case RhoMinus:
1174     return (char*)"RhoMinus";
1175   case a0_980:
1176     return (char*)"a0_980";
1177   case f0_980:
1178     return (char*)"f0_980";
1179   case KStar_892_0:
1180     return (char*)"KStar_892_0";
1181   case KStar_892_Plus:
1182     return (char*)"KStar_892_Plus";
1183   case KStar_892_Minus:
1184     return (char*)"KStar_892_Minus";
1185   case AntiKStar_892_0:
1186     return (char*)"AntiKStar_892_0";
1187   case K1_1400_Plus:
1188     return (char*)"K1_1400_Plus";
1189   case K1_1400_Minus:
1190     return (char*)"K1_1400_Minus";
1191   case b1_1235_Plus:
1192     return (char*)"b1_1235_Plus";
1193   case Sigma_1385_Minus:
1194     return (char*)"Sigma_1385_Minus";
1195   case Sigma_1385_0:
1196     return (char*)"Sigma_1385_0";
1197   case Sigma_1385_Plus:
1198     return (char*)"Sigma_1385_Plus";
1199   case DeltaPlusPlus:
1200     return (char*)"DeltaPlusPlus";
1201 
1202   default:
1203     return (char*)"x";
1204   }
1205 }
1206 
1207 inline static Particle_t ParticleEnum(const char* locParticleName)
1208 {
1209   if(strcmp(locParticleName, "Unknown") == 0)
1210     return Unknown;
1211   else if(strcmp(locParticleName, "Photon") == 0)
1212     return Gamma;
1213   else if(strcmp(locParticleName, "Positron") == 0)
1214     return Positron;
1215   else if(strcmp(locParticleName, "Electron") == 0)
1216     return Electron;
1217   else if(strcmp(locParticleName, "Neutrino") == 0)
1218     return Neutrino;
1219   else if(strcmp(locParticleName, "Muon+") == 0)
1220     return MuonPlus;
1221   else if(strcmp(locParticleName, "Muon-") == 0)
1222     return MuonMinus;
1223   else if(strcmp(locParticleName, "Pi0") == 0)
1224     return Pi0;
1225   else if(strcmp(locParticleName, "Pi+") == 0)
1226     return PiPlus;
1227   else if(strcmp(locParticleName, "Pi-") == 0)
1228     return PiMinus;
1229   else if(strcmp(locParticleName, "KLong") == 0)
1230     return KLong;
1231   else if(strcmp(locParticleName, "K+") == 0)
1232     return KPlus;
1233   else if(strcmp(locParticleName, "K-") == 0)
1234     return KMinus;
1235   else if(strcmp(locParticleName, "Neutron") == 0)
1236     return Neutron;
1237   else if(strcmp(locParticleName, "Proton") == 0)
1238     return Proton;
1239   else if(strcmp(locParticleName, "AntiProton") == 0)
1240     return AntiProton;
1241   else if(strcmp(locParticleName, "KShort") == 0)
1242     return KShort;
1243   else if(strcmp(locParticleName, "Eta") == 0)
1244     return Eta;
1245   else if(strcmp(locParticleName, "Lambda") == 0)
1246     return Lambda;
1247   else if(strcmp(locParticleName, "Sigma+") == 0)
1248     return SigmaPlus;
1249   else if(strcmp(locParticleName, "Sigma0") == 0)
1250     return Sigma0;
1251   else if(strcmp(locParticleName, "Sigma-") == 0)
1252     return SigmaMinus;
1253   else if(strcmp(locParticleName, "Xi0") == 0)
1254     return Xi0;
1255   else if(strcmp(locParticleName, "Xi-") == 0)
1256     return XiMinus;
1257   else if(strcmp(locParticleName, "Omega-") == 0)
1258     return OmegaMinus;
1259   else if(strcmp(locParticleName, "AntiNeutron") == 0)
1260     return AntiNeutron;
1261   else if(strcmp(locParticleName, "AntiLambda") == 0)
1262     return AntiLambda;
1263   else if(strcmp(locParticleName, "AntiSigma-") == 0)
1264     return AntiSigmaMinus;
1265   else if(strcmp(locParticleName, "AntiSigma0") == 0)
1266     return AntiSigma0;
1267   else if(strcmp(locParticleName, "AntiSigma+") == 0)
1268     return AntiSigmaPlus;
1269   else if(strcmp(locParticleName, "AntiXi0") == 0)
1270     return AntiXi0;
1271   else if(strcmp(locParticleName, "AntiXi+") == 0)
1272     return AntiXiPlus;
1273   else if(strcmp(locParticleName, "AntiOmega+") == 0)
1274     return AntiOmegaPlus;
1275   else if(strcmp(locParticleName, "Geantino") == 0)
1276     return Geantino;
1277   else if(strcmp(locParticleName, "Rho0") == 0)
1278     return Rho0;
1279   else if(strcmp(locParticleName, "Rho+") == 0)
1280     return RhoPlus;
1281   else if(strcmp(locParticleName, "Rho-") == 0)
1282     return RhoMinus;
1283   else if(strcmp(locParticleName, "Omega") == 0)
1284     return omega;
1285   else if(strcmp(locParticleName, "EtaPrime") == 0)
1286     return EtaPrime;
1287   else if(strcmp(locParticleName, "Phi") == 0)
1288     return phiMeson;
1289   else if(strcmp(locParticleName, "a0(980)") == 0)
1290     return a0_980;
1291   else if(strcmp(locParticleName, "f0(980)") == 0)
1292     return f0_980;
1293   else if(strcmp(locParticleName, "K*(892)0") == 0)
1294     return KStar_892_0;
1295   else if(strcmp(locParticleName, "K*(892)+") == 0)
1296     return KStar_892_Plus;
1297   else if(strcmp(locParticleName, "K*(892)-") == 0)
1298     return KStar_892_Minus;
1299   else if(strcmp(locParticleName, "antiK*(892)0") == 0)
1300     return AntiKStar_892_0;
1301   else if(strcmp(locParticleName, "K1(1400)+") == 0)
1302     return K1_1400_Plus;
1303   else if(strcmp(locParticleName, "K1(1400)-") == 0)
1304     return K1_1400_Minus;
1305   else if(strcmp(locParticleName, "b1(1235)+") == 0)
1306     return b1_1235_Plus;
1307   else if(strcmp(locParticleName, "Sigma(1385)-") == 0)
1308     return Sigma_1385_Minus;
1309   else if(strcmp(locParticleName, "Sigma(1385)0") == 0)
1310     return Sigma_1385_0;
1311   else if(strcmp(locParticleName, "Sigma(1385)+") == 0)
1312     return Sigma_1385_Plus;
1313   else if(strcmp(locParticleName, "Deuteron") == 0)
1314     return Deuteron;
1315   else if(strcmp(locParticleName, "Triton") == 0)
1316     return Triton;
1317   else if(strcmp(locParticleName, "Helium") == 0)
1318     return Helium;
1319   else if(strcmp(locParticleName, "Helium-3") == 0)
1320     return He3;
1321   else if(strcmp(locParticleName, "Lithium-6") == 0)
1322     return Li6;
1323   else if(strcmp(locParticleName, "Lithium-7") == 0)
1324     return Li7;
1325   else if(strcmp(locParticleName, "Beryllium-7") == 0)
1326     return Be7;
1327   else if(strcmp(locParticleName, "Beryllium-9") == 0)
1328     return Be9;
1329   else if(strcmp(locParticleName, "Boron-10") == 0)
1330     return B10;
1331   else if(strcmp(locParticleName, "Boron-11") == 0)
1332     return B11;
1333   else if(strcmp(locParticleName, "Carbon") == 0)
1334     return C12;
1335   else if(strcmp(locParticleName, "Nitrogen") == 0)
1336     return N14;
1337   else if(strcmp(locParticleName, "Oxygen") == 0)
1338     return O16;
1339   else if(strcmp(locParticleName, "Fluorine") == 0)
1340     return F19;
1341   else if(strcmp(locParticleName, "Neon") == 0)
1342     return Ne20;
1343   else if(strcmp(locParticleName, "Sodium") == 0)
1344     return Na23;
1345   else if(strcmp(locParticleName, "Magnesium") == 0)
1346     return Mg24;
1347   else if(strcmp(locParticleName, "Aluminum") == 0)
1348     return Al27;
1349   else if(strcmp(locParticleName, "Silicon") == 0)
1350     return Si28;
1351   else if(strcmp(locParticleName, "Phosphorous") == 0)
1352     return P31;
1353   else if(strcmp(locParticleName, "Sulphur") == 0)
1354     return S32;
1355   else if(strcmp(locParticleName, "Chlorine") == 0)
1356     return Cl35;
1357   else if(strcmp(locParticleName, "Argon") == 0)
1358     return Ar36;
1359   else if(strcmp(locParticleName, "Potassium") == 0)
1360     return K39;
1361   else if(strcmp(locParticleName, "Calcium") == 0)
1362     return Ca40;
1363   else if(strcmp(locParticleName, "Scandium") == 0)
1364     return Sc45;
1365   else if(strcmp(locParticleName, "Titanium") == 0)
1366     return Ti48;
1367   else if(strcmp(locParticleName, "Vanadium") == 0)
1368     return V51;
1369   else if(strcmp(locParticleName, "Chromium") == 0)
1370     return Cr52;
1371   else if(strcmp(locParticleName, "Manganese") == 0)
1372     return Mn55;
1373   else if(strcmp(locParticleName, "Iron") == 0)
1374     return Fe56;
1375   else if(strcmp(locParticleName, "Cobalt") == 0)
1376     return Co59;
1377   else if(strcmp(locParticleName, "Nickel") == 0)
1378     return Ni58;
1379   else if(strcmp(locParticleName, "Copper") == 0)
1380     return Cu63;
1381   else if(strcmp(locParticleName, "Zinc") == 0)
1382     return Zn64;
1383   else if(strcmp(locParticleName, "Germanium") == 0)
1384     return Ge74;
1385   else if(strcmp(locParticleName, "Selenium") == 0)
1386     return Se80;
1387   else if(strcmp(locParticleName, "Krypton") == 0)
1388     return Kr84;
1389   else if(strcmp(locParticleName, "Strontium") == 0)
1390     return Sr88;
1391   else if(strcmp(locParticleName, "Zirconium") == 0)
1392     return Zr90;
1393   else if(strcmp(locParticleName, "Molybdenum") == 0)
1394     return Mo98;
1395   else if(strcmp(locParticleName, "Palladium") == 0)
1396     return Pd106;
1397   else if(strcmp(locParticleName, "Cadmium") == 0)
1398     return Cd114;
1399   else if(strcmp(locParticleName, "Tin") == 0)
1400     return Sn120;
1401   else if(strcmp(locParticleName, "Xenon") == 0)
1402     return Xe132;
1403   else if(strcmp(locParticleName, "Barium") == 0)
1404     return Ba138;
1405   else if(strcmp(locParticleName, "Cesium") == 0)
1406     return Ce140;
1407   else if(strcmp(locParticleName, "Samerium") == 0)
1408     return Sm152;
1409   else if(strcmp(locParticleName, "Dysprosium") == 0)
1410     return Dy164;
1411   else if(strcmp(locParticleName, "Ytterbium") == 0)
1412     return Yb174;
1413   else if(strcmp(locParticleName, "Tungsten") == 0)
1414     return W184;
1415   else if(strcmp(locParticleName, "Platium") == 0)
1416     return Pt194;
1417   else if(strcmp(locParticleName, "Gold") == 0)
1418     return Au197;
1419   else if(strcmp(locParticleName, "Mercury") == 0)
1420     return Hg202;
1421   else if(strcmp(locParticleName, "Lead") == 0)
1422     return Pb208;
1423   else if(strcmp(locParticleName, "Uranium") == 0)
1424     return U238;
1425   else if(strcmp(locParticleName, "Delta++") == 0)
1426     return DeltaPlusPlus;
1427   else if(strcmp(locParticleName, "Jpsi") == 0)
1428     return Jpsi;
1429   else if(strcmp(locParticleName, "EtaC") == 0)
1430     return Eta_c;
1431   else if(strcmp(locParticleName, "ChiC0") == 0)
1432     return Chi_c0;
1433   else if(strcmp(locParticleName, "ChiC1") == 0)
1434     return Chi_c1;
1435   else if(strcmp(locParticleName, "ChiC2") == 0)
1436     return Chi_c2;
1437   else if(strcmp(locParticleName, "Psi(2S)") == 0)
1438     return Psi2s;
1439   else if(strcmp(locParticleName, "D0") == 0)
1440     return D0;
1441   else if(strcmp(locParticleName, "AntiD0") == 0)
1442     return AntiD0;
1443   else if(strcmp(locParticleName, "D+") == 0)
1444     return DPlus;
1445   else if(strcmp(locParticleName, "D*0") == 0)
1446     return Dstar0;
1447   else if(strcmp(locParticleName, "D*+") == 0)
1448     return DstarPlus;
1449   else if(strcmp(locParticleName, "LambdaC") == 0)
1450     return Lambda_c;
1451   else
1452     return Unknown;
1453 }
1454 
1455 inline static unsigned short int IsFixedMass(Particle_t p)
1456 {
1457   switch (p)
1458   {
1459   case Gamma:       return 1;
1460   case Positron:    return 1;
1461   case Electron:    return 1;
1462   case Neutrino:    return 1;
1463   case MuonPlus:    return 1;
1464   case MuonMinus:   return 1;
1465   case Pi0:         return 1;
1466   case PiPlus:      return 1;
1467   case PiMinus:     return 1;
1468   case KShort:      return 1;
1469   case KLong:       return 1;
1470   case KPlus:       return 1;
1471   case KMinus:      return 1;
1472   case Neutron:     return 1;
1473   case Proton:      return 1;
1474   case AntiProton:  return 1;
1475   case Eta:         return 1;
1476   case Lambda:      return 1;
1477   case SigmaPlus:   return 1;
1478   case Sigma0:      return 1;
1479   case SigmaMinus:  return 1;
1480   case Xi0:         return 1;
1481   case XiMinus:     return 1;
1482   case OmegaMinus:  return 1;
1483   case AntiNeutron: return 1;
1484   case AntiLambda:  return 1;
1485   case AntiSigmaMinus:  return 1;
1486   case AntiSigma0:  return 1;
1487   case AntiSigmaPlus:   return 1;
1488   case AntiXi0:     return 1;
1489   case AntiXiPlus:  return 1;
1490   case AntiOmegaPlus:   return 1;
1491   case Geantino:    return 1;
1492   case EtaPrime:    return 1;
1493   case Deuteron:    return 1;
1494   case Triton:      return 1;
1495   case Helium:      return 1;
1496   case He3:     return 1;
1497   case Li6:     return 1;
1498   case Li7:     return 1;
1499   case Be7:     return 1;
1500   case Be9:     return 1;
1501   case B10:     return 1;
1502   case B11:     return 1;
1503   case C12:     return 1;
1504   case N14:     return 1;
1505   case O16:     return 1;
1506   case F19:     return 1;
1507   case Ne20:    return 1;
1508   case Na23:    return 1;
1509   case Mg24:    return 1;
1510   case Al27:    return 1;
1511   case Si28:    return 1;
1512   case P31:     return 1;
1513   case S32:     return 1;
1514   case Cl35:    return 1;
1515   case Ar36:    return 1;
1516   case K39:     return 1;
1517   case Ca40:    return 1;
1518   case Sc45:    return 1;
1519   case Ti48:    return 1;
1520   case V51:     return 1;
1521   case Cr52:    return 1;
1522   case Mn55:    return 1;
1523   case Fe56:    return 1;
1524   case Co59:    return 1;
1525   case Ni58:    return 1;
1526   case Cu63:    return 1;
1527   case Zn64:    return 1;
1528   case Ge74:    return 1;
1529   case Se80:    return 1;
1530   case Kr84:    return 1;
1531   case Sr88:    return 1;
1532   case Zr90:    return 1;
1533   case Mo98:    return 1;
1534   case Pd106:   return 1;
1535   case Cd114:   return 1;
1536   case Sn120:   return 1;
1537   case Xe132:   return 1;
1538   case Ba138:   return 1;
1539   case Ce140:   return 1;
1540   case Sm152:   return 1;
1541   case Dy164:   return 1;
1542   case Yb174:   return 1;
1543   case W184:    return 1;
1544   case Pt194:   return 1;
1545   case Au197:   return 1;
1546   case Hg202:   return 1;
1547   case Pb208:   return 1;
1548   case U238:    return 1;
1549   case Jpsi:    return 1;
1550   //case eta_c:   return 1;
1551   //case chi_c0:  return 1;
1552   case Chi_c1:  return 1;
1553   case Chi_c2:  return 1;
1554   case Psi2s:   return 1;
1555   case D0:      return 1;
1556   case AntiD0:  return 1;
1557   case DPlus:   return 1;
1558   case Dstar0:  return 1;
1559   case DstarPlus:  return 1;
1560   case Lambda_c: return 1;
1561   default: return 0;
1562   }
1563 }
1564 
1565 inline static unsigned short int IsResonance(Particle_t p)
1566 {
1567    p = RemapParticleID(p);
1568 
1569     if(IsFixedMass(p) == 1)
1570         return 0;
1571     if(p == Unknown)
1572         return 0;
1573     if(p == phiMeson)
1574         return 0;
1575     if(p == omega)
1576         return 0;
1577     return 1;
1578 }
1579 
1580 inline static unsigned short int IsDetachedVertex(Particle_t p)
1581 {
1582   switch (p)
1583   {
1584   case MuonPlus:    return 1;
1585   case MuonMinus:   return 1;
1586   case PiPlus:      return 1;
1587   case PiMinus:     return 1;
1588   case KShort:      return 1;
1589   case KLong:       return 1;
1590   case KPlus:       return 1;
1591   case KMinus:      return 1;
1592   case Neutron:     return 1;
1593   case Lambda:      return 1;
1594   case SigmaPlus:   return 1;
1595   case SigmaMinus:  return 1;
1596   case Xi0:         return 1;
1597   case XiMinus:     return 1;
1598   case OmegaMinus:  return 1;
1599   case AntiNeutron: return 1;
1600   case AntiLambda:  return 1;
1601   case AntiSigmaMinus:  return 1;
1602   case AntiSigmaPlus:   return 1;
1603   case AntiXi0:     return 1;
1604   case AntiXiPlus:  return 1;
1605   case AntiOmegaPlus:   return 1;
1606   case Deuteron:    return 1;
1607   case Triton:      return 1;
1608   case Helium:      return 1;
1609   case He3:         return 1;
1610   default: return 0;
1611   }
1612 }
1613 
1614 inline static char* ParticleName_ROOT(Particle_t p)
1615 {
1616   p = RemapParticleID(p);
1617 
1618   switch (p) {
1619   case Unknown:
1620     return (char*)"X";
1621   case Gamma:
1622     return (char*)"#gamma";
1623   case Positron:
1624     return (char*)"e^{#plus}";
1625   case Electron:
1626     return (char*)"e^{#minus}";
1627   case Neutrino:
1628     return (char*)"#nu";
1629   case MuonPlus:
1630     return (char*)"#mu^{#plus}";
1631   case MuonMinus:
1632     return (char*)"#mu^{#minus}";
1633   case Pi0:
1634     return (char*)"#pi^{0}";
1635   case PiPlus:
1636     return (char*)"#pi^{#plus}";
1637   case PiMinus:
1638     return (char*)"#pi^{#minus}";
1639   case KLong:
1640     return (char*)"K^{0}_{L}";
1641   case KPlus:
1642     return (char*)"K^{#plus}";
1643   case KMinus:
1644     return (char*)"K^{#minus}";
1645   case Neutron:
1646     return (char*)"n";
1647   case Proton:
1648     return (char*)"p";
1649   case AntiProton:
1650     return (char*)"#bar{p}";
1651   case KShort:
1652     return (char*)"K^{0}_{S}";
1653   case Eta:
1654     return (char*)"#eta";
1655   case Lambda:
1656     return (char*)"#Lambda";
1657   case SigmaPlus:
1658     return (char*)"#Sigma^{#plus}";
1659   case Sigma0:
1660     return (char*)"#Sigma^{0}";
1661   case SigmaMinus:
1662     return (char*)"#Sigma^{#minus}";
1663   case Xi0:
1664     return (char*)"#Xi^{0}";
1665   case XiMinus:
1666     return (char*)"#Xi^{#minus}";
1667   case OmegaMinus:
1668     return (char*)"#Omega^{#minus}";
1669   case AntiNeutron:
1670     return (char*)"#bar^{n}";
1671   case AntiLambda:
1672     return (char*)"#bar^{#Lambda}";
1673   case AntiSigmaMinus:
1674     return (char*)"#bar{#Sigma}^{#minus}";
1675   case AntiSigma0:
1676     return (char*)"#bar{#Sigma}^{0}";
1677   case AntiSigmaPlus:
1678     return (char*)"#bar{#Sigma}^{#plus}";
1679   case AntiXi0:
1680     return (char*)"#bar{#Xi}^{0}";
1681   case AntiXiPlus:
1682     return (char*)"#bar{#Xi}^{#plus}";
1683   case AntiOmegaPlus:
1684     return (char*)"#bar{#Omega}^{#plus}";
1685   case Geantino:
1686     return (char*)"geantino";
1687   case Rho0:
1688     return (char*)"#rho^{0}";
1689   case RhoPlus:
1690     return (char*)"#rho^{#plus}";
1691   case RhoMinus:
1692     return (char*)"#rho^{#minus}";
1693   case omega:
1694     return (char*)"#omega";
1695   case EtaPrime:
1696     return (char*)"#eta'";
1697   case phiMeson:
1698     return (char*)"#phi";
1699   case a0_980:
1700     return (char*)"a_{0}(980)";
1701   case f0_980:
1702     return (char*)"f_{0}(980)";
1703   case KStar_892_0:
1704     return (char*)"K*(892)^{0}";
1705   case KStar_892_Plus:
1706     return (char*)"K*(892)^{#plus}";
1707   case KStar_892_Minus:
1708     return (char*)"K*(892)^{#minus}";
1709   case AntiKStar_892_0:
1710     return (char*)"#bar{K*}(892)^{0}";
1711   case K1_1400_Plus:
1712     return (char*)"K_{1}(1400)^{#plus}";
1713   case K1_1400_Minus:
1714     return (char*)"K_{1}(1400)^{#minus}";
1715   case b1_1235_Plus:
1716     return (char*)"b_{1}(1235)^{#plus}";
1717   case Deuteron:
1718     return (char*)"d";
1719   case Triton:
1720     return (char*)"t";
1721   case Helium:
1722     return (char*)"He";
1723   case He3:
1724     return (char*)"^{3}He";
1725   case Li6:
1726     return (char*)"^{6}Li";
1727   case Li7:
1728     return (char*)"^{7}Li";
1729   case Be7:
1730     return (char*)"^{7}Be";
1731   case Be9:
1732     return (char*)"^{9}Be";
1733   case B10:
1734     return (char*)"^{10}B";
1735   case B11:
1736     return (char*)"^{11}B";
1737   case C12:
1738     return (char*)"^{12}C";
1739   case N14:
1740     return (char*)"^{14}N";
1741   case O16:
1742     return (char*)"^{16}O";
1743   case F19:
1744     return (char*)"^{19}F";
1745   case Ne20:
1746     return (char*)"^{20}Ne";
1747   case Na23:
1748     return (char*)"^{23}Na";
1749   case Mg24:
1750     return (char*)"^{24}Mg";
1751   case Al27:
1752     return (char*)"^{27}Al";
1753   case Si28:
1754     return (char*)"^{28}Si";
1755   case P31:
1756     return (char*)"^{31}P";
1757   case S32:
1758     return (char*)"^{32}S";
1759   case Cl35:
1760     return (char*)"^{35}Cl";
1761   case Ar36:
1762     return (char*)"^{36}Ar";
1763   case K39:
1764     return (char*)"^{39}K";
1765   case Ca40:
1766     return (char*)"^{40}Ca";
1767   case Sc45:
1768     return (char*)"^{45}Sc";
1769   case Ti48:
1770     return (char*)"^{48}Ti";
1771   case V51:
1772     return (char*)"^{51}V";
1773   case Cr52:
1774     return (char*)"^{52}Cr";
1775   case Mn55:
1776     return (char*)"^{55}Mn";
1777   case Fe56:
1778     return (char*)"^{56}Fe";
1779   case Co59:
1780     return (char*)"^{59}Co";
1781   case Ni58:
1782     return (char*)"^{58}Ni";
1783   case Cu63:
1784     return (char*)"^{63}Cu";
1785   case Zn64:
1786     return (char*)"^{64}Zn";
1787   case Ge74:
1788     return (char*)"^{74}Ge";
1789   case Se80:
1790     return (char*)"^{80}Se";
1791   case Kr84:
1792     return (char*)"^{84}Kr";
1793   case Sr88:
1794     return (char*)"^{88}Sr";
1795   case Zr90:
1796     return (char*)"^{90}Zr";
1797   case Mo98:
1798     return (char*)"^{98}Mo";
1799   case Pd106:
1800     return (char*)"^{106}Pd";
1801   case Cd114:
1802     return (char*)"^{114}Cd";
1803   case Sn120:
1804     return (char*)"^{120}Sn";
1805   case Xe132:
1806     return (char*)"^{132}Xe";
1807   case Ba138:
1808     return (char*)"^{138}Ba";
1809   case Ce140:
1810     return (char*)"^{140}Ce";
1811   case Sm152:
1812     return (char*)"^{152}Sm";
1813   case Dy164:
1814     return (char*)"^{164}Dy";
1815   case Yb174:
1816     return (char*)"^{174}Yb";
1817   case W184:
1818     return (char*)"^{184}W";
1819   case Pt194:
1820     return (char*)"^{194}Pt";
1821   case Au197:
1822     return (char*)"^{197}Au";
1823   case Hg202:
1824     return (char*)"^{202}Hg";
1825   case Pb208:
1826     return (char*)"^{208}Pb";
1827   case U238:
1828     return (char*)"^{238}U";
1829   case Sigma_1385_Minus:
1830     return (char*)"#Sigma(1385)^{#minus}";
1831   case Sigma_1385_0:
1832     return (char*)"#Sigma(1385)^{0}";
1833   case Sigma_1385_Plus:
1834     return (char*)"#Sigma(1385)^{#plus}";
1835   case DeltaPlusPlus:
1836     return (char*)"#Delta(1232)^{#plus#plus}";
1837   case Jpsi:
1838     return (char*)"J/#psi";
1839   case Eta_c:
1840     return (char*)"#eta_{c}";
1841   case Chi_c0:
1842     return (char*)"#chi_{c0}";
1843   case Chi_c1:
1844     return (char*)"#chi_{c1}";
1845   case Chi_c2:
1846     return (char*)"#chi_{c2}";
1847   case Psi2s:
1848     return (char*)"#psi(2S)";
1849   case D0:
1850     return (char*)"D^{0}";
1851   case AntiD0:
1852     return (char*)"#bar{D^{0}}";
1853   case DPlus:
1854     return (char*)"D{^+}";
1855   case Dstar0:
1856     return (char*)"D^{*0}";
1857   case DstarPlus:
1858     return (char*)"D^{*+}";
1859   case Lambda_c:
1860     return (char*)"#Lambda_{c}";
1861          
1862   default:
1863     return (char*)"X";
1864   }
1865 }
1866 
1867 inline static double ParticleMass(Particle_t p)
1868 {
1869   p = RemapParticleID(p);
1870 
1871   switch (p) {
1872   case Unknown:     return HUGE_VAL;
1873   case Gamma:       return 0;
1874   case Positron:    return 0.000510998928;
1875   case Electron:    return 0.000510998928;
1876   case Neutrino:    return 0;
1877   case MuonPlus:    return 0.1056583715;
1878   case MuonMinus:   return 0.1056583715;
1879   case Pi0:     return 0.1349766;
1880   case PiPlus:      return 0.13957018;
1881   case PiMinus:     return 0.13957018;
1882   case KShort:      return 0.497614;
1883   case KLong:       return 0.497614;
1884   case KPlus:       return 0.493677;
1885   case KMinus:      return 0.493677;
1886   case Neutron:     return 0.939565379;
1887   case Proton:      return 0.938272046;
1888   case AntiProton:  return 0.938272046;
1889   case Eta:     return 0.547862;
1890   case Lambda:      return 1.115683;
1891   case SigmaPlus:   return 1.18937;
1892   case Sigma0:      return 1.192642;
1893   case SigmaMinus:  return 1.197449;
1894   case Xi0:     return 1.31486;
1895   case XiMinus:     return 1.32171;
1896   case OmegaMinus:  return 1.67245;
1897   case AntiNeutron: return 0.939565379;
1898   case AntiLambda:  return 1.115683;
1899   case AntiSigmaMinus:  return 1.18937;
1900   case AntiSigma0:  return 1.192642;
1901   case AntiSigmaPlus:   return 1.197449;
1902   case AntiXi0:     return 1.31486;
1903   case AntiXiPlus:  return 1.32171;
1904   case AntiOmegaPlus:   return 1.67245;
1905   case Geantino:    return 0.0;
1906   case Rho0:        return 0.7690;  // neutral only, photoproduced and other reactions. e+ e- gives 775.26
1907   case RhoPlus:     return 0.7665;  // charged only, hadroproduced. tau decays and e+ e- gives 775.11
1908   case RhoMinus:    return 0.7665;
1909   case omega:       return 0.78265;
1910   case EtaPrime:    return 0.95778;
1911   case phiMeson:    return 1.019455;
1912   case a0_980:      return 0.980;
1913   case f0_980:      return 0.990;
1914   case KStar_892_0: return 0.89581;     // neutral only
1915   case KStar_892_Plus: return 0.89166;  // charged only, hadroproduced
1916   case KStar_892_Minus: return 0.89166; // charged only, hadroproduced
1917   case AntiKStar_892_0: return 0.89581; // neutral only
1918   case K1_1400_Plus: return 1.403;
1919   case K1_1400_Minus: return 1.403;
1920   case b1_1235_Plus: return 1.2295;
1921   case Deuteron:    return 1.875612859;     // from NIST
1922   case Triton:      return 2.808921004;     // from NIST 5.00735630 x 10^-27 kg
1923   case Helium:      return 3.727379238;     // from NIST 6.64465675 x 10-27 kg
1924   case He3:         return 2.809413498;
1925   case Li6:         return 5.60305;
1926   case Li7:         return 6.53536;
1927   case Be7:         return 6.53622;
1928   case Be9:         return 8.39479;
1929   case B10:         return 9.32699;
1930   case B11:         return 10.25510;
1931   case C12:         return 11.17793;
1932   case N14:         return 13.04378;
1933   case O16:         return 14.89917;
1934   case F19:         return 17.69690;
1935   case Ne20:        return 18.62284;
1936   case Na23:        return 21.41483;
1937   case Mg24:        return 22.34193;
1938   case Al27:        return 25.13314;
1939   case Si28:        return 26.06034;
1940   case P31:         return 28.85188;
1941   case S32:         return 29.78180;
1942   case Cl35:        return 32.57328;
1943   case Ar36:        return 33.50356;
1944   case K39:         return 36.29447;
1945   case Ca40:        return 37.22492;
1946   case Sc45:        return 41.87617;
1947   case Ti48:        return 44.66324;
1948   case V51:         return 47.45401;
1949   case Cr52:        return 48.38228;
1950   case Mn55:        return 51.17447;
1951   case Fe56:        return 52.10307;
1952   case Co59:        return 54.89593;
1953   case Ni58:        return 53.96644;
1954   case Cu63:        return 58.61856;
1955   case Zn64:        return 59.54963;
1956   case Ge74:        return 68.85715;
1957   case Se80:        return 74.44178;
1958   case Kr84:        return 78.16309;
1959   case Sr88:        return 81.88358;
1960   case Zr90:        return 83.74571;
1961   case Mo98:        return 91.19832;
1962   case Pd106:       return 98.64997;
1963   case Cd114:       return 106.10997;
1964   case Sn120:       return 111.68821;
1965   case Xe132:       return 122.86796;
1966   case Ba138:       return 128.45793;
1967   case Ce140:       return 130.32111;
1968   case Sm152:       return 141.51236;
1969   case Dy164:       return 152.69909;
1970   case Yb174:       return 162.02245;
1971   case W184:        return 171.34924;
1972   case Pt194:       return 180.67513;
1973   case Au197:       return 183.47324;
1974   case Hg202:       return 188.13451;
1975   case Pb208:       return 193.72899;       // NIST gives 207.976627 AMU
1976   case U238:        return 221.74295;
1977   case Sigma_1385_Minus:    return 1.3872;
1978   case Sigma_1385_0:        return 1.3837;
1979   case Sigma_1385_Plus: return 1.38280;
1980   case DeltaPlusPlus:   return 1.232;
1981   case Jpsi:            return 3.069916;
1982   case Eta_c:           return 2.9836;
1983   case Chi_c0:          return 3.41475;
1984   case Chi_c1:          return 3.51066;
1985   case Chi_c2:          return 3.55620;
1986   case Psi2s:           return 3.686109;
1987   case D0:              return 1.86484;
1988   case AntiD0:          return 1.86484;
1989   case DPlus:           return 1.86961;
1990   case Dstar0:          return 2.01026;
1991   case DstarPlus:       return 2.00696;
1992   case Lambda_c:        return 2.28646;
1993   default:
1994     fprintf(stderr,"ParticleMass: Error: Unknown particle type %d,",p);
1995     fprintf(stderr," returning HUGE_VAL...\n");
1996     return HUGE_VAL;
1997   }
1998 }
1999 
2000 inline static int ParticleCharge(Particle_t p)
2001 {
2002   p = RemapParticleID(p);
2003 
2004   switch (p) {
2005   case Unknown:     return  0;
2006   case Gamma:       return  0;
2007   case Positron:    return +1;
2008   case Electron:    return -1;
2009   case Neutrino:    return  0;
2010   case MuonPlus:    return +1;
2011   case MuonMinus:   return -1;
2012   case Pi0:     return  0;
2013   case PiPlus:      return +1;
2014   case PiMinus:     return -1;
2015   case KShort:      return  0;
2016   case KLong:       return  0;
2017   case KPlus:       return +1;
2018   case KMinus:      return -1;
2019   case Neutron:     return  0;
2020   case Proton:      return +1;
2021   case AntiProton:  return -1;
2022   case Eta:     return  0;
2023   case Lambda:      return  0;
2024   case SigmaPlus:   return +1;
2025   case Sigma0:      return  0;
2026   case SigmaMinus:  return -1;
2027   case Xi0:     return  0;
2028   case XiMinus:     return -1;
2029   case OmegaMinus:  return -1;
2030   case AntiNeutron: return  0;
2031   case AntiLambda:  return  0;
2032   case AntiSigmaMinus:  return -1;
2033   case AntiSigma0:  return  0;
2034   case AntiSigmaPlus:   return +1;
2035   case AntiXi0:     return  0;
2036   case AntiXiPlus:  return +1;
2037   case AntiOmegaPlus:   return +1;
2038   case Geantino:    return  0;
2039   case Rho0:        return  0;
2040   case RhoPlus:     return +1;
2041   case RhoMinus:    return -1;
2042   case omega:       return  0;
2043   case EtaPrime:    return  0;
2044   case phiMeson:    return  0;
2045   case a0_980:      return  0;
2046   case f0_980:      return  0;
2047   case KStar_892_0: return  0;
2048   case KStar_892_Plus: return  1;
2049   case KStar_892_Minus: return -1;
2050   case AntiKStar_892_0: return  0;
2051   case K1_1400_Plus: return  1;
2052   case K1_1400_Minus: return -1;
2053   case b1_1235_Plus: return 1;
2054   case Deuteron:    return 1;
2055   case Triton:      return 1;
2056   case Helium:      return 2;
2057   case He3:         return 2;
2058   case Li6:         return 3;
2059   case Li7:         return 3;
2060   case Be7:         return 4;
2061   case Be9:         return 4;
2062   case B10:         return 5;
2063   case B11:         return 5;
2064   case C12:         return 6;
2065   case N14:         return 7;
2066   case O16:         return 8;
2067   case F19:         return 9;
2068   case Ne20:        return 10;
2069   case Na23:        return 11;
2070   case Mg24:        return 12;
2071   case Al27:        return 13;
2072   case Si28:        return 14;
2073   case P31:         return 15;
2074   case S32:         return 16;
2075   case Cl35:        return 17;
2076   case Ar36:        return 18;
2077   case K39:         return 19;
2078   case Ca40:        return 20;
2079   case Sc45:        return 21;
2080   case Ti48:        return 22;
2081   case V51:         return 23;
2082   case Cr52:        return 24;
2083   case Mn55:        return 25;
2084   case Fe56:        return 26;
2085   case Co59:        return 27;
2086   case Ni58:        return 28;
2087   case Cu63:        return 29;
2088   case Zn64:        return 30;
2089   case Ge74:        return 32;
2090   case Se80:        return 34;
2091   case Kr84:        return 36;
2092   case Sr88:        return 38;
2093   case Zr90:        return 40;
2094   case Mo98:        return 42;
2095   case Pd106:       return 46;
2096   case Cd114:       return 48;
2097   case Sn120:       return 50;
2098   case Xe132:       return 54;
2099   case Ba138:       return 56;
2100   case Ce140:       return 58;
2101   case Sm152:       return 62;
2102   case Dy164:       return 66;
2103   case Yb174:       return 70;
2104   case W184:        return 74;
2105   case Pt194:       return 78;
2106   case Au197:       return 79;
2107   case Hg202:       return 80;
2108   case Pb208:       return 82;
2109   case U238:        return 92;
2110   case Sigma_1385_Minus:    return -1;
2111   case Sigma_1385_0:        return 0;
2112   case Sigma_1385_Plus: return 1;
2113   case DeltaPlusPlus: return 2;
2114   case Jpsi:    return 0;
2115   case Eta_c:   return 0;
2116   case Chi_c0:  return 0;
2117   case Chi_c1:  return 0;
2118   case Chi_c2:  return 0;
2119   case Psi2s:   return 0;
2120   case D0:      return 0;
2121   case AntiD0:  return 0;
2122   case DPlus:   return 1;
2123   case Dstar0:  return 0;
2124   case DstarPlus:  return 1;
2125   case Lambda_c:   return 1;
2126 
2127   default:
2128     fprintf(stderr,"ParticleCharge: Error: Unknown particle type %d,",p);
2129     fprintf(stderr," returning 0...\n");
2130     return 0;
2131   }
2132 }
2133 
2134 inline static int PDGtype(Particle_t p)
2135 {
2136   p = RemapParticleID(p);
2137 
2138   switch (p) {
2139   case Unknown:     return  0;
2140   case Gamma:       return  22;
2141   case Positron:    return -11;
2142   case Electron:    return  11;
2143   case Neutrino:    return  121416;
2144   case MuonPlus:    return -13;
2145   case MuonMinus:   return  13;
2146   case Pi0:     return  111;
2147   case PiPlus:      return  211;
2148   case PiMinus:     return -211;
2149   case KShort:      return  310;
2150   case KLong:       return  130;
2151   case KPlus:       return  321;
2152   case KMinus:      return -321;
2153   case Neutron:     return  2112;
2154   case Proton:      return  2212;
2155   case AntiProton:  return -2212;
2156   case Eta:     return  221;
2157   case Lambda:      return  3122;
2158   case SigmaPlus:   return  3222;
2159   case Sigma0:      return  3212;
2160   case SigmaMinus:  return  3112;
2161   case Xi0:     return  3322;
2162   case XiMinus:     return  3312;
2163   case OmegaMinus:  return  3334;
2164   case AntiNeutron: return -2112;
2165   case AntiLambda:  return -3122;
2166   case AntiSigmaMinus:  return -3112;
2167   case AntiSigma0:  return -3212;
2168   case AntiSigmaPlus:   return -3222;
2169   case AntiXi0:     return -3322;
2170   case AntiXiPlus:  return -3312;
2171   case AntiOmegaPlus:   return -3334;
2172   case Geantino:    return  0;
2173   case Rho0:        return  113;
2174   case RhoPlus:     return  213;
2175   case RhoMinus:    return -213;
2176   case omega:       return  223;
2177   case EtaPrime:    return  331;
2178   case phiMeson:    return  333;
2179   case a0_980:      return  9000110;
2180   case f0_980:      return  9010221;
2181   case KStar_892_0: return  313;
2182   case AntiKStar_892_0: return  -313;
2183   case KStar_892_Plus: return  323;
2184   case KStar_892_Minus: return -323;
2185   case K1_1400_Plus: return  20323;
2186   case K1_1400_Minus: return  -20323;
2187   case b1_1235_Plus: return  10213;
2188   case Deuteron:        return  45;
2189   case Triton:      return  46;
2190   case Helium:      return  47;
2191   case He3:         return  49;
2192   case Sigma_1385_Minus:    return 3114;
2193   case Sigma_1385_0:        return 3214;
2194   case Sigma_1385_Plus: return 3224;
2195   case Li6:      return 1000030060;
2196   case Li7:      return 1000030070;
2197   case Be7:      return 1000040070;
2198   case Be9:      return 1000040090;
2199   case B10:      return 1000050100;
2200   case B11:      return 1000050110;
2201   case C12:      return 1000060120;
2202   case N14:      return 1000070140;
2203   case O16:      return 1000080160;
2204   case F19:      return 1000090190;
2205   case Ne20:     return 1000100200;
2206   case Na23:     return 1000110230;
2207   case Mg24:     return 1000120240;
2208   case Al27:     return 1000130270;
2209   case Si28:     return 1000140280;
2210   case P31:      return 1000150310;
2211   case S32:      return 1000160320;
2212   case Cl35:     return 1000170350;
2213   case Ar36:     return 1000180360;
2214   case K39:      return 1000190390;
2215   case Ca40:     return 1000200400;
2216   case Sc45:     return 1000210450;
2217   case Ti48:     return 1000220480;
2218   case V51:      return 1000230510;
2219   case Cr52:     return 1000240520;
2220   case Mn55:     return 1000250550;
2221   case Fe56:     return 1000260560;
2222   case Co59:     return 1000270590;
2223   case Ni58:     return 1000280580;
2224   case Cu63:     return 1000290630;
2225   case Zn64:     return 1000300640;
2226   case Ge74:     return 1000320740;
2227   case Se80:     return 1000340800;
2228   case Kr84:     return 1000360840;
2229   case Sr88:     return 1000380880;
2230   case Zr90:     return 1000400900;
2231   case Mo98:     return 1000420980;
2232   case Pd106:    return 1000461060;
2233   case Cd114:    return 1000481140;
2234   case Sn120:    return 1000501200;
2235   case Xe132:    return 1000541320;
2236   case Ba138:    return 1000561380;
2237   case Ce140:    return 1000581400;
2238   case Sm152:    return 1000621520;
2239   case Dy164:    return 1000661640;
2240   case Yb174:    return 1000701740;
2241   case W184:     return 1000741840;
2242   case Pt194:    return 1000781940;
2243   case Au197:    return 1000791970;
2244   case Hg202:    return 1000802020;
2245   case Pb208:    return 1000822080;
2246   case U238:     return 1000922380;
2247   case DeltaPlusPlus: return 2224;
2248   case Jpsi:          return 443;
2249   case Eta_c:         return 441;
2250   case Chi_c0:        return 10441;
2251   case Chi_c1:        return 20443;
2252   case Chi_c2:        return 445;
2253   case Psi2s:         return 100443;
2254   case D0:            return 421;
2255   case AntiD0:        return -421; //FIX!!
2256   case DPlus:         return 411;
2257   case Dstar0:        return 423;
2258   case DstarPlus:     return 413;
2259   case Lambda_c:      return 4122;
2260   default:      return  0;
2261   }
2262 }
2263 
2264 inline static Particle_t PDGtoPType(int locPDG_PID)
2265 {
2266   switch (locPDG_PID) {
2267   case 0:               return Unknown;
2268   case 22:          return Gamma;
2269   case -11:         return Positron;
2270   case 11:          return Electron;
2271   case 121416:      return Neutrino;
2272   case -13:         return MuonPlus;
2273   case 13:          return MuonMinus;
2274   case 111:         return Pi0;
2275   case 211:         return PiPlus;
2276   case -211:            return PiMinus;
2277   case 310:         return KShort;
2278   case 130:         return KLong;
2279   case 321:         return KPlus;
2280   case -321:            return KMinus;
2281   case 2112:            return Neutron;
2282   case 2212:            return Proton;
2283   case -2212:       return AntiProton;
2284   case 221:         return Eta;
2285   case 3122:            return Lambda;
2286   case 3222:            return SigmaPlus;
2287   case 3212:            return Sigma0;
2288   case 3112:            return SigmaMinus;
2289   case 3322:            return Xi0;
2290   case 3312:            return XiMinus;
2291   case 3334:            return OmegaMinus;
2292   case -2112:       return AntiNeutron;
2293   case -3122:       return AntiLambda;
2294   case -3112:       return AntiSigmaMinus;
2295   case -3212:       return AntiSigma0;
2296   case -3222:       return AntiSigmaPlus;
2297   case -3322:       return AntiXi0;
2298   case -3312:       return AntiXiPlus;
2299   case -3334:       return AntiOmegaPlus;
2300   case 113:         return Rho0;
2301   case 213:         return RhoPlus;
2302   case -213:            return RhoMinus;
2303   case 223:         return omega;
2304   case 331:         return EtaPrime;
2305   case 333:         return phiMeson;
2306   case 9000110:     return a0_980;
2307   case 9010221:     return f0_980;
2308   case 313:             return KStar_892_0;
2309   case -313:            return AntiKStar_892_0;
2310   case 323:         return KStar_892_Plus;
2311   case -323:            return KStar_892_Minus;
2312   case 20323:       return K1_1400_Plus;
2313   case -20323:      return K1_1400_Minus;
2314   case 10213:       return b1_1235_Plus;
2315   case 45:          return Deuteron;
2316   case 46:          return Triton;
2317   case 47:          return Helium;
2318   case 49:          return He3;
2319   case 3114:            return Sigma_1385_Minus;
2320   case 3214:            return Sigma_1385_0;
2321   case 3224:            return Sigma_1385_Plus;
2322   case 1000030060:  return Li6;
2323   case 1000030070:  return Li7;
2324   case 1000040070:  return Be7;
2325   case 1000040090:  return Be9;
2326   case 1000050100:  return B10;
2327   case 1000050110:  return B11;
2328   case 1000060120:  return C12;
2329   case 1000070140:  return N14;
2330   case 1000080160:  return O16;
2331   case 1000090190:  return F19;
2332   case 1000100200:  return Ne20;
2333   case 1000110230:  return Na23;
2334   case 1000120240:  return Mg24;
2335   case 1000130270:  return Al27;
2336   case 1000140280:  return Si28;
2337   case 1000150310:  return P31;
2338   case 1000160320:  return S32;
2339   case 1000170350:  return Cl35;
2340   case 1000180360:  return Ar36;
2341   case 1000190390:  return K39;
2342   case 1000200400:  return Ca40;
2343   case 1000210450:  return Sc45;
2344   case 1000220480:  return Ti48;
2345   case 1000230510:  return V51;
2346   case 1000240520:  return Cr52;
2347   case 1000250550:  return Mn55;
2348   case 1000260560:  return Fe56;
2349   case 1000270590:  return Co59;
2350   case 1000280580:  return Ni58;
2351   case 1000290630:  return Cu63;
2352   case 1000300640:  return Zn64;
2353   case 1000320740:  return Ge74;
2354   case 1000340800:  return Se80;
2355   case 1000360840:  return Kr84;
2356   case 1000380880:  return Sr88;
2357   case 1000400900:  return Zr90;
2358   case 1000420980:  return Mo98;
2359   case 1000461060:  return Pd106;
2360   case 1000481140:  return Cd114;
2361   case 1000501200:  return Sn120;
2362   case 1000541320:  return Xe132;
2363   case 1000561380:  return Ba138;
2364   case 1000581400:  return Ce140;
2365   case 1000621520:  return Sm152;
2366   case 1000661640:  return Dy164;
2367   case 1000701740:  return Yb174;
2368   case 1000741840:  return W184;
2369   case 1000781940:  return Pt194;
2370   case 1000791970:  return Au197;
2371   case 1000802020:  return Hg202;
2372   case 1000822080:  return Pb208;
2373   case 1000922380:  return U238;
2374   case 2224:         return DeltaPlusPlus;
2375   case 443:          return Jpsi;
2376   case 441:          return Eta_c;
2377   case 10441:        return Chi_c0;
2378   case 20443:        return Chi_c1;
2379   case 445:          return Chi_c2;
2380   case 100443:       return Psi2s;
2381   case 421:          return D0;
2382   case -421:         return AntiD0;
2383   case 411:          return DPlus;
2384   case 423:          return Dstar0;
2385   case 413:          return DstarPlus;
2386   case 4122:         return Lambda_c;
2387   default:          return Unknown;
2388   }
2389 }
2390 
2391 inline static int Is_FinalStateParticle(Particle_t locPID)
2392 {
2393     switch(locPID)
2394     {
2395         case Gamma:       return 1;
2396         case Positron:    return 1;
2397         case Electron:    return 1;
2398         case Neutrino:    return 1;
2399         case MuonPlus:    return 1;
2400         case MuonMinus:   return 1;
2401         case PiPlus:      return 1;
2402         case PiMinus:     return 1;
2403         case KLong:       return 1;
2404         case KPlus:       return 1;
2405         case KMinus:      return 1;
2406         case Neutron:     return 1;
2407         case Proton:      return 1;
2408         case AntiProton:  return 1;
2409         case AntiNeutron: return 1;
2410         case Deuteron:    return 1;
2411         case Triton:      return 1;
2412         case Helium:      return 1;
2413         case He3:         return 1;
2414         case Li6:         return 1;
2415         case Li7:         return 1;
2416         case Be7:         return 1;
2417         case Be9:         return 1;
2418         case B10:         return 1;
2419         case B11:         return 1;
2420         case C12:         return 1;
2421         case N14:         return 1;
2422         case O16:         return 1;
2423         case F19:         return 1;
2424         case Ne20:        return 1;
2425         case Na23:        return 1;
2426         case Mg24:        return 1;
2427         case Al27:        return 1;
2428         case Si28:        return 1;
2429         case P31:         return 1;
2430         case S32:         return 1;
2431         case Cl35:        return 1;
2432         case Ar36:        return 1;
2433         case K39:         return 1;
2434         case Ca40:        return 1;
2435         case Sc45:        return 1;
2436         case Ti48:        return 1;
2437         case V51:         return 1;
2438         case Cr52:        return 1;
2439         case Mn55:        return 1;
2440         case Fe56:        return 1;
2441         case Co59:        return 1;
2442         case Ni58:        return 1;
2443         case Cu63:        return 1;
2444         case Zn64:        return 1;
2445         case Ge74:        return 1;
2446         case Se80:        return 1;
2447         case Kr84:        return 1;
2448         case Sr88:        return 1;
2449         case Zr90:        return 1;
2450         case Mo98:        return 1;
2451         case Pd106:       return 1;
2452         case Cd114:       return 1;
2453         case Sn120:       return 1;
2454         case Xe132:       return 1;
2455         case Ba138:       return 1;
2456         case Ce140:       return 1;
2457         case Sm152:       return 1;
2458         case Dy164:       return 1;
2459         case Yb174:       return 1;
2460         case W184:        return 1;
2461         case Pt194:       return 1;
2462         case Au197:       return 1;
2463         case Hg202:       return 1;
2464         case Pb208:       return 1;
2465         case U238:        return 1;
2466         default: return 0; //decaying
2467     }
2468 }
2469 
2470 inline static char* Get_ShortName(Particle_t locPID)
2471 {
2472     switch (locPID) {
2473     case Gamma:
2474         return (char*)"g";
2475     case Positron:
2476         return (char*)"ep";
2477     case Electron:
2478         return (char*)"em";
2479     case Neutrino:
2480         return (char*)"neut";
2481     case MuonPlus:
2482         return (char*)"mup";
2483     case MuonMinus:
2484         return (char*)"mum";
2485     case Pi0:
2486         return (char*)"pi0";
2487     case PiPlus:
2488         return (char*)"pip";
2489     case PiMinus:
2490         return (char*)"pim";
2491     case KLong:
2492         return (char*)"kl";
2493     case KPlus:
2494         return (char*)"kp";
2495     case KMinus:
2496         return (char*)"km";
2497     case Neutron:
2498         return (char*)"n";
2499     case Proton:
2500         return (char*)"p";
2501     case AntiProton:
2502         return (char*)"pbar";
2503     case KShort:
2504         return (char*)"ks";
2505     case Eta:
2506         return (char*)"eta";
2507 
2508     case Lambda:
2509         return (char*)"lamb";
2510     case SigmaPlus:
2511         return (char*)"sigp";
2512     case Sigma0:
2513         return (char*)"sig0";
2514     case SigmaMinus:
2515         return (char*)"sigm";
2516     case Xi0:
2517         return (char*)"xi0";
2518     case XiMinus:
2519         return (char*)"xim";
2520     case OmegaMinus:
2521         return (char*)"omgm";
2522 
2523     case AntiNeutron:
2524         return (char*)"nbar";
2525     case AntiLambda:
2526         return (char*)"lbar";
2527     case AntiSigmaMinus:
2528         return (char*)"sigmbar";
2529     case AntiSigma0:
2530         return (char*)"sig0bar";
2531     case AntiSigmaPlus:
2532         return (char*)"sigpbar";
2533     case AntiXi0:
2534         return (char*)"xi0bar";
2535     case AntiXiPlus:
2536         return (char*)"xipbar";
2537     case AntiOmegaPlus:
2538         return (char*)"omgpbar";
2539 
2540     case omega:
2541         return (char*)"omg";
2542     case EtaPrime:
2543         return (char*)"etap";
2544     case phiMeson:
2545         return (char*)"phi";
2546 
2547     case Deuteron:
2548         return (char*)"d";
2549     case Triton:
2550         return (char*)"tri";
2551     case Helium:
2552         return (char*)"he";
2553     case He3:
2554         return (char*)"he3";
2555     case Li6:
2556         return (char*)"li6";
2557     case Li7:
2558         return (char*)"li7";
2559     case Be7:
2560         return (char*)"be7";
2561     case Be9:
2562         return (char*)"be9";
2563     case B10:
2564         return (char*)"b10";
2565     case B11:
2566         return (char*)"b11";
2567     case C12:
2568         return (char*)"c12";
2569     case N14:
2570         return (char*)"n14";
2571     case O16:
2572         return (char*)"o16";
2573     case F19:
2574         return (char*)"f19";
2575     case Ne20:
2576         return (char*)"ne20";
2577     case Na23:
2578         return (char*)"na23";
2579     case Mg24:
2580         return (char*)"mg24";
2581     case Al27:
2582         return (char*)"al27";
2583     case Si28:
2584         return (char*)"si28";
2585     case P31:
2586         return (char*)"p31";
2587     case S32:
2588         return (char*)"s32";
2589     case Cl35:
2590         return (char*)"cl35";
2591     case Ar36:
2592         return (char*)"ar36";
2593     case K39:
2594         return (char*)"k39";
2595     case Ca40:
2596         return (char*)"ca40";
2597     case Sc45:
2598         return (char*)"sc45";
2599     case Ti48:
2600         return (char*)"ti48";
2601     case V51:
2602         return (char*)"v51";
2603     case Cr52:
2604         return (char*)"cr52";
2605     case Mn55:
2606         return (char*)"mn55";
2607     case Fe56:
2608         return (char*)"fe56";
2609     case Co59:
2610         return (char*)"co59";
2611     case Ni58:
2612         return (char*)"ni58";
2613     case Cu63:
2614         return (char*)"cu63";
2615     case Zn64:
2616         return (char*)"zn64";
2617     case Ge74:
2618         return (char*)"ge74";
2619     case Se80:
2620         return (char*)"se80";
2621     case Kr84:
2622         return (char*)"kr84";
2623     case Sr88:
2624         return (char*)"sr88";
2625     case Zr90:
2626         return (char*)"zr90";
2627     case Mo98:
2628         return (char*)"mo98";
2629     case Pd106:
2630         return (char*)"pd106";
2631     case Cd114:
2632         return (char*)"cd114";
2633     case Sn120:
2634         return (char*)"sn120";
2635     case Xe132:
2636         return (char*)"xe132";
2637     case Ba138:
2638         return (char*)"ba138";
2639     case Ce140:
2640         return (char*)"ce140";
2641     case Sm152:
2642         return (char*)"sm152";
2643     case Dy164:
2644         return (char*)"dy164";
2645     case Yb174:
2646         return (char*)"yb174";
2647     case W184:
2648         return (char*)"w184";
2649     case Pt194:
2650         return (char*)"pt194";
2651     case Au197:
2652         return (char*)"au197";
2653     case Hg202:
2654         return (char*)"hg202";
2655     case Pb208:
2656         return (char*)"pb208";
2657     case U238:
2658         return (char*)"u238";
2659     case Jpsi:
2660         return (char*)"jpsi";
2661     case Eta_c:
2662         return (char*)"etac";
2663     case Chi_c0:
2664         return (char*)"chic0";
2665     case Chi_c1:
2666         return (char*)"chic1";
2667     case Chi_c2:
2668         return (char*)"chic2";
2669     case Psi2s:
2670         return (char*)"psi2S";
2671     case D0:
2672         return (char*)"d0";
2673     case AntiD0:
2674         return (char*)"d0bar";
2675     case DPlus:
2676         return (char*)"dp";
2677     case Lambda_c:
2678         return (char*)"lambc";
2679 
2680     default:
2681         return (char*)"Unknown";
2682     }
2683 }
2684 
2685 inline static int ParticleMultiplexPower(Particle_t locPID)
2686 {
2687    locPID = RemapParticleID(locPID);
2688 
2689     switch(locPID)
2690     {
2691         //FINAL-STATE PARTICLES (+ pi0) (decimal: 10^power):
2692         case Gamma:       return 0;
2693         case Positron:    return 1;
2694         case Electron:    return 2;
2695         case Neutrino:    return 3;
2696         case MuonPlus:    return 4;
2697         case MuonMinus:   return 5;
2698         case Pi0:         return 6;
2699         case PiPlus:      return 7;
2700         case PiMinus:     return 8;
2701         case KLong:       return 9;
2702         case KPlus:       return 10;
2703         case KMinus:      return 11;
2704         case Neutron:     return 12;
2705         case Proton:      return 13;
2706         case AntiProton:  return 14;
2707         case AntiNeutron: return 15;
2708 
2709         //DECAYING PARTICLES (- pi0): (binary: 2^power)
2710         case KShort:           return 0;
2711         case Eta:              return 1;
2712         case Lambda:           return 2;
2713         case SigmaPlus:        return 3;
2714         case Sigma0:           return 4;
2715         case SigmaMinus:       return 5;
2716         case Xi0:              return 6;
2717         case XiMinus:          return 7;
2718         case OmegaMinus:       return 8;
2719         case AntiLambda:       return 9;
2720         case AntiSigmaMinus:   return 10;
2721         case AntiSigma0:       return 11;
2722         case AntiSigmaPlus:    return 12;
2723         case AntiXi0:          return 13;
2724         case AntiXiPlus:       return 14;
2725         case AntiOmegaPlus:    return 15;
2726         case Deuteron:         return 16;
2727         case Rho0:             return 17;
2728         case RhoPlus:          return 18;
2729         case RhoMinus:         return 19;
2730         case omega:            return 20;
2731         case EtaPrime:         return 21;
2732         case phiMeson:         return 22;
2733         case a0_980:           return 23;
2734         case f0_980:           return 24;
2735         case KStar_892_0:      return 25;
2736         case KStar_892_Plus:   return 26;
2737         case KStar_892_Minus:  return 27;
2738         case AntiKStar_892_0:  return 28;
2739         case K1_1400_Plus:     return 29;
2740         case K1_1400_Minus:    return 30;
2741         case b1_1235_Plus:     return 31;
2742         case Sigma_1385_Minus: return 32;
2743         case Sigma_1385_0:     return 33;
2744         case Sigma_1385_Plus:  return 34;
2745         case DeltaPlusPlus:    return 35;
2746         case Jpsi:             return 36;
2747         case Eta_c:            return 37;
2748         case Chi_c0:           return 38;
2749         case Chi_c1:           return 39;
2750         case Chi_c2:           return 40;
2751         case Psi2s:            return 41;
2752         case D0:               return 42;
2753         case DPlus:            return 43;
2754         case Dstar0:           return 44;
2755         case DstarPlus:        return 45;
2756         case Lambda_c:         return 46;
2757         case AntiD0:           return 47;
2758         default: return -1;
2759     }
2760 }
2761 
2762 inline static Particle_t DemultiplexPID(int locBit, int locIsDecayingFlag)
2763 {
2764     //FINAL-STATE PARTICLES (+ pi0) (decimal: 10^power):
2765     if(locIsDecayingFlag == 0)
2766     {
2767         switch(locBit)
2768         {
2769             case 0:   return Gamma;
2770             case 1:   return Positron;
2771             case 2:   return Electron;
2772             case 3:   return Neutrino;
2773             case 4:   return MuonPlus;
2774             case 5:   return MuonMinus;
2775             case 6:   return Pi0;
2776             case 7:   return PiPlus;
2777             case 8:   return PiMinus;
2778             case 9:   return KLong;
2779             case 10:  return KPlus;
2780             case 11:  return KMinus;
2781             case 12:  return Neutron;
2782             case 13:  return Proton;
2783             case 14:  return AntiProton;
2784             case 15:  return AntiNeutron;
2785             default:  return Unknown;
2786         }
2787     }
2788 
2789     //DECAYING PARTICLES (- pi0): (binary: 2^power)
2790     switch(locBit)
2791     {
2792         case 0:   return KShort;
2793         case 1:   return Eta;
2794         case 2:   return Lambda;
2795         case 3:   return SigmaPlus;
2796         case 4:   return Sigma0;
2797         case 5:   return SigmaMinus;
2798         case 6:   return Xi0;
2799         case 7:   return XiMinus;
2800         case 8:   return OmegaMinus;
2801         case 9:   return AntiLambda;
2802         case 10:  return AntiSigmaMinus;
2803         case 11:  return AntiSigma0;
2804         case 12:  return AntiSigmaPlus;
2805         case 13:  return AntiXi0;
2806         case 14:  return AntiXiPlus;
2807         case 15:  return AntiOmegaPlus;
2808         case 16:  return Deuteron;
2809         case 17:  return Rho0;
2810         case 18:  return RhoPlus;
2811         case 19:  return RhoMinus;
2812         case 20:  return omega;
2813         case 21:  return EtaPrime;
2814         case 22:  return phiMeson;
2815         case 23:  return a0_980;
2816         case 24:  return f0_980;
2817         case 25:  return KStar_892_0;
2818         case 26:  return KStar_892_Plus;
2819         case 27:  return KStar_892_Minus;
2820         case 28:  return AntiKStar_892_0;
2821         case 29:  return K1_1400_Plus;
2822         case 30:  return K1_1400_Minus;
2823         case 31:  return b1_1235_Plus;
2824         case 32:  return Sigma_1385_Minus;
2825         case 33:  return Sigma_1385_0;
2826         case 34:  return Sigma_1385_Plus;
2827         case 35:  return DeltaPlusPlus;
2828         case 36:  return Jpsi;
2829         case 37:  return Eta_c;
2830         case 38:  return Chi_c0;
2831         case 39:  return Chi_c1;
2832         case 40:  return Chi_c2;
2833         case 41:  return Psi2s;
2834         case 42:  return D0;
2835         case 43:  return DPlus;
2836         case 44:  return Dstar0;
2837         case 45:  return DstarPlus;
2838         case 46:  return Lambda_c;
2839       case 47:  return AntiD0;
2840         default:  return Unknown;
2841     }
2842 }
2843 
2844 typedef enum
2845 {
2846     d_Charged,
2847     d_Positive,
2848     d_Negative,
2849     d_Neutral,
2850     d_AllCharges
2851 } Charge_t;
2852 
2853 inline static int Is_CorrectCharge(Particle_t locPID, Charge_t locCharge)
2854 {
2855     if(locPID == Unknown)
2856         return (locCharge == d_AllCharges);
2857     int locIntCharge = ParticleCharge(locPID);
2858     switch(locCharge)
2859     {
2860         case d_Neutral:
2861             return (locIntCharge == 0);
2862         case d_Positive:
2863             return (locIntCharge > 0);
2864         case d_Negative:
2865             return (locIntCharge < 0);
2866         case d_Charged:
2867             return (locIntCharge != 0);
2868         case d_AllCharges:
2869             return 1;
2870         default:
2871             return 0;
2872     }
2873 }
2874 
2875 // Deduce particle type from charge and mass
2876 inline static Particle_t IDTrack(float locCharge, float locMass)
2877 {
2878         float locMassTolerance = 0.010;
2879         if (locCharge > 0.1) // Positive particles
2880         { 
2881       if (fabs(locMass - ParticleMass(Triton)) < locMassTolerance) return Triton;
2882                 if (fabs(locMass - ParticleMass(Deuteron)) < locMassTolerance) return Deuteron;
2883                 if (fabs(locMass - ParticleMass(Proton)) < locMassTolerance) return Proton;
2884                 if (fabs(locMass - ParticleMass(PiPlus)) < locMassTolerance) return PiPlus;
2885                 if (fabs(locMass - ParticleMass(KPlus)) < locMassTolerance) return KPlus;
2886                 if (fabs(locMass - ParticleMass(Positron)) < locMassTolerance) return Positron;
2887                 if (fabs(locMass - ParticleMass(MuonPlus)) < locMassTolerance) return MuonPlus;
2888         }
2889         else if(locCharge < -0.1) // Negative particles
2890         {
2891                 if (fabs(locMass - ParticleMass(PiMinus)) < locMassTolerance) return PiMinus;
2892                 if (fabs(locMass - ParticleMass(KMinus)) < locMassTolerance) return KMinus;
2893                 if (fabs(locMass - ParticleMass(MuonMinus)) < locMassTolerance) return MuonMinus;
2894                 if (fabs(locMass - ParticleMass(Electron)) < locMassTolerance) return Electron;
2895                 if (fabs(locMass - ParticleMass(AntiProton)) < locMassTolerance) return AntiProton;
2896         }
2897         else //Neutral Track
2898         {
2899                 if (fabs(locMass - ParticleMass(Gamma)) < locMassTolerance) return Gamma;
2900                 if (fabs(locMass - ParticleMass(Neutron)) < locMassTolerance) return Neutron;
2901         }
2902         return Unknown;
2903 }
2904 
2905 
2906 #endif