Geant4  10.00.p02
G4INCLGlobals.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // INCL++ intra-nuclear cascade model
27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28 // Davide Mancusi, CEA
29 // Alain Boudard, CEA
30 // Sylvie Leray, CEA
31 // Joseph Cugnon, University of Liege
32 //
33 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 #ifndef G4INCLGlobals_hh
38 #define G4INCLGlobals_hh 1
39 
40 #include <cmath>
41 #include <string>
42 #include "G4INCLParticleType.hh"
43 
44 namespace G4INCL {
45  class Particle;
46 
47  namespace PhysicalConstants {
49  const G4double hc = 197.328;
50 
52  const G4double hcSquared = hc*hc;
53 
55  const G4double Pf = 1.37*hc;
56  // const G4double Pf = 1.36828*hc;
57 
59  const G4double PfSquared = Pf*Pf;
60 
63 
68  const G4double eSquared = 1.439964;
69  }
70 
71  namespace Math {
72  const G4double pi = 3.14159265358979323846264338328;
73  const G4double twoPi = 2.0 * pi;
74  const G4double tenPi = 10.0 * pi;
75  const G4double piOverTwo = 0.5 * pi;
76  const G4double oneOverSqrtTwo = 1./std::sqrt((G4double)2.);
77  const G4double oneOverSqrtThree = 1./std::sqrt((G4double)3.);
78  const G4double oneThird = 1./3.;
79  const G4double twoThirds = 2./3.;
80  const G4double sqrtFiveThirds = std::sqrt(5./3.);
81  const G4double sqrtThreeFifths = std::sqrt(3./5.);
82 
83  inline G4double toDegrees(G4double radians) {
84  return radians * (180.0 / pi);
85  }
86 
87  inline G4int heaviside(G4int n) {
88  if(n < 0) return 0;
89  else return 1;
90  }
91 
92  inline G4double pow13(G4double x) {
93  return std::pow(x, oneThird);
94  }
95 
97  return std::pow(x, -oneThird);
98  }
99 
100  inline G4double pow23(G4double x) {
101  return std::pow(x, twoThirds);
102  }
103 
104  inline G4double aSinH(G4double x) {
105  return std::log(x + std::sqrt(x*x+1.));
106  }
107 
111  template <typename T> inline G4int sign(const T t) {
112  return t > 0 ? 1: t < 0 ? -1 : 0;
113  }
114 
116  template <typename T> inline T max(const T t1, const T t2) {
117  return t1 > t2 ? t1 : t2;
118  }
119 
121  template <typename T> inline T min(const T t1, const T t2) {
122  return t1 < t2 ? t1 : t2;
123  }
124 
132  G4double gaussianCDF(const G4double x);
133 
143  G4double gaussianCDF(const G4double x, const G4double x0, const G4double sigma);
144 
145  }
146 
147  namespace ParticleConfig {
148  G4bool isPair(Particle const * const p1, Particle const * const p2, ParticleType t1, ParticleType t2);
149  }
150 
151  namespace String {
152  void wrap(std::string &str, const size_t lineLength=78, const std::string &separators=" \t");
153  void replaceAll(std::string &str, const std::string &from, const std::string &to, const size_t maxPosition=std::string::npos);
154  }
155 }
156 #endif
const G4double sqrtThreeFifths
const G4double PfCubed
Fermi momentum cubed [(MeV/c)^3].
const G4double eSquared
Coulomb conversion factor [MeV*fm].
G4int heaviside(G4int n)
const G4double tenPi
const G4double pi
const G4double hc
[MeV*fm]
G4double toDegrees(G4double radians)
int G4int
Definition: G4Types.hh:78
G4double pow23(G4double x)
G4double aSinH(G4double x)
const G4double hcSquared
[MeV^2*fm^2]
bool G4bool
Definition: G4Types.hh:79
const G4double sqrtFiveThirds
const G4double piOverTwo
const G4int n
const G4double oneOverSqrtThree
const G4double PfSquared
Fermi momentum squared [(MeV/c)^2].
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void replaceAll(std::string &str, const std::string &from, const std::string &to, const size_t maxPosition=std::string::npos)
const G4double Pf
Fermi momentum [MeV/c].
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
const G4double twoPi
G4bool isPair(Particle const *const p1, Particle const *const p2, ParticleType t1, ParticleType t2)
const G4double twoThirds
double G4double
Definition: G4Types.hh:76
G4double pow13(G4double x)
G4double powMinus13(G4double x)
const G4double oneThird
G4double gaussianCDF(const G4double x)
Cumulative distribution function for Gaussian.
G4int sign(const T t)
A simple sign function that allows us to port fortran code to c++ more easily.
const G4double oneOverSqrtTwo
void wrap(std::string &str, const size_t lineLength=78, const std::string &separators=" \t")