Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuBremsstrahlung.cc,v 2.2 1998/12/09 09:20:44 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuBremsstrahlung.cc,v 1.2 1999/05/04 14:24:21 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -821,6 +821,8 @@ void G4IMuBremsstrahlung::BuildLambdaTable(const G4ParticleDefinition& ParticleT
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuEnergyLoss.cc,v 2.2 1998/12/09 09:20:44 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuEnergyLoss.cc,v 1.1 1999/01/07 16:11:06 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuIonisation.cc,v 2.2 1998/12/09 09:20:45 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuIonisation.cc,v 1.2 1999/04/13 09:09:42 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -1031,16 +1031,17 @@ G4VParticleChange* G4IMuIonisation::PostStepDoIt(
finalKineticEnergy = KineticEnergy - DeltaKineticEnergy ;
if (finalKineticEnergy > 0. )
{
// changed energy and momentum of the actual particle
finalMomentum=sqrt(finalKineticEnergy*
(finalKineticEnergy+2.*ParticleMass)) ;
finalPx = (TotalMomentum*ParticleDirection.x()
-DeltaTotalMomentum*DeltaDirection.x())/finalMomentum ;
finalPy = (TotalMomentum*ParticleDirection.y()
-DeltaTotalMomentum*DeltaDirection.y())/finalMomentum ;
finalPz = (TotalMomentum*ParticleDirection.z()
-DeltaTotalMomentum*DeltaDirection.z())/finalMomentum ;
finalPx = TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x();
finalPy = TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y();
finalPz = TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z();
finalMomentum =
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
finalPx /= finalMomentum ;
finalPy /= finalMomentum ;
finalPz /= finalMomentum ;
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IMuPairProduction.cc,v 2.3 1998/12/09 09:20:47 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IMuPairProduction.cc,v 1.2 1999/05/04 14:24:23 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -809,6 +809,8 @@ void G4IMuPairProduction::BuildLambdaTable(const G4ParticleDefinition& ParticleT
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
if(&ParticleType == theMuonPlus )
themuplusLambdaTable = theMeanFreePathTable ;
if(&ParticleType == theMuonMinus )
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuBremsstrahlung.cc,v 2.6 1998/11/13 13:38:35 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuBremsstrahlung.cc,v 1.5 1999/06/14 13:26:30 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -43,10 +43,7 @@ G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& processName)
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(100),
theGamma (G4Gamma::Gamma() ),
theMuonMinus ( G4MuonMinus::MuonMinus() ),
theMuonPlus ( G4MuonPlus::MuonPlus() )
TotBin(100)
{ }
G4MuBremsstrahlung::~G4MuBremsstrahlung()
@@ -85,7 +82,9 @@ void G4MuBremsstrahlung::BuildPhysicsTable(
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
BuildLambdaTable(aParticleType) ;
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
if(gammaCutInRange != lastgammaCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
@@ -103,7 +102,7 @@ void G4MuBremsstrahlung::BuildLossTable(
const G4MaterialTable* theMaterialTable =
G4Material::GetMaterialTable();
ParticleMass = aParticleType.GetPDGMass();
GammaCutInKineticEnergy = (*theGamma).GetEnergyCuts() ;
GammaCutInKineticEnergy = G4Gamma::Gamma()->GetEnergyCuts() ;
G4int numOfMaterials = theMaterialTable->length() ;
@@ -205,6 +204,7 @@ void G4MuBremsstrahlung::BuildLambdaTable(
delete theMeanFreePathTable;
}
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
@@ -240,7 +240,7 @@ void G4MuBremsstrahlung::ComputePartialSumSigma(
const G4ElementVector* theElementVector = aMaterial->GetElementVector();
const G4double* theAtomNumDensityVector =
aMaterial->GetAtomicNumDensityVector();
G4double GammaEnergyCut = (G4Gamma::GetCutsInEnergy())[Imate];
G4double GammaEnergyCut = (G4Gamma::Gamma()->GetCutsInEnergy())[Imate];
PartialSumSigma(Imate) = new G4ValVector(NbOfElements);
@@ -425,6 +425,8 @@ void G4MuBremsstrahlung::MakeSamplingTables(
}
}
ya[NBIN] = 0. ; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(CrossSection > 0.)
{
for(G4int ib=0; ib<=nbin; ib++)
@@ -454,17 +456,11 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
// Gamma cut in this material
G4double GammaEnergyCut =
(G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
(G4Gamma::Gamma()->GetCutsInEnergy())[aMaterial->GetIndex()];
// check against insufficient energy
if (KineticEnergy < GammaEnergyCut)
{
aParticleChange.SetMomentumChange( ParticleDirection );
aParticleChange.SetEnergyChange( KineticEnergy );
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetNumberOfSecondaries(0);
if(KineticEnergy < GammaEnergyCut)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aMaterial);
@@ -497,22 +493,20 @@ G4VParticleChange* G4MuBremsstrahlung::PostStepDoIt(const G4Track& trackData,
del = abs(log(KineticEnergy)-log(tdat[it])) ;
if(del<delmin)
{
del=delmin;
delmin=del;
itt=it ;
}
}
//sample energy transfer according to the sampling table
G4double r = G4UniformRand() ;
iy = -1 ;
do {
iy += 1 ;
} while (((proba[izz][itt][iy]) < r)&&(iy < NBINminus1)) ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
//sampling is Done uniformly in y in the bin
if( iy < NBINminus1 )
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy] ) ;
else
y = ya[iy] ;
@@ -573,14 +567,14 @@ G4Element* G4MuBremsstrahlung::SelectRandomAtom(G4Material* aMaterial) const
G4double rval = G4UniformRand()*((*PartialSumSigma(Index))(NumberOfElements-1));
for ( G4int i=0; i < NumberOfElements; i++ )
if (rval <= (*PartialSumSigma(Index))(i)) return ((*theElementVector)(i));
G4cout << " WARNING !!! - The Material '"<< aMaterial->GetName()
<< "' has no elements, NULL pointer returned." << endl;
G4cout << " WARNING !!! - The Material " << aMaterial->GetName()
<< " has no elements, NULL pointer returned." << endl;
return NULL;
}
void G4MuBremsstrahlung::PrintInfoDefinition()
{
G4String comments = "cross sections from R. Kokoulin \n ";
G4String comments = "theoretical cross section \n ";
comments += " Good description up to 1000 TeV.";
G4cout << endl << GetProcessName() << ": " << comments
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuEnergyLoss.cc,v 2.8 1998/12/09 09:20:42 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuEnergyLoss.cc,v 1.6 1999/06/18 11:30:47 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
@@ -42,7 +42,7 @@
// The NbOfProcesses data member can be changed using the (public static)
// functions Get/Set/Plus/MinusNbOfProcesses (see G4MuEnergyLoss.hh)
G4int G4MuEnergyLoss::NbOfProcesses = 3 ;
G4int G4MuEnergyLoss::NbOfProcesses = 3 ; // !!!!!!!!!!!!!!!
G4PhysicsTable** G4MuEnergyLoss::RecorderOfmuplusProcess =
new G4PhysicsTable*[10] ;
@@ -74,9 +74,8 @@ G4PhysicsTable* G4MuEnergyLoss::themuplusRangeCoeffCTable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffATable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffBTable = NULL ;
G4PhysicsTable* G4MuEnergyLoss::themuminusRangeCoeffCTable = NULL ;
G4double G4MuEnergyLoss::CutInmupluslossTable = 0. ;
G4double G4MuEnergyLoss::CutInmuminuslossTable = 0. ;
G4EnergyLossMessenger* G4MuEnergyLoss::eLossMessenger = NULL ;
// constructor and destructor
@@ -94,7 +93,8 @@ G4MuEnergyLoss::G4MuEnergyLoss(const G4String& processName)
theRangeCoeffBTable(NULL),
theRangeCoeffCTable(NULL),
lastMaterial(NULL),
lastCutInRange(0.),
lastgammaCutInRange(0.),
lastelectronCutInRange(0.),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
@@ -114,56 +114,39 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
const G4ParticleDefinition& aParticleType)
{
// calculate data members TotBin,LOGRTable,RTable first
G4double lrate ;
G4int nbin ;
G4double binning = 2.*dRoverRange ;
lrate = log(HighestKineticEnergy/LowestKineticEnergy) ;
nbin = G4int((lrate/log(1.+binning) + lrate/log(1.+2.*binning))/2.);
nbin = (nbin+25)/50 ;
TotBin = 50*nbin ;
if(TotBin<50)
TotBin = 50 ;
if(TotBin>500)
TotBin = 500 ;
G4double binning = dRoverRange;
G4double lrate = log(HighestKineticEnergy/LowestKineticEnergy);
G4int nbin = G4int(lrate/log(1.+binning) + 0.5 );
nbin = (nbin+25)/50;
TotBin =50*nbin ;
if (TotBin<50) TotBin = 50;
if (TotBin>500) TotBin = 500;
LOGRTable=lrate/TotBin;
RTable =exp(LOGRTable);
G4bool MakeTable ;
ParticleMass = aParticleType.GetPDGMass() ;
G4double Charge = aParticleType.GetPDGCharge() ;
CutInRange = aParticleType.GetLengthCuts();
G4double gammaCutInRange = G4Gamma::Gamma()->GetCuts();
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
// Create tables only if there is a new cut value !*************************
if( Charge > 0.)
MakeTable = false ;
// Create tables only if there are new cut values
if((gammaCutInRange == lastgammaCutInRange) &&
(electronCutInRange == lastelectronCutInRange))
{
if(CounterOfmuplusProcess==NbOfProcesses)
{
if(CutInRange != CutInmupluslossTable)
MakeTable = true ;
CutInmupluslossTable = CutInRange ;
}
else
{
MakeTable = false ;
}
;
}
else
{
if(CounterOfmuminusProcess==NbOfProcesses)
{
if(CutInRange != CutInmuminuslossTable)
MakeTable = true ;
CutInmuminuslossTable = CutInRange ;
}
else
{
MakeTable = false ;
}
if((Charge > 0.)&&(CounterOfmuplusProcess==NbOfProcesses))
MakeTable = true ;
if((Charge < 0.)&&(CounterOfmuminusProcess==NbOfProcesses))
MakeTable = true ;
}
if( MakeTable )
{
// Build energy loss table as a sum of the energy loss due to the
// different processes.
const G4MaterialTable* theMaterialTable=
@@ -203,66 +186,53 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
if(CounterOfProcess == NbOfProcesses)
{
// loop for materials
G4double LowEdgeEnergy , Value ;
G4bool isOutRange ;
G4int J;
G4PhysicsTable* pointer ;
for (J=0; J<numOfMaterials; J++)
{
// create physics vector and fill it
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
LowestKineticEnergy, HighestKineticEnergy, TotBin);
// loop for the kinetic energy
for (G4int i=0; i<TotBin; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
Value = 0. ;
for (G4int process=0; process < NbOfProcesses; process++)
{
pointer= RecorderOfProcess[process];
Value += (*pointer)[J]->
GetValue(LowEdgeEnergy,isOutRange) ;
}
aVector->PutValue(i,Value) ;
}
theDEDXTable->insert(aVector) ;
}
}
// reset counter to zero ..................
if( Charge >0.)
CounterOfmuplusProcess=0 ;
else
CounterOfmuminusProcess=0 ;
// reset counter to zero ..................
if( Charge >0.)
CounterOfmuplusProcess=0 ;
else
CounterOfmuminusProcess=0 ;
// Build range table
BuildRangeTable( aParticleType);
// Build range table
BuildRangeTable( aParticleType);
// Build lab/proper time tables
BuildTimeTables( aParticleType) ;
// Build lab/proper time tables
BuildTimeTables( aParticleType) ;
// Build coeff tables for the energy loss calculation
BuildRangeCoeffATable( aParticleType);
BuildRangeCoeffBTable( aParticleType);
BuildRangeCoeffCTable( aParticleType);
// invert the range table
BuildInverseRangeTable(aParticleType);
// Build coeff tables for the energy loss calculation
BuildRangeCoeffATable( aParticleType);
BuildRangeCoeffBTable( aParticleType);
BuildRangeCoeffCTable( aParticleType);
// invert the range table
BuildInverseRangeTable(aParticleType);
}
}
// make the energy loss and the range table available
const G4double lowestKineticEnergy(1.00*keV);
const G4double highestKineticEnergy(1000000.*TeV);
@@ -273,6 +243,10 @@ G4MuEnergyLoss::~G4MuEnergyLoss()
(Charge > 0)? theLabTimemuplusTable: theLabTimemuminusTable,
(Charge > 0)? theProperTimemuplusTable: theProperTimemuminusTable,
lowestKineticEnergy, highestKineticEnergy, 1.,TotBin);
lastgammaCutInRange = gammaCutInRange ;
lastelectronCutInRange = electronCutInRange ;
}
}
void G4MuEnergyLoss::BuildRangeTable(
@@ -1171,51 +1145,44 @@ G4VParticleChange* G4MuEnergyLoss::AlongStepDoIt(
// do not track further if kin.energy < 1. eV
const G4double MinKineticEnergy = 1.*eV;
const G4double linLossLimit = 0.02 ;
G4double MeanLoss, finalT;
if (E < MinKineticEnergy) { finalT = 0.; MeanLoss = E;}
else if (EnergyBinNumber <= 0)
{
if (Step >= fRangeNow) { finalT = 0.; MeanLoss = E;}
else
{
finalT = E*(1.-Step/fRangeNow)*(1.-Step/fRangeNow);
if (finalT < MinKineticEnergy) finalT = 0.;
MeanLoss = E - finalT;
}
}
if (E < MinKineticEnergy) finalT = 0.;
else if ( E<= LowestKineticEnergy)
{
if (Step >= fRangeNow) finalT = 0.;
else finalT = E - Step*fdEdx ;
}
else if (E>=HighestKineticEnergy) finalT = E - Step*fdEdx;
else if (EnergyBinNumber >= (TotBin-1))
{
// simple solution for the moment: loss = Step*dE/dx (dE/dx const)
MeanLoss = Step*fdEdx;
if (MeanLoss > E) MeanLoss = E;
finalT = E - MeanLoss;
if (finalT < MinKineticEnergy) { finalT = 0.; MeanLoss = E;}
}
else if (Step >= fRangeNow) { finalT = 0.; MeanLoss = E;}
else if (Step >= fRangeNow) finalT = 0.;
else
{
{
if(Step/fRangeNow < linLossLimit) finalT = E-Step*fdEdx ;
else
{
if (charge<0.) finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonMinus,fRangeNow-Step,aMaterial);
else finalT = G4EnergyLossTables::GetPreciseEnergyFromRange(
theMuonPlus,fRangeNow-Step,aMaterial);
if (finalT < MinKineticEnergy) finalT = 0.;
MeanLoss = E-finalT;
if (MeanLoss < 0.) { MeanLoss = 0.; finalT = E;}
//now the loss with fluctuation
if ((EnlossFlucFlag) && (MeanLoss > 0.) && (MeanLoss < E))
{
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss);
if (finalT < 0.) finalT = E-MeanLoss;
}
}
}
if(finalT < MinKineticEnergy) finalT = 0. ;
MeanLoss = E-finalT ;
//now the loss with fluctuation
if ((EnlossFlucFlag) && (finalT > 0.) && (finalT < E)&&(E > LowestKineticEnergy))
{
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss);
if (finalT < 0.) finalT = E-MeanLoss;
}
// kill the particle if the kinetic energy <= 0
if (finalT <= 0. )
@@ -1237,6 +1204,8 @@ G4double G4MuEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// calculate actual loss from the mean loss
// The model used to get the fluctuation is the same as in Glandz in Geant3.
{
static const G4double Tlow=10.*keV ;
// check if the material has changed ( cache mechanism)
if (aMaterial != lastMaterial)
@@ -1265,8 +1234,7 @@ G4double G4MuEnergyLoss::GetLossWithFluct(const G4DynamicParticle* aParticle,
// get particle data
G4double Tkin = aParticle->GetKineticEnergy();
G4double charge = aParticle->GetDefinition()->GetPDGCharge();
if (charge<0.) threshold =((*G4Electron::Electron()).GetCutsInEnergy())[imat];
else threshold =((*G4Positron::Positron()).GetCutsInEnergy())[imat];
threshold =((*G4Electron::Electron()).GetCutsInEnergy())[imat];
G4double rmass = electron_mass_c2/ParticleMass;
G4double tau = Tkin/ParticleMass, tau1 = tau+1., tau2 = tau*(tau+2.);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuIonisation.cc,v 2.6 1998/11/13 13:38:35 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuIonisation.cc,v 1.3 1999/04/13 09:09:41 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -30,6 +30,8 @@
#include "G4MuIonisation.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
// constructor and destructor
G4MuIonisation::G4MuIonisation(const G4String& processName)
@@ -37,11 +39,7 @@ G4MuIonisation::G4MuIonisation(const G4String& processName)
LowestKineticEnergy(1.00*keV),
HighestKineticEnergy(1000000.*TeV),
theMeanFreePathTable(NULL),
lastCutInRange(0.),
TotBin(100),
theElectron ( G4Electron::Electron() ),
theMuonPlus ( G4MuonPlus::MuonPlus() ),
theMuonMinus ( G4MuonMinus::MuonMinus() )
TotBin(100)
{ }
G4MuIonisation::~G4MuIonisation()
@@ -63,12 +61,9 @@ void G4MuIonisation::SetPhysicsTableBining(G4double lowE, G4double highE,
void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
// just call BuildLossTable+BuildLambdaTable
{
BuildLossTable(aParticleType) ;
G4double Charge = aParticleType.GetPDGCharge();
CutInRange = aParticleType.GetLengthCuts();
BuildLossTable(aParticleType) ;
if(Charge>0.)
{
RecorderOfmuplusProcess[CounterOfmuplusProcess] = (*this).theLossTable ;
@@ -80,11 +75,9 @@ void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType
CounterOfmuminusProcess++;
}
if(CutInRange != lastCutInRange)
{
lastCutInRange = CutInRange ;
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
}
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
@@ -94,14 +87,7 @@ void G4MuIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType
void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
{
G4double Charge = aParticleType.GetPDGCharge() ;
if(Charge>0.)
ParticleCutInKineticEnergy = theMuonPlus->GetCutsInEnergy() ;
else
ParticleCutInKineticEnergy = theMuonMinus->GetCutsInEnergy() ;
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
G4double LowEdgeEnergy , ionloss ;
G4double RateMass ;
@@ -151,11 +137,9 @@ void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
material->GetAtomicNumDensityVector() ;
const G4int NumberOfElements=
material->GetNumberOfElements() ;
DeltaCutInKineticEnergyNow = DeltaCutInKineticEnergy[J] ;
G4double tau,tau0,Tmax,gamma,bg2,beta2,rcut,delta,x,sh ;
for (G4int i = 0 ; i < TotBin ; i++)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
@@ -248,7 +232,7 @@ void G4MuIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
{
// Build mean free path tables for the delta ray production process
G4double LowEdgeEnergy , Value ,sigma ;
G4double LowEdgeEnergy,Tmax , Value ,sigma ;
G4bool isOutRange ;
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
@@ -263,7 +247,6 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
// get electron and particle cuts in kinetic energy
DeltaCutInKineticEnergy = theElectron->GetCutsInEnergy() ;
ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
for (G4int J=0 ; J < numOfMaterials; J++)
{
@@ -282,13 +265,23 @@ void G4MuIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
{
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
sigma = 0. ;
for (G4int iel=0; iel<NumberOfElements; iel++ )
// check threshold here !
G4double Tmax = 2.*electron_mass_c2*LowEdgeEnergy*
(LowEdgeEnergy+2.*ParticleMass)/
(ParticleMass*ParticleMass+2.*electron_mass_c2*
(LowEdgeEnergy+ParticleMass)+
electron_mass_c2*electron_mass_c2) ;
if(Tmax > DeltaCutInKineticEnergyNow)
{
sigma += theAtomicNumDensityVector[iel]*
for (G4int iel=0; iel<NumberOfElements; iel++ )
{
sigma += theAtomicNumDensityVector[iel]*
ComputeMicroscopicCrossSection(aParticleType,
LowEdgeEnergy,
(*theElementVector)(iel)->GetZ() ) ;
}
}
Value = sigma<=0 ? DBL_MAX : 1./sigma ;
@@ -341,7 +334,6 @@ G4double G4MuIonisation::ComputeMicroscopicCrossSection(
}
}
}
return TotalCrossSection ;
}
@@ -430,10 +422,12 @@ G4VParticleChange* G4MuIonisation::PostStepDoIt(
(a0+log((2.*TotalEnergy-twoep)/ParticleMass)-
log(1.+twoep/electron_mass_c2)))
/grejc ;
} while( G4UniformRand()>grej );
}
DeltaKineticEnergy = x * MaxKineticEnergyTransfer ;
if(DeltaKineticEnergy <= 0.)
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
@@ -467,15 +461,18 @@ G4VParticleChange* G4MuIonisation::PostStepDoIt(
finalKineticEnergy = KineticEnergy - DeltaKineticEnergy ;
if (finalKineticEnergy > 0. )
{
// changed energy and momentum of the actual particle
finalMomentum=sqrt(finalKineticEnergy*
(finalKineticEnergy+2.*ParticleMass)) ;
finalPx = (TotalMomentum*ParticleDirection.x()
-DeltaTotalMomentum*DeltaDirection.x())/finalMomentum ;
finalPy = (TotalMomentum*ParticleDirection.y()
-DeltaTotalMomentum*DeltaDirection.y())/finalMomentum ;
finalPz = (TotalMomentum*ParticleDirection.z()
-DeltaTotalMomentum*DeltaDirection.z())/finalMomentum ;
finalPx = TotalMomentum*ParticleDirection.x()
- DeltaTotalMomentum*DeltaDirection.x();
finalPy = TotalMomentum*ParticleDirection.y()
- DeltaTotalMomentum*DeltaDirection.y();
finalPz = TotalMomentum*ParticleDirection.z()
- DeltaTotalMomentum*DeltaDirection.z();
finalMomentum =
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
finalPx /= finalMomentum ;
finalPy /= finalMomentum ;
finalPz /= finalMomentum ;
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
}
else
@@ -5,10 +5,9 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuPairProduction.cc,v 2.10 1998/12/02 16:33:18 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuPairProduction.cc,v 1.6 1999/06/14 13:26:35 urban Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// $Id:
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
@@ -21,6 +20,7 @@
// **************************************************************
// 04-06-98, in DoIt,secondary production condition:range>min(threshold,safety)
// 26/10/98, new stuff from R. Kokoulin + cleanup , L.Urban
// 06/05/99 , bug fixed , L.Urban
// --------------------------------------------------------------
#include "G4MuPairProduction.hh"
@@ -42,11 +42,7 @@ G4MuPairProduction::G4MuPairProduction(const G4String& processName)
theMeanFreePathTable(NULL),
LowestKineticEnergy (1.*GeV),
HighestKineticEnergy (1000000.*TeV),
TotBin(50),
theElectron (G4Electron::Electron() ),
thePositron (G4Positron::Positron() ),
theMuonMinus ( G4MuonMinus::MuonMinus() ),
theMuonPlus ( G4MuonPlus::MuonPlus() )
TotBin(50)
{ }
@@ -89,16 +85,16 @@ void G4MuPairProduction::BuildPhysicsTable(
if(theMeanFreePathTable == NULL)
MakeSamplingTables(&aParticleType) ;
BuildLambdaTable(aParticleType) ;
G4double electronCutInRange = G4Electron::Electron()->GetCuts();
if(electronCutInRange != lastelectronCutInRange)
BuildLambdaTable(aParticleType) ;
G4MuEnergyLoss::BuildDEDXTable(aParticleType) ;
if(&aParticleType==theMuonPlus)
PrintInfoDefinition() ;
}
void G4MuPairProduction::BuildLossTable(
const G4ParticleDefinition& aParticleType)
{
@@ -153,7 +149,6 @@ void G4MuPairProduction::BuildLossTable(
natom = theAtomicNumDensityVector[iel] ;
loss = ComputePairLoss(&aParticleType,
Z,KineticEnergy,eCut,pCut) ;
pairloss += natom*loss ;
}
if(pairloss<0.)
@@ -166,7 +161,6 @@ void G4MuPairProduction::BuildLossTable(
}
}
G4double G4MuPairProduction::ComputePairLoss(
const G4ParticleDefinition* ParticleType,
G4double AtomicNumber,
@@ -180,7 +174,7 @@ G4double G4MuPairProduction::ComputePairLoss(
wgi[] ={ 0.0506,0.1112,0.1569,0.1813,0.1813,0.1569,0.1112,0.0506 };
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double z13 = exp(log(AtomicNumber)/3.) ;
G4double loss = 0.0 ;
@@ -236,6 +230,7 @@ void G4MuPairProduction::BuildLambdaTable(
}
theMeanFreePathTable = new
G4PhysicsTable( G4Material::GetNumberOfMaterials() ) ;
PartialSumSigma.resize(G4Material::GetNumberOfMaterials());
G4PhysicsLogVector* ptrVector;
for ( G4int J=0 ; J < G4Material::GetNumberOfMaterials(); J++ )
@@ -304,7 +299,7 @@ G4double G4MuPairProduction::ComputeMicroscopicCrossSection(
static const G4double ak1=6.9 ;
static const G4double ak2=1.0 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double z13 = exp(log(AtomicNumber)/3.) ;
G4double CrossSection = 0.0 ;
@@ -357,7 +352,7 @@ void G4MuPairProduction::MakeSamplingTables(
MinPairEnergy = 4.*electron_mass_c2 ;
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
for (G4int iz=0; iz<nzdat; iz++)
{
@@ -399,6 +394,7 @@ void G4MuPairProduction::MakeSamplingTables(
proba[iz][it][nbin] = CrossSection ;
}
}
ya[NBIN]=0. ;
if(CrossSection > 0.)
{
@@ -420,7 +416,7 @@ G4double G4MuPairProduction::ComputeDDMicroscopicCrossSection(
// Calculates the double differential (DD) microscopic cross section
// using the cross section formula of R.P. Kokoulin (18/01/98)
{
G4double sqrte = sqrt(exp(1.)) ;
static const G4double sqrte = sqrt(exp(1.)) ;
G4double bbbtf= 183. ;
G4double bbbh = 202.4 ;
@@ -595,23 +591,18 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
aDynamicParticle->GetMomentumDirection();
// e-e+ cut in this material
G4double ElectronEnergyCut =
(G4Electron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4double PositronEnergyCut =
(G4Electron::GetCutsInEnergy())[aMaterial->GetIndex()];
G4double ElectronEnergyCut = electron_mass_c2+
((*G4Electron::Electron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4double PositronEnergyCut = electron_mass_c2+
((*G4Positron::Positron()).GetCutsInEnergy())[aMaterial->GetIndex()];
G4double CutInPairEnergy = ElectronEnergyCut + PositronEnergyCut ;
G4double MinPairEnergy = 4.*electron_mass_c2 ;
if (CutInPairEnergy < MinPairEnergy) CutInPairEnergy = MinPairEnergy ;
// check against insufficient energy
if (KineticEnergy < CutInPairEnergy )
{
aParticleChange.SetMomentumChange( ParticleDirection );
aParticleChange.SetEnergyChange( KineticEnergy );
aParticleChange.SetLocalEnergyDeposit (0.);
aParticleChange.SetNumberOfSecondaries(0);
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
}
if(KineticEnergy < CutInPairEnergy )
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
// select randomly one element constituing the material
G4Element* anElement = SelectRandomAtom(aMaterial);
@@ -650,7 +641,7 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
del = abs(log(KineticEnergy)-log(tdat[it])) ;
if(del<delmin)
{
del=delmin;
delmin=del;
itt=it ;
}
}
@@ -662,17 +653,17 @@ G4VParticleChange* G4MuPairProduction::PostStepDoIt(const G4Track& trackData,
do {
iy += 1 ;
} while ((ya[iy] < yc )&&(iy < NBINminus1)) ;
G4double norm = 1./(1.-proba[izz][itt][iy]) ;
G4double norm = proba[izz][itt][iy] ;
G4double r = G4UniformRand() ;
G4double r = norm+G4UniformRand()*(1.-norm) ;
iy = -1 ;
iy -= 1 ;
do {
iy += 1 ;
} while (((norm*proba[izz][itt][iy]) < r)&&(iy < NBINminus1)) ;
} while ((proba[izz][itt][iy] < r)&&(iy < NBINminus1)) ;
//sampling is uniformly in y in the bin
if( iy < NBINminus1 )
if( iy < NBIN )
y = ya[iy] + G4UniformRand() * ( ya[iy+1] - ya[iy]) ;
else
y = ya[iy] ;
@@ -801,7 +792,7 @@ G4Element* G4MuPairProduction::SelectRandomAtom(G4Material* aMaterial) const
}
void G4MuPairProduction::PrintInfoDefinition()
{
G4String comments = "cross sections from R. Kokoulin \n ";
G4String comments = "theoretical cross sections \n ";
comments += " Good description up to 1000 TeV.";
G4cout << endl << GetProcessName() << ": " << comments