Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.cc,v 1.2 2006/06/29 19:54:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4DummyModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.03.2006
//
// Modifications:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4DummyModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DummyModel::G4DummyModel(const G4String& nam)
: G4VEmModel(nam)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DummyModel::~G4DummyModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DummyModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
std::vector<G4DynamicParticle*>* G4DummyModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{
std::vector<G4DynamicParticle*>* vdp = 0;
return vdp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc,v 1.24 2005/11/26 15:33:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCalculator.cc,v 1.33 2006/06/29 19:54:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -40,6 +43,13 @@
// 08.04.2005 Major optimisation of internal interfaces (V.Ivantchenko)
// 08.05.2005 Use updated interfaces (V.Ivantchenko)
// 23.10.2005 Fix computations for ions (V.Ivantchenko)
// 11.01.2006 Add GetCSDARange (V.Ivantchenko)
// 26.01.2006 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 14.03.2006 correction in GetCrossSectionPerVolume (mma)
// suppress GetCrossSectionPerAtom
// elm->GetA() in ComputeCrossSectionPerAtom
// 22.03.2006 Add ComputeElectronicDEDX and ComputeTotalDEDX (V.Ivanchenko)
// 13.05.2006 Add Corrections for ion stopping (V.Ivanchenko)
//
// Class Description:
//
@@ -84,6 +94,7 @@ G4EmCalculator::G4EmCalculator()
massRatio = 1.0;
currentParticleName= "";
currentMaterialName= "";
theGenericIon = G4GenericIon::GenericIon();
ionEffCharge = new G4ionEffectiveCharge();
isIon = false;
isApplicable = false;
@@ -125,13 +136,60 @@ G4double G4EmCalculator::GetDEDX(G4double kinEnergy, const G4ParticleDefinition*
G4double G4EmCalculator::GetDEDX(G4double kinEnergy, const G4String& particle,
const G4String& material, const G4String& reg)
{
return GetDEDX(kinEnergy,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4ParticleDefinition* p,
const G4Material* mat, const G4Region* region)
G4double G4EmCalculator::GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
res = manager->GetRangeFromRestricteDEDX(p, kinEnergy, couple);
if(verbose>0) {
G4cout << "G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
<< " range(mm)= " << res/mm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCSDARange(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
res = manager->GetCSDARange(p, kinEnergy, couple);
if(verbose>0) {
G4cout << "G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
<< " range(mm)= " << res/mm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
@@ -150,16 +208,43 @@ G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4ParticleDefinition
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4String& particle,
const G4String& material, const G4String& reg)
G4double G4EmCalculator::GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetRange(kinEnergy,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetRangeFromRestricteDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetKinEnergy(G4double range, const G4ParticleDefinition* p,
const G4Material* mat, const G4Region* region)
G4double G4EmCalculator::GetCSDARange(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetCSDARange(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetRange(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetKinEnergy(G4double range,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
@@ -181,7 +266,8 @@ G4double G4EmCalculator::GetKinEnergy(G4double range, const G4ParticleDefinition
G4double G4EmCalculator::GetKinEnergy(G4double range, const G4String& particle,
const G4String& material, const G4String& reg)
{
return GetKinEnergy(range,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetKinEnergy(range,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -195,20 +281,22 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple) {
if(couple && UpdateParticle(p, kinEnergy)) {
G4int idx = couple->GetIndex();
FindLambdaTable(p, processName);
if(currentLambda && UpdateParticle(p, kinEnergy)) {
if(currentLambda) {
G4bool b;
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->GetValue(e,b))*chargeSquare;
res /= mat->GetTotNbOfAtomsPerVolume();
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm^2/g)= " << res*gram/cm2
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " e(MeV)= " << e
<< " q2= " << chargeSquare;
G4cout << G4endl;
}
}
}
@@ -229,31 +317,6 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCrossSectionPerAtom(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4String& processName,
const G4Material* mat,
const G4Region* region)
{
G4double res = GetCrossSectionPerVolume(kinEnergy,p,processName,mat,region);
if(mat) res /= mat->GetTotNbOfAtomsPerVolume();
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCrossSectionPerAtom( G4double kinEnergy,
const G4String& particle,
const G4String& processName,
const G4String& material,
const G4String& reg)
{
return GetCrossSectionPerAtom(kinEnergy,FindParticle(particle),processName,
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetMeanFreePath(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4String& processName,
@@ -308,7 +371,8 @@ void G4EmCalculator::PrintRangeTable(const G4ParticleDefinition* p)
void G4EmCalculator::PrintInverseRangeTable(const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = FindEnergyLossProcess(p);
G4cout << "### G4EmCalculator: Inverse Range Table for " << p->GetParticleName() << G4endl;
G4cout << "### G4EmCalculator: Inverse Range Table for "
<< p->GetParticleName() << G4endl;
if(elp) G4cout << *(elp->InverseRangeTable()) << G4endl;
}
@@ -326,32 +390,41 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
if(verbose > 1) {
G4cout << "### G4EmCalculator::ComputeDEDX: " << p->GetParticleName()
<< " in " << currentMaterialName
<< " e(MeV)= " << kinEnergy/MeV << " cut(MeV)= " << cut/MeV << G4endl;
<< " e(MeV)= " << kinEnergy/MeV << " cut(MeV)= " << cut/MeV
<< G4endl;
}
if(FindEmModel(p, processName, kinEnergy)) {
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
// G4cout << "currentModel= " << currentModel << G4endl;
if(UpdateParticle(p, kinEnergy)) {
G4double escaled = kinEnergy*massRatio;
if(baseParticle) {
res = currentModel->ComputeDEDXPerVolume(mat, baseParticle, escaled, cut)
* chargeSquare;
res = currentModel->ComputeDEDXPerVolume(
mat, baseParticle, escaled, cut) * chargeSquare;
if(verbose > 1)
G4cout << baseParticle->GetParticleName() << " Escaled(MeV)= " << escaled;
G4cout << baseParticle->GetParticleName()
<< " Escaled(MeV)= " << escaled;
} else {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) G4cout << " no basePart E(MeV)= " << kinEnergy;
}
if(verbose > 1)
G4cout << " DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
if(isIon && currentModel->HighEnergyLimit() > 100.*MeV) {
res += corr->HighOrderCorrections(p,mat,kinEnergy);
if(isIon) {
if(currentModel->HighEnergyLimit() > 100.*MeV)
res += corr->HighOrderCorrections(p,mat,kinEnergy);
else
res *= corr->EffectiveChargeCorrection(p,mat,kinEnergy);
if(verbose > 1)
G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
/*
// emulate boundary region for different parameterisations
G4double eth = currentModel->LowEnergyLimit();
if(eth > 0.05*MeV && eth < 10.*MeV && escaled > eth) {
@@ -363,22 +436,25 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
if(verbose > 1)
G4cout << "At boundary energy(MeV)= " << eth/MeV << " DEDX(MeV/mm)= " << res1*mm/MeV
G4cout << "At boundary energy(MeV)= " << eth/MeV
<< " DEDX(MeV/mm)= " << res1*mm/MeV
<< G4endl;
if(isIon) res1 += corr->HighOrderCorrections(p,mat,eth/massRatio);
G4double res0 = res1;
if(FindEmModel(p, processName, eth-1.0*keV)) {
if(baseParticle) {
res0 = currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut)
* chargeSquare;
res0 = currentModel->ComputeDEDXPerVolume(
mat, baseParticle, eth, cut) * chargeSquare;
} else {
res0 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
}
//G4cout << "eth= " << eth << " escaled= " << escaled << " res0= " << res0 << " res1= "
//G4cout << "eth= " << eth << " escaled= " << escaled
// << " res0= " << res0 << " res1= "
// << res1 << " q2= " << chargeSquare << G4endl;
res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
}
*/
if(verbose > 0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " DEDX(MeV/mm)= " << res*mm/MeV
@@ -396,6 +472,56 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeElectronicDEDX(G4double kinEnergy,
const G4ParticleDefinition* part,
const G4Material* mat,
G4double cut)
{
currentMaterial = mat;
currentMaterialName = mat->GetName();
G4double dedx = 0.0;
if(UpdateParticle(part, kinEnergy)) {
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
const G4ParticleDefinition* p = (vel[i])->Particle();
if((!isIon && p == part) || (isIon && p == theGenericIon))
dedx += ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),mat,cut);
}
}
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeElectronicDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut)
{
return ComputeElectronicDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition* part,
const G4Material* mat, G4double cut)
{
G4double dedx = ComputeElectronicDEDX(kinEnergy,part,mat,cut);
if(mass > 700.*MeV) dedx += ComputeNuclearDEDX(kinEnergy,part,mat);
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut)
{
return ComputeTotalDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& processName,
@@ -418,7 +544,8 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
if(verbose > 1) {
G4cout << p->GetParticleName() << " E(MeV)= " << kinEnergy/MeV
<< " NuclearDEDX(MeV/mm)= " << res*mm/MeV
<< " NuclearDEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " NuclearDEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
return res;
@@ -430,7 +557,8 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& material)
{
return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),FindMaterial(material));
return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -445,21 +573,23 @@ G4double G4EmCalculator::ComputeCrossSectionPerVolume(
currentMaterial = mat;
currentMaterialName = mat->GetName();
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
UpdateParticle(p, kinEnergy);
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->CrossSectionPerVolume(mat, baseParticle, e, cut, e)*chargeSquare;
} else {
res = currentModel->CrossSectionPerVolume(mat, p, e, cut, e);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm^2/g)= " << res*gram/cm2
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->CrossSectionPerVolume(
mat, baseParticle, e, cut, e) * chargeSquare;
} else {
res = currentModel->CrossSectionPerVolume(mat, p, e, cut, e);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
}
return res;
@@ -474,7 +604,8 @@ G4double G4EmCalculator::ComputeCrossSectionPerVolume(
const G4String& material,
G4double cut)
{
return ComputeCrossSectionPerVolume(kinEnergy,FindParticle(particle),processName,
return ComputeCrossSectionPerVolume(kinEnergy,FindParticle(particle),
processName,
FindMaterial(material),cut);
}
@@ -488,21 +619,23 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(
G4double cut)
{
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
UpdateParticle(p, kinEnergy);
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->ComputeCrossSectionPerAtom(baseParticle, e, Z, A, cut)*chargeSquare;
} else {
res = currentModel->ComputeCrossSectionPerAtom(p, e, Z, A, cut);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(barn)= " << res/barn
<< " " << p->GetParticleName()
<< " Z= " << Z << " A= " << A
<< G4endl;
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->ComputeCrossSectionPerAtom(
baseParticle, e, Z, A, cut) * chargeSquare;
} else {
res = currentModel->ComputeCrossSectionPerAtom(p, e, Z, A, cut);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(barn)= " << res/barn
<< " " << p->GetParticleName()
<< " Z= " << Z << " A= " << A/(g/mole) << " g/mole"
<< G4endl;
}
}
}
return res;
@@ -516,8 +649,9 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(G4double kinEnergy,
const G4Element* elm,
G4double cut)
{
return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),processName,
elm->GetZ(),elm->GetN(),cut);
return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),
processName,
elm->GetZ(),elm->GetA(),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -555,40 +689,51 @@ G4double G4EmCalculator::ComputeMeanFreePath(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p, G4double kinEnergy)
G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p,
G4double kinEnergy)
{
if(p != currentParticle) {
currentParticle = p;
baseParticle = 0;
currentParticleName = p->GetParticleName();
massRatio = 1.0;
mass = p->GetPDGMass();
chargeSquare = 1.0;
currentProcess = FindEnergyLossProcess(p);
currentProcessName = "";
if(currentProcess) currentProcessName = currentProcess->GetProcessName();
if(p->GetParticleType() == "nucleus" &&
currentParticleName != "deuteron" && currentParticleName != "triton") {
baseParticle = G4GenericIon::GenericIon();
currentParticleName != "deuteron" && currentParticleName != "triton") {
baseParticle = theGenericIon;
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
isIon = true;
// G4cout << p->GetParticleName() << " in " << currentMaterial->GetName()
// G4cout << p->GetParticleName()
// << " in " << currentMaterial->GetName()
// << " e= " << kinEnergy << G4endl;
chargeSquare =
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
//G4cout << "q2= " << chargeSquare << G4endl;
} else {
isIon = false;
const G4VEnergyLossProcess* proc = FindEnergyLossProcess(p);
if(proc) {
baseParticle = proc->BaseParticle();
if(currentProcess) {
baseParticle = currentProcess->BaseParticle();
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
G4double q = p->GetPDGCharge()/baseParticle->GetPDGCharge();
chargeSquare *= q*q;
}
G4double q = baseParticle->GetPDGCharge()/eplus;
chargeSquare /= (q*q);
}
}
}
}
if(isIon) chargeSquare =
if(isIon) {
chargeSquare =
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
if(currentProcess)
currentProcess->SetDynamicMassCharge(massRatio,chargeSquare);
// G4cout << "massR= " << massRatio << " q2= " << chargeSquare << G4endl;
}
return true;
}
@@ -600,7 +745,8 @@ const G4ParticleDefinition* G4EmCalculator::FindParticle(const G4String& name)
if(name != currentParticleName) {
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!p) {
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find " << name << G4endl;
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find "
<< name << G4endl;
}
} else {
p = currentParticle;
@@ -616,7 +762,8 @@ const G4Material* G4EmCalculator::FindMaterial(const G4String& name)
currentMaterial = G4Material::GetMaterial(name);
currentMaterialName = name;
if(!currentMaterial)
G4cout << "### WARNING: G4EmCalculator::FindMaterial fails to find " << name << G4endl;
G4cout << "### WARNING: G4EmCalculator::FindMaterial fails to find "
<< name << G4endl;
}
return currentMaterial;
}
@@ -630,8 +777,9 @@ const G4Region* G4EmCalculator::FindRegion(const G4String& reg)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4MaterialCutsCouple* G4EmCalculator::FindCouple(const G4Material* material,
const G4Region* region)
const G4MaterialCutsCouple* G4EmCalculator::FindCouple(
const G4Material* material,
const G4Region* region)
{
if(!material) return 0;
currentMaterial = material;
@@ -640,7 +788,8 @@ const G4MaterialCutsCouple* G4EmCalculator::FindCouple(const G4Material* materia
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
const G4Region* r = region;
if(!r) r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
if(!r)
r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
return theCoupleTable->GetMaterialCutsCouple(material,r->GetProductionCuts());
@@ -684,15 +833,16 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton")
part = G4GenericIon::GenericIon();
if(isIon) part = theGenericIon;
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
if((vel[i])->GetProcessName() == currentName && (vel[i])->Particle() == part) {
if((vel[i])->GetProcessName() == currentName &&
(vel[i])->Particle() == part)
{
currentLambda = (vel[i])->LambdaTable();
isApplicable = true;
break;
@@ -702,7 +852,9 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
const std::vector<G4VEmProcess*> vem = lManager->GetEmProcessVector();
G4int n = vem.size();
for(G4int i=0; i<n; i++) {
if((vem[i])->GetProcessName() == currentName && (vem[i])->Particle() == part) {
if((vem[i])->GetProcessName() == currentName &&
(vem[i])->Particle() == part)
{
currentLambda = (vem[i])->LambdaTable();
isApplicable = true;
break;
@@ -710,10 +862,13 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
}
}
if(!currentLambda) {
const std::vector<G4VMultipleScattering*> vmsc = lManager->GetMultipleScatteringVector();
const std::vector<G4VMultipleScattering*> vmsc =
lManager->GetMultipleScatteringVector();
G4int n = vmsc.size();
for(G4int i=0; i<n; i++) {
if((vmsc[i])->GetProcessName() == currentName && (vmsc[i])->Particle() == part) {
if((vmsc[i])->GetProcessName() == currentName &&
(vmsc[i])->Particle() == part)
{
currentLambda = (vmsc[i])->LambdaTable();
isApplicable = true;
break;
@@ -727,25 +882,23 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
const G4String& processName,
G4double kineticEnergy)
G4double kinEnergy)
{
G4bool res = false;
if(!p) {
G4cout << "G4EmCalculator::FindEmModel WARNING: no particle defined" << G4endl;
G4cout << "G4EmCalculator::FindEmModel WARNING: no particle defined"
<< G4endl;
return res;
}
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
G4double kinEnergy = kineticEnergy;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton") {
part = G4GenericIon::GenericIon();
kinEnergy *= part->GetPDGMass()/p->GetPDGMass();
}
G4double scaledEnergy = kinEnergy*massRatio;
if(isIon) part = theGenericIon;
if(verbose > 1) {
G4cout << "G4EmCalculator::FindEmModel for " << partname
<< " (type= " << p->GetParticleType()
<< ") and " << processName << " at e(MeV)= " << kinEnergy;
<< ") and " << processName << " at e(MeV)= " << scaledEnergy;
if(p != part) G4cout << " GenericIon is the base particle";
G4cout << G4endl;
}
@@ -755,34 +908,40 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
currentModel = 0;
size_t idx = 0;
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
// G4cout << "i= " << i << " part= " << (vel[i])->Particle()->GetParticleName()
// G4cout << "i= " << i << " part= "
// << (vel[i])->Particle()->GetParticleName()
// << " proc= " << (vel[i])->GetProcessName() << G4endl;
if((vel[i])->GetProcessName() == currentName && (vel[i])->Particle() == part) {
if((vel[i])->GetProcessName() == currentName &&
(vel[i])->Particle() == part)
{
const G4ParticleDefinition* bp = (vel[i])->BaseParticle();
// G4cout << "i= " << i << " bp= " << bp << G4endl;
if(!bp) {
currentModel = (vel[i])->SelectModelForMaterial(kinEnergy, idx);
currentModel = (vel[i])->SelectModelForMaterial(scaledEnergy, idx);
isApplicable = true;
break;
} else {
G4double e = kinEnergy*bp->GetPDGMass()/p->GetPDGMass();
for(G4int j=0; j<n; j++) {
if((vel[j])->Particle() == bp) {
currentModel = (vel[j])->SelectModelForMaterial(e, idx);
currentModel = (vel[j])->SelectModelForMaterial(scaledEnergy, idx);
isApplicable = true;
break;
}
}
}
// G4cout << "model= " << currentModel << G4endl;
break;
}
}
if(!currentModel) {
const std::vector<G4VEmProcess*> vem = lManager->GetEmProcessVector();
G4int n = vem.size();
for(G4int i=0; i<n; i++) {
if((vem[i])->GetProcessName() == currentName && (vem[i])->Particle() == part) {
if((vem[i])->GetProcessName() == currentName &&
(vem[i])->Particle() == part)
{
currentModel = (vem[i])->SelectModelForMaterial(kinEnergy, idx);
isApplicable = true;
break;
@@ -790,10 +949,13 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
}
if(!currentModel) {
const std::vector<G4VMultipleScattering*> vmsc = lManager->GetMultipleScatteringVector();
const std::vector<G4VMultipleScattering*> vmsc =
lManager->GetMultipleScatteringVector();
G4int n = vmsc.size();
for(G4int i=0; i<n; i++) {
if((vmsc[i])->GetProcessName() == currentName && (vmsc[i])->Particle() == part) {
if((vmsc[i])->GetProcessName() == currentName &&
(vmsc[i])->Particle() == part)
{
currentModel = (vmsc[i])->SelectModelForMaterial(kinEnergy, idx);
isApplicable = true;
break;
@@ -806,17 +968,19 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = 0;
G4VEnergyLossProcess* elp = 0;
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton")
part = G4GenericIon::GenericIon();
if(p->GetParticleType() == "nucleus" &&
partname != "deuteron" &&
partname != "triton") part = G4GenericIon::GenericIon();
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
if((vel[i])->Particle() == part) {
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.cc,v 1.13 2005/11/26 16:59:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCorrections.cc,v 1.20 2006/06/29 19:54:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -36,38 +39,55 @@
// Modifications:
// 05.05.2005 V.Ivanchenko Fix misprint in Mott term
// 26.11.2005 V.Ivanchenko Fix effective charge for heavy ions using original paper
// 28.04.2006 V.Ivanchenko General cleanup, add finite size corrections
// 13.05.2006 V.Ivanchenko Add corrections for ion stopping
//
//
// Class Description:
//
// This class provides calculation of EM corrections to ionisation
// This class provides calculation of EM corrections to ionisation
//
// -------------------------------------------------------------------
//
#include "G4EmCorrections.hh"
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4NistManager.hh"
#include "G4VEmModel.hh"
#include "G4Proton.hh"
#include "G4LPhysicsFreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCorrections::G4EmCorrections()
{
Initialise();
particle = 0;
curParticle= 0;
material = 0;
curMaterial= 0;
curVector = 0;
kinEnergy = 0.0;
ionModel = 0;
nIons = 0;
verbose = 1;
massFactor = 1.0;
nist = G4NistManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCorrections::~G4EmCorrections()
{}
{
for(G4int i=0; i<nIons; i++) {delete stopData[i];}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
@@ -76,131 +96,32 @@ G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
// valid for kineticEnergy < 0.5 MeV
// Other corrections from S.P.Ahlen Rev. Mod. Phys., Vol 52, No1, 1980
G4double tau = kineticEnergy / p->GetPDGMass();
SetupKinematics(p, mat, e);
if(tau <= 0.0) return 0.0;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double beta = std::sqrt(beta2);
G4double Barkas = BarkasCorrection (p, mat, e);
G4double Bloch = BlochCorrection (p, mat, e);
G4double Mott = MottCorrection (p, mat, e);
G4double FSize = FiniteSizeCorrection (p, mat, e);
G4double q = p->GetPDGCharge()/eplus;
if(q > 2.5) q *= (1.0 - std::exp(-130.0*beta/std::pow(q,0.66666667)));
else if(q > 1.5) q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double sum = (2.0*(Barkas + Bloch) + FSize + Mott);
G4double q2 = q*q;
G4double ba = beta2/alpha2;
G4double BarkasTerm = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
if(verbose > 1)
G4cout << "EmCorrections: E(MeV)= " << e/MeV << " Barkas= " << Barkas
<< " Bloch= " << Bloch << " Mott= " << Mott << " Fsize= " << FSize
<< " Sum= " << sum << G4endl;
G4double Zeff = 0.0;
G4double norm = 0.0;
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4int(Z);
G4double X = ba / Z;
// Variables to compute L_1
// G4double Eta0Chi = 0.8;
// G4double EtaChi = Eta0Chi * ( 1.0 + 6.02*std::pow( Z,-1.19 ) );
// G4double W = ( EtaChi * std::pow( Z,0.16666667 ) ) / std::sqrt(X);
G4double b = 1.3;
if(1 == iz) {
if(material->GetName() == "G4_lH2") b = 0.6;
else b = 1.8;
}
else if(2 == iz) b = 0.6;
else if(10 >= iz) b = 1.8;
else if(17 >= iz) b = 1.4;
else if(18 == iz) b = 1.8;
else if(25 >= iz) b = 1.4;
else if(50 >= iz) b = 1.35;
G4double W = b/std::sqrt(X);
G4double val;
if(W <= engBarkas[0]) val = corBarkas[0];
else if(W >= engBarkas[46]) val = corBarkas[46]*engBarkas[46]/W;
else {
G4int iw = Index(W, engBarkas, 47);
val = Value(W, engBarkas[iw], engBarkas[iw+1], corBarkas[iw], corBarkas[iw+1]);
}
BarkasTerm += 1.29*val*atomDensity[i] * std::sqrt(Z /X)/ X;
Zeff += Z*atomDensity[i];
norm += atomDensity[i];
}
Zeff /= norm;
BarkasTerm *= 2.0*q;
// L2 correction
G4double y2 = q2 / ba ;
G4double BlochTerm = 1.202;
if(y2 > 0.05) {
BlochTerm = 1.0 / (1.0 + y2) ;
G4double de = BlochTerm;
G4double i = 1.0;
do {
i += 1.0;
de = 1.0/( i * (i*i + y2));
BlochTerm += de;
} while (de > BlochTerm*0.01);
}
BlochTerm *= -2.0*y2;
// Estimation of mean square root of the ionisation potential
G4double ze = 2.0*Zeff;
G4double ze1 = std::log(ze);
G4double eexc= material->GetIonisation()->GetMeanExcitationEnergy()*ze1*ze1/ze;
G4double invbeta = 1.0/beta;
G4double invbeta2= invbeta*invbeta;
G4double za = q*fine_structure_const;
G4double za2 = za*za;
G4double za3 = za2*za;
G4double x = za*invbeta;
G4double cosx;
if(x < COSEB[13]) {
G4int i = Index(x,COSEB,14);
cosx = Value(x,COSEB[i], COSEB[i+1],COSXI[i],COSXI[i+1]);
} else {
cosx = COSXI[13]*COSEB[13]/x;
}
G4double mterm =
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))))
+ za2*(3.246 - 0.451*beta2)
+ za3*(1.522*beta + 0.987*invbeta)
+ za2*za2*(4.569 - 0.494*beta2 - 2.696*invbeta2)
+ za3*za2*(1.254*beta + 0.222*invbeta - 1.17*invbeta*invbeta2);
G4double eloss = (BarkasTerm + (BlochTerm + mterm)*material->GetElectronDensity()) *
q2 * twopi_mc2_rcl2 *invbeta2;
return eloss;
sum *= material->GetElectronDensity() * q2 * twopi_mc2_rcl2 /beta2;
return sum;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::Bethe(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double mass = p->GetPDGMass();
G4double ratio = electron_mass_c2/mass;
G4double tau = kineticEnergy / mass;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
SetupKinematics(p, mat, e);
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double eexc2 = eexc*eexc;
G4double dedx = 0.5*std::log(2.0*electron_mass_c2*bg2*tmax/eexc2)-beta2;
@@ -210,35 +131,22 @@ G4double G4EmCorrections::Bethe(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::SpinCorrection(const G4ParticleDefinition* p,
const G4Material*,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double mass = p->GetPDGMass();
G4double ratio = electron_mass_c2/mass;
G4double tau = kineticEnergy / mass;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
G4double dedx = 0.5*tmax/(kineticEnergy + mass);
SetupKinematics(p, mat, e);
G4double dedx = 0.5*tmax/(kinEnergy + mass);
return 0.5*dedx*dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
@@ -261,19 +169,11 @@ G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
@@ -288,7 +188,8 @@ G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
for(G4int j=1; j<nmax; j++) {
G4double ne = G4double(shells.GetNumberOfElectrons(iz,j));
G4double e1 = shells.GetBindingEnergy(iz,j);
// G4cout << "LShell: j= " << j << " ne= " << ne << " e(eV)= " << e/eV << " e0(eV)= " << e0/eV << G4endl;
// G4cout << "LShell: j= " << j << " ne= " << ne << " e(eV)= " << e/eV
// << " e0(eV)= " << e0/eV << G4endl;
term += f*ne*atomDensity[i]*LShell(e1/e0,ba2/Z2)/Z;
}
}
@@ -320,26 +221,29 @@ G4double G4EmCorrections::KShell(G4double tet, G4double eta)
G4int ieta = Index(y, Eta, nEtaK);
corr = Value2(x, y, TheK[itet], TheK[itet+1], Eta[ieta], Eta[ieta+1],
CK[itet][ieta], CK[itet+1][ieta], CK[itet][ieta+1], CK[itet+1][ieta+1]);
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheK[itet]<<" "<< TheK[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CK= " << CK[itet][ieta]<<" "<< CK[itet+1][ieta]<<" "<< CK[itet][ieta+1]<<" "<< CK[itet+1][ieta+1]<<G4endl;
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheK[itet]
//<<" "<< TheK[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CK= " << CK[itet][ieta]<<" "<< CK[itet+1][ieta]
//<<" "<< CK[itet][ieta+1]<<" "<< CK[itet+1][ieta+1]<<G4endl;
}
//G4cout << "Kshell: tet= " << tet << " eta= " << eta << " C= " << corr << " itet,ieta= " << itet <<G4endl;
//G4cout << "Kshell: tet= " << tet << " eta= " << eta << " C= " << corr
//<< " itet,ieta= " << itet <<G4endl;
return corr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::LShell(G4double tet, G4double eta)
G4double G4EmCorrections::LShell(G4double tet, G4double eta)
{
G4double corr = 0.0;
G4double x = tet;
if(tet < TheL[0]) x = TheL[0];
if(tet < TheL[0]) x = TheL[0];
G4int itet = Index(x, TheL, nL);
// assimptotic case
if(eta >= Eta[nEtaL-1]) {
corr = (Value(x, TheL[itet], TheL[itet+1], UL[itet], UL[itet+1])
corr = (Value(x, TheL[itet], TheL[itet+1], UL[itet], UL[itet+1])
+ Value(x, TheL[itet], TheL[itet+1], VL[itet], VL[itet+1])/eta
)/eta;
} else {
@@ -348,8 +252,10 @@ G4double G4EmCorrections::LShell(G4double tet, G4double eta)
G4int ieta = Index(y, Eta, nEtaL);
corr = Value2(x, y, TheL[itet], TheL[itet+1], Eta[ieta], Eta[ieta+1],
CL[itet][ieta], CL[itet+1][ieta], CL[itet][ieta+1], CL[itet+1][ieta+1]);
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheL[itet]<<" "<< TheL[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CL= " << CL[itet][ieta]<<" "<< CL[itet+1][ieta]<<" "<< CL[itet][ieta+1]<<" "<< CL[itet+1][ieta+1]<<G4endl;
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheL[itet]
//<<" "<< TheL[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CL= " << CL[itet][ieta]<<" "<< CL[itet+1][ieta]
//<<" "<< CL[itet][ieta+1]<<" "<< CL[itet+1][ieta+1]<<G4endl;
}
// G4cout << "Lshell: tet= " << tet << " eta= " << eta << " C= " << corr << " itet= " << itet <<G4endl;
return corr;
@@ -358,12 +264,11 @@ G4double G4EmCorrections::LShell(G4double tet, G4double eta)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::ShellCorrectionSTD(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double bg2 = tau * (tau+2.0);
G4double taulim= 8.0*MeV/p->GetPDGMass();
SetupKinematics(p, mat, e);
G4double taulim= 8.0*MeV/mass;
G4double bg2lim= taulim * (taulim+2.0);
G4double* shellCorrectionVector =
@@ -393,18 +298,12 @@ G4double G4EmCorrections::ShellCorrectionSTD(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
@@ -449,13 +348,13 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
if(28 >= iz) {
term += f*(Z - 10.)*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
} else if(32 >= iz) {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
} else if(60 >= iz) {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
term += f*(Z - 28.)*atomDensity[i]*LShell(eshell,HN[iz-33]*eta)/Z;
} else {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[53]*eta)/Z;
term += f*32.0*atomDensity[i]*LShell(eshell,HN[30]*eta)/Z;
term += f*32.0*atomDensity[i]*LShell(eshell,HN[30]*eta)/Z;
term += f*(Z - 60.)*atomDensity[i]*LShell(eshell,150.*eta)/Z;
}
*/
@@ -471,11 +370,10 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::DensityCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double bg2 = tau * (tau+2.0);
SetupKinematics(p, mat, e);
G4double cden = material->GetIonisation()->GetCdensity();
G4double mden = material->GetIonisation()->GetMdensity();
@@ -499,25 +397,16 @@ G4double G4EmCorrections::DensityCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
// Physical review B Vol.5 No.7 1 April 1972 pp. 2393-2397
// valid for kineticEnergy > 0.5 MeV
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double BarkasTerm = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
@@ -525,17 +414,11 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
G4int iz = G4int(Z);
G4double X = ba2 / Z;
// Variables to compute L_1
// G4double Eta0Chi = 0.8;
// G4double EtaChi = Eta0Chi * ( 1.0 + 6.02*std::pow( Z,-1.19 ) );
// G4double W = ( EtaChi * std::pow( Z,0.16666667 ) ) / std::sqrt(X);
G4double b = 1.3;
if(1 == iz) {
if(material->GetName() == "G4_lH2") b = 0.6;
else b = 1.8;
}
}
else if(2 == iz) b = 0.6;
else if(10 >= iz) b = 1.8;
else if(17 >= iz) b = 1.4;
@@ -552,28 +435,25 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
G4int iw = Index(W, engBarkas, 47);
val = Value(W, engBarkas[iw], engBarkas[iw+1], corBarkas[iw], corBarkas[iw+1]);
}
BarkasTerm += val*atomDensity[i] * std::sqrt(1.0/(Z*X))/ X;
// G4cout << "i= " << i << " b= " << b << " W= " << W
// << " Z= " << Z << " X= " << X << " val= " << val<< G4endl;
BarkasTerm += val*atomDensity[i] / (std::sqrt(Z*X)*X);
}
BarkasTerm *= q/material->GetTotNbOfAtomsPerVolume();
BarkasTerm *= 1.29*charge/material->GetTotNbOfAtomsPerVolume();
return BarkasTerm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::BlochCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
SetupKinematics(p, mat, e);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double q2 = q*q;
G4double y2 = q2/ba2;
G4double y2 = q2*alpha2 / beta2;
G4double term = 1.0/(1.0 + y2);
G4double del;
G4double j = 1.0;
@@ -589,26 +469,31 @@ G4double G4EmCorrections::BlochCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::MottCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double bg2 = tau*(tau + 2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double beta = std::sqrt(beta2);
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double mterm = 0.0;
SetupKinematics(p, mat, e);
G4double mterm = pi*fine_structure_const*beta*charge;
/*
G4double mterm = 0.0;
if(beta > 0.0) {
// Estimation of mean square root of the ionisation potential
G4double Zeff = 0.0;
G4double norm = 0.0;
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
Zeff += Z*atomDensity[i];
norm += atomDensity[i];
}
Zeff *= (2.0/norm);
G4double ze1 = std::log(Zeff);
G4double eexc= material->GetIonisation()->GetMeanExcitationEnergy()*ze1*ze1/Zeff;
G4double invbeta = 1.0/beta;
G4double invbeta2= invbeta*invbeta;
G4double za = q*fine_structure_const;
G4double za = charge*fine_structure_const;
G4double za2 = za*za;
G4double za3 = za2*za;
G4double x = za*invbeta;
@@ -621,47 +506,96 @@ G4double G4EmCorrections::MottCorrection(const G4ParticleDefinition* p,
}
mterm =
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))))
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))));
+ za2*(3.246 - 0.451*beta2)
+ za3*(1.522*beta + 0.987*invbeta)
+ za2*za2*(4.569 - 0.494*beta2 - 2.696*invbeta2)
+ za3*za2*(1.254*beta + 0.222*invbeta - 1.17*invbeta*invbeta2);
}
*/
return mterm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::FiniteSizeCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
G4double e)
// Finite size corrections are parameterized according to
// J.D.Jackson Phys. Rev. D59 (1998) 017301
{
SetupKinematics(p, mat, e);
G4double term = 0.0;
//Leptons
if(p->GetLeptonNumber() != 0) {
G4double x = tmax/(e + mass);
term = x*x;
// Pions and Kaons
} else if(p->GetPDGSpin() == 0.0 && q2 < 1.5) {
G4double xpi = 0.736*GeV;
G4double x = 2.0*electron_mass_c2*tmax0/(xpi*xpi);
term = -std::log(1.0 + x);
// Protons and baryons
} else if(q2 < 1.5) {
G4double xp = 0.8426*GeV;
G4double x = 2.0*electron_mass_c2*tmax0/(xp*xp);
G4double ksi2 = 2.79285*2.79285;
term = -x*(1.0 + 5.0*x/6.0)/((1.0 + x)*(1 + x)) - std::log(1.0 + x);
G4double b = xp*0.5/mass;
G4double c = xp*mass/(electron_mass_c2*(mass + e));
G4double lb = b*b;
G4double lb2= lb*lb;
G4double nu = 0.5*c*c;
G4double x1 = 1.0 + x;
G4double x2 = x1*x1;
G4double l1 = 1.0 - lb;
G4double l2 = l1*l1;
G4double lx = 1.0 + lb*x;
G4double ia = lb2*(lx*std::log(lx/x1)/x + l1 -
0.5*x*l2/(lb*x1) +
x*(3.0 + 2.0*x)*l2*l1/(6.0*x2*lb2))/(l2*l2);
G4double ib = x*x*(3.0 + x)/(6.0*x2*x1);
term += lb*((ksi2 - 1.0)*ia + nu*ksi2*ib);
// G4cout << "Proton F= " << term << " ia= " << ia << " ib= " << ib << " lb= " << lb<< G4endl;
//ions
} else {
G4double xp = 0.8426*GeV/std::pow(mass/proton_mass_c2,-0.33333333);
G4double x = 2.0*electron_mass_c2*tmax0/(xp*xp);
term = -std::log(1.0 + x);
//G4cout << "Ion F= " << term << G4endl;
}
return term;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearDEDX(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy,
G4bool fluct)
const G4Material* mat,
G4double e,
G4bool fluct)
{
G4double nloss = 0.0;
if(kineticEnergy <= 0.0) return nloss;
if(e <= 0.0) return nloss;
SetupKinematics(p, mat, e);
lossFlucFlag = fluct;
// Projectile nucleus
G4double z1 = std::abs((p->GetPDGCharge())/eplus) ;
G4double m1 = p->GetPDGMass()/amu_c2;
G4int NumberOfElements = material->GetNumberOfElements() ;
const G4ElementVector* theElementVector =
material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector() ;
G4double z1 = std::abs(particle->GetPDGCharge()/eplus);
G4double m1 = mass/amu_c2;
// loop for the elements in the material
for (G4int iel=0; iel<NumberOfElements; iel++) {
for (G4int iel=0; iel<numberOfElements; iel++) {
const G4Element* element = (*theElementVector)[iel] ;
G4double z2 = element->GetZ();
G4double m2 = element->GetA()*mole/g ;
nloss += (NuclearStoppingPower(kineticEnergy, z1, z2, m1, m2))
* theAtomicNumDensityVector[iel] ;
nloss += (NuclearStoppingPower(kinEnergy, z1, z2, m1, m2))
* atomDensity[iel] ;
}
nloss *= theZieglerFactor;
return nloss;
@@ -669,8 +603,8 @@ G4double G4EmCorrections::NuclearDEDX(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double z1, G4double z2,
G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double z1, G4double z2,
G4double m1, G4double m2)
{
G4double energy = kineticEnergy/keV ; // energy in keV
@@ -678,14 +612,14 @@ G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double rm;
if(z1 > 1.5) rm = (m1 + m2) * ( std::pow(z1, .23) + std::pow(z2, .23) ) ;
else rm = (m1 + m2) * std::pow(z2, 0.333333);
else rm = (m1 + m2) * std::pow(z2, 0.333333);
G4double er = 32.536 * m2 * energy / ( z1 * z2 * rm ) ; // reduced energy
for (G4int i=1; i<104; i++)
{
if (er > e[i]) {
nloss = (a[i] - a[i-1])*(er-e[i-1])/(e[i] - e[i-1]) + a[i-1];
if (er > ed[i]) {
nloss = (a[i] - a[i-1])*(er-ed[i-1])/(ed[i] - ed[i-1]) + a[i-1];
break;
}
}
@@ -696,17 +630,141 @@ G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
(4.0 + 0.197*std::pow(er,-1.6991)+6.584*std::pow(er,-1.0494))) ;
nloss *= G4RandGauss::shoot(1.0,sig) ;
}
}
nloss *= 8.462 * z1 * z2 * m1 / rm ; // Return to [ev/(10^15 atoms/cm^2]
if ( nloss < 0.0) nloss = 0.0 ;
return nloss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ionEffectiveCharge* G4EmCorrections::GetIonEffectiveCharge(G4VEmModel* m)
{
if(m) ionModel = m;
return &effCharge;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4EmCorrections::GetNumberOfStoppingVectors()
{
return nIons;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
G4double ekin)
{
G4double factor = 1.0;
if(p->GetPDGCharge() <= 2.5*eplus) return factor;
if(verbose > 1)
G4cout << "EffectiveChargeCorrection: " << p->GetParticleName() << " in " << mat->GetName()
<< " ekin(MeV)= " << ekin/MeV << G4endl;
if(p != curParticle || mat != curMaterial) {
curParticle = p;
curMaterial = 0;
curVector = 0;
G4int Z = p->GetAtomicNumber();
G4int A = p->GetAtomicMass();
if(verbose > 1) G4cout << "Zion= " << Z << " Aion= " << A << G4endl;
massFactor = proton_mass_c2/(nist->GetIsotopeMass(Z,A)*amu_c2);
idx = 0;
for(; idx<nIons; idx++) {
if(Z == Zion[idx] && A == Aion[idx]) {
if(materialList[idx] == mat) {
curMaterial = mat;
curVector = stopData[idx];
break;
} else if(materialList[idx] == 0) {
if(materialName[idx] == mat->GetName())
curVector = InitialiseMaterial(mat);
}
}
}
}
if(curVector) {
G4bool b;
factor = curVector->GetValue(ekin*massFactor,b);
}
if(verbose > 1) G4cout << " factor= " << factor << G4endl;
return factor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCorrections::AddStoppingData(G4int Z, G4int A,
const G4String& mname,
G4PhysicsVector& dVector)
{
idx = 0;
for(; idx<nIons; idx++) {
if(Z == Zion[idx] && A == Aion[idx] && mname == materialName[idx])
break;
}
if(idx == nIons) {
Zion.push_back(Z);
Aion.push_back(A);
materialName.push_back(mname);
materialList.push_back(0);
stopData.push_back(0);
nIons++;
} else {
if(stopData[idx]) delete stopData[idx];
}
size_t nbins = dVector.GetVectorLength();
size_t n = 0;
for(; n<nbins; n++) {
if(dVector.GetLowEdgeEnergy(n) > 2.0*MeV) break;
}
if(n < nbins) nbins = n + 1;
G4LPhysicsFreeVector* v =
new G4LPhysicsFreeVector(nbins,
dVector.GetLowEdgeEnergy(0),
dVector.GetLowEdgeEnergy(nbins-1));
G4bool b;
for(size_t i=0; i<nbins; i++) {
G4double e = dVector.GetLowEdgeEnergy(i);
G4double dedx = dVector.GetValue(e, b);
v->PutValues(i, e, dedx);
}
// G4cout << *v << G4endl;
stopData[idx] = v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4EmCorrections::InitialiseMaterial(const G4Material* mat)
{
G4PhysicsVector* v = 0;
const G4Material* m = nist->FindOrBuildMaterial(materialName[idx],false);
if(m) {
materialList[idx] = m;
curMaterial = mat;
v = stopData[idx];
size_t nbins = v->GetVectorLength();
const G4ParticleDefinition* p = G4Proton::Proton();
if(verbose>1) G4cout << "G4ionIonisation::InitialiseMaterial Stooping data for "
<< materialName[idx] << G4endl;
G4bool b;
for(size_t i=0; i<nbins; i++) {
G4double e = v->GetLowEdgeEnergy(i);
G4double dedx = v->GetValue(e, b);
G4double dedx1= ionModel->ComputeDEDXPerVolume(mat, p, e, e)*
effCharge.EffectiveChargeSquareRatio(curParticle,mat,e/massFactor);
v->PutValue(i, dedx/dedx1);
if(verbose>1) G4cout << " E(meV)= " << e/MeV << " Correction= " << dedx/dedx1
<< " " << dedx << " " << dedx1 << G4endl;
}
}
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCorrections::Initialise()
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
@@ -887,7 +945,7 @@ void G4EmCorrections::Initialise()
};
for(i=0; i<104; i++) {
e[i] = nuca[i][0];
ed[i] = nuca[i][0];
a[i] = nuca[i][1];
}
@@ -1322,7 +1380,7 @@ void G4EmCorrections::Initialise()
};
const G4double tau[93] = {
const G4double ntau[93] = {
0.0,
-251.1, 512.8, 1724, 649, 658.8, 594.1, 946.6, 969.2, 1154, 997.8,
939.3, 775.5, 619.9, 848.3, 973.4, 1035, 1252, 698.8, 1043, 1080,
@@ -1338,7 +1396,7 @@ void G4EmCorrections::Initialise()
for(i=0; i<93; i++) {
MSH[i] = mm[i];
TAU[i] = tau[i];
TAU[i] = ntau[i];
}
const G4double coseb[14] = {0.0,0.05,0.1,0.15,0.2,0.3,0.4,0.5,0.6,0.8,
1.0,1.2,1.5,2.0};
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc,v 1.31 2005/11/29 08:06:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmModelManager.cc,v 1.36 2006/06/29 19:55:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -53,6 +56,8 @@
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-08-05 Fix cut for e+e- pair production (V.Ivanchenko)
// 29-11-05 Add protection for arithmetic operations with cut=DBL_MAX (V.Ivanchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
//
// Class Description:
//
@@ -181,7 +186,8 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
G4VEmFluctuationModel* fm, const G4Region* r)
{
if(!p) {
G4cout << "G4EmModelManager::AddEmModel WARNING: no model defined." << G4endl;
G4cout << "G4EmModelManager::AddEmModel WARNING: no model defined."
<< G4endl;
return;
}
models.push_back(p);
@@ -209,7 +215,8 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::UpdateEmModel(const G4String& nam, G4double emin, G4double emax)
void G4EmModelManager::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
if (nEmModels) {
for(G4int i=0; i<nEmModels; i++) {
@@ -227,6 +234,19 @@ void G4EmModelManager::UpdateEmModel(const G4String& nam, G4double emin, G4doubl
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4EmModelManager::GetModel(G4int i)
{
G4VEmModel* m = 0;
if(i >= 0 && i < nEmModels) m = models[i];
else if(verboseLevel > 0)
G4cout << "G4EmModelManager::GetModel WARNING: "
<< "index " << i << " is wrong Nmodels= "
<< nEmModels << G4endl;
return m;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
const G4ParticleDefinition* sp,
G4double theMinSubRange,
@@ -248,7 +268,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
Clear();
G4RegionStore* regionStore = G4RegionStore::GetInstance();
const G4Region* world = regionStore->GetRegion("DefaultRegionForTheWorld", false);
const G4Region* world =
regionStore->GetRegion("DefaultRegionForTheWorld", false);
// Identify the list of regions with different set of models
nRegions = 1;
@@ -308,7 +329,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
if (n>0) tmin = std::max(tmin, eHigh[n-1]);
if(1 < verboseLevel) {
G4cout << "Model #" << ii << " <" << model->GetName() << "> for region <";
G4cout << "Model #" << ii
<< " <" << model->GetName() << "> for region <";
if (region) G4cout << region->GetName();
G4cout << "> "
<< " tmin(MeV)= " << tmin/MeV
@@ -351,7 +373,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
for(G4int i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
@@ -374,7 +397,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
if( secondaryParticle == G4Gamma::Gamma() ) idx = 0;
cut = (*theCoupleTable->GetEnergyCutsVector(idx))[i];
if( secondaryParticle == G4Positron::Positron() && cut < DBL_MAX )
cut += (*theCoupleTable->GetEnergyCutsVector(2))[i] + 2.0*electron_mass_c2;
cut += (*theCoupleTable->GetEnergyCutsVector(2))[i] +
2.0*electron_mass_c2;
if( cut < DBL_MAX ) subcut = minSubRange*cut;
}
@@ -385,14 +409,15 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
G4double tcutmin = model->MinEnergyCut(particle, couple);
cut = std::max(cut, tcutmin);
subcut = std::max(subcut, tcutmin);
if(cut < tcutmin) cut = tcutmin;
if(subcut < tcutmin) subcut = tcutmin;
if(1 < verboseLevel) {
G4cout << "The model # " << j
<< "; tcutmin(MeV)= " << tcutmin/MeV
<< "; tcut(MeV)= " << cut/MeV
<< "; tsubcut(MeV)= " << subcut/MeV
<< G4endl;
<< " for " << particle->GetParticleName()
<< G4endl;
}
}
theCuts.push_back(cut);
@@ -417,7 +442,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple)
const G4MaterialCutsCouple* couple,
G4EmTableType tType)
{
// vectors to provide continues dE/dx
@@ -429,11 +455,18 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double subcut = 0.0;
if(fTotal == tType) cut = DBL_MAX;
else if(fSubRestricted == tType) subcut = theSubCuts[i];
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVector() for "
<< couple->GetMaterial()->GetName()
<< " Ecut(MeV)= " << cut/MeV
<< " Ecut(MeV)= " << cut
<< " Esubcut(MeV)= " << subcut
<< " Type " << tType
<< " for " << particle->GetParticleName()
<< G4endl;
}
@@ -444,7 +477,6 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
dedxLow.resize(nmod);
dedxHigh.resize(nmod);
if(1 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
@@ -464,15 +496,27 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
dedxHigh[0] = 0.0;
if(model) dedxHigh[0] = model->ComputeDEDX(couple,particle,e,cut);
if(model && cut > subcut) {
dedxHigh[0] = model->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxHigh[0] -= model->ComputeDEDX(couple,particle,e,subcut);
}
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
e = upperEkin[regModels->ModelIndex(j)];
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
G4int idx = regModels->ModelIndex(j);
dedxLow[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxLow[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
if(subcut == cut) dedxLow[j] = 0.0;
e = upperEkin[idx];
dedxHigh[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxHigh[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
if(subcut == cut) dedxHigh[j] = 0.0;
}
for(j=1; j<nmod; j++) {
@@ -502,115 +546,20 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
model = models[regModels->ModelIndex(k)];
G4double dedx = 0.0;
if(model) dedx = model->ComputeDEDX(couple,particle,e,cut)*fac;
if(dedx < 0.0) dedx = 0.0;
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
<< " fac= " << fac
<< G4endl;
}
aVector->PutValue(j, dedx);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillDEDXVectorForPreciseRange(
G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple)
{
// vectors to provide continues dE/dx
G4DataVector factor;
G4DataVector dedxLow;
G4DataVector dedxHigh;
G4double e;
size_t i = couple->GetIndex();
if(2 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVectorForPreciseRange() for "
<< couple->GetMaterial()->GetName()
<< G4endl;
}
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
factor.resize(nmod);
dedxLow.resize(nmod);
dedxHigh.resize(nmod);
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
<< " at the region #" << reg
<< G4endl;
}
// calculate factors to provide continuity of energy loss
factor[0] = 1.0;
G4int j;
G4int totBinsLoss = aVector->GetVectorLength();
dedxLow[0] = 0.0;
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
dedxHigh[0] = 0.0;
if(model) dedxHigh[0] = model->ComputeDEDX(couple,particle,e,e);
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
e = upperEkin[regModels->ModelIndex(j)];
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
}
for(j=1; j<nmod; j++) {
if(dedxLow[j] > 0.0) factor[j] = (dedxHigh[j-1]/dedxLow[j] - 1.0);
else factor[j] = 0.0;
}
if(2 < verboseLevel) {
G4cout << "Loop over " << totBinsLoss << " bins start " << G4endl;
}
}
// Calculate energy losses vector
for(j=0; j<totBinsLoss; j++) {
G4double e = aVector->GetLowEdgeEnergy(j);
G4double fac = 1.0;
// Choose a model of energy losses
G4int k = 0;
if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
do {
k++;
fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
} while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
}
model = models[regModels->ModelIndex(k)];
G4double dedx = 0.0;
if(model) dedx = model->ComputeDEDX(couple,particle,e,e)*fac;
G4double dedx0 = 0.0;
if(model && cut > subcut) {
dedx = model->ComputeDEDX(couple,particle,e,cut);
dedx0 = dedx;
if(subcut > 0.0) dedx -= model->ComputeDEDX(couple,particle,e,subcut);
dedx *= fac;
}
if(dedx < 0.0) dedx = 0.0;
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
<< " dEdx0(MeV/mm)= " << dedx0*mm/MeV
<< " fac= " << fac
<< G4endl;
}
@@ -621,28 +570,35 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4bool startFromNull)
const G4MaterialCutsCouple* couple,
G4bool startFromNull,
G4EmTableType tType)
{
// vectors to provide continues dE/dx
// vectors to provide continues cross section
G4DataVector factor;
G4DataVector sigmaLow;
G4DataVector sigmaHigh;
G4double e;
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double tmax = DBL_MAX;
if (fSubRestricted == tType) {
tmax = cut;
cut = theSubCuts[i];
}
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillLambdaVector() for particle "
<< particle->GetParticleName()
<< " in " << couple->GetMaterial()->GetName()
<< " Ecut(MeV)= " << cut
<< " Emax(MeV)= " << tmax
<< " Type " << tType
<< G4endl;
}
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
@@ -665,7 +621,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
sigmaHigh[0] = 0.0;
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,cut,e);
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,cut,tmax);
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
@@ -675,7 +631,8 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
<< " Emax(MeV)= " << e/MeV
<< " nbins= " << totBinsLambda
<< G4endl;
G4cout << " model #0 eUp= " << e << " sigmaUp= " << sigmaHigh[0] << G4endl;
G4cout << " model #0 eUp= " << e
<< " sigmaUp= " << sigmaHigh[0] << G4endl;
}
@@ -684,9 +641,11 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
sigmaLow[j] =
models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
e = upperEkin[regModels->ModelIndex(j)];
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
sigmaHigh[j] =
models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
if(1 < verboseLevel) {
G4cout << " model #" << j << " eUp= " << e
<< " sigmaUp= " << sigmaHigh[j]
@@ -717,119 +676,15 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
model = models[regModels->ModelIndex(k)];
G4double cross = 0.0;
if(model) cross = model->CrossSection(couple,particle,e,cut,e)*fac;
if(model) cross = model->CrossSection(couple,particle,e,cut,tmax)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(2 < verboseLevel) {
G4cout << "FillLambdaVector: " << j << ". e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac << " k= " << k << " model= " << regModels->ModelIndex(k)
<< G4endl;
}
if(cross < 0.0) cross = 0.0;
aVector->PutValue(j, cross);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4bool startFromNull)
{
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillSubLambdaTable() for particle "
<< particle->GetParticleName() << G4endl;
}
// vectors to provide continues dE/dx
G4DataVector factor;
G4DataVector sigmaLow;
G4DataVector sigmaHigh;
G4double e;
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double subcut = theSubCuts[i];
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
factor.resize(nmod);
sigmaLow.resize(nmod);
sigmaHigh.resize(nmod);
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName() << G4endl;
}
// calculate factors to provide continuity of energy loss
factor[0] = 1.0;
G4int j;
G4int totBinsLambda = aVector->GetVectorLength();
sigmaLow[0] = 0.0;
e = upperEkin[regModels->ModelIndex(0)];
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
<< " are available " << nmod
<< " models"
<< " Ecut(MeV)= " << cut/MeV
<< " nbins= " << totBinsLambda
<< G4endl;
}
G4VEmModel* model = models[regModels->ModelIndex(0)];
sigmaHigh[0] = 0.0;
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,subcut,cut);
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,subcut,cut);
e = upperEkin[regModels->ModelIndex(j)];
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,subcut,cut);
}
for(j=1; j<nmod; j++) {
if(sigmaLow[j] > 0.0) factor[j] = (sigmaHigh[j-1]/sigmaLow[j] - 1.0);
else factor[j] = 0.0;
}
}
// Calculate energy losses vector
for(j=0; j<totBinsLambda; j++) {
e = aVector->GetLowEdgeEnergy(j);
// Choose a model of energy losses
G4int k = 0;
G4double fac = 1.0;
if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
do {
k++;
fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
} while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
}
model = models[regModels->ModelIndex(k)];
G4double cross = 0.0;
if(model) cross = model->CrossSection(couple,particle,e,subcut,cut)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(2 < verboseLevel) {
G4cout << "BuildLambdaTable: e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac
<< G4endl;
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac << " k= " << k
<< " model= " << regModels->ModelIndex(k)
<< G4endl;
}
if(cross < 0.0) cross = 0.0;
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.cc,v 1.4 2005/04/15 11:40:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmMultiModel.cc,v 1.5 2006/06/29 19:55:03 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.cc,v 1.11 2005/12/05 12:13:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmProcessOptions.cc,v 1.18 2006/06/29 19:55:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -37,6 +40,9 @@
// Modifications:
// 30-06-04 G4EmProcess is pure discrete (V.Ivanchenko)
// 24-03-05 Add ApplyCuts and RandomStep (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit to G4LossTableManager (V.Ivantchenko)
// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
//
// Class Description:
//
@@ -173,14 +179,14 @@ void G4EmProcessOptions::SetMaxEnergy(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMaxEnergyForPreciseRange(G4double val)
void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
for(itr = v.begin(); itr != v.end(); itr++) {
G4VEnergyLossProcess* p = *itr;
if(p) p->SetMaxKinEnergyForPreciseRange(val);
if(p) p->SetMaxKinEnergyForCSDARange(val);
}
}
@@ -238,14 +244,14 @@ void G4EmProcessOptions::SetDEDXBinning(G4int val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDEDXBinningForPreciseRange(G4int val)
void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int val)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
for(itr = v.begin(); itr != v.end(); itr++) {
G4VEnergyLossProcess* p = *itr;
if(p) p->SetDEDXBinningForPreciseRange(val);
if(p) p->SetDEDXBinningForCSDARange(val);
}
}
@@ -278,7 +284,7 @@ void G4EmProcessOptions::SetLambdaBinning(G4int val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetStepLimits(G4double v1, G4double v2)
void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
@@ -317,9 +323,9 @@ void G4EmProcessOptions::SetApplyCuts(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBuildPreciseRange(G4bool val)
void G4EmProcessOptions::SetBuildCSDARange(G4bool val)
{
theManager->SetBuildPreciseRange(val);
theManager->SetBuildCSDARange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -400,15 +406,24 @@ void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscStepLimitation(G4bool algorithm, G4double factor)
void G4EmProcessOptions::SetMscStepLimitation(G4bool algorithm,
G4double factor)
{
const std::vector<G4VMultipleScattering*>& u =
theManager->GetMultipleScatteringVector();
std::vector<G4VMultipleScattering*>::const_iterator itm;
for(itm = u.begin(); itm != u.end(); itm++) {
G4VMultipleScattering* s = *itm;
if(s) s->MscStepLimitation(algorithm, factor);
}
theManager->SetMscStepLimitation(algorithm, factor);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLPMFlag(G4bool val)
{
theManager->SetLPMFlag(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBremsstrahlungTh(G4double val)
{
theManager->SetBremsstrahlungTh(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,29 +1,48 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.cc,v 1.12 2005/11/11 23:28:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossMessenger.cc,v 1.20 2006/06/29 19:55:07 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EnergyLossMessenger
//
// Author: Michel Maire
//
// Creation date: 22-06-2000
//
// Modifications:
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -91,7 +110,8 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetGuidance("unit of finalRange");
unitPrm->SetDefaultValue("mm");
G4String unitCandidates = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
G4String unitCandidates =
G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
unitPrm->SetParameterCandidates(unitCandidates);
StepFuncCmd->SetParameter(unitPrm);
@@ -115,17 +135,38 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
IntegCmd->SetDefaultValue(true);
IntegCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
rangeCmd = new G4UIcmdWithABool("/process/eLoss/preciseRange",this);
rangeCmd = new G4UIcmdWithABool("/process/eLoss/CSDARange",this);
rangeCmd->SetGuidance("Switch true/false the precise range calculation.");
rangeCmd->SetParameterName("range",true);
rangeCmd->SetDefaultValue(true);
rangeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lpmCmd = new G4UIcmdWithABool("/process/eLoss/LPM",this);
lpmCmd->SetGuidance("Switch true/false the LPM effect calculation.");
lpmCmd->SetParameterName("lpm",true);
lpmCmd->SetDefaultValue(true);
lpmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verCmd = new G4UIcmdWithAnInteger("/process/eLoss/verbose",this);
verCmd->SetGuidance("Set verbose level for EM physics.");
verCmd->SetParameterName("verb",true);
verCmd->SetDefaultValue(true);
verCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mscCmd = new G4UIcommand("/process/eLoss/MscStepLimit",this);
mscCmd->SetGuidance("Set msc step limit flag and facRange value.");
G4UIparameter* facRange = new G4UIparameter("facRange",'d',false);
facRange->SetGuidance("msc parameter facRange");
facRange->SetParameterRange("facRange>0.");
mscCmd->SetParameter(facRange);
G4UIparameter* msc = new G4UIparameter("algMsc",'s',true);
msc->SetGuidance("msc step algorithm flag");
msc->SetDefaultValue("true");
mscCmd->SetParameter(msc);
mscCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -142,7 +183,9 @@ G4EnergyLossMessenger::~G4EnergyLossMessenger()
delete MaxEnCmd;
delete IntegCmd;
delete rangeCmd;
delete lpmCmd;
delete verCmd;
delete mscCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -166,7 +209,8 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
}
if (command == MinSubSecCmd)
{ G4VEnergyLoss::SetMinDeltaCutInRange(MinSubSecCmd->GetNewDoubleValue(newValue));
{ G4VEnergyLoss::SetMinDeltaCutInRange(
MinSubSecCmd->GetNewDoubleValue(newValue));
}
if (command == StepFuncCmd)
@@ -177,7 +221,18 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
G4VEnergyLoss::SetStepFunction(v1,v2);
lossTables->SetStepLimits(v1,v2);
lossTables->SetStepFunction(v1,v2);
}
if (command == mscCmd)
{
G4double f;
G4bool a = true;
G4String s;
std::istringstream is(newValue);
is >> f >> s;
if(s == "false" || s == "0" || s == "no") a = false;
lossTables->SetMscStepLimitation(a,f);
}
if (command == MinEnCmd) {
@@ -191,7 +246,10 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
lossTables->SetIntegral(IntegCmd->GetNewBoolValue(newValue));
}
if (command == rangeCmd) {
lossTables->SetBuildPreciseRange(rangeCmd->GetNewBoolValue(newValue));
lossTables->SetBuildCSDARange(rangeCmd->GetNewBoolValue(newValue));
}
if (command == lpmCmd) {
lossTables->SetLPMFlag(lpmCmd->GetNewBoolValue(newValue));
}
if (command == verCmd) {
lossTables->SetVerbose(verCmd->GetNewIntValue(newValue));
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.cc,v 1.32 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossTables.cc,v 1.33 2006/06/29 19:55:09 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.cc,v 1.17 2005/04/12 18:13:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableBuilder.cc,v 1.20 2006/06/29 19:55:11 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -40,6 +43,7 @@
// 21-07-04 V.Ivanchenko Fix problem of range for dedx=0
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 07-12-04 Fix of BuildDEDX table (V.Ivantchenko)
// 27-03-06 Add bool options isIonisation (V.Ivantchenko)
//
// Class Description:
//
@@ -55,6 +59,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LossTableBuilder::G4LossTableBuilder()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LossTableBuilder::~G4LossTableBuilder()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
const std::vector<G4PhysicsTable*>& list)
{
@@ -86,7 +100,8 @@ void G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
G4PhysicsTable* rangeTable)
G4PhysicsTable* rangeTable,
G4bool isIonisation)
// Build range table from the energy loss table
{
size_t n_vectors = dedxTable->length();
@@ -98,7 +113,7 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
for (size_t i=0; i<n_vectors; i++) {
if (rangeTable->GetFlag(i)) {
if (rangeTable->GetFlag(i) || !isIonisation) {
G4PhysicsVector* pv = (*dedxTable)[i];
size_t nbins = pv->GetVectorLength();
size_t bin0 = 0;
@@ -156,7 +171,8 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
G4PhysicsTable* invRangeTable)
G4PhysicsTable* invRangeTable,
G4bool isIonisation)
// Build inverse range table from the energy loss table
{
size_t n_vectors = rangeTable->length();
@@ -165,7 +181,7 @@ void G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable
for (size_t i=0; i<n_vectors; i++) {
if (invRangeTable->GetFlag(i)) {
if (invRangeTable->GetFlag(i) || !isIonisation) {
G4PhysicsVector* pv = (*rangeTable)[i];
size_t nbins = pv->GetVectorLength();
G4double elow = pv->GetLowEdgeEnergy(0);
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc,v 1.61 2005/10/27 15:05:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableManager.cc,v 1.72.2.1 2006/06/29 19:55:13 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -56,6 +59,11 @@
// 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
// 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
// 23-03-06 Set flag isIonisation (VI)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
//
// Class Description:
//
@@ -77,6 +85,8 @@
#include "G4ProductionCutsTable.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4EmCorrections.hh"
#include "G4EmTableType.hh"
#include "G4LossTableBuilder.hh"
G4LossTableManager* G4LossTableManager::theInstance = 0;
@@ -136,11 +146,16 @@ G4LossTableManager::G4LossTableManager()
emCorrections= new G4EmCorrections();
integral = true;
integralActive = false;
buildPreciseRange = false;
buildCSDARange = false;
minEnergyActive = false;
maxEnergyActive = false;
maxEnergyForMuonsActive = false;
stepFunctionActive = false;
flagLPM = true;
flagMSC = true;
facRange = 0.02;
bremsTh = DBL_MAX;
mscActive = false;
verbose = 1;
}
@@ -161,6 +176,7 @@ void G4LossTableManager::Clear()
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
}
@@ -177,6 +193,7 @@ void G4LossTableManager::Register(G4VEnergyLossProcess* p)
range_vector.push_back(0);
inv_range_vector.push_back(0);
tables_are_built.push_back(false);
isActive.push_back(true);
all_tables_are_built = false;
if(!lossFluctuationFlag) p->SetLossFluctuations(false);
if(subCutoffFlag) p->ActivateSubCutoff(true);
@@ -185,7 +202,8 @@ void G4LossTableManager::Register(G4VEnergyLossProcess* p)
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -202,8 +220,10 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
void G4LossTableManager::Register(G4VMultipleScattering* p)
{
msc_vector.push_back(p);
if(mscActive) p->MscStepLimitation(flagMSC, facRange);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VMultipleScattering : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VMultipleScattering : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -222,7 +242,8 @@ void G4LossTableManager::Register(G4VEmProcess* p)
{
emp_vector.push_back(p);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEmProcess : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VEmProcess : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -237,15 +258,17 @@ void G4LossTableManager::DeRegister(G4VEmProcess* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion, G4VEnergyLossProcess* p)
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion,
G4VEnergyLossProcess* p)
{
loss_map[ion] = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::RegisterExtraParticle(const G4ParticleDefinition* part,
G4VEnergyLossProcess* p)
void G4LossTableManager::RegisterExtraParticle(
const G4ParticleDefinition* part,
G4VEnergyLossProcess* p)
{
n_loss++;
loss_vector.push_back(p);
@@ -261,36 +284,45 @@ void G4LossTableManager::RegisterExtraParticle(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::EnergyLossProcessIsInitialised(
const G4ParticleDefinition* particle, G4VEnergyLossProcess* p)
const G4ParticleDefinition* particle,
G4VEnergyLossProcess* p)
{
if (first_entry || (particle == firstParticle && all_tables_are_built) ) {
all_tables_are_built = true;
if(1 < verbose)
G4cout << "### G4LossTableManager start initilisation of tables"
<< G4endl;
for (G4int i=0; i<n_loss; i++) {
G4VEnergyLossProcess* el = loss_vector[i];
if(el) {
const G4ProcessManager* pm = el->GetProcessManager();
if (pm->GetProcessActivation(el)) tables_are_built[i] = false;
else tables_are_built[i] = true;
if (!tables_are_built[i]) all_tables_are_built = false;
isActive[i] = pm->GetProcessActivation(el);
tables_are_built[i] = false;
all_tables_are_built = false;
if(1 < verbose) {
G4cout << i <<". "<< el->GetProcessName()
<< " for " << pm->GetParticleType()->GetParticleName()
<< " active= " << pm->GetProcessActivation(el)
<< " table= " << tables_are_built[i]
<< " isIonisation= " << el->IsIonisationProcess()
<< G4endl;
}
} else {
tables_are_built[i] = true;
part_vector[i] = 0;
}
}
if (first_entry) {
first_entry = false;
firstParticle = particle;
}
}
if(!all_tables_are_built) loss_map.clear();
currentParticle = 0;
SetParameters(p);
for (G4int j=0; j<n_loss; j++) {
if (p == loss_vector[j]) {
@@ -325,7 +357,8 @@ G4EnergyLossMessenger* G4LossTableManager::GetMessenger()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle)
void G4LossTableManager::ParticleHaveNoLoss(
const G4ParticleDefinition* aParticle)
{
G4String s = "G4LossTableManager:: dE/dx table not found for "
+ aParticle->GetParticleName() + "!";
@@ -333,19 +366,19 @@ void G4LossTableManager::ParticleHaveNoLoss(const G4ParticleDefinition* aParticl
exit(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4LossTableManager::BuildPreciseRange() const
G4bool G4LossTableManager::BuildCSDARange() const
{
return buildPreciseRange;
return buildCSDARange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p)
void G4LossTableManager::BuildPhysicsTable(
const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p)
{
if(1 < verbose) {
G4cout << "### G4LossTableManager::BuildDEDXTable() is requested for "
<< aParticle->GetParticleName()
@@ -356,12 +389,10 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
all_tables_are_built = true;
for(G4int i=0; i<n_loss; i++) {
if(!tables_are_built[i] && !base_part_vector[i]) {
const G4ParticleDefinition* curr_part = part_vector[i];
G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
CopyTables(curr_part, curr_proc);
if(curr_proc) CopyTables(curr_part, curr_proc);
}
}
@@ -382,7 +413,7 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
G4VEnergyLossProcess* base_proc)
@@ -390,17 +421,20 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
for (G4int j=0; j<n_loss; j++) {
G4VEnergyLossProcess* proc = loss_vector[j];
if(proc == base_proc || proc->Particle() == part) tables_are_built[j] = true;
if(proc == base_proc || proc->Particle() == part)
tables_are_built[j] = true;
if (!tables_are_built[j] && part == base_part_vector[j]) {
tables_are_built[j] = true;
proc->SetDEDXTable(base_proc->DEDXTable());
proc->SetDEDXTableForSubsec(base_proc->DEDXTableForSubsec());
proc->SetDEDXunRestrictedTable(base_proc->DEDXunRestrictedTable());
proc->SetPreciseRangeTable(base_proc->PreciseRangeTable());
proc->SetCSDARangeTable(base_proc->CSDARangeTable());
proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
proc->SetInverseRangeTable(base_proc->InverseRangeTable());
proc->SetLambdaTable(base_proc->LambdaTable());
proc->SetSubLambdaTable(base_proc->SubLambdaTable());
proc->SetIonisation(base_proc->IsIonisationProcess());
loss_map[part_vector[j]] = proc;
if (1 < verbose) {
G4cout << "For " << proc->GetProcessName()
@@ -416,47 +450,59 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition* aParticle)
G4VEnergyLossProcess* G4LossTableManager::BuildTables(
const G4ParticleDefinition* aParticle)
{
if(1 < verbose) {
G4cout << "G4LossTableManager::BuildTables() for "
<< aParticle->GetParticleName() << G4endl;
}
std::vector<G4PhysicsTable*> list;
list.clear();
std::vector<G4PhysicsTable*> list;
std::vector<G4VEnergyLossProcess*> loss_list;
loss_list.clear();
G4VEnergyLossProcess* em = 0;
G4VEnergyLossProcess* p = 0;
G4int iem = 0;
G4PhysicsTable* dedx = 0;
G4int i;
for (G4int i=0; i<n_loss; i++) {
if (aParticle == part_vector[i] && !tables_are_built[i] && loss_vector[i]) {
if (loss_vector[i]->IsIonisationProcess() || !em) {
em = loss_vector[i];
for (i=0; i<n_loss; i++) {
p = loss_vector[i];
if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
if (p->IsIonisationProcess() && isActive[i] || !em || em && !isActive[iem] ) {
em = p;
iem= i;
}
list.push_back(loss_vector[i]->BuildDEDXTable());
loss_list.push_back(loss_vector[i]);
dedx = p->BuildDEDXTable(fRestricted);
p->SetDEDXTable(dedx);
list.push_back(dedx);
loss_list.push_back(p);
tables_are_built[i] = true;
}
}
G4int n_dedx = list.size();
if (!n_dedx) return 0;
if (!n_dedx) {
G4cout << "G4LossTableManager WARNING: no DEDX processes for "
<< aParticle->GetParticleName() << G4endl;
return 0;
}
G4int nSubRegions = em->NumberOfSubCutoffRegions();
if (1 < verbose) {
G4cout << "G4LossTableManager::BuildTables() start to build range tables"
<< " and the sum of " << n_dedx << " processes"
<< " iem= " << iem << " em= " << em
<< " iem= " << iem << " em= " << em->GetProcessName()
<< " buildCSDARange= " << buildCSDARange
<< " nSubRegions= " << nSubRegions
<< G4endl;
}
G4PhysicsTable* dedx = em->DEDXTable();
dedx = em->DEDXTable();
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedx, list);
dedx_vector[iem] = dedx;
G4PhysicsTable* range = em->RangeTableForLoss();
@@ -467,34 +513,54 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
if(!invrange) invrange = G4PhysicsTableHelper::PreparePhysicsTable(invrange);
inv_range_vector[iem] = invrange;
tableBuilder->BuildRangeTable(dedx, range);
tableBuilder->BuildInverseRangeTable(range, invrange);
G4bool flag = em->IsIonisationProcess();
tableBuilder->BuildRangeTable(dedx, range, flag);
tableBuilder->BuildInverseRangeTable(range, invrange, flag);
if(buildPreciseRange) {
std::vector<G4PhysicsTable*> newlist;
newlist.clear();
G4PhysicsTable* dedxForRange = em->DEDXunRestrictedTable();
for (G4int i=0; i<n_dedx; i++) {
newlist.push_back(loss_list[i]->BuildDEDXTableForPreciseRange());
}
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedxForRange, newlist);
// if(1<verbose) G4cout << *dedx << G4endl;
em->SetDEDXunRestrictedTable(dedxForRange);
range = em->PreciseRangeTable();
if(!range) range = G4PhysicsTableHelper::PreparePhysicsTable(range);
tableBuilder->BuildRangeTable(dedxForRange, range);
em->SetPreciseRangeTable(range);
}
em->SetRangeTableForLoss(range);
em->SetInverseRangeTable(invrange);
loss_map[aParticle] = em;
for (G4int j=0; j<n_dedx; j++) {
G4VEnergyLossProcess* p = loss_list[j];
p->SetLambdaTable(p->BuildLambdaTable());
if(1<verbose) G4cout << *range << G4endl;
std::vector<G4PhysicsTable*> listSub;
std::vector<G4PhysicsTable*> listCSDA;
for (i=0; i<n_dedx; i++) {
p = loss_list[i];
p->SetIonisation(false);
p->SetLambdaTable(p->BuildLambdaTable(fRestricted));
if (0 < p->NumberOfSubCutoffRegions()) {
p->SetSubLambdaTable(p->BuildLambdaSubTable());
if( p != em) em->AddCollaborativeProcess(p);
dedx = p->BuildDEDXTable(fSubRestricted);
p->SetDEDXTableForSubsec(dedx);
listSub.push_back(dedx);
p->SetSubLambdaTable(p->BuildLambdaTable(fSubRestricted));
}
if(buildCSDARange) {
dedx = p->BuildDEDXTable(fTotal);
p->SetDEDXunRestrictedTable(dedx);
listCSDA.push_back(dedx);
}
}
if (0 < nSubRegions) {
G4PhysicsTable* dedxSub = em->DEDXTableForSubsec();
if (1 < listSub.size()) tableBuilder->BuildDEDXTable(dedxSub, listSub);
em->SetDEDXTableForSubsec(dedxSub);
}
if(buildCSDARange) {
G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedxCSDA, listCSDA);
em->SetDEDXunRestrictedTable(dedxCSDA);
G4PhysicsTable* rCSDA = em->CSDARangeTable();
if(!rCSDA) range = G4PhysicsTableHelper::PreparePhysicsTable(rCSDA);
tableBuilder->BuildRangeTable(dedxCSDA, rCSDA, flag);
em->SetCSDARangeTable(rCSDA);
}
em->SetIonisation(true);
loss_map[aParticle] = em;
if (1 < verbose) {
G4cout << "G4LossTableManager::BuildTables: Tables are built for "
<< aParticle->GetParticleName()
@@ -504,7 +570,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
return em;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLossFluctuations(G4bool val)
{
@@ -514,7 +580,7 @@ void G4LossTableManager::SetLossFluctuations(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetSubCutoff(G4bool val)
{
@@ -524,7 +590,7 @@ void G4LossTableManager::SetSubCutoff(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetIntegral(G4bool val)
{
@@ -539,7 +605,7 @@ void G4LossTableManager::SetIntegral(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMinSubRange(G4double val)
{
@@ -549,12 +615,12 @@ void G4LossTableManager::SetMinSubRange(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetRandomStep(G4bool)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMinEnergy(G4double val)
{
@@ -573,7 +639,7 @@ void G4LossTableManager::SetMinEnergy(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergy(G4double val)
{
@@ -592,16 +658,16 @@ void G4LossTableManager::SetMaxEnergy(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergyForPreciseRange(G4double val)
void G4LossTableManager::SetMaxEnergyForCSDARange(G4double val)
{
for(G4int i=0; i<n_loss; i++) {
if(loss_vector[i]) loss_vector[i]->SetMaxKinEnergyForPreciseRange(val);
if(loss_vector[i]) loss_vector[i]->SetMaxKinEnergyForCSDARange(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergyForMuons(G4double val)
{
@@ -609,7 +675,7 @@ void G4LossTableManager::SetMaxEnergyForMuons(G4double val)
maxKinEnergyForMuons = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetDEDXBinning(G4int val)
{
@@ -619,16 +685,16 @@ void G4LossTableManager::SetDEDXBinning(G4int val)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetDEDXBinningForPreciseRange(G4int val)
void G4LossTableManager::SetDEDXBinningForCSDARange(G4int val)
{
for(G4int i=0; i<n_loss; i++) {
if(loss_vector[i]) loss_vector[i]->SetDEDXBinningForPreciseRange(val);
if(loss_vector[i]) loss_vector[i]->SetDEDXBinningForCSDARange(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLambdaBinning(G4int val)
{
@@ -645,7 +711,7 @@ void G4LossTableManager::SetLambdaBinning(G4int val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetVerbose(G4int val)
{
@@ -663,9 +729,9 @@ void G4LossTableManager::SetVerbose(G4int val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetStepLimits(G4double v1, G4double v2)
void G4LossTableManager::SetStepFunction(G4double v1, G4double v2)
{
stepFunctionActive = true;
maxRangeVariation = v1;
@@ -675,14 +741,14 @@ void G4LossTableManager::SetStepLimits(G4double v1, G4double v2)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetBuildPreciseRange(G4bool val)
void G4LossTableManager::SetBuildCSDARange(G4bool val)
{
buildPreciseRange = val;
buildCSDARange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetParameters(G4VEnergyLossProcess* p)
{
@@ -693,25 +759,82 @@ void G4LossTableManager::SetParameters(G4VEnergyLossProcess* p)
p->SetVerboseLevel(verbose);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VEnergyLossProcess*>& G4LossTableManager::GetEnergyLossProcessVector()
const std::vector<G4VEnergyLossProcess*>&
G4LossTableManager::GetEnergyLossProcessVector()
{
return loss_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VEmProcess*>& G4LossTableManager::GetEmProcessVector()
{
return emp_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VMultipleScattering*>& G4LossTableManager::GetMultipleScatteringVector()
const std::vector<G4VMultipleScattering*>&
G4LossTableManager::GetMultipleScatteringVector()
{
return msc_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLPMFlag(G4bool val)
{
flagLPM = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4LossTableManager::LPMFlag() const
{
return flagLPM;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetMscStepLimitation(G4bool val, G4double factor)
{
mscActive = true;
flagMSC = val;
facRange = factor;
size_t msc = msc_vector.size();
for (size_t j=0; j<msc; j++) {
if(msc_vector[j]) msc_vector[j]->MscStepLimitation(val, factor);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4LossTableManager::MscFlag() const
{
return flagMSC;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LossTableManager::FacRange() const
{
return facRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetBremsstrahlungTh(G4double val)
{
bremsTh = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LossTableManager::BremsstrahlungTh() const
{
return bremsTh;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.cc,v 1.1 2005/07/25 18:14:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmFluctuationModel.cc,v 1.2 2006/06/29 19:55:15 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc,v 1.3 2005/10/25 18:28:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmModel.cc,v 1.6 2006/06/29 19:55:17 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +39,7 @@
//
// Modifications:
// 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
// 06.02.2006 add method ComputeMeanFreePath() (mma)
//
//
// Class Description:
@@ -47,22 +51,25 @@
#include "G4VEmModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEmModel::G4VEmModel(const G4String& nam):
lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEmModel::~G4VEmModel()
{}
G4double G4VEmModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
@@ -71,12 +78,26 @@ G4double G4VEmModel::CrossSectionPerVolume(
for (size_t i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
cross += theAtomNumDensityVector[i]*
ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
xsec[i] = cross;
}
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
G4double ekin,
const G4Material* material,
G4double emin,
G4double emax)
{
G4double mfp = DBL_MAX;
G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
if (cross >0.) mfp = 1./cross;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc,v 1.32 2005/09/04 17:03:53 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmProcess.cc,v 1.35 2006/06/29 19:55:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -38,12 +41,13 @@
// 30-06-04 make it to be pure discrete process (V.Ivanchenko)
// 30-09-08 optimise integral option (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (VI)
// 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivanchenko)
// 25-07-05 Add protection: integral mode only for charged particles (V.Ivanchenko)
// 25-07-05 Add protection: integral mode only for charged particles (VI)
// 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko)
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
//
//
// Class Description:
@@ -71,7 +75,6 @@
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -190,7 +193,7 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildLambdaTable()
{
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossSTD::BuildLambdaTable() for process "
G4cout << "G4EmProcess::BuildLambdaTable() for process "
<< GetProcessName() << " and particle "
<< particle->GetParticleName()
<< G4endl;
@@ -238,7 +241,8 @@ void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region)
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
modelManager->AddEmModel(order, p, 0, region);
if(p) p->SetParticleChange(pParticleChange);
@@ -246,7 +250,8 @@ void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::UpdateEmModel(const G4String& nam, G4double emin, G4double emax)
void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
@@ -386,7 +391,8 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
} else {
G4VEmModel* model = SelectModel(kineticEnergy);
cross = model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
cross =
model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
}
return cross;
@@ -394,12 +400,11 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z)
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A)
{
G4VEmModel* model = SelectModel(kineticEnergy);
G4double A = G4NistManager::Instance()->FindOrBuildElement(G4int(Z), false)->GetN();
G4double cross = model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
return cross;
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -420,7 +425,8 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
G4bool yes = true;
if ( theLambdaTable && part == particle) {
const G4String name = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
const G4String name =
GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = theLambdaTable->StorePhysicsTable(name,ascii);
if ( yes ) {
@@ -429,7 +435,8 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
<< " in the directory <" << directory
<< "> " << G4endl;
} else {
G4cout << "Fail to store Physics Tables for " << particle->GetParticleName()
G4cout << "Fail to store Physics Tables for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
@@ -438,7 +445,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
@@ -457,7 +464,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
G4String filename;
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,
filename,ascii);
if ( yes ) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " is Retrieved from <"
@@ -480,7 +488,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
void G4VEmProcess::FindLambdaMax()
{
if(1 < verboseLevel) {
G4cout << "### G4VEmProcess::FindLambdaMax: " << particle->GetParticleName()
G4cout << "### G4VEmProcess::FindLambdaMax: "
<< particle->GetParticleName()
<< " and process " << GetProcessName() << G4endl;
}
size_t n = theLambdaTable->length();
@@ -590,7 +599,8 @@ G4bool G4VEmProcess::IsIntegral() const
G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
{
G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
G4PhysicsVector* v =
new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
return v;
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.cc,v 1.45 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEnergyLoss.cc,v 1.46 2006/06/29 19:55:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// --------------------------------------------------------------
File diff suppressed because it is too large Load Diff
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc,v 1.37 2005/10/27 11:33:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VMultipleScattering.cc,v 1.39 2006/06/29 19:55:25 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -74,6 +77,7 @@
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4GenericIon.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -163,7 +167,10 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
{
if (!firstParticle) {
currentCouple = 0;
firstParticle = &part;
if(part.GetParticleType() == "nucleus" &&
part.GetParticleSubType() == "generic")
firstParticle = G4GenericIon::GenericIon();
else firstParticle = &part;
currentParticle = &part;
}
@@ -181,7 +188,8 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
InitialiseProcess(firstParticle);
if(buildLambdaTable)
theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
const G4DataVector* theCuts = modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
const G4DataVector* theCuts =
modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
if(2 < verboseLevel) G4cout << theCuts << G4endl;
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc,v 1.10 2005/02/27 18:07:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ionEffectiveCharge.cc,v 1.13 2006/06/29 19:55:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -37,6 +40,8 @@
// Modifications:
// 12.09.2004 Set low energy limit to 1 keV (V.Ivanchenko)
// 25.01.2005 Add protection - min Charge 0.1 eplus (V.Ivanchenko)
// 28.04.2006 Set upper energy limit to 50 MeV (V.Ivanchenko)
// 23.05.2006 Set upper energy limit to Z*10 MeV (V.Ivanchenko)
//
// -------------------------------------------------------------------
@@ -84,7 +89,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// Vol.1, Pergamon Press, 1985
// Fast ions or hadrons
G4double reducedEnergy = kineticEnergy * proton_mass_c2/mass ;
if( reducedEnergy > energyHighLimit || Zi < 1.5 ) return charge;
if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 ) return charge;
static G4double vFermi[92] = {
1.0309, 0.15976, 0.59782, 1.0781, 1.0486, 1.0, 1.058, 0.93942, 0.74562, 0.3424,
@@ -168,14 +173,14 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// Heavy ion case
} else {
G4double z23 = std::pow(z, 0.666667);
G4double zi13 = std::pow(Zi, 0.33333);
G4double zi23 = zi13*zi13;
reducedEnergy = std::max(reducedEnergy,energyBohr/z23);
G4double e = std::max(reducedEnergy,energyBohr/z23);
// v1 is ion velocity in vF unit
G4double v1 = std::sqrt( reducedEnergy / energyBohr )/ vF ;
G4double v1 = std::sqrt( e / energyBohr )/ vF ;
G4double y ;
// Faster than Fermi velocity
@@ -191,10 +196,12 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// G4cout << "y= " << y << " y3= " << y3 << " v1= " << v1 << " vF= " << vF << G4endl;
q = 1.0 - std::exp( 0.803*y3 - 1.3167*y3*y3 - 0.38157*y - 0.008983*y*y ) ;
// q = 1.0 - std::exp(-0.95*std::sqrt(reducedEnergy/energyBohr)/zi23);
G4double qmin = minCharge/Zi;
if(q < qmin) q = qmin;
G4double tq = 7.6 - std::log(reducedEnergy/keV);
G4double sq = 1.0 + ( 0.18 + 0.0015 * z ) * std::exp( -tq*tq )/ (Zi*Zi);
// G4cout << "sq= " << sq << G4endl;
@@ -205,6 +212,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
G4double lambda = 10.0 * vF * std::pow(1.0-q, 0.6667) / (zi13 * (6.0 + q)) ;
chargeCorrection = sq * (1.0 + (0.5/q - 0.5)*std::log(1.0 + lambda*lambda)/(vF*vF) );
}
// G4cout << "G4ionEffectiveCharge: charge= " << charge << " q= " << q
// << " chargeCor= " << chargeCorrection