Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -5,24 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VhEnergyLoss.cc,v 1.5 2000/06/13 16:49:58 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VhEnergyLoss.cc,v 1.13 2000/10/30 07:01:09 urban Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// -----------------------------------------------------------
// 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
// ---------- G4VhEnergyLoss physics process -----------
// by Laszlo Urban, 30 May 1997
//
// **************************************************************
// It is the first implementation of the NEW UNIFIED ENERGY LOSS PROCESS.
// It calculates the energy loss of charged hadrons.
// **************************************************************
//
// 7/10/98: bug fixes + some cleanup , L.Urban
// 22/10/98 : cleanup , L.Urban
// 07/12/98 : works for ions as well+ bug corrected, L.Urban
@@ -30,16 +17,24 @@
// 01/03/99 : creation of sub-cutoff delta rays, L.Urban
// 28/04/99 : bug fixed in DoIt , L.Urban
// 10/02/00 modifications , new e.m. structure, L.Urban
// 18/07/00 : bug fix in AlongStepDoIt V.Ivanchenko
// 10/08/00 : V.Ivanchenko change AlongStepDoIt and
// add EnergyLossFluctuation in order to simulate
// energy losses of ions
// 17/08/00 : V.Ivanchenko change EnergyLossFluctuation
// 18/08/00 : V.Ivanchenko bug fixed in GetConstrained
// --------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4VhEnergyLoss.hh"
#include "G4EnergyLossMessenger.hh"
#include "G4EnergyLossTables.hh"
#include "G4Poisson.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
// Initialisation of static members ******************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VhEnergyLoss::NbOfProcesses = 1 ;
G4int G4VhEnergyLoss::CounterOfProcess = 0 ;
@@ -80,10 +75,6 @@ const G4AntiProton* G4VhEnergyLoss::theAntiProton=G4AntiProton::AntiProton() ;
G4double G4VhEnergyLoss::ptableElectronCutInRange = 0.0*mm ;
G4double G4VhEnergyLoss::pbartableElectronCutInRange = 0.0*mm ;
G4double G4VhEnergyLoss::MinDeltaCutInRange = 0.1*mm ;
G4double* G4VhEnergyLoss::MinDeltaEnergy = NULL ;
G4bool G4VhEnergyLoss::setMinDeltaCutInRange = false ;
G4double G4VhEnergyLoss::Charge ;
G4double G4VhEnergyLoss::LowerBoundEloss = 1.*keV ;
@@ -97,28 +88,26 @@ G4double G4VhEnergyLoss::c2N = 13.25e-21*keV*mm*mm ;
G4double G4VhEnergyLoss::c3N = 0.500e-21*mm*mm ;
G4int G4VhEnergyLoss::Ndeltamax = 100 ;
G4EnergyLossMessenger* G4VhEnergyLoss::hLossMessenger = NULL;
// constructor and destructor
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VhEnergyLoss::G4VhEnergyLoss(const G4String& processName)
: G4VEnergyLoss (processName),
theLossTable (NULL),
MinKineticEnergy(1.*eV),
linLossLimit(0.05)
{
//create (only once) EnergyLoss messenger
if(!hLossMessenger) hLossMessenger = new G4EnergyLossMessenger();
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
}
G4VhEnergyLoss::~G4VhEnergyLoss()
{
if(theLossTable) {
theLossTable->clearAndDestroy();
delete theLossTable; theLossTable = NULL;
}
/// if(MinDeltaEnergy) delete MinDeltaEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VhEnergyLoss::BuildDEDXTable(
const G4ParticleDefinition& aParticleType)
@@ -305,6 +294,7 @@ void G4VhEnergyLoss::BuildDEDXTable(
}
}
// make the energy loss and the range table available
G4EnergyLossTables::Register(&aParticleType,
@@ -325,7 +315,7 @@ void G4VhEnergyLoss::BuildDEDXTable(
if(!setMinDeltaCutInRange)
MinDeltaCutInRange = G4Electron::Electron()->GetCuts()/10.;
if(aParticleType.GetParticleName()=="proton")
if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
{
G4cout << G4endl;
G4cout.precision(5) ;
@@ -338,9 +328,13 @@ void G4VhEnergyLoss::BuildDEDXTable(
if(MinDeltaEnergy) delete MinDeltaEnergy ;
MinDeltaEnergy = new G4double [numOfMaterials] ;
if(LowerLimitForced) delete LowerLimitForced ;
LowerLimitForced = new G4bool [numOfMaterials] ;
G4double Tlowerlimit = 1.*keV ;
for(G4int mat=0; mat<numOfMaterials; mat++)
{
LowerLimitForced[mat] = false ;
MinDeltaEnergy[mat] = G4EnergyLossTables::GetPreciseEnergyFromRange(
G4Electron::Electron(),MinDeltaCutInRange,
(*theMaterialTable)(mat)) ;
@@ -349,12 +343,19 @@ void G4VhEnergyLoss::BuildDEDXTable(
if(MinDeltaEnergy[mat]>G4Electron::Electron()->GetCutsInEnergy()[mat])
MinDeltaEnergy[mat]=G4Electron::Electron()->GetCutsInEnergy()[mat] ;
if(aParticleType.GetParticleName()=="proton")
if((subSecFlag) && (aParticleType.GetParticleName()=="proton"))
{
G4cout << G4std::setw(20) << (*theMaterialTable)(mat)->GetName()
<< G4std::setw(15) << MinDeltaEnergy[mat]/keV << G4endl;
<< G4std::setw(15) << MinDeltaEnergy[mat]/keV ;
if(LowerLimitForced[mat])
G4cout << " lower limit forced." << G4endl;
else
G4cout << G4endl ;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VhEnergyLoss::GetConstraints(const G4DynamicParticle *aParticle,
G4Material *aMaterial)
@@ -408,6 +409,8 @@ G4double G4VhEnergyLoss::GetConstraints(const G4DynamicParticle *aParticle,
return StepLimit ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
const G4Track& trackData,const G4Step& stepData)
// compute the energy loss after a step
@@ -464,7 +467,7 @@ G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
theAntiProton,
rscaled-sscaled,aMaterial) ;
}
MeanLoss /= (massratio*ChargeSquare) ;
MeanLoss /= massratio ;
}
else MeanLoss = Step*fdEdx ;
}
@@ -557,7 +560,9 @@ G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
aMaterial) ;
// absolute lower limit for T0
if(T0<MinDeltaEnergyNow) T0=MinDeltaEnergyNow ;
// if(T0<MinDeltaEnergyNow) T0=MinDeltaEnergyNow ;
if((T0<MinDeltaEnergyNow)||(LowerLimitForced[aMaterial->GetIndex()]))
T0=MinDeltaEnergyNow ;
// compute nb of delta rays to be generated
G4int N=int(fragment*(c0N/(E*T0)+c1N/T0-(c2N+c3N*T0)/Tc)*
@@ -677,8 +682,8 @@ G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
// now the loss with fluctuation
if((EnlossFlucFlag) && (finalT > 0.) && (finalT < E)&&(E > LowerBoundEloss))
{
MeanLoss /= ChargeSquare ;
finalT = E-GetLossWithFluct(aParticle,aMaterial,MeanLoss)*ChargeSquare ;
finalT = E -
EnergyLossFluctuation(aParticle,aMaterial,ChargeSquare,MeanLoss,Step) ;
if (finalT < 0.) finalT = 0. ;
}
@@ -699,4 +704,18 @@ G4VParticleChange* G4VhEnergyLoss::AlongStepDoIt(
return &aParticleChange ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VhEnergyLoss::EnergyLossFluctuation(
const G4DynamicParticle *aParticle,
G4Material *aMaterial,
G4double ChargeSquare,
G4double MeanLoss,
G4double Step)
{
G4double loss = GetLossWithFluct(aParticle,aMaterial,
ChargeSquare,MeanLoss,Step) ;
return loss ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....