Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlungModel.cc,v 1.44 2009/04/09 18:41:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4eBremsstrahlungModel.cc,v 1.48 2010/10/26 10:35:22 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// -------------------------------------------------------------------
//
@@ -54,6 +54,7 @@
// 27-03-06 Fix calculation of fl parameter at low energy (energy loss) (VI)
// 15-02-07 correct LPMconstant by a factor 2, thanks to G. Depaola (mma)
// 09-09-08 MigdalConstant increased in (2pi)^2 times (A.Schaelicke)
// 13-10-10 Add angular distributon interface (VI)
//
// Class Description:
//
@@ -74,6 +75,7 @@
#include "G4ProductionCutsTable.hh"
#include "G4DataVector.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ModifiedTsai.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -89,9 +91,12 @@ G4eBremsstrahlungModel::G4eBremsstrahlungModel(const G4ParticleDefinition* p,
LPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)),
isInitialised(false)
{
if(p) SetParticle(p);
if(p) { SetParticle(p); }
theGamma = G4Gamma::Gamma();
minThreshold = 1.0*keV;
minThreshold = 0.1*keV;
SetAngularDistribution(new G4ModifiedTsai());
highKinEnergy = HighEnergyLimit();
lowKinEnergy = LowEnergyLimit();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -128,7 +133,7 @@ G4double G4eBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
void G4eBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if(p) SetParticle(p);
if(p) { SetParticle(p); }
highKinEnergy = HighEnergyLimit();
lowKinEnergy = LowEnergyLimit();
const G4ProductionCutsTable* theCoupleTable=
@@ -171,8 +176,8 @@ G4double G4eBremsstrahlungModel::ComputeDEDXPerVolume(
G4double kineticEnergy,
G4double cutEnergy)
{
if(!particle) SetParticle(p);
if(kineticEnergy < lowKinEnergy) return 0.0;
if(!particle) { SetParticle(p); }
if(kineticEnergy < lowKinEnergy) { return 0.0; }
const G4double thigh = 100.*GeV;
@@ -271,7 +276,7 @@ G4double G4eBremsstrahlungModel::ComputeDEDXPerVolume(
}
dedx += loss;
}
if(dedx < 0.) dedx = 0.;
if(dedx < 0.) { dedx = 0.; }
return dedx;
}
@@ -412,11 +417,11 @@ G4double G4eBremsstrahlungModel::CrossSectionPerVolume(
G4double cutEnergy,
G4double maxEnergy)
{
if(!particle) SetParticle(p);
if(!particle) { SetParticle(p); }
G4double cross = 0.0;
G4double tmax = min(maxEnergy, kineticEnergy);
G4double cut = max(cutEnergy, minThreshold);
if(cut >= tmax) return cross;
if(cut >= tmax) { return cross; }
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetAtomicNumDensityVector();
@@ -494,7 +499,7 @@ G4double G4eBremsstrahlungModel::ComputeCrossSectionPerAtom(
{
G4double cross = 0.0 ;
if ( kineticEnergy < 1*keV || kineticEnergy < cut) return cross;
if ( kineticEnergy < 1*keV || kineticEnergy < cut) { return cross; }
static const G4double ksi=2.0, alfa=1.00;
static const G4double csigh = 0.127, csiglow = 0.25, asiglow = 0.020*MeV ;
@@ -663,7 +668,7 @@ void G4eBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
{
G4double kineticEnergy = dp->GetKineticEnergy();
G4double tmax = min(maxEnergy, kineticEnergy);
if(tmin >= tmax) return;
if(tmin >= tmax) { return; }
//
// GEANT4 internal units.
@@ -708,8 +713,8 @@ void G4eBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
G4double xmin = tmin/kineticEnergy;
G4double xmax = tmax/kineticEnergy;
G4double kappa = 0.0;
if(xmax >= 1.) xmax = 1.;
else kappa = log(xmax)/log(xmin);
if(xmax >= 1.) { xmax = 1.; }
else { kappa = log(xmax)/log(xmin); }
G4double epsilmin = tmin/totalEnergy;
G4double epsilmax = tmax/totalEnergy;
@@ -811,18 +816,6 @@ void G4eBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
*/
} while( greject < G4UniformRand()*grejmax );
}
/*
if(x > 0.999) {
G4cout << "### G4eBremsstrahlungModel Warning: e= " << kineticEnergy
<< " tlow= " << tlow
<< " x= " << x
<< " greject= " << greject
<< " grejmax= " << grejmax
<< " migdal= " << migdal
<< G4endl;
// if(x >= 1.0) G4Exception("X=1");
}
*/
gammaEnergy = x*kineticEnergy;
if (LPMFlag()) {
@@ -836,19 +829,12 @@ void G4eBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
} while (!LPMOK);
//
// angles of the emitted gamma. ( Z - axis along the parent particle)
// angles of the emitted gamma. ( Z - axis along the parent particle)
// use general interface
//
// universal distribution suggested by L. Urban
// (Geant3 manual (1993) Phys211),
// derived from Tsai distribution (Rev Mod Phys 49,421(1977))
G4double u;
const G4double a1 = 0.625 , a2 = 3.*a1 , d = 27. ;
if (9./(9.+d) > G4UniformRand()) u = - log(G4UniformRand()*G4UniformRand())/a1;
else u = - log(G4UniformRand()*G4UniformRand())/a2;
G4double theta = u*electron_mass_c2/totalEnergy;
G4double theta = GetAngularDistribution()->PolarAngle(totalEnergy,
totalEnergy-gammaEnergy,
(G4int)anElement->GetZ());
G4double sint = sin(theta);
@@ -900,20 +886,18 @@ const G4Element* G4eBremsstrahlungModel::SelectRandomAtom(
if(1 < nElements) {
--nElements;
G4DataVector* dv = partialSumSigma[couple->GetIndex()];
G4double rval = G4UniformRand()*((*dv)[nElements-1]);
G4double rval = G4UniformRand()*((*dv)[nElements]);
for (G4int i=0; i<nElements; i++) {
if (rval <= (*dv)[i]) elm = (*theElementVector)[i];
elm = (*theElementVector)[nElements];
for (G4int i=0; i<nElements; ++i) {
if (rval <= (*dv)[i]) {
elm = (*theElementVector)[i];
break;
}
}
if(!elm) {
G4cout << "G4eBremsstrahlungModel::SelectRandomAtom: Warning -"
<< " no elements found in "
<< material->GetName()
<< G4endl;
elm = (*theElementVector)[0];
}
} else elm = (*theElementVector)[0];
} else { elm = (*theElementVector)[0]; }
SetCurrentElement(elm);
return elm;