rivet is hosted by Hepforge, IPPP Durham

#include <ParticleName.hh>

Collaboration diagram for ParticleNames:

List of all members.

Public Member Functions

const std::string & _particleName (PdgId pid)
PdgId _particleId (const std::string &pname)

Static Public Member Functions

static const std::string & particleName (PdgId pid)
static PdgId particleId (const std::string &pname)

Private Member Functions

 ParticleNames ()
void _add_pid_name (PdgId pid, const std::string &pname)

Private Attributes

std::map< PdgId, std::string > _ids_names
std::map< std::string, PdgId_names_ids

Static Private Attributes

static ParticleNames_instance = 0

Detailed Description

Definition at line 69 of file ParticleName.hh.


Constructor & Destructor Documentation

ParticleNames ( ) [inline, private]

Definition at line 93 of file ParticleName.hh.

References ParticleNames::_add_pid_name(), Rivet::ANTIMUON, Rivet::ANTINEUTRON, Rivet::ANTIPROTON, Rivet::ANTITAU, Rivet::ANY, Rivet::ELECTRON, Rivet::HIGGS, Rivet::MUON, Rivet::NEUTRON, Rivet::NU_E, Rivet::NU_EBAR, Rivet::NU_MU, Rivet::NU_MUBAR, Rivet::NU_TAU, Rivet::NU_TAUBAR, Rivet::PHOTON, Rivet::PIMINUS, Rivet::PIPLUS, Rivet::POSITRON, Rivet::PROTON, Rivet::TAU, Rivet::WMINUSBOSON, Rivet::WPLUSBOSON, and Rivet::ZBOSON.

Referenced by ParticleNames::particleId(), and ParticleNames::particleName().

                    {
      _add_pid_name(ELECTRON, "ELECTRON");
      _add_pid_name(POSITRON, "POSITRON");
      _add_pid_name(PROTON, "PROTON");
      _add_pid_name(ANTIPROTON, "ANTIPROTON");
      _add_pid_name(PHOTON, "PHOTON");
      _add_pid_name(NEUTRON, "NEUTRON");
      _add_pid_name(ANTINEUTRON, "ANTINEUTRON");
      _add_pid_name(MUON, "MUON");
      _add_pid_name(ANTIMUON, "ANTIMUON");
      _add_pid_name(NU_E, "NU_E");
      _add_pid_name(NU_EBAR, "NU_EBAR");
      _add_pid_name(NU_MU, "NU_MU");
      _add_pid_name(NU_MUBAR, "NU_MUBAR");
      _add_pid_name(NU_TAU, "NU_TAU");
      _add_pid_name(NU_TAUBAR, "NU_TAUBAR");
      _add_pid_name(PIPLUS, "PIPLUS");
      _add_pid_name(PIMINUS, "PIMINUS");
      _add_pid_name(TAU, "TAU");
      _add_pid_name(WPLUSBOSON, "WPLUSBOSON");
      _add_pid_name(WMINUSBOSON, "WMINUSBOSON");
      _add_pid_name(ZBOSON, "ZBOSON");
      _add_pid_name(HIGGS, "HIGGS");
      _add_pid_name(ANTITAU, "ANTITAU");
      // _add_pid_name(PHOTOELECTRON, "PHOTOELECTRON");
      // _add_pid_name(PHOTOPOSITRON, "PHOTOPOSITRON");
      // _add_pid_name(PHOTOMUON, "PHOTOMUON");
      // _add_pid_name(PHOTOANTIMUON, "PHOTOANTIMUON");
      // _add_pid_name(PHOTOTAU, "PHOTOTAU");
      // _add_pid_name(PHOTOANTITAU, "PHOTOANTITAU");
      _add_pid_name(ANY, "*");
    }

Member Function Documentation

void _add_pid_name ( PdgId  pid,
const std::string &  pname 
) [inline, private]

Definition at line 126 of file ParticleName.hh.

References ParticleNames::_ids_names, and ParticleNames::_names_ids.

Referenced by ParticleNames::ParticleNames().

                                                          {
      _ids_names[pid] = pname;
      _names_ids[pname] = pid;
    }
PdgId _particleId ( const std::string &  pname)

Definition at line 21 of file ParticleName.cc.

References ParticleNames::_names_ids, Rivet::ANTIPROTON, Rivet::ELECTRON, Rivet::NEUTRON, Rivet::PHOTON, Rivet::POSITRON, Rivet::PROTON, and Rivet::toUpper().

Referenced by ParticleNames::particleId().

                                                         {
    if (_names_ids.find(pname) == _names_ids.end()) {
      if (toUpper(pname) == "P+" || toUpper(pname) == "P") return PROTON;
      if (toUpper(pname) == "P-" || toUpper(pname) == "PBAR") return ANTIPROTON;
      if (toUpper(pname) == "E-") return ELECTRON;
      if (toUpper(pname) == "E+") return POSITRON;
      if (toUpper(pname) == "GAMMA") return PHOTON;
      if (toUpper(pname) == "N") return NEUTRON;
      try {
        PdgId rtn = lexical_cast<PdgId>(pname);
        return rtn;
      } catch (const bad_lexical_cast& blc) {
        throw PidError("Particle name '" + pname + "' not known and could not be directly cast to a PDG ID.");
      }
    }
    return _names_ids[pname];
  }
const std::string & _particleName ( PdgId  pid)

Definition at line 13 of file ParticleName.cc.

References ParticleNames::_ids_names.

Referenced by ParticleNames::particleName().

                                                         {
    if (_ids_names.find(pid) == _ids_names.end()) {
      throw PidError("Particle ID '" + lexical_cast<string>(pid) + "' not known.");
    }
    return _ids_names[pid];
  }
static PdgId particleId ( const std::string &  pname) [inline, static]
static const std::string& particleName ( PdgId  pid) [inline, static]

Member Data Documentation

std::map<PdgId, std::string> _ids_names [private]

Definition at line 134 of file ParticleName.hh.

Referenced by ParticleNames::_add_pid_name(), and ParticleNames::_particleName().

ParticleNames * _instance = 0 [static, private]

Definition at line 132 of file ParticleName.hh.

Referenced by ParticleNames::particleId(), and ParticleNames::particleName().

std::map<std::string, PdgId> _names_ids [private]

Definition at line 136 of file ParticleName.hh.

Referenced by ParticleNames::_add_pid_name(), and ParticleNames::_particleId().


The documentation for this class was generated from the following files: