Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 67044 2013-01-30 08:50:06Z 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 fNaturalAbandances (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 
141 
142  inline void SetNaturalAbandancesFlag(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  //
151 
152  //the number of electrons at the shell, ground shell index=0
153  //
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  //
162  inline G4IsotopeVector* GetIsotopeVector() const {return theIsotopeVector;}
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  //
174  static
176 
177  static
178  size_t GetNumberOfElements();
179 
180  //the index of this element in the Table:
181  //
182  inline size_t GetIndex() const {return fIndexInTable;}
183 
184  //return pointer to an element, given its name:
185  //
186  static
187  G4Element* GetElement(G4String name, G4bool warning=true);
188 
189  //count number of materials which use this element
190  //
191  inline G4int GetCountUse() const {return fCountUse;}
192  inline void increaseCountUse() {fCountUse++;}
193  inline void decreaseCountUse() {fCountUse--;}
194 
195  //count elements with same Z
196  //
197  inline G4int GetIndexZ() const {return fIndexZ;}
198 
199  //Coulomb correction factor:
200  //
201  inline G4double GetfCoulomb() const {return fCoulomb;}
202 
203  //Tsai formula for the radiation length:
204  //
205  inline G4double GetfRadTsai() const {return fRadTsai;}
206 
207  //pointer to ionisation parameters:
208  //
209  inline G4IonisParamElm* GetIonisation() const {return fIonisation;}
210 
211  // printing methods
212  //
213  friend std::ostream& operator<<(std::ostream&, G4Element*);
214  friend std::ostream& operator<<(std::ostream&, G4Element&);
215  friend std::ostream& operator<<(std::ostream&, G4ElementTable);
216 
217 public: // without description
218 
219  G4int operator==(const G4Element&) const;
220  G4int operator!=(const G4Element&) const;
221 
222  G4Element(__void__&);
223  // Fake default constructor for usage restricted to direct object
224  // persistency for clients requiring preallocation of memory for
225  // persistifiable objects.
226 
227  inline void SetName(const G4String& name) {fName=name;}
228 
229 private:
230 
232  const G4Element & operator=(const G4Element&);
233 
234  void InitializePointers();
235  void ComputeDerivedQuantities();
236  void ComputeCoulombFactor();
237  void ComputeLradTsaiFactor();
238  void AddNaturalIsotopes();
239 
240 private:
241 
242  //
243  // Basic data members (which define an Element)
244  //
245  G4String fName; // name
246  G4String fSymbol; // symbol
247  G4double fZeff; // Effective atomic number
248  G4double fNeff; // Effective number of nucleons
249  G4double fAeff; // Effective mass of a mole
250 
251  G4int fNbOfAtomicShells; // number of atomic shells
252  G4double* fAtomicShells ; // Pointer to atomic shell binding energies
253  G4int* fNbOfShellElectrons; // pointer to the number of subshell electrons
254 
255  // Isotope vector contains constituent isotopes of the element
256  size_t fNumberOfIsotopes; // Number of isotopes added to the element
257  G4IsotopeVector* theIsotopeVector;
258  G4double* fRelativeAbundanceVector; // Fraction nb of atomes per volume
259  // for each constituent
260  G4int fCountUse; // nb of materials which use this element
261  G4int fIndexZ; // index for elements with same Z
262 
263  // Set up the static Table of Elements
264  static G4ElementTable theElementTable;
265  size_t fIndexInTable;
266  G4bool fNaturalAbandances;
267 
268  //
269  // Derived data members (computed from the basic data members)
270  //
271  G4double fCoulomb; // Coulomb correction factor
272  G4double fRadTsai; // Tsai formula for the radiation length
273  G4IonisParamElm* fIonisation; // Pointer to ionisation parameters
274 };
275 
277 {
278  return fNaturalAbandances;
279 }
280 
282 {
283  fNaturalAbandances = val;
284 }
285 
286 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
287 
288 #endif