17 : m_w(fw), m_f(ffano) {
18 mfunnamep(
"PairProd::PairProd(const std::string&, double, double)");
20 std::ifstream file(file_name.c_str());
23 mcerr <<
"cannot open file " << file_name << std::endl;
27 file >> m_wtable >> m_i >> m_j >> m_ftable >> 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];
37 m_k =
sqrt(m_f * m_w * m_w / (m_ftable * m_wtable * m_wtable));
38 m_s = m_w - m_k * m_wtable;
44 mfunname(
"double PairProd::get_eloss() const");
45 return m_k * pran.
ran(SRANLUX()) + m_s;
48#ifdef USE_GET_ELOSS_CUT
51 mfunname(
"double PairProd::get_eloss(const double ecur) const");
52 const double e_loss = m_k * pran.
ran(SRANLUX()) + m_s;
53 constexpr double w_cut_ratio = 0.2;
54 return e_cur - e_loss < w_cut_ratio * m_w ? 1.0e20 : eloss;
60 mfunname(
"double PairProd::get_eloss(const double ecur) const");
61 const double e_loss = m_k * pran.
ran(SRANLUX()) + m_s;
62 constexpr double V_ratio = 0.5;
63 const double v = V_ratio * m_w / e_cur;
65 const double c = v < 1. ? 1. / (1. - v * v) : DBL_MAX;
73 Ifile <<
"PairProd:\n";
75 Ifile <<
"W=" << m_w <<
" Fano factor=" << m_f <<
'\n';
76 Ifile <<
"W table=" << m_wtable <<
" Fano factor table=" << m_ftable <<
'\n';
77 Ifile <<
"I=" << m_i <<
" J=" << m_j <<
" k=" << m_k <<
" s=" << m_s <<
'\n';
#define mfunnamep(string)
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)