CMS 3D CMS Logo

PdgEntryReplacer.cc
Go to the documentation of this file.
3 #include <sstream>
4 using namespace std;
5 
6 string PdgEntryReplacer::replace(const string& in) const {
7  string out = in;
8  for(;;) {
9  size_t p1 = out.find_first_of('{');
10  if(p1 == string::npos) break;
11  size_t p2 = out.find_first_of('}', p1 + 1);
12  if(p2 == string::npos) break;
13  size_t n = p2 - p1 - 1;
14  string name(out, p1 + 1, n);
15  PdtEntry particle(name);
16  particle.setup(*es_);
17  ostringstream o;
18  o << particle.pdgId();
19  string s = o.str();
20  out.replace(p1, n + 2, s);
21  }
22  return out;
23 }
std::string replace(const std::string &) const
double p2[4]
Definition: TauolaWrapper.h:90
void setup(const edm::EventSetup &)
fill data from Event Setup
Definition: PdtEntry.cc:28
double p1[4]
Definition: TauolaWrapper.h:89
int pdgId() const
PDG id.
Definition: PdtEntry.cc:7