Garfield++ v1r0
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>
8
9/*
10Definition of atoms. Only the basic information: the name, the notation,
11the atomic weight and charge.
12
13Definition of atomic mixtures. Pointers to atoms, weights and
14various mean parameters.
15
16The principle of definitions of atoms is dictionary or a database:
17the atoms are not repeated,
18each atom is presented in the total system no more than one time.
19The system knows each atom presented in it.
20The atom characteristics can be obtained by literal notation.
21The system declines the secondary initialization.
22The copying is not declined.
23When the user program wants to refer to atom,
24it has to use either char* (String) notation, or pointer (or reference)
25to one of these objects.
26As usually, in the case of pointers I recommend to use protected pointers
27to external objects PassivePtr.
28The user pogram can initialize the new atoms.
29The standard atoms are initiated in files GasLib.h and GasLib.c.
30
31In principle I am going to initiate all atoms from Mendeleev's table,
32but I haven't finished yet. Only its first half is filled at the moment.
33
34The atoms are registered in the static element of class AtomDef
35private:
36 static AbsList< AtomDef* > logbook;
37The can be obtained by notations by:
38public:
39 static const AbsList< AtomDef* >& get_AtomDefLogbook(void);
40 static AtomDef* get_AtomDef(const String& fnotation);
41 // returns the address of atom with this name if it is registered in system,
42 // or NULL otherwise
43
44The definition of atomic mixture is a simple class. It is heavily used
45for definition of matter and gas.
46
47In these files and in the other components of the matter package
48the principles are similar. This is the principle of database, the principle
49of the strict protection of internal data (variables marked by
50suffix 'h') and granting access though the functions which have similar
51names without this suffix 'h'.
52
53
541998-2004, I. Smirnov.
55*/
56
57namespace Heed {
58
59const int max_poss_atom_z = 100;
60
61class AtomDef : public RegPassivePtr {
62 String nameh;
63 String notationh;
64 int Zh;
65 // Atomic mass in internal units. Transfer to gram/mole if need.
66 double Ah;
67
68 public:
69 AtomDef(void);
70 AtomDef(const String& fnameh, const String& fnotationh, int fZh, double fAh);
71 ~AtomDef();
72 void print(std::ostream& file, int l = 0) const;
73 const String& name(void) const { return nameh; }
74 const String& notation(void) const { return notationh; }
75 int Z(void) const { return Zh; }
76 double A(void) const { return Ah; }
77 // Print all registered atoms
78 static void printall(std::ostream& file);
79 // Check that there is no atom with the same name in the container
80 void verify(void);
81 // Initialize the logbook at the first request
82 // and keep it as internal static variable.
83 static AbsList<AtomDef*>& get_logbook(void);
84 static const AbsList<AtomDef*>& get_const_logbook(void);
85 // Return the address of atom with this name if it is registered in system,
86 // or NULL otherwise
87 static AtomDef* get_AtomDef(const String& fnotation);
88 // Return the atomic number corresponding to a given Z.
89 // If the atom is not registered, the current version
90 // terminates the program through spexit(). Be careful!
91 static double get_A(int fZ);
92 // Return the address of atom corresponding to a given Z.
93 // If the atom is not registered, the current version
94 // terminates the program through spexit(). Be careful!
95 static AtomDef* get_AtomDef(int fZ);
96
98};
99std::ostream& operator<<(std::ostream& file, const AtomDef& f);
100
101class AtomMixDef : public RegPassivePtr {
102 // Number of different atoms
103 long qatomh;
105 DynLinArr<double> weight_quanh; // sum is 1
106 DynLinArr<double> weight_massh; // sum is 1
107
108 // Weighted means
109 double Z_meanh;
110 double A_meanh; // in internal units. Transfer to gram/mole if needed.
111 double inv_A_meanh; // in internal units. Transfer to (1.0/(gram/mole)),
112 // if needed
113 // Z_meanh / A_meanh;
114 double mean_ratio_Z_to_Ah;
115 double NumberOfElectronsInGramh;
116
117 public:
119 : qatomh(0),
120 Z_meanh(0.0),
121 A_meanh(0.0),
122 inv_A_meanh(0.0),
123 mean_ratio_Z_to_Ah(0.0),
124 NumberOfElectronsInGramh(0.0) {
125 ;
126 }
127 AtomMixDef(long fqatom, const DynLinArr<String>& fatom_not,
128 const DynLinArr<double>& fweight_quan);
129 AtomMixDef(long fqatom, const DynLinArr<String>& fatom_not,
130 const DynLinArr<long>& fweight_quan);
131 AtomMixDef(const String& fatom_not);
132 AtomMixDef(const String& fatom_not1, double fweight_quan1,
133 const String& fatom_not2, double fweight_quan2);
134 AtomMixDef(const String& fatom_not1, double fweight_quan1,
135 const String& fatom_not2, double fweight_quan2,
136 const String& fatom_not3, double fweight_quan3);
137 AtomMixDef(const String& fatom_not1, double fweight_quan1,
138 const String& fatom_not2, double fweight_quan2,
139 const String& fatom_not3, double fweight_quan3,
140 const String& fatom_not4, double fweight_quan4);
141 void print(std::ostream& file, int l) const;
142 long qatom(void) const { return qatomh; }
143 const DynLinArr<PassivePtr<AtomDef> >& atom(void) const { return atomh; }
144 PassivePtr<AtomDef> atom(long n) const { return atomh[n]; }
145 const DynLinArr<double>& weight_quan(void) const { return weight_quanh; }
146 const DynLinArr<double>& weight_mass(void) const { return weight_massh; }
147 double weight_quan(long n) const { return weight_quanh[n]; }
148 double weight_mass(long n) const { return weight_massh[n]; }
149 double Z_mean(void) const { return Z_meanh; }
150 double A_mean(void) const { return A_meanh; }
151 double inv_A_mean(void) const { return inv_A_meanh; }
152 double mean_ratio_Z_to_A(void) const { return mean_ratio_Z_to_Ah; }
153 double NumberOfElectronsInGram(void) const {
154 return NumberOfElectronsInGramh;
155 }
156};
157std::ostream& operator<<(std::ostream& file, const AtomMixDef& f);
158
159}
160
161#endif
std::string String
Definition: String.h:75
static AbsList< AtomDef * > & get_logbook(void)
Definition: AtomDef.cpp:87
const String & name(void) const
Definition: AtomDef.h:73
int Z(void) const
Definition: AtomDef.h:75
static AtomDef * get_AtomDef(const String &fnotation)
Definition: AtomDef.cpp:96
void print(std::ostream &file, int l=0) const
Definition: AtomDef.cpp:12
double A(void) const
Definition: AtomDef.h:76
const String & notation(void) const
Definition: AtomDef.h:74
static void printall(std::ostream &file)
Definition: AtomDef.cpp:16
static const AbsList< AtomDef * > & get_const_logbook(void)
Definition: AtomDef.cpp:92
macro_copy_total(AtomDef)
void verify(void)
Definition: AtomDef.cpp:64
static double get_A(int fZ)
Definition: AtomDef.cpp:38
AtomDef(void)
Definition: AtomDef.cpp:25
void print(std::ostream &file, int l) const
Definition: AtomDef.cpp:459
double NumberOfElectronsInGram(void) const
Definition: AtomDef.h:153
double A_mean(void) const
Definition: AtomDef.h:150
PassivePtr< AtomDef > atom(long n) const
Definition: AtomDef.h:144
double inv_A_mean(void) const
Definition: AtomDef.h:151
AtomMixDef(void)
Definition: AtomDef.h:118
double weight_quan(long n) const
Definition: AtomDef.h:147
double mean_ratio_Z_to_A(void) const
Definition: AtomDef.h:152
long qatom(void) const
Definition: AtomDef.h:142
double Z_mean(void) const
Definition: AtomDef.h:149
const DynLinArr< PassivePtr< AtomDef > > & atom(void) const
Definition: AtomDef.h:143
const DynLinArr< double > & weight_quan(void) const
Definition: AtomDef.h:145
const DynLinArr< double > & weight_mass(void) const
Definition: AtomDef.h:146
double weight_mass(long n) const
Definition: AtomDef.h:148
Definition: BGMesh.cpp:3
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:22
const int max_poss_atom_z
Definition: AtomDef.h:59