Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::ElElasticScat Class Reference

#include <ElElasticScat.h>

Public Member Functions

double get_CS (long Z, double energy, double angle, int s_interp=0)
 
double get_CS_Rutherford (long Z, double energy, double angle)
 
long get_qe (void) const
 
double get_energy_mesh (long ne) const
 
 ElElasticScat ()=default
 Default constructor.
 
 ElElasticScat (const std::string &file_name)
 Constructor with file name.
 
void print (std::ostream &file, int l) const
 

Detailed Description

Definition of elastic scattering for low-energy delta-electron. The class contains the data for all atoms presents them by request. 2003, I. Smirnov

Definition at line 34 of file ElElasticScat.h.

Constructor & Destructor Documentation

◆ ElElasticScat() [1/2]

Heed::ElElasticScat::ElElasticScat ( )
default

Default constructor.

◆ ElElasticScat() [2/2]

Heed::ElElasticScat::ElElasticScat ( const std::string &  file_name)

Constructor with file name.

Definition at line 37 of file ElElasticScat.cpp.

37 : atom(0) {
38 mfunnamep("ElElasticScat::ElElasticScat(const string& filename)");
39 std::ifstream file(file_name.c_str());
40 if (!file) {
41 funnw.ehdr(mcerr);
42 mcerr << "cannot open file " << file_name << std::endl;
44 }
45 int i = findmark(file, "#");
46 check_econd11a(i, != 1, "cannot find sign #, wrong file format", mcerr);
47 file >> qe;
48 energy_mesh.resize(qe);
49 gamma_beta2.resize(qe);
50 for (long ne = 0; ne < qe; ++ne) {
51 file >> energy_mesh[ne];
52 if (!file.good()) {
53 funnw.ehdr(mcerr);
54 mcerr << "error at reading energy_mesh, ne=" << ne << '\n';
56 }
57 // energy mesh in keV
58 const double rm = 0.001 * energy_mesh[ne] / electron_mass_c2;
59 const double gamma = 1. + rm;
60 const double beta2 = (2 * rm + rm * rm) / (gamma * gamma);
61 gamma_beta2[ne] = gamma * beta2;
62 }
63 while (findmark(file, "$") == 1) {
64 long Z;
65 file >> Z;
66 check_econd21(Z, < 1 ||, > 110, mcerr);
67 atom.emplace_back(ElElasticScatData(Z, qe));
68 for (int nc = 0; nc < 4; ++nc) {
69 for (long ne = 0; ne < qe; ++ne) {
70 file >> atom.back().data[ne].A[nc];
71 if (!file.good()) {
72 funnw.ehdr(mcerr);
73 mcerr << "error at reading A, Z=" << Z << " nc=" << nc << " ne=" << ne
74 << '\n';
76 }
77 }
78 }
79 for (int nc = 0; nc < 7; ++nc) {
80 for (long ne = 0; ne < qe; ++ne) {
81 file >> atom.back().data[ne].C[nc];
82 if (!file.good()) {
83 funnw.ehdr(mcerr);
84 mcerr << "error at reading C, Z=" << Z << " nc=" << nc << " ne=" << ne
85 << '\n';
87 }
88 }
89 }
90 for (long ne = 0; ne < qe; ++ne) {
91 file >> atom.back().data[ne].B;
92 if (!file.good()) {
93 funnw.ehdr(mcerr);
94 mcerr << "error at reading B, Z=" << Z << " ne=" << ne << '\n';
96 }
97 }
98 }
99}
#define check_econd21(a, sign1_b1_sign0, sign2_b2, stream)
Definition: FunNameStack.h:191
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
#define mfunnamep(string)
Definition: FunNameStack.h:49
#define spexit(stream)
Definition: FunNameStack.h:256
int findmark(std::istream &file, const char *s)
Definition: findmark.cpp:19
#define mcerr
Definition: prstream.h:128

Member Function Documentation

◆ get_CS()

double Heed::ElElasticScat::get_CS ( long  Z,
double  energy,
double  angle,
int  s_interp = 0 
)

Get the cross-section (in angstrom^2/srad).

Parameters
Zatomic number
energykinetic energy in MeV
angleangle
s_interpflag for debugging and various checks

fill_hist call this function with s_interp=1 for histograms "int...".

Definition at line 168 of file ElElasticScat.cpp.

