CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PdgEntryReplacer Class Reference

#include <PdgEntryReplacer.h>

Public Member Functions

 PdgEntryReplacer (const edm::EventSetup &es)
 
std::string replace (const std::string &) const
 

Private Attributes

const edm::EventSetupes_
 

Detailed Description

Definition at line 9 of file PdgEntryReplacer.h.

Constructor & Destructor Documentation

◆ PdgEntryReplacer()

PdgEntryReplacer::PdgEntryReplacer ( const edm::EventSetup es)
inlineexplicit

Definition at line 11 of file PdgEntryReplacer.h.

11 : es_(&es) {}

Member Function Documentation

◆ replace()

string PdgEntryReplacer::replace ( const std::string &  ) const

Definition at line 6 of file PdgEntryReplacer.cc.

6  {
7  string out = in;
8  for (;;) {
9  size_t p1 = out.find_first_of('{');
10  if (p1 == string::npos)
11  break;
12  size_t p2 = out.find_first_of('}', p1 + 1);
13  if (p2 == string::npos)
14  break;
15  size_t n = p2 - p1 - 1;
16  string name(out, p1 + 1, n);
17  PdtEntry particle(name);
18  particle.setup(*es_);
19  ostringstream o;
20  o << particle.pdgId();
21  string s = o.str();
22  out.replace(p1, n + 2, s);
23  }
24  return out;
25 }

References recoMuon::in, dqmiodumpmetadata::n, Skims_PA_cff::name, EcalTangentSkim_cfg::o, MillePedeFileConverter_cfg::out, p1, p2, PdtEntry::pdgId(), alignCSCRings::s, and PdtEntry::setup().

Member Data Documentation

◆ es_

const edm::EventSetup* PdgEntryReplacer::es_
private

Definition at line 15 of file PdgEntryReplacer.h.

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PdgEntryReplacer::es_
const edm::EventSetup * es_
Definition: PdgEntryReplacer.h:15
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:36
alignCSCRings.s
s
Definition: alignCSCRings.py:92
p2
double p2[4]
Definition: TauolaWrapper.h:90
recoMuon::in
Definition: RecoMuonEnumerators.h:6
p1
double p1[4]
Definition: TauolaWrapper.h:89
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
PdtEntry
Definition: PdtEntry.h:19
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31