90 G4double t0 = std::max(tMin, lowestE);
92 if(t0 >= tm)
return 0.0;
95 Shell(Z, shell)->BindingEnergy();
97 if(e <= bindingEnergy)
return 0.0;
101 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
102 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
104 if(verbose > 1 || (Z==4 && e>= 1.0 && e<= 0.0)) {
105 G4cout <<
"G4eIonisationSpectrum::Probability: Z= " << Z
106 <<
"; shell= " << shell
107 <<
"; E(keV)= " << e/keV
108 <<
"; Eb(keV)= " << bindingEnergy/keV
118 for (
G4int i=0; i<iMax; i++)
125 if(p[3] > 0.5) p[3] = 0.5;
127 G4double gLocal = energy/electron_mass_c2 + 1.;
128 p.push_back((2.0*gLocal - 1.0)/(gLocal*gLocal));
133 p[iMax-1] = Function(p[3], p);
136 G4cout <<
"WARNING: G4eIonisationSpectrum::Probability "
137 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
138 << Z <<
". Please check and/or update it " <<
G4endl;
141 if(e >= 1. && e <= 0. && Z == 4) p.push_back(0.0);
144 G4double val = IntSpectrum(x1, x2, p);
145 G4double x0 = (lowestE + bindingEnergy)/energy;
146 G4double nor = IntSpectrum(x0, 0.5, p);
148 if(verbose > 1 || (Z==4 && e>= 1.0 && e<= 0.0)) {
149 G4cout <<
"tcut= " << tMin
150 <<
"; tMax= " << tMax
166 if(nor > 0.0) val /= nor;
185 G4double t0 = std::max(tMin, lowestE);
187 if(t0 >= tm)
return 0.0;
190 Shell(Z, shell)->BindingEnergy();
192 if(e <= bindingEnergy)
return 0.0;
194 G4double energy = e + bindingEnergy;
196 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
197 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
200 G4cout <<
"G4eIonisationSpectrum::AverageEnergy: Z= " << Z
201 <<
"; shell= " << shell
202 <<
"; E(keV)= " << e/keV
203 <<
"; bindingE(keV)= " << bindingEnergy/keV
212 for (
G4int i=0; i<iMax; i++)
219 if(p[3] > 0.5) p[3] = 0.5;
221 G4double gLocal2 = energy/electron_mass_c2 + 1.;
222 p.push_back((2.0*gLocal2 - 1.0)/(gLocal2*gLocal2));
228 p[iMax-1] = Function(p[3], p);
231 G4cout <<
"WARNING: G4eIonisationSpectrum::AverageEnergy "
232 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
233 << Z <<
". Please check and/or update it " <<
G4endl;
236 G4double val = AverageValue(x1, x2, p);
237 G4double x0 = (lowestE + bindingEnergy)/energy;
238 G4double nor = IntSpectrum(x0, 0.5, p);
242 G4cout <<
"tcut(MeV)= " << tMin/MeV
243 <<
"; tMax(MeV)= " << tMax/MeV
258 if(nor > 0.0) val /= nor;
274 G4double t0 = std::max(tMin, lowestE);
276 if(t0 > tm)
return tDelta;
279 Shell(Z, shell)->BindingEnergy();
281 if(e <= bindingEnergy)
return 0.0;
283 G4double energy = e + bindingEnergy;
285 G4double x1 = std::min(0.5,(t0 + bindingEnergy)/energy);
286 G4double x2 = std::min(0.5,(tm + bindingEnergy)/energy);
287 if(x1 >= x2)
return tDelta;
290 G4cout <<
"G4eIonisationSpectrum::SampleEnergy: Z= " << Z
291 <<
"; shell= " << shell
292 <<
"; E(keV)= " << e/keV
300 for (
G4int i=0; i<iMax; i++)
307 if(p[3] > 0.5) p[3] = 0.5;
309 G4double gLocal3 = energy/electron_mass_c2 + 1.;
310 p.push_back((2.0*gLocal3 - 1.0)/(gLocal3*gLocal3));
316 p[iMax-1] = Function(p[3], p);
319 G4cout <<
"WARNING: G4eIonisationSpectrum::SampleSpectrum "
320 <<
"parameter p[3] <= 0. G4LEDATA dabatase might be corrupted for Z = "
321 << Z <<
". Please check and/or update it " <<
G4endl;
327 if(a1 < a2) aria1 = IntSpectrum(a1, a2, p);
331 if(a3 < a4) aria2 = IntSpectrum(a3, a4, p);
334 G4double amaj, fun, q, x, z1, z2, dx, dx1;
341 for (
G4int j=5; j<iMax; j++) {
342 if(p[j] > amaj) amaj = p[j];
354 dx = (p[2] - p[1]) / 3.0;
355 dx1= std::exp(std::log(p[3]/p[2]) / 16.0);
356 for (i=4; i<iMax-1; i++) {
360 }
else if(iMax-2 == i) {
366 if(x >= z1 && x <= z2)
break;
369 fun = p[i] + (x - z1) * (p[i+1] - p[i])/(z2 - z1);
372 G4cout <<
"WARNING in G4eIonisationSpectrum::SampleEnergy:"
373 <<
" Majoranta " << amaj
375 <<
" in the first aria at x= " << x
387 amaj = std::max(p[iMax-1], Function(0.5, p)) * factor;
394 fun = Function(x, p);
397 G4cout <<
"WARNING in G4eIonisationSpectrum::SampleEnergy:"
398 <<
" Majoranta " << amaj
400 <<
" in the second aria at x= " << x
412 tDelta = x*energy - bindingEnergy;
415 G4cout <<
"tcut(MeV)= " << tMin/MeV
416 <<
"; tMax(MeV)= " << tMax/MeV
422 <<
"; be= " << bindingEnergy
424 <<
"; tDelta= " << tDelta
439 if(xMin >= xMax)
return sum;
441 G4double x1, x2, xs1, xs2, y1, y2, ys1, ys2, q;
450 G4double dx1= std::exp(std::log(p[3]/p[2]) / 16.0);
452 for (
size_t i=0; i<19; i++) {
467 }
else if (xMin < x2) {
477 ys1 += (xs1 - x1)*(y2 - y1)/(x2 - x1);
481 ys2 += (xs2 - x2)*(y1 - y2)/(x1 - x2);
484 q = (ys1*xs2 - ys2*xs1)/(xs1*xs2)
485 + std::log(xs2/xs1)*(ys2 - ys1)/(xs2 - xs1);
487 if(p.size() == 26)
G4cout <<
"i= " << i <<
" q= " << q <<
" sum= " << sum <<
G4endl;
498 x1 = std::max(xMin, p[3]);
499 if(x1 >= xMax)
return sum;
504 q = (xs1 - xs2)*(1.0 - p[0])
505 - p[iMax]*std::log(x2/x1)
506 + (1. - p[iMax])*(x2 - x1)
507 + 1./(1. - x2) - 1./(1. - x1)
508 + p[iMax]*std::log((1. - x2)/(1. - x1))
509 + 0.25*p[0]*(xs1*xs1 - xs2*xs2);
511 if(p.size() == 26)
G4cout <<
"param... q= " << q <<
" sum= " << sum <<
G4endl;
522 if(xMin >= xMax)
return sum;
524 G4double x1, x2, xs1, xs2, y1, y2, ys1, ys2;
533 G4double dx1= std::exp(std::log(p[3]/p[2]) / 16.0);
535 for (
size_t i=0; i<19; i++) {
549 }
else if (xMin < x2) {
559 ys1 += (xs1 - x1)*(y2 - y1)/(x2 - x1);
563 ys2 += (xs2 - x2)*(y1 - y2)/(x1 - x2);
566 sum += std::log(xs2/xs1)*(ys1*xs2 - ys2*xs1)/(xs2 - xs1)
579 x1 = std::max(xMin, p[3]);
580 if(x1 >= xMax)
return sum;
586 sum += std::log(x2/x1)*(1.0 - p[0])
587 + 0.5*(1. - p[iMax])*(x2*x2 - x1*x1)
588 + 1./(1. - x2) - 1./(1. - x1)
589 + (1. + p[iMax])*std::log((1. - x2)/(1. - x1))
590 + 0.5*p[0]*(xs1 - xs2);
605 return 0.5 * kineticEnergy;
G4DLLIMPORT std::ostream G4cout
static G4AtomicTransitionManager * Instance()
G4double Parameter(G4int Z, G4int shellIndex, G4int parameterIndex, G4double e) const
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