Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4EmCalculator Class Reference

#include <G4EmCalculator.hh>

Public Member Functions

G4double ComputeCrossSectionPerAtom (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
 
G4double ComputeCrossSectionPerAtom (G4double kinEnergy, const G4String &part, const G4String &processName, const G4Element *, G4double cut=0.0)
 
G4double ComputeCrossSectionPerShell (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4int Z, G4int shellIdx, G4double cut=0.0)
 
G4double ComputeCrossSectionPerShell (G4double kinEnergy, const G4String &part, const G4String &processName, const G4Element *, G4int shellIdx, G4double cut=0.0)
 
G4double ComputeCrossSectionPerVolume (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
 
G4double ComputeCrossSectionPerVolume (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, G4double cut=0.0)
 
G4double ComputeDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
 
G4double ComputeDEDX (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, G4double cut=DBL_MAX)
 
G4double ComputeDEDXForCutInRange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double rangecut=DBL_MAX)
 
G4double ComputeDEDXForCutInRange (G4double kinEnergy, const G4String &part, const G4String &mat, G4double rangecut=DBL_MAX)
 
G4double ComputeElectronicDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)
 
G4double ComputeElectronicDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, G4double cut=DBL_MAX)
 
G4double ComputeEnergyCutFromRangeCut (G4double range, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeEnergyCutFromRangeCut (G4double range, const G4String &, const G4String &)
 
G4double ComputeGammaAttenuationLength (G4double kinEnergy, const G4Material *)
 
G4double ComputeMeanFreePath (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
 
G4double ComputeMeanFreePath (G4double kinEnergy, const G4String &, const G4String &, const G4String &processName, G4double cut=0.0)
 
G4double ComputeNuclearDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeNuclearDEDX (G4double kinEnergy, const G4String &part, const G4String &mat)
 
G4double ComputeShellIonisationCrossSectionPerAtom (const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy, const G4Material *mat=nullptr)
 
G4double ComputeTotalDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
 
G4double ComputeTotalDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, G4double cut=DBL_MAX)
 
const G4MaterialCutsCoupleFindCouple (const G4Material *, const G4Region *r=nullptr)
 
const G4ParticleDefinitionFindIon (G4int Z, G4int A)
 
const G4MaterialFindMaterial (const G4String &)
 
const G4ParticleDefinitionFindParticle (const G4String &)
 
G4VProcessFindProcess (const G4ParticleDefinition *part, const G4String &processName)
 
const G4RegionFindRegion (const G4String &)
 
 G4EmCalculator ()
 
 G4EmCalculator (const G4EmCalculator &)=delete
 
G4double GetCrossSectionPerVolume (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
 
G4double GetCrossSectionPerVolume (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, const G4String &s="world")
 
G4double GetCSDARange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetCSDARange (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetKinEnergy (G4double range, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetKinEnergy (G4double range, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetMeanFreePath (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
 
G4double GetMeanFreePath (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, const G4String &s="world")
 
G4double GetRange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetRange (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetRangeFromRestricteDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetRangeFromRestricteDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetShellIonisationCrossSectionPerAtom (const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy)
 
G4EmCalculatoroperator= (const G4EmCalculator &right)=delete
 
void PrintDEDXTable (const G4ParticleDefinition *)
 
void PrintInverseRangeTable (const G4ParticleDefinition *)
 
void PrintRangeTable (const G4ParticleDefinition *)
 
void SetupMaterial (const G4Material *)
 
void SetupMaterial (const G4String &)
 
void SetVerbose (G4int val)
 
 ~G4EmCalculator ()
 

Private Member Functions

G4bool ActiveForParticle (const G4ParticleDefinition *part, G4VProcess *proc)
 
void CheckMaterial (G4int Z)
 
G4VEmProcessFindDiscreteProcess (const G4ParticleDefinition *, const G4String &processName)
 
G4bool FindEmModel (const G4ParticleDefinition *, const G4String &processName, G4double kinEnergy)
 
G4VEnergyLossProcessFindEnergyLossProcess (const G4ParticleDefinition *)
 
G4VEnergyLossProcessFindEnLossProcess (const G4ParticleDefinition *, const G4String &processName)
 
void FindLambdaTable (const G4ParticleDefinition *, const G4String &processName, G4double kinEnergy, G4int &proctype)
 
G4VMultipleScatteringFindMscProcess (const G4ParticleDefinition *, const G4String &processName)
 
G4bool UpdateCouple (const G4Material *, G4double cut)
 
G4bool UpdateParticle (const G4ParticleDefinition *, G4double kinEnergy)
 

Private Attributes

const G4ParticleDefinitionbaseParticle = nullptr
 
G4double chargeSquare = 1.0
 
G4EmCorrectionscorr
 
G4VProcesscurProcess = nullptr
 
const G4MaterialCutsCouplecurrentCouple = nullptr
 
G4int currentCoupleIndex = 0
 
G4double currentCut = DBL_MAX
 
const G4PhysicsTablecurrentLambda = nullptr
 
const G4MaterialcurrentMaterial = nullptr
 
G4String currentMaterialName = ""
 
G4VEmModelcurrentModel = nullptr
 
G4String currentName = ""
 
const G4ParticleDefinitioncurrentParticle = nullptr
 
G4String currentParticleName = ""
 
G4VEnergyLossProcesscurrentProcess = nullptr
 
G4String currentProcessName = ""
 
G4double cutenergy [3]
 
const G4MaterialcutMaterial = nullptr
 
G4DynamicParticledynParticle = nullptr
 
G4ionEffectiveChargeionEffCharge
 
G4IonTableionTable
 
G4bool isApplicable = false
 
G4bool isIon = false
 
G4String lambdaName = ""
 
const G4ParticleDefinitionlambdaParticle = nullptr
 
std::vector< const G4MaterialCutsCouple * > localCouples
 
std::vector< G4doublelocalCuts
 
std::vector< const G4Material * > localMaterials
 
G4VEmModelloweModel = nullptr
 
G4LossTableManagermanager
 
G4double mass = 0
 
G4double massRatio = 1.0
 
G4NistManagernist
 
G4int nLocalMaterials = 0
 
const G4ParticleDefinitiontheGenericIon
 
G4EmParameterstheParameters
 
G4int verbose = 0
 

Detailed Description

Definition at line 79 of file G4EmCalculator.hh.

Constructor & Destructor Documentation

◆ G4EmCalculator() [1/2]

G4EmCalculator::G4EmCalculator ( )

Definition at line 75 of file G4EmCalculator.cc.

76{
81 cutenergy[0] = cutenergy[1] = cutenergy[2] = DBL_MAX;
86}
const G4ParticleDefinition * theGenericIon
G4double cutenergy[3]
G4LossTableManager * manager
G4EmParameters * theParameters
G4EmCorrections * corr
G4DynamicParticle * dynParticle
G4IonTable * ionTable
G4ionEffectiveCharge * ionEffCharge
G4NistManager * nist
static G4EmParameters * Instance()
static G4GenericIon * GenericIon()
Definition: G4GenericIon.cc:92
static G4LossTableManager * Instance()
G4EmCorrections * EmCorrections()
static G4NistManager * Instance()
G4IonTable * GetIonTable() const
static G4ParticleTable * GetParticleTable()
#define DBL_MAX
Definition: templates.hh:62

References corr, cutenergy, DBL_MAX, dynParticle, G4LossTableManager::EmCorrections(), G4GenericIon::GenericIon(), G4ParticleTable::GetIonTable(), G4ParticleTable::GetParticleTable(), G4NistManager::Instance(), G4EmParameters::Instance(), G4LossTableManager::Instance(), ionEffCharge, ionTable, manager, nist, theGenericIon, and theParameters.

◆ ~G4EmCalculator()

G4EmCalculator::~G4EmCalculator ( )

Definition at line 90 of file G4EmCalculator.cc.

91{
92 delete ionEffCharge;
93 delete dynParticle;
94 for (G4int i=0; i<nLocalMaterials; ++i) {
95 delete localCouples[i];
96 }
97}
int G4int
Definition: G4Types.hh:85
std::vector< const G4MaterialCutsCouple * > localCouples

References dynParticle, ionEffCharge, localCouples, and nLocalMaterials.

◆ G4EmCalculator() [2/2]

G4EmCalculator::G4EmCalculator ( const G4EmCalculator )
delete

Member Function Documentation

◆ ActiveForParticle()

G4bool G4EmCalculator::ActiveForParticle ( const G4ParticleDefinition part,
G4VProcess proc 
)
private

Definition at line 1222 of file G4EmCalculator.cc.

1224{
1225 G4ProcessManager* pm = part->GetProcessManager();
1226 G4ProcessVector* pv = pm->GetProcessList();
1227 G4int n = pv->size();
1228 G4bool res = false;
1229 for(G4int i=0; i<n; ++i) {
1230 if((*pv)[i] == proc) {
1231 if(pm->GetProcessActivation(i)) { res = true; }
1232 break;
1233 }
1234 }
1235 return res;
1236}
bool G4bool
Definition: G4Types.hh:86
G4ProcessManager * GetProcessManager() const
G4bool GetProcessActivation(G4VProcess *aProcess) const
G4ProcessVector * GetProcessList() const
std::size_t size() const

References G4ProcessManager::GetProcessActivation(), G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), CLHEP::detail::n, and G4ProcessVector::size().

Referenced by ComputeDEDXForCutInRange(), ComputeElectronicDEDX(), FindDiscreteProcess(), FindEnLossProcess(), and FindMscProcess().

◆ CheckMaterial()

void G4EmCalculator::CheckMaterial ( G4int  Z)
private

Definition at line 1260 of file G4EmCalculator.cc.

1261{
1262 G4bool isFound = false;
1263 if(currentMaterial) {
1265 for(size_t i=0; i<nn; ++i) {
1266 if(Z == currentMaterial->GetElement(i)->GetZasInt()) {
1267 isFound = true;
1268 break;
1269 }
1270 }
1271 }
1272 if(!isFound) {
1274 }
1275}
const G4int Z[17]
G4int GetZasInt() const
Definition: G4Element.hh:132
const G4Material * currentMaterial
void SetupMaterial(const G4Material *)
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:198
size_t GetNumberOfElements() const
Definition: G4Material.hh:182
G4Material * FindOrBuildSimpleMaterial(G4int Z, G4bool warning=false)

References currentMaterial, G4NistManager::FindOrBuildSimpleMaterial(), G4Material::GetElement(), G4Material::GetNumberOfElements(), G4Element::GetZasInt(), nist, G4InuclParticleNames::nn, SetupMaterial(), and Z.

Referenced by ComputeCrossSectionPerAtom(), and ComputeCrossSectionPerShell().

◆ ComputeCrossSectionPerAtom() [1/2]

G4double G4EmCalculator::ComputeCrossSectionPerAtom ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
G4double  Z,
G4double  A,
G4double  cut = 0.0 
)

Definition at line 618 of file G4EmCalculator.cc.

624{
625 G4double res = 0.0;
626 if(UpdateParticle(p, kinEnergy)) {
627 G4int iz = G4lrint(Z);
628 CheckMaterial(iz);
629 if(FindEmModel(p, processName, kinEnergy)) {
630 G4double e = kinEnergy;
632 if(baseParticle) {
633 e *= kinEnergy*massRatio;
636 baseParticle, e, Z, A, aCut) * chargeSquare;
637 } else {
639 res = currentModel->ComputeCrossSectionPerAtom(p, e, Z, A, aCut);
640 }
641 if(verbose>0) {
642 G4cout << "E(MeV)= " << kinEnergy/MeV
643 << " cross(barn)= " << res/barn
644 << " " << p->GetParticleName()
645 << " Z= " << Z << " A= " << A/(g/mole) << " g/mole"
646 << " cut(keV)= " << aCut/keV
647 << G4endl;
648 }
649 }
650 }
651 return res;
652}
static constexpr double mole
Definition: G4SIunits.hh:279
static constexpr double barn
Definition: G4SIunits.hh:85
static constexpr double keV
Definition: G4SIunits.hh:202
static constexpr double g
Definition: G4SIunits.hh:168
static constexpr double MeV
Definition: G4SIunits.hh:200
double G4double
Definition: G4Types.hh:83
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4bool UpdateParticle(const G4ParticleDefinition *, G4double kinEnergy)
G4bool FindEmModel(const G4ParticleDefinition *, const G4String &processName, G4double kinEnergy)
G4VEmModel * currentModel
void CheckMaterial(G4int Z)
G4double chargeSquare
const G4ParticleDefinition * baseParticle
G4double LowestElectronEnergy() const
const G4String & GetParticleName() const
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:341
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
Definition: G4VEmModel.cc:223
T max(const T t1, const T t2)
brief Return the largest of the two arguments
int G4lrint(double ad)
Definition: templates.hh:134

References A, barn, baseParticle, chargeSquare, CheckMaterial(), G4VEmModel::ComputeCrossSectionPerAtom(), currentModel, FindEmModel(), g, G4cout, G4endl, G4lrint(), G4ParticleDefinition::GetParticleName(), G4VEmModel::InitialiseForElement(), keV, G4EmParameters::LowestElectronEnergy(), massRatio, G4INCL::Math::max(), MeV, mole, theParameters, UpdateParticle(), verbose, and Z.

Referenced by RunAction::BeginOfRunAction(), and ComputeCrossSectionPerAtom().

◆ ComputeCrossSectionPerAtom() [2/2]

G4double G4EmCalculator::ComputeCrossSectionPerAtom ( G4double  kinEnergy,
const G4String part,
const G4String processName,
const G4Element elm,
G4double  cut = 0.0 
)
inline

Definition at line 507 of file G4EmCalculator.hh.

512{
513 return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),
514 processName,
515 elm->GetZ(),elm->GetN(),cut);
516}
G4double GetZ() const
Definition: G4Element.hh:131
G4double GetN() const
Definition: G4Element.hh:135
const G4ParticleDefinition * FindParticle(const G4String &)
G4double ComputeCrossSectionPerAtom(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)

References ComputeCrossSectionPerAtom(), FindParticle(), G4Element::GetN(), and G4Element::GetZ().

◆ ComputeCrossSectionPerShell() [1/2]

G4double G4EmCalculator::ComputeCrossSectionPerShell ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
G4int  Z,
G4int  shellIdx,
G4double  cut = 0.0 
)

Definition at line 656 of file G4EmCalculator.cc.

661{
662 G4double res = 0.0;
663 if(UpdateParticle(p, kinEnergy)) {
665 if(FindEmModel(p, processName, kinEnergy)) {
666 G4double e = kinEnergy;
668 if(baseParticle) {
669 e *= kinEnergy*massRatio;
672 e, aCut) * chargeSquare;
673 } else {
675 res = currentModel->ComputeCrossSectionPerAtom(p, Z, shellIdx, e, aCut);
676 }
677 if(verbose>0) {
678 G4cout << "E(MeV)= " << kinEnergy/MeV
679 << " cross(barn)= " << res/barn
680 << " " << p->GetParticleName()
681 << " Z= " << Z << " shellIdx= " << shellIdx
682 << " cut(keV)= " << aCut/keV
683 << G4endl;
684 }
685 }
686 }
687 return res;
688}
virtual G4double ComputeCrossSectionPerShell(const G4ParticleDefinition *, G4int Z, G4int shellIdx, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:351

References barn, baseParticle, chargeSquare, CheckMaterial(), G4VEmModel::ComputeCrossSectionPerAtom(), G4VEmModel::ComputeCrossSectionPerShell(), currentModel, FindEmModel(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4VEmModel::InitialiseForElement(), keV, G4EmParameters::LowestElectronEnergy(), massRatio, G4INCL::Math::max(), MeV, theParameters, UpdateParticle(), verbose, and Z.

Referenced by ComputeCrossSectionPerShell().

◆ ComputeCrossSectionPerShell() [2/2]

G4double G4EmCalculator::ComputeCrossSectionPerShell ( G4double  kinEnergy,
const G4String part,
const G4String processName,
const G4Element elm,
G4int  shellIdx,
G4double  cut = 0.0 
)
inline

Definition at line 520 of file G4EmCalculator.hh.

524{
525 return ComputeCrossSectionPerShell(kinEnergy, FindParticle(part),
526 processName, elm->GetZasInt(),
527 shellIdx, cut);
528}
G4double ComputeCrossSectionPerShell(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4int Z, G4int shellIdx, G4double cut=0.0)

References ComputeCrossSectionPerShell(), FindParticle(), and G4Element::GetZasInt().

◆ ComputeCrossSectionPerVolume() [1/2]

G4double G4EmCalculator::ComputeCrossSectionPerVolume ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
const G4Material mat,
G4double  cut = 0.0 
)

Definition at line 583 of file G4EmCalculator.cc.

589{
590 SetupMaterial(mat);
591 G4double res = 0.0;
592 if(UpdateParticle(p, kinEnergy)) {
593 if(FindEmModel(p, processName, kinEnergy)) {
594 G4double e = kinEnergy;
596 if(baseParticle) {
597 e *= kinEnergy*massRatio;
599 mat, baseParticle, e, aCut, e) * chargeSquare;
600 } else {
601 res = currentModel->CrossSectionPerVolume(mat, p, e, aCut, e);
602 }
603 if(verbose>0) {
604 G4cout << "G4EmCalculator::ComputeXSPerVolume: E(MeV)= " << kinEnergy/MeV
605 << " cross(cm-1)= " << res*cm
606 << " cut(keV)= " << aCut/keV
607 << " " << p->GetParticleName()
608 << " in " << mat->GetName()
609 << G4endl;
610 }
611 }
612 }
613 return res;
614}
static constexpr double cm
Definition: G4SIunits.hh:99
const G4String & GetName() const
Definition: G4Material.hh:173
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:237

