Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
EnTransfCS_BGM.cpp
Go to the documentation of this file.
1#include <iomanip>
2
5
6namespace Heed {
7
8EnTransfCS_BGM::EnTransfCS_BGM(double fparticle_mass, BGMesh* fmesh,
9 int fs_primary_electron, HeedMatterDef* fhmd,
10 long fparticle_charge)
11 : particle_mass(fparticle_mass),
12 particle_charge(fparticle_charge),
13 s_primary_electron(fs_primary_electron),
14 hmd(fhmd),
15 mesh(fmesh) {
16 mfunnamep("EnTransfCS_BGM::EnTransfCS_BGM(...)");
17
18 const long q = mesh->q;
19 etcs_bgm.resize(q);
20 for (long n = 0; n < q; n++) {
21 double bg = mesh->x[n];
22 // gamma - 1
23 double gamma_1 = sqrt(1.0 + (bg * bg)) - 1.0;
24 etcs_bgm[n] = EnTransfCS(fparticle_mass, gamma_1, fs_primary_electron, fhmd,
25 fparticle_charge);
26 }
27}
28
29void EnTransfCS_BGM::print(std::ostream& file, int l) const {
30 if (l <= 0) return;
31 Ifile << "EnTransfCS_BGM(l=" << l << "):\n";
32 indn.n += 2;
33 Ifile << "particle_mass=" << particle_mass
34 << " particle_charge=" << particle_charge << std::endl;
35 Ifile << "s_primary_electron=" << s_primary_electron << std::endl;
36 Ifile << "hmd:\n";
37 hmd->print(file, 1);
38 Ifile << "mesh:\n";
39 mesh->print(file, 1);
40
41 Ifile << "Array of Cross Section:\n";
42 Ifile << "Number of elements = " << etcs_bgm.size() << '\n';
43
44 if (l >= 2) {
45 const long q = mesh->q;
46 for (long n = 0; n < q; n++) {
47 Ifile << "n=" << std::setw(5) << n << " bg=" << std::setw(14)
48 << mesh->x[n] << " quan=" << std::setw(14) << etcs_bgm[n].quanC;
49#ifndef EXCLUDE_MEAN
50 file << " mean=" << std::setw(14) << etcs_bgm[n].meanC;
51#endif
52 file << '\n';
53 }
54 }
55 indn.n -= 2;
56}
57}
#define mfunnamep(string)
Definition: FunNameStack.h:49
Mesh of values.
Definition: BGMesh.h:10
void print(std::ostream &file, int l) const
Definition: BGMesh.cpp:25
long q
Total number of points (not number of intervals).
Definition: BGMesh.h:17
std::vector< double > x
Definition: BGMesh.h:18
std::vector< EnTransfCS > etcs_bgm
int s_primary_electron
Sign that the primary particle is an electron.
void print(std::ostream &file, int l) const
EnTransfCS_BGM()=default
Default constructor.
HeedMatterDef * hmd
void print(std::ostream &file, int l) const
Definition: BGMesh.cpp:6
indentation indn
Definition: prstream.cpp:15
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:314
#define Ifile
Definition: prstream.h:195