CMS 3D CMS Logo

PdtEntry.cc
Go to the documentation of this file.
6 
7 int PdtEntry::pdgId() const {
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 }
13 
14 std::string const &PdtEntry::name() const {
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 }
20 
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 }
27 
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 }
47 namespace edm {
48  namespace pdtentry {
49  PdtEntry getPdtEntry(Entry const &e, char const *name) {
50  if (e.typeCode() == 'I')
51  return PdtEntry(e.getInt32());
52  else if (e.typeCode() == 'S')
53  return PdtEntry(e.getString());
54  else
55  throw Exception(errors::Configuration, "EntryError")
56  << "can not convert representation of " << name << " to value of type PdtEntry. "
57  << "Please, provide a parameter either of type int32 or string.";
58  }
59 
60  std::vector<PdtEntry> getPdtEntryVector(Entry const &e, char const *name) {
61  std::vector<PdtEntry> ret;
62  if (e.typeCode() == 'i') {
63  std::vector<int> v(e.getVInt32());
64  for (std::vector<int>::const_iterator i = v.begin(); i != v.end(); ++i)
65  ret.push_back(PdtEntry(*i));
66  return ret;
67  } else if (e.typeCode() == 's') {
68  std::vector<std::string> v(e.getVString());
69  for (std::vector<std::string>::const_iterator i = v.begin(); i != v.end(); ++i)
70  ret.push_back(PdtEntry(*i));
71  return ret;
72  } else
73  throw Exception(errors::Configuration, "EntryError")
74  << "can not convert representation of " << name << " to value of type PdtEntry. "
75  << "Please, provide a parameter either of type int32 or string.";
76  }
77  } // namespace pdtentry
78 } // namespace edm
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
mps_fire.i
i
Definition: mps_fire.py:355
PdtEntry::pdgId
int pdgId() const
PDG id.
Definition: PdtEntry.cc:7
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
findQualityFiles.v
v
Definition: findQualityFiles.py:179
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
EDMException.h
edm::ESHandle< HepPDT::ParticleDataTable >
PdtEntry::data
const HepPDT::ParticleData & data() const
particle data
Definition: PdtEntry.cc:21
PdtEntry::data_
const HepPDT::ParticleData * data_
particle data
Definition: PdtEntry.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ParticleDataTable.h
PdtEntry.h
PdtEntry::setup
void setup(const edm::EventSetup &)
fill data from Event Setup
Definition: PdtEntry.cc:28
PdtEntry::name_
std::string name_
particle name
Definition: PdtEntry.h:40
edm::EventSetup
Definition: EventSetup.h:57
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
PdtEntry
Definition: PdtEntry.h:19
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
edm::errors::Configuration
Definition: EDMException.h:36
edm::Entry
Definition: Entry.h:40
edm::pdtentry::getPdtEntry
PdtEntry getPdtEntry(Entry const &e, char const *name)
Definition: PdtEntry.cc:49
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:60