Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
e_cont_enloss.cpp
Go to the documentation of this file.
1#include <stdlib.h>
2#include <limits.h>
3#include <cmath>
9/*
10Continuous energy loss of electron similar to GDRELE from GEANT 3.21
11
122003, I. Smirnov
13*/
14
15namespace Heed {
16
17double e_cont_enloss(double ratio_Z_to_A, // do not forget:
18 // 1.0/(gram/mole)
19 double I_eff, double density,
20 double Ekin, // in internal units
21 double Ecut, // in internal units
22 double z) {
23 mfunname("double e_cont_enloss(...)");
24 double gamma = Ekin / electron_mass_c2 + 1.0;
25 double gamma2 = gamma * gamma;
26 double gamma_1 = Ekin / electron_mass_c2;
27 //mcout<<"gamma="<<gamma<<" gamma_1="<<gamma_1<<" gamma2="<<gamma2<<'\n';
28 double dedx = 0.0;
29 if (gamma_1 <= 0.0) return dedx;
30 double Tcme = Ecut / electron_mass_c2;
31 double betta = lorbeta(gamma_1);
32 double betta2 = betta * betta;
33 // calculation of F^+-
34 double F;
35 if (z > 0) // positron
36 {
37 double y = 1.0 / (1.0 + gamma);
38 double D = Tcme;
39 if (gamma_1 < Tcme) D = gamma_1;
40 double D2 = D * D / 2.0;
41 double D3 = 2.0 * D2 * D / 3.0;
42 double D4 = D2 * D2;
43 F = log(gamma_1 * D) -
44 betta2 *
45 (gamma_1 + 2.0 * D -
46 y * (3.0 * D2 + y * (D - D3 + y * (D2 - gamma_1 * D3 + D4)))) /
47 gamma_1;
48 } else {
49 double D = Tcme;
50 if (D > gamma_1 / 2.0) D = gamma_1 / 2.0;
51 F = -1.0 - betta2 + log((gamma_1 - D) * D) + gamma_1 / (gamma_1 - D) +
52 (0.5 * D * D + (1.0 + 2.0 * gamma_1) * log(1.0 - D / gamma_1)) / gamma2;
53 }
54 double logI = log(I_eff / electron_mass_c2);
55 double eldens = // in 1 / [legnth^3]
56 ratio_Z_to_A * // 1 / [weight]/mole
57 Avogadro * // from CLHEP Avogadro = 6.0221367e+23/mole
58 density; // [weight]/[length]^3
59 //double con2 = density;
60 double C = // dimensionless
61 1.0 +
62 2.0 * log((I_eff / GeV) / (28.8e-9 * sqrt(density / (g / cm3) *
63 ratio_Z_to_A * gram / mole)));
64 //Iprintn(mcout, density/(g/cm3));
65 //Iprintn(mcout, ratio_Z_to_A * gram/mole);
66 //Iprintn(mcout, C);
67 double x0, x1;
68 if (density > 0.05 * g / cm3) {
69 //mcout<<"density > 0.05 * g/cm3\n";
70 if (I_eff < 1.0e-7 * GeV) {
71 if (C < 3.681) {
72 x0 = 1.0;
73 } else {
74 x0 = 0.326 * C - 1.0;
75 }
76 x1 = 2.0;
77 } else {
78 //mcout<<"I_eff >= 1.0e-7 * GeV\n";
79 if (C < 5.215) {
80 //mcout<<"C < 5.215\n";
81 x0 = 0.2;
82 } else {
83 x0 = 0.326 * C - 1.5;
84 }
85 x1 = 3.0;
86 }
87 } else {
88 //mcout<<"density <= 0.05 * g/cm3\n";
89 if (C <= 12.25) {
90 //mcout<<"C <= 12.25\n";
91 double ip = long((C - 10.0) / 0.5) + 1;
92 if (ip < 0) ip = 0;
93 if (ip > 4) ip = 4;
94 x0 = 1.6 + 0.1 * double(ip);
95 x1 = 4.0;
96 } else {
97 if (C <= 13.804) {
98 x0 = 2.0;
99 x1 = 5.0;
100 } else {
101 x0 = 0.326 * C - 2.5;
102 x1 = 5.0;
103 }
104 }
105 }
106 double xa = C / 4.606;
107 double aa = 4.606 * (xa - x0) / pow(x1 - x0, 3.0);
108 double x = log(gamma_1 * (gamma + 1.0)) / 4.606;
109 double del = 0.0;
110 if (x > x0) {
111 del = 4.606 * x - C;
112 if (x <= x1) del = del + aa * pow(x1 - x, 3.0);
113 }
114 double cons = 0.153536e-3 // this is 2*pi*r0^2* avogadro * Emass(GeV)
115 * GeV * cm2 // translate to internal units
116 / Avogadro; // already included in eldens
117 dedx = cons * eldens * (log(2.0 * gamma_1 + 4.0) - 2.0 * logI + F - del) /
118 betta2;
119 if (dedx < 0.0) dedx = 0.0;
120 return dedx;
121}
122
123}
DoubleAc pow(const DoubleAc &f, double p)
Definition: DoubleAc.cpp:336
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
#define mfunname(string)
Definition: FunNameStack.h:67
Definition: BGMesh.cpp:3
double lorbeta(const double gamma_1)
Definition: lorgamma.cpp:22
double e_cont_enloss(double ratio_Z_to_A, double I_eff, double density, double Ekin, double Ecut, double z)