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::AtomMixDef Class Reference

#include <AtomDef.h>

+ Inheritance diagram for Heed::AtomMixDef:

Public Member Functions

 AtomMixDef ()=default
 Default constructor.
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< double > &fweight_quan)
 
 AtomMixDef (unsigned long fqatom, const std::vector< std::string > &fatom_not, const std::vector< long > &fweight_quan)
 
 AtomMixDef (const std::string &fatom_not)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3)
 
 AtomMixDef (const std::string &fatom_not1, double fweight_quan1, const std::string &fatom_not2, double fweight_quan2, const std::string &fatom_not3, double fweight_quan3, const std::string &fatom_not4, double fweight_quan4)
 
void print (std::ostream &file, int l) const
 
long qatom () const
 
const std::vector< AtomDef * > & atom () const
 
AtomDefatom (long n) const
 
const std::vector< double > & weight_quan () const
 
const std::vector< double > & weight_mass () const
 
double weight_quan (long n) const
 
double weight_mass (long n) const
 
double Z_mean () const
 
double A_mean () const
 
double inv_A_mean () const
 
double mean_ratio_Z_to_A () const
 
double NumberOfElectronsInGram () const
 

Detailed Description

Definition of atomic mixtures. Pointers to atoms, weights and various mean parameters.

Definition at line 97 of file AtomDef.h.

Constructor & Destructor Documentation

◆ AtomMixDef() [1/7]

Heed::AtomMixDef::AtomMixDef ( )
default

Default constructor.

◆ AtomMixDef() [2/7]

Heed::AtomMixDef::AtomMixDef ( unsigned long  fqatom,
const std::vector< std::string > &  fatom_not,
const std::vector< double > &  fweight_quan 
)

Definition at line 96 of file AtomDef.cpp.

99 : qatomh(fqatom),
100 atomh(fqatom, nullptr),
101 weight_quanh(fqatom, 0.0),
102 weight_massh(fqatom, 0.0) {
103 mfunnamep("AtomMixDef::AtomMixDef(...)");
104 check_econd11(fqatom, <= 0, mcerr);
105 check_econd12(fqatom, >, fatom_not.size(), mcerr);
106 check_econd12(fqatom, >, fweight_quan.size(), mcerr);
107
108 for (long n = 0; n < qatomh; ++n) {
109 AtomDef* ad = AtomDef::get_AtomDef(fatom_not[n]);
110 if (!ad) {
111 funnw.ehdr(mcerr);
112 mcerr << "cannot find atom with notation " << fatom_not[n]
113 << "\nIn particular, check the sequence of initialization\n";
114 spexit(mcerr);
115 }
116 atomh[n] = ad;
117 }
118 double s = 0.0;
119 for (long n = 0; n < qatomh; n++) {
120 weight_quanh[n] = fweight_quan[n];
121 check_econd11(weight_quanh[n], <= 0, mcerr);
122 s += weight_quanh[n];
123 }
124 check_econd11(s, <= 0, mcerr);
125 if (s != 1.0) {
126 for (long n = 0; n < qatomh; n++) {
127 weight_quanh[n] /= s;
128 }
129 }
130 for (long n = 0; n < qatomh; n++) {
131 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
132 }
133 s = 0.0;
134 for (long n = 0; n < qatomh; n++) {
135 s += weight_massh[n];
136 }
137 check_econd11(s, <= 0, mcerr);
138 if (s != 1.0) {
139 for (long n = 0; n < qatomh; n++) {
140 weight_massh[n] /= s;
141 }
142 }
143 for (long n = 0; n < qatomh; n++) {
144 Z_meanh += atomh[n]->Z() * weight_quanh[n];
145 A_meanh += atomh[n]->A() * weight_quanh[n];
146 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
147 }
148 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
149 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
150}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:155
#define mfunnamep(string)
Definition: FunNameStack.h:49
#define spexit(stream)
Definition: FunNameStack.h:256
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:163
static AtomDef * get_AtomDef(const std::string &fnotation)
Definition: AtomDef.cpp:87
#define mcerr
Definition: prstream.h:128

◆ AtomMixDef() [3/7]

Heed::AtomMixDef::AtomMixDef ( unsigned long  fqatom,
const std::vector< std::string > &  fatom_not,
const std::vector< long > &  fweight_quan 
)

Definition at line 152 of file AtomDef.cpp.

155 : qatomh(fqatom),
156 atomh(fqatom, nullptr),
157 weight_quanh(fqatom, 0.0),
158 weight_massh(fqatom, 0.0) {
159 mfunnamep("AtomMixDef::AtomMixDef(...)");
160 check_econd11(fqatom, <= 0, mcerr);
161 check_econd12(fqatom, >, fatom_not.size(), mcerr);
162 check_econd12(fqatom, >, fweight_quan.size(), mcerr);
163
164 for (long n = 0; n < qatomh; ++n) {
165 AtomDef* ad = AtomDef::get_AtomDef(fatom_not[n]);
166 if (!ad) {
167 funnw.ehdr(mcerr);
168 mcerr << "cannot find atom with notation " << fatom_not[n]
169 << "\nIn particular, check the sequence of initialization\n";
170 spexit(mcerr);
171 }
172 atomh[n] = ad;
173 }
174 double s = 0.0;
175 for (long n = 0; n < qatomh; n++) {
176 weight_quanh[n] = fweight_quan[n];
177 check_econd11(weight_quanh[n], <= 0, mcerr);
178 s += weight_quanh[n];
179 }
180 check_econd11(s, <= 0, mcerr);
181 if (s != 1.0) {
182 for (long n = 0; n < qatomh; n++) {
183 weight_quanh[n] /= s;
184 }
185 }
186 for (long n = 0; n < qatomh; n++) {
187 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
188 }
189 s = 0.0;
190 for (long n = 0; n < qatomh; n++) {
191 s += weight_massh[n];
192 }
193 check_econd11(s, <= 0, mcerr);
194 if (s != 1.0) {
195 for (long n = 0; n < qatomh; n++) {
196 weight_massh[n] /= s;
197 }
198 }
199 for (long n = 0; n < qatomh; n++) {
200 Z_meanh += atomh[n]->Z() * weight_quanh[n];
201 A_meanh += atomh[n]->A() * weight_quanh[n];
202 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
203 }
204 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
205 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
206}

◆ AtomMixDef() [4/7]

Heed::AtomMixDef::AtomMixDef ( const std::string &  fatom_not)

Definition at line 209 of file AtomDef.cpp.

210 : qatomh(1),
211 atomh(1, nullptr),
212 weight_quanh(1, 1.),
213 weight_massh(1, 1.) {
214 mfunnamep("AtomMixDef::AtomMixDef(...)");
215 AtomDef* ad = AtomDef::get_AtomDef(fatom_not);
216 if (!ad) {
217 funnw.ehdr(mcerr);
218 mcerr << "cannot find atom with notation " << fatom_not
219 << "\nIn particular, check the sequence of initialization\n";
220 spexit(mcerr);
221 }
222 atomh[0] = ad;
223
224 weight_quanh[0] = 1.0;
225 weight_massh[0] = 1.0;
226
227 Z_meanh += atomh[0]->Z();
228 A_meanh += atomh[0]->A();
229 inv_A_meanh += (1.0 / atomh[0]->A());
230 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
231 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
232}

◆ AtomMixDef() [5/7]

Heed::AtomMixDef::AtomMixDef ( const std::string &  fatom_not1,
double  fweight_quan1,
const std::string &  fatom_not2,
double  fweight_quan2 
)

Definition at line 235 of file AtomDef.cpp.

237 : qatomh(2),
238 atomh(2, nullptr),
239 weight_quanh(2),
240 weight_massh(2) {
241 mfunnamep("AtomMixDef::AtomMixDef(...)");
242 std::vector<std::string> fatom_not(2);
243 fatom_not[0] = fatom_not1;
244 fatom_not[1] = fatom_not2;
245
246 for (long n = 0; n < qatomh; ++n) {
247 AtomDef* ad = AtomDef::get_AtomDef(fatom_not[n]);
248 if (!ad) {
249 funnw.ehdr(mcerr);
250 mcerr << "cannot find atom with notation " << fatom_not[n]
251 << "\nIn particular, check the sequence of initialization\n";
252 spexit(mcerr);
253 }
254 atomh[n] = ad;
255 }
256 weight_quanh[0] = fweight_quan1;
257 weight_quanh[1] = fweight_quan2;
258 double s = 0.0;
259 for (long n = 0; n < qatomh; n++) {
260 check_econd11(weight_quanh[n], <= 0, mcerr);
261 s += weight_quanh[n];
262 }
263 check_econd11(s, <= 0, mcerr);
264 if (s != 1.0) {
265 for (long n = 0; n < qatomh; n++) {
266 weight_quanh[n] /= s;
267 }
268 }
269 for (long n = 0; n < qatomh; n++) {
270 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
271 }
272 s = 0.0;
273 for (long n = 0; n < qatomh; n++) {
274 s += weight_massh[n];
275 }
276 check_econd11(s, <= 0, mcerr);
277 if (s != 1.0) {
278 for (long n = 0; n < qatomh; n++) {
279 weight_massh[n] /= s;
280 }
281 }
282 for (long n = 0; n < qatomh; n++) {
283 Z_meanh += atomh[n]->Z() * weight_quanh[n];
284 A_meanh += atomh[n]->A() * weight_quanh[n];
285 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
286 }
287 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
288 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
289}

