Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -87,7 +87,7 @@ G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
{
SetHighEnergyLimit(2.0*CLHEP::MeV);
lowestKinEnergy = 1.0*CLHEP::keV;
lowestKinEnergy = 0.25*CLHEP::keV;
theZieglerFactor = CLHEP::eV*CLHEP::cm2*1.0e-15;
theElectron = G4Electron::Electron();
expStopPower125 = 0.0;
@@ -101,7 +101,10 @@ G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
G4BraggModel::~G4BraggModel()
{
if(IsMaster()) { delete fPSTAR; fPSTAR = nullptr; }
if(IsMaster()) {
delete fPSTAR;
fPSTAR = nullptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -153,6 +156,14 @@ G4double G4BraggModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4BraggModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* couple)
{
return couple->GetMaterial()->GetIonisation()->GetMeanExcitationEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4BraggModel::GetParticleCharge(const G4ParticleDefinition* p,
const G4Material* mat,
G4double kineticEnergy)
@@ -166,17 +177,18 @@ G4double G4BraggModel::GetParticleCharge(const G4ParticleDefinition* p,
G4double G4BraggModel::ComputeCrossSectionPerElectron(
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy,
G4double cut,
G4double maxKinEnergy)
{
G4double cross = 0.0;
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
G4double cross = 0.0;
const G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
const G4double maxEnergy = std::min(tmax, maxKinEnergy);
const G4double cutEnergy = std::max(cut, lowestKinEnergy*massRate);
if(cutEnergy < maxEnergy) {
G4double energy = kineticEnergy + mass;
G4double energy2 = energy*energy;
G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
const G4double energy = kineticEnergy + mass;
const G4double energy2 = energy*energy;
const G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
cross = (maxEnergy - cutEnergy)/(cutEnergy*maxEnergy)
- beta2*G4Log(maxEnergy/cutEnergy)/tmax;
@@ -184,9 +196,8 @@ G4double G4BraggModel::ComputeCrossSectionPerElectron(
cross *= CLHEP::twopi_mc2_rcl2*chargeSquare/beta2;
}
// G4cout << "BR: e= " << kineticEnergy << " tmin= " << cutEnergy
// << " tmax= " << tmax << " cross= " << cross << G4endl;
// G4cout << "BR: e= " << kineticEnergy << " tmin= " << cutEnergy
// << " tmax= " << tmax << " cross= " << cross << G4endl;
return cross;
}
@@ -220,32 +231,26 @@ G4double G4BraggModel::CrossSectionPerVolume(const G4Material* material,
G4double G4BraggModel::ComputeDEDXPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy)
G4double cut)
{
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double tkin = kineticEnergy/massRate;
const G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
const G4double tkin = kineticEnergy/massRate;
const G4double cutEnergy = std::max(cut, lowestKinEnergy*massRate);
G4double dedx = 0.0;
if(tkin < lowestKinEnergy) {
dedx = DEDX(material, lowestKinEnergy)*std::sqrt(tkin/lowestKinEnergy);
} else {
dedx = DEDX(material, tkin);
if (cutEnergy < tmax) {
const G4double tau = kineticEnergy/mass;
const G4double x = cutEnergy/tmax;
dedx += (G4Log(x)*(tau + 1.)*(tau + 1.)/(tau * (tau + 2.0)) + 1.0 - x) *
CLHEP::twopi_mc2_rcl2 * material->GetElectronDensity();
}
}
if (cutEnergy < tmax) {
G4double tau = kineticEnergy/mass;
G4double gam = tau + 1.0;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gam*gam);
G4double x = cutEnergy/tmax;
dedx += (G4Log(x) + (1.0 - x)*beta2) * CLHEP::twopi_mc2_rcl2
* (material->GetElectronDensity())/beta2;
}
// now compute the total ionization loss
dedx = std::max(dedx, 0.0) * chargeSquare;
//G4cout << "E(MeV)= " << tkin/MeV << " dedx= " << dedx
@@ -258,18 +263,19 @@ G4double G4BraggModel::ComputeDEDXPerVolume(const G4Material* material,
void G4BraggModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double xmin,
G4double minEnergy,
G4double maxEnergy)
{
G4double tmax = MaxSecondaryKinEnergy(dp);
G4double xmax = std::min(tmax, maxEnergy);
const G4double tmax = MaxSecondaryKinEnergy(dp);
const G4double xmax = std::min(tmax, maxEnergy);
const G4double xmin = std::max(lowestKinEnergy*massRate, minEnergy);
if(xmin >= xmax) { return; }
G4double kineticEnergy = dp->GetKineticEnergy();
G4double energy = kineticEnergy + mass;
G4double energy2 = energy*energy;
G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
G4double grej = 1.0;
const G4double energy = kineticEnergy + mass;
const G4double energy2 = energy*energy;
const G4double beta2 = kineticEnergy*(kineticEnergy + 2.0*mass)/energy2;
const G4double grej = 1.0;
G4double deltaKinEnergy, f;
CLHEP::HepRandomEngine* rndmEngineMod = G4Random::getTheEngine();