15using CLHEP::electron_mass_c2;
16using CLHEP::fine_structure_const;
20 const std::vector<AtomPhotoAbsCS*>& faapacs,
23 mfunname(
"HeedMatterDef::HeedMatterDef(...)");
26 const long q =
matter->qatom();
27 apacs.resize(q,
nullptr);
28 for (
long n = 0; n < q; ++n) {
29 apacs[n] = faapacs[n];
34#ifdef CALC_W_USING_CHARGES
37 for (
long n = 0; n < q; ++n) {
38 const double w =
matter->weight_quan(n) *
apacs[n]->get_Z();
39 mean_I += w *
apacs[n]->get_I_min();
45 for (
long n = 0; n < q; ++n) {
46 mean_I +=
matter->weight_quan(n) *
apacs[n]->get_I_min();
55 std::vector<MolecPhotoAbsCS>& fampacs,
58 mfunname(
"HeedMatterDef::HeedMatterDef(...)");
61 const long qat = agas->
qatom();
62 apacs.resize(qat,
nullptr);
63 const long qmol = agas->
qmolec();
65 for (
long nmol = 0; nmol < qmol; ++nmol) {
69 const long qa = agas->
molec(nmol)->qatom();
70 for (
long na = 0; na < qa; ++na) {
71 apacs[nat] = fampacs[nmol].get_atom(na);
78#ifdef CALC_W_USING_CHARGES
81 for (
long n = 0; n < qmol; ++n) {
83 u += w * fampacs[n].get_F();
88 for (
long n = 0; n < qmol; ++n) {
95#ifdef CALC_W_USING_CHARGES
98 for (
long n = 0; n < qmol; ++n) {
100 u += w * fampacs[n].get_W();
105 for (
long n = 0; n < qmol; ++n) {
113void HeedMatterDef::initialize() {
114 mfunname(
"void HeedMatterDef::initialize()");
120 wpla =
eldens * 4. * pi * fine_structure_const / electron_mass_c2;
124 for (
long n = 0; n < qat; ++n) {
127 rms = rms / (gram / mole);
129 std::vector<double> RLenAt(qat);
130 std::vector<double> RuthAt(qat);
131 for (
long n = 0; n < qat; ++n) {
133 RLenAt[n] = 716.4 *
matter->
atom(n)->A() / (gram / mole) /
134 (z * (z + 1) * log(287. /
sqrt(
double(z))));
135 RuthAt[n] = 4. * pi * z * z * fine_structure_const * fine_structure_const;
137 std::vector<double> rm(qat);
138 for (
long n = 0; n < qat; ++n) {
139 rm[n] =
matter->atom(n)->A() / (gram / mole) *
matter->weight_quan(n) / rms;
141 for (
long n = 0; n < qat; ++n) {
147 for (
long n = 0; n < qat; ++n) {
153 for (
long n = 0; n < qat; ++n) {
164 for (
long ne = 0; ne < qe; ++ne) {
169 for (
int na = 0; na < qat; ++na) {
170 const double ta =
apacs[na]->get_integral_ACS(e1, e2);
171 sa +=
matter->weight_quan(na) * ta / (e2 - e1);
172 check_econd11a(ta, < 0,
"ACS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
173 <<
" na=" << na <<
'\n',
178 :
apacs[na]->get_integral_ICS(e1, e2);
179 si +=
matter->weight_quan(na) * ti / (e2 - e1);
180 check_econd11a(ti, < 0,
"ICS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
181 <<
" na=" << na <<
'\n',
190 double ec2 = ec * ec;
196 for (
long ne = 0; ne < qe; ++ne) {
198 double ec2 = ec * ec;
201 for (
long m = 0; m < qe; ++m) {
206 s +=
epsi2[m] * ecm * (em2 - em1) / (ecm * ecm - ec2);
208 double ee1 = 0.5 * (em1 + ecm);
209 double ee2 = 0.5 * (em2 + ecm);
226 s = s + ep1 * ee1 * (ecm - em1) / (ee1 * ee1 - ec2);
227 s = s + ep2 * ee2 * (em2 - ecm) / (ee2 * ee2 - ec2);
230 epsi1[ne] = (2. / pi) * s;
235 mfunnamep(
"void HeedMatterDef::replace_epsi12(const std::string& file_name)");
237 std::ifstream file(file_name.c_str());
240 mcerr <<
"cannot open file " << file_name << std::endl;
243 mcout <<
"file " << file_name <<
" is opened" << std::endl;
249 std::vector<double> ener(qe);
250 std::vector<double> eps1(qe);
251 std::vector<double> eps2(qe);
253 for (
long ne = 0; ne < qe; ++ne) {
254 file >> ener[ne] >> eps1[ne] >> eps2[ne];
262 double emin = ener[0] - 0.5 * (ener[1] - ener[0]);
263 double emax = ener[qe - 1] + 0.5 * (ener[qe - 1] - ener[qe - 2]);
268 for (
long ne = 0; ne < qe; ++ne) {
271 epsi1[ne] = interpolate(pcmd, eps1, ec, 0, 1, emin, 1, emax);
272 epsi2[ne] = interpolate(pcmd, eps2, ec, 1, 1, emin, 1, emax);
279 Ifile <<
"HeedMatterDef:\n";
284 Ifile <<
"Printing " << q <<
" photoabsorption cross sections:\n";
286 for (
long n = 0; n < q; ++n) {
287 apacs[n]->print(file, l - 1);
305 Ifile <<
" ne energy ACS(Mb) ICS(Mb) ACS(1/MeV^2) "
306 "ICS(1/MeV^2) epsip epsi1 epsi2 "
307 "(1+epsi1)^2+epsi2^2\n";
308 for (ne = 0; ne < qe; ne++) {
309 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
310 <<
energy_mesh->get_e(ne) <<
' ' << std::setw(12) <<
ACS[ne] <<
' '
311 << std::setw(12) <<
ICS[ne] <<
' ' << std::setw(12)
314 << std::setw(12) <<
epsi1[ne] <<
' ' << std::setw(12) <<
epsi2[ne]
315 <<
' ' << std::setw(12)
#define check_econd11(a, signb, stream)
#define check_econd11a(a, signb, add, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
const std::vector< double > & weight_quan() const
const std::vector< const AtomDef * > & atom() const
const std::vector< const MoleculeDef * > & molec() const
const std::vector< double > & weight_quan_molec() const
double eldens
Electron density MeV**3.
double W
Mean work per pair production, MeV.
double wpla
Squared plasma energy;.
double xeldens
Long. electron density MeV**2/cm (for x=1 cm).
std::vector< const AtomPhotoAbsCS * > apacs
HeedMatterDef()=default
Default constructor.
double eldens_cm_3
Electron density cm**-3.
std::vector< double > ACS
Photoabsorption cross section per one atom(Mb).
std::vector< double > epsip
Some plasma dielectric constant (not used, but just initialized for print)
std::vector< double > epsi1
Real part of dielectric constant (e_1 - 1).
double Rutherford_const
Const for Rutherford cross section (1/cm3).
std::vector< double > ICS
std::vector< double > epsi2
Imaginary part of dielectric constant.
double radiation_length
Radiation Length.
void print(std::ostream &file, int l) const
void replace_epsi12(const std::string &file_name)
static constexpr int s_use_mixture_thresholds
T t_value_straight_point_ar(const M &mesh, const D &y, T x, int s_ban_neg, int s_extrap_left, T left_bond, int s_extrap_right, T right_bond)
DoubleAc pow(const DoubleAc &f, double p)
constexpr double C1_MEV2_MBN
constexpr double coef_I_to_W
constexpr double C1_MEV_CM
DoubleAc sqrt(const DoubleAc &f)
#define Iprintan(file, name, addition)
#define Iprintn(file, name)