Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -30,8 +30,6 @@
// Sylvie Leray, CEA
// Joseph Cugnon, University of Liege
//
// INCL++ revision: v5.1.8
//
#define INCLXX_IN_GEANT4_MODE 1
#include "globals.hh"
@@ -48,6 +46,7 @@
#include <iostream>
#include <cmath>
#include <utility>
#include "G4INCLIRandomGenerator.hh"
#include "G4INCLThreeVector.hh"
#include "G4INCLGlobals.hh"
@@ -55,113 +54,86 @@
namespace G4INCL {
class Random {
private:
Random() {}
virtual ~Random() {}
private:
static IRandomGenerator *theGenerator;
public:
namespace Random {
/**
* Set the random number generator implementation to be used globally by INCL.
*
* @see G4INCL::IRandomGenerator
*/
static void setGenerator(G4INCL::IRandomGenerator *aGenerator) {
if(isInitialized()) {
ERROR("INCL random number generator already initialized." << std::endl);
} else {
theGenerator = aGenerator;
}
};
void setGenerator(G4INCL::IRandomGenerator *aGenerator);
/**
* Set the seeds of the current generator.
*
*/
static void setSeeds(const SeedVector &sv) {
theGenerator->setSeeds(sv);
};
void setSeeds(const SeedVector &sv);
/**
* Get the seeds of the current generator.
*
*/
static SeedVector getSeeds() {
return theGenerator->getSeeds();
};
SeedVector getSeeds();
/**
* Generate flat distribution of random numbers.
*/
static G4double shoot() {return theGenerator->flat(); };
G4double shoot();
/**
* Return a random number in the ]0,1] interval
*/
static G4double shoot0() {
G4double r;
while( (r=shoot()) <= 0. )
;
return r;
}
G4double shoot0();
/**
* Return a random number in the [0,1[ interval
*/
static G4double shoot1() {
G4double r;
while( (r=shoot()) >= 1. )
;
return r;
}
G4double shoot1();
/**
* Return a random integer in the [0,n[ interval
*/
template<typename T> T shootInteger(T n);
/**
* Generate random numbers using gaussian distribution.
*/
static G4double gauss(G4double sigma=1.);
G4double gauss(G4double sigma=1.);
/**
* Generate isotropically-distributed ThreeVectors of given norm.
*/
static ThreeVector normVector(G4double norm=1.);
ThreeVector normVector(G4double norm=1.);
/**
* Generate ThreeVectors that are uniformly distributed in a sphere of
* radius rmax.
*/
static ThreeVector sphereVector(G4double rmax=1.) {
return normVector( rmax*Math::pow13(shoot0()) );
}
ThreeVector sphereVector(G4double rmax=1.);
/** \brief Generate Gaussianly-distributed ThreeVectors
*
* Generate ThreeVectors that are distributed as a three-dimensional
* Gaussian of the given sigma.
*/
static ThreeVector gaussVector(G4double sigma=1.) {
const G4double sigmax = sigma * Math::oneOverSqrtThree;
return ThreeVector(gauss(sigmax), gauss(sigmax), gauss(sigmax));
}
ThreeVector gaussVector(G4double sigma=1.);
/// \brief Generate pairs of correlated Gaussian random numbers
std::pair<G4double,G4double> correlatedGaussian(const G4double corrCoeff, const G4double x0=0., const G4double sigma=1.);
/// \brief Generate pairs of correlated uniform random numbers
std::pair<G4double,G4double> correlatedUniform(const G4double corrCoeff);
/**
* Delete the generator
*/
static void deleteGenerator() {
delete theGenerator;
theGenerator = 0;
}
void deleteGenerator();
/**
* Check if the generator is initialized.
*/
static G4bool isInitialized() {
if(theGenerator == 0) return false;
return true;
};
};
G4bool isInitialized();
}
}