Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
+39 -2
View File
@@ -1,4 +1,4 @@
$Id: History 102548 2017-02-08 14:33:25Z gcosmo $
$Id: History 104457 2017-05-31 15:52:37Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,8 +17,45 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14 December 16: V.Ivant (emutils-V10-02-39)
31 May 17: V.Ivant (emutils-V10-03-10)
- G4VEmModel - added triplet model pointer and Get/Set methods
26 May 17: V.Ivant (emutils-V10-03-09)
- G4EmSaturation - fixed typo
25 May 17: V.Ivant (emutils-V10-03-08)
- G4VEmProcess - added DNA ionisation process for hydrogen and helium
to the list of processes, which have auger and fluo flags
24 May 17: V.Ivant (emutils-V10-03-07)
- G4VEnergyLossProcess, G4LossTableManager - minor cleanup of inline
methods
03 May 17: V.Ivant (emutils-V10-03-06)
- G4VEmProcess - added DNA ionisation process to the list of
discrete processes, which have auger and fluo flags for
secondary particles
- G4VEmModel - added extra protected class member for nuclear
stopping
- G4EmCorrections - removed computation of nuclear stopping power
- G4EmCalculator - for computation of the nuclear stopping power
use concrete model (applied in run time) instead of
G4EmCorrections emulation; to get cross section per volume
for discrete processes use interface of the process, addressing
http://hypernews.slac.stanford.edu/HyperNews/geant4/get/hadroprocess/1595/1.html
03 April 17: V.Ivant (emutils-V10-03-05)
- G4EmParameters - G4EmSaturation may be created at any
moment (G4Mutex is used)
24 March 17: V.Ivant (emutils-V10-03-02)
- G4EmParametersMessenger, G4EmParameters - added parameter
"ScreeningFactor" Get/Set methods and UI command
14 December 16: V.Ivant (emutils-V10-03-00)
- G4EmParametersMessenger - fixed typo (#1929)
- G4EmParameters - added method with more correct name AddPhysics()
in order to replace AddMsc in future (no change in functionality)
19 November 16: V.Ivant (emutils-V10-02-38)
- G4EmParametersMessenger - fixed typo
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.hh 96834 2016-05-12 09:19:10Z gcosmo $
// $Id: G4EmCalculator.hh 103954 2017-05-04 11:29:22Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -327,9 +327,11 @@ private:
const G4ParticleDefinition* lambdaParticle;
const G4ParticleDefinition* baseParticle;
const G4PhysicsTable* currentLambda;
G4VEmModel* currentModel;
G4VEmModel* loweModel;
G4VEnergyLossProcess* currentProcess;
G4VEmModel* currentModel;
G4VEmModel* loweModel;
G4VEnergyLossProcess* currentProcess;
G4VProcess* curProcess;
const G4ParticleDefinition* theGenericIon;
G4ionEffectiveCharge* ionEffCharge;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.hh 100363 2016-10-19 09:24:47Z gcosmo $
// $Id: G4EmCorrections.hh 103954 2017-05-04 11:29:22Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -134,11 +134,6 @@ public:
const G4Material*,
G4double kineticEnergy);
G4double NuclearDEDX(const G4ParticleDefinition*,
const G4Material*,
G4double kineticEnergy,
G4bool fluct = true);
void AddStoppingData(G4int Z, G4int A, const G4String& materialName,
G4PhysicsVector* dVector);
@@ -190,9 +185,6 @@ private:
G4double y1, G4double y2, G4double z11, G4double z21,
G4double z12, G4double z22) const;
G4double NuclearStoppingPower(G4double e, G4double z1, G4double z2,
G4double m1, G4double m2);
// hide assignment operator
G4EmCorrections & operator=(const G4EmCorrections &right) = delete;
G4EmCorrections(const G4EmCorrections&) = delete;
@@ -214,9 +206,7 @@ private:
static G4LPhysicsFreeVector* ThetaK;
static G4LPhysicsFreeVector* ThetaL;
G4double theZieglerFactor;
G4double alpha2;
G4bool lossFlucFlag;
std::vector<const G4Material*> currmat;
std::map< G4int, std::vector<G4double> > thcorr;
@@ -61,6 +61,7 @@
#include "G4MscStepLimitType.hh"
#include "G4NuclearFormfactorType.hh"
#include "G4EmSaturation.hh"
#include "G4Threading.hh"
#include <vector>
class G4EmParametersMessenger;
@@ -191,6 +192,9 @@ public:
void SetMscSkin(G4double val);
G4double MscSkin() const;
void SetScreeningFactor(G4double val);
G4double ScreeningFactor() const;
void SetStepFunction(G4double v1, G4double v2);
void SetStepFunctionMuHad(G4double v1, G4double v2);
@@ -243,6 +247,10 @@ public:
const std::vector<G4String>& RegionsMsc() const;
const std::vector<G4String>& TypesMsc() const;
void AddPhysics(const G4String& region, const G4String& type);
const std::vector<G4String>& RegionsPhysics() const;
const std::vector<G4String>& TypesPhysics() const;
void SetSubCutoff(G4bool val, const G4String& region = "");
void SetDeexActiveRegion(const G4String& region, G4bool fdeex,
@@ -329,6 +337,7 @@ private:
G4double finalRange;
G4double dRoverRangeMuHad;
G4double finalRangeMuHad;
G4double factorScreen;
G4int nbins;
G4int nbinsPerDecade;
@@ -376,6 +385,9 @@ private:
std::vector<G4double> m_factBiasedSec;
std::vector<G4double> m_elimBiasedSec;
#ifdef G4MULTITHREADED
static G4Mutex emParametersMutex;
#endif
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -117,6 +117,7 @@ private:
G4UIcmdWithADouble* fr1Cmd;
G4UIcmdWithADouble* fgCmd;
G4UIcmdWithADouble* skinCmd;
G4UIcmdWithADouble* screCmd;
G4UIcmdWithAnInteger* dedxCmd;
G4UIcmdWithAnInteger* lamCmd;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh 99151 2016-09-07 08:03:17Z gcosmo $
// $Id: G4LossTableManager.hh 104349 2017-05-26 07:18:59Z gcosmo $
//
//
// -------------------------------------------------------------------
@@ -320,7 +320,7 @@ G4LossTableManager::GetEnergyLossProcess(const G4ParticleDefinition *aParticle)
if ((pos = loss_map.find(aParticle)) != loss_map.end()) {
currentLoss = (*pos).second;
} else {
currentLoss = 0;
currentLoss = nullptr;
if ((pos = loss_map.find(theGenericIon)) != loss_map.end()) {
currentLoss = (*pos).second;
}
@@ -337,9 +337,7 @@ G4double G4LossTableManager::GetDEDX(const G4ParticleDefinition *aParticle,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = 0.0;
if(currentLoss) { x = currentLoss->GetDEDX(kineticEnergy, couple); }
return x;
return currentLoss ? currentLoss->GetDEDX(kineticEnergy, couple) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -350,9 +348,7 @@ G4double G4LossTableManager::GetSubDEDX(const G4ParticleDefinition *aParticle,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = 0.0;
if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); }
return x;
return currentLoss ? currentLoss->GetDEDXForSubsec(kineticEnergy, couple) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -363,9 +359,7 @@ G4double G4LossTableManager::GetCSDARange(const G4ParticleDefinition *aParticle,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = DBL_MAX;
if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); }
return x;
return currentLoss ? currentLoss->GetCSDARange(kineticEnergy, couple) : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -377,9 +371,7 @@ G4double G4LossTableManager::GetRangeFromRestricteDEDX(
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = DBL_MAX;
if(currentLoss) { x = currentLoss->GetRangeForLoss(kineticEnergy, couple); }
return x;
return currentLoss ? currentLoss->GetRangeForLoss(kineticEnergy, couple) : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -390,11 +382,7 @@ G4double G4LossTableManager::GetRange(const G4ParticleDefinition *aParticle,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = DBL_MAX;
if(currentLoss) {
x = currentLoss->GetRange(kineticEnergy, couple);
}
return x;
return currentLoss ? currentLoss->GetRange(kineticEnergy, couple) : DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -405,9 +393,7 @@ G4double G4LossTableManager::GetEnergy(const G4ParticleDefinition *aParticle,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = 0;
if(currentLoss) { x = currentLoss->GetKineticEnergy(range, couple); }
return x;
return currentLoss ? currentLoss->GetKineticEnergy(range, couple) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -420,9 +406,7 @@ G4double G4LossTableManager::GetDEDXDispersion(
{
const G4ParticleDefinition* aParticle = dp->GetParticleDefinition();
if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
G4double x = 0.0;
if(currentLoss) { currentLoss->GetDEDXDispersion(couple, dp, length); }
return x;
return currentLoss ? currentLoss->GetDEDXDispersion(couple, dp, length) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh 97742 2016-06-08 09:24:54Z gcosmo $
// $Id: G4VEmModel.hh 104457 2017-05-31 15:52:37Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -315,6 +315,10 @@ public:
inline G4VEmAngularDistribution* GetAngularDistribution();
inline G4VEmModel* GetTripletModel();
inline void SetTripletModel(G4VEmModel*);
inline void SetAngularDistribution(G4VEmAngularDistribution*);
inline G4double HighEnergyLimit() const;
@@ -359,6 +363,8 @@ public:
inline void SetForceBuildTable(G4bool val);
inline void SetFluctuationFlag(G4bool val);
inline void SetMasterThread(G4bool val);
inline G4bool IsMaster() const;
@@ -424,6 +430,7 @@ protected:
const std::vector<G4double>* theDensityFactor;
const std::vector<G4int>* theDensityIdx;
size_t idxTable;
G4bool lossFlucFlag;
const static G4double inveplus;
// ======== Cached values - may be state dependent ================
@@ -433,6 +440,7 @@ private:
const G4MaterialCutsCouple* fCurrentCouple;
const G4Element* fCurrentElement;
const G4Isotope* fCurrentIsotope;
G4VEmModel* fTripletModel;
G4int nsec;
std::vector<G4double> xsec;
@@ -630,6 +638,23 @@ inline void G4VEmModel::SetAngularDistribution(G4VEmAngularDistribution* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmModel::GetTripletModel()
{
return fTripletModel;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetTripletModel(G4VEmModel* p)
{
if(p != fTripletModel) {
delete fTripletModel;
fTripletModel = p;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmModel::HighEnergyLimit() const
{
return highLimit;
@@ -707,6 +732,13 @@ inline void G4VEmModel::SetAngularGeneratorFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetFluctuationFlag(G4bool val)
{
lossFlucFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmModel::SetMasterThread(G4bool val)
{
isMaster = val;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh 96139 2016-03-17 14:10:31Z gcosmo $
// $Id: G4VEnergyLossProcess.hh 104349 2017-05-26 07:18:59Z gcosmo $
// GEANT4 tag $Name:
//
// -------------------------------------------------------------------
@@ -809,11 +809,9 @@ G4VEnergyLossProcess::GetCSDARange(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(theCSDARangeTable) {
x=GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
}
return x;
return (theCSDARangeTable) ?
GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor
: DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -824,11 +822,7 @@ G4VEnergyLossProcess::GetRangeForLoss(G4double& kineticEnergy,
{
// G4cout << "GetRangeForLoss: Range from " << GetProcessName() << G4endl;
DefineMaterial(couple);
G4double x =
GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
//G4cout << "GetRangeForLoss: Range from " << GetProcessName()
// << " e= " << kineticEnergy << " r= " << x << G4endl;
return x;
return GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -848,11 +842,7 @@ G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = 0.0;
if(theLambdaTable) {
x = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
}
return x;
return theLambdaTable ? GetLambdaForScaledEnergy(kineticEnergy*massRatio) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc 96834 2016-05-12 09:19:10Z gcosmo $
// $Id: G4EmCalculator.cc 103954 2017-05-04 11:29:22Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -107,6 +107,7 @@ G4EmCalculator::G4EmCalculator()
currentLambda = nullptr;
currentModel = nullptr;
currentProcess = nullptr;
curProcess = nullptr;
loweModel = nullptr;
chargeSquare = 1.0;
massRatio = 1.0;
@@ -279,27 +280,32 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
G4int idx = couple->GetIndex();
FindLambdaTable(p, processName, kinEnergy);
if(FindEmModel(p, processName, kinEnergy)) {
G4int idx = couple->GetIndex();
FindLambdaTable(p, processName, kinEnergy);
if(currentLambda) {
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
} else {
res = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat,
kinEnergy);
G4VEmProcess* emproc = FindDiscreteProcess(p, processName);
if(emproc) {
res = emproc->CrossSectionPerVolume(kinEnergy, couple);
} else if(currentLambda) {
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
} else {
res = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat,
kinEnergy);
}
if(verbose>0) {
G4cout << "G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " Escaled((MeV)= "
<< kinEnergy*massRatio
<< " q2= " << chargeSquare;
G4cout << G4endl;
}
}
if(verbose>0) {
G4cout << "G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " Escaled((MeV)= "
<< kinEnergy*massRatio
<< " q2= " << chargeSquare;
G4cout << G4endl;
}
}
return res;
}
@@ -582,8 +588,15 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat)
{
G4double res = corr->NuclearDEDX(p, mat, kinEnergy, false);
G4double res = 0.0;
G4VEmProcess* nucst = FindDiscreteProcess(p, "nuclearStopping");
if(nucst) {
G4VEmModel* mod = nucst->GetModelByIndex();
if(mod) {
mod->SetFluctuationFlag(false);
res = mod->ComputeDEDXPerVolume(mat, p, kinEnergy);
}
}
if(verbose > 1) {
G4cout << p->GetParticleName() << " E(MeV)= " << kinEnergy/MeV
@@ -897,7 +910,7 @@ const G4MaterialCutsCouple* G4EmCalculator::FindCouple(
const G4Material* material,
const G4Region* region)
{
const G4MaterialCutsCouple* couple = 0;
const G4MaterialCutsCouple* couple = nullptr;
SetupMaterial(material);
if(currentMaterial) {
// Access to materials
@@ -964,7 +977,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
// Search for the process
if (!currentLambda || p != lambdaParticle || processName != lambdaName) {
lambdaName = processName;
currentLambda = 0;
currentLambda = nullptr;
lambdaParticle = p;
const G4ParticleDefinition* part = p;
@@ -972,8 +985,8 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
// Search for energy loss process
currentName = processName;
currentModel = 0;
loweModel = 0;
currentModel = nullptr;
loweModel = nullptr;
G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
if(elproc) {
@@ -985,6 +998,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
<< G4endl;
}
}
curProcess = elproc;
return;
}
@@ -998,6 +1012,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4cout << "G4VEmProcess is found out: " << currentName << G4endl;
}
}
curProcess = proc;
return;
}
@@ -1015,6 +1030,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
}
}
}
curProcess = msc;
}
}
}
@@ -1046,8 +1062,8 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
// Search for energy loss process
currentName = processName;
currentModel = 0;
loweModel = 0;
currentModel = nullptr;
loweModel = nullptr;
size_t idx = 0;
G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
@@ -1076,7 +1092,7 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
G4double eth = currentModel->LowEnergyLimit();
if(eth > 0.0) {
loweModel = proc->SelectModelForMaterial(eth - CLHEP::eV, idx);
if(loweModel == currentModel) { loweModel = 0; }
if(loweModel == currentModel) { loweModel = nullptr; }
else {
loweModel->InitialiseForMaterial(part, currentMaterial);
loweModel->SetupForMaterial(part, currentMaterial, eth - CLHEP::eV);
@@ -1090,11 +1106,11 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
G4VMultipleScattering* proc = FindMscProcess(part, processName);
if(proc) {
currentModel = proc->SelectModel(kinEnergy, idx);
loweModel = 0;
loweModel = nullptr;
}
}
if(currentModel) {
if(loweModel == currentModel) { loweModel = 0; }
if(loweModel == currentModel) { loweModel = nullptr; }
isApplicable = true;
currentModel->InitialiseForMaterial(part, currentMaterial);
if(loweModel) {
@@ -1122,7 +1138,7 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
const G4ParticleDefinition* p)
{
G4VEnergyLossProcess* elp = 0;
G4VEnergyLossProcess* elp = nullptr;
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.cc 100363 2016-10-19 09:24:47Z gcosmo $
// $Id: G4EmCorrections.cc 103954 2017-05-04 11:29:22Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -135,9 +135,7 @@ G4EmCorrections::G4EmCorrections(G4int verb)
mass = tau = gamma = bg2 = beta2 = beta = ba2 = tmax = charge = q2 = 0.0;
// Constants
theZieglerFactor = CLHEP::eV*CLHEP::cm2*1.0e-15;
alpha2 = CLHEP::fine_structure_const*CLHEP::fine_structure_const;
lossFlucFlag = true;
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
@@ -745,199 +743,6 @@ G4double G4EmCorrections::MottCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearDEDX(const G4ParticleDefinition* p,
const G4Material* mat,
G4double e,
G4bool fluct)
{
G4double nloss = 0.0;
if(e <= 0.0) return nloss;
SetupKinematics(p, mat, e);
lossFlucFlag = fluct;
// Projectile nucleus
G4double z1 = std::abs(particle->GetPDGCharge()*inveplus);
G4double mass1 = mass/amu_c2;
// loop for the elements in the material
for (G4int iel=0; iel<numberOfElements; iel++) {
const G4Element* element = (*theElementVector)[iel] ;
G4double z2 = element->GetZ();
G4double mass2 = element->GetN();
nloss += (NuclearStoppingPower(kinEnergy, z1, z2, mass1, mass2))
* atomDensity[iel] ;
}
nloss *= theZieglerFactor;
return nloss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double z1, G4double z2,
G4double mass1, G4double mass2)
{
G4double energy = kineticEnergy/CLHEP::keV ; // energy in keV
G4double nloss = 0.0;
G4double rm;
if(z1 > 1.5) rm = (mass1 + mass2) * ( g4calc->Z23(G4lrint(z1)) + g4calc->Z23(G4lrint(z2)) ) ;
else rm = (mass1 + mass2) * g4calc->Z13(G4lrint(z2));
G4double er = 32.536 * mass2 * energy / ( z1 * z2 * rm ) ; // reduced energy
static const G4double nuca[104][2] = {
{ 1.0E+8, 5.831E-8},
{ 8.0E+7, 7.288E-8},
{ 6.0E+7, 9.719E-8},
{ 5.0E+7, 1.166E-7},
{ 4.0E+7, 1.457E-7},
{ 3.0E+7, 1.942E-7},
{ 2.0E+7, 2.916E-7},
{ 1.5E+7, 3.887E-7},
{ 1.0E+7, 5.833E-7},
{ 8.0E+6, 7.287E-7},
{ 6.0E+6, 9.712E-7},
{ 5.0E+6, 1.166E-6},
{ 4.0E+6, 1.457E-6},
{ 3.0E+6, 1.941E-6},
{ 2.0E+6, 2.911E-6},
{ 1.5E+6, 3.878E-6},
{ 1.0E+6, 5.810E-6},
{ 8.0E+5, 7.262E-6},
{ 6.0E+5, 9.663E-6},
{ 5.0E+5, 1.157E-5},
{ 4.0E+5, 1.442E-5},
{ 3.0E+5, 1.913E-5},
{ 2.0E+5, 2.845E-5},
{ 1.5E+5, 3.762E-5},
{ 1.0E+5, 5.554E-5},
{ 8.0E+4, 6.866E-5},
{ 6.0E+4, 9.020E-5},
{ 5.0E+4, 1.070E-4},
{ 4.0E+4, 1.319E-4},
{ 3.0E+4, 1.722E-4},
{ 2.0E+4, 2.499E-4},
{ 1.5E+4, 3.248E-4},
{ 1.0E+4, 4.688E-4},
{ 8.0E+3, 5.729E-4},
{ 6.0E+3, 7.411E-4},
{ 5.0E+3, 8.718E-4},
{ 4.0E+3, 1.063E-3},
{ 3.0E+3, 1.370E-3},
{ 2.0E+3, 1.955E-3},
{ 1.5E+3, 2.511E-3},
{ 1.0E+3, 3.563E-3},
{ 8.0E+2, 4.314E-3},
{ 6.0E+2, 5.511E-3},
{ 5.0E+2, 6.430E-3},
{ 4.0E+2, 7.756E-3},
{ 3.0E+2, 9.855E-3},
{ 2.0E+2, 1.375E-2},
{ 1.5E+2, 1.736E-2},
{ 1.0E+2, 2.395E-2},
{ 8.0E+1, 2.850E-2},
{ 6.0E+1, 3.552E-2},
{ 5.0E+1, 4.073E-2},
{ 4.0E+1, 4.802E-2},
{ 3.0E+1, 5.904E-2},
{ 1.5E+1, 9.426E-2},
{ 1.0E+1, 1.210E-1},
{ 8.0E+0, 1.377E-1},
{ 6.0E+0, 1.611E-1},
{ 5.0E+0, 1.768E-1},
{ 4.0E+0, 1.968E-1},
{ 3.0E+0, 2.235E-1},
{ 2.0E+0, 2.613E-1},
{ 1.5E+0, 2.871E-1},
{ 1.0E+0, 3.199E-1},
{ 8.0E-1, 3.354E-1},
{ 6.0E-1, 3.523E-1},
{ 5.0E-1, 3.609E-1},
{ 4.0E-1, 3.693E-1},
{ 3.0E-1, 3.766E-1},
{ 2.0E-1, 3.803E-1},
{ 1.5E-1, 3.788E-1},
{ 1.0E-1, 3.711E-1},
{ 8.0E-2, 3.644E-1},
{ 6.0E-2, 3.530E-1},
{ 5.0E-2, 3.444E-1},
{ 4.0E-2, 3.323E-1},
{ 3.0E-2, 3.144E-1},
{ 2.0E-2, 2.854E-1},
{ 1.5E-2, 2.629E-1},
{ 1.0E-2, 2.298E-1},
{ 8.0E-3, 2.115E-1},
{ 6.0E-3, 1.883E-1},
{ 5.0E-3, 1.741E-1},
{ 4.0E-3, 1.574E-1},
{ 3.0E-3, 1.372E-1},
{ 2.0E-3, 1.116E-1},
{ 1.5E-3, 9.559E-2},
{ 1.0E-3, 7.601E-2},
{ 8.0E-4, 6.668E-2},
{ 6.0E-4, 5.605E-2},
{ 5.0E-4, 5.008E-2},
{ 4.0E-4, 4.352E-2},
{ 3.0E-4, 3.617E-2},
{ 2.0E-4, 2.768E-2},
{ 1.5E-4, 2.279E-2},
{ 1.0E-4, 1.723E-2},
{ 8.0E-5, 1.473E-2},
{ 6.0E-5, 1.200E-2},
{ 5.0E-5, 1.052E-2},
{ 4.0E-5, 8.950E-3},
{ 3.0E-5, 7.246E-3},
{ 2.0E-5, 5.358E-3},
{ 1.5E-5, 4.313E-3},
{ 0.0, 3.166E-3}
};
if (er >= nuca[0][0]) { nloss = nuca[0][1]; }
else {
// the table is inverse in energy
for (G4int i=102; i>=0; --i) {
G4double edi = nuca[i][0];
if (er <= edi) {
G4double edi1 = nuca[i+1][0];
G4double ai = nuca[i][1];
G4double ai1 = nuca[i+1][1];
nloss = (ai - ai1)*(er - edi1)/(edi - edi1) + ai1;
break;
}
}
}
// Stragling
if(lossFlucFlag) {
G4double sig = 4.0 * mass1 * mass2 / ((mass1 + mass2)*(mass1 + mass2)*
(4.0 + 0.197/(er*er) + 6.584/er));
nloss *= G4RandGauss::shoot(1.0,sig) ;
}
nloss *= 8.462 * z1 * z2 * mass1 / rm ; // Return to [ev/(10^15 atoms/cm^2]
nloss = std::max(nloss, 0.0);
return nloss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
@@ -62,6 +62,10 @@
G4EmParameters* G4EmParameters::theInstance = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4EmParameters::emParametersMutex = G4MUTEX_INITIALIZER;
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4EmParameters* G4EmParameters::Instance()
@@ -139,6 +143,7 @@ void G4EmParameters::Initialise()
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
factorScreen = 1.0;
nbins = 77;
nbinsPerDecade = 7;
@@ -356,12 +361,17 @@ G4bool G4EmParameters::Integral() 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
}
G4bool G4EmParameters::BirksActive() const
@@ -374,6 +384,7 @@ void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
if(emSaturation != ptr) {
delete emSaturation;
emSaturation = ptr;
SetBirksActive(true);
}
}
@@ -655,6 +666,24 @@ G4double G4EmParameters::MscSkin() const
return skin;
}
void G4EmParameters::SetScreeningFactor(G4double val)
{
if(IsLocked()) { return; }
if(val > 0.0) {
factorScreen = val;
} else {
G4ExceptionDescription ed;
ed << "Value of factorScreen is out of range: "
<< val << " is ignored";
PrintWarning(ed);
}
}
G4double G4EmParameters::ScreeningFactor() const
{
return factorScreen;
}
void G4EmParameters::SetStepFunction(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
@@ -912,6 +941,27 @@ const std::vector<G4String>& G4EmParameters::TypesMsc() const
return m_typesMsc;
}
void G4EmParameters::AddPhysics(const G4String& region, const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesMsc.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesMsc[i]) { return; }
}
m_regnamesMsc.push_back(r);
m_typesMsc.push_back(type);
}
const std::vector<G4String>& G4EmParameters::RegionsPhysics() const
{
return m_regnamesMsc;
}
const std::vector<G4String>& G4EmParameters::TypesPhysics() const
{
return m_typesMsc;
}
void G4EmParameters::SetSubCutoff(G4bool val, const G4String& region)
{
if(IsLocked()) { return; }
@@ -1175,6 +1225,7 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Range factor for msc step limit for muons/hadrons " <<rangeFactorMuHad << "\n";
os << "Geometry factor for msc step limitation of e+- " <<geomFactor << "\n";
os << "Skin parameter for msc step limitation of e+- " <<skin << "\n";
os << "Screening factor " <<factorScreen << "\n";
os << "Step function for e+- " <<"("<< dRoverRange
<< ", " << finalRange << " mm)\n";
os << "Step function for muons/hadrons " <<"("<< dRoverRangeMuHad
@@ -275,6 +275,11 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
skinCmd->SetParameterName("skin",true);
skinCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
screCmd = new G4UIcmdWithADouble("/process/msc/ScreeningFactor",this);
screCmd->SetGuidance("Set screening factor");
screCmd->SetParameterName("screen",true);
screCmd->AvailableForStates(G4State_Idle);
dedxCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsDEDX",this);
dedxCmd->SetGuidance("Set number of bins for EM tables");
dedxCmd->SetParameterName("binsDEDX",true);
@@ -565,6 +570,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete fr1Cmd;
delete fgCmd;
delete skinCmd;
delete screCmd;
delete dedxCmd;
delete lamCmd;
@@ -698,6 +704,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == skinCmd) {
theParameters->SetMscSkin(skinCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == screCmd) {
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
} else if (command == dedxCmd) {
theParameters->SetNumberOfBins(dedxCmd->GetNewIntValue(newValue));
@@ -758,7 +766,7 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
G4String s1(""),s2("");
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddMsc(s1, s2);
theParameters->AddPhysics(s1, s2);
} else if (command == dumpCmd) {
theParameters->Dump();
} else if (command == SubSecCmd) {
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmSaturation.cc 100346 2016-10-18 15:30:36Z gcosmo $
// $Id: G4EmSaturation.cc 104372 2017-05-29 09:55:44Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -231,7 +231,7 @@ void G4EmSaturation::InitialiseBirksCoefficient(const G4Material* mat)
void G4EmSaturation::DumpBirksCoefficients()
{
G4cout << "### Birks coeffitients used in run time" << G4endl;
G4cout << "### Birks coefficients used in run time" << G4endl;
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
for(G4int i=0; i<nMaterials; ++i) {
const G4Material* mat = (*mtable)[i];
@@ -251,7 +251,7 @@ void G4EmSaturation::DumpBirksCoefficients()
void G4EmSaturation::DumpG4BirksCoefficients()
{
if(nG4Birks > 0) {
G4cout << "### Birks coeffitients for Geant4 materials" << G4endl;
G4cout << "### Birks coefficients for Geant4 materials" << G4endl;
for(G4int i=0; i<nG4Birks; ++i) {
G4cout << " " << g4MatNames[i] << " "
<< g4MatData[i]*MeV/mm << " mm/MeV" << G4endl;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc 97742 2016-06-08 09:24:54Z gcosmo $
// $Id: G4VEmModel.cc 104457 2017-05-31 15:52:37Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -70,9 +70,11 @@ G4VEmModel::G4VEmModel(const G4String& nam):
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),
theDensityFactor(nullptr),theDensityIdx(nullptr),fCurrentCouple(nullptr),
fCurrentElement(nullptr),fCurrentIsotope(nullptr),nsec(5)
isMaster(true),fElementData(nullptr),pParticleChange(nullptr),
xSectionTable(nullptr),theDensityFactor(nullptr),theDensityIdx(nullptr),
lossFlucFlag(true),fCurrentCouple(nullptr),
fCurrentElement(nullptr),fCurrentIsotope(nullptr),
fTripletModel(nullptr),nsec(5)
{
xsec.resize(nsec);
nSelectors = 0;
@@ -124,6 +126,7 @@ G4ParticleChangeForLoss* G4VEmModel::GetParticleChangeForLoss()
p = new G4ParticleChangeForLoss();
pParticleChange = p;
}
if(fTripletModel) { fTripletModel->SetParticleChange(p); }
return p;
}
@@ -138,6 +141,7 @@ G4ParticleChangeForGamma* G4VEmModel::GetParticleChangeForGamma()
p = new G4ParticleChangeForGamma();
pParticleChange = p;
}
if(fTripletModel) { fTripletModel->SetParticleChange(p); }
return p;
}
@@ -418,7 +422,7 @@ void
G4VEmModel::SetParticleChange(G4VParticleChange* p, G4VEmFluctuationModel* f)
{
if(p && pParticleChange != p) { pParticleChange = p; }
flucModel = f;
if(flucModel != f) { flucModel = f; }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc 98778 2016-08-09 14:41:08Z gcosmo $
// $Id: G4VEmProcess.cc 104349 2017-05-26 07:18:59Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -149,9 +149,17 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
lManager->Register(this);
secID = fluoID = augerID = biasID = -1;
mainSecondaries = 100;
if("phot" == GetProcessName() || "compt" == GetProcessName()) {
mainSecondaries = 1;
}
if("phot" == GetProcessName() || "compt" == GetProcessName()
|| "e-_G4DNAIonisation" == GetProcessName()
|| "hydrogen_G4DNAIonisation" == GetProcessName()
|| "helium_G4DNAIonisation" == GetProcessName()
|| "alpha_G4DNAIonisation" == GetProcessName()
|| "alpha+_G4DNAIonisation" == GetProcessName()
|| "proton_G4DNAIonisation" == GetProcessName()
|| "GenericIon_G4DNAIonisation" == GetProcessName() )
{
mainSecondaries = 1;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -361,13 +369,15 @@ void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
}
// defined ID of secondary particles
G4String nam1 = GetProcessName();
G4String nam2 = nam1 + "_fluo" ;
G4String nam3 = nam1 + "_auger";
G4String nam4 = nam1 + "_split";
secID = G4PhysicsModelCatalog::Register(nam1);
fluoID = G4PhysicsModelCatalog::Register(nam2);
augerID = G4PhysicsModelCatalog::Register(nam3);
biasID = G4PhysicsModelCatalog::Register(nam4);
if(100 > mainSecondaries) {
G4String nam2 = nam1 + "_fluo" ;
G4String nam3 = nam1 + "_auger";
G4String nam4 = nam1 + "_split";
fluoID = G4PhysicsModelCatalog::Register(nam2);
augerID = G4PhysicsModelCatalog::Register(nam3);
biasID = G4PhysicsModelCatalog::Register(nam4);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -846,9 +856,12 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
} else {
t->SetCreatorModelIndex(biasID);
}
//G4cout << "Secondary(post step) has weight " << t->GetWeight()
// << ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV" <<G4endl;
/*
G4cout << "Secondary(post step) has weight " << t->GetWeight()
<< ", Ekin= " << t->GetKineticEnergy()/MeV << " MeV "
<< GetProcessName() << " fluoID= " << fluoID
<< " augerID= " << augerID <<G4endl;
*/
} else {
delete dp;
edep += e;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc 98778 2016-08-09 14:41:08Z gcosmo $
// $Id: G4VEnergyLossProcess.cc 104349 2017-05-26 07:18:59Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -1295,7 +1295,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
atomDeexcitation->AlongStepDeexcitation(scTracks, step,
eloss, currentCoupleIndex);
if(scTracks.size() > 0) { FillSecondariesAlongStep(eloss, weight); }
if(eloss < 0.0) { eloss = 0.0; }
eloss = std::max(eloss, 0.0);
}
fParticleChange.SetProposedKineticEnergy(0.0);
fParticleChange.ProposeLocalEnergyDeposit(eloss);