Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PhotoAbsCSLib.cpp
Go to the documentation of this file.
3
4#include <iostream>
5
6// 2004, I. Smirnov
7
8namespace {
9
10std::string getDataBasePath() {
11
12 std::string path;
13 // First try if the environment variable HEED_DATABASE is defined.
14 char* heed_database = std::getenv("HEED_DATABASE");
15 if (heed_database) {
16 path = std::string(heed_database);
17 } else {
18 // If HEED_DATABASE is not defined, try GARFIELD_INSTALL.
19 char* garfield_install = std::getenv("GARFIELD_INSTALL");
20 if (garfield_install) {
21 path = std::string(garfield_install) + "/share/Heed/database/";
22 } else {
23 // Try GARFIELD_HOME.
24 char* garfield_home = std::getenv("GARFIELD_HOME");
25 if (garfield_home) {
26 path = std::string(garfield_home) + "/Heed/heed++/database/";
27 }
28 }
29 }
30 return path;
31}
32
33Heed::ExAtomPhotoAbsCS generate_Ar_PACS(const std::string& shelllist_dir,
34 const std::string& pacs_table_dir) {
35
36 Heed::ExAtomPhotoAbsCS Argon_PACS_mod_esc(18, shelllist_dir + "shelllist.dat",
37 pacs_table_dir + "Ar.dat");
38
39 // ExAtomPhotoAbsCS Argon_PACS_mod_esc(18,
40 // shelllist_dir + "shelllist.dat",
41 // shelllist_dir + "mw3.dat");
42
43 // ExAtomPhotoAbsCS Argon_PACS_mod_esc(18, "argon",
44 // shelllist_dir + "ftbf18.dat", 2);
45
46 Heed::AtomicSecondaryProducts* asp = Argon_PACS_mod_esc.get_asp(1);
47 std::vector<double> electron_energy;
48 std::vector<double> photon_energy;
49 electron_energy.emplace_back(0.000200);
50 // electron_energy.emplace_back(0.002670);
51 asp->add_channel(0.65, electron_energy, photon_energy);
52 electron_energy.resize(2);
53 electron_energy[0] = 0.000050;
54 electron_energy[1] = 0.000200;
55 asp->add_channel(0.35, electron_energy, photon_energy, 1);
56 // mcout<<"L1:\n";
57 // asp->print(mcout, 2);
58
59 asp = Argon_PACS_mod_esc.get_asp(2);
60 electron_energy.resize(1);
61 electron_energy[0] = 0.000200;
62 asp->add_channel(1.0, electron_energy, photon_energy, 1);
63 // mcout<<"L2:\n";
64 // asp->print(mcout, 2);
65
66 asp = Argon_PACS_mod_esc.get_asp(3);
67 electron_energy.resize(1);
68 electron_energy[0] = 0.000200;
69 asp->add_channel(1.0, electron_energy, photon_energy, 1);
70 // mcout<<"L3:\n";
71 // asp->print(mcout, 2);
72
73 return Argon_PACS_mod_esc;
74}
75}
76
77namespace Heed {
78
79using CLHEP::gram;
80using CLHEP::mole;
81
82
83std::map<std::string, ExAtomPhotoAbsCS> PhotoAbsCSLib::apacs;
84std::map<std::string, SimpleAtomPhotoAbsCS> PhotoAbsCSLib::hpacs;
85
86AtomPhotoAbsCS* PhotoAbsCSLib::getAPACS(const std::string& name) {
87 if (apacs.empty()) initialise();
88 if (name == "H" || name.find("H for") == 0) {
89 return &hpacs[name];
90 }
91 if (apacs.count(name) > 0) return &apacs[name];
92 return nullptr;
93}
94
95void PhotoAbsCSLib::initialise() {
96 if (!hpacs.empty() || !apacs.empty()) return;
97 // Hydrogen.
98 hpacs.emplace("H",
99 SimpleAtomPhotoAbsCS(1, std::make_shared<HydrogenPhotoAbsCS>()));
100 hpacs.emplace("H for H2",
101 SimpleAtomPhotoAbsCS(1, std::make_shared<PhenoPhotoAbsCS>("Hydrogen_for_H2", 1, 15.43e-6, 3.228)));
102 hpacs.emplace("H for CH4",
103 SimpleAtomPhotoAbsCS(1, std::make_shared<PhenoPhotoAbsCS>("Hydrogen_for_CH4", 1, 12.65e-06, 3.228)));
104 hpacs.emplace("H for NH4",
105 SimpleAtomPhotoAbsCS(1, std::make_shared<PhenoPhotoAbsCS>("Hydrogen_for_NH4", 1, 10.0e-06, 3.228)));
106 // hpacs.emplace("H for CH4",
107 // SimpleTablePhotoAbsCS("Hydrogen_for_CH4", 1, 12.65e-6,
108 // dbpath + "H_for_CH4.dat");
109
110 std::string dbpath = getDataBasePath();
111 if (dbpath.empty()) {
112 std::cerr << "Heed::PhotoAbsCsLib::initialise:\n"
113 << " Could not retrieve database path.\n";
114 }
115 if (dbpath[dbpath.size() - 1] != '/') dbpath.append("/");
116
117 const std::string pacs_table_dir = dbpath + "henke/";
118
119 // Argon.
120 apacs.emplace("Ar", generate_Ar_PACS(dbpath, pacs_table_dir));
121
122 // Other atoms.
123 std::string shells = dbpath + "shelllist.dat";
124 const std::map<std::string, int> atoms = {
125 {"He", 2}, {"Li", 3}, {"Be", 4}, {"B", 5}, {"C", 6},
126 {"O", 8}, {"F", 9}, {"Ne", 10}, {"Na", 11}, {"Mg", 12},
127 {"Al", 13}, {"Si", 14}, {"P", 15}, {"S", 16}, {"Cl", 17},
128 {"Ga", 31}, {"Ge", 32}, {"As", 33}, {"Br", 35}, {"Kr", 36},
129 {"Cd", 48}, {"Te", 52}, {"Xe", 54}, {"Cs", 55}, {"Hg", 80},
130 {"U", 92}};
131 for (const auto& atom : atoms) {
132 std::string pacstable = pacs_table_dir + atom.first + ".dat";
133 apacs.emplace(atom.first, ExAtomPhotoAbsCS(atom.second, shells, pacstable));
134 }
135 // "Standard" Argon:
136 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, shells,
137 // pacs_table_dir + "Ar.dat"));
138 // Optional variants:
139 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, shells, dbpath + "mw3.dat"));
140 // Variant for debug, pointwise cross section
141 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, "argon",
142 // dbpath + "ftbf18.dat", 2));
143 // Variant for debug, fitted cross section
144 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, "argon", dbpath + "shelltscf.dat",
145 // 2, 0, 0.0);
146 // Variant for debug, fitted cross section with replacement from Henke
147 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, "argon", dbpath + "shelltscf.dat",
148 // pacs_table_dir + "Ar.dat",
149 // 40.0e-6, 2, 0.0);
150 // Another variant for debug, fitted cross section with replacement from
151 // Marr and West, should be similar to old Fortran verion
152 // apacs.emplace("Ar", ExAtomPhotoAbsCS(18, "argon", dbpath + "shelltscf.dat",
153 // dbpath + "mw3.dat", 40.0e-6, 2, 0.0);
154
155 // For debug, FitBT
156 // apacs.emplace("C", ExAtomPhotoAbsCS(6, "carbon", dbpath + "shelltscf.dat",
157 // 2, 0, 0.0);
158 // apacs.emplace("C for CH4", ExAtomPhotoAbsCS(6, shells,
159 // pacs_table_dir + "C.dat",
160 // "C_for_CH4", 12.65e-06);
161
162 apacs.emplace("C for CH4", ExAtomPhotoAbsCS(6, shells,
163 dbpath + "C_for_CH4.dat",
164 "C_for_CH4", 12.65e-6));
165 apacs.emplace("C for C2H4", ExAtomPhotoAbsCS(6, shells,
166 pacs_table_dir + "C.dat",
167 "C_for_C2H4", 10.51e-06));
168 apacs.emplace("C for C2H6", ExAtomPhotoAbsCS(6, shells,
169 pacs_table_dir + "C.dat",
170 "C_for_C2H6", 11.52e-06));
171 apacs.emplace("C for C4H10", ExAtomPhotoAbsCS(6, shells,
172 pacs_table_dir + "C.dat",
173 "C_for_C4H10", 10.55e-06));
174 apacs.emplace("C for Methylal", ExAtomPhotoAbsCS(6, shells,
175 pacs_table_dir + "C.dat",
176 "C_for_Methylal", 10.0e-06));
177 apacs.emplace("C for CF4", ExAtomPhotoAbsCS(6, shells,
178 pacs_table_dir + "C.dat",
179 "C_for_CF4", 16.23e-06));
180 apacs.emplace("C for CO2", ExAtomPhotoAbsCS(6, shells,
181 pacs_table_dir + "C.dat",
182 "C_for_CO2", 13.79e-06));
183 apacs.emplace("N", ExAtomPhotoAbsCS(7, shells, pacs_table_dir + "N.dat",
184 "N_for_N2", 15.581e-6));
185 apacs.emplace("O for CO2", ExAtomPhotoAbsCS(8, shells,
186 pacs_table_dir + "O.dat",
187 "O_for_CO2", 13.79e-6));
188
189 std::string sshells = dbpath + "shelllist_solid.dat";
190
191 apacs.emplace("Diamond", ExAtomPhotoAbsCS(6, sshells,
192 pacs_table_dir + "C.dat",
193 "Diamond"));
194 apacs.emplace("Si crystal", ExAtomPhotoAbsCS(14, sshells,
195 pacs_table_dir + "Si.dat",
196 "Si_crystal"));
197 apacs.emplace("Ge crystal", ExAtomPhotoAbsCS(32, shells,
198 pacs_table_dir + "Ge.dat",
199 "Ge_crystal", 0.67e-06));
200 apacs.emplace("Si G4", ExAtomPhotoAbsCS(14, sshells, dbpath + "Si_G4.dat", "Si_G4"));
201 apacs.emplace("Ga for GaAs", ExAtomPhotoAbsCS(31, sshells,
202 pacs_table_dir + "Ga.dat",
203 "Ga_for_GaAs"));
204 apacs.emplace("As for GaAs", ExAtomPhotoAbsCS(33, sshells,
205 pacs_table_dir + "As.dat",
206 "As_for_GaAs"));
207 apacs.emplace("Cd for CdTe", ExAtomPhotoAbsCS(48, sshells,
208 pacs_table_dir + "Cd.dat",
209 "Cd_for_CdTe"));
210 apacs.emplace("Te for CdTe", ExAtomPhotoAbsCS(52, sshells,
211 pacs_table_dir + "Te.dat",
212 "Te_for_CdTe"));
213}
214
215}
Atomic photoabsorption cross-section abstract base class.
Definition PhotoAbsCS.h:286
void add_channel(double fchannel_prob_dens, const std::vector< double > &felectron_energy, const std::vector< double > &fphoton_energy, int s_all_rest=0)
Atomic photo-absorption with excitation.
Definition PhotoAbsCS.h:430
static AtomPhotoAbsCS * getAPACS(const std::string &name)
Definition BGMesh.cpp:6