References baseParticle, chargeSquare, cm, G4VEmModel::CrossSectionPerVolume(), currentModel, FindEmModel(), G4cout, G4endl, G4Material::GetName(), G4ParticleDefinition::GetParticleName(), keV, G4EmParameters::LowestElectronEnergy(), massRatio, G4INCL::Math::max(), MeV, SetupMaterial(), theParameters, UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), ComputeCrossSectionPerVolume(), ComputeGammaAttenuationLength(), ComputeMeanFreePath(), and GetCrossSectionPerVolume().

◆ ComputeCrossSectionPerVolume() [2/2]

G4double G4EmCalculator::ComputeCrossSectionPerVolume ( G4double  kinEnergy,
const G4String part,
const G4String proc,
const G4String mat,
G4double  cut = 0.0 
)
inline

Definition at line 492 of file G4EmCalculator.hh.

498{
499 return ComputeCrossSectionPerVolume(kinEnergy,FindParticle(particle),
500 processName,
502}
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
const G4Material * FindMaterial(const G4String &)
string material
Definition: eplot.py:19

References ComputeCrossSectionPerVolume(), FindMaterial(), FindParticle(), and eplot::material.

◆ ComputeDEDX() [1/2]

G4double G4EmCalculator::ComputeDEDX ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
const G4Material mat,
G4double  cut = DBL_MAX 
)

Definition at line 351 of file G4EmCalculator.cc.

