Geant4  10.03
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 96794 2016-05-09 10:09:30Z 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  inline G4int GetZasInt() const {return fZ;}
133 
134  // Atomic weight in atomic units
135  inline G4double GetN() const {return fNeff;}
136  inline G4double GetAtomicMassAmu() const {return fNeff;}
137 
138  // Mass of a mole in Geant4 units for atoms with atomic shell
139  inline G4double GetA() const {return fAeff;}
140 
141  inline G4bool GetNaturalAbundanceFlag() const;
142 
143  inline void SetNaturalAbundanceFlag(G4bool);
144 
145  //the number of atomic shells in this element:
146  //
147  inline G4int GetNbOfAtomicShells() const {return fNbOfAtomicShells;}
148 
149  //the binding energy of the shell, ground shell index=0
150  //
151  G4double GetAtomicShell(G4int index) const;
152 
153  //the number of electrons at the shell, ground shell index=0
154  //
155  G4int GetNbOfShellElectrons(G4int index) const;
156 
157  //number of isotopes constituing this element:
158  //
159  inline size_t GetNumberOfIsotopes() const {return fNumberOfIsotopes;}
160 
161  //vector of pointers to isotopes constituing this element:
162  //
164 
165  //vector of relative abundance of each isotope:
166  //
168  {return fRelativeAbundanceVector;}
169 
170  inline const G4Isotope* GetIsotope(G4int iso) const
171  {return (*theIsotopeVector)[iso];}
172 
173  //the (static) Table of Elements:
174  //
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  //Coulomb correction factor:
190  //
191  inline G4double GetfCoulomb() const {return fCoulomb;}
192 
193  //Tsai formula for the radiation length:
194  //
195  inline G4double GetfRadTsai() const {return fRadTsai;}
196 
197  //pointer to ionisation parameters:
198  //
199  inline G4IonisParamElm* GetIonisation() const {return fIonisation;}
200 
201  // printing methods
202  //
203  friend std::ostream& operator<<(std::ostream&, const G4Element*);
204  friend std::ostream& operator<<(std::ostream&, const G4Element&);
205  friend std::ostream& operator<<(std::ostream&, G4ElementTable);
206 
207 public: // without description
208 
209  G4Element(__void__&);
210  // Fake default constructor for usage restricted to direct object
211  // persistency for clients requiring preallocation of memory for
212  // persistifiable objects.
213 
214  inline void SetName(const G4String& name) {fName=name;}
215 
216 private:
217 
218  void InitializePointers();
220  void ComputeCoulombFactor();
221  void ComputeLradTsaiFactor();
222  void AddNaturalIsotopes();
223 
224  G4Element(G4Element&) = delete;
225  const G4Element & operator=(const G4Element&) = delete;
226  G4int operator==(const G4Element&) const = delete;
227  G4int operator!=(const G4Element&) const = delete;
228 
229  //
230  // Basic data members (which define an Element)
231  //
232  G4String fName; // name
233  G4String fSymbol; // symbol
234  G4double fZeff; // Effective atomic number
235  G4double fNeff; // Effective number of nucleons
236  G4double fAeff; // Effective mass of a mole
238 
239  G4int fNbOfAtomicShells; // number of atomic shells
240  G4double* fAtomicShells ; // Pointer to atomic shell binding energies
241  G4int* fNbOfShellElectrons; // Pointer to the number of subshell electrons
242 
243  // Isotope vector contains constituent isotopes of the element
244  G4int fNumberOfIsotopes; // Number of isotopes added to the element
246  G4double* fRelativeAbundanceVector; // Fraction nb of atomes per volume
247  // for each constituent
248 
249  // Set up the static Table of Elements
253 
254  //
255  // Derived data members (computed from the basic data members)
256  //
257  G4double fCoulomb; // Coulomb correction factor
258  G4double fRadTsai; // Tsai formula for the radiation length
259  G4IonisParamElm* fIonisation; // Pointer to ionisation parameters
260 };
261 
263 {
264  return fNaturalAbundance;
265 }
266 
268 {
269  fNaturalAbundance = val;
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
273 
274 #endif
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
G4double fRadTsai
Definition: G4Element.hh:258
G4int operator!=(const G4Element &) const =delete
G4double GetAtomicMassAmu() const
Definition: G4Element.hh:136
G4bool GetNaturalAbundanceFlag() const
Definition: G4Element.hh:262
G4int GetNbOfAtomicShells() const
Definition: G4Element.hh:147
std::vector< G4Isotope * > G4IsotopeVector
G4int operator==(const G4Element &) const =delete
static G4Element * GetElement(G4String name, G4bool warning=true)
Definition: G4Element.cc:412
G4double GetN() const
Definition: G4Element.hh:135
void SetNaturalAbundanceFlag(G4bool)
Definition: G4Element.hh:267
void ComputeCoulombFactor()
Definition: G4Element.cc:287
static G4ElementTable theElementTable
Definition: G4Element.hh:250
void AddNaturalIsotopes()
Definition: G4Element.cc:325
const G4String & GetSymbol() const
Definition: G4Element.hh:128
G4double fCoulomb
Definition: G4Element.hh:257
G4int * fNbOfShellElectrons
Definition: G4Element.hh:241
G4IsotopeVector * theIsotopeVector
Definition: G4Element.hh:245
G4double GetZ() const
Definition: G4Element.hh:131
G4double * fAtomicShells
Definition: G4Element.hh:240
G4IonisParamElm * fIonisation
Definition: G4Element.hh:259
G4double GetfCoulomb() const
Definition: G4Element.hh:191
const char * name(G4int ptype)
G4int GetNbOfShellElectrons(G4int index) const
Definition: G4Element.cc:382
G4double GetA() const
Definition: G4Element.hh:139
int G4int
Definition: G4Types.hh:78
G4bool fNaturalAbundance
Definition: G4Element.hh:252
void ComputeLradTsaiFactor()
Definition: G4Element.cc:302
static size_t GetNumberOfElements()
Definition: G4Element.cc:405
void InitializePointers()
Definition: G4Element.cc:219
bool G4bool
Definition: G4Types.hh:79
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:152
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
size_t GetIndex() const
Definition: G4Element.hh:182
G4Element(const G4String &name, const G4String &symbol, G4double Zeff, G4double Aeff)
Definition: G4Element.cc:75
G4int fZ
Definition: G4Element.hh:237
G4String fSymbol
Definition: G4Element.hh:233
G4int fNumberOfIsotopes
Definition: G4Element.hh:244
G4double fNeff
Definition: G4Element.hh:235
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
G4double GetfRadTsai() const
Definition: G4Element.hh:195
size_t fIndexInTable
Definition: G4Element.hh:251
G4int GetZasInt() const
Definition: G4Element.hh:132
friend std::ostream & operator<<(std::ostream &, const G4Element *)
Definition: G4Element.cc:432
G4IonisParamElm * GetIonisation() const
Definition: G4Element.hh:199
G4String fName
Definition: G4Element.hh:232
virtual ~G4Element()
Definition: G4Element.cc:253
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170
G4int fNbOfAtomicShells
Definition: G4Element.hh:239
G4double fZeff
Definition: G4Element.hh:234
G4double * fRelativeAbundanceVector
Definition: G4Element.hh:246
G4double GetAtomicShell(G4int index) const
Definition: G4Element.cc:367
std::vector< G4Element * > G4ElementTable
double G4double
Definition: G4Types.hh:76
const G4String & GetName() const
Definition: G4Element.hh:127
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398
void SetName(const G4String &name)
Definition: G4Element.hh:214
const G4Element & operator=(const G4Element &)=delete
G4double fAeff
Definition: G4Element.hh:236
void ComputeDerivedQuantities()
Definition: G4Element.cc:267