CMS 3D CMS Logo

PdtEntry.cc
Go to the documentation of this file.
4 
5 int PdtEntry::pdgId() const {
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 }
11 
12 std::string const &PdtEntry::name() const {
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 }
18 
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 }
25 
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 }
43 namespace edm {
44  namespace pdtentry {
45  PdtEntry getPdtEntry(Entry const &e, char const *name) {
46  if (e.typeCode() == 'I')
47  return PdtEntry(e.getInt32());
48  else if (e.typeCode() == 'S')
49  return PdtEntry(e.getString());
50  else
51  throw Exception(errors::Configuration, "EntryError")
52  << "can not convert representation of " << name << " to value of type PdtEntry. "
53  << "Please, provide a parameter either of type int32 or string.";
54  }
55 
56  std::vector<PdtEntry> getPdtEntryVector(Entry const &e, char const *name) {
57  std::vector<PdtEntry> ret;
58  if (e.typeCode() == 'i') {
59  std::vector<int> v(e.getVInt32());
60  for (std::vector<int>::const_iterator i = v.begin(); i != v.end(); ++i)
61  ret.push_back(PdtEntry(*i));
62  return ret;
63  } else if (e.typeCode() == 's') {
64  std::vector<std::string> v(e.getVString());
65  for (std::vector<std::string>::const_iterator i = v.begin(); i != v.end(); ++i)
66  ret.push_back(PdtEntry(*i));
67  return ret;
68  } else
69  throw Exception(errors::Configuration, "EntryError")
70  << "can not convert representation of " << name << " to value of type PdtEntry. "
71  << "Please, provide a parameter either of type int32 or string.";
72  }
73  } // namespace pdtentry
74 } // namespace edm
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
mps_fire.i
i
Definition: mps_fire.py:428
PdtEntry::pdgId
int pdgId() const
PDG id.
Definition: PdtEntry.cc:5
edm
HLT enums.
Definition: AlignableModifier.h:19
findQualityFiles.v
v
Definition: findQualityFiles.py:179
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
EDMException.h
PdtEntry::data
const HepPDT::ParticleData & data() const
particle data
Definition: PdtEntry.cc:19
PdtEntry::data_
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:43
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ParticleDataTable.h
PdtEntry::setup
void setup(const HepPDT::ParticleDataTable &)
fill data from Event Setup
Definition: PdtEntry.cc:26
PdtEntry.h
PdtEntry::name_
std::string name_
particle name
Definition: PdtEntry.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
PdtEntry
Definition: PdtEntry.h:20
cms::Exception
Definition: Exception.h:70
PdtEntry::name
const std::string & name() const
particle name
Definition: PdtEntry.cc:12
PdtEntry::pdgId_
int pdgId_
PDG id.
Definition: PdtEntry.h:39
edm::errors::Configuration
Definition: EDMException.h:36
edm::Entry
Definition: Entry.h:40
ParticleDataTable
HepPDT::ParticleDataTable ParticleDataTable
Definition: ParticleDataTable.h:8
edm::pdtentry::getPdtEntry
PdtEntry getPdtEntry(Entry const &e, char const *name)
Definition: PdtEntry.cc:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edm::pdtentry::getPdtEntryVector
std::vector< PdtEntry > getPdtEntryVector(Entry const &e, char const *name)
Definition: PdtEntry.cc:56