#include <G4INCLParticleSpecies.hh>
Definition at line 53 of file G4INCLParticleSpecies.hh.
◆ ParticleSpecies() [1/4]
G4INCL::ParticleSpecies::ParticleSpecies |
( |
| ) |
|
|
inline |
◆ ParticleSpecies() [2/4]
G4INCL::ParticleSpecies::ParticleSpecies |
( |
std::string const & |
pS | ) |
|
Definition at line 54 of file G4INCLParticleSpecies.cc.
56 if(pS==
"p" || pS==
"proton") {
60 }
else if(pS==
"n" || pS==
"neutron") {
64 }
else if(pS==
"delta++" || pS==
"deltaplusplus") {
68 }
else if(pS==
"delta+" || pS==
"deltaplus") {
72 }
else if(pS==
"delta0" || pS==
"deltazero") {
76 }
else if(pS==
"delta-" || pS==
"deltaminus") {
80 }
else if(pS==
"pi+" || pS==
"pion+" || pS==
"piplus" || pS==
"pionplus") {
84 }
else if(pS==
"pi0" || pS==
"pion0" || pS==
"pizero" || pS==
"pionzero") {
88 }
else if(pS==
"pi-" || pS==
"pion-" || pS==
"piminus" || pS==
"pionminus") {
92 }
else if(pS==
"d" || pS==
"deuteron") {
96 }
else if(pS==
"t" || pS==
"triton") {
100 }
else if(pS==
"a" || pS==
"alpha") {
void parseNuclide(std::string const &pS)
Parse a nuclide name.
◆ ParticleSpecies() [3/4]
G4INCL::ParticleSpecies::ParticleSpecies |
( |
ParticleType const |
t | ) |
|
Definition at line 108 of file G4INCLParticleSpecies.cc.
G4int getChargeNumber(const ParticleType t)
Get charge number from particle type.
G4int getMassNumber(const ParticleType t)
Get mass number from particle type.
◆ ParticleSpecies() [4/4]
G4INCL::ParticleSpecies::ParticleSpecies |
( |
const G4int |
A, |
|
|
const G4int |
Z |
|
) |
| |
◆ parseElement()
G4bool G4INCL::ParticleSpecies::parseElement |
( |
std::string const & |
pS | ) |
|
|
private |
Parse an element name.
Note: this function is UGLY. Look at it at your own peril.
- Parameters
-
pS | a normalised string (lowercase) |
- Returns
- true if the parsing succeeded
Definition at line 237 of file G4INCLParticleSpecies.cc.
G4int parseElement(std::string pS)
Get the name of the element from the atomic number.
G4int parseIUPACElement(std::string const &pS)
Parse a IUPAC element name.
◆ parseIUPACElement()
G4bool G4INCL::ParticleSpecies::parseIUPACElement |
( |
std::string const & |
s | ) |
|
|
private |
Parse a IUPAC element name.
Note: this function is UGLY. Look at it at your own peril.
- Parameters
-
s | a normalised string (lowercase) |
- Returns
- true if the parsing succeeded
Definition at line 249 of file G4INCLParticleSpecies.cc.
G4int parseIUPACElement(std::string const &pS)
Parse a IUPAC element name.
◆ parseNuclide()
void G4INCL::ParticleSpecies::parseNuclide |
( |
std::string const & |
pS | ) |
|
|
private |
Parse a nuclide name.
Note: this function is UGLY. Look at it at your own peril.
- Parameters
-
pS | a normalised string (lowercase) |
Definition at line 120 of file G4INCLParticleSpecies.cc.
124 const std::string separators(
"-_");
125 std::string
allowed(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
129 if(pS.find_first_not_of(
allowed)!=std::string::npos) {
142 std::size_t firstSeparator = pS.find_first_of(separators);
143 std::size_t lastSeparator = pS.find_last_of(separators);
144 if(firstSeparator!=std::string::npos && firstSeparator!=lastSeparator) {
153 G4bool startsWithAlpha = std::isalpha(pS.at(0));
154 if(startsWithAlpha) {
155 predicate=std::isdigit;
156 }
else if(std::isdigit(pS.at(0))) {
157 predicate=std::isalpha;
166 size_t endFirstSection, beginSecondSection;
167 if(firstSeparator==std::string::npos) {
172 beginSecondSection = std::find_if(pS.begin()+1, pS.end(), predicate) - pS.begin();
174 if(beginSecondSection>=pS.size()) {
175 if(startsWithAlpha) {
186 endFirstSection = beginSecondSection;
190 endFirstSection = firstSeparator;
191 beginSecondSection = firstSeparator+1;
194 std::string firstSection(pS.substr(0,endFirstSection));
195 std::string secondSection(pS.substr(beginSecondSection,std::string::npos));
196 std::stringstream parsingStream;
200 if(startsWithAlpha) {
201 parsingStream.str(secondSection);
204 parsingStream.str(firstSection);
215 parsingStream >>
theA;
216 if(parsingStream.fail()) {
226 if(
theZ>theA && hasIsotope) {
233 if(
theZ==1 && theA==1)
ParticleSpecies()
Convert a string to a particle species.
G4bool parseElement(std::string const &pS)
Parse an element name.
◆ theA
G4int G4INCL::ParticleSpecies::theA |
◆ theType
◆ theZ
G4int G4INCL::ParticleSpecies::theZ |
The documentation for this class was generated from the following files: