Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:53

0001 #ifndef RIVET_PARTICLENAME_HH
0002 #define RIVET_PARTICLENAME_HH
0003 
0004 #include "Rivet/Particle.fhh"
0005 #include "Rivet/Tools/Exceptions.hh"
0006 
0007 // cython includes termio.h on some systems,
0008 // which #defines a B0 = 0 macro
0009 #undef B0
0010 
0011 namespace Rivet {
0012 
0013   namespace PID {
0014 
0015 
0016     /// Static const convenience particle ID names
0017 
0018     /// Special wildcard particle name
0019     constexpr PdgId ANY = 10000;
0020 
0021     /// @name Charged leptons
0022     /// @{
0023     constexpr PdgId ELECTRON = 11;
0024     constexpr PdgId POSITRON = -ELECTRON;
0025     constexpr PdgId EMINUS = ELECTRON;
0026     constexpr PdgId EPLUS = POSITRON;
0027     constexpr PdgId MUON = 13;
0028     constexpr PdgId ANTIMUON = -MUON;
0029     constexpr PdgId TAU = 15;
0030     constexpr PdgId ANTITAU = -TAU;
0031     /// @}
0032 
0033     /// @name Neutrinos
0034     /// @{
0035     constexpr PdgId NU_E = 12;
0036     constexpr PdgId NU_EBAR = -NU_E;
0037     constexpr PdgId NU_MU = 14;
0038     constexpr PdgId NU_MUBAR = -NU_MU;
0039     constexpr PdgId NU_TAU = 16;
0040     constexpr PdgId NU_TAUBAR = -NU_TAU;
0041     /// @}
0042 
0043     /// @name Bosons
0044     /// @{
0045     constexpr PdgId PHOTON = 22;
0046     constexpr PdgId GAMMA = PHOTON;
0047     constexpr PdgId GLUON = 21;
0048     constexpr PdgId WPLUSBOSON = 24;
0049     constexpr PdgId WMINUSBOSON = -WPLUSBOSON;
0050     constexpr PdgId WPLUS = WPLUSBOSON;
0051     constexpr PdgId WMINUS = WMINUSBOSON;
0052     constexpr PdgId WBOSON = WPLUSBOSON;
0053     constexpr PdgId Z0BOSON = 23;
0054     constexpr PdgId ZBOSON = Z0BOSON;
0055     constexpr PdgId Z0 = Z0BOSON;
0056     constexpr PdgId HIGGSBOSON = 25;
0057     constexpr PdgId HIGGS = HIGGSBOSON;
0058     constexpr PdgId H0BOSON = HIGGSBOSON;
0059     constexpr PdgId HBOSON = HIGGSBOSON;
0060     /// @}
0061 
0062     /// @name Quarks
0063     /// @{
0064     constexpr PdgId DQUARK = 1;
0065     constexpr PdgId UQUARK = 2;
0066     constexpr PdgId SQUARK = 3;
0067     constexpr PdgId CQUARK = 4;
0068     constexpr PdgId BQUARK = 5;
0069     constexpr PdgId TQUARK = 6;
0070     /// @}
0071 
0072     /// @name Nucleons
0073     /// @{
0074     constexpr PdgId PROTON = 2212;
0075     constexpr PdgId ANTIPROTON = -PROTON;
0076     constexpr PdgId PBAR = ANTIPROTON;
0077     constexpr PdgId NEUTRON = 2112;
0078     constexpr PdgId ANTINEUTRON = -NEUTRON;
0079     /// @}
0080 
0081     /// @name Light mesons
0082     /// @{
0083     constexpr PdgId PI0 = 111;
0084     constexpr PdgId PIPLUS = 211;
0085     constexpr PdgId PIMINUS = -PIPLUS;
0086     constexpr PdgId RHO0 = 113;
0087     constexpr PdgId RHOPLUS = 213;
0088     constexpr PdgId RHOMINUS = -RHOPLUS;
0089     constexpr PdgId K0L = 130;
0090     constexpr PdgId K0S = 310;
0091     constexpr PdgId K0 = 311;
0092     constexpr PdgId KPLUS = 321;
0093     constexpr PdgId KMINUS = -KPLUS;
0094     constexpr PdgId ETA = 221;
0095     constexpr PdgId ETAPRIME = 331;
0096     constexpr PdgId PHI = 333;
0097     constexpr PdgId OMEGA = 223;
0098     /// @}
0099 
0100     /// @name Charmonia
0101     /// @{
0102     constexpr PdgId ETAC = 441;
0103     constexpr PdgId JPSI = 443;
0104     constexpr PdgId PSI2S = 100443;
0105     /// @}
0106 
0107     /// @name Charm mesons
0108     /// @{
0109     constexpr PdgId D0 = 421;
0110     constexpr PdgId D0BAR = -421;
0111     constexpr PdgId DPLUS = 411;
0112     constexpr PdgId DMINUS = -DPLUS;
0113     constexpr PdgId DSTARPLUS = 413;
0114     constexpr PdgId DSTARMINUS = -DSTARPLUS;
0115     constexpr PdgId DSPLUS = 431;
0116     constexpr PdgId DSMINUS = -DSPLUS;
0117     /// @}
0118 
0119     /// @name Bottomonia
0120     /// @{
0121     constexpr PdgId ETAB = 551;
0122     constexpr PdgId UPSILON1S = 553;
0123     constexpr PdgId UPSILON2S = 100553;
0124     constexpr PdgId UPSILON3S = 200553;
0125     constexpr PdgId UPSILON4S = 300553;
0126     /// @}
0127 
0128     /// @name b mesons
0129     /// @{
0130     constexpr PdgId B0 = 511;
0131     constexpr PdgId B0BAR = -511;
0132     constexpr PdgId BPLUS = 521;
0133     constexpr PdgId BMINUS = -BPLUS;
0134     constexpr PdgId B0S = 531;
0135     constexpr PdgId BCPLUS = 541;
0136     constexpr PdgId BCMINUS = -BCPLUS;
0137     /// @}
0138 
0139     /// @name Baryons
0140     /// @{
0141     constexpr PdgId LAMBDA = 3122;
0142     constexpr PdgId SIGMA0 = 3212;
0143     constexpr PdgId SIGMAPLUS = 3222;
0144     constexpr PdgId SIGMAMINUS = 3112;
0145     constexpr PdgId SIGMAB = 5212;
0146     constexpr PdgId SIGMABPLUS = 5222;
0147     constexpr PdgId SIGMABMINUS = 5112;
0148     constexpr PdgId LAMBDACPLUS = 4122;
0149     constexpr PdgId LAMBDACMINUS = -4122;
0150     constexpr PdgId LAMBDAB = 5122;
0151     constexpr PdgId XI0 = 3322;
0152     constexpr PdgId XIMINUS = 3312;
0153     constexpr PdgId XIPLUS = -XIMINUS;
0154     constexpr PdgId XI0B = 5232;
0155     constexpr PdgId XIBMINUS = 5132;
0156     constexpr PdgId XI0C = 4132;
0157     constexpr PdgId XICPLUS = 4232;
0158     constexpr PdgId OMEGAMINUS = 3334;
0159     constexpr PdgId OMEGAPLUS = -OMEGAMINUS;
0160     constexpr PdgId OMEGABMINUS = 5332;
0161     constexpr PdgId OMEGA0C = 4332;
0162     /// @}
0163 
0164     /// @name Exotic/weird stuff
0165     /// @{
0166     constexpr PdgId REGGEON = 110;
0167     constexpr PdgId POMERON = 990;
0168     constexpr PdgId ODDERON = 9990;
0169     constexpr PdgId GRAVITON = 39;
0170     constexpr PdgId NEUTRALINO1 = 1000022;
0171     constexpr PdgId GRAVITINO = 1000039;
0172     constexpr PdgId GLUINO = 1000021;
0173     constexpr int BPRIME = 7;
0174     constexpr int TPRIME = 8;
0175     constexpr int LPRIME = 17;
0176     constexpr int NUPRIME = 18;
0177     // constexpr int DARKMATTERSCALAR = 1000051;
0178     // constexpr int DARKMATTERFERMION = 1000052;
0179     // constexpr int DARKMATTERVECTOR = 1000053;
0180     /// @todo Add axion, black hole remnant, etc. on demand
0181     /// @}
0182 
0183     /// @name Nuclei
0184     /// @{
0185     constexpr PdgId DEUTERON = 1000010020;
0186     constexpr PdgId ALUMINIUM = 1000130270;
0187     constexpr PdgId COPPER = 1000290630;
0188     constexpr PdgId XENON = 1000541290;
0189     constexpr PdgId GOLD = 1000791970;
0190     constexpr PdgId LEAD = 1000822080;
0191     constexpr PdgId URANIUM = 1000922380;
0192     /// @todo Add other nuclei on demand
0193     /// @}
0194 
0195 
0196 
0197     /// Handler for particle name code <-> string conversion
0198     ///
0199     /// @todo Hide this utility class or equiv in an unnamed namespace in a .cc file.
0200     class ParticleNames {
0201     public:
0202 
0203       static std::string particleName(PdgId pid) {
0204         if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
0205         return _instance->_particleName(pid);
0206       }
0207 
0208       static PdgId particleID(const std::string& pname) {
0209         if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
0210         return _instance->_particleID(pname);
0211       }
0212 
0213       std::string _particleName(PdgId pid);
0214 
0215       PdgId _particleID(const std::string& pname);
0216 
0217 
0218     private:
0219 
0220       ParticleNames() {
0221         // charged leptons
0222         _add_pid_name(ELECTRON, "ELECTRON");
0223         _add_pid_name(POSITRON, "POSITRON");
0224         _add_pid_name(MUON, "MUON");
0225         _add_pid_name(ANTIMUON, "ANTIMUON");
0226         _add_pid_name(TAU, "TAU");
0227         _add_pid_name(ANTITAU, "ANTITAU");
0228         // neutrinos
0229         _add_pid_name(NU_E, "NU_E");
0230         _add_pid_name(NU_EBAR, "NU_EBAR");
0231         _add_pid_name(NU_MU, "NU_MU");
0232         _add_pid_name(NU_MUBAR, "NU_MUBAR");
0233         _add_pid_name(NU_TAU, "NU_TAU");
0234         _add_pid_name(NU_TAUBAR, "NU_TAUBAR");
0235         // bosons
0236         _add_pid_name(GLUON, "GLUON");
0237         _add_pid_name(PHOTON, "PHOTON");
0238         _add_pid_name(WPLUSBOSON, "WPLUSBOSON");
0239         _add_pid_name(WMINUSBOSON, "WMINUSBOSON");
0240         _add_pid_name(ZBOSON, "ZBOSON");
0241         _add_pid_name(HIGGS, "HIGGS");
0242         // quarks
0243         _add_pid_name(DQUARK, "DOWN");
0244         _add_pid_name(UQUARK, "UP");
0245         _add_pid_name(SQUARK, "STRANGE");
0246         _add_pid_name(CQUARK, "CHARM");
0247         _add_pid_name(BQUARK, "BOTTOM");
0248         _add_pid_name(TQUARK, "TOP");
0249         _add_pid_name(-DQUARK, "ANTIDOWN");
0250         _add_pid_name(-UQUARK, "ANTIUP");
0251         _add_pid_name(-SQUARK, "ANTISTRANGE");
0252         _add_pid_name(-CQUARK, "ANTICHARM");
0253         _add_pid_name(-BQUARK, "ANTIBOTTOM");
0254         _add_pid_name(-TQUARK, "ANTITOP");
0255         // nucleons
0256         _add_pid_name(PROTON, "PROTON");
0257         _add_pid_name(ANTIPROTON, "ANTIPROTON");
0258         _add_pid_name(NEUTRON, "NEUTRON");
0259         _add_pid_name(ANTINEUTRON, "ANTINEUTRON");
0260         // light mesons
0261         _add_pid_name(PI0, "PI0");
0262         _add_pid_name(PIPLUS, "PIPLUS");
0263         _add_pid_name(PIMINUS, "PIMINUS");
0264         _add_pid_name(RHO0, "RHO0");
0265         _add_pid_name(RHOPLUS, "RHOPLUS");
0266         _add_pid_name(RHOMINUS, "RHOMINUS");
0267         _add_pid_name(K0, "K0");
0268         _add_pid_name(KPLUS, "KPLUS");
0269         _add_pid_name(KMINUS, "KMINUS");
0270         _add_pid_name(ETA, "ETA");
0271         _add_pid_name(PHI, "PHI");
0272         // charm mesons
0273         _add_pid_name(D0, "D0");
0274         _add_pid_name(D0BAR, "D0BAR");
0275         _add_pid_name(DPLUS, "DPLUS");
0276         _add_pid_name(DMINUS, "DMINUS");
0277         // B mesons
0278         _add_pid_name(B0, "B0");
0279         _add_pid_name(B0BAR, "B0BAR");
0280         _add_pid_name(BPLUS, "BPLUS");
0281         _add_pid_name(BMINUS, "BMINUS");
0282         // baryons
0283         _add_pid_name(LAMBDA, "LAMBDA");
0284         _add_pid_name(SIGMA0, "SIGMA0");
0285         _add_pid_name(SIGMAPLUS, "SIGMAPLUS");
0286         _add_pid_name(SIGMAMINUS, "SIGMAMINUS");
0287         _add_pid_name(XI0, "XI0");
0288         _add_pid_name(XIPLUS, "XIPLUS");
0289         _add_pid_name(XIMINUS, "XIMINUS");
0290         // exotics
0291         _add_pid_name(REGGEON, "REGGEON");
0292         _add_pid_name(POMERON, "POMERON");
0293         // nuclei
0294         _add_pid_name(DEUTERON, "DEUTERON");
0295         _add_pid_name(ALUMINIUM, "ALUMINIUM");
0296         _add_pid_name(COPPER, "COPPER");
0297         _add_pid_name(XENON, "XENON");
0298         _add_pid_name(GOLD, "GOLD");
0299         _add_pid_name(LEAD, "LEAD");
0300         _add_pid_name(URANIUM, "URANIUM");
0301         // wildcard
0302         _add_pid_name(ANY, "*");
0303       }
0304 
0305       void _add_pid_name(PdgId pid, const std::string& pname) {
0306         _ids_names[pid] = pname;
0307         _names_ids[pname] = pid;
0308       }
0309 
0310       static unique_ptr<ParticleNames> _instance;
0311 
0312       std::map<PdgId, std::string> _ids_names;
0313 
0314       std::map<std::string, PdgId> _names_ids;
0315 
0316     };
0317 
0318 
0319     /// Print a PdgId as a named string.
0320     inline std::string toParticleName(PdgId p) {
0321       return ParticleNames::particleName(p);
0322     }
0323 
0324 
0325     /// Print a PdgId as a named string.
0326     inline PdgId toParticleID(const std::string& pname) {
0327       return ParticleNames::particleID(pname);
0328     }
0329 
0330 
0331     /// Convenience maker of particle ID pairs from PdgIds.
0332     inline std::pair<PdgId,PdgId> make_pdgid_pair(PdgId a, PdgId b) {
0333       return make_pair(a, b);
0334     }
0335 
0336 
0337     /// Convenience maker of particle ID pairs from particle names.
0338     inline std::pair<PdgId,PdgId> make_pdgid_pair(const std::string& a, const std::string& b) {
0339       const PdgId pa = toParticleID(a);
0340       const PdgId pb = toParticleID(b);
0341       return make_pair(pa, pb);
0342     }
0343 
0344 
0345     /// Print a PdgIdPair as a string.
0346     inline std::string toBeamsString(const PdgIdPair& pair) {
0347       string out = "[" +
0348         toParticleName(pair.first) + ", " +
0349         toParticleName(pair.second) + "]";
0350       return out;
0351     }
0352 
0353 
0354   }
0355 
0356 }
0357 
0358 #endif