CMS 3D CMS Logo

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 (const std::string &name)
 construct from particle name More...
 
 PdtEntry (int pdgId)
 construct from PDG id More...
 
void setup (const edm::EventSetup &)
 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 19 of file PdtEntry.h.

Constructor & Destructor Documentation

◆ PdtEntry() [1/3]

PdtEntry::PdtEntry ( )
inlineexplicit

default construct

Definition at line 22 of file PdtEntry.h.

22 : pdgId_(0), data_(nullptr) {}

◆ PdtEntry() [2/3]

PdtEntry::PdtEntry ( int  pdgId)
inlineexplicit

construct from PDG id

Definition at line 24 of file PdtEntry.h.

24 : pdgId_(pdgId), data_(nullptr) {}

◆ PdtEntry() [3/3]

PdtEntry::PdtEntry ( const std::string &  name)
inlineexplicit

construct from particle name

Definition at line 26 of file PdtEntry.h.

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

Member Function Documentation

◆ data()

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

particle data

Definition at line 21 of file PdtEntry.cc.

21  {
22  if (data_ == nullptr)
23  throw cms::Exception("ConfigError") << "PdtEntry::name was not set."
24  << "please, call PdtEntry::setup(const EventSetup & es)";
25  return *data_;
26 }

References data_, and Exception.

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

◆ name()

const std::string & PdtEntry::name ( void  ) const

particle name

Definition at line 14 of file PdtEntry.cc.

14  {
15  if (name_.empty())
16  throw cms::Exception("ConfigError") << "PdtEntry::name was not set."
17  << "please, call PdtEntry::setup(const EventSetup & es)";
18  return name_;
19 }

References name_.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

◆ pdgId()

int PdtEntry::pdgId ( ) const

PDG id.

Definition at line 7 of file PdtEntry.cc.

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

References Exception, and pdgId_.

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

◆ setup()

void PdtEntry::setup ( const edm::EventSetup es)

fill data from Event Setup

Definition at line 28 of file PdtEntry.cc.

28  {
30  es.getData(pdt);
31  HepPDT::ParticleData const *p = nullptr;
32  if (pdgId_ == 0) {
33  p = pdt->particle(name_);
34  if (p == nullptr)
35  throw cms::Exception("ConfigError") << "PDT has no entry for " << name_ << "."
36  << "PdtEntry can't be set.";
37  pdgId_ = p->pid();
38  } else {
39  p = pdt->particle(pdgId_);
40  if (p == nullptr)
41  throw cms::Exception("ConfigError") << "PDT has no entry for " << pdgId_ << "."
42  << "PdtEntry can't be set.";
43  name_ = p->name();
44  }
45  data_ = p;
46 }

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

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

Member Data Documentation

◆ data_

const HepPDT::ParticleData* PdtEntry::data_
private

particle data

Definition at line 42 of file PdtEntry.h.

Referenced by data(), and setup().

◆ name_

std::string PdtEntry::name_
private

particle name

Definition at line 40 of file PdtEntry.h.

Referenced by name(), and setup().

◆ pdgId_

int PdtEntry::pdgId_
private

PDG id.

Definition at line 38 of file PdtEntry.h.

Referenced by pdgId(), and setup().

PdtEntry::pdgId
int pdgId() const
PDG id.
Definition: PdtEntry.cc:7
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
edm::ESHandle< HepPDT::ParticleDataTable >
PdtEntry::data_
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:42
PdtEntry::name_
std::string name_
particle name
Definition: PdtEntry.h:40
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
Exception
Definition: hltDiff.cc:246
cms::Exception
Definition: Exception.h:70
PdtEntry::name
const std::string & name() const
particle name
Definition: PdtEntry.cc:14
PdtEntry::pdgId_
int pdgId_
PDG id.
Definition: PdtEntry.h:38