356{
357 SetupMaterial(mat);
358 G4double res = 0.0;
359 if(verbose > 1) {
360 G4cout << "### G4EmCalculator::ComputeDEDX: " << p->GetParticleName()
361 << " in " << currentMaterialName
362 << " e(MeV)= " << kinEnergy/MeV << " cut(MeV)= " << cut/MeV
363 << G4endl;
364 }
365 if(UpdateParticle(p, kinEnergy)) {
366 if(FindEmModel(p, processName, kinEnergy)) {
367
368 // Special case of ICRU'73 model
369 const G4String& mname = currentModel->GetName();
370 if(mname == "ParamICRU73" || mname == "LinhardSorensen" || mname == "Atima") {
371 res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
372 if(verbose > 1) {
373 G4cout << mname << " ion E(MeV)= " << kinEnergy << " ";
374 G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
375 << " DEDX(MeV*cm^2/g)= "
376 << res*gram/(MeV*cm2*mat->GetDensity())
377 << G4endl;
378 }
379 } else {
380
381 G4double escaled = kinEnergy*massRatio;
382 if(baseParticle) {
384 mat, baseParticle, escaled, cut) * chargeSquare;
385 if(verbose > 1) {
387 << " Escaled(MeV)= " << escaled;
388 }
389 } else {
390 res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
391 if(verbose > 1) { G4cout << " no basePart E(MeV)= " << kinEnergy << " "; }
392 }
393 if(verbose > 1) {
394 G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
395 << " DEDX(MeV*cm^2/g)= "
396 << res*gram/(MeV*cm2*mat->GetDensity())
397 << G4endl;
398 }
399
400 // emulate smoothing procedure
402 // G4cout << "massRatio= " << massRatio << " eth= " << eth << G4endl;
403 if(loweModel) {
404 G4double res0 = 0.0;
405 G4double res1 = 0.0;
406 if(baseParticle) {
407 res1 = currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut)
408 * chargeSquare;
409 res0 = loweModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut)
410 * chargeSquare;
411 } else {
412 res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
413 res0 = loweModel->ComputeDEDXPerVolume(mat, p, eth, cut);
414 }
415 if(verbose > 1) {
416 G4cout << "At boundary energy(MeV)= " << eth/MeV
417 << " DEDX(MeV/mm)= " << res1*mm/MeV
418 << G4endl;
419 }
420
421 //G4cout << "eth= " << eth << " escaled= " << escaled
422 // << " res0= " << res0 << " res1= "
423 // << res1 << " q2= " << chargeSquare << G4endl;
424
425 if(res1 > 0.0 && escaled > 0.0) {
426 res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
427 }
428 }
429
430 // low energy correction for ions
431 if(isIon) {
432 G4double length = CLHEP::nm;
433 const G4Region* r = 0;
434 const G4MaterialCutsCouple* couple = FindCouple(mat, r);
435 G4double eloss = res*length;
436 dynParticle->SetKineticEnergy(kinEnergy);
437 currentModel->GetChargeSquareRatio(p, mat, kinEnergy);
438 currentModel->CorrectionsAlongStep(couple,dynParticle,length,eloss);
439 res = eloss/length;
440
441 if(verbose > 1) {
442 G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
443 << " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
444 << G4endl;
445 }
446 }
447 }
448 }
449 if(verbose > 0) {
450 G4cout << "Sum: E(MeV)= " << kinEnergy/MeV
451 << " DEDX(MeV/mm)= " << res*mm/MeV
452 << " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
453 << " cut(MeV)= " << cut/MeV
454 << " " << p->GetParticleName()
455 << " in " << currentMaterialName
456 << " Zi^2= " << chargeSquare
457 << " isIon=" << isIon
458 << G4endl;
459 }
460 }
461 return res;
462}
static constexpr double gram
Definition: G4SIunits.hh:163
static constexpr double cm2
Definition: G4SIunits.hh:100
static constexpr double mm
Definition: G4SIunits.hh:95
void SetKineticEnergy(G4double aEnergy)
G4VEmModel * loweModel
G4String currentMaterialName
const G4MaterialCutsCouple * FindCouple(const G4Material *, const G4Region *r=nullptr)
G4double GetDensity() const
Definition: G4Material.hh:176
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:662
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, const G4double &length, G4double &eloss)
Definition: G4VEmModel.cc:399
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
Definition: G4VEmModel.cc:382
const G4String & GetName() const
Definition: G4VEmModel.hh:837
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
Definition: G4VEmModel.cc:228
static constexpr double nm
Definition: SystemOfUnits.h:93

References baseParticle, chargeSquare, cm2, G4VEmModel::ComputeDEDXPerVolume(), G4VEmModel::CorrectionsAlongStep(), currentMaterialName, currentModel, dynParticle, FindCouple(), FindEmModel(), G4cout, G4endl, G4VEmModel::GetChargeSquareRatio(), G4Material::GetDensity(), G4VEmModel::GetName(), G4ParticleDefinition::GetParticleName(), gram, isIon, loweModel, G4VEmModel::LowEnergyLimit(), massRatio, MeV, mm, CLHEP::nm, G4DynamicParticle::SetKineticEnergy(), SetupMaterial(), UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), ComputeDEDX(), ComputeDEDXForCutInRange(), ComputeElectronicDEDX(), and RunAction::CriticalEnergy().

◆ ComputeDEDX() [2/2]

G4double G4EmCalculator::ComputeDEDX ( G4double  kinEnergy,
const G4String part,
const G4String proc,
const G4String mat,
G4double  cut = DBL_MAX 
)
inline

Definition at line 468 of file G4EmCalculator.hh.

473{
474 return ComputeDEDX(kinEnergy,FindParticle(particle),processName,
476}
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)

References ComputeDEDX(), FindMaterial(), FindParticle(), and eplot::material.

◆ ComputeDEDXForCutInRange() [1/2]

G4double G4EmCalculator::ComputeDEDXForCutInRange ( G4double  kinEnergy,
const G4ParticleDefinition part,
const G4Material mat,
G4double  rangecut = DBL_MAX 
)

Definition at line 499 of file G4EmCalculator.cc.

503{
504 SetupMaterial(mat);
505 G4double dedx = 0.0;
506 if(UpdateParticle(part, kinEnergy)) {
507
509 const std::vector<G4VEnergyLossProcess*> vel =
510 lManager->GetEnergyLossProcessVector();
511 G4int n = vel.size();
512
513 if(mat != cutMaterial) {
514 cutMaterial = mat;
518 }
519
520 //G4cout << "ComputeElectronicDEDX for " << part->GetParticleName()
521 // << " n= " << n << G4endl;
522
523 for(G4int i=0; i<n; ++i) {
524 if(vel[i]) {
525 G4VProcess* p = reinterpret_cast<G4VProcess*>(vel[i]);
526 if(ActiveForParticle(part, p)) {
527 //G4cout << "idx= " << i << " " << (vel[i])->GetProcessName()
528 // << " " << (vel[i])->Particle()->GetParticleName() << G4endl;
529 const G4ParticleDefinition* sec = (vel[i])->SecondaryParticle();
530 G4int idx = 0;
531 if(sec == G4Electron::Electron()) { idx = 1; }
532 else if(sec == G4Positron::Positron()) { idx = 2; }
533
534 dedx += ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),
535 mat,cutenergy[idx]);
536 }
537 }
538 }
539 }
540 return dedx;
541}
static G4Electron * Electron()
Definition: G4Electron.cc:93
G4double ComputeEnergyCutFromRangeCut(G4double range, const G4ParticleDefinition *, const G4Material *)
G4bool ActiveForParticle(const G4ParticleDefinition *part, G4VProcess *proc)
const G4Material * cutMaterial
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
const std::vector< G4VEnergyLossProcess * > & GetEnergyLossProcessVector()
static G4Positron * Positron()
Definition: G4Positron.cc:93

References ActiveForParticle(), ComputeDEDX(), ComputeEnergyCutFromRangeCut(), cutenergy, cutMaterial, G4Electron::Electron(), G4Gamma::Gamma(), G4LossTableManager::GetEnergyLossProcessVector(), G4LossTableManager::Instance(), CLHEP::detail::n, G4Positron::Positron(), SetupMaterial(), and UpdateParticle().

Referenced by ComputeDEDXForCutInRange().

◆ ComputeDEDXForCutInRange() [2/2]

G4double G4EmCalculator::ComputeDEDXForCutInRange ( G4double  kinEnergy,
const G4String part,
const G4String mat,
G4double  rangecut = DBL_MAX 
)
inline

Definition at line 445 of file G4EmCalculator.hh.

449{
450 return ComputeDEDXForCutInRange(kinEnergy,FindParticle(part),
451 FindMaterial(mat), rangecut);
452}
G4double ComputeDEDXForCutInRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double rangecut=DBL_MAX)

References ComputeDEDXForCutInRange(), FindMaterial(), and FindParticle().

◆ ComputeElectronicDEDX() [1/2]

G4double G4EmCalculator::ComputeElectronicDEDX ( G4double  kinEnergy,
const G4ParticleDefinition part,
const G4Material mat,
G4double  cut = DBL_MAX 
)

Definition at line 466 of file G4EmCalculator.cc.

470{
471 SetupMaterial(mat);
472 G4double dedx = 0.0;
473 if(UpdateParticle(part, kinEnergy)) {
474
476 const std::vector<G4VEnergyLossProcess*> vel =
477 lManager->GetEnergyLossProcessVector();
478 G4int n = vel.size();
479
480 //G4cout << "ComputeElectronicDEDX for " << part->GetParticleName()
481 // << " n= " << n << G4endl;
482
483 for(G4int i=0; i<n; ++i) {
484 if(vel[i]) {
485 G4VProcess* p = reinterpret_cast<G4VProcess*>(vel[i]);
486 if(ActiveForParticle(part, p)) {
487 //G4cout << "idx= " << i << " " << (vel[i])->GetProcessName()
488 // << " " << (vel[i])->Particle()->GetParticleName() << G4endl;
489 dedx += ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),mat,cut);
490 }
491 }
492 }
493 }
494 return dedx;
495}

References ActiveForParticle(), ComputeDEDX(), G4LossTableManager::GetEnergyLossProcessVector(), G4LossTableManager::Instance(), CLHEP::detail::n, SetupMaterial(), and UpdateParticle().

Referenced by ComputeElectronicDEDX(), and ComputeTotalDEDX().

◆ ComputeElectronicDEDX() [2/2]

G4double G4EmCalculator::ComputeElectronicDEDX ( G4double  kinEnergy,
const G4String part,
const G4String mat,
G4double  cut = DBL_MAX 
)
inline