◆ AtomMixDef() [6/7]

Heed::AtomMixDef::AtomMixDef ( const std::string &  fatom_not1,
double  fweight_quan1,
const std::string &  fatom_not2,
double  fweight_quan2,
const std::string &  fatom_not3,
double  fweight_quan3 
)

Definition at line 292 of file AtomDef.cpp.

295 : qatomh(3),
296 atomh(3, nullptr),
297 weight_quanh(3),
298 weight_massh(3) {
299
300 mfunnamep("AtomMixDef::AtomMixDef(...)");
301 std::vector<std::string> fatom_not(3);
302 fatom_not[0] = fatom_not1;
303 fatom_not[1] = fatom_not2;
304 fatom_not[2] = fatom_not3;
305
306 for (long n = 0; n < qatomh; ++n) {
307 AtomDef* ad = AtomDef::get_AtomDef(fatom_not[n]);
308 if (!ad) {
309 funnw.ehdr(mcerr);
310 mcerr << "cannot find atom with notation " << fatom_not[n]
311 << "\nIn particular, check the sequence of initialization\n";
312 spexit(mcerr);
313 }
314 atomh[n] = ad;
315 }
316 weight_quanh[0] = fweight_quan1;
317 weight_quanh[1] = fweight_quan2;
318 weight_quanh[2] = fweight_quan3;
319 double s = 0.0;
320 for (long n = 0; n < qatomh; n++) {
321 check_econd11(weight_quanh[n], <= 0, mcerr);
322 s += weight_quanh[n];
323 }
324 check_econd11(s, <= 0, mcerr);
325 if (s != 1.0) {
326 for (long n = 0; n < qatomh; n++) {
327 weight_quanh[n] /= s;
328 }
329 }
330 for (long n = 0; n < qatomh; n++) {
331 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
332 }
333 s = 0.0;
334 for (long n = 0; n < qatomh; n++) {
335 s += weight_massh[n];
336 }
337 check_econd11(s, <= 0, mcerr);
338 if (s != 1.0) {
339 for (long n = 0; n < qatomh; n++) {
340 weight_massh[n] /= s;
341 }
342 }
343 for (long n = 0; n < qatomh; n++) {
344 Z_meanh += atomh[n]->Z() * weight_quanh[n];
345 A_meanh += atomh[n]->A() * weight_quanh[n];
346 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
347 }
348 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
349 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
350}

◆ AtomMixDef() [7/7]

Heed::AtomMixDef::AtomMixDef ( const std::string &  fatom_not1,
double  fweight_quan1,
const std::string &  fatom_not2,
double  fweight_quan2,
const std::string &  fatom_not3,
double  fweight_quan3,
const std::string &  fatom_not4,
double  fweight_quan4 
)

Definition at line 353 of file AtomDef.cpp.

