Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4RandomDirection.hh 103484 2017-04-11 08:31:44Z gcosmo $
// $Id: G4RandomDirection.hh 106707 2017-10-20 08:30:31Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -39,6 +39,7 @@
// providing more performant results.
// History:
// 19.10.17 E. Tcherniaev, use of G.Marsaglia (1972) method
// 06.04.17 E. Tcherniaev, added G4RandomDirection(cosTheta)
// 15.03.16 E. Tcherniaev, removed unnecessary if and unit()
// 18.03.08 V. Grichine, unit radius sphere surface based algorithm
@@ -54,12 +55,17 @@
#include "Randomize.hh"
#include "G4ThreeVector.hh"
// G.Marsaglia (1972) method
inline G4ThreeVector G4RandomDirection()
{
G4double z = 2.*G4UniformRand() - 1.; // z = cos(theta)
G4double rho = std::sqrt((1.+z)*(1.-z)); // rho = sqrt(1-z*z)
G4double phi = CLHEP::twopi*G4UniformRand();
return G4ThreeVector(rho*std::cos(phi), rho*std::sin(phi), z);
G4double u, v, b;
do {
u = 2.*G4UniformRand() - 1.;
v = 2.*G4UniformRand() - 1.;
b = u*u + v*v;
} while (b > 1.);
G4double a = 2.*std::sqrt(1. - b);
return G4ThreeVector(a*u, a*v, 2.*b - 1.);
}
inline G4ThreeVector G4RandomDirection(G4double cosTheta)