Definition at line 435 of file G4EmCalculator.hh.

437{
438 return
439 ComputeElectronicDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
440}
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)

References ComputeElectronicDEDX(), FindMaterial(), and FindParticle().

◆ ComputeEnergyCutFromRangeCut() [1/2]

G4double G4EmCalculator::ComputeEnergyCutFromRangeCut ( G4double  range,
const G4ParticleDefinition part,
const G4Material mat 
)

Definition at line 748 of file G4EmCalculator.cc.

752{
754 ConvertRangeToEnergy(part, mat, range);
755}
static G4ProductionCutsTable * GetProductionCutsTable()

References G4ProductionCutsTable::GetProductionCutsTable().

Referenced by ComputeDEDXForCutInRange(), and ComputeEnergyCutFromRangeCut().

◆ ComputeEnergyCutFromRangeCut() [2/2]

G4double G4EmCalculator::ComputeEnergyCutFromRangeCut ( G4double  range,
const G4String particle,
const G4String material 
)
inline

Definition at line 533 of file G4EmCalculator.hh.

537{
538 return ComputeEnergyCutFromRangeCut(range,FindParticle(particle),
540}

References ComputeEnergyCutFromRangeCut(), FindMaterial(), FindParticle(), and eplot::material.

◆ ComputeGammaAttenuationLength()

G4double G4EmCalculator::ComputeGammaAttenuationLength ( G4double  kinEnergy,
const G4Material mat 
)

Definition at line 693 of file G4EmCalculator.cc.

695{
696 G4double res = 0.0;
697 const G4ParticleDefinition* gamma = G4Gamma::Gamma();
698 res += ComputeCrossSectionPerVolume(kinEnergy, gamma, "conv", mat, 0.0);
699 res += ComputeCrossSectionPerVolume(kinEnergy, gamma, "compt", mat, 0.0);
700 res += ComputeCrossSectionPerVolume(kinEnergy, gamma, "phot", mat, 0.0);
701 res += ComputeCrossSectionPerVolume(kinEnergy, gamma, "Rayl", mat, 0.0);
702 if(res > 0.0) { res = 1.0/res; }
703 return res;
704}

References ComputeCrossSectionPerVolume(), and G4Gamma::Gamma().

◆ ComputeMeanFreePath() [1/2]

G4double G4EmCalculator::ComputeMeanFreePath ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
const G4Material mat,
G4double  cut = 0.0 
)

Definition at line 727 of file G4EmCalculator.cc.

732{
733 G4double mfp = DBL_MAX;
734 G4double x = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat, cut);
735 if(x > 0.0) { mfp = 1.0/x; }
736 if(verbose>1) {
737 G4cout << "E(MeV)= " << kinEnergy/MeV
738 << " MFP(mm)= " << mfp/mm
739 << " " << p->GetParticleName()
740 << " in " << mat->GetName()
741 << G4endl;
742 }
743 return mfp;
744}

References ComputeCrossSectionPerVolume(), DBL_MAX, G4cout, G4endl, G4Material::GetName(), G4ParticleDefinition::GetParticleName(), MeV, mm, and verbose.

Referenced by ComputeMeanFreePath().

◆ ComputeMeanFreePath() [2/2]

G4double G4EmCalculator::ComputeMeanFreePath ( G4double  kinEnergy,
const G4String particle,
const G4String processName,
const G4String processName,
G4double  cut = 0.0 
)
inline

Definition at line 545 of file G4EmCalculator.hh.

550{
551 return ComputeMeanFreePath(kinEnergy,FindParticle(particle),processName,
553}
G4double ComputeMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)

References ComputeMeanFreePath(), FindMaterial(), FindParticle(), and eplot::material.

◆ ComputeNuclearDEDX() [1/2]

G4double G4EmCalculator::ComputeNuclearDEDX ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4Material mat 
)

Definition at line 557 of file G4EmCalculator.cc.

560{
561 G4double res = 0.0;
562 G4VEmProcess* nucst = FindDiscreteProcess(p, "nuclearStopping");
563 if(nucst) {
564 G4VEmModel* mod = nucst->EmModel();
565 if(mod) {
566 mod->SetFluctuationFlag(false);
567 res = mod->ComputeDEDXPerVolume(mat, p, kinEnergy);
568 }
569 }
570
571 if(verbose > 1) {
572 G4cout << p->GetParticleName() << " E(MeV)= " << kinEnergy/MeV
573 << " NuclearDEDX(MeV/mm)= " << res*mm/MeV
574 << " NuclearDEDX(MeV*cm^2/g)= "
575 << res*gram/(MeV*cm2*mat->GetDensity())
576 << G4endl;
577 }
578 return res;
579}
G4VEmProcess * FindDiscreteProcess(const G4ParticleDefinition *, const G4String &processName)
void SetFluctuationFlag(G4bool val)
Definition: G4VEmModel.hh:732
G4VEmModel * EmModel(size_t index=0) const

References cm2, G4VEmModel::ComputeDEDXPerVolume(), G4VEmProcess::EmModel(), FindDiscreteProcess(), G4cout, G4endl, G4Material::GetDensity(), G4ParticleDefinition::GetParticleName(), gram, MeV, mm, G4VEmModel::SetFluctuationFlag(), and verbose.

Referenced by ComputeNuclearDEDX(), and ComputeTotalDEDX().

◆ ComputeNuclearDEDX() [2/2]

G4double G4EmCalculator::ComputeNuclearDEDX ( G4double  kinEnergy,
const G4String part,
const G4String mat 
)
inline

Definition at line 481 of file G4EmCalculator.hh.

484{
485 return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),
487}
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)

References ComputeNuclearDEDX(), FindMaterial(), FindParticle(), and eplot::material.

◆ ComputeShellIonisationCrossSectionPerAtom()

G4double G4EmCalculator::ComputeShellIonisationCrossSectionPerAtom ( const G4String part,
G4int  Z,
G4AtomicShellEnumerator  shell,
G4double  kinEnergy,
const G4Material mat = nullptr 
)

Definition at line 708 of file G4EmCalculator.cc.

714{
715 G4double res = 0.0;
716 const G4ParticleDefinition* p = FindParticle(particle);
718 if(p && ad) {
719 res = ad->ComputeShellIonisationCrossSectionPerAtom(p, Z, shell,
720 kinEnergy, mat);
721 }
722 return res;
723}
G4VAtomDeexcitation * AtomDeexcitation()
virtual G4double ComputeShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=nullptr)=0

References G4LossTableManager::AtomDeexcitation(), G4VAtomDeexcitation::ComputeShellIonisationCrossSectionPerAtom(), FindParticle(), manager, and Z.

◆ ComputeTotalDEDX() [1/2]

G4double G4EmCalculator::ComputeTotalDEDX ( G4double  kinEnergy,
const G4ParticleDefinition part,
const G4Material mat,
G4double  cut = DBL_MAX 
)

Definition at line 545 of file G4EmCalculator.cc.

549{
550 G4double dedx = ComputeElectronicDEDX(kinEnergy,part,mat,cut);
551 if(mass > 700.*MeV) { dedx += ComputeNuclearDEDX(kinEnergy,part,mat); }
552 return dedx;
553}

References ComputeElectronicDEDX(), ComputeNuclearDEDX(), mass, and MeV.

Referenced by ComputeTotalDEDX().

◆ ComputeTotalDEDX() [2/2]

G4double G4EmCalculator::ComputeTotalDEDX ( G4double  kinEnergy,
const G4String part,
const G4String mat,
G4double  cut = DBL_MAX 
)
inline

Definition at line 457 of file G4EmCalculator.hh.

461{
462 return ComputeTotalDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
463}
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)

References ComputeTotalDEDX(), FindMaterial(), and FindParticle().

◆ FindCouple()

const G4MaterialCutsCouple * G4EmCalculator::FindCouple ( const G4Material material,
const G4Region r = nullptr 
)

Definition at line 878 of file G4EmCalculator.cc.

881{
882 const G4MaterialCutsCouple* couple = nullptr;
884 if(currentMaterial) {
885 // Access to materials
886 const G4ProductionCutsTable* theCoupleTable=
888 const G4Region* r = region;
889 if(r) {
890 couple = theCoupleTable->GetMaterialCutsCouple(material,
891 r->GetProductionCuts());
892 } else {
894 size_t nr = store->size();
895 if(0 < nr) {
896 for(size_t i=0; i<nr; ++i) {
897 couple = theCoupleTable->GetMaterialCutsCouple(
898 material, ((*store)[i])->GetProductionCuts());
899 if(couple) { break; }
900 }
901 }
902 }
903 }
904 if(!couple) {
906 ed << "G4EmCalculator::FindCouple: fail for material <"
907 << currentMaterialName << ">";
908 if(region) { ed << " and region " << region->GetName(); }
909 G4Exception("G4EmCalculator::FindCouple", "em0078",
910 FatalException, ed);
911 }
912 return couple;
913}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4RegionStore * GetInstance()
G4ProductionCuts * GetProductionCuts() const

