Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4BetheBlochModel.cc,v 1.9 2003/11/12 10:24:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -59,7 +61,8 @@ G4BetheBlochModel::G4BetheBlochModel(const G4ParticleDefinition* p, const G4Stri
|
||||
lowKinEnergy(2.0*MeV),
|
||||
twoln10(2.0*log(10.0)),
|
||||
bg2lim(0.0169),
|
||||
taulim(8.4146e-3)
|
||||
taulim(8.4146e-3),
|
||||
isIon(false)
|
||||
{
|
||||
if(p) SetParticle(p);
|
||||
}
|
||||
@@ -73,14 +76,16 @@ G4BetheBlochModel::~G4BetheBlochModel()
|
||||
|
||||
void G4BetheBlochModel::SetParticle(const G4ParticleDefinition* p)
|
||||
{
|
||||
particle = p;
|
||||
mass = particle->GetPDGMass();
|
||||
spin = particle->GetPDGSpin();
|
||||
G4double q = particle->GetPDGCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
lowKinEnergy *= mass/proton_mass_c2;
|
||||
ratio = electron_mass_c2/mass;
|
||||
qc = mass/ratio;
|
||||
if(particle != p) {
|
||||
particle = p;
|
||||
mass = particle->GetPDGMass();
|
||||
spin = particle->GetPDGSpin();
|
||||
G4double q = particle->GetPDGCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
lowKinEnergy *= mass/proton_mass_c2;
|
||||
ratio = electron_mass_c2/mass;
|
||||
if(particle->GetParticleName() == "GenericIon") isIon = true;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -125,11 +130,12 @@ void G4BetheBlochModel::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4BetheBlochModel::ComputeDEDX(const G4Material* material,
|
||||
G4double G4BetheBlochModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kineticEnergy,
|
||||
G4double cutEnergy)
|
||||
{
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
|
||||
G4double tau = kineticEnergy/mass;
|
||||
G4double x = 1.0;
|
||||
@@ -149,23 +155,23 @@ G4double G4BetheBlochModel::ComputeDEDX(const G4Material* material,
|
||||
G4double* shellCorrectionVector =
|
||||
material->GetIonisation()->GetShellCorrectionVector();
|
||||
G4double eDensity = material->GetElectronDensity();
|
||||
|
||||
|
||||
G4double dedx = log(2.0*electron_mass_c2*bg2*tmax*x/eexc2)-(1.0 + x)*beta2;
|
||||
|
||||
|
||||
if(0.5 == spin) {
|
||||
G4double del = 0.5*x*tmax/(kineticEnergy + mass);
|
||||
dedx += del*del;
|
||||
}
|
||||
|
||||
// density correction
|
||||
// density correction
|
||||
x = log(bg2)/twoln10;
|
||||
if ( x >= x0den ) {
|
||||
dedx -= twoln10*x - cden ;
|
||||
if ( x < x1den ) dedx -= aden*pow((x1den-x),mden) ;
|
||||
}
|
||||
|
||||
// shell correction
|
||||
G4double sh = 0.0;
|
||||
|
||||
// shell correction
|
||||
G4double sh = 0.0;
|
||||
x = 1.0;
|
||||
|
||||
if ( bg2 > bg2lim ) {
|
||||
@@ -182,23 +188,23 @@ G4double G4BetheBlochModel::ComputeDEDX(const G4Material* material,
|
||||
sh *= log(tau/taul)/log(taulim/taul);
|
||||
}
|
||||
dedx -= sh;
|
||||
|
||||
|
||||
// now compute the total ionization loss
|
||||
|
||||
if (dedx < 0.0) dedx = 0.0 ;
|
||||
|
||||
|
||||
dedx *= twopi_mc2_rcl2*chargeSquare*eDensity/beta2;
|
||||
|
||||
return dedx;
|
||||
return dedx;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4BetheBlochModel::CrossSection(const G4Material* material,
|
||||
G4double G4BetheBlochModel::CrossSection(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kineticEnergy,
|
||||
G4double cutEnergy,
|
||||
G4double maxEnergy)
|
||||
G4double maxEnergy)
|
||||
{
|
||||
G4double cross = 0.0;
|
||||
G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
|
||||
@@ -217,15 +223,17 @@ G4double G4BetheBlochModel::CrossSection(const G4Material* material,
|
||||
// +term for spin=1 particle
|
||||
} else if( 0.9 < spin ) {
|
||||
|
||||
G4double qc = mass/ratio;
|
||||
cross += -log(x)/(3.0*qc) +
|
||||
(tmax - cutEnergy) * ((1.0+ 0.25*tmax*(1.0 + x)/qc)/(energy*energy)
|
||||
- beta2 / (tmax * qc) )/3.0;
|
||||
}
|
||||
|
||||
cross *= twopi_mc2_rcl2*chargeSquare*material->GetElectronDensity()/beta2;
|
||||
|
||||
cross *= twopi_mc2_rcl2*chargeSquare*
|
||||
(couple->GetMaterial()->GetElectronDensity())/beta2;
|
||||
}
|
||||
// G4cout << "tmin= " << cutEnergy << " tmax= " << tmax
|
||||
// << " cross= " << cross << G4endl;
|
||||
// G4cout << "tmin= " << cutEnergy << " tmax= " << tmax
|
||||
// << " cross= " << cross << G4endl;
|
||||
return cross;
|
||||
}
|
||||
|
||||
@@ -256,6 +264,7 @@ G4DynamicParticle* G4BetheBlochModel::SampleSecondary(
|
||||
if(spin < 0.9) {
|
||||
grej += xmax*xmax*x;
|
||||
} else {
|
||||
G4double qc = mass/ratio;
|
||||
y = tmax/(3.0*qc);
|
||||
grej += (1.0 - beta2*xmin)*xmin*y + x*xmin*xmin*(2.0/3.0 + xmin*y);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4BohrFluctuations.cc,v 1.7 2003/10/24 14:00:25 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -34,6 +37,7 @@
|
||||
// Modifications:
|
||||
//
|
||||
// 23-05-03 Add control on parthalogical cases (V.Ivanchenko)
|
||||
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
|
||||
//
|
||||
// Class Description: Sampling of Gaussion fluctuations
|
||||
//
|
||||
@@ -66,7 +70,7 @@ G4BohrFluctuations::~G4BohrFluctuations()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4BohrFluctuations::Initialise(const G4ParticleDefinition* part)
|
||||
void G4BohrFluctuations::InitialiseMe(const G4ParticleDefinition* part)
|
||||
{
|
||||
particle = part;
|
||||
particleMass = part->GetPDGMass();
|
||||
@@ -77,10 +81,10 @@ void G4BohrFluctuations::Initialise(const G4ParticleDefinition* part)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4BohrFluctuations::SampleFluctuations(const G4Material* material,
|
||||
const G4DynamicParticle* dp,
|
||||
G4double& tmax,
|
||||
G4double& length,
|
||||
G4double& meanLoss)
|
||||
const G4DynamicParticle* dp,
|
||||
G4double& tmax,
|
||||
G4double& length,
|
||||
G4double& meanLoss)
|
||||
{
|
||||
if(meanLoss <= minLoss) return meanLoss;
|
||||
G4double siga = Dispersion(material,dp,tmax,length);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4BraggModel.cc,v 1.11 2003/11/12 10:24:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -63,9 +65,10 @@ G4BraggModel::G4BraggModel(const G4ParticleDefinition* p, const G4String& nam)
|
||||
particle(0),
|
||||
highKinEnergy(2.0*MeV),
|
||||
lowKinEnergy(0.0*MeV),
|
||||
iMolecula(0),
|
||||
protonMassAMU(1.007276),
|
||||
theZieglerFactor(eV*cm2*1.0e-15)
|
||||
theZieglerFactor(eV*cm2*1.0e-15),
|
||||
iMolecula(0),
|
||||
isIon(false)
|
||||
{
|
||||
if(p) SetParticle(p);
|
||||
}
|
||||
@@ -79,14 +82,17 @@ G4BraggModel::~G4BraggModel()
|
||||
|
||||
void G4BraggModel::SetParticle(const G4ParticleDefinition* p)
|
||||
{
|
||||
particle = p;
|
||||
mass = particle->GetPDGMass();
|
||||
spin = particle->GetPDGSpin();
|
||||
G4double q = particle->GetPDGCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
massRate = mass/proton_mass_c2;
|
||||
highKinEnergy *= massRate;
|
||||
ratio = electron_mass_c2/mass;
|
||||
if(particle != p) {
|
||||
particle = p;
|
||||
mass = particle->GetPDGMass();
|
||||
spin = particle->GetPDGSpin();
|
||||
G4double q = particle->GetPDGCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
massRate = mass/proton_mass_c2;
|
||||
highKinEnergy *= massRate;
|
||||
ratio = electron_mass_c2/mass;
|
||||
if(particle->GetParticleName() == "GenericIon") isIon = true;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -131,12 +137,12 @@ void G4BraggModel::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4BraggModel::ComputeDEDX(const G4Material* material,
|
||||
G4double G4BraggModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kineticEnergy,
|
||||
G4double cutEnergy)
|
||||
{
|
||||
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
|
||||
G4double dedx = DEDX(material, kineticEnergy/massRate);
|
||||
|
||||
@@ -146,9 +152,9 @@ G4double G4BraggModel::ComputeDEDX(const G4Material* material,
|
||||
G4double tau = kineticEnergy/mass;
|
||||
G4double gam = tau + 1.0;
|
||||
G4double beta2 = 1. - 1./(gam*gam);
|
||||
// G4double bg2 = tau * (tau+2.0);
|
||||
|
||||
dedx += (log(x) + (1.0 - x)*beta2) * twopi_mc2_rcl2
|
||||
* (material->GetElectronDensity())/beta2;
|
||||
* (material->GetElectronDensity())/beta2;
|
||||
}
|
||||
|
||||
// now compute the total ionization loss
|
||||
@@ -162,7 +168,7 @@ G4double G4BraggModel::ComputeDEDX(const G4Material* material,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4BraggModel::CrossSection(const G4Material* material,
|
||||
G4double G4BraggModel::CrossSection(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kineticEnergy,
|
||||
G4double cutEnergy,
|
||||
@@ -172,17 +178,18 @@ G4double G4BraggModel::CrossSection(const G4Material* material,
|
||||
G4double cross = 0.0;
|
||||
G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy), maxEnergy);
|
||||
if(cutEnergy < tmax) {
|
||||
|
||||
|
||||
G4double x = cutEnergy/tmax;
|
||||
G4double energy = kineticEnergy + mass;
|
||||
G4double gam = energy/mass;
|
||||
G4double beta2 = 1. - 1./(gam*gam);
|
||||
cross = (1.0 - x*(1.0 - beta2*log(x)))/cutEnergy;
|
||||
|
||||
cross *= twopi_mc2_rcl2*chargeSquare*material->GetElectronDensity()/beta2;
|
||||
|
||||
cross *= twopi_mc2_rcl2*chargeSquare*
|
||||
(couple->GetMaterial()->GetElectronDensity())/beta2;
|
||||
}
|
||||
// G4cout << "tmin= " << cutEnergy << " tmax= " << tmax
|
||||
// << " cross= " << cross << G4endl;
|
||||
// G4cout << "tmin= " << cutEnergy << " tmax= " << tmax
|
||||
// << " cross= " << cross << G4endl;
|
||||
return cross;
|
||||
}
|
||||
|
||||
@@ -213,14 +220,14 @@ G4DynamicParticle* G4BraggModel::SampleSecondary(
|
||||
z = xmin*xmax/(xmin*(1.0 - q) + xmax*q);
|
||||
|
||||
f = 1.0 - beta2 * z;
|
||||
|
||||
/*
|
||||
if(f > grej) {
|
||||
G4cout << "G4BraggModel::SampleSecondary Warning! "
|
||||
<< "Majorant " << grej << " < "
|
||||
<< f << " for x= " << z
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
*/
|
||||
} while( grej*G4UniformRand() >= f );
|
||||
|
||||
G4double deltaKinEnergy = z * tmax;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4EmModelManager.cc,v 1.20 2003/11/03 19:37:59 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -42,6 +44,10 @@
|
||||
// 06-03-03 Fix in energy intervals for models (V.Ivanchenko)
|
||||
// 13-04-03 Add startFromNull (V.Ivanchenko)
|
||||
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
|
||||
// 16-07-03 Replace G4Material by G4MaterialCutCouple in dE/dx and CrossSection
|
||||
// calculation (V.Ivanchenko)
|
||||
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
|
||||
// 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
@@ -96,6 +102,8 @@ G4EmModelManager::G4EmModelManager():
|
||||
nEmModels(0),
|
||||
nRegions(0),
|
||||
nCouples(0),
|
||||
idxOfRegionModels(0),
|
||||
setOfRegionModels(0),
|
||||
minSubRange(0.1),
|
||||
particle(0),
|
||||
verboseLevel(0)
|
||||
@@ -150,8 +158,15 @@ void G4EmModelManager::Clear()
|
||||
theCuts.clear();
|
||||
theSubCuts.clear();
|
||||
upperEkin.clear();
|
||||
idxOfRegionModels.clear();
|
||||
setOfRegionModels.clear();
|
||||
if(idxOfRegionModels) delete [] idxOfRegionModels;
|
||||
if(setOfRegionModels && nRegions) {
|
||||
for(G4int i=0; i<nRegions; i++) {
|
||||
delete (setOfRegionModels[i]);
|
||||
}
|
||||
delete [] setOfRegionModels;
|
||||
}
|
||||
idxOfRegionModels = 0;
|
||||
setOfRegionModels = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -167,6 +182,7 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
|
||||
flucModels.push_back(fm);
|
||||
regions.push_back(r);
|
||||
orderOfModels.push_back(num);
|
||||
p->DefineForRegion(r);
|
||||
if (nEmModels) {
|
||||
G4int idx = nEmModels;
|
||||
do {idx--;} while (idx && num < orderOfModels[idx]);
|
||||
@@ -187,11 +203,34 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4EmModelManager::UpdateEmModel(const G4String& nam, G4double emin, G4double emax)
|
||||
{
|
||||
if (nEmModels) {
|
||||
for(G4int i=0; i<nEmModels; i++) {
|
||||
if(nam == models[i]->GetName()) {
|
||||
models[i]->SetLowEnergyLimit(emin);
|
||||
models[i]->SetHighEnergyLimit(emax);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
G4cout << "G4EmModelManager::UpdateEmModel WARNING: no model <"
|
||||
<< nam << "> is found out"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
const G4ParticleDefinition* sp,
|
||||
G4double theMinSubRange,
|
||||
G4int val)
|
||||
{
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager::Initialise() for "
|
||||
<< p->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
// Are models defined?
|
||||
if(!nEmModels) {
|
||||
G4Exception("G4EmModelManager::Initialise without any model defined");
|
||||
@@ -201,11 +240,6 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
minSubRange = theMinSubRange;
|
||||
verboseLevel = val;
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "### G4EmModelManager::Initialise() for "
|
||||
<< p->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
Clear();
|
||||
|
||||
G4RegionStore* regionStore = G4RegionStore::GetInstance();
|
||||
@@ -232,11 +266,11 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
}
|
||||
}
|
||||
|
||||
setOfRegionModels.clear();
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
idxOfRegionModels.resize(numOfCouples);
|
||||
idxOfRegionModels = new G4int[numOfCouples];
|
||||
setOfRegionModels = new G4RegionModels*[nRegions];
|
||||
upperEkin.resize(nEmModels);
|
||||
|
||||
// Order models for regions
|
||||
@@ -283,12 +317,14 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
}
|
||||
eLow[0] = 0.0;
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "New G4RegionModels set with " << n << " models for region <"
|
||||
<< region->GetName() << "> " << G4endl;
|
||||
<< region->GetName() << "> Elow(MeV)= ";
|
||||
for(G4int ii=0; ii<n; ii++) {G4cout << eLow[ii]/MeV << " ";}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
G4RegionModels* rm = new G4RegionModels(n, modelAtRegion, eLow);
|
||||
setOfRegionModels.push_back(rm);
|
||||
setOfRegionModels[reg] = rm;
|
||||
}
|
||||
|
||||
// Access to materials and build cuts
|
||||
@@ -302,9 +338,13 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
do {reg--;} while (reg>0 && pcuts != (set[reg]->GetProductionCuts()));
|
||||
idxOfRegionModels[i] = reg;
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager::Initialise() for "
|
||||
<< material->GetName() << G4endl;
|
||||
<< material->GetName()
|
||||
<< " indexOfCouple= " << i
|
||||
<< " indexOfRegion= " << reg
|
||||
<< " indexOfRegion= " << reg
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4double cut = 0.0;
|
||||
@@ -339,12 +379,12 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
for(G4int jj=0; jj<nEmModels; jj++) {
|
||||
models[jj]->Initialise(particle, theCuts);
|
||||
if(flucModels[jj]) flucModels[jj]->Initialise(particle);
|
||||
if(flucModels[jj]) flucModels[jj]->InitialiseMe(particle);
|
||||
}
|
||||
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager is initialised "
|
||||
G4cout << "G4EmModelManager is initialised; nRegions= " << nRegions
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -364,13 +404,12 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
|
||||
|
||||
G4double e;
|
||||
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
size_t i = couple->GetIndex();
|
||||
G4double cut = theCuts[i];
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager::FillDEDXVector() for "
|
||||
<< material->GetName()
|
||||
<< couple->GetMaterial()->GetName()
|
||||
<< " Ecut(MeV)= " << cut/MeV
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -385,7 +424,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "There are " << nmod << " models for "
|
||||
<< material->GetName()
|
||||
<< couple->GetMaterial()->GetName()
|
||||
<< " at the region #" << reg
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -400,15 +439,15 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
|
||||
dedxLow[0] = 0.0;
|
||||
|
||||
e = upperEkin[regModels->ModelIndex(0)];
|
||||
dedxHigh[0] = models[regModels->ModelIndex(0)]->ComputeDEDX(material,particle,e,cut);
|
||||
dedxHigh[0] = models[regModels->ModelIndex(0)]->ComputeDEDX(couple,particle,e,cut);
|
||||
|
||||
if(nmod > 1) {
|
||||
for(j=1; j<nmod; j++) {
|
||||
|
||||
e = upperEkin[regModels->ModelIndex(j-1)];
|
||||
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(material,particle,e,cut);
|
||||
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
|
||||
e = upperEkin[regModels->ModelIndex(j)];
|
||||
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(material,particle,e,cut);
|
||||
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
|
||||
}
|
||||
|
||||
for(j=1; j<nmod; j++) {
|
||||
@@ -436,11 +475,11 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
|
||||
} while (k<nmod-1 && e < upperEkin[regModels->ModelIndex(k)] );
|
||||
}
|
||||
|
||||
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(material,particle,e,cut)*fac;
|
||||
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(couple,particle,e,cut)*fac;
|
||||
|
||||
if(dedx < 0.0) dedx = 0.0;
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "Material= " << material->GetName()
|
||||
G4cout << "Material= " << couple->GetMaterial()->GetName()
|
||||
<< " E(MeV)= " << e/MeV
|
||||
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
|
||||
<< " fac= " << fac
|
||||
@@ -465,12 +504,11 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
|
||||
|
||||
G4double e;
|
||||
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
size_t i = couple->GetIndex();
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager::FillDEDXVector() for "
|
||||
<< material->GetName()
|
||||
<< couple->GetMaterial()->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -484,7 +522,7 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "There are " << nmod << " models for "
|
||||
<< material->GetName()
|
||||
<< couple->GetMaterial()->GetName()
|
||||
<< " at the region #" << reg
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -499,15 +537,15 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
|
||||
dedxLow[0] = 0.0;
|
||||
|
||||
e = upperEkin[regModels->ModelIndex(0)];
|
||||
dedxHigh[0] = models[regModels->ModelIndex(0)]->ComputeDEDX(material,particle,e,e);
|
||||
dedxHigh[0] = models[regModels->ModelIndex(0)]->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(material,particle,e,e);
|
||||
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
|
||||
e = upperEkin[regModels->ModelIndex(j)];
|
||||
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(material,particle,e,e);
|
||||
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
|
||||
}
|
||||
|
||||
for(j=1; j<nmod; j++) {
|
||||
@@ -535,11 +573,11 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
|
||||
} while (k<nmod-1 && e < upperEkin[regModels->ModelIndex(k)] );
|
||||
}
|
||||
|
||||
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(material,particle,e,e)*fac;
|
||||
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(couple,particle,e,e)*fac;
|
||||
|
||||
if(dedx < 0.0) dedx = 0.0;
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "Material= " << material->GetName()
|
||||
G4cout << "Material= " << couple->GetMaterial()->GetName()
|
||||
<< " E(MeV)= " << e/MeV
|
||||
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
|
||||
<< " fac= " << fac
|
||||
@@ -563,12 +601,10 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
|
||||
G4double e;
|
||||
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4EmModelManager::FillLambdaVector() for particle "
|
||||
<< particle->GetParticleName()
|
||||
<< " in " << material->GetName()
|
||||
<< " in " << couple->GetMaterial()->GetName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -585,7 +621,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "There are " << nmod << " models for "
|
||||
<< material->GetName() << G4endl;
|
||||
<< couple->GetMaterial()->GetName() << G4endl;
|
||||
}
|
||||
|
||||
// calculate factors to provide continuity of energy loss
|
||||
@@ -598,7 +634,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
e = upperEkin[regModels->ModelIndex(0)];
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "### For material " << material->GetName()
|
||||
G4cout << "### For material " << couple->GetMaterial()->GetName()
|
||||
<< " " << nmod
|
||||
<< " models"
|
||||
<< " Ecut(MeV)= " << cut/MeV
|
||||
@@ -607,16 +643,16 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
sigmaHigh[0] = models[regModels->ModelIndex(0)]->CrossSection(material,particle,e,cut,e);
|
||||
sigmaHigh[0] = models[regModels->ModelIndex(0)]->CrossSection(couple,particle,e,cut,e);
|
||||
|
||||
if(nmod > 1) {
|
||||
|
||||
for(j=1; j<nmod; j++) {
|
||||
|
||||
e = upperEkin[regModels->ModelIndex(j-1)];
|
||||
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(material,particle,e,cut,e);
|
||||
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
|
||||
e = upperEkin[regModels->ModelIndex(j)];
|
||||
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(material,particle,e,cut,e);
|
||||
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
|
||||
}
|
||||
for(j=1; j<nmod; j++) {
|
||||
if(sigmaLow[j] > 0.0) factor[j] = (sigmaHigh[j-1]/sigmaLow[j] - 1.0);
|
||||
@@ -639,7 +675,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
|
||||
} while (k<nmod-1 && e < upperEkin[regModels->ModelIndex(k)] );
|
||||
}
|
||||
|
||||
G4double cross = models[regModels->ModelIndex(k)]->CrossSection(material,particle,e,cut,e)*fac;
|
||||
G4double cross = models[regModels->ModelIndex(k)]->CrossSection(couple,particle,e,cut,e)*fac;
|
||||
if(j==0 && startFromNull) cross = 0.0;
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
@@ -673,7 +709,6 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
|
||||
|
||||
G4double e;
|
||||
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
size_t i = couple->GetIndex();
|
||||
G4double cut = theCuts[i];
|
||||
G4double subcut = theSubCuts[i];
|
||||
@@ -687,7 +722,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "There are " << nmod << " models for "
|
||||
<< material->GetName() << G4endl;
|
||||
<< couple->GetMaterial()->GetName() << G4endl;
|
||||
}
|
||||
|
||||
// calculate factors to provide continuity of energy loss
|
||||
@@ -701,7 +736,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
|
||||
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
G4cout << "### For material " << material->GetName()
|
||||
G4cout << "### For material " << couple->GetMaterial()->GetName()
|
||||
<< " are available " << nmod
|
||||
<< " models"
|
||||
<< " Ecut(MeV)= " << cut/MeV
|
||||
@@ -709,16 +744,16 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
sigmaHigh[0] = models[regModels->ModelIndex(0)]->CrossSection(material,particle,e,subcut,cut);
|
||||
sigmaHigh[0] = models[regModels->ModelIndex(0)]->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(material,particle,e,subcut,cut);
|
||||
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,subcut,cut);
|
||||
e = upperEkin[regModels->ModelIndex(j)];
|
||||
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(material,particle,e,subcut,cut);
|
||||
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);
|
||||
@@ -741,7 +776,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
|
||||
} while (k<nmod-1 && e < upperEkin[regModels->ModelIndex(k)] );
|
||||
}
|
||||
|
||||
G4double cross=models[regModels->ModelIndex(k)]->CrossSection(material,particle,e,subcut,cut)*fac;
|
||||
G4double cross=models[regModels->ModelIndex(k)]->CrossSection(couple,particle,e,subcut,cut)*fac;
|
||||
if(j==0 && startFromNull) cross = 0.0;
|
||||
|
||||
if(1 < verboseLevel) {
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EnergyLossMessenger.cc,v 1.9 2003/06/16 17:02:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4EnergyLossMessenger.cc,v 1.11 2003/10/13 10:49:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include <strstream>
|
||||
@@ -48,13 +49,13 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
|
||||
{
|
||||
eLossDirectory = new G4UIdirectory("/process/eLoss/");
|
||||
eLossDirectory->SetGuidance("Commands for G4VEnergyLoss.");
|
||||
|
||||
|
||||
RndmStepCmd = new G4UIcmdWithABool("/process/eLoss/rndmStep",this);
|
||||
RndmStepCmd->SetGuidance("Randomize the proposed step by eLoss.");
|
||||
RndmStepCmd->SetParameterName("choice",true);
|
||||
RndmStepCmd->SetDefaultValue(false);
|
||||
RndmStepCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
|
||||
EnlossFlucCmd = new G4UIcmdWithABool("/process/eLoss/fluct",this);
|
||||
EnlossFlucCmd->SetGuidance("Switch true/false the energy loss fluctuations.");
|
||||
EnlossFlucCmd->SetParameterName("choice",true);
|
||||
@@ -76,26 +77,26 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
|
||||
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters.");
|
||||
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
|
||||
StepFuncCmd->SetGuidance(" finalRange: range for final step");
|
||||
|
||||
|
||||
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
|
||||
dRoverRPrm->SetGuidance("max Range variation per step (fractional number)");
|
||||
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
|
||||
StepFuncCmd->SetParameter(dRoverRPrm);
|
||||
|
||||
|
||||
G4UIparameter* finalRangePrm = new G4UIparameter("finalRange",'d',false);
|
||||
finalRangePrm->SetGuidance("range for final step");
|
||||
finalRangePrm->SetParameterRange("finalRange>0.");
|
||||
StepFuncCmd->SetParameter(finalRangePrm);
|
||||
|
||||
|
||||
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
|
||||
unitPrm->SetGuidance("unit of finalRange");
|
||||
unitPrm->SetDefaultValue("mm");
|
||||
G4String unitCandidates = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
|
||||
unitPrm->SetParameterCandidates(unitCandidates);
|
||||
|
||||
|
||||
StepFuncCmd->SetParameter(unitPrm);
|
||||
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
|
||||
MinEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minKinEnergy",this);
|
||||
MinEnCmd->SetGuidance("Set the min kinetic energy");
|
||||
MinEnCmd->SetParameterName("emin",true);
|
||||
@@ -119,6 +120,12 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
|
||||
rangeCmd->SetParameterName("range",true);
|
||||
rangeCmd->SetDefaultValue(true);
|
||||
rangeCmd->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);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -135,18 +142,19 @@ G4EnergyLossMessenger::~G4EnergyLossMessenger()
|
||||
delete MaxEnCmd;
|
||||
delete IntegCmd;
|
||||
delete rangeCmd;
|
||||
delete verCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
{
|
||||
G4LossTableManager* lossTables = G4LossTableManager::Instance();
|
||||
if (command == RndmStepCmd)
|
||||
{ G4VEnergyLoss::SetRndmStep(RndmStepCmd->GetNewBoolValue(newValue));
|
||||
lossTables->SetRandomStep(RndmStepCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
|
||||
|
||||
if (command == EnlossFlucCmd)
|
||||
{ G4VEnergyLoss::SetEnlossFluc(EnlossFlucCmd->GetNewBoolValue(newValue));
|
||||
lossTables->SetLossFluctuations(EnlossFlucCmd->GetNewBoolValue(newValue));
|
||||
@@ -173,7 +181,7 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
G4VEnergyLoss::SetStepFunction(v1,v2);
|
||||
lossTables->SetStepLimits(v1,v2);
|
||||
}
|
||||
|
||||
|
||||
if (command == MinEnCmd) {
|
||||
lossTables->SetMinEnergy(MinEnCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
@@ -185,7 +193,10 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
lossTables->SetIntegral(IntegCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
if (command == rangeCmd) {
|
||||
lossTables->SetBuildPreciseRange(IntegCmd->GetNewBoolValue(newValue));
|
||||
lossTables->SetBuildPreciseRange(rangeCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
if (command == verCmd) {
|
||||
lossTables->SetVerbose(verCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EnergyLossTables.cc,v 1.27 2003/04/18 17:49:26 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4EnergyLossTables.cc,v 1.31 2003/11/24 12:12:53 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// first version created by P.Urban , 06/04/1998
|
||||
@@ -57,7 +57,7 @@ G4double G4EnergyLossTables::rmin = 0. ;
|
||||
G4double G4EnergyLossTables::rmax = 0. ;
|
||||
G4double G4EnergyLossTables::Thigh = 0. ;
|
||||
G4int G4EnergyLossTables::let_counter = 0;
|
||||
G4int G4EnergyLossTables::let_max_num_warnings = 2;
|
||||
G4int G4EnergyLossTables::let_max_num_warnings = 100;
|
||||
G4bool G4EnergyLossTables::first_loss = true;
|
||||
|
||||
G4EnergyLossTables::helper_map G4EnergyLossTables::dict;
|
||||
@@ -201,7 +201,7 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle,"dEdx");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -244,7 +244,7 @@ G4double G4EnergyLossTables::GetLabTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle,"LabTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
@@ -290,7 +290,7 @@ G4double G4EnergyLossTables::GetDeltaLabTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* labtimeTable= t.theLabTimeTable;
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!labtimeTable) ParticleHaveNoLoss(aParticle,"LabTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
|
||||
@@ -368,7 +368,7 @@ G4double G4EnergyLossTables::GetProperTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle,"ProperTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
@@ -389,7 +389,7 @@ G4double G4EnergyLossTables::GetProperTime(
|
||||
t.theHighestKineticEnergy,isOut);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
time = (*propertimeTable)(materialIndex)->GetValue(
|
||||
scaledKineticEnergy,isOut);
|
||||
|
||||
@@ -414,7 +414,7 @@ G4double G4EnergyLossTables::GetDeltaProperTime(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* propertimeTable= t.theProperTimeTable;
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!propertimeTable) ParticleHaveNoLoss(aParticle,"ProperTime");
|
||||
|
||||
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
|
||||
const G4double dToverT = 0.05 , facT = 1. -dToverT ;
|
||||
@@ -496,7 +496,7 @@ G4double G4EnergyLossTables::GetRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable || !rangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!rangeTable) ParticleHaveNoLoss(aParticle,"Range");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -547,7 +547,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
|
||||
if (!dEdxTable || !inverseRangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!inverseRangeTable) ParticleHaveNoLoss(aParticle,"InverseRange");
|
||||
|
||||
G4double scaledrange,scaledKineticEnergy ;
|
||||
G4bool isOut ;
|
||||
@@ -609,7 +609,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!dEdxTable) ParticleHaveNoLoss(aParticle,"dEdx");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -656,7 +656,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if (!dEdxTable || !rangeTable) ParticleHaveNoLoss(aParticle);
|
||||
if (!rangeTable) ParticleHaveNoLoss(aParticle,"Range");
|
||||
|
||||
G4int materialIndex = aMaterial->GetIndex();
|
||||
|
||||
@@ -697,7 +697,8 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
G4double G4EnergyLossTables::GetDEDX(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double KineticEnergy,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
{
|
||||
if(aParticle != lastParticle)
|
||||
{
|
||||
@@ -709,8 +710,11 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
oldIndex = -1 ;
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if ( !dEdxTable )
|
||||
return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple);
|
||||
|
||||
if (!dEdxTable ) {
|
||||
if (check) return G4LossTableManager::Instance()->GetDEDX(aParticle,KineticEnergy,couple);
|
||||
else ParticleHaveNoLoss(aParticle, "dEdx");
|
||||
}
|
||||
|
||||
G4int materialIndex = couple->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -743,7 +747,8 @@ G4double G4EnergyLossTables::GetDEDX(
|
||||
G4double G4EnergyLossTables::GetRange(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double KineticEnergy,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
{
|
||||
if(aParticle != lastParticle)
|
||||
{
|
||||
@@ -756,9 +761,11 @@ G4double G4EnergyLossTables::GetRange(
|
||||
}
|
||||
const G4PhysicsTable* rangeTable= t.theRangeTable;
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
if ( !rangeTable || !dEdxTable)
|
||||
return G4LossTableManager::Instance()->GetRange(aParticle,KineticEnergy,couple);
|
||||
|
||||
if (!rangeTable) {
|
||||
if(check) return G4LossTableManager::Instance()->GetRange(aParticle,KineticEnergy,couple);
|
||||
else return DBL_MAX;
|
||||
//ParticleHaveNoLoss(aParticle,"Range");
|
||||
}
|
||||
|
||||
G4int materialIndex = couple->GetIndex();
|
||||
G4double scaledKineticEnergy = KineticEnergy*t.theMassRatio;
|
||||
@@ -794,7 +801,8 @@ G4double G4EnergyLossTables::GetRange(
|
||||
G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
const G4ParticleDefinition *aParticle,
|
||||
G4double range,
|
||||
const G4MaterialCutsCouple *couple)
|
||||
const G4MaterialCutsCouple *couple,
|
||||
G4bool check)
|
||||
// it returns the value of the kinetic energy for a given range
|
||||
{
|
||||
if( aParticle != lastParticle)
|
||||
@@ -808,8 +816,12 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
|
||||
}
|
||||
const G4PhysicsTable* dEdxTable= t.theDEDXTable;
|
||||
const G4PhysicsTable* inverseRangeTable= t.theInverseRangeTable;
|
||||
if ( !dEdxTable || !inverseRangeTable)
|
||||
return G4LossTableManager::Instance()->GetEnergy(aParticle,range,couple);
|
||||
|
||||
if (!inverseRangeTable) {
|
||||
if(check) return G4LossTableManager::Instance()->GetEnergy(aParticle,range,couple);
|
||||
else return DBL_MAX;
|
||||
// else ParticleHaveNoLoss(aParticle,"InverseRange");
|
||||
}
|
||||
|
||||
G4double scaledrange,scaledKineticEnergy ;
|
||||
G4bool isOut ;
|
||||
@@ -959,31 +971,32 @@ G4double G4EnergyLossTables::GetPreciseRangeFromEnergy(
|
||||
|
||||
void G4EnergyLossTables::CPRWarning()
|
||||
{
|
||||
// if (let_counter < let_max_num_warnings) {
|
||||
if (let_counter < let_max_num_warnings) {
|
||||
|
||||
// G4cout << G4endl;
|
||||
// G4cout << "##### G4EnergyLossTable WARNING: The obsolete interface is used" << G4endl;
|
||||
// G4cout << "##### Please, substitute G4Material by G4MaterialCutsCouple" << G4endl;
|
||||
// G4cout << "##### Obsolete interface will be removed soon" << G4endl;
|
||||
// G4cout << G4endl;
|
||||
// let_counter++;
|
||||
if ((G4RegionStore::GetInstance())->size() > 1) {
|
||||
G4Exception("G4EnergyLossTables:: More than 1 region - table can't be accessed with obsolete interface");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// } else if (let_counter == let_max_num_warnings) {
|
||||
|
||||
// G4cout << "##### G4EnergyLossTable WARNING closed" << G4endl;
|
||||
// let_counter++;
|
||||
G4cout << G4endl;
|
||||
G4cout << "##### G4EnergyLossTable WARNING: The obsolete interface is used!" << G4endl;
|
||||
G4cout << "##### RESULTS ARE NOT GARANTEED!" << G4endl;
|
||||
G4cout << "##### Please, substitute G4Material by G4MaterialCutsCouple" << G4endl;
|
||||
G4cout << "##### Obsolete interface will be removed soon" << G4endl;
|
||||
G4cout << G4endl;
|
||||
let_counter++;
|
||||
// if ((G4RegionStore::GetInstance())->size() > 1) {
|
||||
// G4Exception("G4EnergyLossTables:: More than 1 region - table can't be accessed with obsolete interface");
|
||||
// exit(1);
|
||||
// }
|
||||
|
||||
} else if (let_counter == let_max_num_warnings) {
|
||||
|
||||
G4cout << "##### G4EnergyLossTable WARNING closed" << G4endl;
|
||||
let_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle)
|
||||
void G4EnergyLossTables::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle, const G4String& q)
|
||||
{
|
||||
G4String s = "G4EnergyLossTables:: dE/dx table not found for "
|
||||
G4String s = "G4EnergyLossTables:: " + q + " table not found for "
|
||||
+ aParticle->GetParticleName() + "!";
|
||||
G4Exception(s);
|
||||
exit(1);
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4IonFluctuations.cc,v 1.8 2003/11/12 10:24:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -37,6 +40,7 @@
|
||||
// 07-02-03 change signature (V.Ivanchenko)
|
||||
// 13-02-03 Add name (V.Ivanchenko)
|
||||
// 23-05-03 Add control on parthalogical cases (V.Ivanchenko)
|
||||
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
@@ -72,12 +76,13 @@ G4IonFluctuations::~G4IonFluctuations()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4IonFluctuations::Initialise(const G4ParticleDefinition* part)
|
||||
void G4IonFluctuations::InitialiseMe(const G4ParticleDefinition* part)
|
||||
{
|
||||
particle = part;
|
||||
particleMass = part->GetPDGMass();
|
||||
G4double q = part->GetPDGCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
charge = part->GetPDGCharge()/eplus;
|
||||
chargeSquare = charge*charge;
|
||||
chargeSqRatio = 1.0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -92,10 +97,12 @@ G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
|
||||
|
||||
if(dp->GetDefinition() != particle) {
|
||||
particle = dp->GetDefinition();
|
||||
particleMass = dp->GetMass();
|
||||
charge = dp->GetCharge();
|
||||
chargeSquare = charge*charge;
|
||||
charge = particle->GetPDGCharge()/eplus;
|
||||
}
|
||||
particleMass = dp->GetMass();
|
||||
G4double q = dp->GetCharge()/eplus;
|
||||
chargeSquare = q*q;
|
||||
chargeSqRatio = chargeSquare/(charge*charge);
|
||||
|
||||
G4double siga = Dispersion(material,dp,tmax,length);
|
||||
G4double loss = meanLoss;
|
||||
@@ -111,6 +118,7 @@ G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
|
||||
if(gauss) {
|
||||
// Increase fluctuations for big fractional energy loss
|
||||
|
||||
//G4cout << "siga= " << siga << G4endl;
|
||||
if ( meanLoss > minFraction*kineticEnergy ) {
|
||||
G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
|
||||
G4double b2 = 1.0 - 1.0/(gam*gam);
|
||||
@@ -119,6 +127,7 @@ G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
|
||||
G4double x3 = 1.0/(x*x*x);
|
||||
siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
|
||||
}
|
||||
// G4cout << "siga= " << siga << G4endl;
|
||||
siga = sqrt(siga);
|
||||
|
||||
G4double lossmax = meanLoss+meanLoss;
|
||||
@@ -132,7 +141,7 @@ G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
|
||||
G4double n = (G4double)(G4Poisson(navr));
|
||||
loss = meanLoss*n/navr;
|
||||
}
|
||||
|
||||
// G4cout << "meanLoss= " << meanLoss << " loss= " << loss << G4endl;
|
||||
return loss;
|
||||
}
|
||||
|
||||
@@ -146,20 +155,28 @@ G4double G4IonFluctuations::Dispersion(
|
||||
{
|
||||
G4double electronDensity = material->GetElectronDensity();
|
||||
kineticEnergy = dp->GetKineticEnergy();
|
||||
// G4cout << "e= " << kineticEnergy << " m= " << particleMass
|
||||
// << " tmax= " << tmax << " l= " << length << " q^2= " << chargeSquare << G4endl;
|
||||
G4double gam = kineticEnergy/particleMass + 1.0;
|
||||
beta2 = 1.0 - 1.0/(gam*gam);
|
||||
G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
|
||||
* electronDensity * chargeSquare;
|
||||
G4double siga = (1.0/beta2 - 0.5)*tmax*length*electronDensity*twopi_mc2_rcl2*chargeSquare;
|
||||
// G4cout << "siga= " << siga << G4endl;
|
||||
|
||||
// Low velocity - additional ion charge fluctuations according to
|
||||
// Q.Yang et al., NIM B61(1991)149-155.
|
||||
G4double zeff = electronDensity/(material->GetTotNbOfAtomsPerVolume());
|
||||
//G4cout << "siga= " << siga << " zeff= " << zeff << G4endl;
|
||||
|
||||
if ( beta2 < 3.0*theBohrBeta2*zeff ) {
|
||||
|
||||
G4double a = CoeffitientA (zeff);
|
||||
G4double b = CoeffitientB (material, zeff);
|
||||
siga *= (chargeSquare * a + b);
|
||||
// G4cout << "a= " << a << " b= " << b << G4endl;
|
||||
siga *= (a*chargeSqRatio + b);
|
||||
} else {
|
||||
|
||||
// H.Geissel et al. NIM B, 195 (2002) 3.
|
||||
siga *= RelativisticFactor(material, zeff);
|
||||
}
|
||||
|
||||
return siga;
|
||||
@@ -350,3 +367,16 @@ G4double G4IonFluctuations::CoeffitientB(const G4Material* material, G4double& z
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4IonFluctuations::RelativisticFactor(const G4Material*, G4double& zeff)
|
||||
{
|
||||
// H.Geissel et al. NIM B, 195 (2002) 3.
|
||||
G4double factor = 1.0 + 0.667*theBohrBeta2*(1.0 - beta2)
|
||||
* log(2.0*electron_mass_c2/(5.0*charge*eV))
|
||||
/ ((1.0 - 0.5*beta2)*beta2*zeff) ;
|
||||
factor *= (1.0 + 1.415e-4*chargeSquare/beta2);
|
||||
// G4cout << "factor= " << factor << G4endl;
|
||||
return factor;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4LossTableBuilder.cc,v 1.9 2003/11/25 18:01:48 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4LossTableManager.cc,v 1.37 2003/11/26 14:55:50 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -42,6 +44,12 @@
|
||||
// 02-04-03 Change messenger (V.Ivanchenko)
|
||||
// 26-04-03 Fix retrieve tables (V.Ivanchenko)
|
||||
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
|
||||
// 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
|
||||
// 05-10-03 Add G4VEmProcesses registration and Verbose command (V.Ivanchenko)
|
||||
// 17-10-03 Add SetParameters method (V.Ivanchenko)
|
||||
// 23-10-03 Add control on inactive processes (V.Ivanchenko)
|
||||
// 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
|
||||
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
@@ -57,7 +65,10 @@
|
||||
#include "G4MaterialCutsCouple.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4VMultipleScattering.hh"
|
||||
#include "G4VEmProcess.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
|
||||
G4LossTableManager* G4LossTableManager::theInstance = 0;
|
||||
|
||||
@@ -81,7 +92,12 @@ G4LossTableManager::~G4LossTableManager()
|
||||
size_t msc = msc_vector.size();
|
||||
for (size_t j=0; j<msc; j++) {
|
||||
if(msc_vector[j] ) delete msc_vector[j];
|
||||
} Clear();
|
||||
}
|
||||
size_t emp = emp_vector.size();
|
||||
for (size_t k=0; k<emp; k++) {
|
||||
if(emp_vector[k] ) delete emp_vector[k];
|
||||
}
|
||||
Clear();
|
||||
delete theMessenger;
|
||||
delete tableBuilder;
|
||||
}
|
||||
@@ -114,6 +130,7 @@ G4LossTableManager::G4LossTableManager()
|
||||
buildPreciseRange = false;
|
||||
minEnergyActive = false;
|
||||
maxEnergyActive = false;
|
||||
stepFunctionActive = false;
|
||||
verbose = 0;
|
||||
}
|
||||
|
||||
@@ -142,7 +159,7 @@ void G4LossTableManager::Clear()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::Register(G4VEnergyLossSTD* p)
|
||||
void G4LossTableManager::Register(G4VEnergyLossProcess* p)
|
||||
{
|
||||
n_loss++;
|
||||
loss_vector.push_back(p);
|
||||
@@ -153,14 +170,18 @@ void G4LossTableManager::Register(G4VEnergyLossSTD* p)
|
||||
inv_range_vector.push_back(0);
|
||||
tables_are_built.push_back(false);
|
||||
all_tables_are_built = false;
|
||||
if(integralActive) p->SetIntegral(integral);
|
||||
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
|
||||
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
|
||||
if(!lossFluctuationFlag) p->SetLossFluctuations(false);
|
||||
if(subCutoffFlag) p->SetSubCutoff(true);
|
||||
if(rndmStepFlag) p->SetRandomStep(true);
|
||||
if(stepFunctionActive) p->SetStepFunction(maxRangeVariation, maxFinalStep);
|
||||
if(integralActive) p->SetIntegral(integral);
|
||||
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
|
||||
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::DeRegister(G4VEnergyLossSTD* p)
|
||||
void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
|
||||
{
|
||||
for (G4int i=0; i<n_loss; i++) {
|
||||
if(loss_vector[i] == p) loss_vector[i] = 0;
|
||||
@@ -186,7 +207,24 @@ void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion, G4VEnergyLossSTD* p)
|
||||
void G4LossTableManager::Register(G4VEmProcess* p)
|
||||
{
|
||||
emp_vector.push_back(p);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::DeRegister(G4VEmProcess* p)
|
||||
{
|
||||
size_t emp = emp_vector.size();
|
||||
for (size_t i=0; i<emp; i++) {
|
||||
if(emp_vector[i] == p) emp_vector[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion, G4VEnergyLossProcess* p)
|
||||
{
|
||||
loss_map[ion] = p;
|
||||
}
|
||||
@@ -208,51 +246,71 @@ void G4LossTableManager::ParticleHaveNoLoss(const G4ParticleDefinition* aParticl
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
void G4LossTableManager::Initialise(const G4ParticleDefinition* aParticle)
|
||||
G4bool G4LossTableManager::IsRecalcNeeded(const G4ParticleDefinition* aParticle)
|
||||
{
|
||||
G4bool isNeeded = !all_tables_are_built;
|
||||
if (first_entry || (aParticle == firstParticle && all_tables_are_built) ) {
|
||||
isNeeded = true;
|
||||
all_tables_are_built = false;
|
||||
electron_table_are_built = false;
|
||||
loss_map.clear();
|
||||
for (G4int i=0; i<n_loss; i++) {
|
||||
if(loss_vector[i]) {
|
||||
const G4ProcessManager* pm = loss_vector[i]->GetProcessManager();
|
||||
if (pm->GetProcessActivation(loss_vector[i])) tables_are_built[i] = false;
|
||||
else tables_are_built[i] = true;
|
||||
} else {
|
||||
tables_are_built[i] = true;
|
||||
part_vector[i] = 0;
|
||||
}
|
||||
}
|
||||
Initialise();
|
||||
}
|
||||
|
||||
if (first_entry) {
|
||||
first_entry = false;
|
||||
firstParticle = aParticle;
|
||||
}
|
||||
|
||||
return isNeeded;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4LossTableManager::Initialise()
|
||||
{
|
||||
|
||||
for(G4int j=0; j<n_loss; j++) {
|
||||
|
||||
const G4ParticleDefinition* pd = loss_vector[j]->Particle();
|
||||
if (!pd) {
|
||||
pd = loss_vector[j]->GetProcessManager()->GetParticleType();
|
||||
loss_vector[j]->SetParticle(pd);
|
||||
}
|
||||
if(!tables_are_built[j]) all_tables_are_built = false;
|
||||
if(pd != part_vector[j]) {
|
||||
part_vector[j] = pd;
|
||||
base_part_vector[j] = loss_vector[j]->BaseParticle();
|
||||
}
|
||||
if(1 < verbose) {
|
||||
G4String nm = "unknown";
|
||||
if(pd) nm = pd->GetParticleName();
|
||||
G4cout << "For " << loss_vector[j]->GetProcessName()
|
||||
<< " for " << nm
|
||||
<< " tables_are_built= " << tables_are_built[j]
|
||||
<< " procFlag= " << loss_vector[j]->TablesAreBuilt()
|
||||
<< " all_tables_are_built= " << all_tables_are_built
|
||||
<< G4endl;
|
||||
if (loss_vector[j]) {
|
||||
const G4ParticleDefinition* pd = loss_vector[j]->Particle();
|
||||
if (!pd) {
|
||||
pd = loss_vector[j]->GetProcessManager()->GetParticleType();
|
||||
loss_vector[j]->SetParticle(pd);
|
||||
}
|
||||
if(!tables_are_built[j]) all_tables_are_built = false;
|
||||
if(pd != part_vector[j]) {
|
||||
part_vector[j] = pd;
|
||||
base_part_vector[j] = loss_vector[j]->BaseParticle();
|
||||
}
|
||||
if(0 < verbose) {
|
||||
G4String nm = "unknown";
|
||||
if(pd) nm = pd->GetParticleName();
|
||||
G4cout << "For " << loss_vector[j]->GetProcessName()
|
||||
<< " for " << nm
|
||||
<< " tables_are_built= " << tables_are_built[j]
|
||||
<< " procFlag= " << loss_vector[j]->TablesAreBuilt()
|
||||
<< " all_tables_are_built= " << all_tables_are_built
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All tables have to be rebuilt
|
||||
if (all_tables_are_built && firstParticle == aParticle) {
|
||||
for (G4int i=0; i<n_loss; i++) {
|
||||
tables_are_built[i] = false;
|
||||
}
|
||||
all_tables_are_built = false;
|
||||
electron_table_are_built = false;
|
||||
loss_map.clear();
|
||||
}
|
||||
|
||||
if(1 < verbose) {
|
||||
G4cout << "electron_table_are_built= " << electron_table_are_built
|
||||
if(0 < verbose) {
|
||||
G4cout << "G4LossTableManager::Initialise:"
|
||||
<< " electron_table_are_built= " << electron_table_are_built
|
||||
<< " all_tables_are_built= " << all_tables_are_built
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -265,33 +323,36 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
|
||||
{
|
||||
|
||||
if(0 < verbose) {
|
||||
G4cout << "G4LossTableManager::BuildDEDXTable() for "
|
||||
G4cout << "### G4LossTableManager::BuildDEDXTable() is requested for "
|
||||
<< aParticle->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
Initialise(aParticle);
|
||||
if(aParticle == theElectron) {
|
||||
if(!electron_table_are_built) {
|
||||
eIonisation = BuildTables(theElectron);
|
||||
electron_table_are_built = true;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
G4VEnergyLossProcess* em = loss_vector[i];
|
||||
if(aParticle == part_vector[i]) SetParameters(loss_vector[i]);
|
||||
if (tables_are_built[i] && em->SecondaryParticle() == theElectron && eIonisation ) {
|
||||
em->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// identify all particles and built electron table
|
||||
if(!electron_table_are_built) {
|
||||
eIonisation = BuildTables(theElectron);
|
||||
currentLoss = eIonisation;
|
||||
currentParticle = theElectron;
|
||||
electron_table_are_built = true;
|
||||
}
|
||||
|
||||
// If particle is not an electron
|
||||
if(aParticle != theElectron) {
|
||||
} else {
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
|
||||
if(aParticle == part_vector[i]) {
|
||||
if(tables_are_built[i]) break;
|
||||
if(aParticle == part_vector[i] && !tables_are_built[i]) {
|
||||
SetParameters(loss_vector[i]);
|
||||
// if(tables_are_built[i]) break;
|
||||
if(!base_part_vector[i]) {
|
||||
G4VEnergyLossSTD* hIonisation = BuildTables(aParticle);
|
||||
for(G4int j=0; j<i; j++) {
|
||||
G4VEnergyLossProcess* hIonisation = BuildTables(aParticle);
|
||||
for(G4int j=0; j<n_loss; j++) {
|
||||
if (aParticle == base_part_vector[j]) {
|
||||
tables_are_built[j] = true;
|
||||
G4VEnergyLossSTD* em = loss_vector[j];
|
||||
G4VEnergyLossProcess* em = loss_vector[j];
|
||||
em->Initialise();
|
||||
em->SetDEDXTable(hIonisation->DEDXTable());
|
||||
em->SetRangeTable(hIonisation->RangeTable());
|
||||
@@ -299,22 +360,23 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
|
||||
em->SetLambdaTable(hIonisation->LambdaTable());
|
||||
em->SetSubLambdaTable(hIonisation->SubLambdaTable());
|
||||
loss_map[part_vector[j]] = em;
|
||||
if (em->SecondaryParticle() == theElectron) {
|
||||
if (em->SecondaryParticle() == theElectron && eIonisation) {
|
||||
em->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
}
|
||||
if (0 < verbose) {
|
||||
G4cout << "For " << loss_vector[j]->GetProcessName()
|
||||
<< " for " << part_vector[j]->GetParticleName()
|
||||
<< " base_part= " << base_part_vector[j]->GetParticleName()
|
||||
<< " tables_are_built= " << G4endl;
|
||||
<< " tables are assigned "
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
G4VEnergyLossSTD* em = loss_vector[i];
|
||||
G4VEnergyLossProcess* em = loss_vector[i];
|
||||
for(G4int j=0; j<n_loss; j++) {
|
||||
if (tables_are_built[j] && part_vector[j] == base_part_vector[i]) {
|
||||
G4VEnergyLossSTD* hIonisation = loss_vector[j];
|
||||
G4VEnergyLossProcess* hIonisation = loss_vector[j];
|
||||
tables_are_built[i] = true;
|
||||
em->Initialise();
|
||||
em->SetDEDXTable(hIonisation->DEDXTable());
|
||||
@@ -323,13 +385,13 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
|
||||
em->SetLambdaTable(hIonisation->LambdaTable());
|
||||
em->SetSubLambdaTable(hIonisation->SubLambdaTable());
|
||||
loss_map[part_vector[i]] = em;
|
||||
if (em->SecondaryParticle() == theElectron)
|
||||
if (em->SecondaryParticle() == theElectron && eIonisation)
|
||||
em->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
if (0 < verbose) {
|
||||
G4cout << "For " << em->GetProcessName()
|
||||
<< " for " << part_vector[i]->GetParticleName()
|
||||
<< " base_part= " << base_part_vector[i]->GetParticleName()
|
||||
<< " tables_are_built= " << G4endl;
|
||||
<< " tables are assigned= " << G4endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -340,6 +402,7 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
|
||||
}
|
||||
}
|
||||
|
||||
if(all_tables_are_built) return;
|
||||
all_tables_are_built = true;
|
||||
for (G4int ii=0; ii<n_loss; ii++) {
|
||||
if ( !tables_are_built[ii] ) {
|
||||
@@ -348,35 +411,40 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
|
||||
}
|
||||
}
|
||||
|
||||
if(1 < verbose) {
|
||||
G4cout << "G4LossTableManager::BuildDEDXTable: end; "
|
||||
if(0 < verbose) {
|
||||
G4cout << "### G4LossTableManager::BuildDEDXTable end: "
|
||||
<< "all_tables_are_built= " << all_tables_are_built
|
||||
<< G4endl;
|
||||
}
|
||||
if(all_tables_are_built) {
|
||||
G4cout << "### All dEdx and Range tables are built #####" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4LossTableManager::RetrievePhysicsTables(const G4ParticleDefinition* aParticle,
|
||||
G4VEnergyLossSTD* theLoss)
|
||||
G4VEnergyLossProcess* theLoss)
|
||||
{
|
||||
if(0 < verbose) {
|
||||
G4cout << "G4LossTableManager::RetrievePhysicsTable() for "
|
||||
<< aParticle->GetParticleName()
|
||||
<< "; all_tables_are_built= " << all_tables_are_built
|
||||
<< G4endl;
|
||||
}
|
||||
if (first_entry) Initialise(aParticle);
|
||||
if (all_tables_are_built) return;
|
||||
if(all_tables_are_built) return;
|
||||
|
||||
G4bool hasRange = false;
|
||||
for (G4int i=0; i<n_loss; i++) {
|
||||
G4bool isLast = false;
|
||||
G4int i;
|
||||
for (i=0; i<n_loss; i++) {
|
||||
if ( theLoss == loss_vector[i] ) {
|
||||
if((n_loss-1 == i && part_vector[n_loss-1] != G4Proton::Proton()) ||
|
||||
(n_loss-2 == i && part_vector[n_loss-1] == G4Proton::Proton())) isLast = true;
|
||||
tables_are_built[i] = true;
|
||||
if (theLoss->RangeTable()) {
|
||||
if (part_vector[i] == theElectron) {
|
||||
eIonisation = theLoss;
|
||||
currentLoss = theLoss;
|
||||
currentParticle = theElectron;
|
||||
electron_table_are_built = true;
|
||||
}
|
||||
loss_map[part_vector[i]] = theLoss;
|
||||
@@ -387,17 +455,18 @@ void G4LossTableManager::RetrievePhysicsTables(const G4ParticleDefinition* aPart
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
if (electron_table_are_built && theLoss->SecondaryParticle() == theElectron)
|
||||
theLoss->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
break;
|
||||
}
|
||||
if (electron_table_are_built && theLoss->SecondaryParticle() == theElectron)
|
||||
theLoss->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
}
|
||||
|
||||
if ( hasRange ) {
|
||||
for (G4int j=0; j<n_loss; j++) {
|
||||
if ( base_part_vector[j] == aParticle && !tables_are_built[j] ) {
|
||||
G4VEnergyLossSTD* em = loss_vector[j];
|
||||
G4VEnergyLossProcess* em = loss_vector[j];
|
||||
tables_are_built[j] = true;
|
||||
em->Initialise();
|
||||
em->Initialise();
|
||||
em->SetDEDXTable(theLoss->DEDXTable());
|
||||
em->SetRangeTable(theLoss->RangeTable());
|
||||
em->SetInverseRangeTable(theLoss->InverseRangeTable());
|
||||
@@ -435,15 +504,21 @@ void G4LossTableManager::RetrievePhysicsTables(const G4ParticleDefinition* aPart
|
||||
}
|
||||
|
||||
if(0 < verbose) {
|
||||
G4cout << "G4LossTableManager::RetrievePhysicsTable: end; "
|
||||
G4cout << "G4LossTableManager::RetrievePhysicsTable end: "
|
||||
<< "all_tables_are_built= " << all_tables_are_built
|
||||
<< " i= " << i << " n_loss= " << n_loss
|
||||
<< G4endl;
|
||||
}
|
||||
if(all_tables_are_built) {
|
||||
G4cout << "##### All dEdx and Range tables are retrieved #####" << G4endl;
|
||||
} else if(isLast) {
|
||||
G4Exception("G4LossTableManager ERROR: not all dEdx and Range tables are retrieved");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VEnergyLossSTD* G4LossTableManager::BuildTables(const G4ParticleDefinition* aParticle)
|
||||
G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition* aParticle)
|
||||
{
|
||||
if(0 < verbose) {
|
||||
G4cout << "G4LossTableManager::BuildTables() for "
|
||||
@@ -453,14 +528,14 @@ G4VEnergyLossSTD* G4LossTableManager::BuildTables(const G4ParticleDefinition* aP
|
||||
// Check is it new particle or all tables have to be rebuilt
|
||||
std::vector<G4PhysicsTable*> list;
|
||||
list.clear();
|
||||
std::vector<G4VEnergyLossSTD*> loss_list;
|
||||
std::vector<G4VEnergyLossProcess*> loss_list;
|
||||
loss_list.clear();
|
||||
G4VEnergyLossSTD* em = 0;
|
||||
G4VEnergyLossProcess* em = 0;
|
||||
G4int iem = 0;
|
||||
G4bool no_el = true;
|
||||
|
||||
for (G4int i=0; i<n_loss; i++) {
|
||||
if (aParticle == part_vector[i]) {
|
||||
if (aParticle == part_vector[i] && !tables_are_built[i]) {
|
||||
loss_vector[i]->Initialise();
|
||||
if(no_el && loss_vector[i]->SecondaryParticle() == theElectron) {
|
||||
em = loss_vector[i];
|
||||
@@ -501,25 +576,31 @@ G4VEnergyLossSTD* G4LossTableManager::BuildTables(const G4ParticleDefinition* aP
|
||||
G4PhysicsTable* invrange = tableBuilder->BuildInverseRangeTable(dedx, range);
|
||||
em->SetInverseRangeTable(invrange);
|
||||
inv_range_vector[iem] = invrange;
|
||||
|
||||
/*
|
||||
if(buildPreciseRange) {
|
||||
range->clearAndDestroy();
|
||||
std::vector<G4PhysicsTable*> newlist;
|
||||
newlist.clear();
|
||||
for (G4int i=0; i<n_dedx; i++) {
|
||||
newlist.push_back(loss_list[i]->BuildDEDXTableForPreciseRange());
|
||||
}
|
||||
G4PhysicsTable* dedxForRange = newlist[0];
|
||||
if (1 < n_dedx) dedxForRange = tableBuilder->BuildDEDXTable(newlist);
|
||||
range = tableBuilder->BuildRangeTable(dedx);
|
||||
range = tableBuilder->BuildRangeTable(dedxForRange);
|
||||
for(G4int j=0; j<n_dedx; j++) {
|
||||
newlist[j]->clearAndDestroy();
|
||||
}
|
||||
newlist.clear();
|
||||
}
|
||||
*/
|
||||
|
||||
em->SetRangeTable(range);
|
||||
range_vector[iem] = range;
|
||||
|
||||
loss_map[aParticle] = em;
|
||||
for (G4int j=0; j<n_dedx; j++) {
|
||||
if(loss_list[j]->SecondaryParticle() == theElectron)
|
||||
if(loss_list[j]->SecondaryParticle() == theElectron && eIonisation)
|
||||
loss_list[j]->SetSecondaryRangeTable(eIonisation->RangeTable());
|
||||
|
||||
G4PhysicsTable* lambdaTable = loss_list[j]->BuildLambdaTable();
|
||||
@@ -535,6 +616,8 @@ G4VEnergyLossSTD* G4LossTableManager::BuildTables(const G4ParticleDefinition* aP
|
||||
<< "; ionisation process: " << em->GetProcessName()
|
||||
<< G4endl;
|
||||
}
|
||||
list.clear();
|
||||
loss_list.clear();
|
||||
return em;
|
||||
}
|
||||
|
||||
@@ -544,7 +627,7 @@ void G4LossTableManager::SetLossFluctuations(G4bool val)
|
||||
{
|
||||
lossFluctuationFlag = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetLossFluctuations(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetLossFluctuations(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +637,7 @@ void G4LossTableManager::SetSubCutoff(G4bool val)
|
||||
{
|
||||
subCutoffFlag = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetSubCutoff(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetSubCutoff(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +648,7 @@ void G4LossTableManager::SetIntegral(G4bool val)
|
||||
integral = val;
|
||||
integralActive = true;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetIntegral(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetIntegral(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +658,7 @@ void G4LossTableManager::SetMinSubRange(G4double val)
|
||||
{
|
||||
minSubRange = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetMinSubRange(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetMinSubRange(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +668,7 @@ void G4LossTableManager::SetRandomStep(G4bool val)
|
||||
{
|
||||
rndmStepFlag = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetRandomStep(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetRandomStep(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +679,15 @@ void G4LossTableManager::SetMinEnergy(G4double val)
|
||||
minEnergyActive = true;
|
||||
minKinEnergy = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetMinKinEnergy(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetMinKinEnergy(val);
|
||||
}
|
||||
size_t msc = msc_vector.size();
|
||||
for (size_t j=0; j<msc; j++) {
|
||||
if(msc_vector[j]) msc_vector[j]->SetMinKinEnergy(val);
|
||||
}
|
||||
size_t emp = emp_vector.size();
|
||||
for (size_t k=0; k<emp; k++) {
|
||||
if(emp_vector[k]) emp_vector[k]->SetMinKinEnergy(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +698,33 @@ void G4LossTableManager::SetMaxEnergy(G4double val)
|
||||
maxEnergyActive = true;
|
||||
maxKinEnergy = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetMaxKinEnergy(val);
|
||||
if(loss_vector[i]) loss_vector[i]->SetMaxKinEnergy(val);
|
||||
}
|
||||
size_t msc = msc_vector.size();
|
||||
for (size_t j=0; j<msc; j++) {
|
||||
if(msc_vector[j]) msc_vector[j]->SetMaxKinEnergy(val);
|
||||
}
|
||||
size_t emp = emp_vector.size();
|
||||
for (size_t k=0; k<emp; k++) {
|
||||
if(emp_vector[k]) emp_vector[k]->SetMaxKinEnergy(val);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4LossTableManager::SetVerbose(G4int val)
|
||||
{
|
||||
verbose = val;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
if(loss_vector[i]) loss_vector[i]->SetVerboseLevel(val);
|
||||
}
|
||||
size_t msc = msc_vector.size();
|
||||
for (size_t j=0; j<msc; j++) {
|
||||
if(msc_vector[j]) msc_vector[j]->SetVerboseLevel(val);
|
||||
}
|
||||
size_t emp = emp_vector.size();
|
||||
for (size_t k=0; k<emp; k++) {
|
||||
if(emp_vector[k]) emp_vector[k]->SetVerboseLevel(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,10 +732,11 @@ void G4LossTableManager::SetMaxEnergy(G4double val)
|
||||
|
||||
void G4LossTableManager::SetStepLimits(G4double v1, G4double v2)
|
||||
{
|
||||
stepFunctionActive = true;
|
||||
maxRangeVariation = v1;
|
||||
maxFinalStep = v2;
|
||||
for(G4int i=0; i<n_loss; i++) {
|
||||
loss_vector[i]->SetStepLimits(v1, v2);
|
||||
if(loss_vector[i]) loss_vector[i]->SetStepFunction(v1, v2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,6 +747,14 @@ void G4LossTableManager::SetBuildPreciseRange(G4bool val)
|
||||
buildPreciseRange = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4LossTableManager::SetParameters(G4VEnergyLossProcess* p)
|
||||
{
|
||||
if(stepFunctionActive) p->SetStepFunction(maxRangeVariation, maxFinalStep);
|
||||
if(integralActive) p->SetIntegral(integral);
|
||||
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
|
||||
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MscModel.cc,v 1.13 2003/11/26 10:01:13 urban Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -41,9 +43,15 @@
|
||||
// (L.Urban)
|
||||
// 30-05-03 misprint in SampleCosineTheta corrected(L.Urban)
|
||||
// 27-03-03 Rename (V.Ivanchenko)
|
||||
// 04-06-03 Fix compilation warnings (V.Ivanchenko)
|
||||
//
|
||||
// 05-08-03 angle distribution has been modified (L.Urban)
|
||||
// 06-11-03 precision problems solved for high energy (PeV) particles
|
||||
// change in the tail of the angular distribution
|
||||
// highKinEnergy is set to 100 PeV (L.Urban)
|
||||
//
|
||||
// 10-11-03 highKinEnergy is set back to 100 TeV, some tail tuning +
|
||||
// cleaning (L.Urban)
|
||||
// 26-11-03 correction in TrueStepLength :
|
||||
// trueLength <= currentRange (L.Urban)
|
||||
|
||||
// Class Description:
|
||||
//
|
||||
@@ -65,22 +73,25 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4MscModel::G4MscModel(G4double& m_dtrl, G4double& m_NuclCorrPar,
|
||||
G4double& m_FactPar, G4double& m_facxsi,
|
||||
G4MscModel::G4MscModel(G4double& m_dtrl, G4double& m_NuclCorrPar,
|
||||
G4double& m_FactPar, G4double& m_facxsi,
|
||||
G4bool& m_samplez, const G4String& nam)
|
||||
: G4VEmModel(nam),
|
||||
highKinEnergy(10.0*TeV),
|
||||
lowKinEnergy(0.1*keV),
|
||||
taubig(8.0),
|
||||
tausmall(1.e-14),
|
||||
taulim(1.e-5),
|
||||
tausmall(1.e-20),
|
||||
taulim(1.e-6),
|
||||
dtrl(m_dtrl),
|
||||
NuclCorrPar (m_NuclCorrPar),
|
||||
FactPar(m_FactPar),
|
||||
facxsi(m_facxsi),
|
||||
samplez(m_samplez),
|
||||
stepmin(1.e-6*mm)
|
||||
{}
|
||||
samplez(m_samplez)
|
||||
{
|
||||
highKinEnergy = 100.0*TeV;
|
||||
lowKinEnergy = 0.1*keV;
|
||||
stepmin = 1.e-6*mm;
|
||||
currentRange = 0. ;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -94,33 +105,14 @@ G4bool G4MscModel::IsInCharge(const G4ParticleDefinition* p)
|
||||
{
|
||||
return (p->GetPDGCharge() != 0.0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4MscModel::Initialise(const G4ParticleDefinition* p,
|
||||
const G4DataVector&)
|
||||
{
|
||||
// set values of some data members
|
||||
if((p->GetParticleName() == "e-") || (p->GetParticleName() == "e+"))
|
||||
{
|
||||
// parameters for e+/e-
|
||||
alfa1 = 1.45 ;
|
||||
alfa2 = 0.60 ;
|
||||
alfa3 = 0.30 ;
|
||||
b = 1. ;
|
||||
xsi = facxsi*2.22 ;
|
||||
c0 = 2.30 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// parameters for heavy particles
|
||||
alfa1 = 1.10 ;
|
||||
alfa2 = 0.14 ;
|
||||
alfa3 = 0.07 ;
|
||||
b = 1. ;
|
||||
xsi = facxsi*2.70 ;
|
||||
c0 = 1.40 ;
|
||||
}
|
||||
xsi = facxsi*2.8215 ;
|
||||
b = 1. ;
|
||||
sigmafactor = twopi*classic_electr_radius*classic_electr_radius;
|
||||
particle = p;
|
||||
mass = particle->GetPDGMass();
|
||||
@@ -129,12 +121,13 @@ void G4MscModel::Initialise(const G4ParticleDefinition* p,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4MscModel::CrossSection(const G4Material* material,
|
||||
G4double G4MscModel::CrossSection(const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double kineticEnergy,
|
||||
G4double,
|
||||
G4double)
|
||||
{
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
const G4ElementVector* theElementVector = material->GetElementVector();
|
||||
const G4double* NbOfAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
|
||||
G4int NumberOfElements = material->GetNumberOfElements();
|
||||
@@ -150,7 +143,6 @@ G4double G4MscModel::CrossSection(const G4Material* material,
|
||||
kineticEnergy,atomicNumber,atomicWeight);
|
||||
}
|
||||
sigma *= sigmafactor;
|
||||
|
||||
// Calculate lambda
|
||||
if ( sigma > 0.0) sigma = 1.0/sigma;
|
||||
else sigma = DBL_MAX;
|
||||
@@ -181,7 +173,6 @@ G4double G4MscModel::ComputeTransportCrossSection(
|
||||
10000.0*MeV};
|
||||
|
||||
// corr. factors for e-/e+ lambda
|
||||
|
||||
G4double celectron[15][23] =
|
||||
{{1.125,1.072,1.051,1.047,1.047,1.050,1.052,1.054,
|
||||
1.054,1.057,1.062,1.069,1.075,1.090,1.105,1.111,
|
||||
@@ -225,7 +216,6 @@ G4double G4MscModel::ComputeTransportCrossSection(
|
||||
{65.87,59.06,15.87,7.570,5.567,3.650,2.682,2.182,
|
||||
1.939,1.579,1.325,1.178,1.108,1.014,0.965,0.947,
|
||||
0.941,0.938,0.940,0.944,0.946,0.954,1.1922 },
|
||||
// {45.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239, // paper.....
|
||||
{55.60,47.34,15.92,7.810,5.755,3.767,2.760,2.239,
|
||||
1.985,1.609,1.343,1.188,1.113,1.013,0.960,0.939,
|
||||
0.933,0.930,0.933,0.936,0.939,0.949,1.2026 }};
|
||||
@@ -326,7 +316,7 @@ G4double G4MscModel::ComputeTransportCrossSection(
|
||||
if ( x0 < -1. || eKineticEnergy <= 10.*MeV)
|
||||
{
|
||||
x0 = -1.;
|
||||
corrnuclsize = 1.;
|
||||
corrnuclsize = 1.;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -364,7 +354,6 @@ G4double G4MscModel::ComputeTransportCrossSection(
|
||||
T = Tdat[iT+1]; E = T + electron_mass_c2;
|
||||
G4double b2big = T*(E+electron_mass_c2)/(E*E);
|
||||
G4double ratb2 = (beta2-b2small)/(b2big-b2small);
|
||||
|
||||
G4double c1,c2,cc1,cc2,corr;
|
||||
if (charge < 0.)
|
||||
{
|
||||
@@ -408,22 +397,22 @@ G4double G4MscModel::ComputeTransportCrossSection(
|
||||
G4double G4MscModel::GeomPathLength(
|
||||
G4PhysicsTable* theLambdaTable,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4ParticleDefinition* theParticle,
|
||||
G4double& T0,
|
||||
G4double lambda,
|
||||
G4double range,
|
||||
G4double truePathLength)
|
||||
const G4ParticleDefinition* theParticle,
|
||||
G4double& T0,
|
||||
G4double lambda,
|
||||
G4double range,
|
||||
G4double truePathLength)
|
||||
{
|
||||
// do the true -> geom transformation
|
||||
const G4double ztmin = 1./3., ztmax = 0.98 ;
|
||||
const G4double ztmax = 101./103. ;
|
||||
if (theParticle != particle ) {
|
||||
particle = theParticle;
|
||||
mass = particle->GetPDGMass();
|
||||
charge = particle->GetPDGCharge()/eplus;
|
||||
}
|
||||
currentKinEnergy = T0;
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
currentRadLength = material->GetRadlen();
|
||||
currentRange = range ;
|
||||
currentRadLength = couple->GetMaterial()->GetRadlen();
|
||||
|
||||
lambda0 = lambda;
|
||||
lambda1 = -1.;
|
||||
@@ -432,15 +421,20 @@ G4double G4MscModel::GeomPathLength(
|
||||
zm = 1.;
|
||||
cthm = 1.;
|
||||
tPathLength = truePathLength;
|
||||
|
||||
// this correction needed to run MSC with eIoni and eBrem inactivated
|
||||
// and makes no harm for a normal run
|
||||
if(tPathLength > range)
|
||||
tPathLength = range ;
|
||||
|
||||
G4double tau = tPathLength/lambda0 ;
|
||||
|
||||
if (tau <= tausmall) return tPathLength;
|
||||
|
||||
G4double zmean = tPathLength;
|
||||
|
||||
if (tPathLength < range*dtrl) {
|
||||
zmean = lambda0*(1.-exp(-tau));
|
||||
|
||||
if(tau < taulim) zmean = tPathLength*(1.-0.5*tPathLength/lambda0) ;
|
||||
} else {
|
||||
G4LossTableManager* theManager = G4LossTableManager::Instance();
|
||||
G4double T1 = theManager->GetEnergy(particle,range-tPathLength,couple);
|
||||
@@ -449,8 +443,9 @@ G4double G4MscModel::GeomPathLength(
|
||||
G4bool bb;
|
||||
lambda1 = ((*theLambdaTable)[couple->GetIndex()])->GetValue(T1,bb);
|
||||
} else {
|
||||
lambda1 = CrossSection(material,particle,T1,0.0,1.0);
|
||||
lambda1 = CrossSection(couple,particle,T1,0.0,1.0);
|
||||
}
|
||||
|
||||
if (T0 > particle->GetPDGMass()) alam = lambda0*tPathLength/(lambda0-lambda1) ;
|
||||
G4double blam = 1.+alam/lambda0 ;
|
||||
if (tPathLength < 2.*dtrl*range) {
|
||||
@@ -468,19 +463,16 @@ G4double G4MscModel::GeomPathLength(
|
||||
// sample z
|
||||
G4double zPathLength = zmean ;
|
||||
G4double zt = zmean/tPathLength ;
|
||||
if (tPathLength >= stepmin && samplez && zt > ztmin && zt < ztmax) {
|
||||
if (tPathLength >= stepmin && samplez && zt > 0.5 && zt < ztmax)
|
||||
{
|
||||
G4double cz = 0.5*(3.*zt-1.)/(1.-zt) ;
|
||||
G4double cz1 = 1.+cz ;
|
||||
G4double u0 = cz/cz1 ;
|
||||
G4double u,grej ;
|
||||
G4double grej0 = exp(cz*log(u0))*(1.-u0) ;
|
||||
do {
|
||||
u = exp(log(G4UniformRand())/cz1) ;
|
||||
grej = exp(cz*log(u))*(1.-u) ;
|
||||
if (grej > grej0)
|
||||
G4cout << "G4MscModel: Warning! majorant "
|
||||
<< grej0 << " < " << grej << G4endl;
|
||||
} while (grej < grej0*G4UniformRand()) ;
|
||||
grej = exp(cz*log(u/u0))*(1.-u)/(1.-u0) ;
|
||||
} while (grej < G4UniformRand()) ;
|
||||
zPathLength = tPathLength*u ;
|
||||
}
|
||||
|
||||
@@ -492,6 +484,7 @@ G4double G4MscModel::GeomPathLength(
|
||||
G4double G4MscModel::TrueStepLength(G4double geomStepLength)
|
||||
{
|
||||
G4double trueLength = geomStepLength;
|
||||
trueLength = geomStepLength;
|
||||
if (geomStepLength > lambda0*tausmall) {
|
||||
G4double blam = 1.+alam/lambda0;
|
||||
if (lambda1 < 0.) {
|
||||
@@ -502,23 +495,20 @@ G4double G4MscModel::TrueStepLength(G4double geomStepLength)
|
||||
trueLength = alam*(1.-exp(log(1.-blam*geomStepLength/alam)/blam));
|
||||
else
|
||||
trueLength = tPathLength;
|
||||
|
||||
} else {
|
||||
if (geomStepLength <= zm) {
|
||||
|
||||
// ??? here is a problems - redefine variable
|
||||
lambdam = -1.;
|
||||
|
||||
if(blam*geomStepLength < alam )
|
||||
if(blam*geomStepLength < alam )
|
||||
trueLength = alam*(1.-exp(log(1.-blam*geomStepLength/alam)/blam));
|
||||
else
|
||||
trueLength = 0.5*tPathLength;
|
||||
|
||||
} else {
|
||||
G4double clam = 1.+alam/lambdam;
|
||||
if(clam*(geomStepLength-zm)/(alam*cthm) < 1.)
|
||||
trueLength = 0.5*tPathLength + alam*(1.-
|
||||
exp(log(1.-clam*(geomStepLength-zm)/(alam*cthm)))/clam) ;
|
||||
exp(log(1.-clam*(geomStepLength-zm)/(alam*cthm))/clam)) ;
|
||||
else
|
||||
trueLength = tPathLength;
|
||||
}
|
||||
@@ -527,6 +517,8 @@ G4double G4MscModel::TrueStepLength(G4double geomStepLength)
|
||||
if(trueLength < geomStepLength) trueLength = geomStepLength;
|
||||
}
|
||||
|
||||
if(trueLength > currentRange) trueLength = currentRange ;
|
||||
|
||||
return trueLength;
|
||||
}
|
||||
|
||||
@@ -534,9 +526,9 @@ G4double G4MscModel::TrueStepLength(G4double geomStepLength)
|
||||
|
||||
G4double G4MscModel::SampleCosineTheta(G4double trueStepLength)
|
||||
{
|
||||
G4double cth = 1.;
|
||||
G4double cth = 1. ;
|
||||
|
||||
currentTau = trueStepLength/lambda0;
|
||||
// G4cout << "tau= " << currentTau << G4endl;
|
||||
if(trueStepLength < stepmin)
|
||||
cth = exp(-currentTau) ;
|
||||
else
|
||||
@@ -555,129 +547,142 @@ G4double G4MscModel::SampleCosineTheta(G4double trueStepLength)
|
||||
if(currentTau > taubig) cth = -1.+2.*G4UniformRand();
|
||||
else
|
||||
{
|
||||
const G4double amax = 25. ;
|
||||
const G4double tau0 = 0.02 ;
|
||||
const G4double c_highland = 13.6*MeV, corr_highland=0.038 ;
|
||||
|
||||
G4double a ;
|
||||
|
||||
// for all particles take the width of the central part
|
||||
// from the Highland formula
|
||||
// (Particle Physics Booklet, July 2002, eq. 26.10)
|
||||
G4double Q = abs(charge) ;
|
||||
G4double xx0 = trueStepLength/currentRadLength;
|
||||
G4double betacp = currentKinEnergy*(currentKinEnergy+2.*mass)/
|
||||
(currentKinEnergy+mass) ;
|
||||
G4double theta0 = c_highland*Q*sqrt(xx0)*
|
||||
(1.+corr_highland*log(xx0))/betacp ;
|
||||
G4double beta=sqrt(currentKinEnergy*(currentKinEnergy+2.*mass))/
|
||||
(currentKinEnergy+mass) ;
|
||||
|
||||
// corr to Highland for small thickness (t/X0)
|
||||
const G4double xx0lim1=1.e-3,xx0lim2=0.055,
|
||||
corr1=0.88, corr2=-0.03 ;
|
||||
G4double corr = 1. ;
|
||||
if(xx0 < xx0lim2)
|
||||
{
|
||||
corr = corr1/(1.+corr2*log(xx0/xx0lim1)) ;
|
||||
theta0 *= corr ;
|
||||
}
|
||||
|
||||
|
||||
// corr to Highland for nonrelativistic particles
|
||||
const G4double blim = 0.400, corr3 = 1.733 ,
|
||||
corr4 = 1.+blim*corr3 ;
|
||||
G4double corrbeta = 1. ;
|
||||
if(beta < blim)
|
||||
{
|
||||
corrbeta = corr4/(1.+beta*corr3) ;
|
||||
theta0 *= corrbeta ;
|
||||
}
|
||||
|
||||
if (theta0 > taulim) a = 0.5/(1.-cos(theta0)) ;
|
||||
else a = 1.0/(theta0*theta0) ;
|
||||
|
||||
|
||||
G4double xmeanth = exp(-currentTau);
|
||||
G4double xmeanth1 = 1.-xmeanth ;
|
||||
if(currentTau < taulim) xmeanth1 = currentTau ;
|
||||
|
||||
const G4double x1fac1 = exp(-xsi) ;
|
||||
const G4double x1fac2 = (1.-(1.+xsi)*x1fac1)/(1.-x1fac1) ;
|
||||
const G4double x1fac3 = 1.3 ; // x1fac3 >= 1. !!!!!!!!!
|
||||
|
||||
G4double a;
|
||||
|
||||
// for heavy particles take the width of the cetral part
|
||||
// from the Highland formula
|
||||
// (Particle Physics Booklet, July 2002, eq. 26.10)
|
||||
if(mass > electron_mass_c2) // + other conditions (beta, x/X0,...?)
|
||||
{
|
||||
G4double Q = abs(charge) ;
|
||||
G4double xx0 = trueStepLength/currentRadLength;
|
||||
G4double betacp = currentKinEnergy*(currentKinEnergy+2.*mass)/
|
||||
(currentKinEnergy+mass) ;
|
||||
G4double theta0 = c_highland*Q*sqrt(xx0)*
|
||||
(1.+corr_highland*log(xx0))/betacp ;
|
||||
|
||||
if (theta0 > tausmall) a = 0.5/(1.-cos(theta0)) ;
|
||||
else a = 1.0/(theta0*theta0) ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double w = log(currentTau/tau0) ;
|
||||
if (currentTau < tau0) a = (alfa1-alfa2*w)/currentTau ;
|
||||
else a = (alfa1+alfa3*w)/currentTau ;
|
||||
}
|
||||
|
||||
G4double xmeanth = exp(-currentTau);
|
||||
|
||||
G4double xmean1,xmean2,eaa,b1,bx,ebx,eb1,c,qprob,prob;
|
||||
|
||||
G4double ea,eaa,xmean1 ;
|
||||
G4double b1 = 2., bx = 2., c = 1., c1 = 0.,
|
||||
eb1 = 0., ebx = 0., xmean2 = 0. ;
|
||||
G4double prob = 1., qprob ;
|
||||
G4double x0 = 1.-xsi/a;
|
||||
G4double ea = 0.;
|
||||
G4double oneminusx0=xsi/a ;
|
||||
G4double oneplusx0=2.+xsi/a ;
|
||||
|
||||
if (x0 <= -1.)
|
||||
{
|
||||
// 1 model fuction only
|
||||
|
||||
if (x0 <= -1.)
|
||||
{
|
||||
// 2 model fuctions only
|
||||
// in order to have xmean1 > xmeanth -> qprob < 1
|
||||
x0 = -1.;
|
||||
|
||||
if( a < 1./(1.-xmeanth)) a = 1./(1.-xmeanth) ;
|
||||
|
||||
if(a*(1.-x0) < amax) ea = exp(-a*(1.-x0));
|
||||
|
||||
if( a < 1./xmeanth1)
|
||||
a = 1./xmeanth1 ;
|
||||
|
||||
oneminusx0 = 1.-x0 ;
|
||||
oneplusx0 = 1.+x0 ;
|
||||
ea = exp(-a*oneminusx0);
|
||||
eaa = 1.-ea ;
|
||||
xmean1 = 1.-1./a+(1.-x0)*ea/eaa ;
|
||||
|
||||
c = 2. ;
|
||||
b1 = b+1. ;
|
||||
bx = b1 ;
|
||||
eb1 = b1 ;
|
||||
ebx = b1 ;
|
||||
xmean2 = 0. ;
|
||||
|
||||
prob = 1. ;
|
||||
xmean1 = 1.-1./a+oneminusx0*ea/eaa ;
|
||||
qprob = xmeanth/xmean1 ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2 model fuctions
|
||||
// 3 model fuctions
|
||||
// in order to have xmean1 > xmeanth
|
||||
if((1.-x1fac2/a) < xmeanth)
|
||||
{
|
||||
a = x1fac3*x1fac2/(1.-xmeanth) ;
|
||||
a = x1fac3*x1fac2/xmeanth1 ;
|
||||
x0 = 1.-xsi/a ;
|
||||
oneminusx0=xsi/a ;
|
||||
oneplusx0=2.+xsi/a ;
|
||||
}
|
||||
|
||||
if(a*(1.-x0) < amax) ea = exp(-a*(1.-x0));
|
||||
ea = x1fac1 ;
|
||||
eaa = 1.-ea ;
|
||||
xmean1 = 1.-x1fac2/a ;
|
||||
|
||||
eaa = 1.-ea ;
|
||||
xmean1 = 1.-1./a+(1.-x0)*ea/eaa ;
|
||||
b = xmean1 ;
|
||||
b1 = b+1. ;
|
||||
bx = (xsi/eaa-1.)/a ;
|
||||
|
||||
// c from continuity of the 1st derivative
|
||||
c = xsi/eaa-1. ;
|
||||
if(c == 2.)
|
||||
{
|
||||
xmean2 = b-b1*bx*log(b1/bx)/oneplusx0 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ea = x1fac1 ;
|
||||
eaa = 1.-ea ;
|
||||
xmean1 = 1.-x1fac2/a ;
|
||||
c1 = c-1. ;
|
||||
eb1 = exp(c1*log(b1)) ;
|
||||
ebx = exp(c1*log(bx)) ;
|
||||
xmean2 = ((b1*ebx-eb1*bx)/(c-2.)+ebx+x0*eb1)/(eb1-ebx) ;
|
||||
}
|
||||
|
||||
// from continuity of the 1st derivatives
|
||||
c = a*(b-x0);
|
||||
if(a*currentTau < c0) c = c0*(b-x0)/currentTau ;
|
||||
|
||||
if(c == 1.) c=1.000001 ;
|
||||
if(c == 2.) c=2.000001 ;
|
||||
if(c == 3.) c=3.000001 ;
|
||||
|
||||
b1 = b+1. ;
|
||||
bx=b-x0 ;
|
||||
eb1=exp((c-1.)*log(b1)) ;
|
||||
ebx=exp((c-1.)*log(bx)) ;
|
||||
xmean2 = (x0*eb1+ebx+(eb1*bx-b1*ebx)/(2.-c))/(eb1-ebx) ;
|
||||
|
||||
G4double cnorm1 = a/eaa ;
|
||||
G4double f1x0 = cnorm1*exp(-a*(1.-x0)) ;
|
||||
G4double cnorm2 = (c-1.)*eb1*ebx/(eb1-ebx) ;
|
||||
G4double f2x0 = cnorm2/exp(c*log(b-x0)) ;
|
||||
|
||||
G4double f1x0 = a*ea/eaa ;
|
||||
G4double f2x0 ;
|
||||
if(c == 2.)
|
||||
f2x0 = b1/(oneplusx0*bx) ;
|
||||
else
|
||||
f2x0 = c1*eb1/(bx*(eb1-ebx)) ;
|
||||
// from continuity at x=x0
|
||||
prob = f2x0/(f1x0+f2x0) ;
|
||||
// from xmean = xmeanth
|
||||
qprob = (f1x0+f2x0)*xmeanth/(f2x0*xmean1+f1x0*xmean2) ;
|
||||
}
|
||||
|
||||
|
||||
// protection against prob or qprob > 1 and
|
||||
// prob or qprob < 0
|
||||
if((qprob > 1.) || (qprob < 0.) || (prob > 1.) || (prob < 0.))
|
||||
{
|
||||
qprob = 1. ;
|
||||
prob = (xmeanth-xmean2)/(xmean1-xmean2);
|
||||
}
|
||||
// protection against qprob > 1
|
||||
if(qprob > 1.) qprob = 1. ;
|
||||
|
||||
// sampling of costheta
|
||||
if (G4UniformRand() < qprob)
|
||||
{
|
||||
if (G4UniformRand() < prob)
|
||||
cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
|
||||
else
|
||||
cth = b-b1*bx/exp(log(ebx-G4UniformRand()*(ebx-eb1))/(c-1.)) ;
|
||||
{
|
||||
if(c == 2.)
|
||||
cth = b-b1*bx/(bx+oneplusx0*G4UniformRand()) ;
|
||||
else
|
||||
cth = b-b1*bx/exp(log(ebx+(eb1-ebx)*G4UniformRand())/c1) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -685,11 +690,10 @@ G4double G4MscModel::SampleCosineTheta(G4double trueStepLength)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//G4cout << "cth= " << cth << G4endl;
|
||||
return cth;
|
||||
}
|
||||
}
|
||||
|
||||
return cth ;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4MscModel::SampleDisplacement()
|
||||
@@ -708,14 +712,15 @@ G4double G4MscModel::SampleDisplacement()
|
||||
rmean = -kappa*currentTau;
|
||||
rmean = -exp(rmean)/(kappa*kappami1);
|
||||
rmean += currentTau-kappapl1/kappa+kappa*etau/kappami1;
|
||||
// G4cout << "tau= " << currentTau << " lambda0= " << lambda0 << " etau= " << etau << " kappa= " << kappa << G4endl;
|
||||
}
|
||||
if (rmean>0.) rmean = 2.*lambda0*sqrt(rmean/3.0);
|
||||
else rmean = 0.;
|
||||
// G4cout << "rmean= " << rmean << G4endl;
|
||||
}
|
||||
return rmean;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,173 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MultipleScatteringSTD.cc,v 1.22 2003/06/02 08:47:49 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
// 16/05/01 value of cparm changed , L.Urban
|
||||
// 18/05/01 V.Ivanchenko Clean up against Linux ANSI compilation
|
||||
// 07/08/01 new methods Store/Retrieve PhysicsTable (mma)
|
||||
// 23-08-01 new angle and z distribution,energy dependence reduced,
|
||||
// Store,Retrieve methods commented out temporarily, L.Urban
|
||||
// 27-08-01 in BuildPhysicsTable:aParticleType.GetParticleName()=="mu+" (mma)
|
||||
// 28-08-01 GetContinuousStepLimit and AlongStepDoIt moved from .icc file (mma)
|
||||
// 03-09-01 value of data member factlim changed, L.Urban
|
||||
// 10-09-01 small change in GetContinuousStepLimit, L.Urban
|
||||
// 11-09-01 G4MultipleScatteringx put as default G4MultipleScattering
|
||||
// store/retrieve physics table reactivated (mma)
|
||||
// 13-09-01 corr. in ComputeTransportCrossSection, L.Urban
|
||||
// 14-09-01 protection in GetContinuousStepLimit, L.Urban
|
||||
// 17-09-01 migration of Materials to pure STL (mma)
|
||||
// 27-09-01 value of data member factlim changed, L.Urban
|
||||
// 31-10-01 big fixed in PostStepDoIt,L.Urban
|
||||
// 17-04-02 NEW angle distribution + boundary algorithm modified, L.Urban
|
||||
// 22-04-02 boundary algorithm modified -> important improvement in timing (L.Urban)
|
||||
// 24-04-02 some minor changes in boundary algorithm, L.Urban
|
||||
// 06-05-02 bug fixed in GetContinuousStepLimit, L.Urban
|
||||
// 24-05-02 changes in angle distribution and boundary algorithm, L.Urban
|
||||
// 11-06-02 bug fixed in ComputeTransportCrossSection, L.Urban
|
||||
// 12-08-02 bug fixed in PostStepDoIt (lateral displacement), L.Urban
|
||||
// 15-08-02 new angle distribution, L.Urban
|
||||
// 26-09-02 angle distribution + boundary algorithm modified, L.Urban
|
||||
// 15-10-02 temporary fix for proton scattering
|
||||
// 30-10-02 modified angle distribution,mods in boundary algorithm,
|
||||
// changes in data members, L.Urban
|
||||
// 11-12-02 precision problem in ComputeTransportCrossSection
|
||||
// for small Tkin/for heavy particles cured from L.Urban
|
||||
// 20-01-03 Migrade to cut per region (V.Ivanchenko)
|
||||
// 05-02-03 changes in data members, new sampling for geom.
|
||||
// path length, step dependence reduced with new
|
||||
// method
|
||||
// 28-03-03 Move to model design (V.Ivanchenko)
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4MultipleScatteringSTD.hh"
|
||||
#include "G4MscModel.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4MultipleScatteringSTD::G4MultipleScatteringSTD(const G4String& processName)
|
||||
: G4VMultipleScattering(processName),
|
||||
lowKineticEnergy(0.1*keV),
|
||||
highKineticEnergy(100.*TeV),
|
||||
totBins(100),
|
||||
facrange(0.199),
|
||||
tlimit(1.e10*mm),
|
||||
tlimitmin(1.e-7*mm),
|
||||
dtrl(0.15),
|
||||
NuclCorrPar (0.0615),
|
||||
FactPar(0.40),
|
||||
facxsi(1.0),
|
||||
cf(1.001),
|
||||
stepnolastmsc(-1000000),
|
||||
nsmallstep(5),
|
||||
samplez(true)
|
||||
{
|
||||
SetBinning(totBins);
|
||||
SetMinKinEnergy(lowKineticEnergy);
|
||||
SetMaxKinEnergy(highKineticEnergy);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4MultipleScatteringSTD::~G4MultipleScatteringSTD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4MultipleScatteringSTD::InitialiseProcess(const G4ParticleDefinition& particle)
|
||||
{
|
||||
if (particle.GetParticleType() == "nucleus") {
|
||||
SetBoundary(false);
|
||||
SetLateralDisplasmentFlag(false);
|
||||
SetBuildLambdaTable(false);
|
||||
} else {
|
||||
SetBoundary(true);
|
||||
SetLateralDisplasmentFlag(true);
|
||||
SetBuildLambdaTable(true);
|
||||
}
|
||||
G4VEmModel* em = new G4MscModel(dtrl,NuclCorrPar,FactPar,facxsi,samplez);
|
||||
em->SetLowEnergyLimit(0.1*keV);
|
||||
em->SetHighEnergyLimit(100.0*TeV);
|
||||
AddEmModel(1, em);
|
||||
boundary = BoundaryAlgorithmFlag();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4MultipleScatteringSTD::TruePathLengthLimit(const G4Track& track,
|
||||
G4double& lambda,
|
||||
G4double currentMinimalStep)
|
||||
{
|
||||
|
||||
G4double tPathLength = currentMinimalStep;
|
||||
|
||||
// special treatment near boundaries ?
|
||||
if (boundary) {
|
||||
|
||||
G4int stepno = track.GetCurrentStepNumber() ;
|
||||
// first step
|
||||
if (stepno == 1) {
|
||||
stepnolastmsc = -1000000 ;
|
||||
tlimit = 1.e10;
|
||||
} else if (stepno > 1) {
|
||||
|
||||
if (track.GetStep()->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) {
|
||||
|
||||
stepnolastmsc = stepno;
|
||||
// if : diff.treatment for small/not small Z
|
||||
G4double range = CurrentRange();
|
||||
if (range > lambda) tlimit = facrange*range;
|
||||
else tlimit = facrange*lambda;
|
||||
|
||||
if(tlimit < tlimitmin) tlimit = tlimitmin;
|
||||
if(tPathLength > tlimit) tPathLength = tlimit;
|
||||
|
||||
} else if (stepno > stepnolastmsc && stepno - stepnolastmsc < nsmallstep
|
||||
&& tPathLength > tlimit) {
|
||||
tlimit *= cf;
|
||||
tPathLength = tlimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tPathLength;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4MultipleScatteringSTD::PrintInfoDefinition()
|
||||
{
|
||||
G4VMultipleScattering::PrintInfoDefinition();
|
||||
if(boundary) {
|
||||
G4cout << " Boundary algorithm is active with facrange= "
|
||||
<< facrange
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4SCProcessorStand.cc,v 1.9 2003/07/21 12:52:10 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UniversalFluctuation.cc,v 1.13 2003/11/13 10:10:32 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
@@ -36,15 +39,12 @@
|
||||
// 28-12-02 add method Dispersion (V.Ivanchenko)
|
||||
// 07-02-03 change signature (V.Ivanchenko)
|
||||
// 13-02-03 Add name (V.Ivanchenko)
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
|
||||
// 07-11-03 Fix problem of rounding of double in G4UniversalFluctuations
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
#include "G4UniversalFluctuation.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Poisson.hh"
|
||||
@@ -54,7 +54,7 @@
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
G4UniversalFluctuation::G4UniversalFluctuation(const G4String& nam)
|
||||
:G4VEmFluctuationModel(nam),
|
||||
particle(0),
|
||||
@@ -63,8 +63,8 @@ G4UniversalFluctuation::G4UniversalFluctuation(const G4String& nam)
|
||||
minLoss(0.000001*eV),
|
||||
problim(0.01),
|
||||
alim(10.),
|
||||
nmaxCont1(4),
|
||||
nmaxCont2(16)
|
||||
nmaxCont1(4.),
|
||||
nmaxCont2(16.)
|
||||
{
|
||||
lastMaterial = 0;
|
||||
sumalim = -log(problim);
|
||||
@@ -77,7 +77,7 @@ G4UniversalFluctuation::~G4UniversalFluctuation()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4UniversalFluctuation::Initialise(const G4ParticleDefinition* part)
|
||||
void G4UniversalFluctuation::InitialiseMe(const G4ParticleDefinition* part)
|
||||
{
|
||||
particle = part;
|
||||
particleMass = part->GetPDGMass();
|
||||
@@ -114,7 +114,7 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
|
||||
|
||||
// Validity range for delta electron cross section
|
||||
G4double loss, siga;
|
||||
|
||||
// G4cout << "### tmax= " << tmax << " kappa= " << minNumberInteractionsBohr << " l= " << length << G4endl;
|
||||
// Gaussian fluctuation
|
||||
if(meanLoss >= minNumberInteractionsBohr*tmax || tmax <= ipotFluct*minNumberInteractionsBohr)
|
||||
{
|
||||
@@ -125,6 +125,7 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
|
||||
do {
|
||||
loss = G4RandGauss::shoot(meanLoss,siga);
|
||||
} while (loss < 0. || loss > 2.*meanLoss);
|
||||
// G4cout << "de= " << meanLoss << " fluc= " << loss-meanLoss << " sig= " << siga << G4endl;
|
||||
|
||||
return loss;
|
||||
}
|
||||
@@ -143,32 +144,27 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
|
||||
lastMaterial = material;
|
||||
}
|
||||
|
||||
G4double suma,w1,w2,C,e0,lossc,w;
|
||||
G4double a1,a2,a3;
|
||||
G4int p1,p2,p3;
|
||||
G4int nb;
|
||||
G4double corrfac, na,alfa,rfac,namean,sa,alfa1,ea,sea;
|
||||
G4double dp3;
|
||||
G4double p1,p2,p3;
|
||||
|
||||
w1 = tmax/ipotFluct;
|
||||
w2 = log(2.*electron_mass_c2*(gam2 - 1.0));
|
||||
G4double w1 = tmax/ipotFluct;
|
||||
G4double w2 = log(2.*electron_mass_c2*(gam2 - 1.0));
|
||||
|
||||
C = meanLoss*(1.-rateFluct)/(w2-ipotLogFluct-beta2);
|
||||
G4double C = meanLoss*(1.-rateFluct)/(w2-ipotLogFluct-beta2);
|
||||
|
||||
a1 = C*f1Fluct*(w2-e1LogFluct-beta2)/e1Fluct;
|
||||
a2 = C*f2Fluct*(w2-e2LogFluct-beta2)/e2Fluct;
|
||||
a3 = rateFluct*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
|
||||
G4double a1 = C*f1Fluct*(w2-e1LogFluct-beta2)/e1Fluct;
|
||||
G4double a2 = C*f2Fluct*(w2-e2LogFluct-beta2)/e2Fluct;
|
||||
G4double a3 = rateFluct*meanLoss*(tmax-ipotFluct)/(ipotFluct*tmax*log(w1));
|
||||
if(a1 < 0.) a1 = 0.;
|
||||
if(a2 < 0.) a2 = 0.;
|
||||
if(a3 < 0.) a3 = 0.;
|
||||
|
||||
suma = a1+a2+a3;
|
||||
G4double suma = a1+a2+a3;
|
||||
|
||||
loss = 0. ;
|
||||
|
||||
if(suma < sumalim) // very small Step
|
||||
{
|
||||
e0 = material->GetIonisation()->GetEnergy0fluct();
|
||||
G4double e0 = material->GetIonisation()->GetEnergy0fluct();
|
||||
|
||||
if(tmax == ipotFluct)
|
||||
{
|
||||
@@ -177,120 +173,101 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
|
||||
if(a3>alim)
|
||||
{
|
||||
siga=sqrt(a3) ;
|
||||
p3 = std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
|
||||
}
|
||||
else
|
||||
p3 = G4Poisson(a3);
|
||||
|
||||
p3 = std::max(0.,G4RandGauss::shoot(a3,siga)+0.5);
|
||||
} else {
|
||||
p3 = G4double(G4Poisson(a3));
|
||||
}
|
||||
loss = p3*e0 ;
|
||||
|
||||
if(p3 > 0)
|
||||
loss += (1.-2.*G4UniformRand())*e0 ;
|
||||
if(p3 > 0.) loss += (1.-2.*G4UniformRand())*e0 ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
tmax = tmax-ipotFluct+e0 ;
|
||||
a3 = meanLoss*(tmax-e0)/(tmax*e0*log(tmax/e0));
|
||||
|
||||
if(a3>alim)
|
||||
{
|
||||
siga=sqrt(a3) ;
|
||||
p3 = std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
|
||||
}
|
||||
else
|
||||
p3 = G4Poisson(a3);
|
||||
|
||||
if(p3 > 0)
|
||||
{
|
||||
w = (tmax-e0)/tmax ;
|
||||
if(p3 > nmaxCont2)
|
||||
{
|
||||
dp3 = G4float(p3) ;
|
||||
corrfac = dp3/G4float(nmaxCont2) ;
|
||||
p3 = std::max(0.,G4RandGauss::shoot(a3,siga)+0.5);
|
||||
} else {
|
||||
p3 = G4double(G4Poisson(a3));
|
||||
}
|
||||
if(p3 > 0.) {
|
||||
G4double w = (tmax-e0)/tmax ;
|
||||
G4double corrfac = 1. ;
|
||||
if(p3 > nmaxCont2) {
|
||||
corrfac = p3/nmaxCont2 ;
|
||||
p3 = nmaxCont2 ;
|
||||
}
|
||||
else
|
||||
corrfac = 1. ;
|
||||
|
||||
for(G4int i=0; i<p3; i++) loss += 1./(1.-w*G4UniformRand()) ;
|
||||
}
|
||||
G4int ip3 = (G4int)p3;
|
||||
for(G4int i=0; i<ip3; i++) {
|
||||
loss += 1./(1.-w*G4UniformRand()) ;
|
||||
}
|
||||
loss *= e0*corrfac ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else // not so small Step
|
||||
{
|
||||
// Not so small Step
|
||||
} else {
|
||||
// excitation type 1
|
||||
if(a1>alim)
|
||||
{
|
||||
if(a1>alim) {
|
||||
siga=sqrt(a1) ;
|
||||
p1 = std::max(0,int(G4RandGauss::shoot(a1,siga)+0.5));
|
||||
p1 = std::max(0.,G4RandGauss::shoot(a1,siga)+0.5);
|
||||
} else {
|
||||
p1 = G4double(G4Poisson(a1));
|
||||
}
|
||||
else
|
||||
p1 = G4Poisson(a1);
|
||||
|
||||
// excitation type 2
|
||||
if(a2>alim)
|
||||
{
|
||||
if(a2>alim) {
|
||||
siga=sqrt(a2) ;
|
||||
p2 = std::max(0,int(G4RandGauss::shoot(a2,siga)+0.5));
|
||||
p2 = std::max(0.,G4RandGauss::shoot(a2,siga)+0.5);
|
||||
} else {
|
||||
p2 = G4double(G4Poisson(a2));
|
||||
}
|
||||
else
|
||||
p2 = G4Poisson(a2);
|
||||
|
||||
loss = p1*e1Fluct+p2*e2Fluct;
|
||||
|
||||
// smearing to avoid unphysical peaks
|
||||
if(p2 > 0)
|
||||
if(p2 > 0.)
|
||||
loss += (1.-2.*G4UniformRand())*e2Fluct;
|
||||
else if (loss>0.)
|
||||
loss += (1.-2.*G4UniformRand())*e1Fluct;
|
||||
|
||||
if(loss < 0.) loss = 0.0;
|
||||
|
||||
// ionisation .......................................
|
||||
if(a3 > 0.)
|
||||
{
|
||||
if(a3>alim)
|
||||
{
|
||||
siga=sqrt(a3) ;
|
||||
p3 = std::max(0,int(G4RandGauss::shoot(a3,siga)+0.5));
|
||||
}
|
||||
else
|
||||
p3 = G4Poisson(a3);
|
||||
|
||||
lossc = 0.;
|
||||
if(p3 > 0)
|
||||
{
|
||||
na = 0.;
|
||||
alfa = 1.;
|
||||
if (p3 > nmaxCont2)
|
||||
{
|
||||
dp3 = G4float(p3);
|
||||
rfac = dp3/(G4float(nmaxCont2)+dp3);
|
||||
namean = G4float(p3)*rfac;
|
||||
sa = G4float(nmaxCont1)*rfac;
|
||||
na = G4RandGauss::shoot(namean,sa);
|
||||
if (na > 0.)
|
||||
{
|
||||
alfa = w1*G4float(nmaxCont2+p3)/
|
||||
(w1*G4float(nmaxCont2)+G4float(p3));
|
||||
alfa1 = alfa*log(alfa)/(alfa-1.);
|
||||
ea = na*ipotFluct*alfa1;
|
||||
sea = ipotFluct*sqrt(na*(alfa-alfa1*alfa1));
|
||||
lossc += G4RandGauss::shoot(ea,sea);
|
||||
if(a3 > 0.) {
|
||||
if(a3>alim) {
|
||||
siga=sqrt(a3) ;
|
||||
p3 = std::max(0.,G4RandGauss::shoot(a3,siga)+0.5);
|
||||
} else {
|
||||
p3 = G4double(G4Poisson(a3));
|
||||
}
|
||||
G4double lossc = 0.;
|
||||
if(p3 > 0) {
|
||||
G4double na = 0.;
|
||||
G4double alfa = 1.;
|
||||
if (p3 > nmaxCont2) {
|
||||
G4double rfac = p3/(nmaxCont2+p3);
|
||||
G4double namean = p3*rfac;
|
||||
G4double sa = nmaxCont1*rfac;
|
||||
na = G4RandGauss::shoot(namean,sa);
|
||||
if (na > 0.) {
|
||||
alfa = w1*(nmaxCont2+p3)/(w1*nmaxCont2+p3);
|
||||
G4double alfa1 = alfa*log(alfa)/(alfa-1.);
|
||||
G4double ea = na*ipotFluct*alfa1;
|
||||
G4double sea = ipotFluct*sqrt(na*(alfa-alfa1*alfa1));
|
||||
lossc += G4RandGauss::shoot(ea,sea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nb = G4int(G4float(p3)-na);
|
||||
if (nb > 0)
|
||||
{
|
||||
w2 = alfa*ipotFluct;
|
||||
w = (tmax-w2)/tmax;
|
||||
for (G4int k=0; k<nb; k++) lossc += w2/(1.-w*G4UniformRand());
|
||||
}
|
||||
}
|
||||
loss += lossc;
|
||||
}
|
||||
if (p3 > na) {
|
||||
w2 = alfa*ipotFluct;
|
||||
G4double w = (tmax-w2)/tmax;
|
||||
G4int nb = G4int(p3-na);
|
||||
for (G4int k=0; k<nb; k++) {
|
||||
lossc += w2/(1.-w*G4UniformRand());
|
||||
}
|
||||
}
|
||||
}
|
||||
loss += lossc;
|
||||
}
|
||||
}
|
||||
|
||||
return loss;
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VEmProcess.cc,v 1.3 2003/10/14 07:50:34 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// GEANT4 Class file
|
||||
//
|
||||
//
|
||||
// File name: G4VEmProcess
|
||||
//
|
||||
// Author: Vladimir Ivanchenko on base of Laszlo Urban code
|
||||
//
|
||||
// Creation date: 01.10.2003
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// It is the unified process for e+ annililation at rest and in fly.
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4VEmProcess.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4VEmFluctuationModel.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4PhysicsVector.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
|
||||
G4VDiscreteProcess(name, type),
|
||||
theLambdaTable(0),
|
||||
particle(0),
|
||||
secondaryParticle(0),
|
||||
currentCouple(0),
|
||||
nLambdaBins(90),
|
||||
integral(true),
|
||||
meanFreePath(true)
|
||||
{
|
||||
|
||||
minKinEnergy = 0.1*keV;
|
||||
maxKinEnergy = 100.0*GeV;
|
||||
|
||||
modelManager = new G4EmModelManager();
|
||||
(G4LossTableManager::Instance())->Register(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VEmProcess::~G4VEmProcess()
|
||||
{
|
||||
if(theLambdaTable) theLambdaTable->clearAndDestroy();
|
||||
theLambdaTable = 0;
|
||||
modelManager->Clear();
|
||||
delete modelManager;
|
||||
(G4LossTableManager::Instance())->DeRegister(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::Initialise()
|
||||
{
|
||||
if(theLambdaTable) theLambdaTable->clearAndDestroy();
|
||||
theLambdaTable = 0;
|
||||
modelManager->Clear();
|
||||
theCuts = modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
if( !particle ) particle = ∂
|
||||
currentCouple = 0;
|
||||
preStepLambda = 0.0;
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::BuildPhysicsTable() for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4bool cutsWasModified = false;
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
for (size_t j=0; j<numOfCouples; j++){
|
||||
if (theCoupleTable->GetMaterialCutsCouple(j)->IsRecalcNeeded()) {
|
||||
cutsWasModified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !cutsWasModified ) return;
|
||||
|
||||
Initialise();
|
||||
theLambdaTable = BuildLambdaTable();
|
||||
PrintInfoDefinition();
|
||||
|
||||
if(0 < verboseLevel && theCuts) {
|
||||
G4cout << "G4VEmProcess::BuildPhysicsTable() done for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4PhysicsTable* G4VEmProcess::BuildLambdaTable()
|
||||
{
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4VEnergyLossSTD::BuildLambdaTable() for process "
|
||||
<< GetProcessName() << " and particle "
|
||||
<< particle->GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// Access to materials
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
G4PhysicsTable* theTable = new G4PhysicsTable(numOfCouples);
|
||||
|
||||
for(size_t i=0; i<numOfCouples; i++) {
|
||||
|
||||
// create physics vector and fill it
|
||||
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
|
||||
G4PhysicsVector* aVector = LambdaPhysicsVector(couple);
|
||||
modelManager->FillLambdaVector(aVector, couple);
|
||||
|
||||
// Insert vector for this material into the table
|
||||
theTable->insert(aVector) ;
|
||||
}
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "Lambda table is built for "
|
||||
<< particle->GetParticleName()
|
||||
<< G4endl;
|
||||
if(2 < verboseLevel) {
|
||||
G4cout << *theTable << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
return theTable;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetParticle(const G4ParticleDefinition* p)
|
||||
{
|
||||
particle = p;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
|
||||
{
|
||||
secondaryParticle = p;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
|
||||
G4VEmFluctuationModel*,
|
||||
const G4Region* region)
|
||||
{
|
||||
modelManager->AddEmModel(order, p, 0, region);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::UpdateEmModel(const G4String& nam, G4double emin,
|
||||
G4double emax)
|
||||
{
|
||||
modelManager->UpdateEmModel(nam, emin, emax);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
aParticleChange.Initialize(track);
|
||||
G4double finalT = track.GetKineticEnergy();
|
||||
|
||||
// Integral approach
|
||||
if (integral) {
|
||||
G4bool b;
|
||||
G4double postStepLambda =
|
||||
(((*theLambdaTable)[currentMaterialIndex])->GetValue(finalT,b));
|
||||
|
||||
if(preStepLambda*G4UniformRand() > postStepLambda)
|
||||
return G4VDiscreteProcess::PostStepDoIt(track,step);
|
||||
}
|
||||
|
||||
G4VEmModel* currentModel = SelectModel(finalT);
|
||||
G4double tcut = (*theCuts)[currentMaterialIndex];
|
||||
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
|
||||
|
||||
/*
|
||||
if(0 < verboseLevel) {
|
||||
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
|
||||
G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
|
||||
<< finalT/MeV
|
||||
<< " MeV; model= (" << currentModel->LowEnergyLimit(pd)
|
||||
<< ", " << currentModel->HighEnergyLimit(pd) << ")"
|
||||
<< G4endl;
|
||||
}
|
||||
*/
|
||||
|
||||
SecondariesPostStep(currentModel,currentCouple,dynParticle,tcut,finalT);
|
||||
return &aParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEmProcess::PrintInfoDefinition()
|
||||
{
|
||||
G4cout << G4endl << GetProcessName() << ": " << G4endl
|
||||
<< " Lambda tables from threshold to "
|
||||
<< G4BestUnit(maxKinEnergy,"Energy")
|
||||
<< " in " << nLambdaBins << " bins."
|
||||
<< G4endl;
|
||||
/*
|
||||
G4cout << "DEDXTable address= " << theDEDXTable << G4endl;
|
||||
if(theDEDXTable) G4cout << (*theDEDXTable) << G4endl;
|
||||
G4cout << "RangeTable address= " << theRangeTable << G4endl;
|
||||
if(theRangeTable) G4cout << (*theRangeTable) << G4endl;
|
||||
G4cout << "InverseRangeTable address= " << theInverseRangeTable << G4endl;
|
||||
if(theInverseRangeTable) G4cout << (*theInverseRangeTable) << G4endl;
|
||||
*/
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "Tables are built for " << particle->GetParticleName()
|
||||
<< " IntegralFlag= " << integral
|
||||
<< G4endl;
|
||||
|
||||
if(2 < verboseLevel) {
|
||||
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
|
||||
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
G4double cut = (*theCuts)[couple->GetIndex()];
|
||||
G4int nbins = 3;
|
||||
if( couple->IsUsed() ) nbins = nLambdaBins;
|
||||
G4double tmin = std::max(MinPrimaryEnergy(particle, couple->GetMaterial(), cut),
|
||||
minKinEnergy);
|
||||
if(tmin >= maxKinEnergy) tmin = 0.5*maxKinEnergy;
|
||||
// G4double xmax = maxKinEnergy*exp(log(maxKinEnergy/tmin)/((G4double)(nbins-1)) );
|
||||
G4PhysicsVector* v = new G4PhysicsLogVector(tmin, maxKinEnergy, nbins);
|
||||
return v;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
|
||||
const G4MaterialCutsCouple* couple)
|
||||
{
|
||||
// Cross section per atom is calculated
|
||||
DefineMaterial(couple);
|
||||
G4double cross = 0.0;
|
||||
G4bool b;
|
||||
if(theLambdaTable) {
|
||||
cross = (((*theLambdaTable)[currentMaterialIndex])->
|
||||
GetValue(kineticEnergy, b));
|
||||
|
||||
cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
|
||||
}
|
||||
|
||||
return cross;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4VEmProcess::MeanFreePath(const G4Track& track,
|
||||
G4double s,
|
||||
G4ForceCondition* cond)
|
||||
{
|
||||
return GetMeanFreePath(track, s, cond);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool G4VEmProcess::StorePhysicsTable(G4ParticleDefinition* part,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
G4bool yes = true;
|
||||
|
||||
if ( theLambdaTable ) {
|
||||
const G4String name = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
|
||||
yes = theLambdaTable->StorePhysicsTable(name,ascii);
|
||||
}
|
||||
|
||||
if ( yes ) {
|
||||
G4cout << "Physics tables are stored for " << particle->GetParticleName()
|
||||
<< " and process " << GetProcessName()
|
||||
<< " in the directory <" << directory
|
||||
<< "> " << G4endl;
|
||||
} else {
|
||||
G4cout << "Fail to store Physics Tables for " << particle->GetParticleName()
|
||||
<< " and process " << GetProcessName()
|
||||
<< " in the directory <" << directory
|
||||
<< "> " << G4endl;
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4VEmProcess::RetrievePhysicsTable(G4ParticleDefinition* part,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
currentCouple = 0;
|
||||
preStepLambda = 0.0;
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4VEmProcess::RetrievePhysicsTable() for "
|
||||
<< part->GetParticleName() << " and process "
|
||||
<< GetProcessName() << G4endl;
|
||||
}
|
||||
G4bool yes = true;
|
||||
|
||||
const G4String particleName = part->GetParticleName();
|
||||
if( !particle ) particle = part;
|
||||
|
||||
Initialise();
|
||||
|
||||
G4String filename;
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
|
||||
theLambdaTable = new G4PhysicsTable(numOfCouples);
|
||||
yes = theLambdaTable->RetrievePhysicsTable(filename,ascii);
|
||||
if ( yes ) {
|
||||
if (-1 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << particleName << " is retrieved from <"
|
||||
<< filename << ">"
|
||||
<< G4endl;
|
||||
}
|
||||
PrintInfoDefinition();
|
||||
} else {
|
||||
theLambdaTable->clearAndDestroy();
|
||||
theLambdaTable = 0;
|
||||
if (-1 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << particleName << " in file <"
|
||||
<< filename << "> is not exist"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
return yes;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VEnergyLoss.cc,v 1.42 2003/06/16 17:02:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4VEnergyLoss.cc,v 1.44 2003/11/06 17:19:51 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
+301
-278
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,8 @@
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VMultipleScattering.cc,v 1.21 2003/11/11 14:05:10 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -33,9 +35,12 @@
|
||||
// Creation date: 25.03.2003
|
||||
//
|
||||
// Modifications:
|
||||
//
|
||||
//
|
||||
// 13.04.03 Change printout (V.Ivanchenko)
|
||||
// 04-06-03 Fix compilation warnings (V.Ivanchenko)
|
||||
// 16-07-03 Use G4VMscModel interface (V.Ivanchenko)
|
||||
// 03-11-03 Fix initialisation problem in RetrievePhysicsTable (V.Ivanchenko)
|
||||
// 04-11-03 Update PrintInfoDefinition (V.Ivanchenko)
|
||||
//
|
||||
//
|
||||
// Class Description:
|
||||
@@ -52,7 +57,6 @@
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4VEmFluctuationModel.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "G4PhysicsTable.hh"
|
||||
@@ -72,13 +76,14 @@ G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType
|
||||
navigator(0),
|
||||
theLambdaTable(0),
|
||||
currentCouple(0),
|
||||
nBins(110),
|
||||
minKinEnergy(1.0*eV),
|
||||
maxKinEnergy(100.0*GeV),
|
||||
nBins(120),
|
||||
boundary(false),
|
||||
latDisplasment(true),
|
||||
buildLambdaTable(true)
|
||||
{
|
||||
minKinEnergy = 100.0*eV;
|
||||
maxKinEnergy = 100.0*TeV;
|
||||
SetVerboseLevel(0);
|
||||
modelManager = new G4EmModelManager();
|
||||
(G4LossTableManager::Instance())->Register(this);
|
||||
|
||||
@@ -101,35 +106,27 @@ G4VMultipleScattering::~G4VMultipleScattering()
|
||||
|
||||
void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
{
|
||||
currentParticle = ∂
|
||||
currentCouple = 0;
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4VMultipleScattering::BuildPhysicsTable() for "
|
||||
G4cout << "========================================================" << G4endl;
|
||||
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4bool cutsWasModified = false;
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
for (size_t j=0; j<numOfCouples; j++){
|
||||
if (theCoupleTable->GetMaterialCutsCouple(j)->IsRecalcNeeded()) {
|
||||
cutsWasModified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !cutsWasModified ) return;
|
||||
InitialiseProcess(part);
|
||||
|
||||
if(latDisplasment) navigator = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking();
|
||||
modelManager->Clear();
|
||||
const G4DataVector* theCuts = modelManager->Initialise(&part, 0, 10.0, verboseLevel);
|
||||
|
||||
if (buildLambdaTable) {
|
||||
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
size_t numOfCouples = theCoupleTable->GetTableSize();
|
||||
theLambdaTable = new G4PhysicsTable(numOfCouples);
|
||||
|
||||
for (size_t i=0; i<numOfCouples; i++) {
|
||||
@@ -154,11 +151,11 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
|
||||
}
|
||||
|
||||
G4String num = part.GetParticleName();
|
||||
if (verboseLevel>0 || num == "e-" || num == "mu+" || num == "proton")
|
||||
PrintInfoDefinition();
|
||||
if (verboseLevel>0 || num == "e-" || num == "mu+" || num == "proton"
|
||||
|| num == "pi-") PrintInfoDefinition();
|
||||
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "G4VMultipleScattering::BuildPhysicsTable() done for "
|
||||
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
|
||||
<< GetProcessName()
|
||||
<< " and particle " << part.GetParticleName()
|
||||
<< G4endl;
|
||||
@@ -243,7 +240,9 @@ G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
|
||||
|
||||
void G4VMultipleScattering::PrintInfoDefinition()
|
||||
{
|
||||
G4cout << G4endl << GetProcessName() << ": Model variant of multiple scattering " << G4endl;
|
||||
G4cout << G4endl << GetProcessName() << ": Model variant of multiple scattering "
|
||||
<< "for " << currentParticle->GetParticleName()
|
||||
<< G4endl;
|
||||
if (theLambdaTable) {
|
||||
G4cout << " Lambda tables from "
|
||||
<< G4BestUnit(MinKinEnergy(),"Energy")
|
||||
@@ -298,16 +297,24 @@ G4bool G4VMultipleScattering::StorePhysicsTable(G4ParticleDefinition* part,
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4VMultipleScattering::RetrievePhysicsTable(G4ParticleDefinition* part,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
currentParticle = part;
|
||||
if(0 < verboseLevel) {
|
||||
G4cout << "========================================================" << G4endl;
|
||||
G4cout << "G4VMultipleScattering::RetrievePhysicsTable() for "
|
||||
<< part->GetParticleName() << " and process "
|
||||
<< GetProcessName() << G4endl;
|
||||
}
|
||||
G4bool res = true;
|
||||
if(!buildLambdaTable) return res;
|
||||
|
||||
InitialiseProcess(*part);
|
||||
if(latDisplasment) navigator = G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking();
|
||||
|
||||
const G4DataVector* theCuts = modelManager->Initialise(part, 0, 10.0, verboseLevel);
|
||||
if(5 < verboseLevel) G4cout << theCuts << G4endl;
|
||||
if(!buildLambdaTable) return true;
|
||||
|
||||
G4String num = part->GetParticleName();
|
||||
const G4ProductionCutsTable* theCoupleTable=
|
||||
@@ -316,9 +323,9 @@ G4bool G4VMultipleScattering::RetrievePhysicsTable(G4ParticleDefinition* part,
|
||||
|
||||
G4String filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
|
||||
theLambdaTable = new G4PhysicsTable(numOfCouples);
|
||||
res = theLambdaTable->RetrievePhysicsTable(filename,ascii);
|
||||
G4bool res = theLambdaTable->RetrievePhysicsTable(filename,ascii);
|
||||
if ( res ) {
|
||||
if (0 < verboseLevel) {
|
||||
if (-1 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << num << " is retrieved from <"
|
||||
<< filename << ">"
|
||||
<< G4endl;
|
||||
@@ -326,7 +333,7 @@ G4bool G4VMultipleScattering::RetrievePhysicsTable(G4ParticleDefinition* part,
|
||||
} else {
|
||||
theLambdaTable->clearAndDestroy();
|
||||
theLambdaTable = 0;
|
||||
if (0 < verboseLevel) {
|
||||
if (-1 < verboseLevel) {
|
||||
G4cout << "Lambda table for " << num << " in file <"
|
||||
<< filename << "> is not exist"
|
||||
<< G4endl;
|
||||
|
||||
Reference in New Issue
Block a user