71 : maxEnergyTransfer(
DBL_MAX), verbose(verb)
73 currentParticle =
nullptr;
74 currentMaterial =
nullptr;
83 mass = charge2 = electronDensity = radLength = bg2 = beta2
84 = kineticEnergy = tmax = 0.0;
87 idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
88 = idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
89 = idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
90 = idxInvRangeProton = idxMscElectron = 0;
92 electron = positron = proton = muonPlus = muonMinus =
nullptr;
100#ifdef G4MULTITHREADED
106#ifdef G4MULTITHREADED
121 if(0 == nmat) { Initialisation(); }
122 G4double kinEnergyFinal = kinEnergy;
123 if(SetupKinematics(part, mat, kinEnergy)) {
127 kinEnergyFinal = 0.0;
128 }
else if(step < linLossLimit*r) {
129 kinEnergyFinal -= step*
ComputeDEDX(kinEnergy,part);
135 return kinEnergyFinal;
147 if(0 == nmat) { Initialisation(); }
148 G4double kinEnergyFinal = kinEnergy;
150 if(SetupKinematics(part, mat, kinEnergy)) {
154 if(step < linLossLimit*r) {
155 kinEnergyFinal += step*
ComputeDEDX(kinEnergy,part);
161 return kinEnergyFinal;
173 if(0 == nmat) { Initialisation(); }
176 if(SetupKinematics(part, mat, kinEnergy)) {
177 if(part == electron || part == positron) {
179 ComputeValue(kinEnergy, GetPhysicsTable(
fMscElectron), idxMscElectron);
181 if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
182 else if(x < 0.9999) { res = -
G4Log(1.0 - x)*stepLength/x; }
198 if(0 == nmat) { Initialisation(); }
199 if(!part || !mat || kinEnergy < keV) {
return false; }
201 if(part != currentParticle) {
203 currentParticle = part;
208 if(mat != currentMaterial) {
211 G4cout <<
"### G4EnergyLossForExtrapolator WARNING:index i= "
212 << i <<
" is out of table - NO extrapolation" <<
G4endl;
215 currentMaterial = mat;
221 if(flag || kinEnergy != kineticEnergy) {
222 kineticEnergy = kinEnergy;
226 bg2 = tau * (tau + 2.0);
227 beta2 = bg2/(gam*gam);
229 if(part == electron) tmax *= 0.5;
230 else if(part != positron) {
232 tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
234 if(tmax > maxEnergyTransfer) { tmax = maxEnergyTransfer; }
242G4EnergyLossForExtrapolator::FindParticle(
const G4String& name)
245 if(name != currentParticleName) {
248 G4cout <<
"### G4EnergyLossForExtrapolator WARNING: "
249 <<
"FindParticle() fails to find "
265 if(part == electron) {
266 x = ComputeValue(ekin, GetPhysicsTable(
fDedxElectron), idxDedxElectron);
267 }
else if(part == positron) {
268 x = ComputeValue(ekin, GetPhysicsTable(
fDedxPositron), idxDedxPositron);
269 }
else if(part == muonPlus || part == muonMinus) {
270 x = ComputeValue(ekin, GetPhysicsTable(
fDedxMuon), idxDedxMuon);
272 G4double e = ekin*proton_mass_c2/mass;
273 x = ComputeValue(e, GetPhysicsTable(
fDedxProton), idxDedxProton)*charge2;
285 if(part == electron) {
286 x = ComputeValue(ekin, GetPhysicsTable(
fRangeElectron), idxRangeElectron);
287 }
else if(part == positron) {
288 x = ComputeValue(ekin, GetPhysicsTable(
fRangePositron), idxRangePositron);
289 }
else if(part == muonPlus || part == muonMinus) {
290 x = ComputeValue(ekin, GetPhysicsTable(
fRangeMuon), idxRangeMuon);
292 G4double massratio = proton_mass_c2/mass;
294 x = ComputeValue(e, GetPhysicsTable(
fRangeProton), idxRangeProton)
295 /(charge2*massratio);
307 if(part == electron) {
309 idxInvRangeElectron);
310 }
else if(part == positron) {
312 idxInvRangePositron);
313 }
else if(part == muonPlus || part == muonMinus) {
314 x = ComputeValue(range, GetPhysicsTable(
fInvRangeMuon), idxInvRangeMuon);
316 G4double massratio = proton_mass_c2/mass;
317 G4double r = range*massratio*charge2;
319 idxInvRangeProton)/massratio;
326void G4EnergyLossForExtrapolator::Initialisation()
329 G4cout <<
"### G4EnergyLossForExtrapolator::Initialisation" <<
G4endl;
331 currentParticle =
nullptr;
332 currentMaterial =
nullptr;
341 currentParticleName =
"";
347void G4EnergyLossForExtrapolator::BuildTables()
349#ifdef G4MULTITHREADED
353 G4cout <<
"### G4EnergyLossForExtrapolator::BuildTables for "
355 << nbins <<
" Emin(MeV)= " << emin <<
" Emax(MeV)= " << emax
361 }
else if(nmat != newmat) {
365#ifdef G4MULTITHREADED
G4double G4Log(G4double x)
#define G4MUTEX_INITIALIZER
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
static size_t GetNumberOfMaterials()
G4double GetElectronDensity() const
G4double GetRadlen() const
static G4MuonMinus * MuonMinus()
static G4MuonPlus * MuonPlus()
G4double GetPDGMass() const
G4double GetPDGCharge() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
static G4Positron * Positron()
static G4Proton * Proton()
const char * name(G4int ptype)