Geant4  10.00.p01
G4Element.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4Element.hh 69704 2013-05-13 09:06:12Z gcosmo $
28 //
29 
30 //---------------------------------------------------------------------------
31 //
32 // ClassName: G4Element
33 //
34 // Description: Contains element properties
35 //
36 // Class description:
37 //
38 // An element is a chemical element either directly defined in terms of
39 // its characteristics: its name, symbol,
40 // Z (effective atomic number)
41 // N (effective number of nucleons)
42 // A (effective mass of a mole)
43 // or in terms of a collection of constituent isotopes with specified
44 // relative abundance (i.e. fraction of nb of atoms per volume).
45 //
46 // Quantities, with physical meaning or not, which are constant in a given
47 // element are computed and stored here as Derived data members.
48 //
49 // The class contains as a private static member the table of defined
50 // elements (an ordered vector of elements).
51 //
52 // Elements can be assembled singly or in mixtures into materials used
53 // in volume definitions via the G4Material class.
54 //
55 // It is strongly recommended do not delete G4Element instance in the
56 // user code. All G4Elements will be automatically deleted at the end
57 // of Geant4 session
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
61 // 09-07-96, new data members added by L.Urban
62 // 17-01-97, aesthetic rearrangement, M.Maire
63 // 20-01-97, Tsai formula for the rad length, M.Maire
64 // 21-01-97, remove mixture flag, M.Maire
65 // 24-01-97, new data member: fTaul
66 // new method: ComputeIonisationPara, M.Maire
67 // 20-03-97, corrected initialization of pointers, M.Maire
68 // 27-06-97, new function GetIsotope(int), M.Maire
69 // 24-02-98, fWeightVector becomes fRelativeAbundanceVector
70 // 27-04-98, atomic shell stuff, V. Grichine
71 // 09-07-98, Ionisation parameters removed from the class, M.Maire
72 // 04-08-98, new method GetElement(elementName), M.Maire
73 // 16-11-98, Subshell -> Shell, mma
74 // 30-03-01, suppression of the warning message in GetElement
75 // 17-07-01, migration to STL, M. Verderi
76 // 13-09-01, stl migration. Suppression of the data member fIndexInTable
77 // 14-09-01, fCountUse: nb of materials which use this element
78 // 26-02-02, fIndexInTable renewed
79 // 01-04-05, new data member fIndexZ to count the number of elements with same Z
80 // 17-10-06: Add Get/Set fNaturalAbundance (V.Ivanchenko)
81 // 17.09.09, add fNbOfShellElectrons and methods (V. Grichine)
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
84 #ifndef G4ELEMENT_HH
85 #define G4ELEMENT_HH 1
86 
87 #include "globals.hh"
88 #include <vector>
89 #include "G4ios.hh"
90 #include "G4Isotope.hh"
91 #include "G4IonisParamElm.hh"
92 #include "G4IsotopeVector.hh"
93 #include "G4ElementTable.hh"
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
97 class G4Element
98 {
99 public: // with description
100 
101  //
102  // Constructor to Build an element directly; no reference to isotopes
103  //
104  G4Element(const G4String& name, //its name
105  const G4String& symbol, //its symbol
106  G4double Zeff, //atomic number
107  G4double Aeff); //mass of mole
108 
109  //
110  // Constructor to Build an element from isotopes via AddIsotope
111  //
112  G4Element(const G4String& name, //its name
113  const G4String& symbol, //its symbol
114  G4int nbIsotopes); //nb of isotopes
115 
116  //
117  // Add an isotope to the element
118  //
119  void AddIsotope(G4Isotope* isotope, //isotope
120  G4double RelativeAbundance); //fraction of nb of
121  //atomes per volume
122  virtual ~G4Element();
123 
124  //
125  // Retrieval methods
126  //
127  inline const G4String& GetName() const {return fName;}
128  inline const G4String& GetSymbol() const {return fSymbol;}
129 
130  // Atomic number
131  inline G4double GetZ() const {return fZeff;}
132 
133  // Atomic weight in atomic units
134  inline G4double GetN() const {return fNeff;}
135  inline G4double GetAtomicMassAmu() const {return fNeff;}
136 
137  // Mass of a mole in Geant4 units for atoms with atomic shell
138  inline G4double GetA() const {return fAeff;}
139 
140  inline G4bool GetNaturalAbundanceFlag() const;
141 
142  inline void SetNaturalAbundanceFlag(G4bool);
143 
144  //the number of atomic shells in this element:
145  //
146  inline G4int GetNbOfAtomicShells() const {return fNbOfAtomicShells;}
147 
148  //the binding energy of the shell, ground shell index=0
149  //
150  G4double GetAtomicShell(G4int index) const;
151 
152  //the number of electrons at the shell, ground shell index=0
153  //
154  G4int GetNbOfShellElectrons(G4int index) const;
155 
156  //number of isotopes constituing this element:
157  //
158  inline size_t GetNumberOfIsotopes() const {return fNumberOfIsotopes;}
159 
160  //vector of pointers to isotopes constituing this element:
161  //
163 
164  //vector of relative abundance of each isotope:
165  //
167  {return fRelativeAbundanceVector;}
168 
169  inline const G4Isotope* GetIsotope(G4int iso) const
170  {return (*theIsotopeVector)[iso];}
171 
172  //the (static) Table of Elements:
173  //
175 
176  static
177  size_t GetNumberOfElements();
178 
179  //the index of this element in the Table:
180  //
181  inline size_t GetIndex() const {return fIndexInTable;}
182 
183  //return pointer to an element, given its name:
184  //
185  static
186  G4Element* GetElement(G4String name, G4bool warning=true);
187 
188  //Coulomb correction factor:
189  //
190  inline G4double GetfCoulomb() const {return fCoulomb;}
191 
192  //Tsai formula for the radiation length:
193  //
194  inline G4double GetfRadTsai() const {return fRadTsai;}
195 
196  //pointer to ionisation parameters:
197  //
198  inline G4IonisParamElm* GetIonisation() const {return fIonisation;}
199 
200  // printing methods
201  //
202  friend std::ostream& operator<<(std::ostream&, G4Element*);
203  friend std::ostream& operator<<(std::ostream&, G4Element&);
204  friend std::ostream& operator<<(std::ostream&, G4ElementTable);
205 
206 public: // without description
207 
208  G4int operator==(const G4Element&) const;
209  G4int operator!=(const G4Element&) const;
210 
211  G4Element(__void__&);
212  // Fake default constructor for usage restricted to direct object
213  // persistency for clients requiring preallocation of memory for
214  // persistifiable objects.
215 
216  inline void SetName(const G4String& name) {fName=name;}
217 
218 private:
219 
221  const G4Element & operator=(const G4Element&);
222 
223  void InitializePointers();
225  void ComputeCoulombFactor();
226  void ComputeLradTsaiFactor();
227  void AddNaturalIsotopes();
228 
229 private:
230 
231  //
232  // Basic data members (which define an Element)
233  //
234  G4String fName; // name
235  G4String fSymbol; // symbol
236  G4double fZeff; // Effective atomic number
237  G4double fNeff; // Effective number of nucleons
238  G4double fAeff; // Effective mass of a mole
239 
240  G4int fNbOfAtomicShells; // number of atomic shells
241  G4double* fAtomicShells ; // Pointer to atomic shell binding energies
242  G4int* fNbOfShellElectrons; // pointer to the number of subshell electrons
243 
244  // Isotope vector contains constituent isotopes of the element
245  size_t fNumberOfIsotopes; // Number of isotopes added to the element
247  G4double* fRelativeAbundanceVector; // Fraction nb of atomes per volume
248  // for each constituent
249 
250  // Set up the static Table of Elements
254 
255  //
256  // Derived data members (computed from the basic data members)
257  //
258  G4double fCoulomb; // Coulomb correction factor
259  G4double fRadTsai; // Tsai formula for the radiation length
260  G4IonisParamElm* fIonisation; // Pointer to ionisation parameters
261 };
262 
264 {
265  return fNaturalAbundance;
266 }
267 
269 {
270  fNaturalAbundance = val;
271 }
272 
273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
274 
275 #endif
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4double fRadTsai
Definition: G4Element.hh:259
G4double GetAtomicMassAmu() const
Definition: G4Element.hh:135
G4bool GetNaturalAbundanceFlag() const
Definition: G4Element.hh:263
G4String symbol
Definition: TRTMaterials.hh:40
const G4Element & operator=(const G4Element &)
Definition: G4Element.cc:441
G4int GetNbOfAtomicShells() const
Definition: G4Element.hh:146
std::vector< G4Isotope * > G4IsotopeVector
static G4Element * GetElement(G4String name, G4bool warning=true)
Definition: G4Element.cc:409
G4double GetN() const
Definition: G4Element.hh:134
void SetNaturalAbundanceFlag(G4bool)
Definition: G4Element.hh:268
void ComputeCoulombFactor()
Definition: G4Element.cc:295
static G4ElementTable theElementTable
Definition: G4Element.hh:251
void AddNaturalIsotopes()
Definition: G4Element.cc:331
const G4String & GetSymbol() const
Definition: G4Element.hh:128
G4double fCoulomb
Definition: G4Element.hh:258
G4String name
Definition: TRTMaterials.hh:40
G4int * fNbOfShellElectrons
Definition: G4Element.hh:242
G4IsotopeVector * theIsotopeVector
Definition: G4Element.hh:246
G4double GetZ() const
Definition: G4Element.hh:131
G4double * fAtomicShells
Definition: G4Element.hh:241
G4IonisParamElm * fIonisation
Definition: G4Element.hh:260
G4double GetfCoulomb() const
Definition: G4Element.hh:190
G4int GetNbOfShellElectrons(G4int index) const
Definition: G4Element.cc:380
G4double GetA() const
Definition: G4Element.hh:138
int G4int
Definition: G4Types.hh:78
G4bool fNaturalAbundance
Definition: G4Element.hh:253
void ComputeLradTsaiFactor()
Definition: G4Element.cc:310
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
void InitializePointers()
Definition: G4Element.cc:227
bool G4bool
Definition: G4Types.hh:79
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:151
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
size_t GetIndex() const
Definition: G4Element.hh:181
G4Element(const G4String &name, const G4String &symbol, G4double Zeff, G4double Aeff)
Definition: G4Element.cc:74
G4String fSymbol
Definition: G4Element.hh:235
G4int operator==(const G4Element &) const
Definition: G4Element.cc:485
G4double fNeff
Definition: G4Element.hh:237
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
G4double GetfRadTsai() const
Definition: G4Element.hh:194
G4int operator!=(const G4Element &) const
Definition: G4Element.cc:492
size_t fIndexInTable
Definition: G4Element.hh:252
G4IonisParamElm * GetIonisation() const
Definition: G4Element.hh:198
G4String fName
Definition: G4Element.hh:234
virtual ~G4Element()
Definition: G4Element.cc:260
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:169
G4int fNbOfAtomicShells
Definition: G4Element.hh:240
G4double fZeff
Definition: G4Element.hh:236
G4double * fRelativeAbundanceVector
Definition: G4Element.hh:247
G4double GetAtomicShell(G4int index) const
Definition: G4Element.cc:365
friend std::ostream & operator<<(std::ostream &, G4Element *)
Definition: G4Element.cc:499
std::vector< G4Element * > G4ElementTable
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Element.hh:127
size_t fNumberOfIsotopes
Definition: G4Element.hh:245
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
void SetName(const G4String &name)
Definition: G4Element.hh:216
G4double fAeff
Definition: G4Element.hh:238
void ComputeDerivedQuantities()
Definition: G4Element.cc:276