Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,14 +21,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ComptonScattering.cc,v 1.5.2.1 2001/06/28 19:12:36 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4ComptonScattering.cc,v 1.14 2001/10/01 15:00:29 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
//------------ G4ComptonScattering physics process --------
|
||||
//------------ G4ComptonScattering physics process -----------------------------
|
||||
// by Michel Maire, April 1996
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// 28-05-96, DoIt() small change in ElecDirection, by M.Maire
|
||||
// 10-06-96, simplification in ComputeMicroscopicCrossSection(), by M.Maire
|
||||
// 21-06-96, SetCuts implementation, M.Maire
|
||||
@@ -37,17 +36,23 @@
|
||||
// 05-03-97, new Physics scheme, M.Maire
|
||||
// 28-03-97, protection in BuildPhysicsTable, M.Maire
|
||||
// 07-04-98, remove 'tracking cut' of the scattered gamma, MMa
|
||||
// 04-06-98, in DoIt, secondary production condition: range>G4std::min(threshold,safety)
|
||||
// 04-06-98, in DoIt, secondary production condition:
|
||||
// range>G4std::min(threshold,safety)
|
||||
// 13-08-98, new methods SetBining() PrintInfo()
|
||||
// 15-12-98, cross section=0 below 10 keV
|
||||
// 28-05-01, V.Ivanchenko minor changes to provide ANSI -wall compilation
|
||||
// --------------------------------------------------------------
|
||||
// 28-05-01, V.Ivanchenko minor changes to provide ANSI -wall compilation
|
||||
// 13-07-01, DoIt: suppression of production cut for the electron (mma)
|
||||
// 03-08-01, new methods Store/Retrieve PhysicsTable (mma)
|
||||
// 06-08-01, BuildThePhysicsTable() called from constructor (mma)
|
||||
// 17-09-01, migration of Materials to pure STL (mma)
|
||||
// 20-09-01, DoIt: fminimalEnergy = 1*eV (mma)
|
||||
// 01-10-01, come back to BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// constructor
|
||||
|
||||
@@ -55,12 +60,13 @@ G4ComptonScattering::G4ComptonScattering(const G4String& processName)
|
||||
: G4VDiscreteProcess (processName),
|
||||
theCrossSectionTable(NULL),
|
||||
theMeanFreePathTable(NULL),
|
||||
LowestEnergyLimit ( 10*keV), // initialization
|
||||
LowestEnergyLimit ( 10*keV),
|
||||
HighestEnergyLimit(100*GeV),
|
||||
NumbBinTable(100)
|
||||
{ }
|
||||
NumbBinTable(100),
|
||||
fminimalEnergy(1*eV)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// destructor
|
||||
|
||||
@@ -77,44 +83,44 @@ G4ComptonScattering::~G4ComptonScattering()
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4ComptonScattering::SetPhysicsTableBining(G4double lowE, G4double highE, G4int nBins)
|
||||
void G4ComptonScattering::SetPhysicsTableBining(
|
||||
G4double lowE, G4double highE, G4int nBins)
|
||||
{
|
||||
LowestEnergyLimit = lowE; HighestEnergyLimit = highE; NumbBinTable = nBins;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4ComptonScattering::BuildPhysicsTable(const G4ParticleDefinition& GammaType)
|
||||
|
||||
// Build microscopic cross section table and mean free path table
|
||||
void G4ComptonScattering::BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
// Build cross section and mean free path tables
|
||||
{
|
||||
G4double LowEdgeEnergy, Value;
|
||||
G4PhysicsLogVector* ptrVector;
|
||||
|
||||
// Build microscopic cross section tables for the Compton Scattering process
|
||||
// Build cross section per atom tables for the Compton Scattering process
|
||||
|
||||
if (theCrossSectionTable) {
|
||||
theCrossSectionTable->clearAndDestroy(); delete theCrossSectionTable; }
|
||||
theCrossSectionTable->clearAndDestroy(); delete theCrossSectionTable;}
|
||||
|
||||
theCrossSectionTable = new G4PhysicsTable(G4Element::GetNumberOfElements()) ;
|
||||
const G4ElementTable* theElementTable = G4Element::GetElementTable() ;
|
||||
theCrossSectionTable = new G4PhysicsTable(G4Element::GetNumberOfElements());
|
||||
const G4ElementTable* theElementTable = G4Element::GetElementTable();
|
||||
G4double AtomicNumber;
|
||||
size_t J;
|
||||
|
||||
for ( J=0 ; J < G4Element::GetNumberOfElements(); J++ )
|
||||
{
|
||||
//create physics vector then fill it ....
|
||||
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit, HighestEnergyLimit,
|
||||
NumbBinTable ) ;
|
||||
AtomicNumber = (*theElementTable)(J)->GetZ();
|
||||
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit,HighestEnergyLimit,
|
||||
NumbBinTable );
|
||||
AtomicNumber = (*theElementTable)[J]->GetZ();
|
||||
|
||||
for ( G4int i = 0 ; i < NumbBinTable ; i++ )
|
||||
{
|
||||
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy( i ) ;
|
||||
Value = ComputeCrossSectionPerAtom( LowEdgeEnergy, AtomicNumber);
|
||||
ptrVector->PutValue( i , Value ) ;
|
||||
LowEdgeEnergy = ptrVector->GetLowEdgeEnergy(i);
|
||||
Value = ComputeCrossSectionPerAtom(LowEdgeEnergy, AtomicNumber);
|
||||
ptrVector->PutValue(i,Value);
|
||||
}
|
||||
|
||||
theCrossSectionTable->insertAt( J , ptrVector ) ;
|
||||
@@ -124,18 +130,18 @@ void G4ComptonScattering::BuildPhysicsTable(const G4ParticleDefinition& GammaTyp
|
||||
// Build mean free path table for the Compton Scattering process
|
||||
|
||||
if (theMeanFreePathTable) {
|
||||
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable; }
|
||||
theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
|
||||
|
||||
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable() ;
|
||||
theMeanFreePathTable= new G4PhysicsTable(G4Material::GetNumberOfMaterials());
|
||||
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,
|
||||
ptrVector = new G4PhysicsLogVector(LowestEnergyLimit,HighestEnergyLimit,
|
||||
NumbBinTable ) ;
|
||||
material = (*theMaterialTable)(J);
|
||||
material = (*theMaterialTable)[J];
|
||||
|
||||
for ( G4int i = 0 ; i < NumbBinTable ; i++ )
|
||||
{
|
||||
@@ -151,13 +157,14 @@ void G4ComptonScattering::BuildPhysicsTable(const G4ParticleDefinition& GammaTyp
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4ComptonScattering::ComputeCrossSectionPerAtom
|
||||
(G4double GammaEnergy, G4double Z)
|
||||
|
||||
// Calculates the microscopic cross section in GEANT4 internal units.
|
||||
// A parametrized formula from L. Urban is used to estimate the total cross section.
|
||||
// Calculates the cross section per atom in GEANT4 internal units.
|
||||
// A parametrized formula from L. Urban is used to estimate
|
||||
// the total cross section.
|
||||
// It gives a good description of the data from 10 keV to 100/Z GeV.
|
||||
|
||||
{
|
||||
@@ -166,12 +173,12 @@ G4double G4ComptonScattering::ComputeCrossSectionPerAtom
|
||||
if ( GammaEnergy < 10.*keV ) return CrossSection;
|
||||
if ( GammaEnergy > (100.*GeV/Z) ) return CrossSection;
|
||||
|
||||
static const G4double a = 20.0 , b = 230.0 , c = 440.0 ;
|
||||
static const G4double a = 20.0 , b = 230.0 , c = 440.0;
|
||||
|
||||
static const G4double
|
||||
d1= 2.7965e-1*barn, d2=-1.8300e-1*barn, d3= 6.7527 *barn, d4=-1.9798e+1*barn,
|
||||
e1= 1.9756e-5*barn, e2=-1.0205e-2*barn, e3=-7.3913e-2*barn, e4= 2.7079e-2*barn,
|
||||
f1=-3.9178e-7*barn, f2= 6.8241e-5*barn, f3= 6.0480e-5*barn, f4= 3.0274e-4*barn;
|
||||
d1= 2.7965e-1*barn, d2=-1.8300e-1*barn, d3= 6.7527 *barn, d4=-1.9798e+1*barn,
|
||||
e1= 1.9756e-5*barn, e2=-1.0205e-2*barn, e3=-7.3913e-2*barn, e4= 2.7079e-2*barn,
|
||||
f1=-3.9178e-7*barn, f2= 6.8241e-5*barn, f3= 6.0480e-5*barn, f4= 3.0274e-4*barn;
|
||||
|
||||
G4double p1Z = Z*(d1 + e1*Z + f1*Z*Z), p2Z = Z*(d2 + e2*Z + f2*Z*Z),
|
||||
p3Z = Z*(d3 + e3*Z + f3*Z*Z), p4Z = Z*(d4 + e4*Z + f4*Z*Z);
|
||||
@@ -182,20 +189,20 @@ G4double G4ComptonScattering::ComputeCrossSectionPerAtom
|
||||
+ (p2Z + p3Z*X + p4Z*X*X)/(1. + a*X + b*X*X + c*X*X*X);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep)
|
||||
//
|
||||
// The scattered gamma energy is sampled according to Klein - Nishina formula.
|
||||
// The random number techniques of Butcher & Messel are used (Nuc Phys 20(1960),15).
|
||||
// The random number techniques of Butcher & Messel are used
|
||||
// (Nuc Phys 20(1960),15).
|
||||
// GEANT4 internal units
|
||||
//
|
||||
// Note : Effects due to binding of atomic electrons are negliged.
|
||||
|
||||
{
|
||||
aParticleChange.Initialize(aTrack);
|
||||
G4Material* aMaterial = aTrack.GetMaterial();
|
||||
|
||||
const G4DynamicParticle* aDynamicGamma = aTrack.GetDynamicParticle();
|
||||
G4double GammaEnergy0 = aDynamicGamma->GetKineticEnergy();
|
||||
@@ -203,7 +210,6 @@ G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
|
||||
G4ParticleMomentum GammaDirection0 = aDynamicGamma->GetMomentumDirection();
|
||||
|
||||
|
||||
//
|
||||
// sample the energy rate of the scattered gamma
|
||||
//
|
||||
@@ -215,7 +221,7 @@ G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
|
||||
do {
|
||||
if ( alpha1/(alpha1+alpha2) > G4UniformRand() )
|
||||
{ epsilon = exp(-alpha1*G4UniformRand()); // pow(epsilon0,G4UniformRand())
|
||||
{ epsilon = exp(-alpha1*G4UniformRand()); // epsilon0**r
|
||||
epsilonsq = epsilon*epsilon; }
|
||||
else {
|
||||
epsilonsq = epsilon0sq + (1.- epsilon0sq)*G4UniformRand();
|
||||
@@ -231,8 +237,8 @@ G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
//
|
||||
|
||||
G4double cosTeta = 1. - onecost , sinTeta = sqrt (sint2);
|
||||
G4double Phi = twopi * G4UniformRand() ;
|
||||
G4double dirx = sinTeta*cos(Phi) , diry = sinTeta*sin(Phi) , dirz = cosTeta ;
|
||||
G4double Phi = twopi * G4UniformRand();
|
||||
G4double dirx = sinTeta*cos(Phi), diry = sinTeta*sin(Phi), dirz = cosTeta;
|
||||
|
||||
//
|
||||
// update G4VParticleChange for the scattered gamma
|
||||
@@ -240,14 +246,17 @@ G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
|
||||
G4ThreeVector GammaDirection1 ( dirx,diry,dirz );
|
||||
GammaDirection1.rotateUz(GammaDirection0);
|
||||
aParticleChange.SetMomentumChange( GammaDirection1 ) ;
|
||||
aParticleChange.SetMomentumChange( GammaDirection1 );
|
||||
G4double GammaEnergy1 = epsilon*GammaEnergy0;
|
||||
if (GammaEnergy1 > 0.)
|
||||
G4double localEnergyDeposit = 0.;
|
||||
|
||||
if (GammaEnergy1 > fminimalEnergy)
|
||||
{
|
||||
aParticleChange.SetEnergyChange( GammaEnergy1 ) ;
|
||||
aParticleChange.SetEnergyChange( GammaEnergy1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
localEnergyDeposit += GammaEnergy1;
|
||||
aParticleChange.SetEnergyChange(0.) ;
|
||||
aParticleChange.SetStatusChange(fStopAndKill);
|
||||
}
|
||||
@@ -256,50 +265,119 @@ G4VParticleChange* G4ComptonScattering::PostStepDoIt(const G4Track& aTrack,
|
||||
// kinematic of the scattered electron
|
||||
//
|
||||
|
||||
G4double ElecKineEnergy = GammaEnergy0 - GammaEnergy1 ;
|
||||
|
||||
// condition changed!
|
||||
if((G4EnergyLossTables::GetRange(G4Electron::Electron(),
|
||||
ElecKineEnergy,aMaterial)>aStep.GetPostStepPoint()->GetSafety())
|
||||
||
|
||||
(ElecKineEnergy >
|
||||
(G4Electron::Electron()->GetCutsInEnergy())[aMaterial->GetIndex()]))
|
||||
G4double ElecKineEnergy = GammaEnergy0 - GammaEnergy1;
|
||||
|
||||
if (ElecKineEnergy > fminimalEnergy)
|
||||
{
|
||||
G4double ElecMomentum = sqrt(ElecKineEnergy*(ElecKineEnergy+2.*electron_mass_c2));
|
||||
G4double ElecMomentum = sqrt(ElecKineEnergy*
|
||||
(ElecKineEnergy+2.*electron_mass_c2));
|
||||
G4ThreeVector ElecDirection (
|
||||
(GammaEnergy0*GammaDirection0 - GammaEnergy1*GammaDirection1)*(1./ElecMomentum) );
|
||||
(GammaEnergy0*GammaDirection0 - GammaEnergy1*GammaDirection1)
|
||||
*(1./ElecMomentum) );
|
||||
|
||||
// create G4DynamicParticle object for the electron.
|
||||
G4DynamicParticle* aElectron= new G4DynamicParticle (G4Electron::Electron(),
|
||||
ElecDirection, ElecKineEnergy) ;
|
||||
G4DynamicParticle* aElectron= new G4DynamicParticle(
|
||||
G4Electron::Electron(),ElecDirection,ElecKineEnergy);
|
||||
|
||||
aParticleChange.SetNumberOfSecondaries(1) ;
|
||||
aParticleChange.AddSecondary( aElectron ) ;
|
||||
aParticleChange.SetLocalEnergyDeposit (0.) ;
|
||||
|
||||
}
|
||||
aParticleChange.SetNumberOfSecondaries(1);
|
||||
aParticleChange.AddSecondary( aElectron );
|
||||
}
|
||||
else
|
||||
{
|
||||
aParticleChange.SetNumberOfSecondaries(0) ;
|
||||
aParticleChange.SetLocalEnergyDeposit (ElecKineEnergy) ;
|
||||
}
|
||||
|
||||
{
|
||||
aParticleChange.SetNumberOfSecondaries(0);
|
||||
localEnergyDeposit += ElecKineEnergy;
|
||||
}
|
||||
aParticleChange.SetLocalEnergyDeposit (localEnergyDeposit);
|
||||
|
||||
// Reset NbOfInteractionLengthLeft and return aParticleChange
|
||||
return G4VDiscreteProcess::PostStepDoIt( aTrack, aStep);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4ComptonScattering::StorePhysicsTable(G4ParticleDefinition* particle,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
G4String filename;
|
||||
|
||||
// store cross section table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"CrossSection",ascii);
|
||||
if ( !theCrossSectionTable->StorePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theCrossSectionTable->StorePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// store mean free path table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
|
||||
if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
G4cout << GetProcessName() << " for " << particle->GetParticleName()
|
||||
<< ": Success to store the PhysicsTables in "
|
||||
<< directory << G4endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4ComptonScattering::RetrievePhysicsTable(G4ParticleDefinition* particle,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
// delete theCrossSectionTable and theMeanFreePathTable
|
||||
if (theCrossSectionTable != 0) {
|
||||
theCrossSectionTable->clearAndDestroy();
|
||||
delete theCrossSectionTable;
|
||||
}
|
||||
if (theMeanFreePathTable != 0) {
|
||||
theMeanFreePathTable->clearAndDestroy();
|
||||
delete theMeanFreePathTable;
|
||||
}
|
||||
|
||||
G4String filename;
|
||||
|
||||
// retreive cross section table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"CrossSection",ascii);
|
||||
theCrossSectionTable = new G4PhysicsTable(G4Element::GetNumberOfElements());
|
||||
if ( !theCrossSectionTable->RetrievePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theCrossSectionTable->RetrievePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// retreive mean free path table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
|
||||
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
|
||||
if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
G4cout << GetProcessName() << " for " << particle->GetParticleName()
|
||||
<< ": Success to retrieve the PhysicsTables from "
|
||||
<< directory << G4endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4ComptonScattering::PrintInfoDefinition()
|
||||
{
|
||||
G4String comments = "Total cross sections from a parametrisation. ";
|
||||
comments += "Good description from 10 KeV to (100/Z) GeV. \n";
|
||||
comments += " Scattered gamma energy according Klein-Nishina.";
|
||||
comments += " Scattered gamma energy according Klein-Nishina.";
|
||||
|
||||
G4cout << G4endl << GetProcessName() << ": " << comments
|
||||
<< "\n PhysicsTables from " << G4BestUnit(LowestEnergyLimit,"Energy")
|
||||
<< "\n PhysicsTables from "
|
||||
<< G4BestUnit(LowestEnergyLimit,"Energy")
|
||||
<< " to " << G4BestUnit(HighestEnergyLimit,"Energy")
|
||||
<< " in " << NumbBinTable << " bins. \n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user