Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
// GEANT 4 class header file
|
||||
// ------------------------------------------------------------
|
||||
// Class description:
|
||||
//
|
||||
@@ -43,36 +43,39 @@
|
||||
|
||||
#include <CLHEP/Units/PhysicalConstants.h>
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
inline G4long G4Poisson(G4double mean)
|
||||
{
|
||||
G4long number = 0;
|
||||
const G4int border = 16;
|
||||
G4long number = 0;
|
||||
const G4int border = 16;
|
||||
const G4double limit = 2e9;
|
||||
|
||||
if(mean <= border)
|
||||
{
|
||||
G4double position = G4UniformRand();
|
||||
G4double position = G4UniformRand();
|
||||
G4double poissonValue = G4Exp(-mean);
|
||||
G4double poissonSum = poissonValue;
|
||||
G4double poissonSum = poissonValue;
|
||||
|
||||
while(poissonSum <= position)
|
||||
{
|
||||
++number;
|
||||
poissonValue *= mean/number;
|
||||
poissonValue *= mean / number;
|
||||
poissonSum += poissonValue;
|
||||
}
|
||||
return number;
|
||||
} // the case of mean <= 16
|
||||
} // the case of mean <= 16
|
||||
|
||||
G4double t = std::sqrt(-2.*std::log(G4UniformRand()))*
|
||||
std::cos(2.*CLHEP::pi*G4UniformRand());
|
||||
G4double value = mean + t*std::sqrt(mean) + 0.5;
|
||||
if(value < 0.) {return 0;}
|
||||
G4double t = std::sqrt(-2. * std::log(G4UniformRand())) *
|
||||
std::cos(2. * CLHEP::pi * G4UniformRand());
|
||||
G4double value = mean + t * std::sqrt(mean) + 0.5;
|
||||
if(value < 0.)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return (value >= limit) ? G4long(limit) : G4long(value);
|
||||
}
|
||||
|
||||
#endif /* G4POISSON_HH */
|
||||
#endif /* G4POISSON_HH */
|
||||
|
||||
Reference in New Issue
Block a user