14using CLHEP::electron_mass_c2;
29 double fmlambda,
double fmthetac)
37 mfunname(
"HeedDeltaElectronCS::HeedDeltaElectronCS(...)");
39 const long qe =
hmd->energy_mesh->get_q();
43 std::vector<double> beta2(qe, 0.);
44 std::vector<double> momentum2(qe, 0.);
46 const double rho =
hmd->matter->density();
47 const double zmean =
hmd->matter->Z_mean();
48 const double amean =
hmd->matter->A_mean();
49 const double ZA = zmean / amean;
50 const double I_eff = 15.8 * eV * zmean;
52 for (
long ne = 0; ne < qe; ne++) {
53 const double ec =
hmd->energy_mesh->get_ec(ne) * MeV;
54 const double gamma_1 = ec / electron_mass_c2;
57 const double en = electron_mass_c2 + ec;
59 (en * en - electron_mass_c2 * electron_mass_c2) / (MeV * MeV);
61 const double dedx =
e_cont_enloss(ZA, I_eff, rho, ec, DBL_MAX, -1);
62 if (smax < dedx) smax = dedx;
63 eLoss[ne] = dedx / (MeV / cm);
65 smax = smax / (MeV / cm);
67 double deriv_min = 0.0;
69 for (
long ne = 1; ne < qe; ne++) {
72 (
hmd->energy_mesh->get_ec(ne) -
hmd->energy_mesh->get_ec(ne - 1));
78 for (
long ne = 0; ne < n_deriv_min - 1; ne++) {
80 deriv_min * (
hmd->energy_mesh->get_ec(ne) -
81 hmd->energy_mesh->get_ec(n_deriv_min - 1))) /
89 const double amin = 0.3;
90 const double amax = 180.0;
101 const long qes =
eesls->get_ees()->get_qe();
105 coef_low_sigma.resize(qes);
107 for (
long ne = 0; ne < qes; ne++) {
108 long qat =
hmd->matter->qatom();
110 for (
long nat = 0; nat < qat; nat++) {
112 s +=
eesls->get_mean_coef(
hmd->matter->atom(nat)->Z(), ne) *
113 hmd->matter->weight_quan(nat);
115 s +=
eesls->get_coef(
hmd->matter->atom(nat)->Z(), ne) *
116 hmd->matter->weight_quan(nat);
122 coef_low_sigma[ne] = s;
127 for (
long ne = 0; ne < qe; ne++) {
129 double ek =
hmd->energy_mesh->get_ec(ne) * 1000.0;
131 rr = 1.0e-3 * amean / (gram / mole) / zmean * 3.872e-3 *
pow(ek, 1.492);
133 rr = 1.0e-3 * 6.97e-3 *
pow(ek, 1.6);
135 rr = rr / (rho / (gram / cm3));
146 double k = b / ((x - a) * (x - a));
148 double r = b - k * (x - a) * (x - a);
160 double mT = 2.0 *
asin(1.0 / (2.0 *
momentum[ne] * zmean * 5.07e2));
164 double A =
hmd->Rutherford_const / cor / (momentum2[ne] * beta2[ne]) /
166 double B =
lambda[ne] * A;
167 B =
sqrt(B / (B + 1.0));
169 double thetac = 2.0 *
asin(B);
176 double r =
sin(0.5 * B);
177 lambda[ne] = 1 / A * 2.0 * r * r / (1 +
cos(B));
187 }
else if (
sruth == 0) {
192 x = x *
hmd->radiation_length * cor;
197 }
else if (
sruth == 2) {
200 const double energy =
hmd->energy_mesh->get_ec(ne);
201 const long qat =
hmd->matter->qatom();
205 for (
long nat = 0; nat < qat; nat++) {
206 const int z =
hmd->matter->atom(nat)->Z();
207 const double w =
hmd->matter->weight_quan(nat);
208 s +=
ees->get_CS(z, energy, angle) * w;
214 smat[nan] = s * twopi *
sin(angle);
221 Avogadro * rho / (gram / cm3) / (amean / (gram / mole));
231 mfunname(
"double HeedDeltaElectronCS::get_sigma(...)");
235 const long qe =
ees->get_qe();
236 double energyKeV = energy * 1000.0;
237 energyKeV = std::max(energyKeV,
ees->get_energy_mesh(0));
238 energyKeV = std::min(energyKeV,
ees->get_energy_mesh(qe - 1));
241 while (n2 - n1 > 1) {
242 const long n3 = n1 + (n2 - n1) / 2;
243 if (energyKeV < ees->get_energy_mesh(n3))
248 const double e1 =
ees->get_energy_mesh(n1);
249 const double e2 =
ees->get_energy_mesh(n2);
254 const double v1 = nscat * coef_low_sigma[n1];
255 const double v2 = nscat * coef_low_sigma[n2];
257 return v1 + (v2 - v1) / (e2 - e1) * (energyKeV - e1);
262 Ifile <<
"HeedDeltaElectronCS(l=" << l <<
"):";
263 long qe =
hmd->energy_mesh->get_q();
269 Ifile <<
" get_ec, beta, momentum, eLoss, lambda, "
270 " low_lambda:" << std::endl;
272 for (
long ne = 0; ne < qe; ne++) {
273 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
274 <<
hmd->energy_mesh->get_ec(ne) <<
' ' << std::setw(12) <<
beta[ne]
275 <<
' ' << std::setw(12) <<
momentum[ne] <<
' ' << std::setw(12)
276 <<
eLoss[ne] <<
' ' << std::setw(12) <<
lambda[ne] <<
' '
280 Ifile <<
"na, angular_mesh_c:" << std::endl;
289 Ifile <<
"ne, energy_mesh(ne), mean_coef_low_sigma:" << std::endl;
290 for (
long ne = 0; ne <
eesls->get_ees()->get_qe(); ne++) {
291 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
292 <<
eesls->get_ees()->get_energy_mesh(ne) <<
" KeV " << std::setw(12)
296 Ifile <<
"ne, energy_mesh(ne), coef_low_sigma:" << std::endl;
297 for (
long ne = 0; ne <
eesls->get_ees()->get_qe(); ne++) {
298 Ifile << std::setw(3) << ne <<
' ' << std::setw(12)
299 <<
eesls->get_ees()->get_energy_mesh(ne) <<
" KeV " << std::setw(12)
300 << coef_low_sigma[ne] <<
'\n';
#define check_econd11(a, signb, stream)
PassivePtr< ElElasticScat > ees
virtual void print(std::ostream &file, int l) const
double get_sigma(double energy, double nscat) const
PassivePtr< HeedMatterDef > hmd
std::vector< PointsRan > low_angular_points_ran
HeedDeltaElectronCS()
Default constructor.
std::vector< double > beta
Table of velocities.
std::vector< double > momentum
Table of momenta [MeV/c].
std::vector< double > eLoss
std::vector< double > angular_mesh_c
Angular mesh, centers, angles in degrees.
std::vector< double > lambda
std::vector< PointsRan > angular_points_ran
PassivePtr< ElElasticScatLowSigma > eesls
static const double low_cut_angle_deg
std::vector< double > mean_coef_low_sigma
std::vector< double > low_lambda
static const long q_angular_mesh
DoubleAc cos(const DoubleAc &f)
double lorbeta(const double gamma_1)
as function of .
DoubleAc pow(const DoubleAc &f, double p)
double e_cont_enloss(double ratio_Z_to_A, double I_eff, double density, double Ekin, double Ecut, double z)
DoubleAc sin(const DoubleAc &f)
DoubleAc asin(const DoubleAc &f)
DoubleAc sqrt(const DoubleAc &f)
#define Iprintn(file, name)