rivet is hosted by Hepforge, IPPP Durham
ParticleName.hh
Go to the documentation of this file.
00001 #ifndef RIVET_PARTICLENAME_HH
00002 #define RIVET_PARTICLENAME_HH
00003 
00004 #include "Rivet/Particle.fhh"
00005 #include "Rivet/Tools/Exceptions.hh"
00006 
00007 namespace Rivet {
00008 
00009   namespace PID {
00010 
00011 
00012     /// Static const convenience particle ID names
00013 
00014     /// Special wildcard particle name
00015     static const PdgId ANY = 10000;
00016 
00017     /// @name Charged leptons
00018     //@{
00019     static const PdgId ELECTRON = 11;
00020     static const PdgId POSITRON = -ELECTRON;
00021     static const PdgId EMINUS = ELECTRON;
00022     static const PdgId EPLUS = POSITRON;
00023     static const PdgId MUON = 13;
00024     static const PdgId ANTIMUON = -MUON;
00025     static const PdgId TAU = 15;
00026     static const PdgId ANTITAU = -TAU;
00027     //@}
00028 
00029     /// @name Neutrinos
00030     //@{
00031     static const PdgId NU_E = 12;
00032     static const PdgId NU_EBAR = -NU_E;
00033     static const PdgId NU_MU = 14;
00034     static const PdgId NU_MUBAR = -NU_MU;
00035     static const PdgId NU_TAU = 16;
00036     static const PdgId NU_TAUBAR = -NU_TAU;
00037     //@}
00038 
00039     /// @name Bosons
00040     //@{
00041     static const PdgId PHOTON = 22;
00042     static const PdgId GAMMA = PHOTON;
00043     static const PdgId GLUON = 21;
00044     static const PdgId WPLUSBOSON = 24;
00045     static const PdgId WMINUSBOSON = -WPLUSBOSON;
00046     static const PdgId WPLUS = WPLUSBOSON;
00047     static const PdgId WMINUS = WMINUSBOSON;
00048     static const PdgId Z0BOSON = 23;
00049     static const PdgId ZBOSON = Z0BOSON;
00050     static const PdgId Z0 = Z0BOSON;
00051     static const PdgId HIGGSBOSON = 25;
00052     static const PdgId HIGGS = HIGGSBOSON;
00053     //@}
00054 
00055     /// @name Quarks
00056     //@{
00057     static const PdgId DQUARK = 1;
00058     static const PdgId UQUARK = 2;
00059     static const PdgId SQUARK = 3;
00060     static const PdgId CQUARK = 4;
00061     static const PdgId BQUARK = 5;
00062     static const PdgId TQUARK = 6;
00063     //@}
00064 
00065     /// @name Nucleons
00066     //@{
00067     static const PdgId PROTON = 2212;
00068     static const PdgId ANTIPROTON = -PROTON;
00069     static const PdgId PBAR = ANTIPROTON;
00070     static const PdgId NEUTRON = 2112;
00071     static const PdgId ANTINEUTRON = -NEUTRON;
00072     //@}
00073 
00074     /// @name Light mesons
00075     //@{
00076     static const PdgId PI0 = 111;
00077     static const PdgId PIPLUS = 211;
00078     static const PdgId PIMINUS = -PIPLUS;
00079     static const PdgId RHO0 = 113;
00080     static const PdgId RHOPLUS = 213;
00081     static const PdgId RHOMINUS = -RHOPLUS;
00082     static const PdgId K0L = 130;
00083     static const PdgId K0S = 310;
00084     static const PdgId KPLUS = 321;
00085     static const PdgId KMINUS = -KPLUS;
00086     static const PdgId ETA = 221;
00087     static const PdgId ETAPRIME = 331;
00088     static const PdgId PHI = 333;
00089     static const PdgId OMEGA = 223;
00090     //@}
00091 
00092     /// @name Charmonia
00093     //@{
00094     static const PdgId ETAC = 441;
00095     static const PdgId JPSI = 443;
00096     static const PdgId PSI2S = 100443;
00097     //@}
00098 
00099     /// @name Charm mesons
00100     //@{
00101     static const PdgId D0 = 421;
00102     static const PdgId D0BAR = -421;
00103     static const PdgId DPLUS = 411;
00104     static const PdgId DMINUS = -DPLUS;
00105     static const PdgId DSPLUS = 431;
00106     static const PdgId DSMINUS = -DSPLUS;
00107     //@}
00108 
00109     /// @name Bottomonia
00110     //@{
00111     static const PdgId ETAB = 551;
00112     static const PdgId UPSILON1S = 553;
00113     static const PdgId UPSILON2S = 100553;
00114     static const PdgId UPSILON3S = 200553;
00115     static const PdgId UPSILON4S = 300553;
00116     //@}
00117 
00118     /// @name b mesons
00119     //@{
00120     static const PdgId B0 = 511;
00121     static const PdgId B0BAR = -511;
00122     static const PdgId BPLUS = 521;
00123     static const PdgId BMINUS = -BPLUS;
00124     static const PdgId B0S = 531;
00125     static const PdgId BCPLUS = 541;
00126     static const PdgId BCMINUS = -BCPLUS;
00127     //@}
00128 
00129     /// @name Baryons
00130     //@{
00131     static const PdgId LAMBDA = 3122;
00132     static const PdgId SIGMA0 = 3212;
00133     static const PdgId SIGMAPLUS = 3222;
00134     static const PdgId SIGMAMINUS = 3112;
00135     static const PdgId LAMBDACPLUS = 4122;
00136     static const PdgId LAMBDACMINUS = 4122;
00137     static const PdgId LAMBDAB = 5122;
00138     static const PdgId XI0 = 3322;
00139     static const PdgId XIMINUS = 3312;
00140     static const PdgId XIPLUS = -XIMINUS;
00141     static const PdgId OMEGAMINUS = 3334;
00142     static const PdgId OMEGAPLUS = -OMEGAMINUS;
00143     //@}
00144 
00145     /// @name Exotic/weird stuff
00146     //@{
00147     static const PdgId REGGEON = 110;
00148     static const PdgId POMERON = 990;
00149     static const PdgId ODDERON = 9990;
00150     static const PdgId GRAVITON = 39;
00151     static const PdgId NEUTRALINO1 = 1000022;
00152     static const PdgId GRAVITINO = 1000039;
00153     static const PdgId GLUINO = 1000021;
00154     /// @todo Add axion, black hole remnant, etc. on demand
00155     //@}
00156 
00157 
00158 
00159     /// Handler for particle name code <-> string conversion
00160     ///
00161     /// @todo Hide this utility class or equiv in an unnamed namespace in a .cc file.
00162     class ParticleNames {
00163     public:
00164 
00165       static const std::string& particleName(PdgId pid) {
00166         /// @todo Isn't there a nicer, pointerless way to do singletons?
00167         if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
00168         return _instance->_particleName(pid);
00169       }
00170 
00171       static PdgId particleId(const std::string& pname) {
00172         /// @todo Isn't there a nicer, pointerless way to do singletons?
00173         if (!_instance) _instance = unique_ptr<ParticleNames>(new ParticleNames);
00174         return _instance->_particleId(pname);
00175       }
00176 
00177       const std::string& _particleName(PdgId pid);
00178 
00179       PdgId _particleId(const std::string& pname);
00180 
00181 
00182     private:
00183 
00184       ParticleNames() {
00185         _add_pid_name(ELECTRON, "ELECTRON");
00186         _add_pid_name(POSITRON, "POSITRON");
00187         _add_pid_name(PROTON, "PROTON");
00188         _add_pid_name(ANTIPROTON, "ANTIPROTON");
00189         _add_pid_name(PHOTON, "PHOTON");
00190         _add_pid_name(NEUTRON, "NEUTRON");
00191         _add_pid_name(ANTINEUTRON, "ANTINEUTRON");
00192         _add_pid_name(MUON, "MUON");
00193         _add_pid_name(ANTIMUON, "ANTIMUON");
00194         _add_pid_name(NU_E, "NU_E");
00195         _add_pid_name(NU_EBAR, "NU_EBAR");
00196         _add_pid_name(NU_MU, "NU_MU");
00197         _add_pid_name(NU_MUBAR, "NU_MUBAR");
00198         _add_pid_name(NU_TAU, "NU_TAU");
00199         _add_pid_name(NU_TAUBAR, "NU_TAUBAR");
00200         _add_pid_name(PIPLUS, "PIPLUS");
00201         _add_pid_name(PIMINUS, "PIMINUS");
00202         _add_pid_name(TAU, "TAU");
00203         _add_pid_name(WPLUSBOSON, "WPLUSBOSON");
00204         _add_pid_name(WMINUSBOSON, "WMINUSBOSON");
00205         _add_pid_name(ZBOSON, "ZBOSON");
00206         _add_pid_name(HIGGS, "HIGGS");
00207         _add_pid_name(ANTITAU, "ANTITAU");
00208         _add_pid_name(ANY, "*");
00209       }
00210 
00211       void _add_pid_name(PdgId pid, const std::string& pname) {
00212         _ids_names[pid] = pname;
00213         _names_ids[pname] = pid;
00214       }
00215 
00216       static unique_ptr<ParticleNames> _instance;
00217 
00218       std::map<PdgId, std::string> _ids_names;
00219 
00220       std::map<std::string, PdgId> _names_ids;
00221 
00222     };
00223 
00224 
00225     /// Print a PdgId as a named string.
00226     inline const std::string& toParticleName(PdgId p) {
00227       return ParticleNames::particleName(p);
00228     }
00229 
00230 
00231     /// Print a PdgId as a named string.
00232     inline PdgId toParticleId(const std::string& pname) {
00233       return ParticleNames::particleId(pname);
00234     }
00235 
00236 
00237     /// Convenience maker of particle ID pairs from PdgIds.
00238     inline std::pair<PdgId,PdgId> make_pdgid_pair(PdgId a, PdgId b) {
00239       return make_pair(a, b);
00240     }
00241 
00242 
00243     /// Convenience maker of particle ID pairs from particle names.
00244     inline std::pair<PdgId,PdgId> make_pdgid_pair(const std::string& a, const std::string& b) {
00245       const PdgId pa = toParticleId(a);
00246       const PdgId pb = toParticleId(b);
00247       return make_pair(pa, pb);
00248     }
00249 
00250 
00251     /// Print a PdgIdPair as a string.
00252     inline std::string toBeamsString(const PdgIdPair& pair) {
00253       string out = "[" +
00254         toParticleName(pair.first) + ", " +
00255         toParticleName(pair.second) + "]";
00256       return out;
00257     }
00258 
00259 
00260   }
00261 
00262 }
00263 
00264 #endif