169 {
170 mfunname(
171 "double ElElasticScat::get_CS(long Z, double energy, double angle, "
172 "int s_interp)");
173 const long qa = atom.size();
174 long na_left = 0;
175 long Z_left = -100;
176 long na_right = qa - 1;
177 long Z_right = 10000;
178 for (long na = 0; na < qa; na++) {
179 if (atom[na].Z == Z && s_interp == 0) {
180 return get_CS_for_presented_atom(na, energy, angle);
181 }
182 if (atom[na].Z > Z_left && atom[na].Z < Z) {
183 Z_left = atom[na].Z;
184 na_left = na;
185 } else if (atom[na].Z < Z_right && atom[na].Z > Z) {
186 Z_right = atom[na].Z;
187 na_right = na;
188 }
189 }
190 check_econd11a(Z_left, == -100, " have not found previous atom", mcerr);
191 check_econd11a(Z_right, == 10000, " have not found next atom", mcerr);
192 const double f1 = get_CS_for_presented_atom(na_left, energy, angle);
193 const double f2 = get_CS_for_presented_atom(na_right, energy, angle);
194 const double z1 = atom[na_left].Z;
195 const double z2 = atom[na_right].Z;
196 const double c = (f1 * 4 - f2 * z1 * z1) / (f2 * z1 - f1 * z2);
197 const double k = f1 / (z1 * (z1 + c));
198 double r = k * Z * (Z + c);
199 if (r < 0.0) r = 0.0;
200 return r;
201}
#define mfunname(string)
Definition: FunNameStack.h:45

Referenced by Heed::HeedDeltaElectronCS::HeedDeltaElectronCS().

◆ get_CS_Rutherford()

double Heed::ElElasticScat::get_CS_Rutherford ( long  Z,
double  energy,
double  angle 
)

Get the cross-section (in angstrom^2).

Parameters
Zatomic number
energykinetic energy in MeV
angleangle in internal units (radian)

Definition at line 203 of file ElElasticScat.cpp.

203 {
204 mfunname(
205 "double ElElasticScat::get_CS_Rutherford(long Z, double energy, "
206 "double angle)");
207 const double gamma_1 = energy / electron_mass_c2;
208 const double beta2 = lorbeta2(gamma_1);
209 const double momentum2 = energy * energy + 2.0 * electron_mass_c2 * energy;
210 // TODO
211 double r = 0.25 * Z * Z * fine_structure_const * fine_structure_const /
212 (momentum2 * beta2 * pow(sin(0.5 * angle), 4)) /
213 (pow(5.07E10, 2)) * 1.0e16;
214 return r;
215}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:337
DoubleAc sin(const DoubleAc &f)
Definition: DoubleAc.cpp:384
double lorbeta2(const double gamma_1)
as function of .
Definition: lorgamma.cpp:27

◆ get_energy_mesh()

double Heed::ElElasticScat::get_energy_mesh ( long  ne) const
inline

◆ get_qe()

long Heed::ElElasticScat::get_qe ( void  ) const
inline

◆ print()

void Heed::ElElasticScat::print ( std::ostream &  file,
int  l 
) const

Definition at line 217 of file ElElasticScat.cpp.

217 {
218 if (l <= 0) return;
219 Ifile << "ElElasticScat(l=" << l << "): qe=" << qe
220 << " atom.size()=" << atom.size() << std::endl;
221 if (l <= 1) return;
222 indn.n += 2;
223 Ifile << "energy_mesh=";
224 for (long ne = 0; ne < qe; ++ne) {
225 file << std::setw(12) << energy_mesh[ne];
226 }
227 file << std::endl;
228 Ifile << "gamma_beta2=";
229 for (long ne = 0; ne < qe; ++ne) {
230 file << std::setw(12) << gamma_beta2[ne];
231 }
232 file << std::endl;
233 indn.n -= 2;
234 const long qa = atom.size();
235 for (long na = 0; na < qa; ++na) {
236 Ifile << "atom[na].Z=" << atom[na].Z << '\n';
237 Ifile << " ";
238 for (long ne = 0; ne < qe; ++ne) {
239 file << std::setw(12) << energy_mesh[ne];
240 }
241 file << std::endl;
242 for (long n = 0; n < 4; ++n) {
243 Ifile << "A[" << n << "]";
244 for (long ne = 0; ne < qe; ++ne) {
245 file << std::setw(12) << atom[na].data[ne].A[n];
246 }
247 file << std::endl;
248 }
249 for (int n = 0; n < 7; ++n) {
250 Ifile << "C[" << n << "]";
251 for (long ne = 0; ne < qe; ++ne) {
252 file << std::setw(12) << atom[na].data[ne].C[n];
253 }
254 file << std::endl;
255 }
256 Ifile << "B ";
257 for (long ne = 0; ne < qe; ++ne) {
258 file << std::setw(12) << atom[na].data[ne].B;
259 }
260 file << std::endl;
261 }
262}
indentation indn
Definition: prstream.cpp:15
#define Ifile
Definition: prstream.h:195

The documentation for this class was generated from the following files: