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/Exceptions.hh"
00006 
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @name Static const convenience particle ID names
00012   //@{
00013   static const PdgId ELECTRON = 11;
00014   static const PdgId POSITRON = -11;
00015   static const PdgId PROTON = 2212;
00016   static const PdgId ANTIPROTON = -2212;
00017   static const PdgId PHOTON = 22;
00018   static const PdgId NEUTRON = 2112;
00019   static const PdgId ANTINEUTRON = -2112;
00020   static const PdgId MUON = 13;
00021   static const PdgId ANTIMUON = -13;
00022   static const PdgId NU_E = 12;
00023   static const PdgId NU_EBAR = -12;
00024   static const PdgId NU_MU = 14;
00025   static const PdgId NU_MUBAR = -14;
00026   static const PdgId NU_TAU = 16;
00027   static const PdgId NU_TAUBAR = -16;
00028   static const PdgId PIPLUS = 211;
00029   static const PdgId PIMINUS = -211;
00030   static const PdgId PI0 = 111;
00031   static const PdgId K0L = 130;
00032   static const PdgId K0S = 310;
00033   static const PdgId KPLUS = 321;
00034   static const PdgId KMINUS = -321;
00035   static const PdgId LAMBDA = 3122;
00036   static const PdgId LAMBDABAR = -3122;
00037   static const PdgId XIMINUS = 3312;
00038   static const PdgId XIPLUS = -3312;
00039   static const PdgId OMEGAMINUS = 3334;
00040   static const PdgId OMEGAPLUS = -3334;
00041   static const PdgId TAU = 15;
00042   static const PdgId ANTITAU = -15;
00043   static const PdgId EMINUS = 11;
00044   static const PdgId EPLUS = -11;
00045   static const PdgId P = 2212;
00046   static const PdgId PBAR = -2212;
00047   static const PdgId GLUON = 21;
00048   static const PdgId GAMMA = 22;
00049   static const PdgId WPLUSBOSON = 24;
00050   static const PdgId WMINUSBOSON = -24;
00051   static const PdgId ZBOSON = 23;
00052   static const PdgId HIGGS = 25;
00053   static const PdgId DQUARK = 1;
00054   static const PdgId UQUARK = 2;
00055   static const PdgId SQUARK = 3;
00056   static const PdgId CQUARK = 4;
00057   static const PdgId BQUARK = 5;
00058   static const PdgId TQUARK = 6;
00059   static const PdgId ANY = 10000;
00060   // static const PdgId PHOTOELECTRON;
00061   // static const PdgId PHOTOPOSITRON;
00062   // static const PdgId PHOTOMUON;
00063   // static const PdgId PHOTOANTIMUON;
00064   // static const PdgId PHOTOTAU;
00065   // static const PdgId PHOTOANTITAU;
00066   //@}
00067 
00068 
00069   class ParticleNames {
00070   public:
00071 
00072     static const std::string& particleName(PdgId pid) {
00073       if (!_instance) _instance = new ParticleNames();
00074       return _instance->_particleName(pid);
00075     }
00076 
00077     static PdgId particleId(const std::string& pname) {
00078       if (!_instance) _instance = new ParticleNames();
00079       return _instance->_particleId(pname);
00080     }
00081 
00082 
00083   public:
00084 
00085     const std::string& _particleName(PdgId pid);
00086 
00087 
00088     PdgId _particleId(const std::string& pname);
00089 
00090 
00091   private:
00092 
00093     ParticleNames() {
00094       _add_pid_name(ELECTRON, "ELECTRON");
00095       _add_pid_name(POSITRON, "POSITRON");
00096       _add_pid_name(PROTON, "PROTON");
00097       _add_pid_name(ANTIPROTON, "ANTIPROTON");
00098       _add_pid_name(PHOTON, "PHOTON");
00099       _add_pid_name(NEUTRON, "NEUTRON");
00100       _add_pid_name(ANTINEUTRON, "ANTINEUTRON");
00101       _add_pid_name(MUON, "MUON");
00102       _add_pid_name(ANTIMUON, "ANTIMUON");
00103       _add_pid_name(NU_E, "NU_E");
00104       _add_pid_name(NU_EBAR, "NU_EBAR");
00105       _add_pid_name(NU_MU, "NU_MU");
00106       _add_pid_name(NU_MUBAR, "NU_MUBAR");
00107       _add_pid_name(NU_TAU, "NU_TAU");
00108       _add_pid_name(NU_TAUBAR, "NU_TAUBAR");
00109       _add_pid_name(PIPLUS, "PIPLUS");
00110       _add_pid_name(PIMINUS, "PIMINUS");
00111       _add_pid_name(TAU, "TAU");
00112       _add_pid_name(WPLUSBOSON, "WPLUSBOSON");
00113       _add_pid_name(WMINUSBOSON, "WMINUSBOSON");
00114       _add_pid_name(ZBOSON, "ZBOSON");
00115       _add_pid_name(HIGGS, "HIGGS");
00116       _add_pid_name(ANTITAU, "ANTITAU");
00117       // _add_pid_name(PHOTOELECTRON, "PHOTOELECTRON");
00118       // _add_pid_name(PHOTOPOSITRON, "PHOTOPOSITRON");
00119       // _add_pid_name(PHOTOMUON, "PHOTOMUON");
00120       // _add_pid_name(PHOTOANTIMUON, "PHOTOANTIMUON");
00121       // _add_pid_name(PHOTOTAU, "PHOTOTAU");
00122       // _add_pid_name(PHOTOANTITAU, "PHOTOANTITAU");
00123       _add_pid_name(ANY, "*");
00124     }
00125 
00126     void _add_pid_name(PdgId pid, const std::string& pname) {
00127       _ids_names[pid] = pname;
00128       _names_ids[pname] = pid;
00129     }
00130 
00131 
00132     static ParticleNames* _instance;
00133 
00134     std::map<PdgId, std::string> _ids_names;
00135 
00136     std::map<std::string, PdgId> _names_ids;
00137 
00138   };
00139 
00140 
00141   /// Print a PdgId as a named string.
00142   inline const std::string& toParticleName(PdgId p) {
00143     return ParticleNames::particleName(p);
00144   }
00145 
00146 
00147   /// Print a PdgId as a named string.
00148   inline PdgId toParticleId(const std::string& pname) {
00149     return ParticleNames::particleId(pname);
00150   }
00151 
00152 
00153   /// Convenience maker of particle ID pairs from PdgIds.
00154   inline std::pair<PdgId,PdgId> make_pdgid_pair(PdgId a, PdgId b) {
00155     return make_pair(a, b);
00156   }
00157 
00158 
00159   /// Convenience maker of particle ID pairs from particle names.
00160   inline std::pair<PdgId,PdgId> make_pdgid_pair(const std::string& a, const std::string& b) {
00161     const PdgId pa = toParticleId(a);
00162     const PdgId pb = toParticleId(b);
00163     return make_pair(pa, pb);
00164   }
00165 
00166 
00167   /// Print a PdgIdPair as a string.
00168   inline std::string toBeamsString(const PdgIdPair& pair) {
00169     string out = "[" +
00170       toParticleName(pair.first) + ", " +
00171       toParticleName(pair.second) + "]";
00172     return out;
00173   }
00174 
00175 
00176 }
00177 
00178 #endif