15using CLHEP::electron_mass_c2;
16using CLHEP::fine_structure_const;
20 const std::vector<AtomPhotoAbsCS*>& faapacs,
22 : matter(amatter), W(fW), F(fF), energy_mesh(fenergy_mesh) {
23 mfunname(
"HeedMatterDef::HeedMatterDef(...)");
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) {
39 mean_I += w *
apacs[n]->get_I_min();
45 for (
long n = 0; n < q; ++n) {
51 inite_HeedMatterDef();
55 const std::vector<MolecPhotoAbsCS*>& fampacs,
57 : matter(agas), W(fW), F(fF), energy_mesh(fenergy_mesh) {
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) {
110 inite_HeedMatterDef();
114 const std::string& gas_notation,
115 const std::vector<MolecPhotoAbsCS*>& fampacs,
116 double fW,
double fF)
117 : W(fW), F(fF), energy_mesh(fenergy_mesh) {
118 mfunnamep(
"HeedMatterDef::HeedMatterDef(...)");
123 mcerr <<
"notation supplied as the gas notation is not appear "
124 <<
"to be related to gas \n";
125 mcerr <<
"gas_notation=" << gas_notation <<
'\n';
131 const long qat = agas->
qatom();
133 const long qmol = agas->
qmolec();
135 for (
long nmol = 0; nmol < qmol; ++nmol) {
139 const long qa = agas->
molec(nmol)->qatom();
140 for (
long na = 0; na < qa; ++na) {
141 apacs[nat] = fampacs[nmol]->get_atom(na);
148#ifdef CALC_W_USING_CHARGES
151 for (
long n = 0; n < qmol; ++n) {
153 u += w * fampacs[n]->get_F();
158 for (
long n = 0; n < qmol; ++n) {
165#ifdef CALC_W_USING_CHARGES
168 for (
long n = 0; n < qmol; ++n) {
170 u += w * fampacs[n]->get_W();
175 for (
long n = 0; n < qmol; ++n) {
180 inite_HeedMatterDef();
183void HeedMatterDef::inite_HeedMatterDef() {
184 mfunname(
"void HeedMatterDef::inite_HeedMatterDef()");
190 wpla =
eldens * 4. * pi * fine_structure_const / electron_mass_c2;
194 for (
long n = 0; n < qat; ++n) {
197 rms = rms / (gram / mole);
199 std::vector<double> RLenAt(qat);
200 std::vector<double> RuthAt(qat);
201 for (
long n = 0; n < qat; ++n) {
203 RLenAt[n] = 716.4 *
matter->
atom(n)->A() / (gram / mole) /
204 (z * (z + 1) * log(287. /
sqrt(
double(z))));
205 RuthAt[n] = 4. * pi * z * z * fine_structure_const * fine_structure_const;
207 std::vector<double> rm(qat);
208 for (
long n = 0; n < qat; ++n) {
211 for (
long n = 0; n < qat; ++n) {
217 for (
long n = 0; n < qat; ++n) {
223 for (
long n = 0; n < qat; ++n) {
234 for (
long ne = 0; ne < qe; ++ne) {
239 for (
int na = 0; na < qat; ++na) {
240 const double ta =
apacs[na]->get_integral_ACS(e1, e2);
242 check_econd11a(ta, < 0,
"ACS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
243 <<
" na=" << na <<
'\n',
248 :
apacs[na]->get_integral_ICS(e1, e2);
250 check_econd11a(ti, < 0,
"ICS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
251 <<
" na=" << na <<
'\n',
260 double ec2 = ec * ec;
266 for (
long ne = 0; ne < qe; ++ne) {
268 double ec2 = ec * ec;
271 for (
long m = 0; m < qe; ++m) {
276 s +=
epsi2[m] * ecm * (em2 - em1) / (ecm * ecm - ec2);
278 double ee1 = 0.5 * (em1 + ecm);
279 double ee2 = 0.5 * (em2 + ecm);
296 s = s + ep1 * ee1 * (ecm - em1) / (ee1 * ee1 - ec2);
297 s = s + ep2 * ee2 * (em2 - ecm) / (ee2 * ee2 - ec2);
300 epsi1[ne] = (2. / pi) * s;
305 mfunnamep(
"void HeedMatterDef::replace_epsi12(const std::string& file_name)");
307 std::ifstream file(file_name.c_str());
310 mcerr <<
"cannot open file " << file_name << std::endl;
313 mcout <<
"file " << file_name <<
" is opened" << std::endl;
319 std::vector<double> ener(qe);
320 std::vector<double> eps1(qe);
321 std::vector<double> eps2(qe);
323 for (
long ne = 0; ne < qe; ++ne) {
324 file >> ener[ne] >> eps1[ne] >> eps2[ne];
332 double emin = ener[0] - 0.5 * (ener[1] - ener[0]);
333 double emax = ener[qe - 1] + 0.5 * (ener[qe - 1] - ener[qe - 2]);
336 for (
long ne = 0; ne < qe; ++ne) {
339 t_value_straight_point_ar<double, std::vector<double>,
343 ec, 0, 1, emin, 1, emax);
345 t_value_straight_point_ar<double, std::vector<double>,
349 ec, 1, 1, emin, 1, emax);
356 Ifile <<
"HeedMatterDef:\n";
361 Ifile <<
"Printing " << q <<
" photoabsorption cross sections:\n";
363 for (
long n = 0; n < q; ++n) {
364 apacs[n]->print(file, l - 1);
382 Ifile <<
" ne energy ACS(Mb) ICS(Mb) ACS(1/MeV^2) "
383 "ICS(1/MeV^2) epsip epsi1 epsi2 "
384 "(1+epsi1)^2+epsi2^2\n";
385 for (ne = 0; ne < qe; ne++) {
386 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
388 << std::setw(12) <<
ICS[ne] <<
' ' << std::setw(12)
391 << std::setw(12) <<
epsi1[ne] <<
' ' << std::setw(12) <<
epsi2[ne]
392 <<
' ' << 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< AtomDef * > & atom() const
long get_q() const
Return number of bins.
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.
const std::vector< double > & weight_quan_molec() const
const std::vector< MoleculeDef * > & 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
static MatterDef * get_MatterDef(const std::string &fnotation)
void print(std::ostream &file, int l) const
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)