Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ComptonScattering.cc,v 1.4 2000/11/17 15:03:17 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//------------ G4ComptonScattering physics process --------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4GammaConversion.cc,v 1.4 2000/08/03 08:36:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
File diff suppressed because it is too large Load Diff
@@ -1,963 +0,0 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeIonisation.cc,v 1.5 2000/04/25 14:33:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// $Id:
// -------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: based on object model of
// 2nd December 1995, G.Cosmo
// ---------- G4IeIonisation physics process -----------
// by Laszlo Urban, 23 June 1998
// ************************************************************
// It is the first implementation of the IONISATION
// PROCESS. ( delta rays + continuous energy loss)
// using an INTEGRAL APPROACH instead of the differential
// one used in the standard implementation .
// ************************************************************
// 27/10/98: minor changes + cleanup, L.Urban
// --------------------------------------------------------------
#include "G4IeIonisation.hh"
#include "G4UnitsTable.hh"
G4IeIonisation::G4IeIonisation(const G4String& processName)
: G4VIeEnergyLoss(processName),
theMeanFreePathTable(NULL),
theNlambdaTable(NULL),
theInverseNlambdaTable(NULL),
theCoeffATable(NULL),
theCoeffBTable(NULL),
theCoeffCTable(NULL),
LowestKineticEnergy(1.00*keV),
HighestKineticEnergy(100.*TeV),
TotBin(100),
NumberOfBuildPhysicsTableCalls(0),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() )
{ }
G4IeIonisation::~G4IeIonisation()
{
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (theNlambdaTable) {
theNlambdaTable->clearAndDestroy();
delete theNlambdaTable;
}
if (theInverseNlambdaTable) {
theInverseNlambdaTable->clearAndDestroy();
delete theInverseNlambdaTable;
}
if(theCoeffATable) {
theCoeffATable->clearAndDestroy();
delete theCoeffATable;
}
if(theCoeffBTable) {
theCoeffBTable->clearAndDestroy();
delete theCoeffBTable;
}
if(theCoeffCTable) {
theCoeffCTable->clearAndDestroy();
delete theCoeffCTable;
}
}
void G4IeIonisation::SetPhysicsTableBining(
G4double lowE,G4double highE,G4int nBins)
{
LowestKineticEnergy=lowE; HighestKineticEnergy=highE; TotBin=nBins;
}
void G4IeIonisation::BuildPhysicsTable(
const G4ParticleDefinition& aParticleType)
{
RTable = exp(log(HighestKineticEnergy/LowestKineticEnergy)/TotBin) ;
NumberOfBuildPhysicsTableCalls += 1 ;
if(NumberOfBuildPhysicsTableCalls == 1)
{
BuildLossTable(aParticleType) ;
if(&aParticleType==theElectron)
{
RecorderOfElectronProcess[CounterOfElectronProcess] =
(*this).theLossTable ;
CounterOfElectronProcess++;
}
else
{
RecorderOfPositronProcess[CounterOfPositronProcess] =
(*this).theLossTable ;
CounterOfPositronProcess++;
}
BuildLambdaTable(aParticleType) ;
BuildDEDXTable(aParticleType) ;
}
else
{
BuildNlambdaTable(aParticleType) ;
BuildCoeffATable(aParticleType) ;
BuildCoeffBTable(aParticleType) ;
BuildCoeffCTable(aParticleType) ;
BuildInverseNlambdaTable(aParticleType) ;
G4int printflag = 0 ;
if(printflag>0)
TestOfInversion(aParticleType,printflag) ;
NumberOfBuildPhysicsTableCalls = 0 ;
if(&aParticleType==G4Electron::Electron())
PrintInfoDefinition();
}
}
void G4IeIonisation::TestOfInversion(
const G4ParticleDefinition& aParticleType,
G4int printflag)
{
G4double T,Nlambda,Tprime,delta,del,sum,delmean,Tdelta ;
G4bool isOut ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
G4cout.setf(G4std::ios::scientific, G4std::ios::floatfield) ;
if(printflag>1)
{
G4cout << G4endl;
G4cout << " particle=" << aParticleType.GetParticleName() << G4endl;
G4cout << "----------------------" << G4endl;
}
for (G4int J=0; J<numOfMaterials; J++)
{
if(printflag>1)
{
G4cout << G4endl;
G4cout << " material = " << (*theMaterialTable)[J]->GetName() << G4endl;
G4cout << " mat.ind.=" << J << " T Nlambda Tprime"
<< " (Tprime-T)/T(%)" << G4endl ;
}
G4PhysicsLogVector* aVector ;
aVector = new G4PhysicsLogVector(LowestKineticEnergy,
HighestKineticEnergy,TotBin) ;
delta = 0. ;
delmean = 0.;
sum = 0.;
Tdelta = 0. ;
for (G4int i=0; i<TotBin-2; i++)
{
T = aVector->GetLowEdgeEnergy(i) ;
Nlambda = (*theNlambdaTable)[J]->GetValue(T,isOut) ;
if(Nlambda>0.)
{
Tprime = (*theInverseNlambdaTable)[J]->GetValue(Nlambda,isOut) ;
if((Nlambda>0.)&&(i<(TotBin-1)))
{
del = 100.*(Tprime-T)/T ;
sum += 1.;
delmean += abs(del);
if(abs(del)>abs(delta))
{
delta = del ;
Tdelta = T ;
}
}
if(printflag>1)
{
G4cout << G4std::setw(18) << G4std::setprecision(6) << T << " " <<
G4std::setw(14)<< G4std::setprecision(6) << Nlambda << " " <<
G4std::setw(14) << G4std::setprecision(6) << Tprime << " " <<
G4std::setw(12) << G4std::setprecision(3) << del << G4endl;
}
}
}
if(printflag>0)
{
G4cout << G4endl;
G4cout << "G4IeIonisation::TestOfInversion (T->Nlambda->Tprime) " << G4endl ;
G4cout << "particle= " << aParticleType.GetParticleName() <<
" material= " << (*theMaterialTable)[J]->GetName() << G4endl ;
G4cout << "max (Tprime-T)/T in % =" << G4std::setw(10) << G4std::setprecision(3) <<
delta ;
G4cout << " at a kinetic energy " << G4std::setw(10) << G4std::setprecision(3) <<
Tdelta/MeV << " MeV" << G4endl;
delmean /= sum ;
G4cout << "mean rel.diff. (Tprime-T)/T=" << G4std::setw(10) <<
G4std::setprecision(3) << delmean <<
" % (mean is calculated in abs. value)" << G4endl;
G4cout << G4endl;
}
}
}
void G4IeIonisation::BuildNlambdaTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
if(theNlambdaTable)
{ theNlambdaTable->clearAndDestroy();
delete theNlambdaTable ; }
theNlambdaTable = new G4PhysicsTable(numOfMaterials) ;
for (G4int J=0; J<numOfMaterials; J++)
{
G4PhysicsLogVector* aVector ;
aVector = new G4PhysicsLogVector(LowestKineticEnergy,
HighestKineticEnergy,TotBin) ;
BuildNlambdaVector(aParticleType,J,aVector) ;
theNlambdaTable->insert(aVector) ;
}
}
void G4IeIonisation::BuildNlambdaVector(
const G4ParticleDefinition& aParticleType,
G4int materialIndex,
G4PhysicsLogVector* nlambdaVector)
{
G4double LowEdgeEnergy,T,Tlast,dEdx,Value,Vlast,u,du,coeff,l ;
G4double thresholdEnergy ;
const G4int nbin = 20 ;
G4bool isOut ;
const G4double small = 1.e-100;
const G4double lmin=1.e-100,lmax=1.e100;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
if(&aParticleType == theElectron)
thresholdEnergy = 2.*DeltaCutInKineticEnergy[materialIndex];
else
thresholdEnergy = DeltaCutInKineticEnergy[materialIndex];
// here assumed that the threshold energy for the process >=
// LowestKineticEnergy (temporarily )
if(thresholdEnergy >= LowestKineticEnergy)
{
Value = 0. ;
}
else
{
// extrapolation needed ..................
//first integral from thresholdEnergy to LowestKineticEnergy
Value = 0. ;
}
nlambdaVector->PutValue(0,Value) ;
Tlast = LowestKineticEnergy ;
Vlast = Value ;
for (G4int i=1; i<TotBin; i++)
{
LowEdgeEnergy = nlambdaVector->GetLowEdgeEnergy(i) ;
Value = 0. ;
if(LowEdgeEnergy > thresholdEnergy)
{
u = log(LowEdgeEnergy/Tlast) ;
du = u/nbin ;
u = -du ;
for(G4int n=0; n<=nbin; n++)
{
u += du ;
T = Tlast*exp(u) ;
if((n==0)||(n==nbin))
coeff=0.5 ;
else
coeff=1.0 ;
l = (*theMeanFreePathTable)[materialIndex]->GetValue(T,isOut);
if((l>lmin) && (l<lmax))
Value += coeff*T/(G4EnergyLossTables::GetPreciseDEDX(&aParticleType,
T,(*theMaterialTable)[materialIndex])*l);
}
Value *= du ;
Value += Vlast ;
if(Value<small)
Value = 0. ;
}
nlambdaVector->PutValue(i,Value) ;
Tlast = LowEdgeEnergy ;
Vlast = Value ;
}
}
void G4IeIonisation::BuildCoeffATable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "A"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffATable)
{ theCoeffATable->clearAndDestroy();
delete theCoeffATable; }
theCoeffATable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = RTable/w , w2 = -RTable*R1/w , w3 = R2/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
for (G4int J=0; J<numOfMaterials; J++)
{
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if( i < (TotBin-1))
Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
else
Value = 0. ;
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffATable->insert(aVector);
}
}
void G4IeIonisation::BuildCoeffBTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "B"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffBTable)
{ theCoeffBTable->clearAndDestroy();
delete theCoeffBTable; }
theCoeffBTable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
for (G4int J=0; J<numOfMaterials; J++)
{
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if(i < (TotBin-1))
Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
else
Value = RTable*(Ri-Rim)/((RTable-1.)*Ti) ;
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffBTable->insert(aVector);
}
}
void G4IeIonisation::BuildCoeffCTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "C"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffCTable)
{ theCoeffCTable->clearAndDestroy();
delete theCoeffCTable; }
theCoeffCTable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = 1./w , w2 = -RTable*R1/w , w3 = RTable*R2/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
for (G4int J=0; J<numOfMaterials; J++)
{
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if(i < (TotBin-1))
Value = w1*Rip + w2*Ri + w3*Rim ;
else
Value = (-Ri+RTable*Rim)/(RTable-1.) ;
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffCTable->insert(aVector);
}
}
void G4IeIonisation::BuildInverseNlambdaTable(
const G4ParticleDefinition& aParticleType)
{
G4double T,Smallest,Biggest ;
const G4double small = 1.e-100;
G4bool isOut ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(theInverseNlambdaTable)
{ theInverseNlambdaTable->clearAndDestroy();
delete theInverseNlambdaTable; }
theInverseNlambdaTable = new G4PhysicsTable(numOfMaterials);
for (G4int J=0; J<numOfMaterials; J++)
{
T = LowestKineticEnergy ;
do
{
Smallest = (*theNlambdaTable)[J]->
GetValue(T,isOut) ;
T *= RTable ;
} while ((Smallest <= small)&&(T<HighestKineticEnergy)) ;
Biggest = (*theNlambdaTable)[J]->
GetValue(HighestKineticEnergy,isOut) ;
// inverse can be built for "meaningful" cut value only!
if(Smallest >= Biggest)
{
G4Exception(
"Cut value is too big , smaller value should be used !");
}
G4PhysicsLogVector* aVector;
aVector = new G4PhysicsLogVector(Smallest,
Biggest,TotBin);
InvertNlambdaVector(aParticleType,J, aVector);
theInverseNlambdaTable->insert(aVector);
}
}
void G4IeIonisation::InvertNlambdaVector(
const G4ParticleDefinition& aParticleType,
G4int materialIndex,
G4PhysicsLogVector* nlambdaVector)
{
G4double LowEdge,A,B,C,discr,KineticEnergy ;
G4double Tbin = LowestKineticEnergy/RTable ;
G4double bin = 0.0 ;
G4int binnumber = -1 ;
G4bool isOut ;
//loop for Nlambda values
for( G4int i=0; i<TotBin; i++)
{
LowEdge = nlambdaVector->GetLowEdgeEnergy(i) ; //i.e. GetLowEdgeValue(i)
if( bin < LowEdge )
{
do
{
binnumber += 1 ;
Tbin *= RTable ;
bin = (*theNlambdaTable)[materialIndex]->GetValue(Tbin,isOut) ;
}
while ((bin < LowEdge) && (binnumber < TotBin-2 )) ;
}
if(binnumber == 0)
KineticEnergy = LowestKineticEnergy ;
else if(binnumber == TotBin-1)
KineticEnergy = HighestKineticEnergy/RTable ;
else
{
A = (*(*theCoeffATable)(materialIndex))(binnumber-1) ;
B = (*(*theCoeffBTable)(materialIndex))(binnumber-1) ;
C = (*(*theCoeffCTable)(materialIndex))(binnumber-1) ;
if(A==0.)
KineticEnergy = (LowEdge -C )/B ;
else
{
discr = B*B - 4.*A*(C-LowEdge);
discr = discr>0. ? sqrt(discr) : 0.;
KineticEnergy = 0.5*(discr-B)/A ;
}
}
nlambdaVector->PutValue(i,KineticEnergy) ;
}
}
void G4IeIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
{
G4double LowEdgeEnergy , ionloss ;
G4bool isOutRange ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
const G4double twoln10 = 2.*log(10.) ;
const G4double Factor = twopi_mc2_rcl2 ;
ParticleMass = aParticleType.GetPDGMass();
ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
G4int numOfMaterials = theMaterialTable->length();
if (theLossTable) {
theLossTable->clearAndDestroy();
delete theLossTable;
}
theLossTable = new G4PhysicsTable(numOfMaterials);
for (G4int J=0; J<numOfMaterials; J++)
{
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
G4double ElectronDensity,Eexc,Eexcm2,Cden,Mden,Aden,X0den,X1den ;
const G4Material* material= (*theMaterialTable)[J];
ElectronDensity = material->GetElectronDensity();
Eexc = material->GetIonisation()->GetMeanExcitationEnergy();
Eexcm2 = Eexc/ParticleMass ;
Eexcm2 *= Eexcm2 ;
Cden = material->GetIonisation()->GetCdensity();
Mden = material->GetIonisation()->GetMdensity();
Aden = material->GetIonisation()->GetAdensity();
X0den = material->GetIonisation()->GetX0density();
X1den = material->GetIonisation()->GetX1density();
ParticleCutInKineticEnergyNow = ParticleCutInKineticEnergy[J] ;
// some local variables -------------------
G4double tau,Tmax,gamma,gamma2,bg2,beta2,d,d2,d3,d4,delta,x,y ;
for (G4int i = 0 ; i < TotBin ; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
tau = LowEdgeEnergy/ParticleMass ;
// Seltzer-Berger formula
gamma = tau +1. ;
bg2 = tau*(tau+2.) ;
gamma2 = gamma*gamma ;
beta2 = bg2/gamma2 ;
// electron .................................
if(&aParticleType==theElectron)
{
Tmax = LowEdgeEnergy/2. ;
d = G4std::min(ParticleCutInKineticEnergyNow, Tmax)/ParticleMass;
ionloss = log(2.*(tau+2.)/Eexcm2)-1.-beta2 ;
ionloss += log((tau-d)*d)+tau/(tau-d) ;
ionloss += (0.5*d*d+(2.*tau+1.)*log(1.-d/tau))/gamma2 ;
}
//positron ...............................
else
{
Tmax = LowEdgeEnergy ;
d = G4std::min(ParticleCutInKineticEnergyNow, Tmax)/ParticleMass;
d2=d*d/2. ;
d3=d*d*d/3. ;
d4=d*d*d*d/4. ;
y=1./(1.+gamma) ;
ionloss = log(2.*(tau+2.)/Eexcm2)+log(tau*d) ;
ionloss-= beta2*(tau+2.*d-y*(3.*d2+y*(d-d3+y*(d2-tau*d3+d4))))/tau;
}
// density correction ................................
x = log(bg2)/twoln10 ;
if ( x < X0den )
delta = 0. ;
else
{
delta = twoln10*x - Cden ;
if ( x < X1den )
delta += Aden*pow((X1den-x),Mden) ;
}
// now you can compute the total ionization loss
ionloss -= delta ;
ionloss *= Factor*ElectronDensity/beta2 ;
if ( ionloss <= 0.)
ionloss = 0. ;
aVector->PutValue(i,ionloss) ;
}
theLossTable->insert(aVector);
}
}
void G4IeIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
{
G4double LowEdgeEnergy , Value ,sigma ;
G4bool isOutRange ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable(numOfMaterials);
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
for (G4int J=0 ; J < numOfMaterials; J++)
{
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
const G4Material* material= (*theMaterialTable)[J];
const G4ElementVector* theElementVector=
material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector();
const G4int NumberOfElements=
material->GetNumberOfElements() ;
DeltaKineticEnergyCutNow = DeltaCutInKineticEnergy[J] ;
for ( G4int i = 0 ; i < TotBin ; i++ )
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
for (G4int iel=0; iel<NumberOfElements; iel++ )
{
sigma += theAtomicNumDensityVector[iel]*
ComputeMicroscopicCrossSection(aParticleType,
LowEdgeEnergy,
(*theElementVector)(iel)->GetZ() ) ;
}
Value = sigma<=0 ? DBL_MAX : 1./sigma ;
aVector->PutValue(i, Value) ;
}
theMeanFreePathTable->insert(aVector);
}
}
G4double G4IeIonisation::ComputeMicroscopicCrossSection(
const G4ParticleDefinition& aParticleType,
G4double KineticEnergy,
G4double AtomicNumber)
{
// calculates the microscopic cross section in GEANT4 internal units
// ( it is called for elements , AtomicNumber = Z )
G4double TotalEnergy,MaxKineticEnergyTransfer,
betasquare,gamma,gamma2,x,x2,y,y2,y12,b1,b2,b3,b4,
TotalCrossSection;
TotalEnergy=KineticEnergy + ParticleMass;
betasquare = KineticEnergy*(TotalEnergy+ParticleMass)
/(TotalEnergy*TotalEnergy);
gamma = TotalEnergy/ParticleMass ;
x=DeltaKineticEnergyCutNow/KineticEnergy ;
if(&aParticleType==theElectron)
MaxKineticEnergyTransfer = 0.5*KineticEnergy ;
else
MaxKineticEnergyTransfer = KineticEnergy ;
if( MaxKineticEnergyTransfer > DeltaKineticEnergyCutNow )
{
//Moller (e-e-) scattering
if(&aParticleType==theElectron)
{
gamma2 = gamma*gamma ;
TotalCrossSection = (gamma-1.)*(gamma-1.)*(0.5-x)/gamma2 + 1./x -
1./(1.-x)-(2.*gamma-1.)*log((1.-x)/x)/gamma2 ;
TotalCrossSection /= betasquare ;
}
//Bhabha (e+e-) scattering
else
{
x2=x*x ;
y=1./(1.+gamma) ;
y2=y*y ;
y12=1.-2.*y ;
b1=2.-y2 ;
b2=y12*(3.+y2) ;
b4=y12*y12*y12 ;
b3=b4+y12*y12 ;
TotalCrossSection = (1./x-1.)/betasquare+b1*log(x)+b2*(1.-x)-
b3*(1.-x2)/2.+b4*(1.-x2*x)/3. ;
}
TotalCrossSection = twopi_mc2_rcl2 * AtomicNumber
*TotalCrossSection/KineticEnergy ;
}
else
TotalCrossSection = 0. ;
return TotalCrossSection ;
}
G4VParticleChange* G4IeIonisation::PostStepDoIt(
const G4Track& trackData,
const G4Step& stepData)
{
aParticleChange.Initialize(trackData) ;
G4Material* aMaterial = trackData.GetMaterial() ;
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle() ;
G4double Charge = aParticle->GetDefinition()->GetPDGCharge();
ParticleMass = aParticle->GetDefinition()->GetPDGMass();
G4double KineticEnergy = aParticle->GetKineticEnergy();
G4double TotalEnergy = KineticEnergy + ParticleMass;
G4double Psquare = KineticEnergy*(TotalEnergy+ParticleMass);
G4double TotalMomentum = sqrt(Psquare);
G4double Esquare=TotalEnergy*TotalEnergy;
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
// get kinetic energy cut for the electron
DeltaCutInKineticEnergy = G4Electron::Electron()->GetCutsInEnergy();
G4double DeltaThreshold = DeltaCutInKineticEnergy[aMaterial->GetIndex()];
// some kinematics
G4double MaxKineticEnergyTransfer;
if (Charge < 0.) MaxKineticEnergyTransfer = 0.5*KineticEnergy;
else MaxKineticEnergyTransfer = KineticEnergy;
// sampling kinetic energy of the delta ray
if (MaxKineticEnergyTransfer <= DeltaThreshold)
return G4IVContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
// normal case
G4double cc,y,y2,c2,b0,b1,b2,b3,b4,x,x1,grej,grejc;
G4double tau = KineticEnergy/ParticleMass;
G4double gamma = tau+1., gamma2=gamma*gamma;
G4double xc = DeltaThreshold/KineticEnergy, xc1=1.-xc;
if (Charge < 0.) // Moller (e-e-) scattering
{
b1=4./(9.*gamma2-10.*gamma+5.);
b2=tau*tau*b1; b3=(2.*gamma2+2.*gamma-1.)*b1;
cc=1.-2.*xc;
do {
x = xc/(1.-cc*G4UniformRand()); x1 = 1.-x;
grej = b2*x*x-b3*x/x1+b1*gamma2/(x1*x1);
} while (G4UniformRand()>grej) ;
}
else // Bhabha (e+e-) scattering
{
y=1./(gamma+1.); y2=y*y; cc=1.-2.*y;
b1=2.-y2; b2=cc*(3.+y2);
c2=cc*cc; b4=c2*cc; b3=c2+b4;
b0=gamma2/(gamma2-1.);
grejc=(((b4*xc-b3)*xc+b2)*xc-b1)*xc+b0;
do {
x = xc/(1.-xc1*G4UniformRand());
grej = ((((b4*x-b3)*x+b2)*x-b1)*x+b0)/grejc;
} while (G4UniformRand()>grej);
}
G4double DeltaKineticEnergy = x * KineticEnergy;
// protection :do not produce a secondary with 0. kinetic energy !
if (DeltaKineticEnergy <= 0.)
return G4IVContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
G4double DeltaTotalMomentum = sqrt(DeltaKineticEnergy * (DeltaKineticEnergy +
2. * electron_mass_c2 ));
G4double costheta = DeltaKineticEnergy * (TotalEnergy + electron_mass_c2)
/(DeltaTotalMomentum * TotalMomentum);
if (costheta < -1.) costheta = -1.;
if (costheta > +1.) costheta = +1.;
// direction of the delta electron
G4double phi = twopi * G4UniformRand();
G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
G4double dirx = sintheta * cos(phi), diry = sintheta * sin(phi),
dirz = costheta;
G4ThreeVector DeltaDirection(dirx,diry,dirz);
DeltaDirection.rotateUz(ParticleDirection);
// create G4DynamicParticle object for delta ray
G4DynamicParticle* theDeltaRay = new G4DynamicParticle;
theDeltaRay->SetKineticEnergy( DeltaKineticEnergy );
theDeltaRay->SetMomentumDirection(
DeltaDirection.x(),DeltaDirection.y(),DeltaDirection.z());
theDeltaRay->SetDefinition(G4Electron::Electron());
// fill aParticleChange
// changed energy and momentum of the actual particle
G4double finalKineticEnergy = KineticEnergy - DeltaKineticEnergy;
if (finalKineticEnergy > 0.)
{
G4double finalPx = TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x();
G4double finalPy = TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y();
G4double finalPz = TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z();
G4double finalMomentum =
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
finalPx /= finalMomentum ;
finalPy /= finalMomentum ;
finalPz /= finalMomentum ;
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
}
else
{
finalKineticEnergy = 0.;
if (Charge < 0.) aParticleChange.SetStatusChange(fStopAndKill);
else aParticleChange.SetStatusChange(fStopButAlive);
}
aParticleChange.SetEnergyChange( finalKineticEnergy );
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary( theDeltaRay );
aParticleChange.SetLocalEnergyDeposit (0.);
return G4IVContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
void G4IeIonisation::PrintInfoDefinition()
{
G4String comments = "delta cross sections from Moller+Bhabha. ";
comments += "Good description from 1 KeV to 100 GeV.\n";
comments += " delta ray energy sampled from differential Xsection.";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestKineticEnergy,"Energy")
<< " to " << G4BestUnit(HighestKineticEnergy,"Energy")
<< " in " << TotBin << " bins. \n";
}
@@ -1,893 +0,0 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IeplusAnnihilation.cc,v 1.6 1999/12/15 14:51:50 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4IeplusAnnihilation process --------
// by Michel Maire, 7 July 1996
// **************************************************************
// --------------------------------------------------------------
// ************************************************************
// It is the first implementation of the
// eplusANNIHILATION PROCESS
// using an INTEGRAL APPROACH instead of the differential
// one used in the standard implementation .
// ************************************************************
// by Laszlo Urban, 23 June 1998
// -----------------------------------------------------------
// 28/10/28: some cleanup , L.Urban
#include "G4IeplusAnnihilation.hh"
#include "G4UnitsTable.hh"
// constructor
G4IeplusAnnihilation::G4IeplusAnnihilation(const G4String& processName)
: G4IVRestDiscreteProcess (processName),
LowestEnergyLimit ( 10*keV), // initialization
HighestEnergyLimit( 10*TeV),
NumberOfBuildPhysicsTableCalls(0),
NumbBinTable(100)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
G4cout << "LowestEnergy: " << LowestEnergyLimit/keV << "keV ";
G4cout << "HighestEnergy: " << HighestEnergyLimit/TeV << "TeV " << G4endl;
}
theCrossSectionTable = NULL;
theMeanFreePathTable = NULL;
theMeanFreePathTable = NULL ;
theNlambdaTable = NULL;
theInverseNlambdaTable = NULL;
theCoeffATable = NULL ;
theCoeffBTable = NULL ;
theCoeffCTable = NULL ;
LowestKineticEnergy = LowestEnergyLimit ;
HighestKineticEnergy= HighestEnergyLimit;
TotBin = NumbBinTable ;
RTable = exp(log(HighestKineticEnergy/LowestKineticEnergy)/TotBin) ;
}
// destructor
G4IeplusAnnihilation::~G4IeplusAnnihilation()
{
if (theCrossSectionTable) {
theCrossSectionTable->clearAndDestroy();
delete theCrossSectionTable;
}
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy();
delete theMeanFreePathTable;
}
if (theNlambdaTable) {
theNlambdaTable->clearAndDestroy();
delete theNlambdaTable;
}
if (theInverseNlambdaTable) {
theInverseNlambdaTable->clearAndDestroy();
delete theInverseNlambdaTable;
}
if (theCoeffATable) {
theCoeffATable->clearAndDestroy();
delete theCoeffATable;
}
if (theCoeffBTable) {
theCoeffBTable->clearAndDestroy();
delete theCoeffBTable;
}
if (theCoeffCTable) {
theCoeffCTable->clearAndDestroy();
delete theCoeffCTable;
}
}
void G4IeplusAnnihilation::SetPhysicsTableBining(G4double lowE,
G4double highE, G4int nBins)
{
LowestEnergyLimit = lowE; HighestEnergyLimit = highE; NumbBinTable = nBins;
}
void G4IeplusAnnihilation::BuildPhysicsTable(const G4ParticleDefinition& PositronType)
// Build microscopic total cross section tables and mean free path table
{
NumberOfBuildPhysicsTableCalls += 1 ;
if(NumberOfBuildPhysicsTableCalls == 1)
{ ; }
else
{
G4double LowEdgeEnergy, Value;
G4PhysicsLogVector* ptrVector;
// Build microscopic cross section tables for the e+e- annihilation
if (theCrossSectionTable) {
theCrossSectionTable->clearAndDestroy(); delete theCrossSectionTable; }
theCrossSectionTable = new G4PhysicsTable( G4Element::GetNumberOfElements()) ;
const G4ElementTable* theElementTable = G4Element::GetElementTable() ;
G4double AtomicNumber;
G4int J;
for ( J=0 ; J < G4Element::GetNumberOfElements(); J++ )
{
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit,
NumbBinTable ) ;
AtomicNumber = (*theElementTable)(J)->GetZ();
for ( G4int i = 0 ; i < NumbBinTable ; i++ )
{
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
Value = ComputeMicroscopicCrossSection( LowEdgeEnergy, AtomicNumber);
ptrVector->PutValue( i , Value ) ;
}
theCrossSectionTable->insertAt( J , ptrVector ) ;
}
// Build mean free path table for the e+e- annihilation
if (theMeanFreePathTable) {
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable; }
theMeanFreePathTable = new G4PhysicsTable( G4Material::GetNumberOfMaterials() );
//*******************!!!!!!!!!!!!!!!!!!!!!!********************
theMeanFreePathTable = theMeanFreePathTable ;
//*******************!!!!!!!!!!!!!!!!!!!!!!********************
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
G4Material* material;
for ( J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
//create physics vector then fill it ....
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit,
NumbBinTable ) ;
material = (*theMaterialTable)(J);
for ( G4int i = 0 ; i < NumbBinTable ; i++ )
{
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
Value = ComputeMeanFreePath( LowEdgeEnergy, material);
ptrVector->PutValue( i , Value ) ;
theMeanFreePathTable->insertAt( J , ptrVector ) ;
}
}
const G4ParticleDefinition& aParticleType = PositronType ;
BuildNlambdaTable(aParticleType) ;
BuildCoeffATable(aParticleType) ;
BuildCoeffBTable(aParticleType) ;
BuildCoeffCTable(aParticleType) ;
BuildInverseNlambdaTable(aParticleType) ;
G4int printflag = 0 ;
if(printflag>0)
TestOfInversion(aParticleType,printflag) ;
NumberOfBuildPhysicsTableCalls = 0 ;
PrintInfoDefinition() ;
}
}
void G4IeplusAnnihilation::TestOfInversion(
const G4ParticleDefinition& aParticleType,
G4int printflag)
{
G4double T,Nlambda,Tprime,delta,del,sum,delmean,Tdelta ;
G4bool isOut ;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
G4cout.setf(G4std::ios::scientific, G4std::ios::floatfield) ;
if(printflag>1)
{
G4cout << G4endl;
G4cout << " particle=" << aParticleType.GetParticleName() << G4endl;
G4cout << "----------------------" << G4endl;
}
for (G4int J=0; J<numOfMaterials; J++)
{
if(printflag>1)
{
G4cout << G4endl;
G4cout << " material = " << (*theMaterialTable)[J]->GetName() << G4endl;
G4cout << " mat.ind.=" << J << " T Nlambda Tprime"
<< " (Tprime-T)/T(%)" << G4endl ;
}
G4PhysicsLogVector* aVector ;
aVector = new G4PhysicsLogVector(LowestKineticEnergy,
HighestKineticEnergy,TotBin) ;
delta = 0. ;
delmean = 0.;
sum = 0.;
Tdelta = 0. ;
for (G4int i=0; i<TotBin-1; i++)
{
T = aVector->GetLowEdgeEnergy(i) ;
Nlambda = (*theNlambdaTable)[J]->GetValue(T,isOut) ;
if(Nlambda>0.)
{
Tprime = (*theInverseNlambdaTable)[J]->GetValue(Nlambda,isOut) ;
if((Nlambda>0.)&&(i<(TotBin-1)))
{
del = 100.*(Tprime-T)/T ;
sum += 1.;
delmean += abs(del);
if(abs(del)>abs(delta))
{
delta = del ;
Tdelta = T ;
}
}
if(printflag>1)
{
G4cout << G4std::setw(18) << G4std::setprecision(6) << T << " " <<
G4std::setw(14)<< G4std::setprecision(6) << Nlambda << " " <<
G4std::setw(14) << G4std::setprecision(6) << Tprime << " " <<
G4std::setw(12) << G4std::setprecision(3) << del << G4endl;
}
}
}
if(printflag>0)
{
G4cout << G4endl;
G4cout << "G4IeplusAnnihilation::TestOfInversion (T->Nlambda->Tprime) " << G4endl
;
G4cout << "particle= " << aParticleType.GetParticleName() <<
" material= " << (*theMaterialTable)[J]->GetName() << G4endl ;
G4cout << "max (Tprime-T)/T in % =" << G4std::setw(10) << G4std::setprecision(3) << delta ;
G4cout << " at a kinetic energy " << G4std::setw(10) << G4std::setprecision(3) <<
Tdelta/MeV << " MeV" << G4endl;
delmean /= sum ;
G4cout << "mean rel.diff. (Tprime-T)/T=" << G4std::setw(10) <<
G4std::setprecision(3) << delmean <<
" % (mean is calculated in abs. value)" << G4endl;
G4cout << G4endl;
}
}
}
void G4IeplusAnnihilation::BuildNlambdaTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length() ;
if(theNlambdaTable)
{ theNlambdaTable->clearAndDestroy();
delete theNlambdaTable ; }
theNlambdaTable = new G4PhysicsTable(numOfMaterials) ;
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
G4PhysicsLogVector* aVector ;
aVector = new G4PhysicsLogVector(LowestKineticEnergy,
HighestKineticEnergy,TotBin) ;
BuildNlambdaVector(aParticleType,J,aVector) ;
theNlambdaTable->insert(aVector) ;
}
}
void G4IeplusAnnihilation::BuildNlambdaVector(
const G4ParticleDefinition& aParticleType,
G4int materialIndex,
G4PhysicsLogVector* nlambdaVector)
{
G4double LowEdgeEnergy,T,Tlast,dEdx,Value,Vlast,u,du,coeff,l ;
const G4int nbin = 20 ;
G4bool isOut ;
const G4double small = 1.e-100;
const G4double plowloss = 0.5 ; //this should be a data member of en.loss!
const G4double lmin=1.e-100,lmax=1.e100;
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
//first integral from 0. to LowestKineticEnergy
// here assumed that the threshold energy for the process >=
// LowestKineticEnergy
dEdx = G4EnergyLossTables::GetPreciseDEDX(&aParticleType,
LowestKineticEnergy,
(*theMaterialTable)[materialIndex]);
Value = LowestKineticEnergy/(dEdx*BIGSTEP*(1.-plowloss)) ;
if(Value<small)
Value = 0. ;
nlambdaVector->PutValue(0,Value) ;
Tlast = LowestKineticEnergy ;
Vlast = Value ;
// loop for kinetic energy
for (G4int i=1; i<TotBin; i++)
{
LowEdgeEnergy = nlambdaVector->GetLowEdgeEnergy(i) ;
u = log(LowEdgeEnergy/Tlast) ;
du = u/nbin ;
u = -du ;
Value = 0. ;
for(G4int n=0; n<=nbin; n++)
{
u += du ;
T = Tlast*exp(u) ;
if((n==0)||(n==nbin))
coeff=0.5 ;
else
coeff=1.0 ;
l = (*theMeanFreePathTable)[materialIndex]->GetValue(T,isOut);
if((l>lmin) && (l<lmax))
Value += coeff*T/(G4EnergyLossTables::GetPreciseDEDX(&aParticleType,
T,(*theMaterialTable)[materialIndex])*l);
}
Value *= du ;
Value += Vlast ;
if(Value<small)
Value = 0. ;
nlambdaVector->PutValue(i,Value) ;
Tlast = LowEdgeEnergy ;
Vlast = Value ;
}
}
void G4IeplusAnnihilation::BuildCoeffATable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "A"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffATable)
{ theCoeffATable->clearAndDestroy();
delete theCoeffATable; }
theCoeffATable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = RTable/w , w2 = -RTable*R1/w , w3 = R2/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create vector
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
// loop for kinetic energy
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if( i < (TotBin-1))
Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
else
{
Rip = Rip*Rip/Rim ;
Value = (w1*Rip + w2*Ri + w3*Rim)/(Ti*Ti) ;
}
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffATable->insert(aVector);
}
}
void G4IeplusAnnihilation::BuildCoeffBTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "B"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffBTable)
{ theCoeffBTable->clearAndDestroy();
delete theCoeffBTable; }
theCoeffBTable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = -R1/w , w2 = R1*(R2+1.)/w , w3 = -R2*R1/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create vector
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
// loop for kinetic energy
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if(i < (TotBin-1))
Value = (w1*Rip + w2*Ri + w3*Rim)/Ti;
else
{
Rip = Rip*Rip/Rim ;
Value = (w1*Rip + w2*Ri + w3*Rim)/Ti ;
}
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffBTable->insert(aVector);
}
}
void G4IeplusAnnihilation::BuildCoeffCTable(
const G4ParticleDefinition& aParticleType)
{
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
// create table for coefficients "C"
G4int numOfMaterials = theMaterialTable->length();
if(theCoeffCTable)
{ theCoeffCTable->clearAndDestroy();
delete theCoeffCTable; }
theCoeffCTable = new G4PhysicsTable(numOfMaterials);
G4double R2 = RTable*RTable ;
G4double R1 = RTable+1.;
G4double w = R1*(RTable-1.)*(RTable-1.);
G4double w1 = 1./w , w2 = -RTable*R1/w , w3 = RTable*R2/w ;
G4double Ti , Tim , Tip , Ri , Rim , Rip , Value ;
G4bool isOut;
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
// create vector
G4int binmax=TotBin ;
G4PhysicsLinearVector* aVector =
new G4PhysicsLinearVector(0.,binmax, TotBin);
// loop for kinetic energy
Ti = LowestKineticEnergy ;
G4PhysicsVector* lVector= (*theNlambdaTable)[J];
for ( G4int i=0; i<TotBin; i++)
{
Ri = lVector->GetValue(Ti,isOut) ;
if ( i==0 )
Rim = Ri/sqrt(RTable) ;
else
{
Tim = Ti/RTable ;
Rim = lVector->GetValue(Tim,isOut);
}
Tip = Ti*RTable ;
Rip = lVector->GetValue(Tip,isOut);
if(i < (TotBin-1))
Value = w1*Rip + w2*Ri + w3*Rim ;
else
{
Rip = Rip*Rip/Rim ;
Value = w1*Rip + w2*Ri + w3*Rim ;
}
aVector->PutValue(i,Value);
Ti = RTable*Ti ;
}
theCoeffCTable->insert(aVector);
}
}
void G4IeplusAnnihilation::BuildInverseNlambdaTable(
const G4ParticleDefinition& aParticleType)
{
G4double T,Smallest,Biggest,TT ;
const G4double small = 1.e-10;
G4bool isOut ;
// create table
const G4MaterialTable* theMaterialTable=
G4Material::GetMaterialTable();
G4int numOfMaterials = theMaterialTable->length();
if(theInverseNlambdaTable)
{ theInverseNlambdaTable->clearAndDestroy();
delete theInverseNlambdaTable; }
theInverseNlambdaTable = new G4PhysicsTable(numOfMaterials);
// loop for materials
for (G4int J=0; J<numOfMaterials; J++)
{
T = LowestKineticEnergy ;
do
{
Smallest = (*theNlambdaTable)[J]->
GetValue(T,isOut) ;
T *= RTable ;
} while (Smallest <= small) ;
Biggest = (*theNlambdaTable)[J]->
GetValue(HighestKineticEnergy,isOut) ;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Biggest *= 1.25 ;
// create vector
G4PhysicsLogVector* aVector;
aVector = new G4PhysicsLogVector(Smallest,
Biggest,TotBin);
// fill the vector
InvertNlambdaVector(aParticleType,J, aVector);
// insert vector to the table
theInverseNlambdaTable->insert(aVector);
}
}
void G4IeplusAnnihilation::InvertNlambdaVector(
const G4ParticleDefinition& aParticleType,
G4int materialIndex,
G4PhysicsLogVector* nlambdaVector)
{
G4double LowEdge,A,B,C,discr,KineticEnergy ;
G4double Tbin = LowestKineticEnergy/RTable ;
G4double bin = 0.0 ;
G4int binnumber = -1 ;
G4bool isOut ;
//loop for Nlambda values
for( G4int i=0; i<TotBin; i++)
{
LowEdge = nlambdaVector->GetLowEdgeEnergy(i) ; //i.e. GetLowEdgeValue(i)
if( bin < LowEdge )
{
do
{
binnumber += 1 ;
Tbin *= RTable ;
bin = (*theNlambdaTable)[materialIndex]->GetValue(Tbin,isOut) ;
}
while ((bin < LowEdge) && (binnumber < TotBin-2 )) ;
}
if(binnumber == 0)
KineticEnergy = LowestKineticEnergy ;
else if(binnumber == TotBin-1)
KineticEnergy = HighestKineticEnergy ;
else
{
A = (*(*theCoeffATable)(materialIndex))(binnumber-1) ;
B = (*(*theCoeffBTable)(materialIndex))(binnumber-1) ;
C = (*(*theCoeffCTable)(materialIndex))(binnumber-1) ;
if(A==0.)
KineticEnergy = (LowEdge -C )/B ;
else
{
discr = B*B - 4.*A*(C-LowEdge);
discr = discr>0. ? sqrt(discr) : 0.;
KineticEnergy = 0.5*(discr-B)/A ;
}
}
nlambdaVector->PutValue(i,KineticEnergy) ;
}
}
G4double G4IeplusAnnihilation::ComputeMicroscopicCrossSection
(G4double PositKinEnergy, G4double AtomicNumber)
// Calculates the microscopic cross section of annihilation into two photons
// from the Heilter formula.
// GEANT4 internal units.
{
static const G4double pi_rcl2 = pi*classic_electr_radius*classic_electr_radius;
G4double gama = 1. + PositKinEnergy/electron_mass_c2;
G4double gama2 = gama*gama, sqgama2 = sqrt(gama2-1.);
return pi_rcl2*AtomicNumber*((gama2+4*gama+1.)*log(gama+sqgama2) - (gama+3.)*sqgama2)
/((gama2-1.)*(gama+1.));
}
G4VParticleChange* G4IeplusAnnihilation::PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep)
//
// The secondaries Gamma energies are sampled using the Heitler cross section.
//
// A modified version of the random number techniques of Butcher & Messel is used
// (Nuc Phys 20(1960),15).
//
// GEANT4 internal units.
//
// Note 1 : The initial electron is assumed free and at rest.
//
// Note 2 : The annihilation processes producing one or more than two photons are
// ignored, as negligible compared to the two photons process.
{
aParticleChange.Initialize(aTrack);
G4Material* aMaterial = aTrack.GetMaterial();
const G4DynamicParticle* aDynamicPositron = aTrack.GetDynamicParticle();
G4double PositKinEnergy = aDynamicPositron->GetKineticEnergy();
G4ParticleMomentum PositDirection = aDynamicPositron->GetMomentumDirection();
aParticleChange.Initialize(aTrack);
// Do not make anything if PositKinEnergy=0. , the annihilation then
// should be performed by the AtRestDoIt!
if(PositKinEnergy == 0.)
return &aParticleChange ;
G4double gama = 1. + PositKinEnergy/electron_mass_c2;
G4double gamap1 = gama+1. , gamam1 = gama-1. , sqgrate = sqrt(gamam1/gamap1)/2. ,
sqg2m1 = sqrt(gamam1*gamap1);
// limits of the energy sampling
G4double epsil1 = 0.5 - sqgrate , epsil2 = 0.5 + sqgrate;
G4double epsilqot = epsil2/epsil1;
//
// sample the energy rate of the created gammas
//
G4double epsil, greject ;
do {
epsil = epsil1*pow(epsilqot,G4UniformRand());
greject = 1. - epsil + (2*gama*epsil-1.)/(epsil*gamap1*gamap1);
} while( greject < G4UniformRand() );
//
// scattered Gamma angles. ( Z - axis along the parent positron)
//
G4double cost = (epsil*gamap1-1.)/(epsil*sqg2m1) , sint = sqrt((1.+cost)*(1.-cost));
G4double phi = twopi * G4UniformRand() ;
G4double dirx = sint*cos(phi) , diry = sint*sin(phi) , dirz = cost;
//
// kinematic of the created pair
//
G4double LocalEnerDeposit = 0. ;
aParticleChange.SetNumberOfSecondaries(2) ;
G4double TotalAvailableEnergy = PositKinEnergy + 2*electron_mass_c2;
G4double Phot1Energy = epsil*TotalAvailableEnergy;
G4double GammaCut= (G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
if (Phot1Energy > GammaCut)
{
G4ThreeVector Phot1Direction ( dirx, diry, dirz );
Phot1Direction.rotateUz(PositDirection);
// create G4DynamicParticle object for the particle1
G4DynamicParticle* aParticle1= new G4DynamicParticle (G4Gamma::Gamma(),
Phot1Direction, Phot1Energy);
aParticleChange.AddSecondary( aParticle1 ) ;
}
else
{ LocalEnerDeposit += Phot1Energy; }
G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
if (Phot2Energy > GammaCut)
{
G4double Eratio = Phot1Energy/Phot2Energy;
G4double PositP = sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
G4ThreeVector Phot2Direction (-dirx*Eratio, -diry*Eratio,
(PositP-dirz*Phot1Energy)/Phot2Energy);
Phot2Direction.rotateUz(PositDirection);
// create G4DynamicParticle object for the particle2
G4DynamicParticle* aParticle2= new G4DynamicParticle (G4Gamma::Gamma(),
Phot2Direction, Phot2Energy);
aParticleChange.AddSecondary( aParticle2 ) ;
}
else
{ LocalEnerDeposit += Phot2Energy; }
aParticleChange.SetLocalEnergyDeposit( LocalEnerDeposit ) ;
//
// Kill the incident positron
//
aParticleChange.SetMomentumChange( 0., 0., 0. ) ;
aParticleChange.SetEnergyChange( 0. ) ;
aParticleChange.SetStatusChange( fStopAndKill ) ;
return &aParticleChange;
}
G4VParticleChange* G4IeplusAnnihilation::AtRestDoIt(const G4Track& aTrack,
const G4Step& aStep)
//
// Performs the e+ e- annihilation when both particles are assumed at rest.
// It generates two back to back photons with energy = electron_mass.
// The angular distribution is isotropic.
// GEANT4 internal units
//
// Note : Effects due to binding of atomic electrons are negliged.
{
aParticleChange.Initialize(aTrack);
G4Material* aMaterial = aTrack.GetMaterial();
aParticleChange.SetNumberOfSecondaries(2) ;
if (electron_mass_c2 > (G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()])
{
G4double cosTeta = 2*G4UniformRand()-1. , sinTeta = sqrt(1.-cosTeta*cosTeta);
G4double Phi = twopi * G4UniformRand() ;
G4ThreeVector Direction (sinTeta*cos(Phi), sinTeta*sin(Phi), cosTeta);
aParticleChange.AddSecondary( new G4DynamicParticle (G4Gamma::Gamma(),
Direction, electron_mass_c2) );
aParticleChange.AddSecondary( new G4DynamicParticle (G4Gamma::Gamma(),
-Direction, electron_mass_c2) );
aParticleChange.SetLocalEnergyDeposit(0.);
}
else
{ aParticleChange.SetLocalEnergyDeposit( 2*electron_mass_c2 ); }
// Kill the incident positron
//
aParticleChange.SetStatusChange( fStopAndKill );
return &aParticleChange;
}
void G4IeplusAnnihilation::PrintInfoDefinition()
{
G4String comments="Total cross section from Heitler formula (2 photon annihilation).\n";
comments += " gamma energies sampled according Heitler";
G4cout << G4endl << GetProcessName() << ": " << comments
<< "\n PhysicsTables from " << G4BestUnit(LowestEnergyLimit,"Energy")
<< " to " << G4BestUnit(HighestEnergyLimit,"Energy")
<< " in " << NumbBinTable << " bins. \n";
}
File diff suppressed because it is too large Load Diff
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PAIonisation.cc,v 1.13 2000/09/22 14:46:38 grichine Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PAIonisation.cc,v 1.14 2001/02/01 15:12:50 grichine Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// **************************************************************
@@ -489,15 +489,16 @@ G4VParticleChange* G4PAIonisation::AlongStepDoIt( const G4Track& trackData,
E = aParticle->GetKineticEnergy() ;
G4double mass = aParticle->GetDefinition()->GetPDGMass() ;
G4double gamma = 1.0 + E/mass ;
if( gamma < 1.2 ) return &aParticleChange ;
G4double Charge = aParticle->GetDefinition()->GetPDGCharge() ;
G4double Chargesquare = Charge*Charge ;
G4double MassRatio = proton_mass_c2/aParticle->GetDefinition()->GetPDGMass() ;
G4double MassRatio = proton_mass_c2/mass ;
ScaledE = E*MassRatio ;
ParticleCutInKineticEnergyNow =
(aParticle->GetDefinition()->GetEnergyCuts())[index] ;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PAIxSection.cc,v 1.4 1999/12/15 14:51:51 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4PAIxSection.cc -- class implementation file
@@ -5,21 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhotoElectricEffect.cc,v 1.11 2000/06/22 08:57:11 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PhotoElectricEffect.cc,v 1.12 2001/02/22 16:05:43 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4PhotoElectricEffect physics process --------
// by Michel Maire, April 1996
// **************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// 12-06-96, Added SelectRandomAtom() method, by M.Maire
// 21-06-96, SetCuts implementation, M.Maire
// 17-09-96, PartialSumSigma(i)
@@ -34,8 +24,11 @@
// 20-05-99, protection against very low energy photons ,L.Urban
// 08-06-99, removed this above protection from the DoIt. mma
// 21-06-00, in DoIt, killing photon: aParticleChange.SetEnergyChange(0.); mma
// 22-06-00, in DoIt, absorbe very low energy photon (back to 20-05-99); mma
// --------------------------------------------------------------
// 22-06-00, in DoIt, absorbe very low energy photon (back to 20-05-99); mma
// 22-02-01, back to 08-06-99 after correc in SandiaTable (materials-V03-00-05)
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4PhotoElectricEffect.hh"
#include "G4EnergyLossTables.hh"
@@ -244,10 +237,10 @@ G4VParticleChange* G4PhotoElectricEffect::PostStepDoIt(const G4Track& aTrack,
G4int NbOfShells = anElement->GetNbOfAtomicShells();
G4int i=0;
while ((i<NbOfShells)&&(PhotonEnergy<anElement->GetAtomicShell(i))) i++;
G4double BindingEnergy = 0.;
if (i<NbOfShells) BindingEnergy = anElement->GetAtomicShell(i);
if (i==NbOfShells) return G4VDiscreteProcess::PostStepDoIt(aTrack,aStep);
G4double ElecKineEnergy = PhotonEnergy - BindingEnergy;
G4double ElecKineEnergy = PhotonEnergy - anElement->GetAtomicShell(i);
if ((G4EnergyLossTables::GetRange(G4Electron::Electron(),
ElecKineEnergy,aMaterial)>aStep.GetPostStepPoint()->GetSafety())
||
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PolarizedComptonScattering.cc,v 1.4 2000/11/17 15:03:18 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//---------- G4PolarizedComptonScattering physics process -------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SynchrotronRadiation.cc,v 1.3 2000/11/01 15:30:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPAIenergyLoss.cc,v 1.1 2000/04/25 14:33:10 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// -----------------------------------------------------------
// GEANT 4 class implementation file
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VeEnergyLoss.cc,v 1.8 2000/10/30 07:01:09 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VeEnergyLoss.cc,v 1.11 2001/03/27 15:10:52 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// --------------------------------------------------------------
@@ -16,6 +16,8 @@
// 02/02/99 important correction in AlongStepDoIt , L.Urban
// 28/04/99 bug fixed (unit independece now),L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// 23/01/01 bug fixed in AlongStepDoIt , L.Urban
// 27/03/01 : commented out the printing of subcutoff energies
// --------------------------------------------------------------
@@ -99,6 +101,14 @@ void G4VeEnergyLoss::BuildDEDXTable(
LOGRTable=lrate/NbinEloss;
RTable =exp(LOGRTable);
//set physically consistent value for finalRange
// and parameters for en.loss step limit
if(finalRange > G4Electron::Electron()->GetCuts())
finalRange = G4Electron::Electron()->GetCuts() ;
c1lim = dRoverRange ;
c2lim = 2.*(1.-dRoverRange)*finalRange ;
c3lim = -(1.-dRoverRange)*finalRange*finalRange;
// Build energy loss table as a sum of the energy loss due to the
// different processes.
//
@@ -278,16 +288,16 @@ void G4VeEnergyLoss::BuildDEDXTable(
if(!setMinDeltaCutInRange )
MinDeltaCutInRange = G4Electron::Electron()->GetCuts()/10. ;
if((subSecFlag) && (&aParticleType==G4Electron::Electron()))
{
G4cout << G4endl;
G4cout.precision(5) ;
G4cout << " eIoni Minimum Delta cut in range=" << MinDeltaCutInRange/mm
<< " mm." << G4endl;
G4cout << G4endl;
G4cout << " material min.delta energy(keV) " << G4endl;
G4cout << G4endl;
}
// if((subSecFlag) && (&aParticleType==G4Electron::Electron()))
// {
// G4cout << G4endl;
// G4cout.precision(5) ;
// G4cout << " eIoni Minimum Delta cut in range=" << MinDeltaCutInRange/mm
// << " mm." << G4endl;
// G4cout << G4endl;
// G4cout << " material min.delta energy(keV) " << G4endl;
// G4cout << G4endl;
// }
if(MinDeltaEnergy) delete MinDeltaEnergy ;
MinDeltaEnergy = new G4double [numOfMaterials] ;
@@ -307,15 +317,15 @@ void G4VeEnergyLoss::BuildDEDXTable(
if(MinDeltaEnergy[mat]>G4Electron::Electron()->GetCutsInEnergy()[mat])
MinDeltaEnergy[mat]=G4Electron::Electron()->GetCutsInEnergy()[mat] ;
if((subSecFlag) && (&aParticleType==G4Electron::Electron()))
{
G4cout << G4std::setw(20) << (*theMaterialTable)(mat)->GetName()
<< G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
if(LowerLimitForced[mat])
G4cout << " lower limit forced." << G4endl;
else
G4cout << G4endl ;
}
// if((subSecFlag) && (&aParticleType==G4Electron::Electron()))
// {
// G4cout << G4std::setw(20) << (*theMaterialTable)(mat)->GetName()
// << G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
// if(LowerLimitForced[mat])
// G4cout << " lower limit forced." << G4endl;
// else
// G4cout << G4endl ;
// }
}
}
@@ -370,7 +380,7 @@ G4VParticleChange* G4VeEnergyLoss::AlongStepDoIt( const G4Track& trackData,
if(finalT < MinKineticEnergy) finalT = 0. ;
MeanLoss = E - finalT ;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// start of subcutoff generation
@@ -466,7 +476,7 @@ G4VParticleChange* G4VeEnergyLoss::AlongStepDoIt( const G4Track& trackData,
N = Ndeltamax ;
G4double Px,Py,Pz ;
G4ThreeVector ParticleDirection ;
ParticleDirection=stepData.GetPostStepPoint()->
ParticleDirection=stepData.GetPreStepPoint()->
GetMomentumDirection() ;
Px =ParticleDirection.x() ;
Py =ParticleDirection.y() ;
@@ -524,8 +534,6 @@ G4VParticleChange* G4VeEnergyLoss::AlongStepDoIt( const G4Track& trackData,
zd=z1+frperstep*dz*urandom ;
G4ThreeVector DeltaPosition(xd,yd,zd) ;
DeltaTime=time0+frperstep*dTime*urandom ;
ParticleDirection=stepData.GetPostStepPoint()->
GetMomentumDirection() ;
G4ThreeVector DeltaDirection(dirx,diry,dirz) ;
DeltaDirection.rotateUz(ParticleDirection);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VhEnergyLoss.cc,v 1.13 2000/10/30 07:01:09 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VhEnergyLoss.cc,v 1.16 2001/03/27 15:10:52 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// -----------------------------------------------------------
@@ -23,6 +23,8 @@
// energy losses of ions
// 17/08/00 : V.Ivanchenko change EnergyLossFluctuation
// 18/08/00 : V.Ivanchenko bug fixed in GetConstrained
// 23/01/01 : bug fixed in AlongStepDoIt , L.Urban
// 27/03/01 : commented out the printing of subcutoff energies
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -117,6 +119,14 @@ void G4VhEnergyLoss::BuildDEDXTable(
LOGRTable=lrate/NbinEloss;
RTable =exp(LOGRTable);
//set physically consistent value for finalRange
// and parameters for en.loss step limit
if(finalRange > G4Electron::Electron()->GetCuts())
finalRange = G4Electron::Electron()->GetCuts() ;
c1lim = dRoverRange ;
c2lim = 2.*(1.-dRoverRange)*finalRange ;
c3lim = -(1.-dRoverRange)*finalRange*finalRange;
// create table if there is no table or there is a new cut value
G4bool MakeTable = false ;
@@ -315,16 +325,16 @@ void G4VhEnergyLoss::BuildDEDXTable(
if(!setMinDeltaCutInRange)
MinDeltaCutInRange = G4Electron::Electron()->GetCuts()/10.;
if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
{
G4cout << G4endl;
G4cout.precision(5) ;
G4cout << " hIoni Minimum Delta cut in range=" << MinDeltaCutInRange/mm
<< " mm." << G4endl;
G4cout << G4endl;
G4cout << " material min.delta energy(keV) " << G4endl;
G4cout << G4endl;
}
// if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
// {
// G4cout << G4endl;
// G4cout.precision(5) ;
// G4cout << " hIoni Minimum Delta cut in range=" << MinDeltaCutInRange/mm
// << " mm." << G4endl;
// G4cout << G4endl;
// G4cout << " material min.delta energy(keV) " << G4endl;
// G4cout << G4endl;
// }
if(MinDeltaEnergy) delete MinDeltaEnergy ;
MinDeltaEnergy = new G4double [numOfMaterials] ;
@@ -343,15 +353,15 @@ void G4VhEnergyLoss::BuildDEDXTable(
if(MinDeltaEnergy[mat]>G4Electron::Electron()->GetCutsInEnergy()[mat])
MinDeltaEnergy[mat]=G4Electron::Electron()->GetCutsInEnergy()[mat] ;
if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
{
G4cout << G4std::setw(20) << (*theMaterialTable)(mat)->GetName()
<< G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
if(LowerLimitForced[mat])
G4cout << " lower limit forced." << G4endl;
else
G4cout << G4endl ;
}
// if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
// {
// G4cout << G4std::setw(20) << (*theMaterialTable)(mat)->GetName()
// << G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
// if(LowerLimitForced[mat])
// G4cout << " lower limit forced." << G4endl;
// else
// G4cout << G4endl ;
// }
}
}
@@ -570,12 +580,12 @@ G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
G4double Px,Py,Pz ;
G4ThreeVector ParticleDirection ;
ParticleDirection=stepData.GetPostStepPoint()->
ParticleDirection=aParticle->
GetMomentumDirection() ;
Px =ParticleDirection.x() ;
Py =ParticleDirection.y() ;
Pz =ParticleDirection.z() ;
G4int subdelta = 0;
if(N > 0)
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4eBremsstrahlung.cc,v 1.13 2000/09/21 09:34:29 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4eBremsstrahlung.cc,v 1.15 2001/02/05 17:53:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
@@ -265,40 +265,13 @@ void G4eBremsstrahlung::BuildLossTable(const G4ParticleDefinition& aParticleType
}
theLossTable->insert(aVector);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eBremsstrahlung::ComputeXYPolynomial(G4double x, G4double y,
G4int xSize, G4int ySize,
const G4double coeff[])
{
// Computes the polynomial (1 y y^2 ...) * matrix * (1 x x^2 ...) .
// xSize and ySize are the dimensions of the matrix,
// coeff containts the elements, stored row-wise.
G4double* a= new G4double[xSize];
G4int i, j;
for (i=0; i<xSize; i++) a[i]= 0.0;
G4int index= 0; G4double yy= 1.0;
for (j=0; j<ySize; j++)
{ for (i=0; i<xSize; i++) a[i]+= coeff[index++]*yy;
yy*= y;
}
G4double r= a[0]; G4double xx= x;
for (i=1; i<xSize; i++) { r+= a[i]*xx; xx*= x;}
delete[] a;
return r;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eBremsstrahlung::ComputeBremLoss(G4double Z,G4double natom,
G4double T,G4double Cut,G4double x)
@@ -354,6 +327,9 @@ G4double G4eBremsstrahlung::ComputeBremLoss(G4double Z,G4double natom,
0.00017519
} ;
static G4double aaa=0.414 ;
static G4double bbb=0.345 ;
static G4double ccc=0.460 ;
G4int iz = 0 ;
G4double delz = 1.e6 ;
@@ -390,6 +366,9 @@ G4double G4eBremsstrahlung::ComputeBremLoss(G4double Z,G4double natom,
if(T <= Cut)
loss *= exp(alosslow*log(T/Cut)) ;
// correction ................................
loss *= (aaa+bbb*T/Tlim)/(1.+ccc*T/Tlim) ;
loss *= fl ;
loss /= Avogadro ;
@@ -438,7 +417,9 @@ void G4eBremsstrahlung::BuildLambdaTable(const G4ParticleDefinition& ParticleTyp
}
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
PartialSumSigma.clearAndDestroy();
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
@@ -694,7 +675,8 @@ void G4eBremsstrahlung::ComputePartialSumSigma(const G4ParticleDefinition* Parti
const G4double* theAtomNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4double GammaEnergyCut = (G4Gamma::GetCutsInEnergy())[Imate];
PartialSumSigma(Imate) = new G4ValVector(NbOfElements);
PartialSumSigma[Imate] = new G4DataVector();
G4double SIGMA = 0. ;
@@ -704,7 +686,7 @@ void G4eBremsstrahlung::ComputePartialSumSigma(const G4ParticleDefinition* Parti
ComputeMicroscopicCrossSection( ParticleType, KineticEnergy,
(*theElementVector)(Ielem)->GetZ(),
GammaEnergyCut );
PartialSumSigma(Imate)->insertAt(Ielem, SIGMA);
PartialSumSigma[Imate]->push_back(SIGMA);
}
}
@@ -956,9 +938,9 @@ G4Element* G4eBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
const G4int NumberOfElements = aMaterial->GetNumberOfElements();
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
G4double rval = G4UniformRand()*((*PartialSumSigma(Index))(NumberOfElements-1));
G4double rval = G4UniformRand()*((*PartialSumSigma[Index])[NumberOfElements-1]);
for ( G4int i=0; i < NumberOfElements; i++ )
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
if (rval <= (*PartialSumSigma[Index])[i]) return ((*theElementVector)(i));
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << G4endl;
return NULL;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4eIonisation.cc,v 1.10 2000/05/23 14:42:21 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// -------------------------------------------------------------
@@ -5,26 +5,19 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4eplusAnnihilation.cc,v 1.2 1999/12/15 14:51:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4eplusAnnihilation.cc,v 1.3 2001/02/22 18:26:09 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// ------------ G4eplusAnnihilation process --------
// by Michel Maire, 7 July 1996
// **************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// 10-01-97, crossection table + mean free path table, M.Maire
// 17-03-97, merge 'in fly' and 'at rest', M.Maire
// 23-03-97, protection in BuildPhysicsTable, M.Maire
// 31-08-98, new methods SetBining() and PrintInfo()
// --------------------------------------------------------------
// 22-02-01, postStepDoIt: fStopButAlive instead of kineEnergy == 0.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4eplusAnnihilation.hh"
#include "G4UnitsTable.hh"
@@ -182,13 +175,13 @@ G4VParticleChange* G4eplusAnnihilation::PostStepDoIt(const G4Track& aTrack,
aParticleChange.Initialize(aTrack);
// Do not make anything if PositKinEnergy=0. , the annihilation then
// Do not make anything if particle is stopped, the annihilation then
// should be performed by the AtRestDoIt!
if (PositKinEnergy == 0.) return &aParticleChange;
if (aTrack.GetTrackStatus() == fStopButAlive) return &aParticleChange;
G4double gama = 1. + PositKinEnergy/electron_mass_c2;
G4double gamap1 = gama+1. , gamam1 = gama-1. , sqgrate = sqrt(gamam1/gamap1)/2. ,
sqg2m1 = sqrt(gamam1*gamap1);
G4double gamam1 = PositKinEnergy/electron_mass_c2;
G4double gama = gamam1+1. , gamap1 = gamam1+2. , sqgrate = sqrt(gamam1/gamap1)/2. ,
sqg2m1 = sqrt(gamam1*gamap1);
// limits of the energy sampling
G4double epsilmin = 0.5 - sqgrate , epsilmax = 0.5 + sqgrate;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4hIonisation.cc,v 1.12 2000/08/10 22:13:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// -------------------------------------------------------------
// GEANT 4 class implementation file