References currentMaterial, currentMaterialName, FatalException, G4Exception(), G4RegionStore::GetInstance(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4Region::GetName(), G4Region::GetProductionCuts(), G4ProductionCutsTable::GetProductionCutsTable(), eplot::material, and SetupMaterial().

Referenced by ComputeDEDX(), export_G4EmCalculator(), GetCrossSectionPerVolume(), GetCSDARange(), GetDEDX(), GetKinEnergy(), and GetRangeFromRestricteDEDX().

◆ FindDiscreteProcess()

G4VEmProcess * G4EmCalculator::FindDiscreteProcess ( const G4ParticleDefinition part,
const G4String processName 
)
private

Definition at line 1158 of file G4EmCalculator.cc.

1160{
1161 G4VEmProcess* proc = nullptr;
1162 auto v = manager->GetEmProcessVector();
1163 G4int n = v.size();
1164 for(G4int i=0; i<n; ++i) {
1165 auto pName = v[i]->GetProcessName();
1166 if(pName == "GammaGeneralProc") {
1167 proc = v[i]->GetEmProcess(processName);
1168 break;
1169 } else if(pName == processName) {
1170 G4VProcess* p = reinterpret_cast<G4VProcess*>(v[i]);
1171 if(ActiveForParticle(part, p)) {
1172 proc = v[i];
1173 break;
1174 }
1175 }
1176 }
1177 return proc;
1178}
const std::vector< G4VEmProcess * > & GetEmProcessVector()
virtual G4VEmProcess * GetEmProcess(const G4String &name)

References ActiveForParticle(), G4VEmProcess::GetEmProcess(), G4LossTableManager::GetEmProcessVector(), manager, and CLHEP::detail::n.

Referenced by ComputeNuclearDEDX(), FindEmModel(), FindLambdaTable(), and GetCrossSectionPerVolume().

◆ FindEmModel()

G4bool G4EmCalculator::FindEmModel ( const G4ParticleDefinition p,
const G4String processName,
G4double  kinEnergy 
)
private

Definition at line 1012 of file G4EmCalculator.cc.

1015{
1016 isApplicable = false;
1017 if(!p || !currentMaterial) {
1018 G4cout << "G4EmCalculator::FindEmModel WARNING: no particle"
1019 << " or materail defined; particle: " << p << G4endl;
1020 return isApplicable;
1021 }
1022 G4String partname = p->GetParticleName();
1023 const G4ParticleDefinition* part = p;
1024 G4double scaledEnergy = kinEnergy*massRatio;
1025 if(isIon) { part = theGenericIon; }
1026
1027 if(verbose > 1) {
1028 G4cout << "## G4EmCalculator::FindEmModel for " << partname
1029 << " (type= " << p->GetParticleType()
1030 << ") and " << processName << " at E(MeV)= " << scaledEnergy
1031 << G4endl;
1032 if(p != part) { G4cout << " GenericIon is the base particle" << G4endl; }
1033 }
1034
1035 // Search for energy loss process
1036 currentName = processName;
1037 currentModel = nullptr;
1038 loweModel = nullptr;
1039 size_t idx = 0;
1040
1041 G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
1042 if(elproc) {
1043 currentModel = elproc->SelectModelForMaterial(scaledEnergy, idx);
1045 currentModel->SetupForMaterial(part, currentMaterial, scaledEnergy);
1047 if(eth > 0.0) {
1048 loweModel = elproc->SelectModelForMaterial(eth - CLHEP::eV, idx);
1049 if(loweModel == currentModel) { loweModel = nullptr; }
1050 else {
1053 }
1054 }
1055 }
1056
1057 // Search for discrete process
1058 if(!currentModel) {
1059 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
1060 if(proc) {
1061 currentModel = proc->SelectModelForMaterial(kinEnergy, idx);
1065 if(eth > 0.0) {
1066 loweModel = proc->SelectModelForMaterial(eth - CLHEP::eV, idx);
1067 if(loweModel == currentModel) { loweModel = nullptr; }
1068 else {
1071 }
1072 }
1073 }
1074 }
1075
1076 // Search for msc process
1077 if(!currentModel) {
1078 G4VMultipleScattering* proc = FindMscProcess(part, processName);
1079 if(proc) {
1080 currentModel = proc->SelectModel(kinEnergy, idx);
1081 loweModel = nullptr;
1082 }
1083 }
1084 if(currentModel) {
1085 if(loweModel == currentModel) { loweModel = nullptr; }
1086 isApplicable = true;
1088 if(loweModel) {
1090 }
1091 if(verbose > 1) {
1092 G4cout << " Model <" << currentModel->GetName()
1093 << "> Emin(MeV)= " << currentModel->LowEnergyLimit()/MeV
1094 << " for " << part->GetParticleName();
1095 if(elproc) {
1096 G4cout << " and " << elproc->GetProcessName() << " " << elproc
1097 << G4endl;
1098 }
1099 if(loweModel) {
1100 G4cout << " LowEnergy model <" << loweModel->GetName() << ">";
1101 }
1102 G4cout << G4endl;
1103 }
1104 }
1105 return isApplicable;
1106}
G4String currentName
G4VEnergyLossProcess * FindEnLossProcess(const G4ParticleDefinition *, const G4String &processName)
G4VMultipleScattering * FindMscProcess(const G4ParticleDefinition *, const G4String &processName)
const G4String & GetParticleType() const
virtual void InitialiseForMaterial(const G4ParticleDefinition *, const G4Material *)
Definition: G4VEmModel.cc:209
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
Definition: G4VEmModel.cc:440
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t idxCouple) const
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idxCouple) const
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382
static constexpr double eV

References currentMaterial, currentModel, currentName, CLHEP::eV, FindDiscreteProcess(), FindEnLossProcess(), FindMscProcess(), G4cout, G4endl, G4VEmModel::GetName(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetParticleType(), G4VProcess::GetProcessName(), G4VEmModel::InitialiseForMaterial(), isApplicable, isIon, loweModel, G4VEmModel::LowEnergyLimit(), massRatio, MeV, G4VMultipleScattering::SelectModel(), G4VEnergyLossProcess::SelectModelForMaterial(), G4VEmProcess::SelectModelForMaterial(), G4VEmModel::SetupForMaterial(), theGenericIon, and verbose.

Referenced by ComputeCrossSectionPerAtom(), ComputeCrossSectionPerShell(), ComputeCrossSectionPerVolume(), ComputeDEDX(), GetCrossSectionPerVolume(), and GetDEDX().

◆ FindEnergyLossProcess()

G4VEnergyLossProcess * G4EmCalculator::FindEnergyLossProcess ( const G4ParticleDefinition p)
private

Definition at line 1110 of file G4EmCalculator.cc.

1112{
1113 G4VEnergyLossProcess* elp = nullptr;
1114 G4String partname = p->GetParticleName();
1115 const G4ParticleDefinition* part = p;
1116
1117 if(p->GetParticleType() == "nucleus"
1118 && currentParticleName != "deuteron"
1119 && currentParticleName != "triton"
1120 && currentParticleName != "alpha"
1121 && currentParticleName != "alpha+"
1122 ) { part = theGenericIon; }
1123
1124 elp = manager->GetEnergyLossProcess(part);
1125 /*
1126 G4cout << "\n G4EmCalculator::FindEnergyLossProcess: for " << p->GetParticleName()
1127 << " found " << elp->GetProcessName() << " of "
1128 << elp->Particle()->GetParticleName() << " " << elp << G4endl;
1129 */
1130 return elp;
1131}
G4String currentParticleName
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)

References currentParticleName, G4LossTableManager::GetEnergyLossProcess(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetParticleType(), manager, and theGenericIon.

Referenced by PrintDEDXTable(), PrintInverseRangeTable(), PrintRangeTable(), and UpdateParticle().

◆ FindEnLossProcess()

G4VEnergyLossProcess * G4EmCalculator::FindEnLossProcess ( const G4ParticleDefinition part,
const G4String processName 
)
private

Definition at line 1136 of file G4EmCalculator.cc.

1138{
1139 G4VEnergyLossProcess* proc = 0;
1140 const std::vector<G4VEnergyLossProcess*> v =
1142 G4int n = v.size();
1143 for(G4int i=0; i<n; ++i) {
1144 if((v[i])->GetProcessName() == processName) {
1145 G4VProcess* p = reinterpret_cast<G4VProcess*>(v[i]);
1146 if(ActiveForParticle(part, p)) {
1147 proc = v[i];
1148 break;
1149 }
1150 }
1151 }
1152 return proc;
1153}

References ActiveForParticle(), G4LossTableManager::GetEnergyLossProcessVector(), manager, and CLHEP::detail::n.

Referenced by FindEmModel(), and FindLambdaTable().

◆ FindIon()

const G4ParticleDefinition * G4EmCalculator::FindIon ( G4int  Z,
G4int  A 
)

Definition at line 843 of file G4EmCalculator.cc.

844{
845 const G4ParticleDefinition* p = ionTable->GetIon(Z,A,0);
846 return p;
847}
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:522

References A, G4IonTable::GetIon(), ionTable, and Z.

◆ FindLambdaTable()

void G4EmCalculator::FindLambdaTable ( const G4ParticleDefinition p,
const G4String processName,
G4double  kinEnergy,
G4int proctype 
)
private

Definition at line 942 of file G4EmCalculator.cc.

945{
946 // Search for the process
947 if (!currentLambda || p != lambdaParticle || processName != lambdaName) {
948 lambdaName = processName;
949 currentLambda = nullptr;
950 lambdaParticle = p;
951
952 const G4ParticleDefinition* part = p;
953 if(isIon) { part = theGenericIon; }
954
955 // Search for energy loss process
956 currentName = processName;
957 currentModel = nullptr;
958 loweModel = nullptr;
959
960 G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
961 if(elproc) {
962 currentLambda = elproc->LambdaTable();
963 proctype = 0;
964 if(currentLambda) {
965 isApplicable = true;
966 if(verbose>1) {
967 G4cout << "G4VEnergyLossProcess is found out: " << currentName
968 << G4endl;
969 }
970 }
971 curProcess = elproc;
972 return;
973 }
974
975 // Search for discrete process
976 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
977 if(proc) {
978 currentLambda = proc->LambdaTable();
979 proctype = 1;
980 if(currentLambda) {
981 isApplicable = true;
982 if(verbose>1) {
983 G4cout << "G4VEmProcess is found out: " << currentName << G4endl;
984 }
985 }
986 curProcess = proc;
987 return;
988 }
989
990 // Search for msc process
991 G4VMultipleScattering* msc = FindMscProcess(part, processName);
992 if(msc) {
993 currentModel = msc->SelectModel(kinEnergy,0);
994 proctype = 2;
995 if(currentModel) {
997 if(currentLambda) {
998 isApplicable = true;
999 if(verbose>1) {
1000 G4cout << "G4VMultipleScattering is found out: " << currentName
1001 << G4endl;
1002 }
1003 }
1004 }
1005 curProcess = msc;
1006 }
1007 }
1008}
G4VProcess * curProcess
const G4ParticleDefinition * lambdaParticle
const G4PhysicsTable * currentLambda
G4PhysicsTable * GetCrossSectionTable()
Definition: G4VEmModel.hh:870
G4PhysicsTable * LambdaTable() const
G4PhysicsTable * LambdaTable() const

References curProcess, currentLambda, currentModel, currentName, FindDiscreteProcess(), FindEnLossProcess(), FindMscProcess(), G4cout, G4endl, G4VEmModel::GetCrossSectionTable(), isApplicable, isIon, lambdaName, lambdaParticle, G4VEmProcess::LambdaTable(), G4VEnergyLossProcess::LambdaTable(), loweModel, G4VMultipleScattering::SelectModel(), theGenericIon, and verbose.

Referenced by GetCrossSectionPerVolume().

◆ FindMaterial()

const G4Material * G4EmCalculator::FindMaterial ( const G4String name)

◆ FindMscProcess()

G4VMultipleScattering * G4EmCalculator::FindMscProcess ( const G4ParticleDefinition part,
const G4String processName 
)
private

Definition at line 1183 of file G4EmCalculator.cc.

1185{
1186 G4VMultipleScattering* proc = 0;
1187 const std::vector<G4VMultipleScattering*> v =
1189 G4int n = v.size();
1190 for(G4int i=0; i<n; ++i) {
1191 if((v[i])->GetProcessName() == processName) {
1192 G4VProcess* p = reinterpret_cast<G4VProcess*>(v[i]);
1193 if(ActiveForParticle(part, p)) {
1194 proc = v[i];
1195 break;
1196 }
1197 }
1198 }
1199 return proc;
1200}
const std::vector< G4VMultipleScattering * > & GetMultipleScatteringVector()

References ActiveForParticle(), G4LossTableManager::GetMultipleScatteringVector(), manager, and CLHEP::detail::n.

Referenced by FindEmModel(), and FindLambdaTable().

◆ FindParticle()

const G4ParticleDefinition * G4EmCalculator::FindParticle ( const G4String name)

◆ FindProcess()

G4VProcess * G4EmCalculator::FindProcess ( const G4ParticleDefinition part,
const G4String processName 
)

Definition at line 1204 of file G4EmCalculator.cc.

1206{
1207 G4VProcess* proc = 0;
1208 const G4ProcessManager* procman = part->GetProcessManager();
1209 G4ProcessVector* pv = procman->GetProcessList();
1210 G4int nproc = pv->size();
1211 for(G4int i=0; i<nproc; ++i) {
1212 if(processName == (*pv)[i]->GetProcessName()) {
1213 proc = (*pv)[i];
1214 break;
1215 }
1216 }
1217 return proc;
1218}

References G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), and G4ProcessVector::size().

