34 #define INCLXX_IN_GEANT4_MODE 1
56 if(pS==
"p" || pS==
"proton") {
61 }
else if(pS==
"n" || pS==
"neutron") {
66 }
else if(pS==
"delta++" || pS==
"deltaplusplus") {
71 }
else if(pS==
"delta+" || pS==
"deltaplus") {
76 }
else if(pS==
"delta0" || pS==
"deltazero") {
81 }
else if(pS==
"delta-" || pS==
"deltaminus") {
86 }
else if(pS==
"pi+" || pS==
"pion+" || pS==
"piplus" || pS==
"pionplus") {
91 }
else if(pS==
"pi0" || pS==
"pion0" || pS==
"pizero" || pS==
"pionzero") {
96 }
else if(pS==
"pi-" || pS==
"pion-" || pS==
"piminus" || pS==
"pionminus") {
101 }
else if(pS==
"lambda" || pS==
"l" || pS==
"l0") {
106 }
else if(pS==
"s+" || pS==
"sigma+" || pS==
"sigmaplus") {
111 }
else if(pS==
"s0" || pS==
"sigma0" || pS==
"sigmazero") {
116 }
else if(pS==
"s-" || pS==
"sigma-" || pS==
"sigmaminus") {
121 }
else if(pS==
"k+" || pS==
"kaon+" || pS==
"kplus" || pS==
"kaonplus") {
126 }
else if(pS==
"k0" || pS==
"kaon0" || pS==
"kzero" || pS==
"kaonzero") {
131 }
else if(pS==
"k0b" || pS==
"kzb" || pS==
"kaon0bar" || pS==
"kzerobar" || pS==
"kaonzerobar") {
136 }
else if(pS==
"k-" || pS==
"kaon-" || pS==
"kminus" || pS==
"kaonminus") {
141 }
else if(pS==
"k0s" || pS==
"kshort" || pS==
"ks" || pS==
"kaonshort") {
146 }
else if(pS==
"k0l" || pS==
"klong" || pS==
"kl" || pS==
"kaonlong") {
151 }
else if(pS==
"d" || pS==
"deuteron") {
156 }
else if(pS==
"t" || pS==
"triton") {
161 }
else if(pS==
"a" || pS==
"alpha") {
166 }
else if(pS==
"eta") {
171 }
else if(pS==
"omega") {
176 }
else if(pS==
"etaprime" || pS==
"etap") {
181 }
else if(pS==
"photon") {
215 const std::string separators(
"-_");
216 std::string
allowed(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
217 allowed += separators;
220 if(pS.find_first_not_of(allowed)!=std::string::npos) {
233 std::size_t firstSeparator = pS.find_first_of(separators);
234 std::size_t lastSeparator = pS.find_last_of(separators);
235 if(firstSeparator!=std::string::npos && firstSeparator!=lastSeparator) {
244 G4bool startsWithAlpha = std::isalpha(pS.at(0));
245 if(startsWithAlpha) {
246 predicate=std::isdigit;
247 }
else if(std::isdigit(pS.at(0))) {
248 predicate=std::isalpha;
257 size_t endFirstSection, beginSecondSection;
258 if(firstSeparator==std::string::npos) {
263 beginSecondSection = std::find_if(pS.begin()+1, pS.end(), predicate) - pS.begin();
265 if(beginSecondSection>=pS.size()) {
266 if(startsWithAlpha) {
277 endFirstSection = beginSecondSection;
281 endFirstSection = firstSeparator;
282 beginSecondSection = firstSeparator+1;
285 std::string firstSection(pS.substr(0,endFirstSection));
286 std::string secondSection(pS.substr(beginSecondSection,std::string::npos));
287 std::stringstream parsingStream;
291 if(startsWithAlpha) {
292 parsingStream.str(secondSection);
295 parsingStream.str(firstSection);
306 parsingStream >>
theA;
307 if(parsingStream.fail()) {
421 else if(
theA == 1 &&
theZ == 0 &&
theS == 0)
return 2112;
422 else if(
theA == 1 &&
theZ == 0 &&
theS == -1)
return 3122;
426 INCL_ERROR(
"ParticleSpecies::getPDGCode: Unknown particle type." <<
'\n');
G4int parseIUPACElement(std::string const &pS)
Parse a IUPAC element name.
G4int getChargeNumber(const ParticleType t)
Get charge number from particle type.
G4int getPDGCode() const
Set a PDG Code (MONTE CARLO PARTICLE NUMBERING)
void parseNuclide(std::string const &pS)
Parse a nuclide name.
G4int getStrangenessNumber(const ParticleType t)
Get strangeness number from particle type.
G4int getMassNumber(const ParticleType t)
Get mass number from particle type.
double A(double temperature)
G4bool parseElement(std::string const &pS)
Parse an element name.
G4bool parseIUPACElement(std::string const &s)
Parse a IUPAC element name.
G4int parseElement(std::string pS)
Get the name of the element from the atomic number.
ParticleSpecies()
Convert a string to a particle species.