CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PdtEntry Class Reference

#include <PdtEntry.h>

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 20 of file PdtEntry.h.

Constructor & Destructor Documentation

PdtEntry::PdtEntry ( )
inlineexplicit

default construct

Definition at line 23 of file PdtEntry.h.

23 : pdgId_(0), data_(nullptr) {}
int pdgId_
PDG id.
Definition: PdtEntry.h:39
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43
PdtEntry::PdtEntry ( int  pdgId)
inlineexplicit

construct from PDG id

Definition at line 25 of file PdtEntry.h.

25 : pdgId_(pdgId), data_(nullptr) {}
int pdgId_
PDG id.
Definition: PdtEntry.h:39
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43
int pdgId() const
PDG id.
Definition: PdtEntry.cc:5
PdtEntry::PdtEntry ( const std::string &  name)
inlineexplicit

construct from particle name

Definition at line 27 of file PdtEntry.h.

27 : pdgId_(0), name_(name), data_(nullptr) {}
int pdgId_
PDG id.
Definition: PdtEntry.h:39
std::string name_
particle name
Definition: PdtEntry.h:41
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43
const std::string & name() const
particle name
Definition: PdtEntry.cc:12

Member Function Documentation

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

particle data

Definition at line 19 of file PdtEntry.cc.

References data_, and Exception.

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

19  {
20  if (data_ == nullptr)
21  throw cms::Exception("ConfigError") << "PdtEntry::name was not set."
22  << "please, call PdtEntry::setup(const EventSetup & es)";
23  return *data_;
24 }
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43
std::string const & PdtEntry::name ( void  ) const

particle name

Definition at line 12 of file PdtEntry.cc.

References name_.

Referenced by config.CFG::__str__(), geometryComparison.GeometryComparison::createScript(), validation.Sample::digest(), primaryVertexResolution.PrimaryVertexResolution::getRepMap(), primaryVertexValidation.PrimaryVertexValidation::getRepMap(), and zMuMuValidation.ZMuMuValidation::getRepMap().

12  {
13  if (name_.empty())
14  throw cms::Exception("ConfigError") << "PdtEntry::name was not set."
15  << "please, call PdtEntry::setup(const EventSetup & es)";
16  return name_;
17 }
std::string name_
particle name
Definition: PdtEntry.h:41
int PdtEntry::pdgId ( ) const

PDG id.

Definition at line 5 of file PdtEntry.cc.

References Exception, and pdgId_.

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

5  {
6  if (pdgId_ == 0)
7  throw cms::Exception("ConfigError") << "PdtEntry::pdgId was not set.\n"
8  << "please, call PdtEntry::setup(const EventSetup & es)";
9  return pdgId_;
10 }
int pdgId_
PDG id.
Definition: PdtEntry.h:39
void PdtEntry::setup ( const HepPDT::ParticleDataTable pdt)

fill data from Event Setup

Definition at line 26 of file PdtEntry.cc.

References data_, Exception, name_, AlCaHLTBitMon_ParallelJobs::p, and pdgId_.

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

26  {
27  HepPDT::ParticleData const *p = nullptr;
28  if (pdgId_ == 0) {
29  p = pdt.particle(name_);
30  if (p == nullptr)
31  throw cms::Exception("ConfigError") << "PDT has no entry for " << name_ << "."
32  << "PdtEntry can't be set.";
33  pdgId_ = p->pid();
34  } else {
35  p = pdt.particle(pdgId_);
36  if (p == nullptr)
37  throw cms::Exception("ConfigError") << "PDT has no entry for " << pdgId_ << "."
38  << "PdtEntry can't be set.";
39  name_ = p->name();
40  }
41  data_ = p;
42 }
int pdgId_
PDG id.
Definition: PdtEntry.h:39
std::string name_
particle name
Definition: PdtEntry.h:41
HepPDT::ParticleData ParticleData
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43

Member Data Documentation

const HepPDT::ParticleData* PdtEntry::data_
private

particle data

Definition at line 43 of file PdtEntry.h.

Referenced by data(), and setup().

std::string PdtEntry::name_
private

particle name

Definition at line 41 of file PdtEntry.h.

Referenced by name(), and setup().

int PdtEntry::pdgId_
private

PDG id.

Definition at line 39 of file PdtEntry.h.

Referenced by pdgId(), and setup().