94 currentCoupleIndex = 0;
108 currentParticleName=
"";
109 currentMaterialName=
"";
115 isApplicable =
false;
123 for (
G4int i=0; i<nLocalMaterials; ++i) {
124 delete localCouples[i];
135 if(couple && UpdateParticle(p, kinEnergy) ) {
136 res = manager->
GetDEDX(p, kinEnergy, couple);
139 if(FindEmModel(p, currentProcessName, kinEnergy)) {
155 G4cout <<
"G4EmCalculator::GetDEDX: E(MeV)= " << kinEnergy/MeV
156 <<
" DEDX(MeV/mm)= " << res*mm/MeV
157 <<
" DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->
GetDensity())
160 <<
" isIon= " << isIon
185 if(couple && UpdateParticle(p, kinEnergy)) {
188 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
189 <<
" range(mm)= " << res/mm
207 if(couple && UpdateParticle(p, kinEnergy)) {
210 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
211 <<
" range(mm)= " << res/mm
229 if(couple && UpdateParticle(p, kinEnergy)) {
230 res = manager->
GetRange(p, kinEnergy, couple);
232 G4cout <<
"G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
233 <<
" range(mm)= " << res/mm
284 if(couple && UpdateParticle(p, 1.0*GeV)) {
285 res = manager->
GetEnergy(p, range, couple);
287 G4cout <<
"G4EmCalculator::GetKinEnergy: Range(mm)= " << range/mm
288 <<
" KinE(MeV)= " << res/MeV
317 if(couple && UpdateParticle(p, kinEnergy)) {
319 FindLambdaTable(p, processName, kinEnergy);
323 res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
329 G4cout <<
"G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
330 <<
" cross(cm-1)= " << res*cm
334 G4cout <<
" idx= " << idx <<
" Escaled((MeV)= "
335 << kinEnergy*massRatio
336 <<
" q2= " << chargeSquare;
382 if(x > 0.0) { res = 1.0/x; }
384 G4cout <<
"G4EmCalculator::GetMeanFreePath: E(MeV)= " << kinEnergy/MeV
385 <<
" MFP(mm)= " << res/mm
428 G4cout <<
"### G4EmCalculator: Inverse Range Table for "
441 currentMaterial = mat;
442 currentMaterialName = mat->
GetName();
446 <<
" in " << currentMaterialName
447 <<
" e(MeV)= " << kinEnergy/MeV <<
" cut(MeV)= " << cut/MeV
450 if(UpdateParticle(p, kinEnergy)) {
451 if(FindEmModel(p, processName, kinEnergy)) {
452 G4double escaled = kinEnergy*massRatio;
455 mat, baseParticle, escaled, cut) * chargeSquare;
458 <<
" Escaled(MeV)= " << escaled;
462 if(verbose > 1) {
G4cout <<
" no basePart E(MeV)= " << kinEnergy <<
" "; }
465 G4cout << currentModel->
GetName() <<
": DEDX(MeV/mm)= " << res*mm/MeV
466 <<
" DEDX(MeV*cm^2/g)= "
487 G4cout <<
"At boundary energy(MeV)= " << eth/MeV
488 <<
" DEDX(MeV/mm)= " << res1*mm/MeV
496 if(res1 > 0.0 && escaled > 0.0) {
497 res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
514 G4cout <<
"After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
515 <<
" DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->
GetDensity())
522 G4cout <<
"Sum: E(MeV)= " << kinEnergy/MeV
523 <<
" DEDX(MeV/mm)= " << res*mm/MeV
524 <<
" DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->
GetDensity())
525 <<
" cut(MeV)= " << cut/MeV
527 <<
" in " << currentMaterialName
528 <<
" Zi^2= " << chargeSquare
529 <<
" isIon=" << isIon
543 currentMaterial = mat;
544 currentMaterialName = mat->
GetName();
546 if(UpdateParticle(part, kinEnergy)) {
549 const std::vector<G4VEnergyLossProcess*> vel =
551 G4int n = vel.size();
556 for(
G4int i=0; i<n; ++i) {
559 if(ActiveForParticle(part, p)) {
562 dedx +=
ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),mat,cut);
623 <<
" NuclearDEDX(MeV/mm)= " << res*mm/MeV
624 <<
" NuclearDEDX(MeV*cm^2/g)= "
650 currentMaterial = mat;
651 currentMaterialName = mat->
GetName();
653 if(UpdateParticle(p, kinEnergy)) {
654 if(FindEmModel(p, processName, kinEnergy)) {
657 e *= kinEnergy*massRatio;
659 mat, baseParticle, e, cut, e) * chargeSquare;
664 G4cout <<
"G4EmCalculator::ComputeXSPerVolume: E(MeV)= " << kinEnergy/MeV
665 <<
" cross(cm-1)= " << res*cm
666 <<
" cut(keV)= " << cut/keV
700 if(UpdateParticle(p, kinEnergy)) {
701 if(FindEmModel(p, processName, kinEnergy)) {
704 e *= kinEnergy*massRatio;
706 baseParticle, e, Z, A, cut) * chargeSquare;
711 G4cout <<
"E(MeV)= " << kinEnergy/MeV
712 <<
" cross(barn)= " << res/barn
714 <<
" Z= " << Z <<
" A= " << A/(g/mole) <<
" g/mole"
747 if(res > 0.0) { res = 1.0/res; }
780 if(x > 0.0) { mfp = 1.0/x; }
782 G4cout <<
"E(MeV)= " << kinEnergy/MeV
783 <<
" MFP(mm)= " << mfp/mm
811 ConvertRangeToEnergy(part, mat, range);
831 if(p != currentParticle) {
842 currentProcess = FindEnergyLossProcess(p);
843 currentProcessName =
"";
859 && currentParticleName !=
"deuteron"
860 && currentParticleName !=
"triton"
861 && currentParticleName !=
"alpha+"
862 && currentParticleName !=
"helium"
863 && currentParticleName !=
"hydrogen"
867 baseParticle = theGenericIon;
893 if(name != currentParticleName) {
896 G4cout <<
"### WARNING: G4EmCalculator::FindParticle fails to find "
918 if(name != currentMaterialName) {
920 currentMaterialName = name;
922 G4cout <<
"### WARNING: G4EmCalculator::FindMaterial fails to find "
925 return currentMaterial;
933 if(reg !=
"" && reg !=
"world") {
947 if(!material)
return 0;
948 currentMaterial = material;
949 currentMaterialName = material->
GetName();
965 if(!material)
return false;
966 currentMaterial = material;
967 currentMaterialName = material->
GetName();
968 for (
G4int i=0; i<nLocalMaterials; ++i) {
969 if(material == localMaterials[i] && cut == localCuts[i]) {
970 currentCouple = localCouples[i];
971 currentCoupleIndex = currentCouple->
GetIndex();
977 localMaterials.push_back(material);
978 localCouples.push_back(cc);
979 localCuts.push_back(cut);
982 currentCoupleIndex = currentCouple->
GetIndex();
994 if (!currentLambda || p != lambdaParticle || processName != lambdaName) {
995 lambdaName = processName;
1000 if(isIon) { part = theGenericIon; }
1003 currentName = processName;
1011 isApplicable =
true;
1013 G4cout <<
"G4VEnergyLossProcess is found out: " << currentName
1021 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
1025 isApplicable =
true;
1027 G4cout <<
"G4VEmProcess is found out: " << currentName <<
G4endl;
1059 isApplicable =
false;
1061 G4cout <<
"G4EmCalculator::FindEmModel WARNING: no particle defined"
1063 return isApplicable;
1067 G4double scaledEnergy = kinEnergy*massRatio;
1068 if(isIon) { part = theGenericIon; }
1071 G4cout <<
"## G4EmCalculator::FindEmModel for " << partname
1073 <<
") and " << processName <<
" at E(MeV)= " << scaledEnergy
1075 if(p != part) {
G4cout <<
" GenericIon is the base particle" <<
G4endl; }
1079 currentName = processName;
1090 if(loweModel == currentModel) { loweModel = 0; }
1096 G4VEmProcess* proc = FindDiscreteProcess(part, processName);
1102 if(loweModel == currentModel) { loweModel = 0; }
1116 if(loweModel == currentModel) { loweModel = 0; }
1117 isApplicable =
true;
1127 G4cout <<
" LowEnergy model <" << loweModel->
GetName() <<
">";
1132 return isApplicable;
1145 && currentParticleName !=
"deuteron"
1146 && currentParticleName !=
"triton"
1147 && currentParticleName !=
"alpha+"
1148 && currentParticleName !=
"helium"
1149 && currentParticleName !=
"hydrogen"
1150 ) { part = theGenericIon; }
1163 const std::vector<G4VEnergyLossProcess*> v =
1166 for(
G4int i=0; i<
n; ++i) {
1167 if((v[i])->GetProcessName() == processName) {
1169 if(ActiveForParticle(part, p)) {
1185 const std::vector<G4VEmProcess*> v =
1188 for(
G4int i=0; i<
n; ++i) {
1189 if((v[i])->GetProcessName() == processName) {
1191 if(ActiveForParticle(part, p)) {
1207 const std::vector<G4VMultipleScattering*> v =
1210 for(
G4int i=0; i<
n; ++i) {
1211 if((v[i])->GetProcessName() == processName) {
1213 if(ActiveForParticle(part, p)) {
1231 for(
G4int i=0; i<
n; ++i) {
1232 if((*pv)[i] == proc) {
G4DLLIMPORT std::ostream G4cout
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(G4double aEnergy)
const G4ParticleDefinition * FindParticle(const G4String &)
G4double ComputeMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
G4double GetShellIonisationCrossSectionPerAtom(const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy)
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
const G4ParticleDefinition * FindIon(G4int Z, G4int A)
G4double ComputeGammaAttenuationLength(G4double kinEnergy, const G4Material *)
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
void SetVerbose(G4int val)
G4double ComputeEnergyCutFromRangeCut(G4double range, const G4ParticleDefinition *, const G4Material *)
const G4MaterialCutsCouple * FindCouple(const G4Material *, const G4Region *r=0)
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
G4double ComputeCrossSectionPerAtom(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=0)
void PrintDEDXTable(const G4ParticleDefinition *)
const G4Region * FindRegion(const G4String &)
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double GetKinEnergy(G4double range, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double ComputeShellIonisationCrossSectionPerAtom(const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy, const G4Material *mat=0)
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
void PrintRangeTable(const G4ParticleDefinition *)
void PrintInverseRangeTable(const G4ParticleDefinition *)
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=0)
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)
const G4Material * FindMaterial(const G4String &)
G4double EffectiveChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4double NuclearDEDX(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy, G4bool fluct=true)
G4double EffectiveChargeCorrection(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
static G4GenericIon * GenericIon()
static G4LossTableManager * Instance()
const std::vector< G4VEmProcess * > & GetEmProcessVector()
G4double GetCSDARange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
G4double GetEnergy(const G4ParticleDefinition *aParticle, G4double range, const G4MaterialCutsCouple *couple)
const std::vector< G4VMultipleScattering * > & GetMultipleScatteringVector()
const std::vector< G4VEnergyLossProcess * > & GetEnergyLossProcessVector()
G4VAtomDeexcitation * AtomDeexcitation()
G4double GetRangeFromRestricteDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4EmCorrections * EmCorrections()
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double GetDensity() const
const G4String & GetName() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4bool GetProcessActivation(G4VProcess *aProcess) const
G4ProcessVector * GetProcessList() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4ProductionCuts * GetProductionCuts() const
virtual G4double ComputeShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=0)=0
virtual G4double GetShellIonisationCrossSectionPerAtom(const G4ParticleDefinition *, G4int Z, G4AtomicShellEnumerator shell, G4double kinE, const G4Material *mat=0)=0
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
G4double LowEnergyLimit() const
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
const G4String & GetName() const
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idxRegion) const
const G4PhysicsTable * LambdaTable() const
const G4ParticleDefinition * BaseParticle() const
G4PhysicsTable * RangeTableForLoss() const
G4PhysicsTable * LambdaTable()
G4PhysicsTable * InverseRangeTable() const
G4VEmModel * SelectModelForMaterial(G4double kinEnergy, size_t &idx) const
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio)
G4PhysicsTable * DEDXTable() const
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
const G4String & GetProcessName() const