95 currentCoupleIndex = 0;
109 currentParticleName=
"";
110 currentMaterialName=
"";
117 isApplicable =
false;
125 for (
G4int i=0; i<nLocalMaterials; ++i) {
126 delete localCouples[i];
139 if(couple && UpdateParticle(p, kinEnergy) ) {
140 res = manager->
GetDEDX(p, kinEnergy, couple);
143 if(FindEmModel(p, currentProcessName, kinEnergy)) {
159 G4cout <<
"G4EmCalculator::GetDEDX: E(MeV)= " << kinEnergy/
MeV
160 <<
" DEDX(MeV/mm)= " << res*
mm/
MeV
164 <<
" isIon= " << isIon
189 if(couple && UpdateParticle(p, kinEnergy)) {
192 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/
MeV
193 <<
" range(mm)= " << res/
mm
212 ed <<
"G4EmCalculator::GetCSDARange: CSDA table is not built; "
213 <<
" use UI command: /process/eLoss/CSDARange true";
214 G4Exception(
"G4EmCalculator::GetCSDARange",
"em0077",
220 if(couple && UpdateParticle(p, kinEnergy)) {
223 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/
MeV
224 <<
" range(mm)= " << res/
mm
242 if(couple && UpdateParticle(p, kinEnergy)) {
243 res = manager->
GetRange(p, kinEnergy, couple);
245 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/
MeV
246 <<
" range(mm)= " << res/
mm
297 if(couple && UpdateParticle(p, 1.0*
GeV)) {
298 res = manager->
GetEnergy(p, range, couple);
300 G4cout <<
"G4EmCalculator::GetKinEnergy: Range(mm)= " << range/
mm
301 <<
" KinE(MeV)= " << res/
MeV
330 if(couple && UpdateParticle(p, kinEnergy)) {
332 FindLambdaTable(p, processName, kinEnergy);
336 res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
342 G4cout <<
"G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/
MeV
343 <<
" cross(cm-1)= " << res*
cm
347 G4cout <<
" idx= " << idx <<
" Escaled((MeV)= "
348 << kinEnergy*massRatio
349 <<
" q2= " << chargeSquare;
395 if(x > 0.0) { res = 1.0/
x; }
397 G4cout <<
"G4EmCalculator::GetMeanFreePath: E(MeV)= " << kinEnergy/
MeV
398 <<
" MFP(mm)= " << res/
mm
441 G4cout <<
"### G4EmCalculator: Inverse Range Table for "
454 currentMaterial = mat;
455 currentMaterialName = mat->
GetName();
459 <<
" in " << currentMaterialName
460 <<
" e(MeV)= " << kinEnergy/
MeV <<
" cut(MeV)= " << cut/
MeV
463 if(UpdateParticle(p, kinEnergy)) {
464 if(FindEmModel(p, processName, kinEnergy)) {
465 G4double escaled = kinEnergy*massRatio;
468 mat, baseParticle, escaled, cut) * chargeSquare;
471 <<
" Escaled(MeV)= " << escaled;
475 if(verbose > 1) {
G4cout <<
" no basePart E(MeV)= " << kinEnergy <<
" "; }
479 <<
" DEDX(MeV*cm^2/g)= "
500 G4cout <<
"At boundary energy(MeV)= " << eth/
MeV
501 <<
" DEDX(MeV/mm)= " << res1*
mm/
MeV
509 if(res1 > 0.0 && escaled > 0.0) {
510 res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
527 G4cout <<
"After Corrections: DEDX(MeV/mm)= " << res*
mm/
MeV
535 G4cout <<
"Sum: E(MeV)= " << kinEnergy/
MeV
536 <<
" DEDX(MeV/mm)= " << res*
mm/
MeV
538 <<
" cut(MeV)= " << cut/
MeV
540 <<
" in " << currentMaterialName
541 <<
" Zi^2= " << chargeSquare
542 <<
" isIon=" << isIon
556 currentMaterial = mat;
557 currentMaterialName = mat->
GetName();
559 if(UpdateParticle(part, kinEnergy)) {
562 const std::vector<G4VEnergyLossProcess*> vel =
569 for(
G4int i=0; i<
n; ++i) {
572 if(ActiveForParticle(part, p)) {
575 dedx +=
ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),mat,cut);
636 <<
" NuclearDEDX(MeV/mm)= " << res*
mm/
MeV
637 <<
" NuclearDEDX(MeV*cm^2/g)= "
663 currentMaterial = mat;
664 currentMaterialName = mat->
GetName();
666 if(UpdateParticle(p, kinEnergy)) {
667 if(FindEmModel(p, processName, kinEnergy)) {
670 e *= kinEnergy*massRatio;
672 mat, baseParticle, e, cut, e) * chargeSquare;
677 G4cout <<
"G4EmCalculator::ComputeXSPerVolume: E(MeV)= " << kinEnergy/
MeV
678 <<
" cross(cm-1)= " << res*
cm
679 <<
" cut(keV)= " << cut/
keV
713 if(UpdateParticle(p, kinEnergy)) {
714 if(FindEmModel(p, processName, kinEnergy)) {
717 e *= kinEnergy*massRatio;
720 baseParticle, e, Z, A, cut) * chargeSquare;
727 <<
" cross(barn)= " << res/
barn
729 <<
" Z= " << Z <<
" A= " << A/(
g/
mole) <<
" g/mole"
762 if(res > 0.0) { res = 1.0/res; }
795 if(x > 0.0) { mfp = 1.0/
x; }
798 <<
" MFP(mm)= " << mfp/
mm
826 ConvertRangeToEnergy(part, mat, range);
846 if(p != currentParticle) {
850 dynParticle.
SetDefinition(const_cast<G4ParticleDefinition*>(p));
857 currentProcess = FindEnergyLossProcess(p);
858 currentProcessName =
"";
874 && currentParticleName !=
"deuteron"
875 && currentParticleName !=
"triton"
876 && currentParticleName !=
"alpha+"
877 && currentParticleName !=
"helium"
878 && currentParticleName !=
"hydrogen"
882 baseParticle = theGenericIon;
908 if(name != currentParticleName) {
911 G4cout <<
"### WARNING: G4EmCalculator::FindParticle fails to find "
932 if(name != currentMaterialName) {
934 currentMaterialName =
name;
935 if(!currentMaterial) {
936 G4cout <<
"### WARNING: G4EmCalculator::FindMaterial fails to find "
940 return currentMaterial;
948 if(reg !=
"" && reg !=
"world") {
965 currentMaterialName = material->
GetName();
975 size_t nr = store->size();
977 for(
size_t i=0; i<nr; ++i) {
979 material, ((*store)[i])->GetProductionCuts());
980 if(couple) {
break; }
987 ed <<
"G4EmCalculator::FindCouple: fail for material " << material
988 <<
" <" << currentMaterialName <<
" > and region " << region;
989 G4Exception(
"G4EmCalculator::FindCouple",
"em0078",
999 if(!material)
return false;
1001 currentMaterialName = material->
GetName();
1002 for (
G4int i=0; i<nLocalMaterials; ++i) {
1003 if(material == localMaterials[i] && cut == localCuts[i]) {
1004 currentCouple = localCouples[i];
1005 currentCoupleIndex = currentCouple->
GetIndex();
1011 localMaterials.push_back(material);
1012 localCouples.push_back(cc);
1013 localCuts.push_back(cut);
1016 currentCoupleIndex = currentCouple->
GetIndex();
1028 if (!currentLambda || p != lambdaParticle || processName != lambdaName) {
1029 lambdaName = processName;
1034 if(isIon) { part = theGenericIon; }
1037 currentName = processName;
1045 isApplicable =
true;
1047 G4cout <<
"G4VEnergyLossProcess is found out: " << currentName
1055 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
1059 isApplicable =
true;
1061 G4cout <<
"G4VEmProcess is found out: " << currentName <<
G4endl;
1093 isApplicable =
false;
1095 G4cout <<
"G4EmCalculator::FindEmModel WARNING: no particle defined"
1097 return isApplicable;
1101 G4double scaledEnergy = kinEnergy*massRatio;
1102 if(isIon) { part = theGenericIon; }
1105 G4cout <<
"## G4EmCalculator::FindEmModel for " << partname
1107 <<
") and " << processName <<
" at E(MeV)= " << scaledEnergy
1109 if(p != part) {
G4cout <<
" GenericIon is the base particle" <<
G4endl; }
1113 currentName = processName;
1124 if(loweModel == currentModel) { loweModel = 0; }
1130 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
1136 if(loweModel == currentModel) { loweModel = 0; }
1150 if(loweModel == currentModel) { loweModel = 0; }
1151 isApplicable =
true;
1165 G4cout <<
" LowEnergy model <" << loweModel->
GetName() <<
">";
1170 return isApplicable;
1183 && currentParticleName !=
"deuteron"
1184 && currentParticleName !=
"triton"
1185 && currentParticleName !=
"alpha+"
1186 && currentParticleName !=
"helium"
1187 && currentParticleName !=
"hydrogen"
1188 ) { part = theGenericIon; }
1201 const std::vector<G4VEnergyLossProcess*>
v =
1204 for(
G4int i=0; i<
n; ++i) {
1205 if((v[i])->GetProcessName() == processName) {
1207 if(ActiveForParticle(part, p)) {
1223 const std::vector<G4VEmProcess*> v =
1226 for(
G4int i=0; i<
n; ++i) {
1227 if((v[i])->GetProcessName() == processName) {
1229 if(ActiveForParticle(part, p)) {
1245 const std::vector<G4VMultipleScattering*> v =
1248 for(
G4int i=0; i<
n; ++i) {
1249 if((v[i])->GetProcessName() == processName) {
1251 if(ActiveForParticle(part, p)) {
1269 for(
G4int i=0; i<
n; ++i) {
1270 if((*pv)[i] == proc) {
G4PhysicsTable * LambdaTable() const
G4ProductionCuts * GetProductionCuts() const
G4double LowEnergyLimit() const
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4LossTableManager * Instance()
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
std::ostringstream G4ExceptionDescription
G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const G4Material * FindMaterial(const G4String &)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
G4PhysicsTable * RangeTableForLoss() const
G4double EffectiveChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
const G4String & GetName() const
void PrintRangeTable(const G4ParticleDefinition *)
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
virtual G4double GetShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=0)=0
G4double GetDensity() const
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)
G4double EffectiveChargeCorrection(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=0)
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=0)
void PrintInverseRangeTable(const G4ParticleDefinition *)
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4ProcessManager * GetProcessManager() const
const std::vector< G4VEmProcess * > & GetEmProcessVector()
const G4String & GetParticleName() const
G4double ComputeShellIonisationCrossSectionPerAtom(const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy, const G4Material *mat=0)
G4double GetCSDARange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
static G4RegionStore * GetInstance()
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double GetShellIonisationCrossSectionPerAtom(const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy)
G4PhysicsTable * LambdaTable() const
G4IonTable * GetIonTable() const
virtual void InitialiseForMaterial(const G4ParticleDefinition *, const G4Material *)
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * FindCouple(const G4Material *, const G4Region *r=0)
G4PhysicsTable * DEDXTable() const
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
G4double NuclearDEDX(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy, G4bool fluct=true)
G4EmCorrections * EmCorrections()
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
const G4String & GetParticleType() const
const G4ParticleDefinition * BaseParticle() const
G4double GetEnergy(const G4ParticleDefinition *aParticle, G4double range, const G4MaterialCutsCouple *couple)
const G4String & GetProcessName() const
const std::vector< G4VEnergyLossProcess * > & GetEnergyLossProcessVector()
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void SetKineticEnergy(G4double aEnergy)
virtual G4double ComputeShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=0)=0
G4double GetRangeFromRestricteDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
static G4ProductionCutsTable * GetProductionCutsTable()
static G4GenericIon * GenericIon()
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idxRegion) const
const G4ParticleDefinition * FindParticle(const G4String &)
G4PhysicsTable * InverseRangeTable() const
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4ParticleTable * GetParticleTable()
G4double ComputeMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
G4double GetKinEnergy(G4double range, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
const G4Region * FindRegion(const G4String &)
const G4ParticleDefinition * FindIon(G4int Z, G4int A)
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
G4double ComputeGammaAttenuationLength(G4double kinEnergy, const G4Material *)
G4bool GetProcessActivation(G4VProcess *aProcess) const
G4double ComputeCrossSectionPerAtom(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
const G4String & GetName() const
void SetVerbose(G4int val)
void PrintDEDXTable(const G4ParticleDefinition *)
G4VAtomDeexcitation * AtomDeexcitation()
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double ComputeEnergyCutFromRangeCut(G4double range, const G4ParticleDefinition *, const G4Material *)
G4double GetPDGCharge() const
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const std::vector< G4VMultipleScattering * > & GetMultipleScatteringVector()
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
G4ProcessVector * GetProcessList() const