89 G4double t0 = std::max(tMin, lowestE);
91 if(t0 >= tm)
return 0.0;
94 Shell(Z, shell)->BindingEnergy();
96 if(e <= bindingEnergy)
return 0.0;
100 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
101 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
104 G4cout <<
"G4eIonisationSpectrum::Probability: Z= " << Z
105 <<
"; shell= " << shell
106 <<
"; E(keV)= " << e/keV
107 <<
"; Eb(keV)= " << bindingEnergy/keV
117 for (
G4int i=0; i<iMax; i++)
119 G4double x = theParam->Parameter(Z, shell, i, e);
124 if(p[3] > 0.5) p[3] = 0.5;
126 G4double gLocal = energy/electron_mass_c2 + 1.;
127 p.push_back((2.0*gLocal - 1.0)/(gLocal*gLocal));
132 p[iMax-1] = Function(p[3], p);
135 G4cout <<
"WARNING: G4eIonisationSpectrum::Probability "
136 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
137 << Z <<
". Please check and/or update it " <<
G4endl;
140 G4double val = IntSpectrum(x1, x2, p);
141 G4double x0 = (lowestE + bindingEnergy)/energy;
142 G4double nor = IntSpectrum(x0, 0.5, p);
145 G4cout <<
"tcut= " << tMin
146 <<
"; tMax= " << tMax
162 if(nor > 0.0) val /= nor;
181 G4double t0 = std::max(tMin, lowestE);
183 if(t0 >= tm)
return 0.0;
186 Shell(Z, shell)->BindingEnergy();
188 if(e <= bindingEnergy)
return 0.0;
190 G4double energy = e + bindingEnergy;
192 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
193 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
196 G4cout <<
"G4eIonisationSpectrum::AverageEnergy: Z= " << Z
197 <<
"; shell= " << shell
198 <<
"; E(keV)= " << e/keV
199 <<
"; bindingE(keV)= " << bindingEnergy/keV
208 for (
G4int i=0; i<iMax; i++)
210 G4double x = theParam->Parameter(Z, shell, i, e);
215 if(p[3] > 0.5) p[3] = 0.5;
217 G4double gLocal2 = energy/electron_mass_c2 + 1.;
218 p.push_back((2.0*gLocal2 - 1.0)/(gLocal2*gLocal2));
224 p[iMax-1] = Function(p[3], p);
227 G4cout <<
"WARNING: G4eIonisationSpectrum::AverageEnergy "
228 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
229 << Z <<
". Please check and/or update it " <<
G4endl;
232 G4double val = AverageValue(x1, x2, p);
233 G4double x0 = (lowestE + bindingEnergy)/energy;
234 G4double nor = IntSpectrum(x0, 0.5, p);
238 G4cout <<
"tcut(MeV)= " << tMin/MeV
239 <<
"; tMax(MeV)= " << tMax/MeV
254 if(nor > 0.0) val /= nor;
270 G4double t0 = std::max(tMin, lowestE);
272 if(t0 > tm)
return tDelta;
275 Shell(Z, shell)->BindingEnergy();
277 if(e <= bindingEnergy)
return 0.0;
279 G4double energy = e + bindingEnergy;
281 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
282 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
283 if(x1 >= x2)
return tDelta;
286 G4cout <<
"G4eIonisationSpectrum::SampleEnergy: Z= " << Z
287 <<
"; shell= " << shell
288 <<
"; E(keV)= " << e/keV
296 for (
G4int i=0; i<iMax; i++)
298 G4double x = theParam->Parameter(Z, shell, i, e);
303 if(p[3] > 0.5) p[3] = 0.5;
305 G4double gLocal3 = energy/electron_mass_c2 + 1.;
306 p.push_back((2.0*gLocal3 - 1.0)/(gLocal3*gLocal3));
312 p[iMax-1] = Function(p[3], p);
315 G4cout <<
"WARNING: G4eIonisationSpectrum::SampleSpectrum "
316 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
317 << Z <<
". Please check and/or update it " <<
G4endl;
323 if(a1 < a2) aria1 = IntSpectrum(a1, a2, p);
327 if(a3 < a4) aria2 = IntSpectrum(a3, a4, p);
330 G4double amaj, fun, q, x, z1, z2, dx, dx1;
337 for (
G4int j=5; j<iMax; j++) {
338 if(p[j] > amaj) amaj = p[j];
350 dx = (p[2] - p[1]) / 3.0;
351 dx1=
G4Exp(std::log(p[3]/p[2]) / 16.0);
352 for (i=4; i<iMax-1; i++) {
356 }
else if(iMax-2 == i) {
362 if(x >= z1 && x <= z2)
break;
365 fun = p[i] + (x - z1) * (p[i+1] - p[i])/(z2 - z1);
368 G4cout <<
"WARNING in G4eIonisationSpectrum::SampleEnergy:"
369 <<
" Majoranta " << amaj
371 <<
" in the first aria at x= " << x
383 amaj = std::max(p[iMax-1], Function(0.5, p)) * factor;
390 fun = Function(x, p);
393 G4cout <<
"WARNING in G4eIonisationSpectrum::SampleEnergy:"
394 <<
" Majoranta " << amaj
396 <<
" in the second aria at x= " << x
408 tDelta = x*energy - bindingEnergy;
411 G4cout <<
"tcut(MeV)= " << tMin/MeV
412 <<
"; tMax(MeV)= " << tMax/MeV
418 <<
"; be= " << bindingEnergy
420 <<
"; tDelta= " << tDelta
435 if(xMin >= xMax)
return sum;
437 G4double x1, x2, xs1, xs2, y1, y2, ys1, ys2, q;
448 for (
size_t i=0; i<19; i++) {
463 }
else if (xMin < x2) {
473 ys1 += (xs1 - x1)*(y2 - y1)/(x2 - x1);
477 ys2 += (xs2 - x2)*(y1 - y2)/(x1 - x2);
480 q = (ys1*xs2 - ys2*xs1)/(xs1*xs2)
481 + std::log(xs2/xs1)*(ys2 - ys1)/(xs2 - xs1);
483 if(p.size() == 26)
G4cout <<
"i= " << i <<
" q= " << q <<
" sum= " << sum <<
G4endl;
494 x1 = std::max(xMin, p[3]);
495 if(x1 >= xMax)
return sum;
500 q = (xs1 - xs2)*(1.0 - p[0])
501 - p[iMax]*std::log(x2/x1)
502 + (1. - p[iMax])*(x2 - x1)
503 + 1./(1. - x2) - 1./(1. - x1)
504 + p[iMax]*std::log((1. - x2)/(1. - x1))
505 + 0.25*p[0]*(xs1*xs1 - xs2*xs2);
507 if(p.size() == 26)
G4cout <<
"param... q= " << q <<
" sum= " << sum <<
G4endl;
518 if(xMin >= xMax)
return sum;
520 G4double x1, x2, xs1, xs2, y1, y2, ys1, ys2;
531 for (
size_t i=0; i<19; i++) {
545 }
else if (xMin < x2) {
555 ys1 += (xs1 - x1)*(y2 - y1)/(x2 - x1);
559 ys2 += (xs2 - x2)*(y1 - y2)/(x1 - x2);
562 sum += std::log(xs2/xs1)*(ys1*xs2 - ys2*xs1)/(xs2 - xs1)
575 x1 = std::max(xMin, p[3]);
576 if(x1 >= xMax)
return sum;
582 sum += std::log(x2/x1)*(1.0 - p[0])
583 + 0.5*(1. - p[iMax])*(x2*x2 - x1*x1)
584 + 1./(1. - x2) - 1./(1. - x1)
585 + (1. + p[iMax])*std::log((1. - x2)/(1. - x1))
586 + 0.5*p[0]*(xs1 - xs2);
594 theParam->PrintData();
601 return 0.5 * kineticEnergy;
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4GLOB_DLL std::ostream G4cout
static G4AtomicTransitionManager * Instance()
G4double AverageEnergy(G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell, const G4ParticleDefinition *pd=0) const
G4double SampleEnergy(G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell, const G4ParticleDefinition *pd=0) const
G4double MaxEnergyOfSecondaries(G4double kineticEnergy, G4int Z=0, const G4ParticleDefinition *pd=0) const
G4double Probability(G4int Z, G4double tMin, G4double tMax, G4double kineticEnergy, G4int shell, const G4ParticleDefinition *pd=0) const