Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4eCoulombScatteringModel.cc,v 1.11 2007/05/22 17:34:36 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4eCoulombScatteringModel.cc,v 1.39 2007/11/28 12:36:23 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -42,6 +42,7 @@
|
||||
// logic of building - only elements from G4ElementTable
|
||||
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
|
||||
// 19.08.06 V.Ivanchenko add inline function ScreeningParameter
|
||||
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
@@ -56,6 +57,9 @@
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -78,9 +82,19 @@ G4eCoulombScatteringModel::G4eCoulombScatteringModel(
|
||||
buildTable(build),
|
||||
isInitialised(false)
|
||||
{
|
||||
fNistManager = G4NistManager::Instance();
|
||||
theElectron = G4Electron::Electron();
|
||||
thePositron = G4Positron::Positron();
|
||||
theProton = G4Proton::Proton();
|
||||
a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
|
||||
G4double p0 = electron_mass_c2*classic_electr_radius;
|
||||
coeff = twopi*p0*p0;
|
||||
coeff = twopi*p0*p0;
|
||||
constn = 6.937e-6/(MeV*MeV);
|
||||
tkin = targetZ = targetA = mom2 = DBL_MIN;
|
||||
elecXSection = nucXSection = 0.0;
|
||||
ecut = DBL_MAX;
|
||||
particle = 0;
|
||||
for(size_t j=0; j<100; j++) {index[j] = -1;}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -98,121 +112,223 @@ G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
|
||||
void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
|
||||
const G4DataVector&)
|
||||
{
|
||||
if(isInitialised) return;
|
||||
isInitialised = true;
|
||||
// G4cout << "!!! G4eCoulombScatteringModel::Initialise for "
|
||||
// << p->GetParticleName() << " cos(TetMin)= " << cosThetaMin
|
||||
// << " cos(TetMax)= " << cosThetaMax <<G4endl;
|
||||
if(!isInitialised) {
|
||||
isInitialised = true;
|
||||
|
||||
if(pParticleChange)
|
||||
fParticleChange =
|
||||
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
|
||||
else
|
||||
fParticleChange = new G4ParticleChangeForGamma();
|
||||
if(pParticleChange)
|
||||
fParticleChange =
|
||||
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
|
||||
else
|
||||
fParticleChange = new G4ParticleChangeForGamma();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!buildTable || p->GetParticleName() == "GenericIon") return;
|
||||
if(p->GetParticleType() == "nucleus") buildTable = false;
|
||||
if(!buildTable) return;
|
||||
|
||||
// Compute cross section multiplied by Ptot^2*beta^2
|
||||
theCrossSectionTable = new G4PhysicsTable();
|
||||
G4PhysicsLogVector* ptrVector;
|
||||
G4double e, value;
|
||||
// Compute log cross section table per atom
|
||||
if(!theCrossSectionTable) theCrossSectionTable = new G4PhysicsTable();
|
||||
|
||||
nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
|
||||
}
|
||||
|
||||
const G4ElementTable* elmt = G4Element::GetElementTable();
|
||||
size_t nelm = G4Element::GetNumberOfElements();
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
for(size_t j=0; j<nelm; j++) {
|
||||
G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kinEnergy,
|
||||
G4double Z, G4double A,
|
||||
G4double cutEnergy, G4double)
|
||||
{
|
||||
if(p == particle && kinEnergy == tkin && Z == targetZ &&
|
||||
A == targetA && cutEnergy == ecut) return nucXSection;
|
||||
|
||||
ptrVector = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
|
||||
const G4Element* elm = (*elmt)[j];
|
||||
G4double Z = elm->GetZ();
|
||||
index[G4int(Z)] = j;
|
||||
for(G4int i=0; i<=nbins; i++) {
|
||||
e = ptrVector->GetLowEdgeEnergy( i ) ;
|
||||
value = CalculateCrossSectionPerAtom(p, e, Z);
|
||||
ptrVector->PutValue( i, log(value) );
|
||||
//G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for "
|
||||
// << p->GetParticleName() << " Z= " << Z << " A= " << A
|
||||
// << " e= " << kinEnergy << G4endl;
|
||||
|
||||
nucXSection = ComputeElectronXSectionPerAtom(p,kinEnergy,Z,A,cutEnergy);
|
||||
|
||||
// nuclear cross section
|
||||
if(theCrossSectionTable) {
|
||||
G4bool b;
|
||||
G4int iz = G4int(Z);
|
||||
G4int idx = index[iz];
|
||||
|
||||
// compute table for given Z
|
||||
if(-1 == idx) {
|
||||
idx = theCrossSectionTable->size();
|
||||
index[iz] = idx;
|
||||
G4PhysicsLogVector* ptrVector
|
||||
= new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
|
||||
// G4cout << "New vector Z= " << iz << " A= " << A << " idx= " << idx << G4endl;
|
||||
G4double e, value;
|
||||
for(G4int i=0; i<=nbins; i++) {
|
||||
e = ptrVector->GetLowEdgeEnergy( i ) ;
|
||||
value = CalculateCrossSectionPerAtom(p, e, Z, A);
|
||||
ptrVector->PutValue( i, log(value) );
|
||||
}
|
||||
theCrossSectionTable->push_back(ptrVector);
|
||||
}
|
||||
|
||||
theCrossSectionTable->insert(ptrVector);
|
||||
// take value from the table
|
||||
nucXSection +=
|
||||
std::exp((((*theCrossSectionTable)[idx]))->GetValue(kinEnergy, b));
|
||||
|
||||
// compute value from scratch
|
||||
} else nucXSection += CalculateCrossSectionPerAtom(p, kinEnergy, Z, A);
|
||||
|
||||
// G4cout << " cross(bn)= " << nucXSection/barn << G4endl;
|
||||
|
||||
if(nucXSection < 0.0) nucXSection = 0.0;
|
||||
return nucXSection;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eCoulombScatteringModel::ComputeElectronXSectionPerAtom(
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kinEnergy,
|
||||
G4double Z,
|
||||
G4double A,
|
||||
G4double cutEnergy)
|
||||
{
|
||||
if(p == particle && kinEnergy == tkin && Z == targetZ &&
|
||||
cutEnergy == ecut) return elecXSection;
|
||||
ecut = cutEnergy;
|
||||
elecXSection = 0.0;
|
||||
SetupParticle(p);
|
||||
G4double ekin = std::max(keV, kinEnergy);
|
||||
//G4double ekin = kinEnergy;
|
||||
SetupTarget(Z, A, ekin);
|
||||
|
||||
G4double tmax = tkin;
|
||||
if(p == theElectron) tmax *= 0.5;
|
||||
else if(p != thePositron) {
|
||||
G4double ratio = electron_mass_c2/mass;
|
||||
G4double tau = tkin/mass;
|
||||
tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
|
||||
(1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
|
||||
}
|
||||
|
||||
G4double t = std::min(cutEnergy, tmax);
|
||||
G4double mom21 = t*(t + 2.0*electron_mass_c2);
|
||||
t = tkin - t;
|
||||
G4double mom22 = t*(t + 2.0*mass);
|
||||
cosTetMaxElec = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
|
||||
if(cosTetMaxElec < cosTetMaxNuc) cosTetMaxElec = cosTetMaxNuc;
|
||||
if(cosTetMaxElec < cosThetaMin) {
|
||||
G4double x1 = 1.0 - cosThetaMin + screenZ;
|
||||
G4double x2 = 1.0 - cosTetMaxElec + screenZ;
|
||||
elecXSection = coeff*Z*chargeSquare*invbeta2*
|
||||
(cosThetaMin - cosTetMaxElec)/(x1*x2*mom2);
|
||||
}
|
||||
// G4cout << "cut= " << ecut << " e= " << tkin
|
||||
// << " croosE(barn)= " << elecXSection/barn
|
||||
// << " cosEl= " << cosTetMaxElec << " costmin= " << cosThetaMin << G4endl;
|
||||
return elecXSection;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom(
|
||||
const G4ParticleDefinition* p,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kinEnergy,
|
||||
G4double Z)
|
||||
G4double Z, G4double A)
|
||||
{
|
||||
G4double cross = 0.0;
|
||||
G4double m = p->GetPDGMass();
|
||||
G4double tkin = std::max(keV, kinEnergy);
|
||||
G4double mom2 = tkin*(tkin + 2.0*m);
|
||||
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
|
||||
if(costm < cosThetaMin) {
|
||||
G4double q = p->GetPDGCharge()/eplus;
|
||||
G4double q2 = q*q;
|
||||
G4double invbeta2 = 1.0 + m*m/mom2;
|
||||
G4double A = ScreeningParameter(Z, q2, mom2, invbeta2);
|
||||
G4double a = 2.0*A + 1.0;
|
||||
cross = coeff*Z*(Z + 1.0)*q2*invbeta2*(cosThetaMin - costm)/
|
||||
((a - cosThetaMin)*(a - costm)*mom2);
|
||||
/*
|
||||
if(Z == 13 || Z == 79) {
|
||||
G4cout << "## e= " << kinEnergy << " beta= " << sqrt (1.0/invbeta2)
|
||||
<<" Z= " << Z
|
||||
<< " sig(bn)= " << cross/barn
|
||||
<< " cosMax= " << costm
|
||||
<< " cosMin= " << cosThetaMin
|
||||
<< G4endl;
|
||||
G4double atommass = 27.0;
|
||||
if(Z == 79) atommass = 197.0;
|
||||
G4double u0 = 1.e+6*atommass*cm2/(cross*Avogadro);
|
||||
G4double u1 = 0.5*u0/( A* ( (1.0 + A)*log(1.0 + 1.0/A) -1.0 ) );
|
||||
G4cout << " l0= " << u0 << " l1= " << u1
|
||||
<< " A= " << A << G4endl;
|
||||
}
|
||||
*/
|
||||
SetupParticle(p);
|
||||
G4double ekin = std::max(keV, kinEnergy);
|
||||
//G4double ekin = kinEnergy;
|
||||
SetupTarget(Z, A, ekin);
|
||||
|
||||
if(cosTetMaxNuc < cosThetaMin) {
|
||||
G4double x1 = 1.0 - cosThetaMin;
|
||||
G4double x2 = 1.0 - cosTetMaxNuc;
|
||||
G4double x3 = cosThetaMin - cosTetMaxNuc;
|
||||
G4double z1 = x1 + screenZ;
|
||||
G4double z2 = x2 + screenZ;
|
||||
G4double d = 1.0/formfactA - screenZ;
|
||||
G4double d1 = 1.0 - formfactA*screenZ;
|
||||
G4double zn1= x1 + d;
|
||||
G4double zn2= x2 + d;
|
||||
cross = coeff*Z*Z*chargeSquare*invbeta2
|
||||
*(x3/(z1*z2) + x3/(zn1*zn2) +
|
||||
2.0*std::log(z1*zn2/(z2*zn1))/d) / (mom2*d1*d1);
|
||||
}
|
||||
|
||||
// G4cout << "CalculateCrossSectionPerAtom: e(MeV)= " << tkin
|
||||
// << " cross(b)= " << cross/barn << " ctmin= " << cosThetaMin
|
||||
// << " ctmax= " << cosTetMaxNuc << G4endl;
|
||||
|
||||
return cross;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4eCoulombScatteringModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4DynamicParticle* dp,
|
||||
G4double,
|
||||
G4double)
|
||||
void G4eCoulombScatteringModel::SampleSecondaries(
|
||||
std::vector<G4DynamicParticle*>*,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4DynamicParticle* dp,
|
||||
G4double cutEnergy,
|
||||
G4double maxEnergy)
|
||||
{
|
||||
const G4Material* aMaterial = couple->GetMaterial();
|
||||
const G4ParticleDefinition* p = dp->GetDefinition();
|
||||
|
||||
G4double mass = dp->GetMass();
|
||||
G4double kinEnergy = dp->GetKineticEnergy();
|
||||
G4double mom2 = kinEnergy*(kinEnergy + 2.0*mass);
|
||||
|
||||
const G4Element* elm = SelectRandomAtom(aMaterial, p, kinEnergy);
|
||||
// Select atom and setup
|
||||
SetupParticle(p);
|
||||
const G4Element* elm =
|
||||
SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy);
|
||||
G4double Z = elm->GetZ();
|
||||
G4double q = p->GetPDGCharge()/eplus;
|
||||
G4double q2 = q*q;
|
||||
G4double A = elm->GetN();
|
||||
|
||||
G4double invbeta2 = 1.0 + mass*mass/mom2;
|
||||
G4double a = 2.*ScreeningParameter(Z, q2, mom2, invbeta2);
|
||||
G4double cross =
|
||||
ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy);
|
||||
|
||||
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
|
||||
G4double costm = cosTetMaxNuc;
|
||||
G4double formf = formfactA;
|
||||
if(G4UniformRand()*cross < elecXSection) {
|
||||
costm = cosTetMaxElec;
|
||||
formf = 0.0;
|
||||
}
|
||||
/*
|
||||
G4cout << "G4eCoul...SampleSecondaries: e(MeV)= " << tkin
|
||||
<< " ctmin= " << cosThetaMin
|
||||
<< " ctmaxN= " << cosTetMaxNuc
|
||||
<< " ctmax= " << costm
|
||||
<< " Z= " << Z << " A= " << A
|
||||
<< " cross= " << cross/barn << " crossE= " << elecXSection/barn
|
||||
<< G4endl;
|
||||
*/
|
||||
if(costm >= cosThetaMin) return;
|
||||
|
||||
G4double x = G4UniformRand();
|
||||
G4double y = (a + 1.0 - cosThetaMin)/(cosThetaMin - costm);
|
||||
G4double st2 = 0.5*(y*(1.0 - costm) - a*x)/(y + x);
|
||||
if(st2 < 0.0 || st2 > 1.0) {
|
||||
G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING st2= "
|
||||
<< st2 << G4endl;
|
||||
st2 = 0.0;
|
||||
}
|
||||
|
||||
G4double tet = 2.0*asin(sqrt(st2));
|
||||
G4double cost= cos(tet);
|
||||
G4double sint= sin(tet);
|
||||
|
||||
G4double x1 = 1. - cosThetaMin + screenZ;
|
||||
G4double x2 = 1. - costm;
|
||||
G4double x3 = cosThetaMin - costm;
|
||||
G4double grej, z, z1;
|
||||
do {
|
||||
z = G4UniformRand()*x3;
|
||||
z1 = (x1*x2 - screenZ*z)/(x1 + z);
|
||||
if(z1 < 0.0) z1 = 0.0;
|
||||
else if(z1 > 2.0) z1 = 2.0;
|
||||
grej = 1.0/(1.0 + formf*z1);
|
||||
} while ( G4UniformRand() > grej*grej );
|
||||
|
||||
G4double cost = 1.0 - z1;
|
||||
G4double sint= sqrt(z1*(2.0 - z1));
|
||||
/*
|
||||
if(sint > 0.1)
|
||||
G4cout<<"## SampleSecondaries: e(MeV)= " << kinEnergy
|
||||
<< " sint= " << sint << " Z= " << Z << " screenZ= " << screenZ
|
||||
<< " cn= " << formf
|
||||
<< G4endl;
|
||||
*/
|
||||
G4double phi = twopi * G4UniformRand();
|
||||
|
||||
G4ThreeVector direction = dp->GetMomentumDirection();
|
||||
|
||||
Reference in New Issue
Block a user