Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
AtomDef.h
Go to the documentation of this file.
1#ifndef ATOM_DEF_H
2#define ATOM_DEF_H
3
4#include <iostream>
5#include <vector>
6#include <list>
7
8namespace Heed {
9
10/// Definition of atoms.
11/// Only the basic information: name, notation, atomic weight and charge.
12///
13/// In principle I am going to initiate all atoms from Mendeleev's table,
14/// but I haven't finished yet. Only its first half is filled at the moment.
15///
16/// 1998-2004, I. Smirnov.
17
18class AtomDef {
19 std::string nameh = "none";
20 std::string notationh = "none";
21 /// Atomic number.
22 int Zh = 0;
23 /// Atomic mass in internal units. Transfer to gram/mole if need.
24 double Ah = 0.;
25
26 public:
27 /// Default constructor
28 AtomDef() = default;
29 /// Constructor
30 AtomDef(const std::string& fnameh, const std::string& fnotationh, int fZh,
31 double fAh);
32 /// Destructor
33 ~AtomDef() = default;
34
35 const std::string& name() const { return nameh; }
36 const std::string& notation() const { return notationh; }
37 int Z() const { return Zh; }
38 double A() const { return Ah; }
39
40 void print(std::ostream& file, int l = 0) const;
41 AtomDef* copy() const { return new AtomDef(*this); }
42};
43std::ostream& operator<<(std::ostream& file, const AtomDef& f);
44
45/// Library of atoms.
46
47class AtomDefs {
48
49 public:
50 static void addAtom(const std::string& name, const std::string& notation,
51 const int z, const double a);
52 static const std::list<AtomDef>& getAtoms();
53
54 /// Return the address of atom with this name if it is registered in system,
55 /// or NULL otherwise
56 static const AtomDef* getAtom(const std::string& fnotation);
57 /// Return the atomic number corresponding to a given Z.
58 /// If the atom is not registered, the program is terminated. Be careful!
59 static double getA(int fZ);
60 /// Return the address of atom corresponding to a given Z.
61 /// If the atom is not registered, the program is terminated. Be careful!
62 static const AtomDef* getAtom(int fZ);
63
64 /// Print all registered atoms.
65 static void printAtoms(std::ostream& file);
66 private:
67 static std::list<AtomDef> atoms;
68};
69
70/// Definition of atomic mixtures. Pointers to atoms, weights and
71/// various mean parameters.
72
74 /// Number of different atoms.
75 long qatomh = 0;
76 /// Constituent atoms.
77 std::vector<const AtomDef*> atomh;
78 std::vector<double> weight_quanh; // sum is 1
79 std::vector<double> weight_massh; // sum is 1
80
81 /// Weighted mean Z
82 double Z_meanh = 0.;
83 /// Weighted mean A (in internal units). Transfer to gram/mole if needed.
84 double A_meanh = 0.;
85 /// Weighted mean 1 / A (in internal units).
86 double inv_A_meanh = 0.;
87 /// Weighted mean ratio Z / A.
88 double mean_ratio_Z_to_Ah = 0.;
89 double NumberOfElectronsInGramh = 0.;
90
91 public:
92 /// Default constructor
93 AtomMixDef() = default;
94 /// Constructor from list of atoms and weights.
95 AtomMixDef(unsigned long fqatom, const std::vector<std::string>& fatom_not,
96 const std::vector<double>& fweight_quan);
97 /// Constructor from list of atoms and number of atoms per molecule.
98 AtomMixDef(unsigned long fqatom, const std::vector<std::string>& fatom_not,
99 const std::vector<long>& fweight_quan);
100 void print(std::ostream& file, int l) const;
101 long qatom() const { return qatomh; }
102 const std::vector<const AtomDef*>& atom() const { return atomh; }
103 const AtomDef* atom(long n) const { return atomh[n]; }
104 const std::vector<double>& weight_quan() const { return weight_quanh; }
105 const std::vector<double>& weight_mass() const { return weight_massh; }
106 double weight_quan(long n) const { return weight_quanh[n]; }
107 double weight_mass(long n) const { return weight_massh[n]; }
108 double Z_mean() const { return Z_meanh; }
109 double A_mean() const { return A_meanh; }
110 double inv_A_mean() const { return inv_A_meanh; }
111 double mean_ratio_Z_to_A() const { return mean_ratio_Z_to_Ah; }
112 double NumberOfElectronsInGram() const {
113 return NumberOfElectronsInGramh;
114 }
115};
116std::ostream& operator<<(std::ostream& file, const AtomMixDef& f);
117}
118
119#endif
double A() const
Definition AtomDef.h:38
int Z() const
Definition AtomDef.h:37
AtomDef()=default
Default constructor.
AtomDef * copy() const
Definition AtomDef.h:41
const std::string & name() const
Definition AtomDef.h:35
void print(std::ostream &file, int l=0) const
Definition AtomDef.cpp:22
~AtomDef()=default
Destructor.
const std::string & notation() const
Definition AtomDef.h:36
Library of atoms.
Definition AtomDef.h:47
static const AtomDef * getAtom(const std::string &fnotation)
Definition AtomDef.cpp:114
static void addAtom(const std::string &name, const std::string &notation, const int z, const double a)
Definition AtomDef.cpp:36
static double getA(int fZ)
Definition AtomDef.cpp:121
static void printAtoms(std::ostream &file)
Print all registered atoms.
Definition AtomDef.cpp:109
static const std::list< AtomDef > & getAtoms()
Definition AtomDef.cpp:41
const std::vector< double > & weight_quan() const
Definition AtomDef.h:104
AtomMixDef()=default
Default constructor.
void print(std::ostream &file, int l) const
Definition AtomDef.cpp:255
const std::vector< double > & weight_mass() const
Definition AtomDef.h:105
long qatom() const
Definition AtomDef.h:101
double mean_ratio_Z_to_A() const
Definition AtomDef.h:111
const std::vector< const AtomDef * > & atom() const
Definition AtomDef.h:102
double Z_mean() const
Definition AtomDef.h:108
const AtomDef * atom(long n) const
Definition AtomDef.h:103
double weight_quan(long n) const
Definition AtomDef.h:106
double NumberOfElectronsInGram() const
Definition AtomDef.h:112
double inv_A_mean() const
Definition AtomDef.h:110
double weight_mass(long n) const
Definition AtomDef.h:107
double A_mean() const
Definition AtomDef.h:109
Definition BGMesh.cpp:6
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition BGMesh.cpp:37