◆ FindRegion()

const G4Region * G4EmCalculator::FindRegion ( const G4String reg)

Definition at line 865 of file G4EmCalculator.cc.

866{
867 const G4Region* r = 0;
868 if(reg != "" && reg != "world") {
870 } else {
871 r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
872 }
873 return r;
874}
static const G4double reg
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const

References G4RegionStore::GetInstance(), G4RegionStore::GetRegion(), and reg.

Referenced by export_G4EmCalculator(), GetCrossSectionPerVolume(), GetCSDARange(), GetDEDX(), GetKinEnergy(), GetMeanFreePath(), GetRange(), and GetRangeFromRestricteDEDX().

◆ GetCrossSectionPerVolume() [1/2]

G4double G4EmCalculator::GetCrossSectionPerVolume ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 233 of file G4EmCalculator.cc.

238{
239 G4double res = 0.0;
240 const G4MaterialCutsCouple* couple = FindCouple(mat,region);
241
242 if(couple && UpdateParticle(p, kinEnergy)) {
243 if(FindEmModel(p, processName, kinEnergy)) {
244 G4int idx = couple->GetIndex();
245 G4int procType = -1;
246 FindLambdaTable(p, processName, kinEnergy, procType);
247
248 G4VEmProcess* emproc = FindDiscreteProcess(p, processName);
249 if(emproc) {
250 res = emproc->CrossSectionPerVolume(kinEnergy, couple);
251 } else if(currentLambda) {
252 // special tables are built for Msc models (procType is set in FindLambdaTable
253 if(procType==2) {
254 G4VMscModel* mscM = static_cast<G4VMscModel*>(currentModel);
255 mscM->SetCurrentCouple(couple);
256 G4double tr1Mfp = mscM->GetTransportMeanFreePath(p, kinEnergy);
257 if (tr1Mfp<DBL_MAX) {
258 res = 1./tr1Mfp;
259 }
260 } else {
261 G4double e = kinEnergy*massRatio;
262 res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
263 }
264 } else {
265 res = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat, kinEnergy);
266 }
267 if(verbose>0) {
268 G4cout << "G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
269 << " cross(cm-1)= " << res*cm
270 << " " << p->GetParticleName()
271 << " in " << mat->GetName();
272 if(verbose>1)
273 G4cout << " idx= " << idx << " Escaled((MeV)= "
274 << kinEnergy*massRatio
275 << " q2= " << chargeSquare;
276 G4cout << G4endl;
277 }
278 }
279 }
280 return res;
281}
void FindLambdaTable(const G4ParticleDefinition *, const G4String &processName, G4double kinEnergy, G4int &proctype)
void SetCurrentCouple(const G4MaterialCutsCouple *)
Definition: G4VEmModel.hh:472
G4double CrossSectionPerVolume(G4double kineticEnergy, const G4MaterialCutsCouple *couple, G4double logKinEnergy=DBL_MAX)
G4double GetTransportMeanFreePath(const G4ParticleDefinition *part, G4double kinEnergy)
Definition: G4VMscModel.hh:319

References chargeSquare, cm, ComputeCrossSectionPerVolume(), G4VEmProcess::CrossSectionPerVolume(), currentLambda, currentModel, DBL_MAX, FindCouple(), FindDiscreteProcess(), FindEmModel(), FindLambdaTable(), G4cout, G4endl, G4MaterialCutsCouple::GetIndex(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), G4VMscModel::GetTransportMeanFreePath(), massRatio, MeV, G4VEmModel::SetCurrentCouple(), UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), GetCrossSectionPerVolume(), and GetMeanFreePath().

◆ GetCrossSectionPerVolume() [2/2]

G4double G4EmCalculator::GetCrossSectionPerVolume ( G4double  kinEnergy,
const G4String part,
const G4String proc,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 409 of file G4EmCalculator.hh.

414{
415 return GetCrossSectionPerVolume(kinEnergy,FindParticle(particle),processName,
417}
const G4Region * FindRegion(const G4String &)
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetCrossSectionPerVolume(), eplot::material, and reg.

◆ GetCSDARange() [1/2]

G4double G4EmCalculator::GetCSDARange ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 164 of file G4EmCalculator.cc.

168{
169 G4double res = 0.0;
172 ed << "G4EmCalculator::GetCSDARange: CSDA table is not built; "
173 << " use UI command: /process/eLoss/CSDARange true";
174 G4Exception("G4EmCalculator::GetCSDARange", "em0077",
175 JustWarning, ed);
176 return res;
177 }
178
179 const G4MaterialCutsCouple* couple = FindCouple(mat,region);
180 if(couple && UpdateParticle(p, kinEnergy)) {
181 res = manager->GetCSDARange(p, kinEnergy, couple);
182 if(verbose>1) {
183 G4cout << " G4EmCalculator::GetCSDARange: E(MeV)= " << kinEnergy/MeV
184 << " range(mm)= " << res/mm
185 << " " << p->GetParticleName()
186 << " in " << mat->GetName()
187 << G4endl;
188 }
189 }
190 return res;
191}
@ JustWarning
G4bool BuildCSDARange() const
G4double GetCSDARange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)

References G4EmParameters::BuildCSDARange(), FindCouple(), G4cout, G4endl, G4Exception(), G4LossTableManager::GetCSDARange(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), JustWarning, manager, MeV, mm, theParameters, UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), GetCSDARange(), and GetRange().

◆ GetCSDARange() [2/2]

G4double G4EmCalculator::GetCSDARange ( G4double  kinEnergy,
const G4String part,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 375 of file G4EmCalculator.hh.

379{
380 return GetCSDARange(kinEnergy,FindParticle(particle),
382}
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetCSDARange(), eplot::material, and reg.

◆ GetDEDX() [1/2]

G4double G4EmCalculator::GetDEDX ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 101 of file G4EmCalculator.cc.

105{
106 G4double res = 0.0;
107 const G4MaterialCutsCouple* couple = FindCouple(mat, region);
108 if(couple && UpdateParticle(p, kinEnergy) ) {
109 res = manager->GetDEDX(p, kinEnergy, couple);
110
111 if(isIon) {
112 if(FindEmModel(p, currentProcessName, kinEnergy)) {
113 G4double length = CLHEP::nm;
114 G4double eloss = res*length;
115 //G4cout << "### GetDEDX: E= " << kinEnergy << " dedx0= " << res
116 // << " de= " << eloss << G4endl;;
117 dynParticle->SetKineticEnergy(kinEnergy);
118 currentModel->GetChargeSquareRatio(p, mat, kinEnergy);
119 currentModel->CorrectionsAlongStep(couple,dynParticle,length,eloss);
120 res = eloss/length;
121 //G4cout << " de1= " << eloss << " res1= " << res
122 // << " " << p->GetParticleName() <<G4endl;;
123 }
124 }
125
126 if(verbose>0) {
127 G4cout << "G4EmCalculator::GetDEDX: E(MeV)= " << kinEnergy/MeV
128 << " DEDX(MeV/mm)= " << res*mm/MeV
129 << " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
130 << " " << p->GetParticleName()
131 << " in " << mat->GetName()
132 << " isIon= " << isIon
133 << G4endl;
134 }
135 }
136 return res;
137}
G4String currentProcessName
G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)

References cm2, G4VEmModel::CorrectionsAlongStep(), currentModel, currentProcessName, dynParticle, FindCouple(), FindEmModel(), G4cout, G4endl, G4VEmModel::GetChargeSquareRatio(), G4LossTableManager::GetDEDX(), G4Material::GetDensity(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), gram, isIon, manager, MeV, mm, CLHEP::nm, G4DynamicParticle::SetKineticEnergy(), UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), GetDEDX(), and G4EnergySplitter::SplitEnergyInVolumes().