357 : qatomh(4),
358 atomh(4, nullptr),
359 weight_quanh(4, 0.),
360 weight_massh(4, 0.) {
361 mfunnamep("AtomMixDef::AtomMixDef(...)");
362 std::vector<std::string> fatom_not(4);
363 fatom_not[0] = fatom_not1;
364 fatom_not[1] = fatom_not2;
365 fatom_not[2] = fatom_not3;
366 fatom_not[3] = fatom_not4;
367
368 for (long k = 0; k < qatomh; k++) {
369 AtomDef* ad = AtomDef::get_AtomDef(fatom_not[k]);
370 if (!ad) {
371 funnw.ehdr(mcerr);
372 mcerr << "cannot find atom with notation " << fatom_not[k]
373 << "\nIn particular, check the sequence of initialization\n";
374 spexit(mcerr);
375 }
376 atomh[k] = ad;
377 }
378 weight_quanh[0] = fweight_quan1;
379 weight_quanh[1] = fweight_quan2;
380 weight_quanh[2] = fweight_quan3;
381 weight_quanh[3] = fweight_quan4;
382 double s = 0.0;
383 for (long n = 0; n < qatomh; n++) {
384 check_econd11(weight_quanh[n], <= 0, mcerr);
385 s += weight_quanh[n];
386 }
387 check_econd11(s, <= 0, mcerr);
388 if (s != 1.0) {
389 for (long n = 0; n < qatomh; n++) {
390 weight_quanh[n] /= s;
391 }
392 }
393 for (long n = 0; n < qatomh; n++) {
394 weight_massh[n] = weight_quanh[n] * atomh[n]->A();
395 }
396 s = 0.0;
397 for (long n = 0; n < qatomh; n++) {
398 s += weight_massh[n];
399 }
400 check_econd11(s, <= 0, mcerr);
401 if (s != 1.0) {
402 for (long n = 0; n < qatomh; n++) {
403 weight_massh[n] /= s;
404 }
405 }
406 for (long n = 0; n < qatomh; n++) {
407 Z_meanh += atomh[n]->Z() * weight_quanh[n];
408 A_meanh += atomh[n]->A() * weight_quanh[n];
409 inv_A_meanh += (1.0 / atomh[n]->A()) * weight_quanh[n];
410 }
411 mean_ratio_Z_to_Ah = Z_meanh / A_meanh;
412 NumberOfElectronsInGramh = mean_ratio_Z_to_Ah * (gram / mole) * Avogadro;
413}

Member Function Documentation

◆ A_mean()

double Heed::AtomMixDef::A_mean ( ) const
inline

Definition at line 141 of file AtomDef.h.

141{ return A_meanh; }

Referenced by Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), Heed::operator<<(), and Heed::HeedPhoton::physics().

◆ atom() [1/2]

const std::vector< AtomDef * > & Heed::AtomMixDef::atom ( ) const
inline

◆ atom() [2/2]

AtomDef * Heed::AtomMixDef::atom ( long  n) const
inline

Definition at line 135 of file AtomDef.h.

135{ return atomh[n]; }

◆ inv_A_mean()

double Heed::AtomMixDef::inv_A_mean ( ) const
inline

Definition at line 142 of file AtomDef.h.

142{ return inv_A_meanh; }

Referenced by Heed::operator<<().

◆ mean_ratio_Z_to_A()

double Heed::AtomMixDef::mean_ratio_Z_to_A ( ) const
inline

Definition at line 143 of file AtomDef.h.

143{ return mean_ratio_Z_to_Ah; }

Referenced by Heed::operator<<().

◆ NumberOfElectronsInGram()

double Heed::AtomMixDef::NumberOfElectronsInGram ( ) const
inline

Definition at line 144 of file AtomDef.h.

144 {
145 return NumberOfElectronsInGramh;
146 }

Referenced by Heed::operator<<().

◆ print()

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

Definition at line 415 of file AtomDef.cpp.

415 {
416 if (l > 0) file << (*this);
417}

◆ qatom()

◆ weight_mass() [1/2]

const std::vector< double > & Heed::AtomMixDef::weight_mass ( ) const
inline

Definition at line 137 of file AtomDef.h.

137{ return weight_massh; }

Referenced by Heed::operator<<().

◆ weight_mass() [2/2]

double Heed::AtomMixDef::weight_mass ( long  n) const
inline

Definition at line 139 of file AtomDef.h.

139{ return weight_massh[n]; }

◆ weight_quan() [1/2]

const std::vector< double > & Heed::AtomMixDef::weight_quan ( ) const
inline

◆ weight_quan() [2/2]

double Heed::AtomMixDef::weight_quan ( long  n) const
inline

Definition at line 138 of file AtomDef.h.

138{ return weight_quanh[n]; }

◆ Z_mean()

double Heed::AtomMixDef::Z_mean ( ) const
inline

Definition at line 140 of file AtomDef.h.

140{ return Z_meanh; }

Referenced by Heed::EnTransfCS::EnTransfCS(), Heed::HeedDeltaElectronCS::HeedDeltaElectronCS(), and Heed::operator<<().


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