33 #define INCLXX_IN_GEANT4_MODE 1
47 const G4double gcdfa2 = -0.284496736;
49 const G4double gcdfa4 = -1.453152027;
63 G4double y = 1.0 - (((((gcdfa5*t + gcdfa4)*t) + gcdfa3)*t + gcdfa2)*t + gcdfa1)*t*std::exp(-z*z);
65 return 0.5*(1.0 + sgn*
y);
73 namespace ParticleConfig {
80 #ifndef INCLXX_IN_GEANT4_MODE
82 void wrap(std::string &str,
const size_t lineLength,
const std::string &separators) {
83 const size_t len = str.size();
85 while(len-startPos > lineLength) {
86 const size_t nextNewline = str.find(
'\n', startPos);
87 if(nextNewline!=std::string::npos && nextNewline-startPos<=lineLength)
88 startPos = nextNewline+1;
90 size_t lastSeparator = str.find_last_of(separators, startPos+lineLength);
91 if(lastSeparator!=std::string::npos)
92 str[lastSeparator] =
'\n';
93 startPos = lastSeparator+1;
98 void replaceAll(std::string &str,
const std::string &from,
const std::string &to,
const size_t maxPosition) {
101 size_t start_pos = 0;
102 size_t cur_max_pos = maxPosition;
103 const size_t from_len = from.length();
104 const size_t to_len = to.length();
105 while((start_pos = str.find(from, start_pos)) != std::string::npos
106 && (cur_max_pos==std::string::npos || start_pos<cur_max_pos)) {
107 str.replace(start_pos, from_len, to);
109 if(cur_max_pos!=std::string::npos)
110 cur_max_pos += to_len - from_len;
114 #endif // INCLXX_IN_GEANT4_MODE
G4INCL::ParticleType getType() const
void replaceAll(std::string &str, const std::string &from, const std::string &to, const size_t maxPosition=std::string::npos)
G4bool isPair(Particle const *const p1, Particle const *const p2, ParticleType t1, ParticleType t2)
G4double gaussianCDF(const G4double x)
Cumulative distribution function for Gaussian.
const G4double oneOverSqrtTwo
void wrap(std::string &str, const size_t lineLength=78, const std::string &separators=" \t")