CMS 3D CMS Logo

Public Member Functions | Private Attributes

PdtEntry Class Reference

#include <PdtEntry.h>

List of all members.

Public Member Functions

const HepPDT::ParticleDatadata () const
 particle data
const std::string & name () const
 particle name
int pdgId () const
 PDG id.
 PdtEntry ()
 default construct
 PdtEntry (int pdgId)
 construct from PDG id
 PdtEntry (const std::string &name)
 construct from particle name
void setup (const edm::EventSetup &)
 fill data from Event Setup

Private Attributes

const HepPDT::ParticleDatadata_
 particle data
std::string name_
 particle name
int pdgId_
 PDG id.

Detailed Description

Definition at line 15 of file PdtEntry.h.


Constructor & Destructor Documentation

PdtEntry::PdtEntry ( ) [inline, explicit]

default construct

Definition at line 18 of file PdtEntry.h.

: pdgId_( 0 ), data_( 0 ) { }
PdtEntry::PdtEntry ( int  pdgId) [inline, explicit]

construct from PDG id

Definition at line 20 of file PdtEntry.h.

: pdgId_( pdgId ), data_( 0 ) { }
PdtEntry::PdtEntry ( const std::string &  name) [inline, explicit]

construct from particle name

Definition at line 22 of file PdtEntry.h.

: pdgId_( 0 ), name_( name ), data_( 0 ) { }

Member Function Documentation

HepPDT::ParticleData const & PdtEntry::data ( ) const

particle data

Definition at line 23 of file PdtEntry.cc.

References data_, and Exception.

Referenced by converter::MassiveCandidateConverter::beginFirstRun().

                                               { 
  if(data_ == 0)
    throw cms::Exception("ConfigError")
      << "PdtEntry::name was not set."
      << "please, call PdtEntry::setup(const EventSetup & es)";
  return * data_; 
} 
std::string const & PdtEntry::name ( void  ) const

particle name

Definition at line 15 of file PdtEntry.cc.

References name_.

                                      {
  if (name_.empty())
    throw cms::Exception("ConfigError")
      << "PdtEntry::name was not set."
      << "please, call PdtEntry::setup(const EventSetup & es)";
  return name_;
}
int PdtEntry::pdgId ( ) const

PDG id.

Definition at line 7 of file PdtEntry.cc.

References Exception, and pdgId_.

Referenced by converter::SuperClusterToCandidate::convert(), converter::StandAloneMuonTrackToCandidate::convert(), converter::TrackToCandidate::convert(), and GenParticleDecaySelector::produce().

                          {
  if (pdgId_ == 0)
    throw cms::Exception("ConfigError")
      << "PdtEntry::pdgId was not set.\n"
      << "please, call PdtEntry::setup(const EventSetup & es)";
  return pdgId_;
}
void PdtEntry::setup ( const edm::EventSetup es)

fill data from Event Setup

Definition at line 31 of file PdtEntry.cc.

References data_, Exception, edm::EventSetup::getData(), name_, AlCaHLTBitMon_ParallelJobs::p, and pdgId_.

Referenced by converter::MassiveCandidateConverter::beginFirstRun(), and GenParticleDecaySelector::produce().

                                            {
  edm::ESHandle<HepPDT::ParticleDataTable> pdt;
  es.getData(pdt);
  HepPDT::ParticleData const* p = 0;
  if (pdgId_ == 0) {
    p = pdt->particle(name_);
    if (p == 0) 
      throw cms::Exception("ConfigError")
        << "PDT has no entry for " << name_ << "."
        << "PdtEntry can't be set.";
    pdgId_ = p->pid();
  } else {
    p = pdt->particle(pdgId_);
    if (p == 0) 
      throw cms::Exception("ConfigError")
        << "PDT has no entry for " << pdgId_ << "."
        << "PdtEntry can't be set.";
    name_ = p->name();
  }
  data_ = p;
}

Member Data Documentation

particle data

Definition at line 38 of file PdtEntry.h.

Referenced by data(), and setup().

std::string PdtEntry::name_ [private]

particle name

Definition at line 36 of file PdtEntry.h.

Referenced by name(), and setup().

int PdtEntry::pdgId_ [private]

PDG id.

Definition at line 34 of file PdtEntry.h.

Referenced by pdgId(), and setup().