Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4AnnihiToMuPair.cc 66241 2012-12-13 18:34:42Z gunter $
//
// ------------ G4AnnihiToMuPair physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, November 2002
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4BetheBlochNoDeltaModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4BraggNoDeltaModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GammaConversionToMuons.cc 66872 2013-01-15 01:25:57Z japost $
//
// ------------ G4GammaConversionToMuons physics process ------
// by H.Burkhardt, S. Kelner and R. Kokoulin, April 2002
@@ -151,12 +151,12 @@ G4double G4GammaConversionToMuons::ComputeCrossSectionPerAtom(
static const G4double sqrte=sqrt(exp(1.));
static const G4double PowSat=-0.88;
static G4double CrossSection = 0.0 ;
static G4ThreadLocal G4double CrossSection = 0.0 ;
if ( A < 1. ) return 0;
if ( Egam < 4*Mmuon ) return 0 ; // below threshold return 0
static G4double EgamLast=0,Zlast=0,PowThres,Ecor,B,Dn,Zthird,Winfty,WMedAppr,
static G4ThreadLocal G4double EgamLast=0,Zlast=0,PowThres,Ecor,B,Dn,Zthird,Winfty,WMedAppr,
Wsatur,sigfac;
if(Zlast==Z && Egam==EgamLast) return CrossSection; // already calculated
@@ -224,7 +224,7 @@ G4VParticleChange* G4GammaConversionToMuons::PostStepDoIt(
G4double Z = anElement.GetZ();
G4double A = anElement.GetA()/(g/mole);
static G4double Zlast=0,B,Dn,Zthird,Winfty,A027,C1Num2,C2Term2;
static G4ThreadLocal G4double Zlast=0,B,Dn,Zthird,Winfty,A027,C1Num2,C2Term2;
if(Zlast!=Z) // the element has changed
{ Zlast=Z;
if(Z==1) // special case of Hydrogen
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ICRU73NoDeltaModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ee2KChargedModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ee2KNeutralModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeCrossSections.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeTo3PiModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -77,10 +77,7 @@ G4eeTo3PiModel::G4eeTo3PiModel(G4eeCrossSections* cr):
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4eeTo3PiModel::~G4eeTo3PiModel()
{
G4cout << "### G4eeTo3PiModel::~G4eeTo3PiModel: gmax= "
<< gmax << " gcash= " << gcash << G4endl;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeToHadrons.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeToHadronsModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeToHadronsMultiModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeToPGammaModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4eeToTwoPiModel.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4hBremsstrahlung.cc 72943 2013-08-14 13:40:29Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -46,25 +46,15 @@
#include "G4hBremsstrahlung.hh"
#include "G4SystemOfUnits.hh"
#include "G4Gamma.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4UniversalFluctuation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hBremsstrahlung::G4hBremsstrahlung(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(0),
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{
SetProcessSubType(fBremsstrahlung);
SetSecondaryParticle(G4Gamma::Gamma());
SetIonisation(false);
}
: G4MuBremsstrahlung(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -80,25 +70,13 @@ G4bool G4hBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4hBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hBremsstrahlung::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*,
const G4ParticleDefinition*)
{
if(!isInitialised) {
isInitialised = true;
theParticle = part;
if (!EmModel()) { SetEmModel(new G4hBremsstrahlungModel()); }
G4VEmFluctuationModel* fm = 0;
@@ -110,8 +88,3 @@ void G4hBremsstrahlung::InitialiseEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hBremsstrahlung::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4hBremsstrahlungModel.cc 74020 2013-09-19 13:38:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -51,6 +51,7 @@
#include "G4hBremsstrahlungModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Log.hh"
using namespace std;
@@ -83,7 +84,7 @@ G4double G4hBremsstrahlungModel::ComputeDMicroscopicCrossSection(
G4double rab0=delta*sqrte ;
G4int iz = G4int(Z);
if(iz < 1) iz = 1;
if(iz < 1) { iz = 1; }
G4double z13 = 1.0/nist->GetZ13(iz);
G4double dn = mass*nist->GetA27(iz)/(70.*MeV);
@@ -93,12 +94,12 @@ G4double G4hBremsstrahlungModel::ComputeDMicroscopicCrossSection(
// nucleus contribution logarithm
G4double rab1=b*z13;
G4double fn=log(rab1/(dn*(electron_mass_c2+rab0*rab1))*
G4double fn=G4Log(rab1/(dn*(electron_mass_c2+rab0*rab1))*
(mass+delta*(dn*sqrte-2.))) ;
if(fn <0.) fn = 0. ;
G4double x = 1.0 - v;
if(particle->GetPDGSpin() != 0) x += 0.75*v*v;
if(particle->GetPDGSpin() != 0) { x += 0.75*v*v; }
dxsection = coeff*x*Z*Z*fn/gammaEnergy;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4hPairProduction.cc 72943 2013-08-14 13:40:29Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -46,26 +46,15 @@
#include "G4hPairProduction.hh"
#include "G4SystemOfUnits.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4hPairProductionModel.hh"
#include "G4UniversalFluctuation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4hPairProduction::G4hPairProduction(const G4String& name)
: G4VEnergyLossProcess(name),
theParticle(0),
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{
SetProcessSubType(fPairProdByCharged);
SetSecondaryParticle(G4Positron::Positron());
SetIonisation(false);
}
: G4MuPairProduction(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -81,15 +70,6 @@ G4bool G4hPairProduction::IsApplicable(const G4ParticleDefinition& p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4hPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hPairProduction::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
@@ -98,7 +78,10 @@ void G4hPairProduction::InitialiseEnergyLossProcess(
isInitialised = true;
theParticle = part;
if (!EmModel()) { SetEmModel(new G4hPairProductionModel()); }
if (!EmModel()) { SetEmModel(new G4hPairProductionModel(part)); }
G4double limit = part->GetPDGMass()*8;
if(limit > lowestKinEnergy) { lowestKinEnergy = limit; }
G4VEmFluctuationModel* fm = 0;
EmModel()->SetLowEnergyLimit(MinKinEnergy());
@@ -109,11 +92,6 @@ void G4hPairProduction::InitialiseEnergyLossProcess(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4hPairProduction::PrintInfo()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4hPairProductionModel.cc 74020 2013-09-19 13:38:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -50,6 +50,8 @@
#include "G4hPairProductionModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
using namespace std;
@@ -71,12 +73,12 @@ G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
G4double pairEnergy)
// differential cross section
{
G4double bbbtf= 183. ;
G4double bbbh = 202.4 ;
G4double g1tf = 1.95e-5 ;
G4double g2tf = 5.3e-5 ;
G4double g1h = 4.4e-5 ;
G4double g2h = 4.8e-5 ;
static const G4double bbbtf= 183. ;
static const G4double bbbh = 202.4 ;
static const G4double g1tf = 1.95e-5 ;
static const G4double g2tf = 5.3e-5 ;
static const G4double g1h = 4.4e-5 ;
static const G4double g2h = 4.8e-5 ;
G4double totalEnergy = tkin + particleMass;
G4double residEnergy = totalEnergy - pairEnergy;
@@ -84,16 +86,14 @@ G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
G4double massratio2 = massratio*massratio ;
G4double cross = 0.;
SetCurrentElement(Z);
G4double c3 = 0.75*sqrte*particleMass;
if (residEnergy <= c3*z13) return cross;
if (residEnergy <= c3*z13) { return cross; }
G4double c7 = 4.*electron_mass_c2;
G4double c7 = 4.*CLHEP::electron_mass_c2;
G4double c8 = 6.*particleMass*particleMass;
G4double alf = c7/pairEnergy;
G4double a3 = 1. - alf;
if (a3 <= 0.) return cross;
if (a3 <= 0.) { return cross; }
// zeta calculation
G4double bbb,g1,g2;
@@ -101,10 +101,12 @@ G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
else { bbb = bbbtf; g1 = g1tf; g2 = g2tf; }
G4double zeta = 0;
G4double zeta1 = 0.073*log(totalEnergy/(particleMass+g1*z23*totalEnergy))-0.26;
G4double zeta1 =
0.073*G4Log(totalEnergy/(particleMass+g1*z23*totalEnergy))-0.26;
if ( zeta1 > 0.)
{
G4double zeta2 = 0.058*log(totalEnergy/(particleMass+g2*z13*totalEnergy))-0.14;
G4double zeta2 =
0.058*G4Log(totalEnergy/(particleMass+g2*z13*totalEnergy))-0.14;
zeta = zeta1/zeta2 ;
}
@@ -118,15 +120,15 @@ G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
G4double rta3 = sqrt(a3);
G4double tmnexp = alf/(1. + rta3) + del*rta3;
if(tmnexp >= 1.0) return cross;
if(tmnexp >= 1.0) { return cross; }
G4double tmn = log(tmnexp);
G4double tmn = G4Log(tmnexp);
G4double sum = 0.;
// Gaussian integration in ln(1-ro) ( with 8 points)
for (G4int i=0; i<8; i++)
{
G4double a4 = exp(tmn*xgi[i]); // a4 = (1.-asymmetry)
G4double a4 = G4Exp(tmn*xgi[i]); // a4 = (1.-asymmetry)
G4double a5 = a4*(2.-a4) ;
G4double a6 = 1.-a5 ;
G4double a7 = 1.+a6 ;
@@ -136,33 +138,35 @@ G4double G4hPairProductionModel::ComputeDMicroscopicCrossSection(
G4double xi1 = 1.+xi ;
G4double screen = screen0*xi1/a5 ;
G4double yeu = 5.-a6+4.*bet*a7 ;
G4double yed = 2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6) ;
G4double yed = 2.*(1.+3.*bet)*G4Log(3.+xii)-a6-a1*(2.-a6) ;
G4double ye1 = 1.+yeu/yed ;
G4double ale=log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1)) ;
G4double cre = 0.5*log(1.+2.25*z23*xi1*ye1/massratio2) ;
G4double ale=G4Log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1)) ;
G4double cre = 0.5*G4Log(1.+2.25*z23*xi1*ye1/massratio2) ;
G4double be;
if (xi <= 1.e3) be = ((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
else be = (3.-a6+a1*a7)/(2.*xi);
if (xi <= 1.e3) {
be = ((2.+a6)*(1.+bet)+xi*a9)*G4Log(1.+xii)+(a5-bet)/xi1-a9;
} else {
be = (3.-a6+a1*a7)/(2.*xi);
}
G4double fe = (ale-cre)*be;
if ( fe < 0.) fe = 0. ;
if ( fe < 0.) { fe = 0.; }
G4double ymu = 4.+a6 +3.*bet*a7 ;
G4double ymd = a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6 ;
G4double ymd = a7*(1.5+a1)*G4Log(3.+xi)+1.-1.5*a6 ;
G4double ym1 = 1.+ymu/ymd ;
G4double alm_crm = log(bbb*massratio/(1.5*z23*(1.+screen*ym1)));
G4double alm_crm = G4Log(bbb*massratio/(1.5*z23*(1.+screen*ym1)));
G4double a10,bm;
if ( xi >= 1.e-3)
{
a10 = (1.+a1)*a5 ;
bm = (a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
bm = (a7*(1.+1.5*bet)-a10*xii)*G4Log(xi1)+xi*(a5-bet)/xi1+a10;
} else {
bm = (5.-a6+bet*a9)*(xi/2.);
}
G4double fm = alm_crm*bm;
if ( fm < 0.) fm = 0. ;
if ( fm < 0.) { fm = 0.; }
sum += wgi[i]*a4*(fe+fm/massratio2);
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4hhIonisation.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4mplIonisation.cc 66241 2012-12-13 18:34:42Z gunter $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4mplIonisationModel.cc 76600 2013-11-13 08:30:02Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -59,11 +59,16 @@
#include "G4SystemOfUnits.hh"
#include "G4LossTableManager.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ProductionCutsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Log.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
std::vector<G4double>* G4mplIonisationModel::dedx0 = 0;
G4mplIonisationModel::G4mplIonisationModel(G4double mCharge, const G4String& nam)
: G4VEmModel(nam),G4VEmFluctuationModel(nam),
magCharge(mCharge),
@@ -87,7 +92,9 @@ G4mplIonisationModel::G4mplIonisationModel(G4double mCharge, const G4String& nam
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4mplIonisationModel::~G4mplIonisationModel()
{}
{
if(IsMaster()) { delete dedx0; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -110,6 +117,25 @@ void G4mplIonisationModel::Initialise(const G4ParticleDefinition* p,
{
if(!monopole) { SetParticle(p); }
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
if(IsMaster()) {
if(!dedx0) { dedx0 = new std::vector<G4double>; }
G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int n = dedx0->size();
if(n < numOfCouples) { dedx0->resize(numOfCouples); }
// initialise vector
for(G4int i=0; i<numOfCouples; ++i) {
const G4Material* material =
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
G4double eDensity = material->GetElectronDensity();
G4double vF = electron_Compton_length*pow(3*pi*pi*eDensity,0.3333333333);
(*dedx0)[i] = pi_hbarc2_over_mc2*eDensity*nmpl*nmpl*
(G4Log(2*vF/fine_structure_const) - 0.5)/vF;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -127,7 +153,8 @@ G4double G4mplIonisationModel::ComputeDEDXPerVolume(const G4Material* material,
G4double beta = sqrt(beta2);
// low-energy asymptotic formula
G4double dedx = dedxlim*beta*material->GetDensity();
//G4double dedx = dedxlim*beta*material->GetDensity();
G4double dedx = (*dedx0)[CurrentCouple()->GetIndex()]*beta;
// above asymptotic
if(beta > betalow) {
@@ -138,7 +165,8 @@ G4double G4mplIonisationModel::ComputeDEDXPerVolume(const G4Material* material,
} else {
G4double dedx1 = dedxlim*betalow*material->GetDensity();
//G4double dedx1 = dedxlim*betalow*material->GetDensity();
G4double dedx1 = (*dedx0)[CurrentCouple()->GetIndex()]*betalow;
G4double dedx2 = ComputeDEDXAhlen(material, bg2lim);
// extrapolation between two formula
@@ -203,13 +231,13 @@ void G4mplIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4mplIonisationModel::SampleFluctuations(
const G4Material* material,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
G4double& meanLoss)
G4double tmax,
G4double length,
G4double meanLoss)
{
G4double siga = Dispersion(material,dp,tmax,length);
G4double siga = Dispersion(couple->GetMaterial(),dp,tmax,length);
G4double loss = meanLoss;
siga = sqrt(siga);
G4double twomeanLoss = meanLoss + meanLoss;
@@ -232,8 +260,8 @@ G4double G4mplIonisationModel::SampleFluctuations(
G4double G4mplIonisationModel::Dispersion(const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length)
G4double tmax,
G4double length)
{
G4double siga = 0.0;
G4double tau = dp->GetKineticEnergy()/mass;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4mplIonisationWithDeltaModel.cc 76600 2013-11-13 08:30:02Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -61,11 +61,16 @@
#include "G4ParticleChangeForLoss.hh"
#include "G4Electron.hh"
#include "G4DynamicParticle.hh"
#include "G4ProductionCutsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Log.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
std::vector<G4double>* G4mplIonisationWithDeltaModel::dedx0 = 0;
G4mplIonisationWithDeltaModel::G4mplIonisationWithDeltaModel(G4double mCharge,
const G4String& nam)
: G4VEmModel(nam),G4VEmFluctuationModel(nam),
@@ -76,7 +81,7 @@ G4mplIonisationWithDeltaModel::G4mplIonisationWithDeltaModel(G4double mCharge,
beta2lim(betalim*betalim),
bg2lim(beta2lim*(1.0 + beta2lim))
{
nmpl = G4int(abs(magCharge) * 2 * fine_structure_const + 0.5);
nmpl = G4lrint(std::fabs(magCharge) * 2 * fine_structure_const);
if(nmpl > 6) { nmpl = 6; }
else if(nmpl < 1) { nmpl = 1; }
pi_hbarc2_over_mc2 = pi * hbarc * hbarc / electron_mass_c2;
@@ -93,7 +98,9 @@ G4mplIonisationWithDeltaModel::G4mplIonisationWithDeltaModel(G4double mCharge,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4mplIonisationWithDeltaModel::~G4mplIonisationWithDeltaModel()
{}
{
if(IsMaster()) { delete dedx0; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -117,6 +124,25 @@ G4mplIonisationWithDeltaModel::Initialise(const G4ParticleDefinition* p,
{
if(!monopole) { SetParticle(p); }
if(!fParticleChange) { fParticleChange = GetParticleChangeForLoss(); }
if(IsMaster()) {
if(!dedx0) { dedx0 = new std::vector<G4double>; }
G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int n = dedx0->size();
if(n < numOfCouples) { dedx0->resize(numOfCouples); }
// initialise vector
for(G4int i=0; i<numOfCouples; ++i) {
const G4Material* material =
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
G4double eDensity = material->GetElectronDensity();
G4double vF = electron_Compton_length*pow(3*pi*pi*eDensity,0.3333333333);
(*dedx0)[i] = pi_hbarc2_over_mc2*eDensity*nmpl*nmpl*
(G4Log(2*vF/fine_structure_const) - 0.5)/vF;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -130,6 +156,7 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
if(!monopole) { SetParticle(p); }
G4double tmax = MaxSecondaryEnergy(p,kineticEnergy);
G4double cutEnergy = std::min(tmax, maxEnergy);
cutEnergy = std::max(LowEnergyLimit(), cutEnergy);
G4double tau = kineticEnergy / mass;
G4double gam = tau + 1.0;
G4double bg2 = tau * (tau + 2.0);
@@ -137,7 +164,8 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
G4double beta = sqrt(beta2);
// low-energy asymptotic formula
G4double dedx = dedxlim*beta*material->GetDensity();
//G4double dedx = dedxlim*beta*material->GetDensity();
G4double dedx = (*dedx0)[CurrentCouple()->GetIndex()]*beta;
// above asymptotic
if(beta > betalow) {
@@ -148,7 +176,8 @@ G4mplIonisationWithDeltaModel::ComputeDEDXPerVolume(const G4Material* material,
} else {
G4double dedx1 = dedxlim*betalow*material->GetDensity();
//G4double dedx1 = dedxlim*betalow*material->GetDensity();
G4double dedx1 = (*dedx0)[CurrentCouple()->GetIndex()]*betalow;
G4double dedx2 = ComputeDEDXAhlen(material, bg2lim, cutEnergy);
// extrapolation between two formula
@@ -184,7 +213,7 @@ G4mplIonisationWithDeltaModel::ComputeDEDXAhlen(const G4Material* material,
dedx += 0.5 * k - B[nmpl];
// density effect correction
G4double x = log(bg2)/twoln10;
G4double x = G4Log(bg2)/twoln10;
dedx -= material->GetIonisation()->DensityCorrection(x);
// now compute the total ionization loss
@@ -200,15 +229,16 @@ G4double
G4mplIonisationWithDeltaModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double cut,
G4double maxKinEnergy)
{
if(!monopole) { SetParticle(p); }
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = min(tmax,maxKinEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
G4double cutEnergy = std::max(LowEnergyLimit(), cut);
if(cutEnergy < maxEnergy) {
cross = (1.0/cutEnergy - 1.0/maxEnergy)*twopi_mc2_rcl2*chargeSquare;
cross = (0.5/cutEnergy - 0.5/maxEnergy)*pi_hbarc2_over_mc2 * nmpl * nmpl;
}
return cross;
}
@@ -290,13 +320,13 @@ G4mplIonisationWithDeltaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4mplIonisationWithDeltaModel::SampleFluctuations(
const G4Material* material,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
G4double& meanLoss)
G4double tmax,
G4double length,
G4double meanLoss)
{
G4double siga = Dispersion(material,dp,tmax,length);
G4double siga = Dispersion(couple->GetMaterial(),dp,tmax,length);
G4double loss = meanLoss;
siga = sqrt(siga);
G4double twomeanLoss = meanLoss + meanLoss;
@@ -320,8 +350,8 @@ G4double G4mplIonisationWithDeltaModel::SampleFluctuations(
G4double
G4mplIonisationWithDeltaModel::Dispersion(const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length)
G4double tmax,
G4double length)
{
G4double siga = 0.0;
G4double tau = dp->GetKineticEnergy()/mass;