Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlungModel.cc,v 1.22 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4MuBremsstrahlungModel.cc,v 1.24 2007/11/08 11:48:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -49,6 +49,7 @@
// 03-08-05 Angular correlations according to PRM (V.Ivantchenko)
// 13-02-06 add ComputeCrossSectionPerAtom (mma)
// 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI)
// 07-11-07 Improve sampling of final state (A.Bogdanov)
//
//
@@ -87,17 +88,17 @@ using namespace std;
G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(0),
lowestKinEnergy(1.0*GeV),
minThreshold(1.0*keV),
nzdat(5),
ntdat(8),
NBIN(1000),
cutFixed(0.98*keV),
samplingTablesAreFilled(false)
particle(0),
lowestKinEnergy(1.0*GeV),
minThreshold(1.0*keV),
nzdat(5),
ntdat(8),
NBIN(1000),
cutFixed(0.98*keV),
ignoreCut(false),
samplingTablesAreFilled(false)
{
theGamma = G4Gamma::Gamma();
if(p) SetParticle(p);
}
@@ -141,7 +142,6 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
highKinEnergy = HighEnergyLimit();
G4double fixedEnergy = 0.5*highKinEnergy;
// G4double fixedEnergy = 500000.*TeV;
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
@@ -161,8 +161,9 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
for (G4int i=0; i<numOfCouples; i++) {
G4double cute = DBL_MAX;
if(i < nc) cute = cuts[i];
if(cute < cutFixed || ignoreCut) cute = cutFixed;
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
G4DataVector* dv = ComputePartialSumSigma(material,fixedEnergy,cute);
partialSumSigma.push_back(dv);
@@ -171,8 +172,8 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
}
if(!samplingTablesAreFilled) MakeSamplingTables();
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>
(pParticleChange);
fParticleChange =
reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
}
@@ -186,10 +187,11 @@ G4double G4MuBremsstrahlungModel::ComputeDEDXPerVolume(
G4double cutEnergy)
{
G4double dedx = 0.0;
if (kineticEnergy <= lowestKinEnergy) return dedx;
if (kineticEnergy <= lowestKinEnergy || ignoreCut) return dedx;
G4double tmax = kineticEnergy;
G4double cut = min(cutEnergy,tmax);
if(cut < cutFixed) cut = cutFixed;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector =
@@ -360,8 +362,10 @@ G4double G4MuBremsstrahlungModel::ComputeCrossSectionPerAtom(
G4double cutEnergy,
G4double)
{
G4double cross = ComputeMicroscopicCrossSection (kineticEnergy,
Z, A/(g/mole), cutEnergy);
G4double cut = min(cutEnergy, kineticEnergy);
if(cut < cutFixed || ignoreCut) cut = cutFixed;
G4double cross =
ComputeMicroscopicCrossSection (kineticEnergy, Z, A/(g/mole), cut);
return cross;
}
@@ -379,6 +383,7 @@ G4double G4MuBremsstrahlungModel::CrossSectionPerVolume(
G4double tmax = min(maxEnergy, kineticEnergy);
G4double cut = min(cutEnergy, tmax);
if(cut < cutFixed || ignoreCut) cut = cutFixed;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
@@ -500,17 +505,18 @@ void G4MuBremsstrahlungModel::MakeSamplingTables()
void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double tmin,
G4double minEnergy,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
// check against insufficient energy
G4double tmax = min(kineticEnergy, maxEnergy);
G4double tmin = min(kineticEnergy, minEnergy);
if(tmin < cutFixed || ignoreCut) tmin = cutFixed;
if(tmin >= tmax) return;
static const G4double ysmall = -100. ;
static const G4double ytablelow = -5. ;
// ===== the begining of a new code ======
// ===== sampling of energy transfer ======
G4ParticleMomentum partDirection = dp->GetMomentumDirection();
@@ -520,81 +526,37 @@ void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
G4double totalEnergy = kineticEnergy + mass;
G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass));
G4double dy = 5./G4float(NBIN);
G4double AtomicNumber = anElement->GetZ();
G4double AtomicWeight = anElement->GetA()/(g/mole);
// This sampling should be checked!!! VI
G4double ymin=log(log(tmin/cutFixed)/log(tmax/cutFixed));
G4double func1 = tmin*ComputeDMicroscopicCrossSection(
kineticEnergy,AtomicNumber,
AtomicWeight,tmin);
if(ymin < ysmall) return;
// sampling using tables
G4double v,x,y ;
G4int iy;
// select sampling table ;
G4double lnZ = log(anElement->GetZ()) ;
G4double delmin = 1.e10 ;
G4double del ;
G4int izz = 0;
G4int itt = 0;
G4int NBINminus1;
NBINminus1 = NBIN-1 ;
for (G4int iz=0; iz<nzdat; iz++)
{
del = std::abs(lnZ-log(zdat[iz])) ;
if(del<delmin)
{
delmin=del ;
izz=iz ;
}
}
delmin = 1.e10 ;
for (G4int it=0; it<ntdat; it++)
{
del = std::abs(log(tmax)-log(tdat[it])) ;
if(del<delmin)
{
delmin=del;
itt=it ;
}
}
G4int iymin = G4int((ymin+5.)/dy+0.5) ;
G4double lnepksi, epksi;
G4double func2;
G4double ksi2;
do {
if(ymin < ytablelow)
{
y = ymin + G4UniformRand()*(ytablelow-ymin) ;
}
else
{
G4double r = G4UniformRand() ;
lnepksi = log(tmin) + G4UniformRand()*log(kineticEnergy/tmin);
epksi = exp(lnepksi);
func2 = epksi*ComputeDMicroscopicCrossSection(
kineticEnergy,AtomicNumber,
AtomicWeight,epksi);
ksi2 = G4UniformRand();
iy = iymin-1 ;
delmin = proba[izz][itt][NBINminus1]-proba[izz][itt][iymin] ;
do {
iy += 1 ;
} while ((r > (proba[izz][itt][iy]-proba[izz][itt][iymin])/delmin)
&&(iy < NBINminus1)) ;
} while(func2/func1 < ksi2);
//sampling is Done uniformly in y in the bin
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy] ) ;
}
x = exp(y) ;
v = cutFixed*exp(x*log(tmax/cutFixed)) ;
} while ( v <= 0.);
// ===== the end of a new code =====
// create G4DynamicParticle object for the Gamma
G4double gEnergy = v;
G4double gEnergy = epksi;
// sample angle
G4double gam = totalEnergy/mass;
G4double rmax = gam*min(1.0, totalEnergy/gEnergy - 1.0);
rmax *= rmax;
x = G4UniformRand()*rmax/(1.0 + rmax);
G4double x = G4UniformRand()*rmax/(1.0 + rmax);
G4double theta = sqrt(x/(1.0 - x))/gam;
G4double sint = sin(theta);