◆ GetDEDX() [2/2]

G4double G4EmCalculator::GetDEDX ( G4double  kinEnergy,
const G4String part,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 353 of file G4EmCalculator.hh.

355{
356 return GetDEDX(kinEnergy,FindParticle(particle),
358}
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetDEDX(), eplot::material, and reg.

◆ GetKinEnergy() [1/2]

G4double G4EmCalculator::GetKinEnergy ( G4double  range,
const G4ParticleDefinition p,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 211 of file G4EmCalculator.cc.

215{
216 G4double res = 0.0;
217 const G4MaterialCutsCouple* couple = FindCouple(mat,region);
218 if(couple && UpdateParticle(p, 1.0*GeV)) {
219 res = manager->GetEnergy(p, range, couple);
220 if(verbose>0) {
221 G4cout << "G4EmCalculator::GetKinEnergy: Range(mm)= " << range/mm
222 << " KinE(MeV)= " << res/MeV
223 << " " << p->GetParticleName()
224 << " in " << mat->GetName()
225 << G4endl;
226 }
227 }
228 return res;
229}
static constexpr double GeV
Definition: G4SIunits.hh:203
G4double GetEnergy(const G4ParticleDefinition *aParticle, G4double range, const G4MaterialCutsCouple *couple)

References FindCouple(), G4cout, G4endl, G4LossTableManager::GetEnergy(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), GeV, manager, MeV, mm, UpdateParticle(), and verbose.

Referenced by GetKinEnergy().

◆ GetKinEnergy() [2/2]

G4double G4EmCalculator::GetKinEnergy ( G4double  range,
const G4String part,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 399 of file G4EmCalculator.hh.

401{
402 return GetKinEnergy(range,FindParticle(particle),
404}
G4double GetKinEnergy(G4double range, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetKinEnergy(), eplot::material, and reg.

◆ GetMeanFreePath() [1/2]

G4double G4EmCalculator::GetMeanFreePath ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4String processName,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 302 of file G4EmCalculator.cc.

307{
308 G4double res = DBL_MAX;
309 G4double x = GetCrossSectionPerVolume(kinEnergy,p, processName, mat,region);
310 if(x > 0.0) { res = 1.0/x; }
311 if(verbose>1) {
312 G4cout << "G4EmCalculator::GetMeanFreePath: E(MeV)= " << kinEnergy/MeV
313 << " MFP(mm)= " << res/mm
314 << " " << p->GetParticleName()
315 << " in " << mat->GetName()
316 << G4endl;
317 }
318 return res;
319}

References DBL_MAX, G4cout, G4endl, GetCrossSectionPerVolume(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), MeV, mm, and verbose.

Referenced by RunAction::BeginOfRunAction(), and GetMeanFreePath().

◆ GetMeanFreePath() [2/2]

G4double G4EmCalculator::GetMeanFreePath ( G4double  kinEnergy,
const G4String part,
const G4String proc,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 422 of file G4EmCalculator.hh.

427{
428 return GetMeanFreePath(kinEnergy,FindParticle(particle),processName,
430}
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetMeanFreePath(), eplot::material, and reg.

◆ GetRange() [1/2]

G4double G4EmCalculator::GetRange ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 195 of file G4EmCalculator.cc.

199{
200 G4double res = 0.0;
202 res = GetCSDARange(kinEnergy, p, mat, region);
203 } else {
204 res = GetRangeFromRestricteDEDX(kinEnergy, p, mat, region);
205 }
206 return res;
207}
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)

References G4EmParameters::BuildCSDARange(), GetCSDARange(), GetRangeFromRestricteDEDX(), and theParameters.

Referenced by GetRange().

◆ GetRange() [2/2]

G4double G4EmCalculator::GetRange ( G4double  kinEnergy,
const G4String part,
const G4String mat,
const G4String s = "world" 
)
inline

Definition at line 387 of file G4EmCalculator.hh.

391{
392 return GetRange(kinEnergy,FindParticle(particle),
394}
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)

References FindMaterial(), FindParticle(), FindRegion(), GetRange(), eplot::material, and reg.

◆ GetRangeFromRestricteDEDX() [1/2]

G4double G4EmCalculator::GetRangeFromRestricteDEDX ( G4double  kinEnergy,
const G4ParticleDefinition p,
const G4Material mat,
const G4Region r = nullptr 
)

Definition at line 141 of file G4EmCalculator.cc.

145{
146 G4double res = 0.0;
147 const G4MaterialCutsCouple* couple = FindCouple(mat,region);
148 if(couple && UpdateParticle(p, kinEnergy)) {
149 res = manager->GetRangeFromRestricteDEDX(p, kinEnergy, couple);
150 if(verbose>1) {
151 G4cout << " G4EmCalculator::GetRangeFromRestrictedDEDX: E(MeV)= "
152 << kinEnergy/MeV
153 << " range(mm)= " << res/mm
154 << " " << p->GetParticleName()
155 << " in " << mat->GetName()
156 << G4endl;
157 }
158 }
159 return res;
160}
G4double GetRangeFromRestricteDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)

References FindCouple(), G4cout, G4endl, G4Material::GetName(), G4ParticleDefinition::GetParticleName(), G4LossTableManager::GetRangeFromRestricteDEDX(), manager, MeV, mm, UpdateParticle(), and verbose.

Referenced by RunAction::BeginOfRunAction(), GetRange(), and GetRangeFromRestricteDEDX().

◆ GetRangeFromRestricteDEDX() [2/2]

G4double G4EmCalculator::GetRangeFromRestricteDEDX ( G4double  kinEnergy,
const G4String part,
const G4String mat,
const G4String s = "world" 
)
inline

◆ GetShellIonisationCrossSectionPerAtom()

G4double G4EmCalculator::GetShellIonisationCrossSectionPerAtom ( const G4String part,
G4int  Z,
G4AtomicShellEnumerator  shell,
G4double  kinEnergy 
)

Definition at line 285 of file G4EmCalculator.cc.

290{
291 G4double res = 0.0;
292 const G4ParticleDefinition* p = FindParticle(particle);
294 if(p && ad) {
295 res = ad->GetShellIonisationCrossSectionPerAtom(p, Z, shell, kinEnergy);
296 }
297 return res;
298}
virtual G4double GetShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=nullptr)=0

References G4LossTableManager::AtomDeexcitation(), FindParticle(), G4VAtomDeexcitation::GetShellIonisationCrossSectionPerAtom(), manager, and Z.

◆ operator=()

G4EmCalculator & G4EmCalculator::operator= ( const G4EmCalculator right)
delete

◆ PrintDEDXTable()

void G4EmCalculator::PrintDEDXTable ( const G4ParticleDefinition p)

Definition at line 323 of file G4EmCalculator.cc.

324{
326 G4cout << "##### DEDX Table for " << p->GetParticleName() << G4endl;
327 if(elp) G4cout << *(elp->DEDXTable()) << G4endl;
328}
G4VEnergyLossProcess * FindEnergyLossProcess(const G4ParticleDefinition *)
G4PhysicsTable * DEDXTable() const

References G4VEnergyLossProcess::DEDXTable(), FindEnergyLossProcess(), G4cout, G4endl, and G4ParticleDefinition::GetParticleName().

Referenced by export_G4EmCalculator().

◆ PrintInverseRangeTable()

void G4EmCalculator::PrintInverseRangeTable ( const G4ParticleDefinition p)

Definition at line 341 of file G4EmCalculator.cc.

342{
344 G4cout << "### G4EmCalculator: Inverse Range Table for "
345 << p->GetParticleName() << G4endl;
346 if(elp) G4cout << *(elp->InverseRangeTable()) << G4endl;
347}
G4PhysicsTable * InverseRangeTable() const

References FindEnergyLossProcess(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), and G4VEnergyLossProcess::InverseRangeTable().

Referenced by export_G4EmCalculator().

◆ PrintRangeTable()

void G4EmCalculator::PrintRangeTable ( const G4ParticleDefinition p)

Definition at line 332 of file G4EmCalculator.cc.

333{
335 G4cout << "##### Range Table for " << p->GetParticleName() << G4endl;
336 if(elp) G4cout << *(elp->RangeTableForLoss()) << G4endl;
337}
G4PhysicsTable * RangeTableForLoss() const

References FindEnergyLossProcess(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), and G4VEnergyLossProcess::RangeTableForLoss().

Referenced by export_G4EmCalculator().

◆ SetupMaterial() [1/2]

void G4EmCalculator::SetupMaterial ( const G4Material mat)

◆ SetupMaterial() [2/2]

void G4EmCalculator::SetupMaterial ( const G4String mname)

Definition at line 1253 of file G4EmCalculator.cc.

1254{
1256}
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)

References G4NistManager::FindOrBuildMaterial(), nist, and SetupMaterial().

◆ SetVerbose()

void G4EmCalculator::SetVerbose ( G4int  val)

Definition at line 1279 of file G4EmCalculator.cc.

1280{
1281 verbose = verb;
1282}

References verbose.

Referenced by export_G4EmCalculator().

◆ UpdateCouple()

G4bool G4EmCalculator::UpdateCouple ( const G4Material material,
G4double  cut 
)
private

Definition at line 917 of file G4EmCalculator.cc.

918{
920 if(!currentMaterial) { return false; }
921 for (G4int i=0; i<nLocalMaterials; ++i) {
922 if(material == localMaterials[i] && cut == localCuts[i]) {
925 currentCut = cut;
926 return true;
927 }
928 }
930 localMaterials.push_back(material);
931 localCouples.push_back(cc);
932 localCuts.push_back(cut);
934 currentCouple = cc;
936 currentCut = cut;
937 return true;
938}
std::vector< const G4Material * > localMaterials
const G4MaterialCutsCouple * currentCouple
std::vector< G4double > localCuts

References currentCouple, currentCoupleIndex, currentCut, currentMaterial, G4MaterialCutsCouple::GetIndex(), localCouples, localCuts, localMaterials, eplot::material, nLocalMaterials, and SetupMaterial().

◆ UpdateParticle()

G4bool G4EmCalculator::UpdateParticle ( const G4ParticleDefinition p,
G4double  kinEnergy 
)
private

Definition at line 759 of file G4EmCalculator.cc.

761{
762 if(p != currentParticle) {
763
764 // new particle
765 currentParticle = p;
767 dynParticle->SetKineticEnergy(kinEnergy);
768 baseParticle = 0;
770 massRatio = 1.0;
771 mass = p->GetPDGMass();
772 chargeSquare = 1.0;
775 isIon = false;
776
777 // ionisation process exist
778 if(currentProcess) {
781
782 // base particle is used
783 if(baseParticle) {
786 chargeSquare = q*q;
787 }
788
789 if(p->GetParticleType() == "nucleus"
790 && currentParticleName != "deuteron"
791 && currentParticleName != "triton"
792 && currentParticleName != "alpha+"
793 && currentParticleName != "alpha"
794 ) {
795 isIon = true;
798 if(verbose>1) {
799 G4cout << "\n G4EmCalculator::UpdateParticle: isIon 1 "
800 << p->GetParticleName()
801 << " in " << currentMaterial->GetName()
802 << " e= " << kinEnergy << G4endl;
803 }
804 }
805 }
806 }
807
808 // Effective charge for ions
809 if(isIon) {
813 if(currentProcess) {
815 if(verbose>1) {
816 G4cout <<"\n NewIon: massR= "<< massRatio << " q2= "
817 << chargeSquare << " " << currentProcess << G4endl;
818 }
819 }
820 }
821 return true;
822}
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4VEnergyLossProcess * currentProcess
G4double EffectiveChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4double EffectiveChargeCorrection(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4double GetPDGCharge() const
const G4ParticleDefinition * BaseParticle() const
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)

References baseParticle, G4VEnergyLossProcess::BaseParticle(), chargeSquare, corr, currentMaterial, currentParticle, currentParticleName, currentProcess, currentProcessName, dynParticle, G4EmCorrections::EffectiveChargeCorrection(), G4EmCorrections::EffectiveChargeSquareRatio(), FindEnergyLossProcess(), G4cout, G4endl, G4Material::GetName(), G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetParticleType(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGMass(), G4VProcess::GetProcessName(), isIon, mass, massRatio, G4DynamicParticle::SetDefinition(), G4VEnergyLossProcess::SetDynamicMassCharge(), G4DynamicParticle::SetKineticEnergy(), theGenericIon, and verbose.

Referenced by ComputeCrossSectionPerAtom(), ComputeCrossSectionPerShell(), ComputeCrossSectionPerVolume(), ComputeDEDX(), ComputeDEDXForCutInRange(), ComputeElectronicDEDX(), GetCrossSectionPerVolume(), GetCSDARange(), GetDEDX(), GetKinEnergy(), and GetRangeFromRestricteDEDX().

Field Documentation

◆ baseParticle

const G4ParticleDefinition* G4EmCalculator::baseParticle = nullptr
private

◆ chargeSquare

G4double G4EmCalculator::chargeSquare = 1.0
private

◆ corr

G4EmCorrections* G4EmCalculator::corr
private

Definition at line 305 of file G4EmCalculator.hh.

Referenced by G4EmCalculator(), and UpdateParticle().

◆ curProcess

G4VProcess* G4EmCalculator::curProcess = nullptr
private

Definition at line 319 of file G4EmCalculator.hh.

Referenced by FindLambdaTable().

◆ currentCouple

const G4MaterialCutsCouple* G4EmCalculator::currentCouple = nullptr
private

Definition at line 308 of file G4EmCalculator.hh.

Referenced by UpdateCouple().

◆ currentCoupleIndex

G4int G4EmCalculator::currentCoupleIndex = 0
private

Definition at line 331 of file G4EmCalculator.hh.

Referenced by UpdateCouple().

◆ currentCut

G4double G4EmCalculator::currentCut = DBL_MAX
private

Definition at line 325 of file G4EmCalculator.hh.

Referenced by UpdateCouple().

◆ currentLambda

const G4PhysicsTable* G4EmCalculator::currentLambda = nullptr
private

Definition at line 314 of file G4EmCalculator.hh.

Referenced by FindLambdaTable(), and GetCrossSectionPerVolume().

◆ currentMaterial

const G4Material* G4EmCalculator::currentMaterial = nullptr
private

◆ currentMaterialName

G4String G4EmCalculator::currentMaterialName = ""
private

Definition at line 345 of file G4EmCalculator.hh.

Referenced by ComputeDEDX(), FindCouple(), FindMaterial(), and SetupMaterial().

◆ currentModel

G4VEmModel* G4EmCalculator::currentModel = nullptr
private

◆ currentName

G4String G4EmCalculator::currentName = ""
private

Definition at line 342 of file G4EmCalculator.hh.

Referenced by FindEmModel(), and FindLambdaTable().

◆ currentParticle

const G4ParticleDefinition* G4EmCalculator::currentParticle = nullptr
private

Definition at line 311 of file G4EmCalculator.hh.

Referenced by FindParticle(), and UpdateParticle().

◆ currentParticleName

G4String G4EmCalculator::currentParticleName = ""
private

Definition at line 344 of file G4EmCalculator.hh.

Referenced by FindEnergyLossProcess(), FindParticle(), and UpdateParticle().

◆ currentProcess

G4VEnergyLossProcess* G4EmCalculator::currentProcess = nullptr
private

Definition at line 318 of file G4EmCalculator.hh.

Referenced by UpdateParticle().

◆ currentProcessName

G4String G4EmCalculator::currentProcessName = ""
private

Definition at line 346 of file G4EmCalculator.hh.

Referenced by GetDEDX(), and UpdateParticle().

◆ cutenergy

G4double G4EmCalculator::cutenergy[3]
private

Definition at line 329 of file G4EmCalculator.hh.

Referenced by ComputeDEDXForCutInRange(), and G4EmCalculator().

◆ cutMaterial

const G4Material* G4EmCalculator::cutMaterial = nullptr
private

Definition at line 310 of file G4EmCalculator.hh.

Referenced by ComputeDEDXForCutInRange().

◆ dynParticle

G4DynamicParticle* G4EmCalculator::dynParticle = nullptr
private

◆ ionEffCharge

G4ionEffectiveCharge* G4EmCalculator::ionEffCharge
private

Definition at line 323 of file G4EmCalculator.hh.

Referenced by G4EmCalculator(), and ~G4EmCalculator().

◆ ionTable

G4IonTable* G4EmCalculator::ionTable
private

Definition at line 304 of file G4EmCalculator.hh.

Referenced by FindIon(), and G4EmCalculator().

◆ isApplicable

G4bool G4EmCalculator::isApplicable = false
private

Definition at line 336 of file G4EmCalculator.hh.

Referenced by FindEmModel(), and FindLambdaTable().

◆ isIon

G4bool G4EmCalculator::isIon = false
private

Definition at line 335 of file G4EmCalculator.hh.

Referenced by ComputeDEDX(), FindEmModel(), FindLambdaTable(), GetDEDX(), and UpdateParticle().

◆ lambdaName

G4String G4EmCalculator::lambdaName = ""
private

Definition at line 343 of file G4EmCalculator.hh.

Referenced by FindLambdaTable().

◆ lambdaParticle

const G4ParticleDefinition* G4EmCalculator::lambdaParticle = nullptr
private

Definition at line 312 of file G4EmCalculator.hh.

Referenced by FindLambdaTable().

◆ localCouples

std::vector<const G4MaterialCutsCouple*> G4EmCalculator::localCouples
private

Definition at line 339 of file G4EmCalculator.hh.

Referenced by UpdateCouple(), and ~G4EmCalculator().

◆ localCuts

std::vector<G4double> G4EmCalculator::localCuts
private

Definition at line 340 of file G4EmCalculator.hh.

Referenced by UpdateCouple().

◆ localMaterials

std::vector<const G4Material*> G4EmCalculator::localMaterials
private

Definition at line 338 of file G4EmCalculator.hh.

Referenced by UpdateCouple().

◆ loweModel

G4VEmModel* G4EmCalculator::loweModel = nullptr
private

Definition at line 317 of file G4EmCalculator.hh.

Referenced by ComputeDEDX(), FindEmModel(), and FindLambdaTable().

◆ manager

G4LossTableManager* G4EmCalculator::manager
private

◆ mass

G4double G4EmCalculator::mass = 0
private

Definition at line 328 of file G4EmCalculator.hh.

Referenced by ComputeTotalDEDX(), and UpdateParticle().

◆ massRatio

G4double G4EmCalculator::massRatio = 1.0
private

◆ nist

G4NistManager* G4EmCalculator::nist
private

Definition at line 303 of file G4EmCalculator.hh.

Referenced by CheckMaterial(), G4EmCalculator(), and SetupMaterial().

◆ nLocalMaterials

G4int G4EmCalculator::nLocalMaterials = 0
private

Definition at line 332 of file G4EmCalculator.hh.

Referenced by UpdateCouple(), and ~G4EmCalculator().

◆ theGenericIon

const G4ParticleDefinition* G4EmCalculator::theGenericIon
private

◆ theParameters

G4EmParameters* G4EmCalculator::theParameters
private

◆ verbose

G4int G4EmCalculator::verbose = 0
private

The documentation for this class was generated from the following files: