15using CLHEP::electron_mass_c2;
16using CLHEP::fine_structure_const;
24 radiation_length(0.0),
25 Rutherford_const(0.0),
31 : W(fW), F(fF), energy_mesh(fenergy_mesh) {
32 mfunname(
"HeedMatterDef::HeedMatterDef(...)");
35 const long q =
matter->qatom();
37 for (
long n = 0; n < q; ++n) {
38 apacs[n].put(faapacs[n]);
43#ifdef CALC_W_USING_CHARGES
46 for (
long n = 0; n < q; ++n) {
47 const double w =
matter->weight_quan(n) *
apacs[n]->get_Z();
48 mean_I += w *
apacs[n]->get_I_min();
54 for (
long n = 0; n < q; ++n) {
55 mean_I +=
matter->weight_quan(n) *
apacs[n]->get_I_min();
60 inite_HeedMatterDef();
65 : W(fW), F(fF), energy_mesh(fenergy_mesh) {
66 mfunname(
"HeedMatterDef::HeedMatterDef(...)");
69 const long qat = agas->
qatom();
71 const long qmol = agas->
qmolec();
73 for (
long nmol = 0; nmol < qmol; ++nmol) {
77 const long qa = agas->
molec(nmol)->qatom();
78 for (
long na = 0; na < qa; ++na) {
79 apacs[nat].put(fampacs[nmol]->get_atom(na).getver());
86#ifdef CALC_W_USING_CHARGES
89 for (
long n = 0; n < qmol; ++n) {
91 u += w * fampacs[n]->
get_F();
96 for (
long n = 0; n < qmol; ++n) {
103#ifdef CALC_W_USING_CHARGES
106 for (
long n = 0; n < qmol; ++n) {
108 u += w * fampacs[n]->
get_W();
113 for (
long n = 0; n < qmol; ++n) {
118 inite_HeedMatterDef();
122 const std::string& gas_notation,
124 : W(fW), F(fF), energy_mesh(fenergy_mesh) {
125 mfunnamep(
"HeedMatterDef::HeedMatterDef(...)");
130 mcerr <<
"notation supplied as the gas notation is not appear "
131 <<
"to be related to gas \n";
132 mcerr <<
"gas_notation=" << gas_notation <<
'\n';
138 const long qat = agas->
qatom();
140 const long qmol = agas->
qmolec();
142 for (
long nmol = 0; nmol < qmol; ++nmol) {
146 const long qa = agas->
molec(nmol)->qatom();
147 for (
long na = 0; na < qa; ++na) {
148 apacs[nat].put(fampacs[nmol]->get_atom(na).getver());
155#ifdef CALC_W_USING_CHARGES
158 for (
long n = 0; n < qmol; ++n) {
160 u += w * fampacs[n]->
get_F();
165 for (
long n = 0; n < qmol; ++n) {
172#ifdef CALC_W_USING_CHARGES
175 for (
long n = 0; n < qmol; ++n) {
177 u += w * fampacs[n]->
get_W();
182 for (
long n = 0; n < qmol; ++n) {
187 inite_HeedMatterDef();
190void HeedMatterDef::inite_HeedMatterDef() {
191 mfunname(
"void HeedMatterDef::inite_HeedMatterDef()");
192 const double amean =
matter->A_mean() / (gram / mole);
193 const double rho =
matter->density() / (gram / cm3);
197 wpla =
eldens * 4. * pi * fine_structure_const / electron_mass_c2;
200 long qat =
matter->qatom();
201 for (
long n = 0; n < qat; ++n) {
204 rms = rms / (gram / mole);
206 std::vector<double> RLenAt(qat);
207 std::vector<double> RuthAt(qat);
208 for (
long n = 0; n < qat; ++n) {
209 const int z =
matter->atom(n)->Z();
210 RLenAt[n] = 716.4 *
matter->atom(n)->A() / (gram / mole) /
211 (z * (z + 1) * log(287. /
sqrt(
double(z))));
212 RuthAt[n] = 4. * pi * z * z * fine_structure_const * fine_structure_const;
214 std::vector<double> rm(qat);
215 for (
long n = 0; n < qat; ++n) {
216 rm[n] =
matter->atom(n)->A() / (gram / mole) *
matter->weight_quan(n) / rms;
218 for (
long n = 0; n < qat; ++n) {
224 for (
long n = 0; n < qat; ++n) {
230 for (
long n = 0; n < qat; ++n) {
241 for (
long ne = 0; ne < qe; ++ne) {
246 for (
int na = 0; na < qat; ++na) {
247 const double ta =
apacs[na]->get_integral_ACS(e1, e2);
248 sa +=
matter->weight_quan(na) * ta / (e2 - e1);
249 check_econd11a(ta, < 0,
"ACS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
250 <<
" na=" << na <<
'\n',
255 :
apacs[na]->get_integral_ICS(e1, e2);
256 si +=
matter->weight_quan(na) * ti / (e2 - e1);
257 check_econd11a(ti, < 0,
"ICS: ne=" << ne <<
" e1=" << e1 <<
" e2=" << e2
258 <<
" na=" << na <<
'\n',
267 double ec2 = ec * ec;
273 for (
long ne = 0; ne < qe; ++ne) {
275 double ec2 = ec * ec;
278 for (
long m = 0; m < qe; ++m) {
283 s +=
epsi2[m] * ecm * (em2 - em1) / (ecm * ecm - ec2);
285 double ee1 = 0.5 * (em1 + ecm);
286 double ee2 = 0.5 * (em2 + ecm);
303 s = s + ep1 * ee1 * (ecm - em1) / (ee1 * ee1 - ec2);
304 s = s + ep2 * ee2 * (em2 - ecm) / (ee2 * ee2 - ec2);
307 epsi1[ne] = (2. / pi) * s;
312 mfunnamep(
"void HeedMatterDef::replace_epsi12(const std::string& file_name)");
314 std::ifstream file(file_name.c_str());
317 mcerr <<
"cannot open file " << file_name << std::endl;
320 mcout <<
"file " << file_name <<
" is opened" << std::endl;
326 std::vector<double> ener(qe);
327 std::vector<double> eps1(qe);
328 std::vector<double> eps2(qe);
330 for (
long ne = 0; ne < qe; ++ne) {
331 file >> ener[ne] >> eps1[ne] >> eps2[ne];
339 double emin = ener[0] - 0.5 * (ener[1] - ener[0]);
340 double emax = ener[qe - 1] + 0.5 * (ener[qe - 1] - ener[qe - 2]);
343 for (
long ne = 0; ne < qe; ++ne) {
346 t_value_straight_point_ar<double, std::vector<double>,
350 ec, 0, 1, emin, 1, emax);
352 t_value_straight_point_ar<double, std::vector<double>,
356 ec, 1, 1, emin, 1, emax);
363 Ifile <<
"HeedMatterDef:\n";
368 Ifile <<
"Printing " << q <<
" photoabsorption cross sections:\n";
370 for (
long n = 0; n < q; ++n) {
371 apacs[n]->print(file, l - 1);
389 Ifile <<
" ne energy ACS(Mb) ICS(Mb) ACS(1/MeV^2) "
390 "ICS(1/MeV^2) epsip epsi1 epsi2 "
391 "(1+epsi1)^2+epsi2^2\n";
392 for (ne = 0; ne < qe; ne++) {
393 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
394 <<
energy_mesh->get_e(ne) <<
' ' << std::setw(12) <<
ACS[ne] <<
' '
395 << std::setw(12) <<
ICS[ne] <<
' ' << std::setw(12)
398 << std::setw(12) <<
epsi1[ne] <<
' ' << std::setw(12) <<
epsi2[ne]
399 <<
' ' << 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)
Atomic photoabsorption cross-section abstract base class.
const std::vector< double > & weight_quan_molec() const
const std::vector< PassivePtr< 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).
double eldens_cm_3
Electron density cm**-3.
std::vector< double > ACS
Photoabsorbtion cross section per one atom(Mb).
std::vector< double > epsip
Some plasma dielectric constant (not used, but just initialized for print)
std::vector< PassivePtr< const AtomPhotoAbsCS > > apacs
HeedMatterDef()
Default constructor.
PassivePtr< MatterDef > matter
std::vector< double > epsi1
Real part of dielectric constant (e_1 - 1).
double Rutherford_const
Const for Rutherford cross section (1/cm3).
PassivePtr< EnergyMesh > energy_mesh
static const int s_use_mixture_thresholds
std::vector< double > ICS
std::vector< double > epsi2
Imaginary part of dielectric constant.
double radiation_length
Radiation Length.
virtual void print(std::ostream &file, int l) const
void replace_epsi12(const std::string &file_name)
static MatterDef * get_MatterDef(const std::string &fnotation)
double get_W() const
Retrieve W value [MeV].
int get_total_Z() const
Sum up the atomic numbers of all atoms in the molecule.
double get_F() const
Retrieve Fano factor.
int get_qatom() const
Total number of atoms of all sorts in the molecule.
DoubleAc pow(const DoubleAc &f, double p)
DoubleAc sqrt(const DoubleAc &f)
#define Iprintan(file, name, addition)
#define Iprintn(file, name)