16 long fparticle_charge)
17 : particle_mass(fparticle_mass),
18 particle_charge(fparticle_charge),
22 gamma(fgamma_1 + 1.0),
25 s_primary_electron(fs_primary_electron),
36 mfunnamep(
"EnTransfCS::EnTransfCS(double fparticle_mass, double fbeta, "
37 "HeedMatterDef* fhmd)");
58 long qe =
hmd->energy_mesh->get_q();
65#ifdef DEBUG_EnTransfCS
66 treser.put_qel(qe, 0.0);
69#ifndef EXCLUDE_A_VALUES
70 addaC_a.put_qel(qe, 0.0);
73 long qa =
hmd->matter->qatom();
79#ifndef EXCLUDE_A_VALUES
86#ifndef EXCLUDE_VAL_FADDA
87 val_fadda.put_qel(qa);
88#ifndef EXCLUDE_A_VALUES
89 val_fadda_a.put_qel(qa);
95#ifndef EXCLUDE_A_VALUES
100 for (
long na = 0; na < qa; na++) {
101 long qs =
hmd->apacs[na]->get_qshell();
107#ifndef EXCLUDE_A_VALUES
108 cher_a[na].put_qel(qs);
109 adda_a[na].put_qel(qs);
110 fadda_a[na].put_qel(qs);
111 quan_a[na].put_qel(qs);
113#ifndef EXCLUDE_VAL_FADDA
114 val_fadda[na].put_qel(qs);
115#ifndef EXCLUDE_A_VALUES
116 val_fadda_a[na].put_qel(qs);
122#ifndef EXCLUDE_A_VALUES
123 mean_a[na].put_qel(qs);
126 for (
long ns = 0; ns < qs; ns++) {
131#ifndef EXCLUDE_A_VALUES
132 cher_a[na][ns].put_qel(qe, 0.0);
133 adda_a[na][ns].put_qel(qe, 0.0);
134 fadda_a[na][ns].put_qel(qe, 0.0);
139 for (ne = 0; ne < qe; ne++) {
146 for (ne = 0; ne < qe; ne++) {
147 r = 2.0 * 0.511 *
beta2 /
hmd->energy_mesh->get_ec(ne);
155 double r0, rr12, rr22, r1, r2, r3;
158 for (ne = 0; ne < qe; ne++) {
159 r0 = 1.0 +
hmd->epsi1[ne];
162 rr22 =
hmd->epsi2[ne] *
hmd->epsi2[ne];
163 r1 = (-r0 * r +
beta2 * rr22) / (rr12 + rr22);
166 if (r < 0) r3 = M_PI + r3;
168 chereC[ne] = (coefpa /
hmd->eldens) * r1 * r3;
171 for (ne = 0; ne < qe; ne++) {
172 double ec =
hmd->energy_mesh->get_ec(ne);
178 Rreser[ne] = 1.0 / (ec * ec);
191 (2.0 * pg2 + 2.0 *
gamma - 1.0) / (delta * (
gamma_1 - delta)) +
197 double Z_mean =
hmd->matter->Z_mean();
198 for (
long na = 0; na < qa; na++) {
199 long qs =
hmd->apacs[na]->get_qshell();
200 double at_weight_quan =
hmd->matter->weight_quan(na);
201 for (
long ns = 0; ns < qs; ns++) {
203#ifndef EXCLUDE_A_VALUES
208 for (ne = 0; ne < qe; ne++) {
209 double e1 =
hmd->energy_mesh->get_e(ne);
210 double e2 =
hmd->energy_mesh->get_e(ne + 1);
213 ics =
hmd->apacs[na]->get_integral_TICS(
216 ics =
hmd->apacs[na]->get_integral_ICS(ns, e1, e2) / (e2 - e1) *
220#ifndef EXCLUDE_A_VALUES
221 double acs =
hmd->apacs[na]->get_integral_ACS(ns, e1, e2) / (e2 - e1) *
225 "na=" << na <<
" ns=" << ns <<
" ne=" << ne <<
'\n',
227 if (
hmd->ACS[ne] > 0.0) {
230#ifndef EXCLUDE_A_VALUES
236#ifndef EXCLUDE_A_VALUES
243 for (ne = 0; ne < qe; ne++) {
244 double e1 =
hmd->energy_mesh->get_e(ne);
245 double ec =
hmd->energy_mesh->get_ec(ne);
246 double e2 =
hmd->energy_mesh->get_e(ne + 1);
250 check_econd11a(r, < 0.0,
"na=" << na <<
" ns=" << ns <<
" na=" << na,
253 afrezer[ne] = (s + 0.5 * r) * coefpa *
Rreser[ne] / Z_mean;
255 "na=" << na <<
" ns=" << ns <<
" na=" << na,
mcerr);
260#ifdef DEBUG_EnTransfCS
261 treser[ne] += afrezer[ne];
266 for (ne = 0; ne < qe; ++ne) {
268#ifndef EXCLUDE_A_VALUES
271 double e1 =
hmd->energy_mesh->get_e(ne);
272 double ec =
hmd->energy_mesh->get_ec(ne);
273 double e2 =
hmd->energy_mesh->get_e(ne + 1);
274 double sqepsi =
pow((1 +
hmd->epsi1[ne]), 2.0) +
pow(
hmd->epsi2[ne], 2.0);
275 for (
long na = 0; na < qa; na++) {
276 double at_weight_quan =
hmd->matter->weight_quan(na);
277 long qs =
hmd->apacs[na]->get_qshell();
278 for (
long ns = 0; ns < qs; ns++) {
281 ics =
hmd->apacs[na]->get_integral_TICS(
284 ics =
hmd->apacs[na]->get_integral_ICS(ns, e1, e2) / (e2 - e1) *
287#ifndef EXCLUDE_A_VALUES
288 double acs =
hmd->apacs[na]->get_integral_ACS(ns, e1, e2) / (e2 - e1) *
292 at_weight_quan *
log1C[ne] * coefpa * ics / (ec * Z_mean * sqepsi);
294 at_weight_quan *
log2C[ne] * coefpa * ics / (ec * Z_mean * sqepsi);
295 double& r_adda =
adda[na][ns][ne];
296 double& r_frezer =
frezer[na][ns][ne];
297 r_adda = r1 + r2 + r_frezer;
298 if (r_adda < 0.0) r_adda = 0.0;
300#ifndef EXCLUDE_A_VALUES
302 at_weight_quan *
log1C[ne] * coefpa * acs / (ec * Z_mean * sqepsi);
304 at_weight_quan *
log2C[ne] * coefpa * acs / (ec * Z_mean * sqepsi);
305 double& r_adda_a = adda_a[na][ns][ne];
306 r_adda_a = r1_a + r2_a +
frezer;
307 if (r_adda_a < 0.0) r_adda_a = 0.0;
309 if (ec >
hmd->min_ioniz_pot) {
310 r_adda +=
cher[na][ns][ne];
313 mcout <<
"negative adda\n";
314 mcout <<
"na=" << na <<
" ns=" << ns <<
" ne=" << ne
315 <<
" adda[na][ns][ne] = " <<
adda[na][ns][ne] <<
'\n';
316 adda[na][ns][ne] = 0.0;
319#ifndef EXCLUDE_A_VALUES
320 adda_a[na][ns][ne] +=
cher[na][ns][ne];
322 "na=" << na <<
" ns=" << ns <<
" na=" << na,
mcerr);
325#ifndef EXCLUDE_A_VALUES
331#ifndef EXCLUDE_A_VALUES
336 const double* aetemp =
hmd->energy_mesh->get_ae();
338 double emin =
hmd->energy_mesh->get_emin();
339 double emax =
hmd->energy_mesh->get_emax();
341 quanC = t_integ_step_ar<double, DynLinArr<double>,
343 pcm_e,
addaC, emin, emax, 0) *
hmd->xeldens;
348 pcm_e, addaC_a, emin, emax, 0) *
hmd->xeldens;
352 meanC = t_integ_step_ar<double, DynLinArr<double>,
354 pcm_e,
addaC, emin, emax, 1) *
hmd->xeldens;
359 pcm_e, addaC_a, emin, emax, 1) *
hmd->xeldens;
368 double e1 =
hmd->energy_mesh->get_e(qe);
377 double e1 =
hmd->energy_mesh->get_e(qe);
388 double e1 =
hmd->energy_mesh->get_e(qe);
395#ifndef EXCLUDE_A_VALUES
398 double e1 =
hmd->energy_mesh->get_e(qe);
414 for (
long na = 0; na < qa; na++) {
415 long qs =
hmd->apacs[na]->get_qshell();
416 for (
long ns = 0; ns < qs; ns++) {
417 quan[na][ns] = t_integ_step_ar<double, DynLinArr<double>,
419 pcm_e,
adda[na][ns], emin, emax, 0) *
hmd->xeldens;
423 pcm_e, adda_a[na][ns], emin, emax, 0) *
hmd->xeldens;
426 mean[na][ns] = t_integ_step_ar<double, DynLinArr<double>,
428 pcm_e,
adda[na][ns], emin, emax, 1) *
hmd->xeldens;
432 pcm_e, adda_a[na][ns], emin, emax, 1) *
hmd->xeldens;
438 for (
long na = 0; na < qa; na++) {
439 long qs =
hmd->apacs[na]->get_qshell();
440 for (
long ns = 0; ns < qs; ns++) {
441 if (
quan[na][ns] > 0.0)
442#ifndef EXCLUDE_VAL_FADDA
445 t_hispre_step_ar<double, DynLinArr<double>,
449#ifndef EXCLUDE_A_VALUES
450 if (quan_a[na][ns] > 0.0)
451#ifndef EXCLUDE_VAL_FADDA
452 val_fadda_a[na][ns] =
454 t_hispre_step_ar<double, DynLinArr<double>,
456 pcm_e, adda_a[na][ns], fadda_a[na][ns]);
462 for (ne = 0; ne < qe; ne++) {
465 if (det_value <= 0.0) {
478#ifdef DEBUG_EnTransfCS
481 std::ofstream dcsfile;
482 dcsfile.open(
"dcs.txt", std::ios::out);
483 dcsfile <<
"# energy [MeV] vs. diff. cs per electron [Mbarn / MeV]\n";
484 for (
int i = 0; i < qe; ++i) {
491#ifndef EXCLUDE_A_VALUES
495#ifndef EXCLUDE_A_VALUES
500#ifndef EXCLUDE_A_VALUES
503#ifndef EXCLUDE_A_VALUES
506#ifndef EXCLUDE_VAL_FADDA
508#ifndef EXCLUDE_A_VALUES
514#ifndef EXCLUDE_A_VALUES
525 Ifile <<
"EnTransfCS(l=" << l <<
"):\n";
532 <<
" gamma=" <<
gamma << std::endl;
538#ifndef EXCLUDE_A_VALUES
539 Ifile <<
"quanC=" <<
quanC <<
" quanC_a=" << quanC_a <<
'\n';
540 Ifile <<
"meanC=" <<
meanC <<
" meanC_a=" << meanC_a <<
'\n';
542 Ifile <<
"meanC1=" <<
meanC1 <<
" meanC1_a=" << meanC1_a <<
'\n';
551#ifndef EXCLUDE_A_VALUES
552 Ifile <<
"quanC=" <<
quanC <<
" quanC_a=" << quanC_a <<
'\n';
558 long qe =
hmd->energy_mesh->get_q();
561#ifdef DEBUG_EnTransfCS
562 Ifile <<
" enerc, log1C, log2C, chereC, addaC, "
563 "chereCangle Rreser treser length_y0\n";
565 Ifile <<
" enerc, log1C, log2C, chereC, addaC, "
566 "chereCangle Rreser length_y0\n";
568 for (ne = 0; ne < qe; ne++) {
569 Ifile << std::setw(12) <<
hmd->energy_mesh->get_ec(ne) << std::setw(12)
570 <<
log1C[ne] << std::setw(12) <<
log2C[ne] << std::setw(12)
571 <<
chereC[ne] << std::setw(12) <<
addaC[ne] << std::setw(12)
573#ifdef DEBUG_EnTransfCS
574 << std::setw(12) << treser[ne]
576 << std::setw(12) <<
length_y0[ne] <<
'\n';
580 long qa =
hmd->matter->qatom();
583 for (na = 0; na < qa; na++) {
585 long qs =
hmd->apacs[na]->get_qshell();
588 for (ns = 0; ns < qs; ns++) {
591 Ifile <<
"quan =" << std::setw(13) <<
quan[na][ns]
592 <<
" mean =" << std::setw(13) <<
mean[na][ns] <<
'\n';
593#ifndef EXCLUDE_A_VALUES
594 Ifile <<
"quan_a =" << std::setw(13) << quan_a[na][ns]
595 <<
" mean_a=" << std::setw(13) << mean_a[na][ns] <<
'\n';
598 Ifile <<
"quan =" << std::setw(13) <<
quan[na][ns] <<
'\n';
599#ifndef EXCLUDE_A_VALUES
600 Ifile <<
"quan_a =" << std::setw(13) << quan_a[na][ns] <<
'\n';
603#ifndef EXCLUDE_VAL_FADDA
604 Ifile <<
"val_fadda=" << std::setw(13) << val_fadda[na][ns]
605#ifndef EXCLUDE_A_VALUES
606 <<
" val_fadda_a=" << std::setw(13) << val_fadda_a[na][ns]
611 Ifile <<
" enerc, cher, cher_a, frezer, adda, "
612 " adda_a, fadda, fadda_a\n";
613 for (ne = 0; ne < qe; ne++) {
614 Ifile << std::setw(12) <<
hmd->energy_mesh->get_ec(ne)
617 << std::setw(12) <<
cher[na][ns][ne]
618#ifndef EXCLUDE_A_VALUES
619 << std::setw(12) << cher_a[na][ns][ne]
622 << std::setw(12) <<
frezer[na][ns][ne] << std::setw(12)
624#ifndef EXCLUDE_A_VALUES
625 << std::setw(12) << adda_a[na][ns][ne]
627 << std::setw(12) <<
fadda[na][ns][ne]
628#ifndef EXCLUDE_A_VALUES
629 << std::setw(12) << fadda_a[na][ns][ne]
643 mfunname(
"std::ostream& operator << (std::ostream& file, const "
644 "EnTransfCSType& f)");
645 if (f.
etcs.get() == NULL) {
646 Ifile <<
"EnTransfCSType: type is not initialized\n";
648 Ifile <<
"EnTransfCSType: =";
649 f.
etcs->print(file, 1);
DoubleAc pow(const DoubleAc &f, double p)
DoubleAc sqrt(const DoubleAc &f)
#define check_econd11a(a, signb, add, stream)
#define mfunnamep(string)
PassivePtr< EnTransfCS > etcs
long particle_charge
Charge in units of electron charge (used square, sign does not matter).
DynLinArr< DynLinArr< double > > quan
DynLinArr< double > Rreser
double particle_ener
Total energy [MeV].
EnTransfCS(void)
Constructors.
DynLinArr< DynLinArr< double > > mean
DynLinArr< DynLinArr< DynLinArr< double > > > cher
double particle_mass
Particle mass [MeV].
DynLinArr< double > chereCangle
double maximal_energy_trans
Max. energy transfer [MeV].
DynLinArr< DynLinArr< DynLinArr< double > > > adda
Sum.
PassivePtr< HeedMatterDef > hmd
DynLinArr< double > log2C
DynLinArr< double > length_y0
double particle_tkin
Kinetic energy [MeV].
double quanC
Integrated (ionization) cross-section.
DynLinArr< DynLinArr< DynLinArr< double > > > fadda
Integral, normalised to unity.
DynLinArr< double > addaC
Sum of (ionization) differential cross-section terms.
virtual void print(std::ostream &file, int l) const
DynLinArr< double > chereC
DynLinArr< DynLinArr< DynLinArr< double > > > frezer
Rutherford term.
DynLinArr< double > log1C
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
double lorbeta(const double gamma_1)
const int s_use_mixture_thresholds
#define Iprintn(file, name)
T t_integ_step_ar(const M &mesh, const D &y, T x1, T x2, int xpower)