68 : maxEnergyTransfer(
DBL_MAX), verbose(verb)
70 currentParticle =
nullptr;
71 currentMaterial =
nullptr;
80 mass = charge2 = electronDensity = radLength = bg2 = beta2
81 = kineticEnergy = tmax = 0.0;
84 idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
85 = idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
86 = idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
87 = idxInvRangeProton = idxMscElectron = 0;
89 electron = positron = proton = muonPlus = muonMinus =
nullptr;
100 if(0 == nmat) { Initialisation(); }
101 G4double kinEnergyFinal = kinEnergy;
102 if(SetupKinematics(part, mat, kinEnergy)) {
106 kinEnergyFinal = 0.0;
107 }
else if(step < linLossLimit*r) {
108 kinEnergyFinal -= step*
ComputeDEDX(kinEnergy,part);
114 return kinEnergyFinal;
126 if(0 == nmat) { Initialisation(); }
127 G4double kinEnergyFinal = kinEnergy;
129 if(SetupKinematics(part, mat, kinEnergy)) {
133 if(step < linLossLimit*r) {
134 kinEnergyFinal += step*
ComputeDEDX(kinEnergy,part);
140 return kinEnergyFinal;
152 if(0 == nmat) { Initialisation(); }
155 if(SetupKinematics(part, mat, kinEnergy)) {
156 if(part == electron || part == positron) {
158 ComputeValue(kinEnergy, GetPhysicsTable(
fMscElectron), idxMscElectron);
160 if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
161 else if(x < 0.9999) { res = -
G4Log(1.0 - x)*stepLength/
x; }
177 if(0 == nmat) { Initialisation(); }
178 if(!part || !mat || kinEnergy <
keV) {
return false; }
180 if(part != currentParticle) {
182 currentParticle = part;
187 if(mat != currentMaterial) {
190 G4cout <<
"### G4EnergyLossForExtrapolator WARNING:index i= "
191 << i <<
" is out of table - NO extrapolation" <<
G4endl;
194 currentMaterial = mat;
200 if(flag || kinEnergy != kineticEnergy) {
201 kineticEnergy = kinEnergy;
205 bg2 = tau * (tau + 2.0);
206 beta2 = bg2/(gam*gam);
208 if(part == electron) tmax *= 0.5;
209 else if(part != positron) {
213 if(tmax > maxEnergyTransfer) { tmax = maxEnergyTransfer; }
221 G4EnergyLossForExtrapolator::FindParticle(
const G4String&
name)
224 if(name != currentParticleName) {
227 G4cout <<
"### G4EnergyLossForExtrapolator WARNING: "
228 <<
"FindParticle() fails to find "
244 if(part == electron) {
245 x = ComputeValue(ekin, GetPhysicsTable(
fDedxElectron), idxDedxElectron);
246 }
else if(part == positron) {
247 x = ComputeValue(ekin, GetPhysicsTable(
fDedxPositron), idxDedxPositron);
248 }
else if(part == muonPlus || part == muonMinus) {
249 x = ComputeValue(ekin, GetPhysicsTable(
fDedxMuon), idxDedxMuon);
252 x = ComputeValue(e, GetPhysicsTable(
fDedxProton), idxDedxProton)*charge2;
264 if(part == electron) {
265 x = ComputeValue(ekin, GetPhysicsTable(
fRangeElectron), idxRangeElectron);
266 }
else if(part == positron) {
267 x = ComputeValue(ekin, GetPhysicsTable(
fRangePositron), idxRangePositron);
268 }
else if(part == muonPlus || part == muonMinus) {
269 x = ComputeValue(ekin, GetPhysicsTable(
fRangeMuon), idxRangeMuon);
273 x = ComputeValue(e, GetPhysicsTable(
fRangeProton), idxRangeProton)
274 /(charge2*massratio);
286 if(part == electron) {
288 idxInvRangeElectron);
289 }
else if(part == positron) {
291 idxInvRangePositron);
292 }
else if(part == muonPlus || part == muonMinus) {
293 x = ComputeValue(range, GetPhysicsTable(
fInvRangeMuon), idxInvRangeMuon);
296 G4double r = range*massratio*charge2;
298 idxInvRangeProton)/massratio;
305 void G4EnergyLossForExtrapolator::Initialisation()
308 G4cout <<
"### G4EnergyLossForExtrapolator::Initialisation" <<
G4endl;
310 currentParticle =
nullptr;
311 currentMaterial =
nullptr;
321 currentParticleName =
"";
330 void G4EnergyLossForExtrapolator::BuildTables()
332 G4AutoLock l(&G4EnergyLossForExtrapolatorMutex);
336 G4cout <<
"### G4EnergyLossForExtrapolator::BuildTables for "
337 << nmat <<
" materials Nbins= " << nbins
338 <<
" Emin(MeV)= " << emin <<
" Emax(MeV)= " << emax <<
G4endl;
348 G4AutoLock l(&G4EnergyLossForExtrapolatorMutex);
static G4MuonPlus * MuonPlus()
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
#define G4MUTEX_INITIALIZER
static constexpr double TeV
G4GLOB_DLL std::ostream G4cout
const G4ParticleDefinition const G4Material *G4double range
G4double GetElectronDensity() const
static constexpr double eplus
static G4Proton * Proton()
static size_t GetNumberOfMaterials()
G4double GetRadlen() const
G4double G4Log(G4double x)
static G4Positron * Positron()
G4double GetPDGMass() const
static G4ParticleTable * GetParticleTable()
static G4MuonMinus * MuonMinus()
static G4Electron * Electron()
static constexpr double MeV
G4double GetPDGCharge() const
static constexpr double keV