Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -64,18 +64,12 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmBiasingManager::G4EmBiasingManager()
: nForcedRegions(0),nSecBiasedRegions(0),eIonisation(nullptr),
currentStepLimit(0.0),startTracking(true)
G4EmBiasingManager::G4EmBiasingManager()
: fDirectionalSplittingTarget(0.0,0.0,0.0)
{
fSafetyMin = 1.e-6*mm;
theElectron = G4Electron::Electron();
theGamma = G4Gamma::Gamma();
fDirectionalSplitting = false;
fDirectionalSplittingRadius = 0.;
fDirectionalSplittingTarget = G4ThreeVector(0.,0.,0.);
fDirectionalSplittingWeights.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -447,8 +441,7 @@ G4EmBiasingManager::ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
const G4DynamicParticle* dp = vd[k];
if(dp->GetDefinition() == theElectron) {
G4double e = dp->GetKineticEnergy();
if(eIonisation->GetRangeForLoss(e, track.GetMaterialCutsCouple())
< safety) {
if(eIonisation->GetRange(e, track.GetMaterialCutsCouple()) < safety) {
eloss += e;
delete dp;
vd[k] = 0;
@@ -48,6 +48,7 @@
#include "G4LossTableManager.hh"
#include "G4EmParameters.hh"
#include "G4NistManager.hh"
#include "G4DynamicParticle.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VMultipleScattering.hh"
@@ -77,33 +78,11 @@ G4EmCalculator::G4EmCalculator()
nist = G4NistManager::Instance();
theParameters = G4EmParameters::Instance();
corr = manager->EmCorrections();
nLocalMaterials = 0;
verbose = 0;
currentCoupleIndex = 0;
currentCouple = nullptr;
currentMaterial = cutMaterial = nullptr;
currentParticle = nullptr;
lambdaParticle = nullptr;
baseParticle = nullptr;
currentLambda = nullptr;
currentModel = nullptr;
currentProcess = nullptr;
curProcess = nullptr;
loweModel = nullptr;
chargeSquare = 1.0;
massRatio = 1.0;
mass = 0.0;
currentCut = 0.0;
cutenergy[0] = cutenergy[1] = cutenergy[2] = DBL_MAX;
currentParticleName= "";
currentMaterialName= "";
currentName = "";
lambdaName = "";
theGenericIon = G4GenericIon::GenericIon();
ionEffCharge = new G4ionEffectiveCharge();
ionTable = G4ParticleTable::GetParticleTable()->GetIonTable();
isIon = false;
isApplicable = false;
theGenericIon = G4GenericIon::GenericIon();
ionEffCharge = new G4ionEffectiveCharge();
dynParticle = new G4DynamicParticle();
ionTable = G4ParticleTable::GetParticleTable()->GetIonTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -111,6 +90,7 @@ G4EmCalculator::G4EmCalculator()
G4EmCalculator::~G4EmCalculator()
{
delete ionEffCharge;
delete dynParticle;
for (G4int i=0; i<nLocalMaterials; ++i) {
delete localCouples[i];
}
@@ -134,10 +114,9 @@ G4double G4EmCalculator::GetDEDX(G4double kinEnergy,
G4double eloss = res*length;
//G4cout << "### GetDEDX: E= " << kinEnergy << " dedx0= " << res
// << " de= " << eloss << G4endl;;
G4double niel = 0.0;
dynParticle.SetKineticEnergy(kinEnergy);
dynParticle->SetKineticEnergy(kinEnergy);
currentModel->GetChargeSquareRatio(p, mat, kinEnergy);
currentModel->CorrectionsAlongStep(couple,&dynParticle,eloss,niel,length);
currentModel->CorrectionsAlongStep(couple,dynParticle,length,eloss);
res = eloss/length;
//G4cout << " de1= " << eloss << " res1= " << res
// << " " << p->GetParticleName() <<G4endl;;
@@ -454,10 +433,9 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
const G4Region* r = 0;
const G4MaterialCutsCouple* couple = FindCouple(mat, r);
G4double eloss = res*length;
G4double niel = 0.0;
dynParticle.SetKineticEnergy(kinEnergy);
dynParticle->SetKineticEnergy(kinEnergy);
currentModel->GetChargeSquareRatio(p, mat, kinEnergy);
currentModel->CorrectionsAlongStep(couple,&dynParticle,eloss,niel,length);
currentModel->CorrectionsAlongStep(couple,dynParticle,length,eloss);
res = eloss/length;
if(verbose > 1) {
@@ -583,7 +561,7 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
G4double res = 0.0;
G4VEmProcess* nucst = FindDiscreteProcess(p, "nuclearStopping");
if(nucst) {
G4VEmModel* mod = nucst->GetModelByIndex();
G4VEmModel* mod = nucst->EmModel();
if(mod) {
mod->SetFluctuationFlag(false);
res = mod->ComputeDEDXPerVolume(mat, p, kinEnergy);
@@ -785,8 +763,8 @@ G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p,
// new particle
currentParticle = p;
dynParticle.SetDefinition(const_cast<G4ParticleDefinition*>(p));
dynParticle.SetKineticEnergy(kinEnergy);
dynParticle->SetDefinition(const_cast<G4ParticleDefinition*>(p));
dynParticle->SetKineticEnergy(kinEnergy);
baseParticle = 0;
currentParticleName = p->GetParticleName();
massRatio = 1.0;
@@ -81,7 +81,7 @@ void G4EmConfigurator::SetExtraEmModel(const G4String& particleName,
G4double emax,
G4VEmFluctuationModel* fm)
{
if(!mod) { return; }
if(nullptr == mod) { return; }
if(1 < verbose) {
G4cout << " G4EmConfigurator::SetExtraEmModel " << mod->GetName()
<< " for " << particleName
@@ -115,9 +115,9 @@ void G4EmConfigurator::AddModels()
}
if(n > 0) {
for(size_t i=0; i<n; ++i) {
if(models[i]) {
G4Region* reg = FindRegion(regions[i]);
if(reg) {
if(nullptr != models[i]) {
const G4Region* reg = FindRegion(regions[i]);
if(nullptr != reg) {
--index;
SetModelForRegion(models[i],flucModels[i],reg,
particles[i],processes[i],
@@ -133,12 +133,12 @@ void G4EmConfigurator::AddModels()
void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
G4VEmFluctuationModel* fm,
G4Region* reg,
const G4Region* reg,
const G4String& particleName,
const G4String& processName,
G4double emin, G4double emax)
{
if(!mod) { return; }
if(nullptr == mod) { return; }
if(1 < verbose) {
G4cout << " G4EmConfigurator::SetModelForRegion: " << mod->GetName()
<< G4endl;
@@ -147,7 +147,7 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
<< " in the region <" << reg->GetName()
<< " Emin(MeV)= " << emin/MeV
<< " Emax(MeV)= " << emax/MeV;
if(fm) { G4cout << " FLmodel " << fm->GetName(); }
if(nullptr != fm) { G4cout << " FLmodel " << fm->GetName(); }
G4cout << G4endl;
}
@@ -178,7 +178,7 @@ void G4EmConfigurator::SetModelForRegion(G4VEmModel* mod,
break;
}
}
if(!proc) {
if(nullptr == proc) {
G4cout << "### G4EmConfigurator WARNING: fails to find a process <"
<< processName << "> for " << particleName << G4endl;
return;
@@ -235,21 +235,22 @@ G4EmConfigurator::PrepareModels(const G4ParticleDefinition* aParticle,
if((particleName == particles[i]) ||
(particles[i] == "all") ||
(particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
G4Region* reg = FindRegion(regions[i]);
const G4Region* reg = FindRegion(regions[i]);
//G4cout << "Region " << reg << G4endl;
if(reg) {
if(nullptr != reg) {
--index;
G4VEmModel* mod = models[i];
G4VEmFluctuationModel* fm = flucModels[i];
if(mod) {
if(nullptr != mod) {
if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
p->AddEmModel(index,mod,fm,reg);
if(1 < verbose) {
G4cout << "### Added eloss model order= " << index << " for "
<< particleName << " and " << processName << G4endl;
<< particleName << " and " << processName
<< " for " << reg->GetName() << G4endl;
}
}
} else if(fm) {
} else if(nullptr != fm) {
p->SetFluctModel(fm);
}
}
@@ -279,12 +280,12 @@ G4EmConfigurator::PrepareModels(const G4ParticleDefinition* aParticle,
if((particleName == particles[i]) ||
(particles[i] == "all") ||
(particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
G4Region* reg = FindRegion(regions[i]);
const G4Region* reg = FindRegion(regions[i]);
//G4cout << "Region " << reg << G4endl;
if(reg) {
if(nullptr != reg) {
--index;
G4VEmModel* mod = models[i];
if(mod) {
if(nullptr != mod) {
if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
p->AddEmModel(index,mod,reg);
if(1 < verbose) {
@@ -320,11 +321,11 @@ G4EmConfigurator::PrepareModels(const G4ParticleDefinition* aParticle,
if((particleName == particles[i]) ||
(particles[i] == "all") ||
(particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
G4Region* reg = FindRegion(regions[i]);
if(reg) {
const G4Region* reg = FindRegion(regions[i]);
if(nullptr != reg) {
--index;
G4VEmModel* mod = models[i];
if(mod) {
if(nullptr != mod) {
if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
p->AddEmModel(index,mod,reg);
//G4cout << "### Added msc model order= " << index << " for "
@@ -353,17 +354,17 @@ void G4EmConfigurator::Clear()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Region* G4EmConfigurator::FindRegion(const G4String& regionName)
const G4Region* G4EmConfigurator::FindRegion(const G4String& regionName)
{
// search for region
G4Region* reg = 0;
const G4Region* reg = nullptr;
G4RegionStore* regStore = G4RegionStore::GetInstance();
G4String r = regionName;
if(r == "" || r == "world" || r == "World") {
r = "DefaultRegionForTheWorld";
}
reg = regStore->GetRegion(r, true);
if(!reg) {
if(nullptr == reg) {
G4cout << "### G4EmConfigurator WARNING: fails to find a region <"
<< r << G4endl;
} else if(verbose > 1) {
@@ -64,12 +64,10 @@
#include "G4VEmModel.hh"
#include "G4Proton.hh"
#include "G4GenericIon.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ProductionCutsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4AtomicShells.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4Pow.hh"
@@ -78,6 +76,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4double inveplus = 1.0/CLHEP::eplus;
const G4double alpha2 = CLHEP::fine_structure_const*CLHEP::fine_structure_const;
const G4double G4EmCorrections::ZD[11] =
{0., 0., 0., 1.72, 2.09, 2.48, 2.82, 3.16, 3.53, 3.84, 4.15};
@@ -104,51 +103,44 @@ const G4double G4EmCorrections::UL[] = {0.1215, 0.5265, 0.8411, 1.0878, 1.2828,
2.0001, 2.0039, 2.0053, 2.0049, 2.0040, 2.0028};
G4double G4EmCorrections::VL[] = {0.0};
G4LPhysicsFreeVector* G4EmCorrections::BarkasCorr = nullptr;
G4LPhysicsFreeVector* G4EmCorrections::ThetaK = nullptr;
G4LPhysicsFreeVector* G4EmCorrections::ThetaL = nullptr;
G4PhysicsFreeVector* G4EmCorrections::sBarkasCorr = nullptr;
G4PhysicsFreeVector* G4EmCorrections::sThetaK = nullptr;
G4PhysicsFreeVector* G4EmCorrections::sThetaL = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4EmCorrections::theCorrMutex = G4MUTEX_INITIALIZER;
#endif
G4EmCorrections::G4EmCorrections(G4int verb)
{
particle = nullptr;
curParticle= nullptr;
material = nullptr;
curMaterial= nullptr;
theElementVector = nullptr;
atomDensity= nullptr;
curVector = nullptr;
ionLEModel = nullptr;
ionHEModel = nullptr;
kinEnergy = 0.0;
verbose = verb;
massFactor = 1.0;
eth = 2.0*CLHEP::MeV;
nbinCorr = 20;
eCorrMin = 25.*CLHEP::keV;
eCorrMax = 250.*CLHEP::MeV;
ionTable = G4ParticleTable::GetParticleTable()->GetIonTable();
g4calc = G4Pow::GetInstance();
nIons = ncouples = numberOfElements = idx = currentZ = 0;
mass = tau = gamma = bg2 = beta2 = beta = ba2 = tmax = charge = q2 = 0.0;
// Constants
alpha2 = CLHEP::fine_structure_const*CLHEP::fine_structure_const;
// G.S. Khandelwal Nucl. Phys. A116(1968)97 - 111.
// "Shell corrections for K- and L- electrons
nK = 20;
nL = 26;
nEtaK = 29;
nEtaL = 28;
isMaster = false;
// fill vectors
if(BarkasCorr == nullptr) { Initialise(); }
if(sBarkasCorr == nullptr) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&theCorrMutex);
if (sBarkasCorr == nullptr) {
#endif
Initialise();
isMaster = true;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&theCorrMutex);
#endif
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -157,10 +149,10 @@ G4EmCorrections::~G4EmCorrections()
{
for(G4int i=0; i<nIons; ++i) {delete stopData[i];}
if(isMaster) {
delete BarkasCorr;
delete ThetaK;
delete ThetaL;
BarkasCorr = ThetaK = ThetaL = nullptr;
delete sBarkasCorr;
delete sThetaK;
delete sThetaL;
sBarkasCorr = sThetaK = sThetaL = nullptr;
}
}
@@ -327,10 +319,9 @@ G4double G4EmCorrections::Bethe(const G4ParticleDefinition* p,
G4double e)
{
SetupKinematics(p, mat, e);
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double eexc2 = eexc*eexc;
G4double dedx = 0.5*G4Log(2.0*electron_mass_c2*bg2*tmax/eexc2)-beta2;
return dedx;
const G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
const G4double eexc2 = eexc*eexc;
return 0.5*G4Log(2.0*electron_mass_c2*bg2*tmax/eexc2)-beta2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -340,7 +331,7 @@ G4double G4EmCorrections::SpinCorrection(const G4ParticleDefinition* p,
G4double e)
{
SetupKinematics(p, mat, e);
G4double dedx = 0.5*tmax/(kinEnergy + mass);
const G4double dedx = 0.5*tmax/(kinEnergy + mass);
return 0.5*dedx*dedx;
}
@@ -364,7 +355,7 @@ G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
}
G4double eta = ba2/Z2;
G4double tet = Z2*(1. + Z2*0.25*alpha2);
if(11 < iz) { tet = ThetaK->Value(Z); }
if(11 < iz) { tet = sThetaK->Value(Z); }
term += f*atomDensity[i]*KShell(tet,eta)/Z;
}
@@ -391,7 +382,7 @@ G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
G4double Z2= Zeff*Zeff;
G4double f = 0.125;
G4double eta = ba2/Z2;
G4double tet = ThetaL->Value(Z);
G4double tet = sThetaL->Value(Z);
G4int nmax = std::min(4,G4AtomicShells::GetNumberOfShells(iz));
for(G4int j=1; j<nmax; ++j) {
G4int ne = G4AtomicShells::GetNumberOfElectrons(iz,j);
@@ -566,7 +557,7 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
}
G4double eta = ba2/Z2;
G4double tet = Z2*(1. + Z2*0.25*alpha2);
if(11 < iz) { tet = ThetaK->Value(Z); }
if(11 < iz) { tet = sThetaK->Value(Z); }
res0 = f*KShell(tet,eta);
res += res0;
//G4cout << " Z= " << iz << " Shell 0" << " tet= " << tet
@@ -577,7 +568,7 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
Z2= Zeff*Zeff;
eta = ba2/Z2;
f = 0.125;
tet = ThetaL->Value(Z);
tet = sThetaL->Value(Z);
G4int ntot = G4AtomicShells::GetNumberOfShells(iz);
G4int nmax = std::min(4, ntot);
G4double norm = 0.0;
@@ -710,9 +701,9 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
G4double W = b/std::sqrt(X);
G4double val = BarkasCorr->Value(W);
if(W > BarkasCorr->Energy(46)) {
val *= BarkasCorr->Energy(46)/W;
G4double val = sBarkasCorr->Value(W);
if(W > sBarkasCorr->Energy(46)) {
val *= sBarkasCorr->Energy(46)/W;
}
// G4cout << "i= " << i << " b= " << b << " W= " << W
// << " Z= " << Z << " X= " << X << " val= " << val<< G4endl;
@@ -865,8 +856,7 @@ void G4EmCorrections::BuildCorrectionVector()
}
G4PhysicsLogVector* vv =
new G4PhysicsLogVector(eCorrMin,eCorrMax,nbinCorr);
vv->SetSpline(true);
new G4PhysicsLogVector(eCorrMin,eCorrMax,nbinCorr,true);
G4double e, eion, dedx, dedx1;
G4double eth0 = v->Energy(0);
G4double escal = eth/massRatio;
@@ -904,6 +894,7 @@ void G4EmCorrections::BuildCorrectionVector()
<< " massF= " << massFactor << G4endl;
}
}
vv->FillSecondDerivatives();
delete v;
ionList[idx] = ion;
stopData[idx] = vv;
@@ -937,8 +928,6 @@ void G4EmCorrections::InitialiseForNewRun()
void G4EmCorrections::Initialise()
{
if(G4Threading::IsMasterThread()) { isMaster = true; }
// Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
// Physical review B Vol.5 No.7 1 April 1972 pagg. 2393-2397
@@ -992,9 +981,9 @@ void G4EmCorrections::Initialise()
{ 9.0, 0.0032},
{ 10.0, 0.0025} };
BarkasCorr = new G4LPhysicsFreeVector(47, 0.02, 10.);
for(i=0; i<47; ++i) { BarkasCorr->PutValues(i, fTable[i][0], fTable[i][1]); }
BarkasCorr->SetSpline(true);
sBarkasCorr = new G4PhysicsFreeVector(47, 0.02, 10., true);
for(i=0; i<47; ++i) { sBarkasCorr->PutValues(i, fTable[i][0], fTable[i][1]); }
sBarkasCorr->FillSecondDerivatives();
static const G4double SK[20] = {1.9477, 1.9232, 1.8996, 1.8550, 1.8137,
1.7754, 1.7396, 1.7223, 1.7063, 1.6752,
@@ -1338,12 +1327,12 @@ void G4EmCorrections::Initialise()
0.58191, 0.5869, 0.59189, 0.60062, 0.60686, 0.61435, 0.61809, 0.62183, 0.62931, 0.6343,
0.6368, 0.64054, 0.64304, 0.64428, 0.64678};
ThetaK = new G4LPhysicsFreeVector(34, xzk[0], xzk[33]);
ThetaL = new G4LPhysicsFreeVector(36, xzl[0], xzl[35]);
for(i=0; i<34; ++i) { ThetaK->PutValues(i, xzk[i], yzk[i]); }
for(i=0; i<36; ++i) { ThetaL->PutValues(i, xzl[i], yzl[i]); }
ThetaK->SetSpline(true);
ThetaL->SetSpline(true);
sThetaK = new G4PhysicsFreeVector(34, xzk[0], xzk[33], true);
sThetaL = new G4PhysicsFreeVector(36, xzl[0], xzl[35], true);
for(i=0; i<34; ++i) { sThetaK->PutValues(i, xzk[i], yzk[i]); }
for(i=0; i<36; ++i) { sThetaL->PutValues(i, xzl[i], yzl[i]); }
sThetaK->FillSecondDerivatives();
sThetaL->FillSecondDerivatives();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -95,7 +95,7 @@ G4PhysicsTable* G4EmDataHandler::MakeTable(size_t i)
void G4EmDataHandler::CleanTable(size_t i)
{
//std::cout << i << " " << data[i] << std::endl;
if(i < tLength && data[i]) {
if(i < tLength && nullptr != data[i]) {
data[i]->clearAndDestroy();
delete data[i];
data[i] = nullptr;
@@ -110,7 +110,7 @@ G4bool G4EmDataHandler::StorePhysicsTable(size_t idx,
G4bool ascii)
{
G4bool yes = true;
if(data[idx]) {
if(nullptr != data[idx]) {
yes = data[idx]->StorePhysicsTable(fname, ascii);
if ( yes ) {
@@ -131,10 +131,10 @@ G4bool G4EmDataHandler::StorePhysicsTable(size_t idx,
G4bool G4EmDataHandler::RetrievePhysicsTable(size_t idx,
const G4ParticleDefinition* part,
const G4String& fname,
G4bool ascii)
G4bool ascii, G4bool spline)
{
G4bool yes =
G4PhysicsTableHelper::RetrievePhysicsTable(data[idx], fname, ascii);
G4PhysicsTable* table = Table(idx);
G4bool yes = G4PhysicsTableHelper::RetrievePhysicsTable(table, fname, ascii, spline);
G4EmParameters* param = G4EmParameters::Instance();
if ( yes ) {
if (0 < param->Verbose()) {
@@ -143,13 +143,6 @@ G4bool G4EmDataHandler::RetrievePhysicsTable(size_t idx,
<< " is retrieved from <" << fname << ">"
<< G4endl;
}
if(param->Spline()) {
G4PhysicsTable* table = data[idx];
size_t n = table->length();
for(size_t i=0; i<n; ++i) {
if((*table)[i]) { (*table)[i]->SetSpline(true); }
}
}
} else if (1 < param->Verbose()) {
G4cout << "Fail to retrieve physics table " << idx << " for "
<< part->GetParticleName() << " from <"
@@ -65,9 +65,8 @@ G4EmElementSelector::G4EmElementSelector(G4VEmModel* mod,
theElementVector = material->GetElementVector();
if(nElmMinusOne > 0) {
xSections.reserve(n);
G4PhysicsLogVector* v0 = new G4PhysicsLogVector(lowEnergy,highEnergy,nbins);
G4PhysicsLogVector* v0 = new G4PhysicsLogVector(lowEnergy,highEnergy,nbins,false);
xSections.push_back(v0);
v0->SetSpline(false);
for(G4int i=1; i<n; ++i) {
G4PhysicsLogVector* v = new G4PhysicsLogVector(*v0);
xSections.push_back(v);
@@ -146,6 +145,43 @@ void G4EmElementSelector::Initialise(const G4ParticleDefinition* part,
// << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const G4Element*
G4EmElementSelector::SelectRandomAtom(const G4double e, const G4double loge) const
{
const G4Element* element = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
// 1. Determine energy index (only once)
const size_t nBins = (xSections[0])->GetVectorLength();
// handle cases below/above the enrgy grid (by ekin, idx that gives a=0/1)
// ekin = x[0] if e<=x[0] and idx will be 0 ^ a=0 => so y=y0
// ekin = x[N-1] if e>=x[N-1] and idx will be N-2 ^ a=1 => so y=y_{N-1}
const G4double ekin = std::max((xSections[0])->Energy(0),
std::min((xSections[0])->Energy(nBins-1),e));
// compute the lower index of the bin (idx \in [0,N-2] will be guaranted)
const size_t idx = (xSections[0])->ComputeLogVectorBin(loge);
// 2. Do the linear interp.(robust for corner cases through ekin, idx and a)
const G4double x1 = (xSections[0])->Energy(idx);
const G4double x2 = (xSections[0])->Energy(idx+1);
// note: all corner cases of the previous methods are covered and eventually
// gives a=0/1 that results in y=y0\y_{N-1} if e<=x[0]/e>=x[N-1] or
// y=y_i/y_{i+1} if e<x[i]/e>=x[i+1] due to small numerical errors
const G4double a = std::max(0., std::min(1., (ekin - x1)/(x2 - x1)));
const G4double urnd = G4UniformRand();
for (G4int i = 0; i < nElmMinusOne; ++i) {
const G4double y1 = (*xSections[i])[idx];
const G4double y2 = (*xSections[i])[idx+1];
if (urnd <= y1 + a*(y2-y1)) {
element = (*theElementVector)[i];
break;
}
}
}
return element;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4EmElementSelector::Dump(const G4ParticleDefinition* part)
@@ -88,7 +88,6 @@ void G4EmExtraParameters::Initialise()
m_lengthForced.clear();
m_weightForced.clear();
m_regnamesSubCut.clear();
m_subCuts.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -282,18 +281,16 @@ const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
return m_typesPhys;
}
void G4EmExtraParameters::SetSubCutoff(G4bool val, const G4String& region)
void G4EmExtraParameters::SetSubCutRegion(const G4String& region)
{
const G4String& r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
m_subCuts[i] = val;
return;
}
}
m_regnamesSubCut.push_back(r);
m_subCuts.push_back(val);
}
void
@@ -380,11 +377,11 @@ G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
{
G4RegionStore* regionStore = G4RegionStore::GetInstance();
const G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
if(nullptr != reg) { ptr->ActivateSubCutoff(reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
@@ -64,6 +64,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
paiCmd->SetGuidance(" regName : G4Region name");
paiCmd->SetGuidance(" paiType : PAI, PAIphoton");
paiCmd->AvailableForStates(G4State_PreInit);
paiCmd->SetToBeBroadcasted(false);
G4UIparameter* part = new G4UIparameter("partName",'s',false);
paiCmd->SetParameter(part);
@@ -88,17 +89,11 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
mscoCmd->SetParameter(mtype);
mtype->SetParameterCandidates("G4EmStandard G4EmStandard_opt1 G4EmStandard_opt2 G4EmStandard_opt3 G4EmStandard_opt4 G4EmStandardGS G4EmStandardSS G4EmLivermore G4EmPenelope G4RadioactiveDecay");
SubSecCmd = new G4UIcommand("/process/eLoss/subsec",this);
SubSecCmd->SetGuidance("Switch true/false the subcutoff generation per region.");
SubSecCmd->SetGuidance(" subSec : true/false");
SubSecCmd = new G4UIcmdWithAString("/process/eLoss/subsecRegion",this);
SubSecCmd->SetGuidance("Enable subcut generation per region.");
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
SubSecCmd->SetToBeBroadcasted(false);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
@@ -106,6 +101,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
StepFuncCmd->SetGuidance(" finalRange: range for final step");
StepFuncCmd->SetGuidance(" unit : unit of finalRange");
StepFuncCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
StepFuncCmd->SetToBeBroadcasted(false);
G4UIparameter* dRoverRPrm = new G4UIparameter("dRoverR",'d',false);
dRoverRPrm->SetParameterRange("dRoverR>0. && dRoverR<=1.");
@@ -124,6 +120,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
StepFuncCmd1->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd1->SetGuidance(" finalRange: range for final step");
StepFuncCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
StepFuncCmd1->SetToBeBroadcasted(false);
G4UIparameter* dRoverRPrm1 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm1->SetParameterRange("dRoverRMuHad>0. && dRoverRMuHad<=1.");
@@ -142,6 +139,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
StepFuncCmd2->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd2->SetGuidance(" finalRange: range for final step");
StepFuncCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
StepFuncCmd2->SetToBeBroadcasted(false);
G4UIparameter* dRoverRPrm2 = new G4UIparameter("dRoverRLIons",'d',false);
dRoverRPrm2->SetParameterRange("dRoverRLIons>0. && dRoverRLIons<=1.");
@@ -160,6 +158,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
StepFuncCmd3->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd3->SetGuidance(" finalRange: range for final step");
StepFuncCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
StepFuncCmd3->SetToBeBroadcasted(false);
G4UIparameter* dRoverRPrm3 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm3->SetParameterRange("dRoverRIons>0. && dRoverRIons<=1.");
@@ -179,6 +178,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
bfCmd->SetGuidance(" procFact : factor");
bfCmd->SetGuidance(" flagFact : flag to change weight");
bfCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
bfCmd->SetToBeBroadcasted(false);
G4UIparameter* procName = new G4UIparameter("procName",'s',false);
bfCmd->SetParameter(procName);
@@ -197,6 +197,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
fiCmd->SetGuidance(" unitT : length unit");
fiCmd->SetGuidance(" tflag : flag to change weight");
fiCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fiCmd->SetToBeBroadcasted(false);
G4UIparameter* procNam = new G4UIparameter("procNam",'s',false);
fiCmd->SetParameter(procNam);
@@ -224,6 +225,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
bsCmd->SetGuidance(" bEnergy : max energy of a secondary for this biasing method");
bsCmd->SetGuidance(" bUnit : energy unit");
bsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
bsCmd->SetToBeBroadcasted(false);
G4UIparameter* bProcNam = new G4UIparameter("bProcNam",'s',false);
bsCmd->SetParameter(bProcNam);
@@ -244,10 +246,12 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
dirSplitCmd = new G4UIcmdWithABool("/process/em/setDirectionalSplitting",this);
dirSplitCmd->SetGuidance("Enable directional brem splitting");
dirSplitCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dirSplitCmd->SetToBeBroadcasted(false);
qeCmd = new G4UIcmdWithABool("/process/em/QuantumEntanglement",this);
qeCmd->SetGuidance("Enable quantum entanglement");
qeCmd->AvailableForStates(G4State_PreInit);
qeCmd->SetToBeBroadcasted(false);
dirSplitTargetCmd = new G4UIcmdWith3VectorAndUnit("/process/em/setDirectionalSplittingTarget",this);
dirSplitTargetCmd->SetGuidance("Position of arget for directional splitting");
@@ -256,6 +260,7 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
dirSplitRadiusCmd = new G4UIcmdWithADoubleAndUnit("/process/em/setDirectionalSplittingRadius",this);
dirSplitRadiusCmd->SetGuidance("Radius of target for directional splitting");
dirSplitRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dirSplitRadiusCmd->SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -312,12 +317,7 @@ void G4EmExtraParametersMessenger::SetNewValue(G4UIcommand* command,
}
physicsModified = true;
} else if (command == SubSecCmd) {
G4String s1, s2;
std::istringstream is(newValue);
is >> s1 >> s2;
G4bool yes = false;
if(s1 == "true") { yes = true; }
theParameters->SetSubCutoff(yes,s2);
theParameters->SetSubCutRegion(newValue);
} else if (command == bfCmd) {
G4double v1(1.0);
G4String s0(""),s1("");
@@ -63,89 +63,104 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
deCmd->SetParameterName("fluoFlag",true);
deCmd->SetDefaultValue(false);
deCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
deCmd->SetToBeBroadcasted(false);
dirFluoCmd = new G4UIcmdWithABool("/process/em/fluoBearden",this);
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd->SetToBeBroadcasted(false);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
auCmd->SetGuidance("Enable/disable Auger electrons production");
auCmd->SetParameterName("augerFlag",true);
auCmd->SetDefaultValue(false);
auCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCmd->SetToBeBroadcasted(false);
auCascadeCmd = new G4UIcmdWithABool("/process/em/augerCascade",this);
auCascadeCmd->SetGuidance("Enable/disable simulation of cascade of Auger electrons");
auCascadeCmd->SetParameterName("augerCascadeFlag",true);
auCascadeCmd->SetDefaultValue(false);
auCascadeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
auCascadeCmd->SetToBeBroadcasted(false);
pixeCmd = new G4UIcmdWithABool("/process/em/pixe",this);
pixeCmd->SetGuidance("Enable/disable PIXE simulation");
pixeCmd->SetParameterName("pixeFlag",true);
pixeCmd->SetDefaultValue(false);
pixeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
pixeCmd->SetToBeBroadcasted(false);
dcutCmd = new G4UIcmdWithABool("/process/em/deexcitationIgnoreCut",this);
dcutCmd->SetGuidance("Enable/Disable usage of cuts in de-excitation module");
dcutCmd->SetParameterName("deexcut",true);
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dcutCmd->SetToBeBroadcasted(false);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit);
dnafCmd->SetToBeBroadcasted(false);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit);
dnasCmd->SetToBeBroadcasted(false);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
dnamscCmd->AvailableForStates(G4State_PreInit);
dnamscCmd->SetToBeBroadcasted(false);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
pixeXsCmd->SetCandidates("ECPSSR_Analytical Empirical ECPSSR_FormFactor");
pixeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeXsCmd->SetToBeBroadcasted(false);
pixeeXsCmd = new G4UIcmdWithAString("/process/em/pixeElecXSmodel",this);
pixeeXsCmd->SetGuidance("The name of PIXE cross section for electron");
pixeeXsCmd->SetParameterName("pixeEXS",true);
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pixeeXsCmd->SetToBeBroadcasted(false);
livCmd = new G4UIcmdWithAString("/process/em/LivermoreData",this);
livCmd->SetGuidance("The name of Livermore data directory");
livCmd->SetParameterName("livDir",true);
livCmd->SetCandidates("livermore epics_2017");
livCmd->AvailableForStates(G4State_PreInit);
livCmd->SetToBeBroadcasted(false);
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
dnaSolCmd->SetParameterName("dnaSol",true);
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002 Kreipl2009 Meesungnoen2002_amorphous");
dnaSolCmd->AvailableForStates(G4State_PreInit);
dnaSolCmd->SetToBeBroadcasted(false);
meCmd = new G4UIcmdWithAString("/process/em/AddMicroElecRegion",this);
meCmd->SetGuidance("Activate MicroElec model in the G4Region");
meCmd->SetParameterName("MicroElec",true);
meCmd->AvailableForStates(G4State_PreInit);
meCmd->SetToBeBroadcasted(false);
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_Opt2, DNA_Opt4, DNA_Opt4a, DNA_Opt6, DNA_Opt6a, DNA_Opt7");
dnaCmd->AvailableForStates(G4State_PreInit);
dnaCmd->SetToBeBroadcasted(false);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
dnaCmd->SetParameter(regName);
@@ -161,6 +176,7 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
deexCmd->SetGuidance(" flagAuger : Auger");
deexCmd->SetGuidance(" flagPIXE : PIXE");
deexCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
deexCmd->SetToBeBroadcasted(false);
G4UIparameter* regNameD = new G4UIparameter("regName",'s',false);
deexCmd->SetParameter(regNameD);
@@ -209,6 +225,7 @@ void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == dirFluoCmd) {
theParameters->SetBeardenFluoDir(dirFluoCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == auCmd) {
theParameters->SetAuger(auCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -55,6 +55,18 @@
#include "G4PhysicsVector.hh"
#include "G4VMscModel.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicsVector.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ProductionCutsTable.hh"
#include "G4RegionStore.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4UnitsTable.hh"
#include "G4DataVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4RegionModels::G4RegionModels(G4int nMod, std::vector<G4int>& indx,
@@ -80,40 +92,15 @@ G4RegionModels::~G4RegionModels()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicsVector.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ProductionCutsTable.hh"
#include "G4RegionStore.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4UnitsTable.hh"
#include "G4DataVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmModelManager::G4EmModelManager():
nEmModels(0),
nRegions(0),
particle(0),
verboseLevel(0)
G4EmModelManager::G4EmModelManager()
{
maxSubCutInRange = 0.7*mm;
models.reserve(4);
flucModels.reserve(4);
regions.reserve(4);
orderOfModels.reserve(4);
isUsed.reserve(4);
severalModels = true;
fluoFlag = false;
currRegionModel = nullptr;
currModel = nullptr;
theCuts = nullptr;
theCutsNew = nullptr;
theSubCuts = nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -123,7 +110,6 @@ G4EmModelManager::~G4EmModelManager()
verboseLevel = 0; // no verbosity at destruction
Clear();
delete theCutsNew;
delete theSubCuts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -134,11 +120,9 @@ void G4EmModelManager::Clear()
G4cout << "G4EmModelManager::Clear()" << G4endl;
}
size_t n = setOfRegionModels.size();
if(n > 0) {
for(size_t i=0; i<n; ++i) {
delete setOfRegionModels[i];
setOfRegionModels[i] = nullptr;
}
for(size_t i=0; i<n; ++i) {
delete setOfRegionModels[i];
setOfRegionModels[i] = nullptr;
}
}
@@ -147,7 +131,7 @@ void G4EmModelManager::Clear()
void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
G4VEmFluctuationModel* fm, const G4Region* r)
{
if(!p) {
if(nullptr == p) {
G4cout << "G4EmModelManager::AddEmModel WARNING: no model defined."
<< G4endl;
return;
@@ -171,7 +155,7 @@ void G4EmModelManager::UpdateEmModel(const G4String& nam,
if(nam == models[i]->GetName()) {
models[i]->SetLowEnergyLimit(emin);
models[i]->SetHighEnergyLimit(emax);
break;
return;
}
}
}
@@ -190,7 +174,9 @@ G4VEmModel* G4EmModelManager::GetModel(G4int i, G4bool ver)
G4cout << "G4EmModelManager::GetModel WARNING: "
<< "index " << i << " is wrong Nmodels= "
<< nEmModels;
if(particle) { G4cout << " for " << particle->GetParticleName(); }
if(nullptr != particle) {
G4cout << " for " << particle->GetParticleName();
}
G4cout<< G4endl;
}
return model;
@@ -201,8 +187,7 @@ G4VEmModel* G4EmModelManager::GetModel(G4int i, G4bool ver)
G4VEmModel* G4EmModelManager::GetRegionModel(G4int k, size_t idx)
{
G4RegionModels* rm = setOfRegionModels[idxOfRegionModels[idx]];
G4VEmModel* mod = models[rm->ModelIndex(k)];
return mod;
return (k < rm->NumberOfModels()) ? models[rm->ModelIndex(k)] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -218,14 +203,12 @@ G4int G4EmModelManager::NumberOfRegionModels(size_t idx) const
const G4DataVector*
G4EmModelManager::Initialise(const G4ParticleDefinition* p,
const G4ParticleDefinition* secondaryParticle,
G4double minSubRange,
G4int val)
G4double, G4int verb)
{
verboseLevel = val;
G4String partname = p->GetParticleName();
verboseLevel = verb;
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::Initialise() for "
<< partname << " Nmodels= " << nEmModels << G4endl;
<< p->GetParticleName() << " Nmodels= " << nEmModels << G4endl;
}
// Are models defined?
if(nEmModels < 1) {
@@ -251,7 +234,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
for (G4int ii=0; ii<nEmModels; ++ii) {
const G4Region* r = regions[ii];
if ( r == 0 || r == world) {
if ( r == nullptr || r == world) {
isWorld = true;
regions[ii] = world;
} else {
@@ -263,7 +246,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
}
if (newRegion) {
setr.push_back(r);
nRegions++;
++nRegions;
}
}
}
@@ -497,7 +480,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
// Access to materials and build cuts
size_t idx = 1;
if(secondaryParticle) {
if(nullptr != secondaryParticle) {
if( secondaryParticle == G4Gamma::Gamma() ) { idx = 0; }
else if( secondaryParticle == G4Electron::Electron()) { idx = 1; }
else if( secondaryParticle == G4Positron::Positron()) { idx = 2; }
@@ -508,12 +491,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
static_cast<const G4DataVector*>(theCoupleTable->GetEnergyCutsVector(idx));
// for the second run the check on cuts should be repeated
if(theCutsNew) { *theCutsNew = *theCuts; }
if(minSubRange < 1.0) {
if( !theSubCuts ) { theSubCuts = new G4DataVector(); }
theSubCuts->resize(numOfCouples,DBL_MAX);
}
if(nullptr != theCutsNew) { *theCutsNew = *theCuts; }
// G4cout << "========Start define cuts" << G4endl;
// define cut values
@@ -540,19 +518,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
}
G4double cut = (*theCuts)[i];
if(secondaryParticle) {
// compute subcut
if( cut < DBL_MAX && minSubRange < 1.0) {
G4double subcut = minSubRange*cut;
G4double rcut = std::min(minSubRange*pcuts->GetProductionCut(idx),
maxSubCutInRange);
G4double tcutmax =
theCoupleTable->ConvertRangeToEnergy(secondaryParticle,
material,rcut);
if(tcutmax < subcut) { subcut = tcutmax; }
(*theSubCuts)[i] = subcut;
}
if(nullptr != secondaryParticle) {
// note that idxOfRegionModels[] not always filled
G4int inn = 0;
@@ -573,7 +539,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
currModel = models[currRegionModel->ModelIndex(jj)];
G4double cutlim = currModel->MinEnergyCut(particle,couple);
if(cutlim > cut) {
if(!theCutsNew) { theCutsNew = new G4DataVector(*theCuts); }
if(nullptr == theCutsNew) { theCutsNew = new G4DataVector(*theCuts); }
(*theCutsNew)[i] = cutlim;
/*
G4cout << "### " << partname << " energy loss model in "
@@ -586,7 +552,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
}
}
}
if(theCutsNew) { theCuts = theCutsNew; }
if(nullptr != theCutsNew) { theCuts = theCutsNew; }
// initialize models
G4int nn = 0;
@@ -596,18 +562,17 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
++nn;
currModel = models[jj];
currModel->Initialise(particle, *theCuts);
if(flucModels[jj]) { flucModels[jj]->InitialiseMe(particle); }
if(nullptr != flucModels[jj]) { flucModels[jj]->InitialiseMe(particle); }
}
}
if(1 == nn) { severalModels = false; }
if(1 < verboseLevel) {
G4cout << "G4EmModelManager for " << partname
G4cout << "G4EmModelManager for " << particle->GetParticleName()
<< " is initialised; nRegions= " << nRegions
<< " severalModels: " << severalModels
<< G4endl;
}
return theCuts;
}
@@ -618,20 +583,12 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
G4EmTableType tType)
{
size_t i = couple->GetIndex();
G4double cut = (*theCuts)[i];
G4double emin = 0.0;
if(fTotal == tType) { cut = DBL_MAX; }
else if(fSubRestricted == tType) {
emin = cut;
if(theSubCuts) { emin = (*theSubCuts)[i]; }
}
G4double cut = (fTotal == tType) ? DBL_MAX : (*theCuts)[i];
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVector() for "
<< couple->GetMaterial()->GetName()
<< " cut(MeV)= " << cut
<< " emin(MeV)= " << emin
<< " Type " << tType
<< " for " << particle->GetParticleName()
<< G4endl;
@@ -643,14 +600,11 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
G4int nmod = regModels->NumberOfModels();
// Calculate energy losses vector
//G4cout << "nmod= " << nmod << G4endl;
size_t totBinsLoss = aVector->GetVectorLength();
G4double del = 0.0;
G4int k0 = 0;
for(size_t j=0; j<totBinsLoss; ++j) {
G4double e = aVector->Energy(j);
// Choose a model of energy losses
@@ -663,19 +617,17 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
if(k > 0 && k != k0) {
k0 = k;
G4double elow = regModels->LowEdgeEnergy(k);
G4double dedx1 = ComputeDEDX(models[regModels->ModelIndex(k-1)],
couple,elow,cut,emin);
G4double dedx2 = ComputeDEDX(models[regModels->ModelIndex(k)],
couple,elow,cut,emin);
del = 0.0;
if(dedx2 > 0.0) { del = (dedx1/dedx2 - 1.0)*elow; }
G4double dedx1 =
models[regModels->ModelIndex(k-1)]->ComputeDEDX(couple, particle, elow, cut);
G4double dedx2 =
models[regModels->ModelIndex(k)]->ComputeDEDX(couple, particle, elow, cut);
del = (dedx2 > 0.0) ? (dedx1/dedx2 - 1.0)*elow : 0.0;
//G4cout << "elow= " << elow
// << " dedx1= " << dedx1 << " dedx2= " << dedx2 << G4endl;
}
}
G4double dedx =
ComputeDEDX(models[regModels->ModelIndex(k)],couple,e,cut,emin);
dedx *= (1.0 + del/e);
G4double dedx = (1.0 + del/e)*
models[regModels->ModelIndex(k)]->ComputeDEDX(couple, particle, e, cut);
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
@@ -685,7 +637,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
<< " modelIdx= " << regModels->ModelIndex(k)
<< G4endl;
}
if(dedx < 0.0) { dedx = 0.0; }
dedx = std::max(dedx, 0.0);
aVector->PutValue(j, dedx);
}
}
@@ -700,10 +652,6 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
size_t i = couple->GetIndex();
G4double cut = (*theCuts)[i];
G4double tmax = DBL_MAX;
if (fSubRestricted == tType) {
tmax = cut;
if(theSubCuts) { cut = (*theSubCuts)[i]; }
}
G4int reg = 0;
if(nRegions > 1 && nEmModels > 1) { reg = idxOfRegionModels[i]; }
@@ -718,7 +666,6 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
<< " cut= " << cut
<< " Type " << tType
<< " nmod= " << nmod
<< " theSubCuts " << theSubCuts
<< G4endl;
}
@@ -744,14 +691,12 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
G4double xs1 = mod1->CrossSection(couple,particle,elow,cut,tmax);
mod = models[regModels->ModelIndex(k)];
G4double xs2 = mod->CrossSection(couple,particle,elow,cut,tmax);
del = 0.0;
if(xs2 > 0.0) { del = (xs1/xs2 - 1.0)*elow; }
del = (xs2 > 0.0) ? (xs1/xs2 - 1.0)*elow : 0.0;
//G4cout << "New model k=" << k << " E(MeV)= " << e/MeV
// << " Elow(MeV)= " << elow/MeV << " del= " << del << G4endl;
}
}
G4double cross = mod->CrossSection(couple,particle,e,cut,tmax);
cross *= (1.0 + del/e);
G4double cross = (1.0 + del/e)*mod->CrossSection(couple,particle,e,cut,tmax);
if(fIsCrossSectionPrim == tType) { cross *= e; }
if(j==0 && startFromNull) { cross = 0.0; }
@@ -46,11 +46,12 @@
#include "G4EmMultiModel.hh"
#include "Randomize.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmMultiModel::G4EmMultiModel(const G4String& nam)
: G4VEmModel(nam), nModels(0)
: G4VEmModel(nam)
{
model.clear();
cross_section.clear();
@@ -75,32 +76,30 @@ void G4EmMultiModel::AddModel(G4VEmModel* p)
void G4EmMultiModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
if(nModels > 0) {
G4EmParameters* param = G4EmParameters::Instance();
G4int verb = IsMaster() ? param->Verbose() : param->WorkerVerbose();
if(verb > 0) {
G4cout << "### Initialisation of EM MultiModel " << GetName()
<< " including following list of models:" << G4endl;
for(G4int i=0; i<nModels; ++i) {
G4cout << " " << (model[i])->GetName();
(model[i])->SetParticleChange(pParticleChange, GetModelOfFluctuations());
(model[i])->Initialise(p, cuts);
}
G4cout << G4endl;
<< " including following list of " << nModels << " models:" << G4endl;
}
for(G4int i=0; i<nModels; ++i) {
G4cout << " " << (model[i])->GetName();
(model[i])->SetParticleChange(pParticleChange, GetModelOfFluctuations());
(model[i])->Initialise(p, cuts);
}
if(verb > 0) { G4cout << G4endl; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmMultiModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy)
G4double G4EmMultiModel::ComputeDEDXPerVolume(const G4Material* mat,
const G4ParticleDefinition* p,
G4double kineticEnergy,
G4double cutEnergy)
{
SetCurrentCouple(couple);
G4double dedx = 0.0;
if(nModels > 0) {
for(G4int i=0; i<nModels; i++) {
dedx += (model[i])->ComputeDEDX(couple, p, cutEnergy, kineticEnergy);
}
for(G4int i=0; i<nModels; ++i) {
dedx += (model[i])->ComputeDEDXPerVolume(mat, p, cutEnergy, kineticEnergy);
}
return dedx;
@@ -116,12 +115,10 @@ G4double G4EmMultiModel::ComputeCrossSectionPerAtom(const G4ParticleDefinition*
G4double maxEnergy)
{
G4double cross = 0.0;
if(nModels>0) {
for(G4int i=0; i<nModels; ++i) {
(model[i])->SetCurrentCouple(CurrentCouple());
cross += (model[i])->ComputeCrossSectionPerAtom(p, kinEnergy, Z, A,
cutEnergy, maxEnergy);
}
for(G4int i=0; i<nModels; ++i) {
(model[i])->SetCurrentCouple(CurrentCouple());
cross += (model[i])->ComputeCrossSectionPerAtom(p, kinEnergy, Z, A,
cutEnergy, maxEnergy);
}
return cross;
}
@@ -120,7 +120,6 @@ void G4EmParameters::Initialise()
lossFluctuation = true;
buildCSDARange = false;
flagLPM = true;
spline = true;
cutAsFinalRange = false;
applyCuts = false;
lateralDisplacement = true;
@@ -128,7 +127,6 @@ void G4EmParameters::Initialise()
muhadLateralDisplacement = false;
useAngGeneratorForIonisation = false;
useMottCorrection = false;
integral = true;
birks = false;
fICRU90 = false;
gener = false;
@@ -138,7 +136,6 @@ void G4EmParameters::Initialise()
fMuDataFromFile = false;
fDNA = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
maxKinEnergy = 100.0*CLHEP::TeV;
maxKinEnergyCSDA = 1.0*CLHEP::GeV;
@@ -161,7 +158,6 @@ void G4EmParameters::Initialise()
lambdaLimit = 1.0*CLHEP::mm;
factorScreen = 1.0;
nbins = 84;
nbinsPerDecade = 7;
verbose = 1;
workerVerbose = 0;
@@ -206,15 +202,12 @@ G4bool G4EmParameters::LPM() const
return flagLPM;
}
void G4EmParameters::SetSpline(G4bool val)
{
if(IsLocked()) { return; }
spline = val;
}
// are obsolete
void G4EmParameters::SetSpline(G4bool)
{}
G4bool G4EmParameters::Spline() const
{
return spline;
return true;
}
void G4EmParameters::SetUseCutAsFinalRange(G4bool val)
@@ -272,10 +265,10 @@ G4bool G4EmParameters::Auger() const
return fCParameters->Auger();
}
// obsolete
void G4EmParameters::SetAugerCascade(G4bool val)
{
if(IsLocked()) { return; }
fCParameters->SetAuger(val);
SetAuger(val);
}
G4bool G4EmParameters::AugerCascade() const
@@ -360,17 +353,6 @@ G4bool G4EmParameters::UseMottCorrection() const
return useMottCorrection;
}
void G4EmParameters::SetIntegral(G4bool val)
{
if(IsLocked()) { return; }
integral = val;
}
G4bool G4EmParameters::Integral() const
{
return integral;
}
void G4EmParameters::SetEnablePolarisation(G4bool val)
{
if(IsLocked()) { return; }
@@ -384,17 +366,9 @@ G4bool G4EmParameters::EnablePolarisation() const
void G4EmParameters::SetBirksActive(G4bool val)
{
if(IsLocked()) { return; }
birks = val;
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&G4EmParameters::emParametersMutex);
#endif
if(birks) {
if(!emSaturation) { emSaturation = new G4EmSaturation(1); }
emSaturation->InitialiseG4Saturation();
}
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&G4EmParameters::emParametersMutex);
#endif
if(birks && nullptr == emSaturation) { emSaturation = new G4EmSaturation(1); }
}
G4bool G4EmParameters::BirksActive() const
@@ -453,9 +427,6 @@ void G4EmParameters::SetGeneralProcessActive(G4bool val)
{
if(IsLocked()) { return; }
gener = val;
// if general interaction is enabled then sub-cutoff and
// force interaction options should be disabled
if(gener) { fBParameters->Initialise(); }
}
G4bool G4EmParameters::GeneralProcessActive() const
@@ -465,10 +436,11 @@ G4bool G4EmParameters::GeneralProcessActive() const
void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
{
if(IsLocked()) { return; }
birks = (nullptr != ptr);
if(emSaturation != ptr) {
delete emSaturation;
emSaturation = ptr;
SetBirksActive(true);
}
}
@@ -512,37 +484,29 @@ void G4EmParameters::ActivateDNA()
G4EmSaturation* G4EmParameters::GetEmSaturation()
{
if(!emSaturation) { SetBirksActive(true); }
return emSaturation;
}
void G4EmParameters::SetMinSubRange(G4double val)
{
if(IsLocked()) { return; }
if(val > 0.0 && val < 1.0) {
minSubRange = val;
} else {
G4ExceptionDescription ed;
ed << "Value of MinSubRange is out of range (0 - 1): " << val
<< " is ignored";
PrintWarning(ed);
if(nullptr == emSaturation) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&emParametersMutex);
if(nullptr == emSaturation) {
#endif
emSaturation = new G4EmSaturation(1);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&emParametersMutex);
#endif
}
}
G4double G4EmParameters::MinSubRange() const
{
return minSubRange;
birks = true;
return emSaturation;
}
void G4EmParameters::SetMinEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val > 1.e-3*eV && val < maxKinEnergy) {
if(val > 1.e-3*CLHEP::eV && val < maxKinEnergy) {
minKinEnergy = val;
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MinKinEnergy - is out of range: " << val/MeV
ed << "Value of MinKinEnergy - is out of range: " << val/CLHEP::MeV
<< " MeV is ignored";
PrintWarning(ed);
}
@@ -556,13 +520,13 @@ G4double G4EmParameters::MinKinEnergy() const
void G4EmParameters::SetMaxEnergy(G4double val)
{
if(IsLocked()) { return; }
if(val > std::max(minKinEnergy,9.99*MeV) && val < 1.e+7*TeV) {
if(val > std::max(minKinEnergy,9.99*CLHEP::MeV) && val < 1.e+7*CLHEP::TeV) {
maxKinEnergy = val;
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergy is out of range: "
<< val/GeV << " GeV is ignored; allowed range 10 MeV - 1.e+7 TeV";
<< val/CLHEP::GeV
<< " GeV is ignored; allowed range 10 MeV - 1.e+7 TeV";
PrintWarning(ed);
}
}
@@ -575,12 +539,12 @@ G4double G4EmParameters::MaxKinEnergy() const
void G4EmParameters::SetMaxEnergyForCSDARange(G4double val)
{
if(IsLocked()) { return; }
if(val > minKinEnergy && val <= 100*TeV) {
if(val > minKinEnergy && val <= 100*CLHEP::TeV) {
maxKinEnergyCSDA = val;
} else {
G4ExceptionDescription ed;
ed << "Value of MaxKinEnergyCSDA is out of range: "
<< val/GeV << " GeV is ignored; allowed range "
<< val/CLHEP::GeV << " GeV is ignored; allowed range "
<< minKinEnergy << " MeV - 100 TeV";
PrintWarning(ed);
}
@@ -927,23 +891,9 @@ void G4EmParameters::FillStepFunction(const G4ParticleDefinition* part, G4VEnerg
fBParameters->FillStepFunction(part, proc);
}
void G4EmParameters::SetNumberOfBins(G4int val)
{
if(IsLocked()) { return; }
if(val >= 5 && val < 10000000) {
nbins = val;
nbinsPerDecade = G4lrint(nbins/std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of number of bins is out of range: "
<< val << " is ignored";
PrintWarning(ed);
}
}
G4int G4EmParameters::NumberOfBins() const
{
return nbins;
return nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
}
void G4EmParameters::SetNumberOfBinsPerDecade(G4int val)
@@ -951,7 +901,6 @@ void G4EmParameters::SetNumberOfBinsPerDecade(G4int val)
if(IsLocked()) { return; }
if(val >= 5 && val < 1000000) {
nbinsPerDecade = val;
nbins = nbinsPerDecade*G4lrint(std::log10(maxKinEnergy/minKinEnergy));
} else {
G4ExceptionDescription ed;
ed << "Value of number of bins per decade is out of range: "
@@ -1161,10 +1110,10 @@ const std::vector<G4String>& G4EmParameters::TypesPhysics() const
return fBParameters->TypesPhysics();
}
void G4EmParameters::SetSubCutoff(G4bool val, const G4String& region)
void G4EmParameters::SetSubCutRegion(const G4String& region)
{
if(IsLocked() && !gener) { return; }
fBParameters->SetSubCutoff(val, region);
if(IsLocked()) { return; }
fBParameters->SetSubCutRegion(region);
}
void
@@ -1268,10 +1217,8 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "====== Electromagnetic Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "LPM effect enabled " <<flagLPM << "\n";
os << "Spline of EM tables enabled " <<spline << "\n";
os << "Enable creation and use of sampling tables " <<fSamplingTable << "\n";
os << "Apply cuts on all EM processes " <<applyCuts << "\n";
os << "Use integral approach for tracking " <<integral << "\n";
os << "Use general process " <<gener << "\n";
os << "Enable linear polarisation for gamma " <<fPolarisation << "\n";
os << "Enable sampling of quantum entanglement "
@@ -1281,7 +1228,6 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
os << "Max kinetic energy for tables "
<<G4BestUnit(maxKinEnergy,"Energy") << "\n";
os << "Number of bins in tables " <<nbins << "\n";
os << "Number of bins per decade of a table " <<nbinsPerDecade << "\n";
os << "Verbose level " <<verbose << "\n";
os << "Verbose level for worker thread " <<workerVerbose << "\n";
@@ -1329,7 +1275,6 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "Use cut as a final range enabled " <<cutAsFinalRange << "\n";
os << "Enable angular generator interface "
<<useAngGeneratorForIonisation << "\n";
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
os << "Max kinetic energy for CSDA tables "
<<G4BestUnit(maxKinEnergyCSDA,"Energy") << "\n";
os << "Max kinetic energy for NIEL computation "
@@ -77,171 +77,180 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
flucCmd->SetParameterName("choice",true);
flucCmd->SetDefaultValue(true);
flucCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
flucCmd->SetToBeBroadcasted(false);
rangeCmd = new G4UIcmdWithABool("/process/eLoss/CSDARange",this);
rangeCmd->SetGuidance("Enable/disable CSDA range calculation");
rangeCmd->SetParameterName("range",true);
rangeCmd->SetDefaultValue(false);
rangeCmd->AvailableForStates(G4State_PreInit);
rangeCmd->SetToBeBroadcasted(false);
lpmCmd = new G4UIcmdWithABool("/process/eLoss/LPM",this);
lpmCmd->SetGuidance("Enable/disable LPM effect calculation");
lpmCmd->SetParameterName("lpm",true);
lpmCmd->SetDefaultValue(true);
lpmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
splCmd = new G4UIcmdWithABool("/process/em/spline",this);
splCmd->SetGuidance("Enable/disable usage spline for Physics Vectors");
splCmd->SetParameterName("spl",true);
splCmd->SetDefaultValue(false);
splCmd->AvailableForStates(G4State_PreInit);
lpmCmd->SetToBeBroadcasted(false);
rsCmd = new G4UIcmdWithABool("/process/eLoss/useCutAsFinalRange",this);
rsCmd->SetGuidance("Enable/disable use of cut in range as a final range");
rsCmd->SetParameterName("choice",true);
rsCmd->SetDefaultValue(false);
rsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
rsCmd->SetToBeBroadcasted(false);
aplCmd = new G4UIcmdWithABool("/process/em/applyCuts",this);
aplCmd->SetGuidance("Enable/disable applying cuts for gamma processes");
aplCmd->SetParameterName("apl",true);
aplCmd->SetDefaultValue(false);
aplCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
aplCmd->SetToBeBroadcasted(false);
latCmd = new G4UIcmdWithABool("/process/msc/LateralDisplacement",this);
latCmd->SetGuidance("Enable/disable sampling of lateral displacement");
latCmd->SetParameterName("lat",true);
latCmd->SetDefaultValue(true);
latCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
latCmd->SetToBeBroadcasted(false);
lat96Cmd = new G4UIcmdWithABool("/process/msc/LateralDisplacementAlg96",this);
lat96Cmd->SetGuidance("Enable/disable sampling of lateral displacement");
lat96Cmd->SetParameterName("lat96",true);
lat96Cmd->SetDefaultValue(false);
lat96Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lat96Cmd->SetToBeBroadcasted(false);
mulatCmd = new G4UIcmdWithABool("/process/msc/MuHadLateralDisplacement",this);
mulatCmd->SetGuidance("Enable/disable sampling of lateral displacement for muons and hadrons");
mulatCmd->SetParameterName("mulat",true);
mulatCmd->SetDefaultValue(true);
mulatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mulatCmd->SetToBeBroadcasted(false);
delCmd = new G4UIcmdWithABool("/process/eLoss/UseAngularGenerator",this);
delCmd->SetGuidance("Enable usage of angular generator for ionisation");
delCmd->SetParameterName("del",true);
delCmd->SetDefaultValue(false);
delCmd->AvailableForStates(G4State_PreInit);
IntegCmd = new G4UIcmdWithABool("/process/eLoss/integral",this);
IntegCmd->SetGuidance("Switch true/false the integral option");
IntegCmd->SetParameterName("integ",true);
IntegCmd->SetDefaultValue(true);
IntegCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
delCmd->SetToBeBroadcasted(false);
mottCmd = new G4UIcmdWithABool("/process/msc/UseMottCorrection",this);
mottCmd->SetGuidance("Enable usage of Mott corrections for e- elastic scattering");
mottCmd->SetParameterName("mott",true);
mottCmd->SetDefaultValue(false);
mottCmd->AvailableForStates(G4State_PreInit);
mottCmd->SetToBeBroadcasted(false);
birksCmd = new G4UIcmdWithABool("/process/msc/UseG4EmSaturation",this);
birksCmd->SetGuidance("Enable usage of built-in Birks saturation");
birksCmd->SetParameterName("birks",true);
birksCmd->SetDefaultValue(false);
birksCmd->AvailableForStates(G4State_PreInit,G4State_Init);
birksCmd->SetToBeBroadcasted(false);
sharkCmd = new G4UIcmdWithABool("/process/em/UseGeneralProcess",this);
sharkCmd->SetGuidance("Enable gamma, e+- general process");
sharkCmd->SetParameterName("gen",true);
sharkCmd->SetDefaultValue(false);
sharkCmd->AvailableForStates(G4State_PreInit);
sharkCmd->SetToBeBroadcasted(false);
sampleTCmd = new G4UIcmdWithABool("/process/em/enableSamplingTable",this);
sampleTCmd->SetGuidance("Enable usage of sampling table for secondary generation");
sampleTCmd->SetParameterName("sampleT",true);
sampleTCmd->SetDefaultValue(false);
sampleTCmd->AvailableForStates(G4State_PreInit);
sampleTCmd->SetToBeBroadcasted(false);
icru90Cmd = new G4UIcmdWithABool("/process/eLoss/UseICRU90",this);
icru90Cmd->SetGuidance("Enable usage of ICRU90 stopping powers");
icru90Cmd->SetParameterName("icru90",true);
icru90Cmd->SetDefaultValue(false);
icru90Cmd->AvailableForStates(G4State_PreInit);
icru90Cmd->SetToBeBroadcasted(false);
mudatCmd = new G4UIcmdWithABool("/process/em/MuDataFromFile",this);
mudatCmd->SetGuidance("Enable usage of muon data from file");
mudatCmd->SetParameterName("mudat",true);
mudatCmd->SetDefaultValue(false);
mudatCmd->AvailableForStates(G4State_PreInit);
minSubSecCmd = new G4UIcmdWithADouble("/process/eLoss/minsubsec",this);
minSubSecCmd->SetGuidance("Set the ratio subcut/cut ");
minSubSecCmd->SetParameterName("rcmin",true);
minSubSecCmd->AvailableForStates(G4State_PreInit);
mudatCmd->SetToBeBroadcasted(false);
minEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minKinEnergy",this);
minEnCmd->SetGuidance("Set the min kinetic energy for EM tables");
minEnCmd->SetParameterName("emin",true);
minEnCmd->SetUnitCategory("Energy");
minEnCmd->AvailableForStates(G4State_PreInit);
minEnCmd->SetToBeBroadcasted(false);
maxEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/maxKinEnergy",this);
maxEnCmd->SetGuidance("Set the max kinetic energy for EM tables");
maxEnCmd->SetParameterName("emax",true);
maxEnCmd->SetUnitCategory("Energy");
maxEnCmd->AvailableForStates(G4State_PreInit);
maxEnCmd->SetToBeBroadcasted(false);
cenCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/maxKinEnergyCSDA",this);
cenCmd->SetGuidance("Set the max kinetic energy for CSDA table");
cenCmd->SetParameterName("emaxCSDA",true);
cenCmd->SetUnitCategory("Energy");
cenCmd->AvailableForStates(G4State_PreInit);
cenCmd->SetToBeBroadcasted(false);
max5DCmd = new G4UIcmdWithADoubleAndUnit("/process/em/max5DMuPairEnergy",this);
max5DCmd->SetGuidance("Set the max kinetic energy for 5D muon pair production");
max5DCmd->SetParameterName("emax5D",true);
max5DCmd->SetUnitCategory("Energy");
max5DCmd->AvailableForStates(G4State_PreInit);
max5DCmd->SetToBeBroadcasted(false);
lowEnCmd = new G4UIcmdWithADoubleAndUnit("/process/em/lowestElectronEnergy",this);
lowEnCmd->SetGuidance("Set the lowest kinetic energy for e+-");
lowEnCmd->SetParameterName("elow",true);
lowEnCmd->SetUnitCategory("Energy");
lowEnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lowEnCmd->SetToBeBroadcasted(false);
lowhEnCmd = new G4UIcmdWithADoubleAndUnit("/process/em/lowestMuHadEnergy",this);
lowhEnCmd->SetGuidance("Set the lowest kinetic energy for muons and hadrons");
lowhEnCmd->SetParameterName("elowh",true);
lowhEnCmd->SetUnitCategory("Energy");
lowhEnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lowhEnCmd->SetToBeBroadcasted(false);
lowEn3Cmd = new G4UIcmdWithADoubleAndUnit("/process/em/lowestTripletEnergy",this);
lowEn3Cmd->SetGuidance("Set the lowest kinetic energy for triplet production");
lowEn3Cmd->SetParameterName("elow3",true);
lowEn3Cmd->SetUnitCategory("Energy");
lowEn3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lowEn3Cmd->SetToBeBroadcasted(false);
lllCmd = new G4UIcmdWithADouble("/process/eLoss/linLossLimit",this);
lllCmd->SetGuidance("Set linearLossLimit parameter");
lllCmd->SetParameterName("linlim",true);
lllCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lllCmd->SetToBeBroadcasted(false);
brCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/bremThreshold",this);
brCmd->SetGuidance("Set e+- bremsstrahlung energy threshold");
brCmd->SetParameterName("emaxBrem",true);
brCmd->SetUnitCategory("Energy");
brCmd->AvailableForStates(G4State_PreInit);
brCmd->SetToBeBroadcasted(false);
br1Cmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/bremMuHadThreshold",this);
br1Cmd->SetGuidance("Set muon/hadron bremsstrahlung energy threshold");
br1Cmd->SetParameterName("emaxMuHadBrem",true);
br1Cmd->SetUnitCategory("Energy");
br1Cmd->AvailableForStates(G4State_PreInit);
br1Cmd->SetToBeBroadcasted(false);
labCmd = new G4UIcmdWithADouble("/process/eLoss/LambdaFactor",this);
labCmd->SetGuidance("Set lambdaFactor parameter for integral option");
labCmd->SetParameterName("Fl",true);
labCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
labCmd->SetToBeBroadcasted(false);
mscfCmd = new G4UIcmdWithADouble("/process/msc/FactorForAngleLimit",this);
mscfCmd->SetGuidance("Set factor for computation of a limit for -t (invariant transfer)");
@@ -249,24 +258,28 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
mscfCmd->SetRange("Fact>0");
mscfCmd->SetDefaultValue(1.);
mscfCmd->AvailableForStates(G4State_PreInit);
mscfCmd->SetToBeBroadcasted(false);
angCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/ThetaLimit",this);
angCmd->SetGuidance("Set the limit on the polar angle for msc and single scattering");
angCmd->SetParameterName("theta",true);
angCmd->SetUnitCategory("Angle");
angCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
angCmd->AvailableForStates(G4State_PreInit);
angCmd->SetToBeBroadcasted(false);
msceCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/EnergyLimit",this);
msceCmd->SetGuidance("Set the upper energy limit for msc");
msceCmd->SetParameterName("mscE",true);
msceCmd->SetUnitCategory("Energy");
msceCmd->AvailableForStates(G4State_PreInit);
msceCmd->SetToBeBroadcasted(false);
nielCmd = new G4UIcmdWithADoubleAndUnit("/process/em/MaxEnergyNIEL",this);
nielCmd->SetGuidance("Set the upper energy limit for NIEL");
nielCmd->SetParameterName("niel",true);
nielCmd->SetUnitCategory("Energy");
nielCmd->AvailableForStates(G4State_PreInit);
nielCmd->SetToBeBroadcasted(false);
frCmd = new G4UIcmdWithADouble("/process/msc/RangeFactor",this);
frCmd->SetGuidance("Set RangeFactor for msc processes of e+-");
@@ -274,6 +287,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
frCmd->SetRange("Fr>0");
frCmd->SetDefaultValue(0.04);
frCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
frCmd->SetToBeBroadcasted(false);
fr1Cmd = new G4UIcmdWithADouble("/process/msc/RangeFactorMuHad",this);
fr1Cmd->SetGuidance("Set RangeFactor for msc processes of muons/hadrons");
@@ -281,6 +295,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
fr1Cmd->SetRange("Fr1>0");
fr1Cmd->SetDefaultValue(0.2);
fr1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fr1Cmd->SetToBeBroadcasted(false);
fgCmd = new G4UIcmdWithADouble("/process/msc/GeomFactor",this);
fgCmd->SetGuidance("Set GeomFactor parameter for msc processes");
@@ -288,90 +303,93 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
fgCmd->SetRange("Fg>0");
fgCmd->SetDefaultValue(3.5);
fgCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fgCmd->SetToBeBroadcasted(false);
skinCmd = new G4UIcmdWithADouble("/process/msc/Skin",this);
skinCmd->SetGuidance("Set skin parameter for msc processes");
skinCmd->SetParameterName("skin",true);
skinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
skinCmd->SetToBeBroadcasted(false);
screCmd = new G4UIcmdWithADouble("/process/msc/ScreeningFactor",this);
screCmd->SetGuidance("Set screening factor");
screCmd->SetParameterName("screen",true);
screCmd->AvailableForStates(G4State_PreInit);
screCmd->SetToBeBroadcasted(false);
safCmd = new G4UIcmdWithADouble("/process/msc/SafetyFactor",this);
safCmd->SetGuidance("Set safety factor");
safCmd->SetParameterName("fsafe",true);
safCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
safCmd->AvailableForStates(G4State_PreInit);
safCmd->SetToBeBroadcasted(false);
llimCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/LambdaLimit",this);
llimCmd->SetGuidance("Set the upper energy limit for NIEL");
llimCmd->SetParameterName("ll",true);
llimCmd->SetUnitCategory("Length");
llimCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dedxCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsDEDX",this);
dedxCmd->SetGuidance("Set number of bins for EM tables");
dedxCmd->SetParameterName("binsDEDX",true);
dedxCmd->SetDefaultValue(84);
dedxCmd->AvailableForStates(G4State_PreInit);
lamCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsLambda",this);
lamCmd->SetGuidance("Set number of bins for EM tables");
lamCmd->SetParameterName("binsL",true);
lamCmd->SetDefaultValue(84);
lamCmd->AvailableForStates(G4State_PreInit);
llimCmd->AvailableForStates(G4State_PreInit);
llimCmd->SetToBeBroadcasted(false);
amCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsPerDecade",this);
amCmd->SetGuidance("Set number of bins per decade for EM tables");
amCmd->SetParameterName("bins",true);
amCmd->SetDefaultValue(7);
amCmd->AvailableForStates(G4State_PreInit);
amCmd->SetToBeBroadcasted(false);
verCmd = new G4UIcmdWithAnInteger("/process/eLoss/verbose",this);
verCmd->SetGuidance("Set verbose level for EM physics");
verCmd->SetParameterName("verb",true);
verCmd->SetDefaultValue(1);
verCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verCmd->SetToBeBroadcasted(false);
ver1Cmd = new G4UIcmdWithAnInteger("/process/em/verbose",this);
ver1Cmd->SetGuidance("Set verbose level for EM physics");
ver1Cmd->SetParameterName("verb1",true);
ver1Cmd->SetDefaultValue(1);
ver1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
ver1Cmd->SetToBeBroadcasted(false);
ver2Cmd = new G4UIcmdWithAnInteger("/process/em/workerVerbose",this);
ver2Cmd->SetGuidance("Set worker verbose level for EM physics");
ver2Cmd->SetParameterName("verb2",true);
ver2Cmd->SetDefaultValue(1);
ver2Cmd->SetDefaultValue(0);
ver2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
ver2Cmd->SetToBeBroadcasted(false);
mscCmd = new G4UIcmdWithAString("/process/msc/StepLimit",this);
mscCmd->SetGuidance("Set msc step limitation type");
mscCmd->SetParameterName("StepLim",true);
mscCmd->SetCandidates("Minimal UseSafety UseSafetyPlus UseDistanceToBoundary");
mscCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mscCmd->SetToBeBroadcasted(false);
msc1Cmd = new G4UIcmdWithAString("/process/msc/StepLimitMuHad",this);
msc1Cmd->SetGuidance("Set msc step limitation type for muons/hadrons");
msc1Cmd->SetParameterName("StepLim1",true);
msc1Cmd->SetCandidates("Minimal UseSafety UseSafetyPlus UseDistanceToBoundary");
msc1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
msc1Cmd->SetToBeBroadcasted(false);
dumpCmd = new G4UIcommand("/process/em/printParameters",this);
dumpCmd->SetGuidance("Print all EM parameters.");
dumpCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dumpCmd->SetToBeBroadcasted(false);
nffCmd = new G4UIcmdWithAString("/process/em/setNuclearFormFactor",this);
nffCmd->SetGuidance("Define type of nuclear form-factor");
nffCmd->SetParameterName("NucFF",true);
nffCmd->SetCandidates("None Exponential Gaussian Flat");
nffCmd->AvailableForStates(G4State_PreInit);
nffCmd->SetToBeBroadcasted(false);
ssCmd = new G4UIcmdWithAString("/process/em/setSingleScattering",this);
ssCmd->SetGuidance("Define type of e+- single scattering model");
ssCmd->SetParameterName("SS",true);
ssCmd->SetCandidates("WVI Mott DPWA");
ssCmd->AvailableForStates(G4State_PreInit);
ssCmd->SetToBeBroadcasted(false);
tripletCmd = new G4UIcmdWithAnInteger("/process/gconv/conversionType",this);
tripletCmd->SetGuidance("gamma conversion triplet/nuclear generation type:");
@@ -382,6 +400,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
tripletCmd->SetRange("type >= 0 && type <= 2");
tripletCmd->SetDefaultValue(0);
tripletCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
tripletCmd->SetToBeBroadcasted(false);
onIsolatedCmd = new G4UIcmdWithABool("/process/gconv/onIsolated",this);
onIsolatedCmd->SetGuidance("Conversion on isolated charged particles");
@@ -390,6 +409,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
onIsolatedCmd->SetParameterName("flag",false);
onIsolatedCmd->SetDefaultValue(false);
onIsolatedCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
onIsolatedCmd->SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -405,14 +425,12 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete flucCmd;
delete rangeCmd;
delete lpmCmd;
delete splCmd;
delete rsCmd;
delete aplCmd;
delete latCmd;
delete lat96Cmd;
delete mulatCmd;
delete delCmd;
delete IntegCmd;
delete mottCmd;
delete birksCmd;
delete sharkCmd;
@@ -421,7 +439,6 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete icru90Cmd;
delete mudatCmd;
delete minSubSecCmd;
delete minEnCmd;
delete maxEnCmd;
delete max5DCmd;
@@ -445,8 +462,6 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete llimCmd;
delete screCmd;
delete dedxCmd;
delete lamCmd;
delete amCmd;
delete verCmd;
delete ver1Cmd;
@@ -475,8 +490,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == lpmCmd) {
theParameters->SetLPM(lpmCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == splCmd) {
theParameters->SetSpline(splCmd->GetNewBoolValue(newValue));
} else if (command == rsCmd) {
theParameters->SetUseCutAsFinalRange(rsCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -494,9 +507,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == delCmd) {
theParameters->ActivateAngularGeneratorForIonisation(delCmd->GetNewBoolValue(newValue));
} else if (command == IntegCmd) {
theParameters->SetIntegral(IntegCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == mottCmd) {
theParameters->SetUseMottCorrection(mottCmd->GetNewBoolValue(newValue));
} else if (command == birksCmd) {
@@ -510,8 +520,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == mudatCmd) {
theParameters->SetRetrieveMuDataFromFile(mudatCmd->GetNewBoolValue(newValue));
} else if (command == minSubSecCmd) {
theParameters->SetMinSubRange(minSubSecCmd->GetNewDoubleValue(newValue));
} else if (command == minEnCmd) {
theParameters->SetMinEnergy(minEnCmd->GetNewDoubleValue(newValue));
} else if (command == maxEnCmd) {
@@ -546,7 +554,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetFactorForAngleLimit(mscfCmd->GetNewDoubleValue(newValue));
} else if (command == angCmd) {
theParameters->SetMscThetaLimit(angCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == msceCmd) {
theParameters->SetMscEnergyLimit(msceCmd->GetNewDoubleValue(newValue));
} else if (command == nielCmd) {
@@ -565,26 +572,16 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
physicsModified = true;
} else if (command == safCmd) {
theParameters->SetMscSafetyFactor(safCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == llimCmd) {
theParameters->SetMscLambdaLimit(llimCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == screCmd) {
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
} else if (command == dedxCmd) {
theParameters->SetNumberOfBins(dedxCmd->GetNewIntValue(newValue));
} else if (command == lamCmd) {
theParameters->SetNumberOfBins(lamCmd->GetNewIntValue(newValue));
} else if (command == amCmd) {
theParameters->SetNumberOfBinsPerDecade(amCmd->GetNewIntValue(newValue));
} else if (command == verCmd) {
theParameters->SetVerbose(verCmd->GetNewIntValue(newValue));
} else if (command == ver1Cmd) {
theParameters->SetVerbose(ver1Cmd->GetNewIntValue(newValue));
physicsModified = true;
} else if (command == ver2Cmd) {
theParameters->SetWorkerVerbose(ver2Cmd->GetNewIntValue(newValue));
physicsModified = true;
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == mscCmd || command == msc1Cmd) {
@@ -634,7 +631,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetSingleScatteringType(x);
} else if ( command==tripletCmd ) {
theParameters->SetConversionType(tripletCmd->GetNewIntValue(newValue));
physicsModified = true;
} else if ( command==onIsolatedCmd ) {
theParameters->SetOnIsolated(onIsolatedCmd->GetNewBoolValue(newValue));
physicsModified = true;
@@ -1,392 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4EmProcessOptions
//
// Author: Vladimir Ivanchenko
//
// Creation date: 27.02.2004
//
// Modifications:
// 30-06-04 G4EmProcess is pure discrete (V.Ivanchenko)
// 24-03-05 Add ApplyCuts and RandomStep (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit to G4LossTableManager (V.Ivantchenko)
// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
// 30-05-12 Add biasing for G4VEmProcess (D. Sawkey)
//
// Class Description:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmProcessOptions.hh"
#include "G4EmParameters.hh"
#include "G4SystemOfUnits.hh"
#include "G4VEmProcess.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Threading.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmProcessOptions::G4EmProcessOptions()
{
G4cout << "### WARNING: G4EmProcessOptions class is obsolete and "
<< "will be removed in the next public release \n"
<< " Please, try to use G4EmParameters class and/or UI "
<< "interface to EM parameters"
<< G4endl;
theParameters = G4EmParameters::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmProcessOptions::~G4EmProcessOptions()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLossFluctuations(G4bool val)
{
theParameters->SetLossFluctuations(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBuildCSDARange(G4bool val)
{
theParameters->SetBuildCSDARange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLPMFlag(G4bool val)
{
theParameters->SetLPM(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetSplineFlag(G4bool val)
{
theParameters->SetSpline(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetUseCutAsFinalRange(G4bool val)
{
theParameters->SetUseCutAsFinalRange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetApplyCuts(G4bool val)
{
theParameters->SetApplyCuts(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetFluo(G4bool val)
{
theParameters->SetFluo(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetAuger(G4bool val)
{
theParameters->SetAuger(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetPIXE(G4bool val)
{
theParameters->SetPixe(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDeexcitationIgnoreCuts(G4bool val)
{
theParameters->SetDeexcitationIgnoreCut(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscLateralDisplacement(G4bool val)
{
theParameters->SetLateralDisplacement(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscMuHadLateralDisplacement(G4bool val)
{
theParameters->SetMuHadLateralDisplacement(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDisplacementBeyondSafety(G4bool)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMinSubRange(G4double val)
{
theParameters->SetMinSubRange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMinEnergy(G4double val)
{
theParameters->SetMinEnergy(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMaxEnergy(G4double val)
{
theParameters->SetMaxEnergy(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
{
theParameters->SetMaxEnergy(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
{
theParameters->SetMaxEnergyForCSDARange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLinearLossLimit(G4double val)
{
theParameters->SetLinearLossLimit(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBremsstrahlungTh(G4double val)
{
theParameters->SetBremsstrahlungTh(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLambdaFactor(G4double val)
{
theParameters->SetLambdaFactor(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetFactorForAngleLimit(G4double val)
{
theParameters->SetFactorForAngleLimit(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetPolarAngleLimit(G4double val)
{
theParameters->SetMscThetaLimit(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscRangeFactor(G4double val)
{
theParameters->SetMscRangeFactor(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscGeomFactor(G4double val)
{
theParameters->SetMscGeomFactor(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetSkin(G4double val)
{
theParameters->SetMscSkin(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDEDXBinning(G4int val)
{
theParameters->SetNumberOfBins(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLambdaBinning(G4int val)
{
theParameters->SetNumberOfBins(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetVerbose(G4int val)
{
theParameters->SetVerbose(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetWorkerVerbose(G4int val)
{
theParameters->SetWorkerVerbose(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscStepLimitation(G4MscStepLimitType val)
{
theParameters->SetMscStepLimitType(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetSubCutoff(G4bool val, const G4String& r)
{
theParameters->SetSubCutoff(val, r);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetIntegral(G4bool val)
{
theParameters->SetIntegral(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
{
theParameters->SetStepFunction(v1, v2);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::SetDeexcitationActiveRegion(const G4String& rname,
G4bool valDeex,
G4bool valAuger,
G4bool valPIXE)
{
theParameters->SetDeexActiveRegion(rname, valDeex, valAuger, valPIXE);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetPIXECrossSectionModel(const G4String& mname)
{
theParameters->SetPIXECrossSectionModel(mname);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::SetPIXEElectronCrossSectionModel(const G4String& mname)
{
theParameters->SetPIXEElectronCrossSectionModel(mname);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::SetProcessBiasingFactor(const G4String& name, G4double val,
G4bool flag)
{
theParameters->SetProcessBiasingFactor(name, val, flag);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::ActivateForcedInteraction(const G4String& name,
G4double length,
const G4String& region,
G4bool flag)
{
theParameters->ActivateForcedInteraction(name, region, length, flag);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::ActivateSecondaryBiasing(const G4String& name,
const G4String& region,
G4double factor,
G4double energyLimit)
{
theParameters->ActivateSecondaryBiasing(name, region, factor, energyLimit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4EmProcessOptions::ActivateSecondaryBiasingForGamma(const G4String& name,
const G4String& region,
G4double factor,
G4double energyLimit)
{
theParameters->ActivateSecondaryBiasing(name, region, factor, energyLimit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -53,7 +53,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4EmSaturation::nMaterials = 0;
size_t G4EmSaturation::nMaterials = 0;
std::vector<G4double> G4EmSaturation::massFactors;
std::vector<G4double> G4EmSaturation::effCharges;
std::vector<G4double> G4EmSaturation::g4MatData;
@@ -62,12 +62,12 @@ std::vector<G4String> G4EmSaturation::g4MatNames;
G4EmSaturation::G4EmSaturation(G4int verb)
{
verbose = verb;
nWarnings = nG4Birks = 0;
electron = nullptr;
proton = nullptr;
nist = G4NistManager::Instance();
InitialiseG4Saturation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -98,7 +98,7 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
// atomic relaxations for gamma incident
if(22 == p->GetPDGEncoding()) {
//G4cout << "%% gamma edep= " << edep/keV << " keV " <<manager << G4endl;
//G4cout << "%% gamma edep= " << edep/keV << " keV " << G4endl;
evis /= (1.0 + bfactor*edep/
G4LossTableManager::Instance()->GetRange(electron,edep,couple));
@@ -122,12 +122,13 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
if(nloss > 0.0) {
G4int idx = couple->GetMaterial()->GetIndex();
G4double escaled = nloss*massFactors[idx];
/*
/*
G4cout << "%% p edep= " << nloss/keV << " keV Escaled= "
<< escaled << " MeV in " << couple->GetMaterial()->GetName()
<< " " << p->GetParticleName()
<< G4endl;
*/
<< " " << p->GetParticleName()
<< G4endl;
G4cout << proton->GetParticleName() << G4endl;
*/
G4double range = G4LossTableManager::Instance()
->GetRange(proton,escaled,couple)/effCharges[idx];
nloss /= (1.0 + bfactor*nloss/range);
@@ -142,13 +143,14 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
void G4EmSaturation::InitialiseG4Saturation()
{
if(nMaterials == G4Material::GetNumberOfMaterials()) { return; }
nMaterials = G4Material::GetNumberOfMaterials();
massFactors.resize(nMaterials, 1.0);
effCharges.resize(nMaterials, 1.0);
if(0 == nG4Birks) { InitialiseG4materials(); }
for(G4int i=0; i<nMaterials; ++i) {
for(size_t i=0; i<nMaterials; ++i) {
InitialiseBirksCoefficient((*G4Material::GetMaterialTable())[i]);
}
if(verbose > 0) { DumpBirksCoefficients(); }
@@ -180,12 +182,12 @@ G4double G4EmSaturation::FindG4BirksCoefficient(const G4Material* mat)
void G4EmSaturation::InitialiseBirksCoefficient(const G4Material* mat)
{
// electron and proton should exist in any case
if(!electron) {
if(nullptr == electron) {
electron = G4ParticleTable::GetParticleTable()->FindParticle("e-");
proton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
if(!electron || !proton) {
if(nullptr == electron) {
G4Exception("G4EmSaturation::InitialiseBirksCoefficient", "em0001",
FatalException, "both electron and proton should exist");
FatalException, "electron should exist");
}
}
@@ -237,7 +239,7 @@ void G4EmSaturation::DumpBirksCoefficients()
{
G4cout << "### Birks coefficients used in run time" << G4endl;
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
for(G4int i=0; i<nMaterials; ++i) {
for(size_t i=0; i<nMaterials; ++i) {
const G4Material* mat = (*mtable)[i];
G4double br = mat->GetIonisation()->GetBirksConstant();
if(br > 0.0) {
@@ -57,7 +57,7 @@
#include "G4PhysicsTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4LPhysicsFreeVector.hh"
#include "G4PhysicsFreeVector.hh"
#include "G4ProductionCutsTable.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Material.hh"
@@ -78,19 +78,20 @@ std::vector<G4bool>* G4LossTableBuilder::theFlag = nullptr;
G4LossTableBuilder::G4LossTableBuilder(G4bool master) : isMaster(master)
{
theParameters = G4EmParameters::Instance();
splineFlag = true;
isInitialized = false;
if(isMaster || !theFlag) {
if(nullptr == theFlag) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&ltbMutex);
if(isMaster || !theFlag) {
if(nullptr == theFlag) {
#endif
isMaster = true;
if(!isMaster) {
G4ExceptionDescription ed;
ed << "Initialisation called from a worker thread ";
G4Exception("G4LossTableBuilder: ", "em0001",
JustWarning, ed);
}
theDensityFactor = new std::vector<G4double>;
theDensityIdx = new std::vector<G4int>;
theFlag = new std::vector<G4bool>;
} else {
isMaster = false;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&ltbMutex);
@@ -151,14 +152,13 @@ G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
for (size_t i=0; i<nCouples; ++i) {
G4PhysicsLogVector* pv0 = static_cast<G4PhysicsLogVector*>((*(list[0]))[i]);
if(pv0) {
if(nullptr != pv0) {
size_t npoints = pv0->GetVectorLength();
G4PhysicsLogVector* pv = new G4PhysicsLogVector(*pv0);
pv->SetSpline(splineFlag);
for (size_t j=0; j<npoints; ++j) {
G4double dedx = 0.0;
for (size_t k=0; k<n_processes; ++k) {
G4PhysicsVector* pv1 = (*(list[k]))[i];
const G4PhysicsVector* pv1 = (*(list[k]))[i];
dedx += (*pv1)[j];
}
pv->PutValue(j, dedx);
@@ -209,21 +209,12 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
// <<" bin0= " << bin0 <<G4endl;
// initialisation of a new vector
if(npoints < 2) { npoints = 2; }
if(npoints < 3) { npoints = 3; }
delete (*rangeTable)[i];
G4PhysicsLogVector* v;
if(0 == bin0) { v = new G4PhysicsLogVector(*pv); }
else { v = new G4PhysicsLogVector(elow, ehigh, npoints-1); }
// dedx is exact zero cannot build range table
if(2 == npoints) {
v->PutValue(0,1000.);
v->PutValue(1,2000.);
G4PhysicsTableHelper::SetPhysicsVector(rangeTable, i, v);
return;
}
v->SetSpline(splineFlag);
else { v = new G4PhysicsLogVector(elow, ehigh, npoints-1, splineFlag); }
// assumed dedx proportional to beta
G4double energy1 = v->Energy(0);
@@ -272,8 +263,7 @@ G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
G4double rhigh = (*pv)[npoints-1];
delete (*invRangeTable)[i];
G4LPhysicsFreeVector* v = new G4LPhysicsFreeVector(npoints,rlow,rhigh);
v->SetSpline(splineFlag);
G4PhysicsFreeVector* v = new G4PhysicsFreeVector(npoints,rlow,rhigh,splineFlag);
for (size_t j=0; j<npoints; ++j) {
G4double e = pv->Energy(j);
@@ -304,10 +294,10 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
theFlag->reserve(nCouples);
}
for(size_t i=0; i<nFlags; ++i) {
(*theFlag)[i] = (table) ? table->GetFlag(i) : true;
(*theFlag)[i] = (nullptr != table) ? table->GetFlag(i) : true;
}
for(size_t i=nFlags; i<nCouples; ++i) {
G4bool yes = (table) ? table->GetFlag(i) : true;
G4bool yes = (nullptr != table) ? table->GetFlag(i) : true;
theDensityFactor->push_back(1.0);
theDensityIdx->push_back(i);
theFlag->push_back(yes);
@@ -322,7 +312,7 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
auto bmat = mat->GetBaseMaterial();
// base material exists - find it and check if it can be reused
if(bmat) {
if(nullptr != bmat) {
for(size_t j=0; j<nCouples; ++j) {
if(j == i) { continue; }
auto bcouple = theCoupleTable->GetMaterialCutsCouple(j);
@@ -346,7 +336,7 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
}
/*
for(size_t i=0; i<nCouples; ++i) {
G4cout << "CoupleIdx= " << i << " Flag= " << theFlag[i]
G4cout << "CoupleIdx= " << i << " Flag= " << (*theFlag)[i]
<< " TableFlag= " << table->GetFlag(i) << " "
<< theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetName()
<< G4endl;
@@ -365,7 +355,7 @@ G4LossTableBuilder::BuildTableForModel(G4PhysicsTable* aTable,
{
// check input
G4PhysicsTable* table = G4PhysicsTableHelper::PreparePhysicsTable(aTable);
if(!table) { return table; }
if(nullptr == table) { return table; }
if(emin >= emax) {
table->clearAndDestroy();
delete table;
@@ -401,13 +391,12 @@ G4LossTableBuilder::BuildTableForModel(G4PhysicsTable* aTable,
if(tmin >= emax) {
aVector = nullptr;
} else {
n *= (G4int)(std::log10(emax/tmin) + 0.5);
n *= G4lrint(std::log10(emax/tmin));
n = std::max(n, 3);
aVector = new G4PhysicsLogVector(tmin, emax, n);
aVector = new G4PhysicsLogVector(tmin, emax, n, spline);
}
if(aVector) {
aVector->SetSpline(spline);
if(nullptr != aVector) {
//G4cout << part->GetParticleName() << " in " << mat->GetName()
// << " tmin= " << tmin << G4endl;
for(G4int j=0; j<=n; ++j) {
@@ -746,13 +746,11 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
if (!tables_are_built[j] && part == base_part_vector[j]) {
tables_are_built[j] = true;
proc->SetDEDXTable(base_proc->IonisationTable(),fRestricted);
proc->SetDEDXTable(base_proc->DEDXTableForSubsec(),fSubRestricted);
proc->SetDEDXTable(base_proc->DEDXunRestrictedTable(),fTotal);
proc->SetCSDARangeTable(base_proc->CSDARangeTable());
proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
proc->SetInverseRangeTable(base_proc->InverseRangeTable());
proc->SetLambdaTable(base_proc->LambdaTable());
proc->SetSubLambdaTable(base_proc->SubLambdaTable());
proc->SetIonisation(base_proc->IsIonisationProcess());
if(proc->IsIonisationProcess()) {
range_vector[j] = base_proc->RangeTableForLoss();
@@ -912,15 +910,6 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
if(build_flags[i]) {
p->SetLambdaTable(p->BuildLambdaTable(fRestricted));
}
if (0 < nSubRegions) {
dedx = p->BuildDEDXTable(fSubRestricted);
p->SetDEDXTable(dedx,fSubRestricted);
listSub.push_back(dedx);
if(build_flags[i]) {
p->SetSubLambdaTable(p->BuildLambdaTable(fSubRestricted));
if(p != em) { em->AddCollaborativeProcess(p); }
}
}
if(theParameters->BuildCSDARange()) {
dedx = p->BuildDEDXTable(fTotal);
p->SetDEDXTable(dedx,fTotal);
@@ -928,16 +917,6 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
}
}
if (0 < nSubRegions) {
G4PhysicsTable* dedxSub = em->IonisationTableForSubsec();
if (1 < listSub.size()) {
em->SetDEDXTable(dedxSub, fIsSubIonisation);
dedxSub = 0;
dedxSub = G4PhysicsTableHelper::PreparePhysicsTable(dedxSub);
tableBuilder->BuildDEDXTable(dedxSub, listSub);
em->SetDEDXTable(dedxSub, fSubRestricted);
}
}
if(theParameters->BuildCSDARange()) {
G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
if (1 < n_dedx) {
@@ -110,11 +110,8 @@ void G4OpticalParameters::Initialise()
scintByParticleType = false;
scintTrackInfo = false;
scintStackPhotons = true;
scintEnhancedTimeConstants = false;
scintFiniteRiseTime = false;
scintTrackSecondariesFirst = true;
scintYieldFactor = 1.;
scintExcitationRatio = 1.;
scintVerboseLevel = 0;
wlsTimeProfileName = "delta";
@@ -188,103 +185,6 @@ void G4OpticalParameters::SetProcessActivation(const G4String& process, G4bool v
G4bool G4OpticalParameters::GetProcessActivation(const G4String& process) const
{ return processActivation.find(process)->second; }
void G4OpticalParameters::Configure(G4OpticalProcessIndex index, G4bool val)
{
// DEPRECATED. Use SetProcessActivation instead.
// Configure the physics constructor to use/not use a selected process.
// This method can only be called in PreInit> phase (before execution of
// ConstructProcess). The process is not added to particle's process manager
// and so it cannot be re-activated later in Idle> phase with the command
// /process/activate.
if(IsLocked()) { return; }
if (index == kCerenkov) processActivation["Cerenkov"] = val;
else if (index == kScintillation) processActivation["Scintillation"] = val;
else if (index == kAbsorption) processActivation["OpAbsorption"] = val;
else if (index == kRayleigh) processActivation["OpRayleigh"] = val;
else if (index == kMieHG) processActivation["OpMieHG"] = val;
else if (index == kWLS) processActivation["OpWLS"] = val;
else if (index == kWLS2) processActivation["OpWLS2"] = val;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::Configure()", "Optical010", FatalException, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method Configure(G4OpticalProcessIndex, G4bool) is deprecated "
<< "and will be removed in a future Geant4 version. Please use "
<< "SetProcessActivation(G4String, G4bool) instead.";
PrintWarning(ed2);
}
G4bool G4OpticalParameters::GetConfiguration(G4OpticalProcessIndex index)
{
// DEPRECATED. Use GetProcessActivation instead.
if (index == kCerenkov) return processActivation["Cerenkov"];
else if (index == kScintillation) return processActivation["Scintillation"];
else if (index == kAbsorption) return processActivation["OpAbsorption"];
else if (index == kRayleigh) return processActivation["OpRayleigh"];
else if (index == kMieHG) return processActivation["OpMieHG"];
else if (index == kWLS) return processActivation["OpWLS"];
else if (index == kWLS2) return processActivation["OpWLS2"];
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::GetConfiguration()", "Optical011", JustWarning, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method GetConfiguration(G4OpticalProcessIndex) is deprecated "
<< "and will be removed in a future Geant4 version. Please use "
<< "GetProcessActivation(G4String) instead.";
PrintWarning(ed2);
return true;
}
void G4OpticalParameters::SetTrackSecondariesFirst(G4OpticalProcessIndex index,
G4bool val)
{
// DEPRECATED. Use SetCerenkovTrackSecondariesFirst and
// SetScintTrackSecondariesFirst instead.
if(IsLocked()) { return; }
if (index == kCerenkov) cerenkovTrackSecondariesFirst = val;
else if (index == kScintillation) scintTrackSecondariesFirst = val;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::SetTrackSecondariesFirst()",
"Optical013", FatalException, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool) is "
<< "deprecated and will be removed in a future Geant4 version. Please use "
<< "SetCerenkovTrackSecondariesFirst(G4bool) and "
<< "SetScintTrackSecondariesFirst(G4bool) instead.";
PrintWarning(ed2);
}
G4bool G4OpticalParameters::GetTrackSecondariesFirst(G4OpticalProcessIndex index)
// DEPRECATED. Use GetCerenkovTrackSecondariesFirst and
// GetScintTrackSecondariesFirst instead.
{
if (index == kCerenkov) return cerenkovTrackSecondariesFirst;
else if (index == kScintillation) return scintTrackSecondariesFirst;
else {
G4ExceptionDescription ed;
ed << "Process index " << index << " out of bounds.";
G4Exception("G4OpticalParameters::GetTrackSecondariesFirst()",
"Optical012", JustWarning, ed);
}
G4ExceptionDescription ed2;
ed2 << "Method GetTrackSecondariesFirst(G4OpticalProcessIndex) is "
<< "deprecated and will be removed in a future Geant4 version. Please use "
<< "GetCerenkovTrackSecondariesFirst() and "
<< "GetScintTrackSecondariesFirst() instead.";
PrintWarning(ed2);
return true;
}
void G4OpticalParameters::SetCerenkovStackPhotons(G4bool val)
{
if(IsLocked()) { return; }
@@ -340,28 +240,6 @@ G4bool G4OpticalParameters::GetCerenkovTrackSecondariesFirst() const
return cerenkovTrackSecondariesFirst;
}
void G4OpticalParameters::SetScintYieldFactor(G4double val)
{
if(IsLocked()) { return; }
scintYieldFactor = val;
}
G4double G4OpticalParameters::GetScintYieldFactor() const
{
return scintYieldFactor;
}
void G4OpticalParameters::SetScintExcitationRatio(G4double val)
{
if(IsLocked()) { return; }
scintExcitationRatio = val;
}
G4double G4OpticalParameters::GetScintExcitationRatio() const
{
return scintExcitationRatio;
}
void G4OpticalParameters::SetScintByParticleType(G4bool val)
{
if(IsLocked()) { return; }
@@ -428,17 +306,6 @@ G4int G4OpticalParameters::GetScintVerboseLevel() const
return scintVerboseLevel;
}
void G4OpticalParameters::SetScintEnhancedTimeConstants(G4bool val)
{
if(IsLocked()) { return; }
scintEnhancedTimeConstants = val;
}
G4bool G4OpticalParameters::GetScintEnhancedTimeConstants() const
{
return scintEnhancedTimeConstants;
}
void G4OpticalParameters::SetWLSTimeProfile(const G4String& val)
{
if(IsLocked()) { return; }
@@ -556,13 +423,10 @@ void G4OpticalParameters::StreamInfo(std::ostream& os) const
os << " Cerenkov stack photons: " << cerenkovStackPhotons << "\n";
os << " Cerenkov track secondaries first: " << cerenkovTrackSecondariesFirst << "\n";
os << " Scintillation process active: " << GetProcessActivation("Scintillation") << "\n";
os << " Scintillation yield factor: " << scintYieldFactor << "\n";
os << " Scintillation excitation ratio: " << scintExcitationRatio << "\n";
os << " Scintillation finite rise time: " << scintFiniteRiseTime << "\n";
os << " Scintillation by particle type: " << scintByParticleType << "\n";
os << " Scintillation record track info: " << scintTrackInfo << "\n";
os << " Scintillation stack photons: " << scintStackPhotons << "\n";
os << " Scintillation use enhanced time constants: " << scintEnhancedTimeConstants << "\n";
os << " Scintillation track secondaries first: " << scintTrackSecondariesFirst << "\n";
os << " WLS process active: " << GetProcessActivation("OpWLS") << "\n";
os << " WLS time profile name: " << wlsTimeProfileName << "\n";
@@ -49,11 +49,6 @@
#include "G4UImanager.hh"
#include "G4UIparameter.hh"
// Commands with '/defaults/' are duplicates and will be removed in
// the next major release of Geant4. Use commands with no /defaults/ instead
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4OpticalParametersMessenger::G4OpticalParametersMessenger(
@@ -62,31 +57,32 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
{
G4bool toBeBroadcasted = false;
fDir = new G4UIdirectory("/process/optical/defaults/",toBeBroadcasted);
fDir->SetGuidance("DEPRECATED Commands related to the optical physics simulation engine.");
fDir2 = new G4UIdirectory("/process/optical/",toBeBroadcasted);
fDir2->SetGuidance("Commands related to the optical physics simulation engine.");
fDir = new G4UIdirectory("/process/optical/",toBeBroadcasted);
fDir->SetGuidance("Commands related to the optical physics simulation engine.");
CreateDirectory("/process/optical/defaults/cerenkov/", "DEPRECATED Cerenkov process commands");
CreateDirectory("/process/optical/defaults/scintillation/", "DEPRECATED Scintillation process commands");
CreateDirectory("/process/optical/defaults/wls/", "DEPRECATED Wave length shifting process commands");
CreateDirectory("/process/optical/defaults/boundary/", "DEPRECATED Boundary scattering commands");
CreateDirectory("/process/optical/cerenkov/", "Cerenkov process commands");
CreateDirectory("/process/optical/scintillation/", "Scintillation process commands");
CreateDirectory("/process/optical/wls/", "Wave length shifting process commands");
CreateDirectory("/process/optical/wls2/", "Second Wave length shifting process commands");
CreateDirectory("/process/optical/boundary/", "Boundary scattering commands");
CreateDirectory("/process/optical/mie/", "Mie scattering process commands");
CreateDirectory("/process/optical/absorption/", "absorption process commands");
CreateDirectory("/process/optical/rayleigh/", "Rayleigh scattering commands");
fCerenkovDir = new G4UIdirectory("/process/optical/cerenkov/", toBeBroadcasted);
fCerenkovDir->SetGuidance("Cerenkov process commands");
fScintDir = new G4UIdirectory("/process/optical/scintillation/", toBeBroadcasted);
fScintDir->SetGuidance("Scintillation process commands");
fWlsDir = new G4UIdirectory("/process/optical/wls/", toBeBroadcasted);
fWlsDir->SetGuidance("Wave length shifting process commands");
fWls2Dir = new G4UIdirectory("/process/optical/wls2/", toBeBroadcasted);
fWls2Dir->SetGuidance("Second Wave length shifting process commands");
fBoundaryDir = new G4UIdirectory("/process/optical/boundary/", toBeBroadcasted);
fBoundaryDir->SetGuidance("Boundary scattering commands");
fMieDir = new G4UIdirectory("/process/optical/mie/", toBeBroadcasted);
fMieDir->SetGuidance("Mie scattering process commands");
fAbsDir = new G4UIdirectory("/process/optical/absorption/", toBeBroadcasted);
fAbsDir->SetGuidance("absorption process commands");
fRaylDir = new G4UIdirectory("/process/optical/rayleigh/", toBeBroadcasted);
fRaylDir->SetGuidance("Rayleigh scattering commands");
// general commands
fActivateProcessCmd= new G4UIcommand("/process/optical/processActivation", this);
fActivateProcessCmd->SetGuidance("Activate/deactivate the specified optical process");
G4UIparameter* par = new G4UIparameter("proc_name",'s',false);
G4String candidates;
for ( G4int i=0; i<kNoProcess; i++ ) {
for ( G4int i=0; i<kNoProcess; ++i ) {
candidates += G4OpticalProcessName(i);
candidates += G4String(" ");
}
@@ -99,19 +95,6 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fActivateProcessCmd->SetParameter(par);
fActivateProcessCmd->AvailableForStates(G4State_PreInit);
// DEPRECATED
fTrackSecondariesFirstCmd = new G4UIcommand("/process/optical/setTrackSecondariesFirst", this);
fTrackSecondariesFirstCmd->SetGuidance("Activate/deactivate tracking of secondaries before finishing their parent track");
fTrackSecondariesFirstCmd->SetGuidance("DEPRECATED: Use /process/optical/cerenkov/setTrackSecondariesFirst and");
fTrackSecondariesFirstCmd->SetGuidance("/process/optical/scintillation/setTrackSecondariesFirst and instead.");
par = new G4UIparameter("proc_name",'s',false);
par->SetParameterCandidates("Cerenkov Scintillation");
fTrackSecondariesFirstCmd->SetParameter(par);
par = new G4UIparameter("flag",'b',false);
par->SetDefaultValue(true);
fTrackSecondariesFirstCmd->SetParameter(par);
fTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fVerboseCmd = new G4UIcmdWithAnInteger("/process/optical/verbose", this);
fVerboseCmd->SetGuidance("Set default verbose level for optical processes");
fVerboseCmd->SetParameterName("ver", true);
@@ -123,39 +106,18 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fDumpCmd->SetGuidance("Print all optical parameters.");
// Cerenkov ////////////////////
fCerenkovMaxPhotons1Cmd = new G4UIcmdWithAnInteger("/process/optical/defaults/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotons1Cmd->SetGuidance("Set maximum number of photons per step");
fCerenkovMaxPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxPhotons instead.");
fCerenkovMaxPhotons1Cmd->SetParameterName("CerenkovMaxPhotons", false);
fCerenkovMaxPhotons1Cmd->SetRange("CerenkovMaxPhotons>=0");
fCerenkovMaxPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxPhotonsCmd = new G4UIcmdWithAnInteger("/process/optical/cerenkov/setMaxPhotons", this);
fCerenkovMaxPhotonsCmd->SetGuidance("Set maximum number of photons per step");
fCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
fCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
fCerenkovMaxPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxBetaChange1Cmd = new G4UIcmdWithADouble("/process/optical/defaults/cerenkov/setMaxBetaChange", this);
fCerenkovMaxBetaChange1Cmd->SetGuidance("Set maximum change of beta of parent particle per step");
fCerenkovMaxBetaChange1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setMaxBetaChange instead.");
fCerenkovMaxBetaChange1Cmd->SetParameterName("CerenkovMaxBetaChange", false);
fCerenkovMaxBetaChange1Cmd->SetRange("CerenkovMaxBetaChange>=0");
fCerenkovMaxBetaChange1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovMaxBetaChangeCmd = new G4UIcmdWithADouble("/process/optical/cerenkov/setMaxBetaChange", this);
fCerenkovMaxBetaChangeCmd->SetGuidance("Set maximum change of beta of parent particle per step");
fCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
fCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
fCerenkovMaxBetaChangeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovStackPhotons1Cmd = new G4UIcmdWithABool("/process/optical/defaults/cerenkov/setStackPhotons", this);
fCerenkovStackPhotons1Cmd->SetGuidance("Set whether or not to stack secondary Cerenkov photons");
fCerenkovStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/cerenkov/setStackPhotons instead.");
fCerenkovStackPhotons1Cmd->SetParameterName("CerenkovStackPhotons", true);
fCerenkovStackPhotons1Cmd->SetDefaultValue(true);
fCerenkovStackPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fCerenkovStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/cerenkov/setStackPhotons", this);
fCerenkovStackPhotonsCmd->SetGuidance("Set whether or not to stack secondary Cerenkov photons");
fCerenkovStackPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
@@ -172,74 +134,23 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fCerenkovVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// Scintillation //////////////////////////
fScintYieldFactor1Cmd = new G4UIcmdWithADouble("/process/optical/defaults/scintillation/setYieldFactor", this);
fScintYieldFactor1Cmd->SetGuidance("Set scintillation yield factor");
fScintYieldFactor1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setYieldFactorinstead.");
fScintYieldFactor1Cmd->SetParameterName("ScintillationYieldFactor", false);
fScintYieldFactor1Cmd->SetRange("ScintillationYieldFactor>=0");
fScintYieldFactor1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintYieldFactorCmd = new G4UIcmdWithADouble("/process/optical/scintillation/setYieldFactor", this);
fScintYieldFactorCmd->SetGuidance("Set scintillation yield factor");
fScintYieldFactorCmd->SetParameterName("ScintillationYieldFactor", false);
fScintYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
fScintYieldFactorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintExcitationRatioCmd = new G4UIcmdWithADouble("/process/optical/scintillation/setExcitationRatio", this);
fScintExcitationRatioCmd->SetGuidance("Set scintillation excitation ratio");
fScintExcitationRatioCmd->SetParameterName("ExcitationRatio", false);
fScintExcitationRatioCmd->SetRange("ExcitationRatio >= 0 && ExcitationRatio <=1");
fScintExcitationRatioCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintByParticleType1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setByParticleType", this);
fScintByParticleType1Cmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
fScintByParticleType1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setByParticleType instead.");
fScintByParticleType1Cmd->SetParameterName("ScintillationByParticleTypeActivation", false);
fScintByParticleType1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintByParticleTypeCmd = new G4UIcmdWithABool("/process/optical/scintillation/setByParticleType", this);
fScintByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
fScintByParticleTypeCmd->SetParameterName("ScintillationByParticleTypeActivation", false);
fScintByParticleTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintEnhancedTimeConstantsCmd = new G4UIcmdWithABool("/process/optical/scintillation/setEnhancedTimeConstants", this);
fScintEnhancedTimeConstantsCmd->SetGuidance("Activate/Inactivate enhanced time constants for scintillation.");
fScintEnhancedTimeConstantsCmd->SetGuidance("This will be the default in the next major release.");
fScintEnhancedTimeConstantsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintTrackInfo1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setTrackInfo", this);
fScintTrackInfo1Cmd->SetGuidance("Activate/Inactivate scintillation TrackInformation");
fScintTrackInfo1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setTrackInfo instead.");
fScintTrackInfo1Cmd->SetParameterName("ScintillationTrackInfo", false);
fScintTrackInfo1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintTrackInfoCmd = new G4UIcmdWithABool("/process/optical/scintillation/setTrackInfo", this);
fScintTrackInfoCmd->SetGuidance("Activate/Inactivate scintillation TrackInformation");
fScintTrackInfoCmd->SetParameterName("ScintillationTrackInfo", false);
fScintTrackInfoCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintFiniteRiseTime1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setFiniteRiseTime", this);
fScintFiniteRiseTime1Cmd->SetGuidance("Set option of a finite rise-time for G4Scintillation");
fScintFiniteRiseTime1Cmd->SetGuidance("If set, the G4Scintillation process expects the user to have set the");
fScintFiniteRiseTime1Cmd->SetGuidance("constant material property FAST/SLOWSCINTILLATIONRISETIME");
fScintFiniteRiseTime1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setFiniteRiseTime instead.");
fScintFiniteRiseTime1Cmd->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTime1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintFiniteRiseTimeCmd = new G4UIcmdWithABool("/process/optical/scintillation/setFiniteRiseTime", this);
fScintFiniteRiseTimeCmd->SetGuidance("Set option of a finite rise-time for G4Scintillation");
fScintFiniteRiseTimeCmd->SetGuidance("If set, the G4Scintillation process expects the user to have set the");
fScintFiniteRiseTimeCmd->SetGuidance("constant material property FAST/SLOWSCINTILLATIONRISETIME");
fScintFiniteRiseTimeCmd->SetGuidance("constant material property SCINTILLATIONRISETIME{1,2,3}");
fScintFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
fScintFiniteRiseTimeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintStackPhotons1Cmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setStackPhotons", this);
fScintStackPhotons1Cmd->SetGuidance("Set whether or not to stack secondary Scintillation photons");
fScintStackPhotons1Cmd->SetGuidance("DEPRECATED: use /process/optical/scintillation/setStackPhotons instead.");
fScintStackPhotons1Cmd->SetParameterName("ScintillationStackPhotons", true);
fScintStackPhotons1Cmd->SetDefaultValue(true);
fScintStackPhotons1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fScintStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/scintillation/setStackPhotons", this);
fScintStackPhotonsCmd->SetGuidance("Set whether or not to stack secondary Scintillation photons");
fScintStackPhotonsCmd->SetParameterName("ScintillationStackPhotons", true);
@@ -257,13 +168,6 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fScintVerboseLevelCmd->AvailableForStates(G4State_Idle, G4State_PreInit);
// WLS //////////////////////////////////
fWLSTimeProfile1Cmd = new G4UIcmdWithAString("/process/optical/defaults/wls/setTimeProfile", this);
fWLSTimeProfile1Cmd->SetGuidance("Set the WLS time profile (delta or exponential)");
fWLSTimeProfile1Cmd->SetGuidance("DEPRECATED: use /process/optical/wls/setTimeProfile instead.");
fWLSTimeProfile1Cmd->SetParameterName("WLSTimeProfile", false);
fWLSTimeProfile1Cmd->SetCandidates("delta exponential");
fWLSTimeProfile1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fWLSTimeProfileCmd = new G4UIcmdWithAString("/process/optical/wls/setTimeProfile", this);
fWLSTimeProfileCmd->SetGuidance("Set the WLS time profile (delta or exponential)");
fWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
@@ -292,12 +196,6 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fWLS2VerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// boundary //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fBoundaryInvokeSD1Cmd->SetGuidance("Set option for calling InvokeSD in G4OpBoundaryProcess");
fBoundaryInvokeSD1Cmd->SetGuidance("DEPRECATED: use /process/optical/boundary/setInvokeSD instead.");
fBoundaryInvokeSD1Cmd->SetParameterName("InvokeSD", false);
fBoundaryInvokeSD1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fBoundaryInvokeSDCmd = new G4UIcmdWithABool("/process/optical/boundary/setInvokeSD", this);
fBoundaryInvokeSDCmd->SetGuidance("Set option for calling InvokeSD in G4OpBoundaryProcess");
fBoundaryInvokeSDCmd->SetParameterName("InvokeSD", false);
@@ -311,7 +209,6 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fBoundaryVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// absorption //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fAbsorptionVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/absorption/verbose", this);
fAbsorptionVerboseLevelCmd->SetGuidance("Verbose level for absorption process.");
fAbsorptionVerboseLevelCmd->SetParameterName("verbose", true);
@@ -320,7 +217,6 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
fAbsorptionVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
// rayleigh //////////////////////////////////////
fBoundaryInvokeSD1Cmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
fRayleighVerboseLevelCmd = new G4UIcmdWithAnInteger("/process/optical/rayleigh/verbose", this);
fRayleighVerboseLevelCmd->SetGuidance("Verbose level for Rayleigh process.");
fRayleighVerboseLevelCmd->SetParameterName("verbose", true);
@@ -340,34 +236,28 @@ G4OpticalParametersMessenger::G4OpticalParametersMessenger(
G4OpticalParametersMessenger::~G4OpticalParametersMessenger()
{
delete fDir;
delete fDir2;
delete fCerenkovDir;
delete fScintDir;
delete fWlsDir;
delete fBoundaryDir;
delete fMieDir;
delete fAbsDir;
delete fRaylDir;
delete fActivateProcessCmd;
delete fVerboseCmd;
delete fDumpCmd;
delete fCerenkovMaxPhotonsCmd;
delete fCerenkovMaxPhotons1Cmd;
delete fCerenkovMaxBetaChangeCmd;
delete fCerenkovMaxBetaChange1Cmd;
delete fCerenkovStackPhotonsCmd;
delete fCerenkovStackPhotons1Cmd;
delete fCerenkovTrackSecondariesFirstCmd;
delete fCerenkovVerboseLevelCmd;
delete fScintYieldFactorCmd;
delete fScintYieldFactor1Cmd;
delete fScintByParticleTypeCmd;
delete fScintByParticleType1Cmd;
delete fScintEnhancedTimeConstantsCmd;
delete fScintTrackInfoCmd;
delete fScintTrackInfo1Cmd;
delete fScintStackPhotonsCmd;
delete fScintStackPhotons1Cmd;
delete fScintExcitationRatioCmd;
delete fScintVerboseLevelCmd;
delete fScintFiniteRiseTimeCmd;
delete fScintFiniteRiseTime1Cmd;
delete fScintTrackSecondariesFirstCmd;
delete fWLSTimeProfileCmd;
delete fWLSTimeProfile1Cmd;
delete fWLSVerboseLevelCmd;
delete fWLS2TimeProfileCmd;
delete fWLS2VerboseLevelCmd;
@@ -375,9 +265,7 @@ G4OpticalParametersMessenger::~G4OpticalParametersMessenger()
delete fRayleighVerboseLevelCmd;
delete fMieVerboseLevelCmd;
delete fBoundaryVerboseLevelCmd;
delete fTrackSecondariesFirstCmd;
delete fBoundaryInvokeSDCmd;
delete fBoundaryInvokeSD1Cmd;
}
void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
@@ -395,51 +283,21 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
G4bool value = G4UIcommand::ConvertToBool(flag);
params->SetProcessActivation(pn, value);
}
else if (command == fTrackSecondariesFirstCmd) {
std::istringstream is(newValue.data());
G4String pn;
G4String flag;
is >> pn >> flag;
G4bool value = G4UIcommand::ConvertToBool(flag);
if (pn == "Cerenkov") params->SetCerenkovStackPhotons(value);
else if (pn == "Scintillation") params->SetScintStackPhotons(value);
else {
G4ExceptionDescription msg;
msg << "Process name not allowed: "<<pn<<" (UI: "<<newValue<<")";
G4Exception("G4OpticalParametersMessenger::SetNewValue(...)","Optical001",
FatalException,msg);
}
}
else if (command == fVerboseCmd) {
params->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
}
else if (command == fDumpCmd) {
params->Dump();
}
else if (command == fCerenkovMaxPhotons1Cmd) {
params->SetCerenkovMaxPhotonsPerStep(
fCerenkovMaxPhotons1Cmd->GetNewIntValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxPhotonsCmd) {
params->SetCerenkovMaxPhotonsPerStep(
fCerenkovMaxPhotonsCmd->GetNewIntValue(newValue));
G4cout << "Cerenkov max photons: " << params->GetCerenkovMaxPhotonsPerStep() << G4endl;
}
else if (command == fCerenkovMaxBetaChange1Cmd) {
params->SetCerenkovMaxBetaChange(
fCerenkovMaxBetaChange1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fCerenkovMaxBetaChangeCmd) {
params->SetCerenkovMaxBetaChange(
fCerenkovMaxBetaChangeCmd->GetNewDoubleValue(newValue));
}
else if (command == fCerenkovStackPhotons1Cmd) {
params->SetCerenkovStackPhotons(
fCerenkovStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fCerenkovStackPhotonsCmd) {
params->SetCerenkovStackPhotons(
fCerenkovStackPhotonsCmd->GetNewBoolValue(newValue));
@@ -452,59 +310,22 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
params->SetCerenkovVerboseLevel(
fCerenkovVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fScintYieldFactor1Cmd) {
params->SetScintYieldFactor(
fScintYieldFactor1Cmd->GetNewDoubleValue(newValue));
Deprecated();
}
else if (command == fScintYieldFactorCmd) {
params->SetScintYieldFactor(
fScintYieldFactorCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintByParticleType1Cmd) {
params->SetScintByParticleType(
fScintByParticleType1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintByParticleTypeCmd) {
params->SetScintByParticleType(
fScintByParticleTypeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintEnhancedTimeConstantsCmd) {
params->SetScintEnhancedTimeConstants(
fScintEnhancedTimeConstantsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintTrackInfo1Cmd) {
params->SetScintTrackInfo(
fScintTrackInfo1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintTrackInfoCmd) {
params->SetScintTrackInfo(
fScintTrackInfoCmd->GetNewBoolValue(newValue));
}
else if (command == fScintFiniteRiseTime1Cmd) {
params->SetScintFiniteRiseTime(
fScintFiniteRiseTime1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintFiniteRiseTimeCmd) {
params->SetScintFiniteRiseTime(
fScintFiniteRiseTimeCmd->GetNewBoolValue(newValue));
}
else if (command == fScintStackPhotons1Cmd) {
params->SetScintStackPhotons(
fScintStackPhotons1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fScintStackPhotonsCmd) {
params->SetScintStackPhotons(
fScintStackPhotonsCmd->GetNewBoolValue(newValue));
}
else if (command == fScintExcitationRatioCmd) {
params->SetScintExcitationRatio(
fScintExcitationRatioCmd->GetNewDoubleValue(newValue));
}
else if (command == fScintTrackSecondariesFirstCmd) {
params->SetScintTrackSecondariesFirst(
fScintTrackSecondariesFirstCmd->GetNewBoolValue(newValue));
@@ -513,10 +334,6 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
params->SetScintVerboseLevel(
fScintVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fWLSTimeProfile1Cmd) {
params->SetWLSTimeProfile(newValue);
Deprecated();
}
else if (command == fWLSTimeProfileCmd) {
params->SetWLSTimeProfile(newValue);
}
@@ -541,10 +358,6 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
else if (command == fBoundaryVerboseLevelCmd) {
params->SetBoundaryVerboseLevel(fBoundaryVerboseLevelCmd->GetNewIntValue(newValue));
}
else if (command == fBoundaryInvokeSD1Cmd) {
params->SetBoundaryInvokeSD(fBoundaryInvokeSD1Cmd->GetNewBoolValue(newValue));
Deprecated();
}
else if (command == fBoundaryInvokeSDCmd) {
params->SetBoundaryInvokeSD(fBoundaryInvokeSDCmd->GetNewBoolValue(newValue));
}
@@ -552,11 +365,3 @@ void G4OpticalParametersMessenger::SetNewValue(G4UIcommand* command,
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
}
void G4OpticalParametersMessenger::Deprecated()
{
G4ExceptionDescription ed;
ed <<" This command has been deprecated and will be removed in the next" << G4endl
<< "major release. Use the same command without /defaults/ instead.";
G4Exception("G4OpticalParametersMessenger", "optical001", JustWarning, ed);
}
@@ -46,6 +46,7 @@
#include "G4VAtomDeexcitation.hh"
#include "G4SystemOfUnits.hh"
#include "G4EmParameters.hh"
#include "G4ParticleDefinition.hh"
#include "G4DynamicParticle.hh"
#include "G4Step.hh"
@@ -60,6 +61,7 @@
#include "G4VParticleChange.hh"
#include "G4PhysicsModelCatalog.hh"
#include "G4Gamma.hh"
#include "G4Log.hh"
#ifdef G4MULTITHREADED
G4Mutex G4VAtomDeexcitation::atomDeexcitationMutex = G4MUTEX_INITIALIZER;
@@ -71,12 +73,8 @@ G4int G4VAtomDeexcitation::pixeIDg = -1;
G4int G4VAtomDeexcitation::pixeIDe = -1;
G4VAtomDeexcitation::G4VAtomDeexcitation(const G4String& modname)
: verbose(1), name(modname), isActive(false), flagAuger(false),
flagAugerCascade(false), flagPIXE(false), ignoreCuts(false),
isActiveLocked(false), isAugerLocked(false),
isAugerCascadeLocked(false), isPIXELocked(false)
: name(modname)
{
theParameters = G4EmParameters::Instance();
vdyn.reserve(5);
theCoupleTable = nullptr;
G4String gg = "gammaPIXE";
@@ -105,14 +103,15 @@ G4VAtomDeexcitation::~G4VAtomDeexcitation()
void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
{
G4EmParameters* theParameters = G4EmParameters::Instance();
theParameters->DefineRegParamForDeex(this);
// Define list of couples
theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
nCouples = theCoupleTable->GetTableSize();
// needed for unit tests
size_t nn = std::max(numOfCouples, 1);
size_t nn = std::max(nCouples, 1);
if(activeDeexcitationMedia.size() != nn) {
activeDeexcitationMedia.resize(nn, false);
activeAugerMedia.resize(nn, false);
@@ -124,7 +123,6 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
// normally there is no locksed flags
if(!isActiveLocked) { isActive = theParameters->Fluo(); }
if(!isAugerLocked) { flagAuger = theParameters->Auger(); }
if(!isAugerCascadeLocked) { flagAugerCascade = theParameters->AugerCascade(); }
if(!isPIXELocked) { flagPIXE = theParameters->Pixe(); }
ignoreCuts = theParameters->DeexcitationIgnoreCut();
@@ -148,17 +146,17 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
}
// Identify active media
G4RegionStore* regionStore = G4RegionStore::GetInstance();
const G4RegionStore* regionStore = G4RegionStore::GetInstance();
for(size_t j=0; j<nRegions; ++j) {
const G4Region* reg = regionStore->GetRegion(activeRegions[j], false);
if(reg && 0 < numOfCouples) {
if(nullptr != reg && 0 < nCouples) {
const G4ProductionCuts* rpcuts = reg->GetProductionCuts();
if(0 < verbose) {
G4cout << " " << activeRegions[j]
<< " " << deRegions[j] << " " << AugerRegions[j]
<< " " << PIXERegions[j] << G4endl;
}
for(G4int i=0; i<numOfCouples; ++i) {
for(G4int i=0; i<nCouples; ++i) {
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
if (couple->GetProductionCuts() == rpcuts) {
@@ -183,7 +181,7 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
InitialiseForNewRun();
if(0 < verbose && flagAuger) {
G4cout << "### === Auger cascade flag: " << flagAugerCascade
G4cout << "### === Auger flag: " << flagAuger
<< G4endl;
}
if(0 < verbose) {
@@ -258,7 +256,7 @@ void G4VAtomDeexcitation::GenerateParticles(std::vector<G4DynamicParticle*>* v,
G4double gCut = DBL_MAX;
if(ignoreCuts) {
gCut = 0.0;
} else if (theCoupleTable) {
} else if (nullptr != theCoupleTable) {
gCut = (*(theCoupleTable->GetEnergyCutsVector(0)))[idx];
}
if(gCut < as->BindingEnergy()) {
@@ -266,7 +264,7 @@ void G4VAtomDeexcitation::GenerateParticles(std::vector<G4DynamicParticle*>* v,
if(CheckAugerActiveRegion(idx)) {
if(ignoreCuts) {
eCut = 0.0;
} else if (theCoupleTable) {
} else if (nullptr != theCoupleTable) {
eCut = (*(theCoupleTable->GetEnergyCutsVector(1)))[idx];
}
}
@@ -288,10 +286,10 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
// step parameters
const G4StepPoint* preStep = step.GetPreStepPoint();
G4ThreeVector prePos = preStep->GetPosition();
G4ThreeVector delta = step.GetPostStepPoint()->GetPosition() - prePos;
G4double preTime = preStep->GetGlobalTime();
G4double dt = step.GetPostStepPoint()->GetGlobalTime() - preTime;
const G4ThreeVector prePos = preStep->GetPosition();
const G4ThreeVector delta = step.GetPostStepPoint()->GetPosition() - prePos;
const G4double preTime = preStep->GetGlobalTime();
const G4double dt = step.GetPostStepPoint()->GetGlobalTime() - preTime;
// particle parameters
const G4Track* track = step.GetTrack();
@@ -314,7 +312,7 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
G4int nelm = material->GetNumberOfElements();
const G4int nelm = material->GetNumberOfElements();
// loop over deexcitations
for(G4int i=0; i<nelm; ++i) {
@@ -327,7 +325,7 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
for(G4int ii=0; ii<nshells; ++ii) {
G4AtomicShellEnumerator as = G4AtomicShellEnumerator(ii);
const G4AtomicShell* shell = GetAtomicShell(Z, as);
G4double bindingEnergy = shell->BindingEnergy();
const G4double bindingEnergy = shell->BindingEnergy();
if(gCut > bindingEnergy) { break; }
@@ -342,7 +340,7 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
//G4cout << " Shell " << ii << " mfp(mm)= " << mfp/mm << G4endl;
// sample ionisation points
do {
stot -= mfp*std::log(G4UniformRand());
stot -= mfp*G4Log(G4UniformRand());
if( stot > 1.0 || eLossMax < bindingEnergy) { break; }
// sample deexcitation
vdyn.clear();
@@ -88,3 +88,8 @@ void G4VEmAngularDistribution::SamplePairDirections(const G4DynamicParticle* dp,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmAngularDistribution::PrintGeneratorInformation() const
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -54,6 +54,7 @@
#include "G4ProductionCutsTable.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4EmParameters.hh"
#include "G4SystemOfUnits.hh"
#include "G4Log.hh"
#include "Randomize.hh"
@@ -63,27 +64,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEmModel::G4VEmModel(const G4String& nam):
flucModel(nullptr),anglModel(nullptr), name(nam), lowLimit(0.1*CLHEP::keV),
highLimit(100.0*CLHEP::TeV),eMinActive(0.0),eMaxActive(DBL_MAX),
polarAngleLimit(CLHEP::pi),secondaryThreshold(DBL_MAX),
theLPMflag(false),flagDeexcitation(false),flagForceBuildTable(false),
isMaster(true),fElementData(nullptr),pParticleChange(nullptr),
xSectionTable(nullptr),pBaseMaterial(nullptr),idxTable(0),
lossFlucFlag(true),inveplus(1.0/CLHEP::eplus),pFactor(1.0),
fCurrentCouple(nullptr),fCurrentElement(nullptr),fCurrentIsotope(nullptr),
fTripletModel(nullptr),nsec(5)
inveplus(1.0/CLHEP::eplus),
lowLimit(0.1*CLHEP::keV),
highLimit(100.0*CLHEP::TeV),
polarAngleLimit(CLHEP::pi),
name(nam)
{
xsec.resize(nsec);
nSelectors = 0;
elmSelectors = nullptr;
localElmSelectors = true;
localTable = true;
useAngularGenerator = false;
useBaseMaterials = true;
isLocked = false;
fEmManager = G4LossTableManager::Instance();
fEmManager->Register(this);
G4LossTableBuilder* bld = fEmManager->GetTableBuilder();
theDensityFactor = bld->GetDensityFactors();
theDensityIdx = bld->GetCoupleIndexes();
@@ -180,30 +170,24 @@ void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* part,
// initialise vector
for(G4int i=0; i<numOfCouples; ++i) {
// no need in element selectors for infionite cuts
// no need in element selectors for infinite cuts
if(cuts[i] == DBL_MAX) { continue; }
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
auto material = couple->GetMaterial();
SetCurrentCouple(couple);
// selector already exist check if should be deleted
G4bool create = true;
if((*elmSelectors)[i]) {
if(material == ((*elmSelectors)[i])->GetMaterial()) { create = false; }
else { delete (*elmSelectors)[i]; }
}
if(create) {
G4double emin = std::max(lowLimit,
MinPrimaryEnergy(material, part, cuts[i]));
G4double emax = std::max(highLimit, 10*emin);
static const G4double invlog106 = 1.0/(6*G4Log(10.));
G4int nbins = (G4int)(nbinsPerDec*G4Log(emax/emin)*invlog106);
nbins = std::max(nbins, 3);
// selector already exist then delete
delete (*elmSelectors)[i];
(*elmSelectors)[i] = new G4EmElementSelector(this,material,nbins,
emin,emax,spline);
}
G4double emin = std::max(lowLimit, MinPrimaryEnergy(material, part, cuts[i]));
G4double emax = std::max(highLimit, 10*emin);
static const G4double invlog106 = 1.0/(6*G4Log(10.));
G4int nbins = (G4int)(nbinsPerDec*G4Log(emax/emin)*invlog106);
nbins = std::max(nbins, 3);
(*elmSelectors)[i] = new G4EmElementSelector(this,material,nbins,
emin,emax,spline);
((*elmSelectors)[i])->Initialise(part, cuts[i]);
/*
G4cout << "G4VEmModel::InitialiseElmSelectors i= " << i
@@ -217,8 +201,7 @@ void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4VEmModel::InitialiseLocal(const G4ParticleDefinition*,
G4VEmModel*)
void G4VEmModel::InitialiseLocal(const G4ParticleDefinition*, G4VEmModel*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -251,24 +234,23 @@ G4double G4VEmModel::ComputeDEDXPerVolume(const G4Material*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
G4double G4VEmModel::CrossSectionPerVolume(const G4Material* mat,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
{
SetupForMaterial(p, material, ekin);
G4double cross = 0.0;
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
G4int nelm = material->GetNumberOfElements();
SetupForMaterial(p, mat, ekin);
const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
G4int nelm = mat->GetNumberOfElements();
if(nelm > nsec) {
xsec.resize(nelm);
nsec = nelm;
}
G4double cross = 0.0;
for (G4int i=0; i<nelm; ++i) {
cross += theAtomNumDensityVector[i]*
ComputeCrossSectionPerAtom(p,material->GetElement(i),ekin,emin,emax);
ComputeCrossSectionPerAtom(p,mat->GetElement(i),ekin,emin,emax);
xsec[i] = cross;
}
return cross;
@@ -290,20 +272,20 @@ void G4VEmModel::StartTracking(G4Track*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material,
const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* mat,
const G4ParticleDefinition* pd,
G4double kinEnergy,
G4double tcut,
G4double tmax)
{
size_t n = material->GetNumberOfElements();
fCurrentElement = material->GetElement(0);
size_t n = mat->GetNumberOfElements();
fCurrentElement = mat->GetElement(0);
if (n > 1) {
G4double x = G4UniformRand()*
G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
const G4double x = G4UniformRand()*
G4VEmModel::CrossSectionPerVolume(mat,pd,kinEnergy,tcut,tmax);
for(size_t i=0; i<n; ++i) {
if (x <= xsec[i]) {
fCurrentElement = material->GetElement(i);
fCurrentElement = mat->GetElement(i);
break;
}
}
@@ -316,7 +298,7 @@ G4int G4VEmModel::SelectRandomAtomNumber(const G4Material* mat)
{
// this algorith assumes that cross section is proportional to
// number electrons multiplied by number of atoms
size_t nn = mat->GetNumberOfElements();
const size_t nn = mat->GetNumberOfElements();
fCurrentElement = mat->GetElement(0);
if(1 < nn) {
const G4double* at = mat->GetVecNbOfAtomsPerVolume();
@@ -337,7 +319,7 @@ G4int G4VEmModel::SelectRandomAtomNumber(const G4Material* mat)
G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm)
{
SetCurrentElement(elm);
size_t ni = elm->GetNumberOfIsotopes();
const size_t ni = elm->GetNumberOfIsotopes();
fCurrentIsotope = elm->GetIsotope(0);
size_t idx = 0;
if(ni > 1) {
@@ -391,7 +373,7 @@ G4double G4VEmModel::ChargeSquareRatio(const G4Track& track)
G4double G4VEmModel::GetChargeSquareRatio(const G4ParticleDefinition* p,
const G4Material*, G4double)
{
G4double q = p->GetPDGCharge()*inveplus;
const G4double q = p->GetPDGCharge()*inveplus;
return q*q;
}
@@ -407,7 +389,7 @@ G4double G4VEmModel::GetParticleCharge(const G4ParticleDefinition* p,
void G4VEmModel::CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double&,G4double&,G4double)
const G4double&,G4double&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -455,7 +437,7 @@ void G4VEmModel::SetupForMaterial(const G4ParticleDefinition*,
void
G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f)
{
if(p != nullptr && pParticleChange != p) { pParticleChange = p; }
if(p != nullptr && pParticleChange != p) { pParticleChange = p; }
if(flucModel != f) { flucModel = f; }
}
@@ -72,74 +72,34 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
G4VDiscreteProcess(name, type),
secondaryParticle(nullptr),
buildLambdaTable(true),
numberOfModels(0),
theLambdaTable(nullptr),
theLambdaTablePrim(nullptr),
integral(false),
applyCuts(false),
startFromNull(false),
splineFlag(true),
isIon(false),
currentCouple(nullptr),
isTheMaster(true),
masterProc(nullptr),
theData(nullptr),
currentModel(nullptr),
particle(nullptr),
currentParticle(nullptr)
G4VDiscreteProcess(name, type)
{
theParameters = G4EmParameters::Instance();
SetVerboseLevel(1);
// Size of tables assuming spline
// Size of tables
minKinEnergy = 0.1*keV;
maxKinEnergy = 100.0*TeV;
nLambdaBins = 84;
minKinEnergyPrim = DBL_MAX;
actBinning = actSpline = actMinKinEnergy = actMaxKinEnergy = false;
// default lambda factor
lambdaFactor = 0.8;
logLambdaFactor = G4Log(lambdaFactor);
// default limit on polar angle
biasFactor = fFactor = 1.0;
// particle types
theGamma = G4Gamma::Gamma();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
theCuts = theCutsGamma = theCutsElectron = theCutsPositron = nullptr;
pParticleChange = &fParticleChange;
fParticleChange.SetSecondaryWeightByProcess(true);
secParticles.reserve(5);
baseMaterial = currentMaterial = nullptr;
preStepLambda = preStepKinEnergy = 0.0;
preStepLogKinEnergy = LOG_EKIN_MIN;
mfpKinEnergy = DBL_MAX;
massRatio = 1.0;
currentCoupleIndex = basedCoupleIndex = 0;
modelManager = new G4EmModelManager();
biasManager = nullptr;
biasFlag = false;
weightFlag = false;
lManager = G4LossTableManager::Instance();
lManager->Register(this);
G4LossTableBuilder* bld = lManager->GetTableBuilder();
theDensityFactor = bld->GetDensityFactors();
theDensityIdx = bld->GetCoupleIndexes();
secID = fluoID = augerID = biasID = -1;
mainSecondaries = 100;
if("phot" == GetProcessName() || "compt" == GetProcessName()
|| "e-_G4DNAIonisation" == GetProcessName()
|| "hydrogen_G4DNAIonisation" == GetProcessName()
@@ -165,7 +125,7 @@ G4VEmProcess::~G4VEmProcess()
*/
if(isTheMaster) {
delete theData;
theData = nullptr;
delete theEnergyOfCrossSectionMax;
}
delete modelManager;
delete biasManager;
@@ -190,63 +150,24 @@ G4double G4VEmProcess::MinPrimaryEnergy(const G4ParticleDefinition*,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* ptr,
const G4Region* region)
{
if(nullptr == ptr) { return; }
G4VEmFluctuationModel* fm = nullptr;
modelManager->AddEmModel(order, p, fm, region);
if(p) { p->SetParticleChange(pParticleChange); }
modelManager->AddEmModel(order, ptr, fm, region);
ptr->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::SetEmModel(G4VEmModel* ptr, G4int)
{
for(auto & em : emModels) { if(em == ptr) { return; } }
emModels.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4VEmProcess::EmModel(size_t index) const
{
return (index < emModels.size()) ? emModels[index] : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VEmProcess::GetNumberOfModels() const
{
return modelManager->NumberOfModels();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VEmProcess::GetNumberOfRegionModels(size_t couple_index) const
{
return modelManager->NumberOfRegionModels(couple_index);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4VEmProcess::GetRegionModel(G4int idx, size_t couple_index) const
{
return modelManager->GetRegionModel(idx, couple_index);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
{
return modelManager->GetModel(idx, ver);
if(nullptr == ptr) { return; }
if(!emModels.empty()) {
for(auto & em : emModels) { if(em == ptr) { return; } }
}
emModels.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -254,8 +175,7 @@ G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx, G4bool ver) const
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
isTheMaster = lManager->IsMaster();
if(!particle) { SetParticle(&part); }
if(nullptr == particle) { SetParticle(&part); }
if(part.GetParticleType() == "nucleus" &&
part.GetParticleSubType() == "generic") {
@@ -281,28 +201,29 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
if(particle != &part) { return; }
G4LossTableBuilder* bld = lManager->GetTableBuilder();
lManager->PreparePhysicsTable(&part, this, isTheMaster);
Clear();
InitialiseProcess(particle);
G4LossTableBuilder* bld = lManager->GetTableBuilder();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t n = theCoupleTable->GetTableSize();
theEnergyOfCrossSectionMax.resize(n, 0.0);
theCrossSectionMax.resize(n, DBL_MAX);
// initialisation of the process
if(!actMinKinEnergy) { minKinEnergy = theParameters->MinKinEnergy(); }
if(!actMaxKinEnergy) { maxKinEnergy = theParameters->MaxKinEnergy(); }
if(!actSpline) { splineFlag = theParameters->Spline(); }
if(isTheMaster) {
SetVerboseLevel(theParameters->Verbose());
if(!theData) { theData = new G4EmDataHandler(2); }
if(nullptr == theData) { theData = new G4EmDataHandler(2); }
if(fEmOnePeak == fXSType) {
if(nullptr == theEnergyOfCrossSectionMax) {
theEnergyOfCrossSectionMax = new std::vector<G4double>;
}
size_t n = theCoupleTable->GetTableSize();
theEnergyOfCrossSectionMax->resize(n, DBL_MAX);
}
} else {
SetVerboseLevel(theParameters->WorkerVerbose());
}
@@ -315,17 +236,22 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
numberOfModels = modelManager->NumberOfModels();
for(G4int i=0; i<numberOfModels; ++i) {
G4VEmModel* mod = modelManager->GetModel(i);
if(0 == i) { currentModel = mod; }
if(nullptr == mod) { continue; }
if(nullptr == currentModel) { currentModel = mod; }
mod->SetPolarAngleLimit(theParameters->MscThetaLimit());
mod->SetMasterThread(isTheMaster);
if(mod->HighEnergyLimit() > maxKinEnergy) {
mod->SetHighEnergyLimit(maxKinEnergy);
}
SetEmModel(mod);
}
if(lManager->AtomDeexcitation()) { modelManager->SetFluoFlag(true); }
theCuts = modelManager->Initialise(particle,secondaryParticle,
2.,verboseLevel);
if(nullptr != lManager->AtomDeexcitation()) {
modelManager->SetFluoFlag(true);
}
fLambdaEnergy = 0.0;
theCuts = modelManager->Initialise(particle,secondaryParticle,1.0,verboseLevel);
theCutsGamma = theCoupleTable->GetEnergyCutsVector(idxG4GammaCut);
theCutsElectron = theCoupleTable->GetEnergyCutsVector(idxG4ElectronCut);
theCutsPositron = theCoupleTable->GetEnergyCutsVector(idxG4PositronCut);
@@ -348,7 +274,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
}
// defined ID of secondary particles
G4String nam1 = GetProcessName();
secID = G4PhysicsModelCatalog::Register(nam1);
secID = G4PhysicsModelCatalog::Register(nam1);
if(100 > mainSecondaries) {
G4String nam2 = nam1 + "_fluo" ;
G4String nam3 = nam1 + "_auger";
@@ -363,7 +289,7 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
if(!masterProc) {
if(nullptr == masterProc) {
if(isTheMaster) { masterProc = this; }
else { masterProc = static_cast<const G4VEmProcess*>(GetMasterProcess());}
}
@@ -385,12 +311,10 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
if(!isTheMaster) {
theLambdaTable = masterProc->LambdaTable();
theLambdaTablePrim = masterProc->LambdaTablePrim();
if(theLambdaTable) { FindLambdaMax(); }
theEnergyOfCrossSectionMax = masterProc->EnergyOfCrossSectionMax();
// local initialisation of models
G4bool printing = true;
numberOfModels = modelManager->NumberOfModels();
for(G4int i=0; i<numberOfModels; ++i) {
G4VEmModel* mod = GetModelByIndex(i, printing);
G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
@@ -484,28 +408,25 @@ void G4VEmProcess::BuildLambdaTable()
if(emax <= emin) { emax = 2*emin; }
G4int bin = G4lrint(nbin*G4Log(emax/emin)/scale);
if(bin < 3) { bin = 3; }
aVector = new G4PhysicsLogVector(emin, emax, bin);
aVector->SetSpline(splineFlag);
aVector = new G4PhysicsLogVector(emin, emax, bin, splineFlag);
modelManager->FillLambdaVector(aVector, couple, startNull);
if(splineFlag) { aVector->FillSecondDerivatives(); }
G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
}
// build high energy table
// build high energy table
if(minKinEnergyPrim < maxKinEnergy) {
delete (*theLambdaTablePrim)[i];
// start not from zero
// start not from zero and always use spline
if(!bVectorPrim) {
G4int bin = G4lrint(nbin*G4Log(maxKinEnergy/minKinEnergyPrim)/scale);
if(bin < 3) { bin = 3; }
aVectorPrim =
new G4PhysicsLogVector(minKinEnergyPrim, maxKinEnergy, bin);
new G4PhysicsLogVector(minKinEnergyPrim, maxKinEnergy, bin, true);
bVectorPrim = aVectorPrim;
} else {
aVectorPrim = new G4PhysicsLogVector(*bVectorPrim);
}
// always use spline
aVectorPrim->SetSpline(splineFlag);
modelManager->FillLambdaVector(aVectorPrim, couple, false,
fIsCrossSectionPrim);
aVectorPrim->FillSecondDerivatives();
@@ -515,7 +436,7 @@ void G4VEmProcess::BuildLambdaTable()
}
}
if(buildLambdaTable) { FindLambdaMax(); }
if(buildLambdaTable && fXSType == fEmOnePeak) { FindLambdaMax(); }
if(1 < verboseLevel) {
G4cout << "Lambda table is built for "
@@ -534,9 +455,8 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
out << G4endl << indent << GetProcessName() << ": ";
if (!rst) {
out << " for " << part.GetParticleName();
if (integral) { out << ","; }
}
if(integral) { out << " integral:1 "; }
if(fXSType != fEmNoIntegral) { out << " XStype:" << fXSType; }
if(applyCuts) { out << " applyCuts:1 "; }
out << " SubType=" << GetProcessSubType();
if(biasFactor != 1.0) { out << " BiasingFactor= " << biasFactor; }
@@ -629,11 +549,14 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
G4double x = DBL_MAX;
DefineMaterial(track.GetMaterialCutsCouple());
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
G4double scaledEnergy = preStepKinEnergy*massRatio;
preStepKinEnergy = track.GetKineticEnergy();
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
const G4double scaledEnergy = preStepKinEnergy*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
/*
G4cout << "PostStepGetPhysicalInteractionLength: idx= " << currentCoupleIndex
<< " couple: " << currentCouple << G4endl;
*/
if(!currentModel->IsActive(scaledEnergy)) {
theNumberOfInteractionLengthLeft = -1.0;
currentInteractionLength = DBL_MAX;
@@ -651,27 +574,20 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
}
// compute mean free path
if(preStepKinEnergy < mfpKinEnergy) {
if (integral) {
ComputeIntegralLambda(preStepKinEnergy, preStepLogKinEnergy);
} else {
preStepLambda = GetCurrentLambda(preStepKinEnergy, preStepLogKinEnergy);
}
ComputeIntegralLambda(preStepKinEnergy, preStepLogKinEnergy);
// zero cross section
if(preStepLambda <= 0.0) {
theNumberOfInteractionLengthLeft = -1.0;
currentInteractionLength = DBL_MAX;
}
}
// zero cross section
if(preStepLambda <= 0.0) {
theNumberOfInteractionLengthLeft = -1.0;
currentInteractionLength = DBL_MAX;
// non-zero cross section
if(preStepLambda > 0.0) {
} else {
// non-zero cross section
if (theNumberOfInteractionLengthLeft < 0.0) {
// beggining of tracking (or just after DoIt of this process)
theNumberOfInteractionLengthLeft = -G4Log( G4UniformRand() );
theNumberOfInteractionLengthLeft = -G4Log( G4UniformRand() );
theInitialNumberOfInteractionLength = theNumberOfInteractionLengthLeft;
} else if(currentInteractionLength < DBL_MAX) {
@@ -693,28 +609,37 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
void G4VEmProcess::ComputeIntegralLambda(G4double e, G4double loge)
{
// condition to skip recomputation of cross section
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
// recomputation is needed
if (e <= epeak) {
if(fXSType == fEmNoIntegral) {
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
} else {
const G4double e1 = e*lambdaFactor;
if (e1 > epeak) {
preStepLambda = GetCurrentLambda(e, loge);
mfpKinEnergy = e;
const G4double preStepLambda1 = GetCurrentLambda(e1,loge+logLambdaFactor);
if (preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
}
} else {
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
mfpKinEnergy = epeak;
} else if(fXSType == fEmIncreasing) {
if(e/lambdaFactor < mfpKinEnergy) {
mfpKinEnergy = e;
preStepLambda = GetCurrentLambda(e, loge);
}
} else if(fXSType == fEmDecreasing) {
if(e < mfpKinEnergy) {
const G4double e1 = e*lambdaFactor;
preStepLambda = GetCurrentLambda(e1);
mfpKinEnergy = e1;
}
} else if(fXSType == fEmOnePeak) {
const G4double epeak = (*theEnergyOfCrossSectionMax)[currentCoupleIndex];
if(e <= epeak) {
if(e/lambdaFactor < mfpKinEnergy) {
mfpKinEnergy = e;
preStepLambda = GetCurrentLambda(e, loge);
}
} else if(e < mfpKinEnergy) {
const G4double e1 = std::max(epeak, e*lambdaFactor);
preStepLambda = GetCurrentLambda(e1);
mfpKinEnergy = e1;
}
} else {
preStepLambda = GetCurrentLambda(e, loge);
}
}
@@ -725,7 +650,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
{
// In all cases clear number of interaction lengths
theNumberOfInteractionLengthLeft = -1.0;
mfpKinEnergy = DBL_MAX;
mfpKinEnergy = DBL_MAX;
fParticleChange.InitializeForPostStep(track);
@@ -734,7 +659,6 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
if (track.GetTrackStatus() == fStopButAlive) { return &fParticleChange; }
const G4double finalT = track.GetKineticEnergy();
const G4double logFinalT = track.GetDynamicParticle()->GetLogKineticEnergy();
// forced process - should happen only once per track
if(biasFlag) {
@@ -743,28 +667,34 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
}
}
// check active and select model
const G4double scaledEnergy = finalT*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
if(!currentModel->IsActive(scaledEnergy)) { return &fParticleChange; }
// Integral approach
if (integral) {
G4double lx = GetLambda(finalT, currentCouple, logFinalT);
if(preStepLambda<lx && 1 < verboseLevel) {
if (fXSType != fEmNoIntegral) {
const G4double logFinalT = track.GetDynamicParticle()->GetLogKineticEnergy();
const G4double lx = std::max(GetCurrentLambda(finalT, logFinalT), 0.0);
const G4double lg = preStepLambda;
if(finalT < mfpKinEnergy) {
mfpKinEnergy = finalT;
preStepLambda = lx;
}
#ifdef G4VERBOSE
if(lg < lx && 1 < verboseLevel) {
G4cout << "WARNING: for " << currentParticle->GetParticleName()
<< " and " << GetProcessName()
<< " E(MeV)= " << finalT/MeV
<< " preLambda= " << preStepLambda << " < "
<< lx << " (postLambda) "
<< " preLambda= " << lg << " < " << lx << " (postLambda) "
<< G4endl;
}
if(preStepLambda*G4UniformRand() > lx) {
ClearNumberOfInteractionLengthLeft();
#endif
if(lg*G4UniformRand() >= lx) {
return &fParticleChange;
}
}
G4double scaledEnergy = finalT*massRatio;
SelectModel(scaledEnergy, currentCoupleIndex);
if(!currentModel->IsActive(scaledEnergy)) { return &fParticleChange; }
// define new weight for primary and secondaries
G4double weight = fParticleChange.GetParentWeight();
if(weightFlag) {
@@ -772,7 +702,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
fParticleChange.ProposeWeight(weight);
}
#ifdef G4VERBOSE
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
<< finalT/MeV
@@ -780,7 +710,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
<< ", " << currentModel->HighEnergyLimit() << ")"
<< G4endl;
}
#endif
// sample secondaries
secParticles.clear();
@@ -815,8 +745,8 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
G4double time = track.GetGlobalTime();
for (G4int i=0; i<num; ++i) {
if (secParticles[i]) {
G4DynamicParticle* dp = secParticles[i];
G4DynamicParticle* dp = secParticles[i];
if (nullptr != dp) {
const G4ParticleDefinition* p = dp->GetParticleDefinition();
G4double e = dp->GetKineticEnergy();
G4bool good = true;
@@ -952,7 +882,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& filename =
GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,
filename,ascii);
filename,ascii,
splineFlag);
if ( yes ) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << particleName
@@ -960,14 +891,12 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
<< filename << ">"
<< G4endl;
}
if(theParameters->Spline()) {
size_t n = theLambdaTable->length();
for(size_t i=0; i<n; ++i) {
if((* theLambdaTable)[i]) {
(* theLambdaTable)[i]->SetSpline(true);
}
}
if(splineFlag) {
for(auto & v : *theLambdaTable) {
if(nullptr != v) { v->FillSecondDerivatives(); }
}
}
} else {
if (1 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " in file <"
@@ -980,7 +909,7 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& filename =
GetPhysicsTableFileName(part,directory,"LambdaPrim",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTablePrim,
filename,ascii);
filename,ascii,true);
if ( yes ) {
if (0 < verboseLevel) {
G4cout << "Lambda table prim for " << particleName
@@ -988,13 +917,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
<< filename << ">"
<< G4endl;
}
if(theParameters->Spline()) {
size_t n = theLambdaTablePrim->length();
for(size_t i=0; i<n; ++i) {
if((* theLambdaTablePrim)[i]) {
(* theLambdaTablePrim)[i]->SetSpline(true);
}
}
for(auto & v : *theLambdaTablePrim) {
if(nullptr != v) { v->FillSecondDerivatives(); }
}
} else {
if (1 < verboseLevel) {
@@ -1074,6 +998,7 @@ void G4VEmProcess::FindLambdaMax()
<< " and process " << GetProcessName() << " " << G4endl;
}
size_t n = theLambdaTable->length();
G4PhysicsVector* pv;
G4double e, ss, emax, smax;
@@ -1082,7 +1007,7 @@ void G4VEmProcess::FindLambdaMax()
// first loop on existing vectors
for (i=0; i<n; ++i) {
pv = (*theLambdaTable)[i];
if(pv) {
if(nullptr != pv) {
size_t nb = pv->GetVectorLength();
emax = DBL_MAX;
smax = 0.0;
@@ -1093,11 +1018,12 @@ void G4VEmProcess::FindLambdaMax()
if(ss > smax) {
smax = ss;
emax = e;
}
} else {
break;
}
}
}
theEnergyOfCrossSectionMax[i] = emax;
theCrossSectionMax[i] = smax;
(*theEnergyOfCrossSectionMax)[i] = emax;
if(1 < verboseLevel) {
G4cout << "For " << particle->GetParticleName()
<< " Max CS at i= " << i << " emax(MeV)= " << emax/MeV
@@ -1108,10 +1034,9 @@ void G4VEmProcess::FindLambdaMax()
// second loop using base materials
for (i=0; i<n; ++i) {
pv = (*theLambdaTable)[i];
if(!pv){
if(nullptr == pv) {
G4int j = (*theDensityIdx)[i];
theEnergyOfCrossSectionMax[i] = theEnergyOfCrossSectionMax[j];
theCrossSectionMax[i] = (*theDensityFactor)[i]*theCrossSectionMax[j];
(*theEnergyOfCrossSectionMax)[i] = (*theEnergyOfCrossSectionMax)[j];
}
}
}
@@ -1119,21 +1044,24 @@ void G4VEmProcess::FindLambdaMax()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector*
G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple* couple)
{
G4PhysicsVector* v =
new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
v->SetSpline(theParameters->Spline());
return v;
DefineMaterial(couple);
G4PhysicsVector* newv = nullptr;
if(nullptr == theLambdaTable) {
newv = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy,
nLambdaBins, splineFlag);
} else {
newv = new G4PhysicsVector(*((*theLambdaTable)[basedCoupleIndex]));
}
return newv;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4Element* G4VEmProcess::GetCurrentElement() const
{
const G4Element* elm =
(currentModel) ? currentModel->GetCurrentElement() : nullptr;
return elm;
return (nullptr != currentModel) ? currentModel->GetCurrentElement() : nullptr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1159,7 +1087,7 @@ void
G4VEmProcess::ActivateForcedInteraction(G4double length, const G4String& r,
G4bool flag)
{
if(!biasManager) { biasManager = new G4EmBiasingManager(); }
if(nullptr == biasManager) { biasManager = new G4EmBiasingManager(); }
if(1 < verboseLevel) {
G4cout << "### ActivateForcedInteraction: for "
<< particle->GetParticleName()
File diff suppressed because it is too large Load Diff
@@ -58,25 +58,13 @@
G4VMscModel::G4VMscModel(const G4String& nam):
G4VEmModel(nam),
safetyHelper(nullptr),
ionisation(nullptr),
facrange(0.04),
facgeom(2.5),
facsafety(0.6),
skin(1.0),
dtrl(0.05),
lambdalimit(1.*CLHEP::mm),
geomMin(1.e-6*CLHEP::mm),
geomMax(1.e50*CLHEP::mm),
fDisplacement(0.,0.,0.),
steppingAlgorithm(fUseSafety),
samplez(false),
latDisplasment(true)
steppingAlgorithm(fUseSafety)
{
dedx = 2.0*CLHEP::MeV*CLHEP::cm2/CLHEP::g;
localrange = DBL_MAX;
localtkin = 0.0;
currentPart = nullptr;
dedx = 2.0*CLHEP::MeV*CLHEP::cm2/CLHEP::g;
SetUseBaseMaterials(false);
}
@@ -91,29 +79,30 @@ G4ParticleChangeForMSC*
G4VMscModel::GetParticleChangeForMSC(const G4ParticleDefinition* p)
{
// recomputed for each new run
if(!safetyHelper) {
if(nullptr == safetyHelper) {
safetyHelper = G4TransportationManager::GetTransportationManager()
->GetSafetyHelper();
safetyHelper->InitialiseHelper();
}
G4ParticleChangeForMSC* change = nullptr;
if (pParticleChange) {
if (nullptr != pParticleChange) {
change = static_cast<G4ParticleChangeForMSC*>(pParticleChange);
} else {
change = new G4ParticleChangeForMSC();
}
if(p) {
if(nullptr != p) {
// table is never built for GenericIon
if(p->GetParticleName() == "GenericIon") {
if(xSectionTable) {
if(nullptr != xSectionTable) {
xSectionTable->clearAndDestroy();
delete xSectionTable;
xSectionTable = nullptr;
}
// table is always built for low mass particles
} else if(p->GetPDGMass() < 4.5*GeV || ForceBuildTableFlag()) {
} else if(p->GetPDGMass() < CLHEP::GeV || ForceBuildTableFlag()) {
// } else if(p->GetPDGMass() < 4.5*CLHEP::GeV || ForceBuildTableFlag()) {
G4EmParameters* param = G4EmParameters::Instance();
idxTable = 0;
@@ -164,9 +153,9 @@ void G4VMscModel::DumpParameters(std::ostream& out) const
else if (steppingAlgorithm == fMinimal) alg = "Minimal";
else if (steppingAlgorithm == fUseSafetyPlus) alg = "SafetyPlus";
out << std::setw(22) << "StepLim=" << alg << " Rfact=" << facrange
out << std::setw(18) << "StepLim=" << alg << " Rfact=" << facrange
<< " Gfact=" << facgeom << " Sfact=" << facsafety << " DispFlag:" << latDisplasment
<< " Skin=" << skin << " Llimit=" << lambdalimit << G4endl;
<< " Skin=" << skin << " Llim=" << lambdalimit/CLHEP::mm << " mm" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -37,8 +37,6 @@
//
// 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)
@@ -56,10 +54,6 @@
// 24-06-09 Removed hidden bin in G4PhysicsVector (V.Ivanchenko)
// 04-06-13 Adoptation to MT mode (V.Ivanchenko)
//
// Class Description:
//
// It is the generic process of multiple scattering it includes common
// part of calculations for all charged particles
// -------------------------------------------------------------------
//
@@ -87,37 +81,22 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType)
G4VMultipleScattering::G4VMultipleScattering(const G4String&, G4ProcessType)
: G4VContinuousDiscreteProcess("msc", fElectromagnetic),
numberOfModels(0),
firstParticle(nullptr),
currParticle(nullptr),
stepLimit(fUseSafety),
facrange(0.04),
latDisplacement(true),
isIon(false),
fNewPosition(0.,0.,0.),
fNewDirection(0.,0.,1.)
{
theParameters = G4EmParameters::Instance();
SetVerboseLevel(1);
SetProcessSubType(fMultipleScattering);
if("ionmsc" == name) { firstParticle = G4GenericIon::GenericIon(); }
lowestKinEnergy = 10*CLHEP::eV;
physStepLimit = gPathLength = tPathLength = 0.0;
fIonisation = nullptr;
geomMin = 0.05*CLHEP::nm;
minDisplacement2 = geomMin*geomMin;
pParticleChange = &fParticleChange;
safetyHelper = nullptr;
fPositionChanged = false;
isActive = false;
currentModel = nullptr;
modelManager = new G4EmModelManager();
emManager = G4LossTableManager::Instance();
mscModels.reserve(2);
@@ -128,40 +107,30 @@ G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType
G4VMultipleScattering::~G4VMultipleScattering()
{
/*
if(1 < verboseLevel) {
G4cout << "G4VMultipleScattering destruct " << GetProcessName()
<< G4endl;
}
*/
delete modelManager;
emManager->DeRegister(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* ptr,
const G4Region* region)
{
if(!p) { return; }
if(nullptr == ptr) { return; }
G4VEmFluctuationModel* fm = nullptr;
modelManager->AddEmModel(order, p, fm, region);
p->SetParticleChange(pParticleChange);
modelManager->AddEmModel(order, ptr, fm, region);
ptr->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::SetEmModel(G4VMscModel* p, size_t)
void G4VMultipleScattering::SetEmModel(G4VMscModel* ptr, G4int)
{
for(auto & msc : mscModels) { if(msc == p) { return; } }
mscModels.push_back(p);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VMscModel* G4VMultipleScattering::EmModel(size_t index) const
{
return (index < mscModels.size()) ? mscModels[index] : nullptr;
if(nullptr == ptr) { return; }
if(!mscModels.empty()) {
for(auto & msc : mscModels) { if(msc == ptr) { return; } }
}
mscModels.push_back(ptr);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -177,34 +146,10 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
}
G4bool master = emManager->IsMaster();
if(!firstParticle) { firstParticle = &part; }
if(part.GetParticleType() == "nucleus") {
stepLimit = fMinimal;
latDisplacement = false;
facrange = 0.2;
G4String pname = part.GetParticleName();
if(pname != "deuteron" && pname != "triton" &&
pname != "alpha+" && pname != "helium" &&
pname != "alpha" && pname != "He3" &&
pname != "hydrogen") {
const G4ParticleDefinition* theGenericIon =
G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
if(&part == theGenericIon) { isIon = true; }
if(theGenericIon && firstParticle != theGenericIon) {
G4ProcessManager* pm = theGenericIon->GetProcessManager();
G4ProcessVector* v = pm->GetAlongStepProcessVector();
size_t n = v->size();
for(size_t j=0; j<n; ++j) {
if((*v)[j] == this) {
firstParticle = theGenericIon;
isIon = true;
break;
}
}
}
}
if(nullptr == firstParticle) { firstParticle = &part; }
if(part.GetPDGMass() > CLHEP::GeV) {
// flag declears that mass scaling is applied
isIon = true;
}
emManager->PreparePhysicsTable(&part, this, master);
@@ -216,7 +161,7 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
<< " and particle " << part.GetParticleName()
<< " local particle " << firstParticle->GetParticleName()
<< " isIon: " << isIon << " isMaster: " << master
<< G4endl;
<< G4endl;
}
if(firstParticle == &part) {
@@ -224,36 +169,33 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
// initialise process
InitialiseProcess(firstParticle);
// heavy particles and not ions
if(!isIon) {
if(part.GetPDGMass() > MeV) {
stepLimit = theParameters->MscMuHadStepLimitType();
facrange = theParameters->MscMuHadRangeFactor();
latDisplacement = theParameters->MuHadLateralDisplacement();
} else {
stepLimit = theParameters->MscStepLimitType();
facrange = theParameters->MscRangeFactor();
latDisplacement = theParameters->LateralDisplacement();
}
// heavy particles
if(part.GetPDGMass() > CLHEP::MeV) {
stepLimit = theParameters->MscMuHadStepLimitType();
facrange = theParameters->MscMuHadRangeFactor();
latDisplacement = theParameters->MuHadLateralDisplacement();
} else {
stepLimit = theParameters->MscStepLimitType();
facrange = theParameters->MscRangeFactor();
latDisplacement = theParameters->LateralDisplacement();
}
if(master) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
// initialisation of models
numberOfModels = modelManager->NumberOfModels();
/*
G4cout << "### G4VMultipleScattering::PreparePhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " Nmod= " << numberOfModels << " " << this
<< G4endl;
/*
std::cout << "### G4VMultipleScattering::PreparePhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " Nmodels= " << mscModels.size() << " " << this << std::endl;
*/
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
G4VMscModel* msc = GetModelByIndex(i);
if(nullptr == msc) { continue; }
if(nullptr == currentModel) { currentModel = msc; }
msc->SetIonisation(nullptr, firstParticle);
msc->SetMasterThread(master);
currentModel = msc;
msc->SetPolarAngleLimit(theParameters->MscThetaLimit());
G4double emax =
std::min(msc->HighEnergyLimit(),theParameters->MaxKinEnergy());
@@ -261,9 +203,9 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
}
modelManager->Initialise(firstParticle, G4Electron::Electron(),
10.0, verboseLevel);
1.0, verboseLevel);
if(!safetyHelper) {
if(nullptr == safetyHelper) {
safetyHelper = G4TransportationManager::GetTransportationManager()
->GetSafetyHelper();
safetyHelper->InitialiseHelper();
@@ -275,42 +217,37 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
{
G4String num = part.GetParticleName();
const G4String& num = part.GetParticleName();
G4bool master = emManager->IsMaster();
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << num << " isIon: " << isIon
<< " IsMaster: " << master << G4endl;
<< " IsMaster: " << master << G4endl;
}
const G4VMultipleScattering* masterProcess =
static_cast<const G4VMultipleScattering*>(GetMasterProcess());
if(firstParticle == &part) {
/*
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << num
<< " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
<< " " << this
<< G4endl;
/*
std::cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName() << " and particle " << num
<< " IsMaster= " << G4LossTableManager::Instance()->IsMaster()
<< " " << this << std::endl;
*/
emManager->BuildPhysicsTable(firstParticle);
if(!master) {
// initialisation of models
/*
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << num
<< " Nmod= " << numberOfModels << " " << this
<< G4endl;
std::cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName() << " and particle " << num
<< " Nmod= " << mscModels.size() << " NOT master" << std::endl;
*/
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i));
if(!msc) { continue; }
G4VMscModel* msc0=
static_cast<G4VMscModel*>(masterProcess->GetModelByIndex(i));
G4VMscModel* msc = GetModelByIndex(i);
if(nullptr == msc) { continue; }
G4VMscModel* msc0 = masterProcess->GetModelByIndex(i);
msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
msc->InitialiseLocal(firstParticle, msc0);
}
@@ -334,8 +271,7 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
<< GetProcessName()
<< " and particle " << num
<< G4endl;
<< " and particle " << num << G4endl;
}
}
@@ -348,7 +284,6 @@ void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
outFile << G4endl << indent << GetProcessName() << ": ";
if (!rst) outFile << " for " << part.GetParticleName();
outFile << " SubType= " << GetProcessSubType() << G4endl;
//StreamProcessInfo(outFile);
modelManager->DumpModelList(outFile, verboseLevel);
}
@@ -356,35 +291,29 @@ void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
void G4VMultipleScattering::StartTracking(G4Track* track)
{
G4VEnergyLossProcess* eloss = nullptr;
if(track->GetParticleDefinition() != currParticle) {
currParticle = track->GetParticleDefinition();
fIonisation = emManager->GetEnergyLossProcess(currParticle);
eloss = fIonisation;
}
/*
G4cout << "G4VMultipleScattering::StartTracking Nmod= " << numberOfModels
<< " " << currParticle->GetParticleName()
<< " E(MeV)= " << track->GetKineticEnergy()
<< " Ion= " << eloss << " " << fIonisation << " IsMaster= "
<< " Ion= " << fIonisation << " IsMaster= "
<< G4LossTableManager::Instance()->IsMaster()
<< G4endl;
*/
for(G4int i=0; i<numberOfModels; ++i) {
for(auto & msc : mscModels) {
/*
G4cout << "Next model " << i << " " << msc
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
G4cout << "Next model " << msc
<< " Emin= " << msc->LowEnergyLimit()
<< " Emax= " << msc->HighEnergyLimit()
<< " Eact= " << msc->LowEnergyActivationLimit() << G4endl;
*/
G4VEmModel* msc = GetModelByIndex(i);
msc->StartTracking(track);
if(eloss) {
G4VMscModel* mscmod = static_cast<G4VMscModel*>(msc);
if(mscmod) { mscmod->SetIonisation(fIonisation, currParticle); }
}
msc->SetIonisation(fIonisation, currParticle);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -596,15 +525,16 @@ G4VMultipleScattering::StorePhysicsTable(const G4ParticleDefinition* part,
if(part != firstParticle) { return yes; }
const G4VMultipleScattering* masterProcess =
static_cast<const G4VMultipleScattering*>(GetMasterProcess());
if(masterProcess && masterProcess != this) { return yes; }
if(nullptr != masterProcess && masterProcess != this) { return yes; }
G4int nmod = modelManager->NumberOfModels();
static const G4String ss[4] = {"1","2","3","4"};
for(G4int i=0; i<nmod; ++i) {
G4VEmModel* msc = modelManager->GetModel(i);
if(nullptr == msc) { continue; }
yes = true;
G4PhysicsTable* table = msc->GetCrossSectionTable();
if (table) {
if (nullptr != table) {
G4int j = std::min(i,3);
G4String name =
GetPhysicsTableFileName(part,directory,"LambdaMod"+ss[j],ascii);
@@ -643,9 +573,8 @@ G4VMultipleScattering::RetrievePhysicsTable(const G4ParticleDefinition*,
void G4VMultipleScattering::SetIonisation(G4VEnergyLossProcess* p)
{
for(G4int i=0; i<numberOfModels; ++i) {
G4VMscModel* msc = static_cast<G4VMscModel*>(GetModelByIndex(i, true));
if(msc) { msc->SetIonisation(p, firstParticle); }
for(auto & msc : mscModels) {
if(nullptr != msc) { msc->SetIonisation(p, firstParticle); }
}
}
@@ -64,26 +64,19 @@
G4ionEffectiveCharge::G4ionEffectiveCharge()
{
chargeCorrection = 1.0;
energyHighLimit = 20.0*MeV;
energyLowLimit = 1.0*keV;
energyBohr = 25.*keV;
massFactor = amu_c2/(proton_mass_c2*keV);
energyHighLimit = 20.0*CLHEP::MeV;
energyLowLimit = 1.0*CLHEP::keV;
energyBohr = 25.*CLHEP::keV;
massFactor = CLHEP::amu_c2/(CLHEP::proton_mass_c2*CLHEP::keV);
minCharge = 1.0;
lastPart = 0;
lastMat = 0;
lastKinEnergy = 0.0;
effCharge = eplus;
effCharge = CLHEP::eplus;
inveplus = 1.0/CLHEP::eplus;
g4calc = G4Pow::GetInstance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ionEffectiveCharge::~G4ionEffectiveCharge()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
@@ -107,12 +100,12 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// The Stopping and Range of Ions in Matter,
// Vol.1, Pergamon Press, 1985
// Fast ions or hadrons
G4double reducedEnergy = kineticEnergy * proton_mass_c2/mass ;
G4double reducedEnergy = kineticEnergy * CLHEP::proton_mass_c2/mass ;
//G4cout << "e= " << reducedEnergy << " Zi= " << Zi << " "
//<< material->GetName() << G4endl;
if(Zi < 1.5 || !material || reducedEnergy > Zi*energyHighLimit ) {
if(Zi < 1.5 || reducedEnergy > Zi*energyHighLimit ) {
return charge;
}
G4double z = material->GetIonisation()->GetZeffective();
@@ -131,9 +124,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
y *= Q;
x += y * c[i] ;
}
G4double ex;
if(x < 0.2) { ex = x * (1 - 0.5*x); }
else { ex = 1. - G4Exp(-x); }
G4double ex = (x < 0.2) ? x * (1 - 0.5*x) : 1. - G4Exp(-x);
G4double tq = 7.6 - Q;
G4double tq2= tq*tq;
@@ -165,18 +156,18 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
y = 0.692308 * vF * (1.0 + 0.666666*v1sq + v1sq*v1sq/15.0) / zi23 ;
}
G4double q;
G4double y3 = std::pow(y, 0.3) ;
G4double y3 = G4Exp(0.3*G4Log(y));
// G4cout<<"y= "<<y<<" y3= "<<y3<<" v1= "<<v1<<" vF= "<<vF<<G4endl;
q = 1.0 - G4Exp( 0.803*y3 - 1.3167*y3*y3 - 0.38157*y - 0.008983*y*y);
q = std::max(q, minCharge/Zi);
G4double q = std::max(1.0 - G4Exp( 0.803*y3 - 1.3167*y3*y3 - 0.38157*y
- 0.008983*y*y), minCharge/Zi);
effCharge = q*charge;
G4double tq = 7.6 - G4Log(reducedEnergy/keV);
// compute chage correction
G4double tq = 7.6 - G4Log(reducedEnergy/CLHEP::keV);
G4double tq2= tq*tq;
G4double sq = 1.0 + ( 0.18 + 0.0015 * z )*G4Exp(-tq2)/ (Zi*Zi);
G4double sq = 1.0 + ( 0.18 + 0.0015 * z )*G4Exp(-tq2)/ (Zi*Zi);
// G4cout << "sq= " << sq << G4endl;
// Screen length according to
@@ -199,5 +190,3 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....