Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ParticleName.hh

Go to the documentation of this file.
00001 // $Id: $
00002 #ifndef RIVET_PARTICLENAME_HH 
00003 #define RIVET_PARTICLENAME_HH 1
00004 
00005 #include "Rivet/Rivet.hh"
00006 
00007 namespace Rivet {
00008 
00009   /// Enumeration of available beam particles (using PDG IDs where available)
00010   enum ParticleName { 
00011     ELECTRON = 11, 
00012     POSITRON = -11, 
00013     PROTON = 2212, 
00014     ANTIPROTON = -2212, 
00015     PHOTON = 22, 
00016     NEUTRON = 2112, 
00017     ANTINEUTRON = 2112, 
00018     MUON = 13, 
00019     ANTIMUON = -13,
00020     NU_E = 12, 
00021     NU_EBAR = -12,
00022     NU_MU = 14, 
00023     NU_MUBAR = -14,
00024     NU_TAU = 16, 
00025     NU_TAUBAR = -16, 
00026     PIPLUS = 211, 
00027     PIMINUS = -211,
00028     TAU = 15, 
00029     ANTITAU = -15,
00030     EMINUS = 11, 
00031     EPLUS = -11, 
00032     P = 2212, 
00033     PBAR = -2212,
00034     GAMMA = 22,
00035     ANY = 10000,
00036     PHOTOELECTRON,
00037     PHOTOPOSITRON,
00038     PHOTOMUON,     
00039     PHOTOANTIMUON,
00040     PHOTOTAU,      
00041     PHOTOANTITAU
00042   };
00043 
00044 
00045   /// Typedef for a map of beam particle name enums to strings.
00046   typedef map<ParticleName, string> ParticleNameMap;
00047 
00048 
00049   /// Typedef for a map of beam particle name strings to enums.
00050   typedef map<string, ParticleName> ParticleNameMapR;
00051 
00052 
00053   /// Function which returns a map from beam particle enums to the corresponding name strings.
00054   inline ParticleNameMap getKnownParticleNames() {
00055     ParticleNameMap bpmap;
00056     bpmap[ELECTRON] = "ELECTRON";
00057     bpmap[POSITRON] = "POSITRON";
00058     bpmap[PROTON] = "PROTON";
00059     bpmap[ANTIPROTON] = "ANTIPROTON";
00060     bpmap[PHOTON] = "PHOTON";
00061     bpmap[NEUTRON] = "NEUTRON";
00062     bpmap[ANTINEUTRON] = "ANTINEUTRON";
00063     bpmap[MUON] = "MUON";
00064     bpmap[ANTIMUON] = "ANTIMUON";
00065     bpmap[NU_E] = "NU_E";
00066     bpmap[NU_EBAR] = "NU_EBAR";
00067     bpmap[NU_MU] = "NU_MU";
00068     bpmap[NU_MUBAR] = "NU_MUBAR";
00069     bpmap[NU_TAU] = "NU_TAU";
00070     bpmap[NU_TAUBAR] = "NU_TAUBAR";
00071     bpmap[PIPLUS] = "PIPLUS"; 
00072     bpmap[PIMINUS] = "PIMINUS";
00073     bpmap[TAU] = "TAU"; 
00074     bpmap[ANTITAU] = "ANTITAU";
00075     bpmap[PHOTOELECTRON] = "PHOTOELECTRON";
00076     bpmap[PHOTOPOSITRON] = "PHOTOPOSITRON";
00077     bpmap[PHOTOMUON] = "PHOTOMUON";
00078     bpmap[PHOTOANTIMUON] = "PHOTOANTIMUON";
00079     bpmap[PHOTOTAU] = "PHOTOTAU"; 
00080     bpmap[PHOTOANTITAU] = "PHOTOANTITAU";
00081     bpmap[ANY] = "*";
00082     return bpmap;
00083   }
00084 
00085   /// Function which returns a map from beam particle name strings to the corresponding enums.
00086   inline ParticleNameMapR getKnownParticleNamesR() {
00087     ParticleNameMap bpmap = getKnownParticleNames();
00088     ParticleNameMapR bpmapr;
00089     for (ParticleNameMap::const_iterator bp = bpmap.begin(); bp != bpmap.end(); ++bp) {
00090       bpmapr[bp->second] = bp->first;
00091     }
00092     return bpmapr;
00093   }
00094 
00095 
00096   /// Typedef for a collection of beam particle name enums.
00097   typedef vector<ParticleName> ParticleNameList;
00098 
00099 
00100   /// Function which returns a vector of all the beam particle values in 
00101   /// the ParticleName enum.
00102   inline ParticleNameList getKnownParticleNameEnums() {
00103     ParticleNameList names;
00104     ParticleNameMap bpmap = getKnownParticleNames();
00105     for (ParticleNameMap::const_iterator bp = bpmap.begin(); bp != bpmap.end(); ++bp) {
00106       names.push_back(bp->first);
00107     }
00108     return names;
00109   }
00110 
00111 
00112   /// Function which returns a vector of all the beam particle name strings.
00113   inline vector<string> getKnownParticleNameNames() {
00114     vector<string> names;
00115     ParticleNameMap bpmap = getKnownParticleNames();
00116     for (ParticleNameMap::const_iterator bp = bpmap.begin(); bp != bpmap.end(); ++bp) {
00117       names.push_back(bp->second);
00118     }
00119     return names;
00120   }
00121 
00122 
00123   /////////////////////////////////////////////////
00124 
00125   
00126 
00127   /// Typedef for a pair of beam particle names.
00128   typedef pair<ParticleName, ParticleName> BeamPair;
00129 
00130   /// Print a BeamPair as a string
00131   inline string toString(BeamPair pair) {
00132     string out = "["
00133       + getKnownParticleNames()[pair.first] 
00134       + ", "
00135       + getKnownParticleNames()[pair.second]
00136       + "]";
00137     return out;
00138   }
00139 
00140   /// Allow BeamPair to be passed to an iostream
00141   inline ostream& operator<<(ostream& os, const BeamPair& bp) {
00142     os << toString(bp);
00143     return os;
00144   }
00145 
00146   
00147 }
00148 
00149 
00150 #endif