Import Geant4 8.2.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.2 2006/06/29 19:53:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4eCoulombScatteringModel.cc,v 1.10 2006/10/26 17:36:17 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -38,6 +38,10 @@
|
||||
// Creation date: 22.08.2005
|
||||
//
|
||||
// Modifications:
|
||||
// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
|
||||
// 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
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
@@ -49,6 +53,7 @@
|
||||
#include "G4eCoulombScatteringModel.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
|
||||
@@ -60,20 +65,21 @@ G4eCoulombScatteringModel::G4eCoulombScatteringModel(
|
||||
G4double thetaMin, G4double thetaMax, G4bool build,
|
||||
G4double tlim, const G4String& nam)
|
||||
: G4VEmModel(nam),
|
||||
theCrossSectionTable(0),
|
||||
cosThetaMin(cos(thetaMin)),
|
||||
cosThetaMax(cos(thetaMax)),
|
||||
lowMomentum(keV),
|
||||
highMomentum(MeV),
|
||||
q2Limit(tlim),
|
||||
theCrossSectionTable(0),
|
||||
lowKEnergy(keV),
|
||||
highKEnergy(TeV),
|
||||
alpha2(fine_structure_const*fine_structure_const),
|
||||
faclim(100.0),
|
||||
nbins(12),
|
||||
nmax(100),
|
||||
buildTable(build),
|
||||
isInitialised(false)
|
||||
{
|
||||
G4double p0 = hbarc/(Bohr_radius*0.885);
|
||||
a0 = 0.25*p0*p0;
|
||||
p0 = electron_mass_c2*classic_electr_radius;
|
||||
a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
|
||||
G4double p0 = electron_mass_c2*classic_electr_radius;
|
||||
coeff = twopi*p0*p0;
|
||||
}
|
||||
|
||||
@@ -90,38 +96,38 @@ G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
|
||||
const G4DataVector&)
|
||||
const G4DataVector&)
|
||||
{
|
||||
if(isInitialised) return;
|
||||
isInitialised = true;
|
||||
|
||||
if(pParticleChange)
|
||||
fParticleChange = reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
|
||||
fParticleChange =
|
||||
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
|
||||
else
|
||||
fParticleChange = new G4ParticleChangeForGamma();
|
||||
|
||||
if(!buildTable || p->GetParticleName() == "GenericIon") return;
|
||||
|
||||
// Compute cross section multiplied by Ptot^2*beta^2
|
||||
G4double mass = p->GetPDGMass();
|
||||
G4double mass2 = mass*mass;
|
||||
|
||||
theCrossSectionTable = new G4PhysicsTable(nmax);
|
||||
theCrossSectionTable = new G4PhysicsTable();
|
||||
G4PhysicsLogVector* ptrVector;
|
||||
G4double mom2, value;
|
||||
G4double pmin = lowMomentum*lowMomentum;
|
||||
G4double pmax = highMomentum*highMomentum;
|
||||
nbins = G4int(log10(pmax/pmin)/2.0) + 1;
|
||||
G4double e, value;
|
||||
nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
|
||||
|
||||
for(G4int j=1; j<nmax; j++) {
|
||||
const G4ElementTable* elmt = G4Element::GetElementTable();
|
||||
size_t nelm = G4Element::GetNumberOfElements();
|
||||
|
||||
ptrVector = new G4PhysicsLogVector(pmin, pmax, nbins);
|
||||
|
||||
for(size_t j=0; j<nelm; j++) {
|
||||
|
||||
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++) {
|
||||
mom2 = ptrVector->GetLowEdgeEnergy( i ) ;
|
||||
value = CalculateCrossSectionPerAtom(p, mom2, j);
|
||||
value *= mom2*mom2/(mom2 + mass2);
|
||||
ptrVector->PutValue( i, value );
|
||||
e = ptrVector->GetLowEdgeEnergy( i ) ;
|
||||
value = CalculateCrossSectionPerAtom(p, e, Z);
|
||||
ptrVector->PutValue( i, log(value) );
|
||||
}
|
||||
|
||||
theCrossSectionTable->insert(ptrVector);
|
||||
@@ -132,22 +138,39 @@ void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom(
|
||||
const G4ParticleDefinition* p,
|
||||
G4double momentum2,
|
||||
G4double kinEnergy,
|
||||
G4double Z)
|
||||
{
|
||||
G4double cross = 0.0;
|
||||
G4double m = p->GetPDGMass();
|
||||
G4double q = p->GetPDGCharge()/eplus;
|
||||
G4double mass2 = m*m;
|
||||
G4double costm = std::max(cosThetaMax, 1.0 - q2Limit/2.0*momentum2);
|
||||
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 invbeta2 = 1.0 + mass2/momentum2;
|
||||
G4double a = 2.0*pow(Z,0.666666667)*a0*
|
||||
(1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
|
||||
cross = coeff*q*q*Z*Z*(cosThetaMin - costm)/((a - cosThetaMin)*(a - costm));
|
||||
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;
|
||||
}
|
||||
*/
|
||||
}
|
||||
//G4cout << "p= " << sqrt(momentum2) << " Z= " << Z << " a= " << a
|
||||
//<< " cross= " << cross << " " <<G4endl;
|
||||
return cross;
|
||||
}
|
||||
|
||||
@@ -164,25 +187,31 @@ std::vector<G4DynamicParticle*>* G4eCoulombScatteringModel::SampleSecondaries(
|
||||
|
||||
G4double mass = dp->GetMass();
|
||||
G4double kinEnergy = dp->GetKineticEnergy();
|
||||
G4double momentum2 = kinEnergy*(kinEnergy + 2.0*mass);
|
||||
G4double invbeta2 = (kinEnergy + mass)*(kinEnergy + mass)/momentum2;
|
||||
G4double mom2 = kinEnergy*(kinEnergy + 2.0*mass);
|
||||
|
||||
const G4Element* elm = SelectRandomAtom(aMaterial, p, kinEnergy);
|
||||
G4double Z = elm->GetZ();
|
||||
G4double q = p->GetPDGCharge()/eplus;
|
||||
G4double q2 = q*q;
|
||||
|
||||
G4double a = 2.*pow(Z,0.666666667)*a0*
|
||||
(1.13 + 3.76*invbeta2*Z*Z*fine_structure_const*fine_structure_const)/momentum2 + 1.0;
|
||||
G4double costm = std::max(cosThetaMax, 1.0 - q2Limit/2.0*momentum2);
|
||||
if(costm > cosThetaMin) return 0;
|
||||
G4double invbeta2 = 1.0 + mass*mass/mom2;
|
||||
G4double a = 2.*ScreeningParameter(Z, q2, mom2, invbeta2);
|
||||
|
||||
G4double cost = a - (a - cosThetaMin)*(a - costm)/
|
||||
(a - cosThetaMin + G4UniformRand()*(cosThetaMin - costm));
|
||||
if(std::abs(cost) > 1.) {
|
||||
G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING cost= " << cost << G4endl;
|
||||
if(cost < -1.) cost = -1.0;
|
||||
else cost = 1.0;
|
||||
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
|
||||
if(costm >= cosThetaMin) return 0;
|
||||
|
||||
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 sint = sqrt((1.0 + cost)*(1.0 - cost));
|
||||
|
||||
G4double tet = 2.0*asin(sqrt(st2));
|
||||
G4double cost= cos(tet);
|
||||
G4double sint= sin(tet);
|
||||
|
||||
G4double phi = twopi * G4UniformRand();
|
||||
|
||||
@@ -190,7 +219,7 @@ std::vector<G4DynamicParticle*>* G4eCoulombScatteringModel::SampleSecondaries(
|
||||
G4ThreeVector newDirection(cos(phi)*sint,sin(phi)*sint,cost);
|
||||
newDirection.rotateUz(direction);
|
||||
|
||||
fParticleChange->ProposeMomentumDirection(direction);
|
||||
fParticleChange->ProposeMomentumDirection(newDirection);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user