15 : wa(fwa), factorFano(ffactorFano) {
17 "PairProd::PairProd(const std::string& file_name, double fwa, double "
20 std::ifstream file(file_name.c_str());
23 mcerr <<
"cannot open file " << file_name << std::endl;
27 file >> wa_table >> I_table >> J_table >> factorFano_table >> q;
30 mcerr <<
"error at reading file" << std::endl;
33 std::vector<double> xx(q);
34 std::vector<double> yy(q);
35 for (
long n = 0; n < q; n++) file >> xx[n] >> yy[n];
36 pran =
PointsRan(xx, yy, I_table, J_table);
37 k =
sqrt(factorFano * wa * wa / (factorFano_table * wa_table * wa_table));
38 s = wa - k * wa_table;
44 mfunname(
"double PairProd::get_eloss() const");
45 return k * pran.
ran(SRANLUX()) + s;
48#ifdef USE_GET_ELOSS_CUT
51 mfunname(
"double PairProd::get_eloss(const double ecur) const");
52 const double e_loss = k * pran.
ran(SRANLUX()) + s;
53 const double w_cut_ratio = 0.2;
54 return e_cur - e_loss < w_cut_ratio * wa ? 1.0e20 : eloss;
60 mfunname(
"double PairProd::get_eloss(const double ecur) const");
61 const double e_loss = k * pran.
ran(SRANLUX()) + s;
62 const double V_ratio = 0.5;
63 const double v = V_ratio * wa / e_cur;
65 const double c = v < 1. ? 1. / (1. - v * v) : DBL_MAX;
73 Ifile <<
"PairProd:\n";
75 Ifile <<
"wa=" << wa <<
" factorFano=" << factorFano <<
'\n';
76 Ifile <<
"wa_table=" << wa_table <<
" factorFano_table=" << factorFano_table
78 Ifile <<
" I_table=" << I_table <<
" J_table=" << J_table <<
" k=" << k
79 <<
" s=" << s <<
'\n';
#define mfunnamep(string)
virtual void print(std::ostream &file, int l) const
double get_eloss() const
Calculate energy loss (in eV).
void print(std::ostream &file) const
double ran(double flat_ran) const
DoubleAc sqrt(const DoubleAc &f)