76 :maxEnergyTransfer(
DBL_MAX),verbose(verb),isInitialised(false)
89 mass = charge2 = electronDensity = radLength = bg2 = beta2
90 = kineticEnergy = tmax = 0;
93 dedxElectron = dedxPositron = dedxProton = rangeElectron
94 = rangePositron = rangeProton = invRangeElectron = invRangePositron
95 = invRangeProton = mscElectron = dedxMuon = rangeMuon = invRangeMuon = 0;
97 electron = positron = proton = muonPlus = muonMinus = 0;
104 for(
G4int i=0; i<nmat; i++) {
delete couples[i];}
109 delete rangeElectron;
110 delete rangePositron;
113 delete invRangeElectron;
114 delete invRangePositron;
115 delete invRangeProton;
128 if(!isInitialised) Initialisation();
129 G4double kinEnergyFinal = kinEnergy;
130 if(SetupKinematics(part, mat, kinEnergy)) {
134 kinEnergyFinal = 0.0;
135 }
else if(step < linLossLimit*r) {
136 kinEnergyFinal -= step*
ComputeDEDX(kinEnergy,part);
142 return kinEnergyFinal;
152 if(!isInitialised) Initialisation();
153 G4double kinEnergyFinal = kinEnergy;
155 if(SetupKinematics(part, mat, kinEnergy)) {
159 if(step < linLossLimit*r) {
160 kinEnergyFinal += step*
ComputeDEDX(kinEnergy,part);
166 return kinEnergyFinal;
177 if(!isInitialised) Initialisation();
178 if(SetupKinematics(part, mat, kinEnergy)) {
179 if(part == electron || part == positron) {
180 G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
181 if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0);
182 else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/
x;
198 if(!part || !mat || kinEnergy <
keV)
return false;
199 if(!isInitialised) Initialisation();
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) {
234 if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer;
241 void G4EnergyLossForExtrapolator::Initialisation()
243 isInitialised =
true;
245 G4cout <<
"### G4EnergyLossForExtrapolator::Initialisation" <<
G4endl;
257 currentParticleName =
"";
264 for(
G4int i=0; i<nmat; i++) {
266 couples.push_back(couple);
269 dedxElectron = PrepareTable();
270 dedxPositron = PrepareTable();
271 dedxMuon = PrepareTable();
272 dedxProton = PrepareTable();
273 rangeElectron = PrepareTable();
274 rangePositron = PrepareTable();
275 rangeMuon = PrepareTable();
276 rangeProton = PrepareTable();
277 invRangeElectron = PrepareTable();
278 invRangePositron = PrepareTable();
279 invRangeMuon = PrepareTable();
280 invRangeProton = PrepareTable();
281 mscElectron = PrepareTable();
286 G4cout <<
"### G4EnergyLossForExtrapolator Builds electron tables" <<
G4endl;
288 ComputeElectronDEDX(electron, dedxElectron);
293 G4cout <<
"### G4EnergyLossForExtrapolator Builds positron tables" <<
G4endl;
295 ComputeElectronDEDX(positron, dedxPositron);
300 G4cout <<
"### G4EnergyLossForExtrapolator Builds muon tables" <<
G4endl;
302 ComputeMuonDEDX(muonPlus, dedxMuon);
307 G4cout <<
"### G4EnergyLossForExtrapolator Builds proton tables" <<
G4endl;
309 ComputeProtonDEDX(proton, dedxProton);
313 ComputeTrasportXS(electron, mscElectron);
322 for(
G4int i=0; i<nmat; i++) {
336 if(name != currentParticleName) {
339 G4cout <<
"### G4EnergyLossForExtrapolator WARNING:FindParticle fails to find "
354 if(part == electron) x = ComputeValue(kinEnergy, dedxElectron);
355 else if(part == positron) x = ComputeValue(kinEnergy, dedxPositron);
356 else if(part == muonPlus || part == muonMinus) {
357 x = ComputeValue(kinEnergy, dedxMuon);
360 x = ComputeValue(e, dedxProton)*charge2;
371 if(part == electron) x = ComputeValue(kinEnergy, rangeElectron);
372 else if(part == positron) x = ComputeValue(kinEnergy, rangePositron);
373 else if(part == muonPlus || part == muonMinus)
374 x = ComputeValue(kinEnergy, rangeMuon);
378 x = ComputeValue(e, rangeProton)/(charge2*massratio);
389 if(part == electron) x = ComputeValue(range, invRangeElectron);
390 else if(part == positron) x = ComputeValue(range, invRangePositron);
391 else if(part == muonPlus || part == muonMinus)
392 x = ComputeValue(range, invRangeMuon);
396 x = ComputeValue(r, invRangeProton)/massratio;
414 currentParticle =
part;
418 G4cout <<
"G4EnergyLossForExtrapolator::ComputeElectronDEDX for "
422 for(
G4int i=0; i<nmat; i++) {
430 for(
G4int j=0; j<=nbins; j++) {
436 <<
" e(MeV)= " << e/
MeV
437 <<
" dedx(Mev/cm)= " << dedx*
cm/
MeV
462 currentParticle =
part;
471 for(
G4int i=0; i<nmat; i++) {
478 for(
G4int j=0; j<=nbins; j++) {
487 <<
" e(MeV)= " << e/
MeV
488 <<
" dedx(Mev/cm)= " << dedx*
cm/
MeV
507 currentParticle =
part;
516 for(
G4int i=0; i<nmat; i++) {
523 for(
G4int j=0; j<=nbins; j++) {
530 <<
" e(MeV)= " << e/
MeV
531 <<
" dedx(Mev/cm)= " << dedx*
cm/
MeV
532 <<
" dedx(Mev.cm2/g)= " << dedx/((mat->
GetDensity())/(
g/
cm2)) << G4endl;
551 currentParticle =
part;
560 for(
G4int i=0; i<nmat; i++) {
567 for(
G4int j=0; j<=nbins; j++) {
573 G4cout <<
"j= " << j <<
" e(MeV)= " << e/
MeV
574 <<
" xs(1/mm)= " << xs*
mm <<
G4endl;