15 const std::vector<double>& y,
16 double x1,
double x2,
const unsigned int xpower) {
18 if (xpower > 1)
return 0.;
19 if (x1 >= x2)
return 0.;
20 const long qi = mesh.
get_qi();
21 if (qi < 1)
return 0.;
24 if (x2 <= xmin || x1 >= xmax)
return 0.;
33 if (mesh.
get_interval(x1, n1, b1, n2, b2) != 1)
return 0.;
37 s = (x2 - x1) * y[n1];
39 s = 0.5 * (x2 * x2 - x1 * x1) * y[n1];
44 s += (b2 - x1) * y[n1];
46 s += 0.5 * (b2 * b2 - x1 * x1) * y[n1];
57 if (mesh.
get_interval(x2, n1, b1, n2, b2) != 1)
return 0.;
60 s += (x2 - b1) * y[n1];
62 s += 0.5 * (x2 * x2 - b1 * b1) * y[n1];
69 for (
long i = ibeg; i < iend; ++i) {
75 s += 0.5 * (b * b - a * a) * y[i];
82 const std::vector<double>& y, std::vector<double>& integ_y) {
84 const long qi = mesh.
get_qi();
85 if (qi < 1)
return 0.;
90 for (
long n = 0; n < qi; n++) {
91 const double xp1 = xp2;
93 const double step = xp2 - xp1;
94 if (y[n] < 0.0)
return 0.;
98 for (
long n = 0; n < qi; n++) integ_y[n] /= s;
107using CLHEP::electron_mass_c2;
108using CLHEP::fine_structure_const;
114 long fparticle_charge)
115 : particle_mass(fparticle_mass),
116 particle_charge(fparticle_charge),
118 s_primary_electron(fs_primary_electron),
120 mfunnamep(
"EnTransfCS::EnTransfCS(...)");
122 const double beta =
lorbeta(fgamma_1);
123 const double beta2 = beta * beta;
124 const double beta12 = 1.0 - beta2;
125 const double gamma = fgamma_1 + 1.;
134 double rme = electron_mass_c2;
135 if (beta12 > 1.0e-10) {
137 2.0 * rm2 * electron_mass_c2 * beta2 /
138 ((rm2 + rme * rme + 2.0 * rme * gamma *
particle_mass) * beta12);
145 log1C.assign(qe, 0.0);
146 log2C.assign(qe, 0.0);
149 Rruth.assign(qe, 0.0);
150 addaC.assign(qe, 0.0);
151#ifndef EXCLUDE_A_VALUES
152 addaC_a.assign(qe, 0.0);
162#ifndef EXCLUDE_A_VALUES
170 for (
long na = 0; na < qa; na++) {
171 const long qs =
hmd->
apacs[na]->get_qshell();
172 cher[na].assign(qs, std::vector<double>(qe, 0.));
173 fruth[na].assign(qs, std::vector<double>(qe, 0.));
174 adda[na].assign(qs, std::vector<double>(qe, 0.));
175 fadda[na].assign(qs, std::vector<double>(qe, 0.));
176 quan[na].assign(qs, 0.);
177 mean[na].assign(qs, 0.);
178#ifndef EXCLUDE_A_VALUES
179 cher_a[na].assign(qs, std::vector<double>(qe, 0.));
180 adda_a[na].assign(qs, std::vector<double>(qe, 0.));
181 fadda_a[na].assign(qs, std::vector<double>(qe, 0.));
182 quan_a[na].assign(qs, 0.);
183 mean_a[na].assign(qs, 0.);
188 double coefpa = fine_structure_const * q2 / (beta2 * CLHEP::pi);
189 const double coefCh = coefpa /
hmd->
eldens;
190 for (
long ne = 0; ne < qe; ne++) {
193 const double a0 = 1. + eps1;
194 const double a1 = -eps1 + a0 * beta12;
195 const double a2 = beta2 * eps2;
196 log1C[ne] = log(1. /
sqrt(a1 * a1 + a2 * a2));
199 const double a3 = 2. * electron_mass_c2 * beta2 / ec;
200 log2C[ne] = a3 > 0. ? log(a3) : 0.;
202 double a4 = atan(a2 / a1);
203 if (a1 < 0) a4 += CLHEP::pi;
206 const double a5 = eps2 * eps2;
207 const double a6 = (-a0 * a1 + beta2 * a5) / (a0 * a0 + a5);
208 chereC[ne] = coefCh * a6 * a4;
211 Rruth[ne] = 1. / (ec * ec);
218 ec * ec / (2. * ener * ener));
221 const double pg2 = gamma * gamma;
222 const double dgd = delta * (
gamma_1 - delta);
225 (2.0 * pg2 + 2.0 * gamma - 1.0) / dgd + 1.0);
232 for (
long na = 0; na < qa; na++) {
235 const long qs = pacs->get_qshell();
236 for (
long ns = 0; ns < qs; ns++) {
237 for (
long ne = 0; ne < qe; ne++) {
242 ics = pacs->get_integral_TICS(ns, e1, e2, ethr) / (e2 - e1);
244 ics = pacs->get_integral_ICS(ns, e1, e2) / (e2 - e1);
247 "na=" << na <<
" ns=" << ns <<
" ne=" << ne <<
'\n',
249 const double tacs =
hmd->
ACS[ne];
250 if (tacs <= 0.0)
continue;
251 cher[na][ns][ne] =
chereC[ne] * awq * ics / tacs;
252#ifndef EXCLUDE_A_VALUES
253 double acs = pacs->get_integral_ACS(ns, e1, e2) / (e2 - e1);
254 cher_a[na][ns][ne] =
chereC[ne] * awq * acs / tacs;
258 const double cR =
C1_MEV2_MBN * awq * coefpa / Z_mean;
260 for (
long ne = 0; ne < qe; ne++) {
264 const double r = pacs->get_integral_ACS(ns, e1, e2) * cR;
266 check_econd11a(r, < 0.0,
"na=" << na <<
" ns=" << ns <<
" ne=" << ne,
269 fruth[na][ns][ne] = (s + 0.5 * r) *
Rruth[ne];
271 "na=" << na <<
" ns=" << ns <<
" na=" << na,
mcerr);
277 for (
long ne = 0; ne < qe; ++ne) {
279#ifndef EXCLUDE_A_VALUES
287 const double eps11 = 1. + eps1;
288 const double sqepsi = eps11 * eps11 + eps2 * eps2;
290 (ec * Z_mean * sqepsi);
291 for (
long na = 0; na < qa; na++) {
294 const long qs = pacs->get_qshell();
295 for (
long ns = 0; ns < qs; ns++) {
298 ics = pacs->get_integral_TICS(ns, e1, e2, ethr) / (e2 - e1);
300 ics = pacs->get_integral_ICS(ns, e1, e2) / (e2 - e1);
302 double r = std::max(cL * awq * ics +
fruth[na][ns][ne], 0.);
303#ifndef EXCLUDE_A_VALUES
304 double acs = pacs->get_integral_ACS(ns, e1, e2) / (e2 - e1);
305 double r_a = std::max(cL * awq * acs +
fruth[na][ns][ne], 0.);
308 r +=
cher[na][ns][ne];
311 mcout <<
"negative adda\n";
312 mcout <<
"na=" << na <<
" ns=" << ns <<
" ne=" << ne
313 <<
": " << r <<
'\n';
317#ifndef EXCLUDE_A_VALUES
318 r_a +=
cher[na][ns][ne];
320 "na=" << na <<
" ns=" << ns <<
" na=" << na,
mcerr);
322 adda[na][ns][ne] = r;
324#ifndef EXCLUDE_A_VALUES
325 adda_a[na][ns][ne] = r_a;
331#ifndef EXCLUDE_A_VALUES
342 quanC = integrate(pcm_e,
addaC, emin, emax, 0) * rho;
343 meanC = integrate(pcm_e,
addaC, emin, emax, 1) * rho;
345#ifndef EXCLUDE_A_VALUES
346 quanC_a = integrate(pcm_e, addaC_a, emin, emax, 0) * rho;
347 meanC_a = integrate(pcm_e, addaC_a, emin, emax, 1) * rho;
350 const double coef = fine_structure_const * fine_structure_const * q2 * twopi /
351 (electron_mass_c2 * beta2) * rho;
363 meanC1 += coef * log(e2 / e1);
373 (e2 * e2 - e1 * e1) / (4.0 * ener * ener));
375#ifndef EXCLUDE_A_VALUES
380 meanC1_a += coef * (log(e2 / e1) - beta2 /
max_etransf * (e2 - e1) +
381 (e2 * e2 - e1 * e1) /
382 (4.0 * ener * ener));
388 for (
long na = 0; na < qa; na++) {
389 const long qs =
hmd->
apacs[na]->get_qshell();
390 for (
long ns = 0; ns < qs; ns++) {
391 quan[na][ns] = integrate(pcm_e,
adda[na][ns], emin, emax, 0) * rho;
392 mean[na][ns] = integrate(pcm_e,
adda[na][ns], emin, emax, 1) * rho;
393#ifndef EXCLUDE_A_VALUES
394 quan_a[na][ns] = integrate(pcm_e, adda_a[na][ns], emin, emax, 0) * rho;
395 mean_a[na][ns] = integrate(pcm_e, adda_a[na][ns], emin, emax, 1) * rho;
400 for (
long na = 0; na < qa; na++) {
401 const long qs =
hmd->
apacs[na]->get_qshell();
402 for (
long ns = 0; ns < qs; ns++) {
403 if (
quan[na][ns] > 0.0) {
404 const double s = cdf(pcm_e,
adda[na][ns],
fadda[na][ns]);
405 if (
fabs(s * rho -
quan[na][ns]) > 1.e-10) {
406 std::cerr <<
"Heed::EnTransfCS: Integrals differ (warning).\n";
409#ifndef EXCLUDE_A_VALUES
410 if (quan_a[na][ns] > 0.0) {
411 const double s = cdf(pcm_e, adda_a[na][ns], fadda_a[na][ns]);
412 if (
fabs(s * rho - quan_a[na][ns]) > 1.e-10) {
413 std::cerr <<
"Heed::EnTransfCS: Integrals differ (warning).\n";
421 for (
long ne = 0; ne < qe; ne++) {
423 const double det_value = 1.0 / (gamma * gamma) -
hmd->
epsi1[ne] * beta2;
424 length_y0[ne] = det_value > 0. ? beta / k0 * 1.0 /
sqrt(det_value) : 0.;
468#ifndef EXCLUDE_A_VALUES
479 Ifile <<
"EnTransfCS(l=" << l <<
"):\n";
488#ifndef EXCLUDE_A_VALUES
489 Ifile <<
"quanC=" <<
quanC <<
" quanC_a=" << quanC_a <<
'\n';
490 Ifile <<
"meanC=" <<
meanC <<
" meanC_a=" << meanC_a <<
'\n';
491 Ifile <<
"meanC1=" <<
meanC1 <<
" meanC1_a=" << meanC1_a <<
'\n';
501 Ifile <<
" enerc, log1C, log2C, chereC, addaC, "
502 "chereCangle Rruth length_y0\n";
503 for (ne = 0; ne < qe; ne++) {
505 <<
log1C[ne] << std::setw(12) <<
log2C[ne] << std::setw(12)
506 <<
chereC[ne] << std::setw(12) <<
addaC[ne] << std::setw(12)
508 << std::setw(12) <<
length_y0[ne] <<
'\n';
515 for (na = 0; na < qa; na++) {
517 long qs =
hmd->
apacs[na]->get_qshell();
520 for (ns = 0; ns < qs; ns++) {
522 Ifile <<
"quan =" << std::setw(13) <<
quan[na][ns]
523 <<
" mean =" << std::setw(13) <<
mean[na][ns] <<
'\n';
524#ifndef EXCLUDE_A_VALUES
525 Ifile <<
"quan_a =" << std::setw(13) << quan_a[na][ns]
526 <<
" mean_a=" << std::setw(13) << mean_a[na][ns] <<
'\n';
529 Ifile <<
" enerc, cher, cher_a, fruth, adda, "
530 " adda_a, fadda, fadda_a\n";
531 for (ne = 0; ne < qe; ne++) {
532 Ifile << std::setw(12)
534 << std::setw(12) <<
cher[na][ns][ne]
535#ifndef EXCLUDE_A_VALUES
536 << std::setw(12) << cher_a[na][ns][ne]
538 << std::setw(12) <<
fruth[na][ns][ne] << std::setw(12)
540#ifndef EXCLUDE_A_VALUES
541 << std::setw(12) << adda_a[na][ns][ne]
543 << std::setw(12) <<
fadda[na][ns][ne]
544#ifndef EXCLUDE_A_VALUES
545 << std::setw(12) << fadda_a[na][ns][ne]
#define check_econd11a(a, signb, add, stream)
#define mfunnamep(string)
const std::vector< double > & weight_quan() const
std::vector< std::vector< double > > quan
Number of collisions / cm, for each atom and shell.
long particle_charge
Charge in units of electron charge (used square, sign does not matter).
std::vector< double > Rruth
term called R in my paper
std::vector< double > log2C
common second log without cs
double gamma_1
Lorentz factor - 1 (the best dimensionless measurement of speed).
std::vector< double > chereCangle
angle of Cherenkov's radiation
std::vector< std::vector< double > > mean
First moment, for each atom and shell.
std::vector< std::vector< std::vector< double > > > fadda
Integral, normalised to unity.
std::vector< double > log1C
common first log without cs
double particle_mass
Particle mass [MeV].
std::vector< std::vector< std::vector< double > > > fruth
Rutherford term.
bool s_primary_electron
Flag indicating whether the primary particle is an electron.
EnTransfCS()=default
Default constructor.
std::vector< std::vector< std::vector< double > > > adda
Sum.
std::vector< double > chereC
Cherenkov's radiation.
std::vector< double > length_y0
std::vector< double > addaC
Sum of (ionization) differential cross-section terms.
std::vector< std::vector< std::vector< double > > > cher
double quanC
Integrated (ionization) cross-section.
void print(std::ostream &file, int l) const
double max_etransf
Max. energy transfer [MeV].
const double * get_ae(void) const
Return all left sides.
double get_emin() const
Return left side of the first bin.
long get_q() const
Return number of bins.
double get_emax() const
Return right side of the last bin.
double get_ec(long n) const
Return center of a given bin.
double get_e(long n) const
Return left side of a given bin.
double eldens
Electron density MeV**3.
double xeldens
Long. electron density MeV**2/cm (for x=1 cm).
std::vector< const AtomPhotoAbsCS * > apacs
std::vector< double > ACS
Photoabsorption cross section per one atom(Mb).
std::vector< double > epsi1
Real part of dielectric constant (e_1 - 1).
std::vector< double > epsi2
Imaginary part of dielectric constant.
void print(std::ostream &file, int l) const
static constexpr int s_use_mixture_thresholds
void get_scoor(long n, T &b) const
virtual int get_interval(long n, T &b1, T &b2) const
double lorbeta(const double gamma_1)
as function of .
constexpr double C1_MEV2_MBN
DoubleAc fabs(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)
#define Iprintn(file, name)