ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Element.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Element.hh
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 //
28 
29 //---------------------------------------------------------------------------
30 //
31 // ClassName: G4Element
32 //
33 // Description: Contains element properties
34 //
35 // Class description:
36 //
37 // An element is a chemical element either directly defined in terms of
38 // its characteristics: its name, symbol,
39 // Z (effective atomic number)
40 // N (effective number of nucleons)
41 // A (effective mass of a mole)
42 // or in terms of a collection of constituent isotopes with specified
43 // relative abundance (i.e. fraction of nb of atoms per volume).
44 //
45 // Quantities, with physical meaning or not, which are constant in a given
46 // element are computed and stored here as Derived data members.
47 //
48 // The class contains as a private static member the table of defined
49 // elements (an ordered vector of elements).
50 //
51 // Elements can be assembled singly or in mixtures into materials used
52 // in volume definitions via the G4Material class.
53 //
54 // It is strongly recommended do not delete G4Element instance in the
55 // user code. All G4Elements will be automatically deleted at the end
56 // of Geant4 session
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
60 // 09-07-96, new data members added by L.Urban
61 // 17-01-97, aesthetic rearrangement, M.Maire
62 // 20-01-97, Tsai formula for the rad length, M.Maire
63 // 21-01-97, remove mixture flag, M.Maire
64 // 24-01-97, new data member: fTaul
65 // new method: ComputeIonisationPara, M.Maire
66 // 20-03-97, corrected initialization of pointers, M.Maire
67 // 27-06-97, new function GetIsotope(int), M.Maire
68 // 24-02-98, fWeightVector becomes fRelativeAbundanceVector
69 // 27-04-98, atomic shell stuff, V. Grichine
70 // 09-07-98, Ionisation parameters removed from the class, M.Maire
71 // 04-08-98, new method GetElement(elementName), M.Maire
72 // 16-11-98, Subshell -> Shell, mma
73 // 30-03-01, suppression of the warning message in GetElement
74 // 17-07-01, migration to STL, M. Verderi
75 // 13-09-01, stl migration. Suppression of the data member fIndexInTable
76 // 14-09-01, fCountUse: nb of materials which use this element
77 // 26-02-02, fIndexInTable renewed
78 // 01-04-05, new data member fIndexZ to count the number of elements with same Z
79 // 17-10-06: Add Get/Set fNaturalAbundance (V.Ivanchenko)
80 // 17.09.09, add fNbOfShellElectrons and methods (V. Grichine)
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
83 #ifndef G4ELEMENT_HH
84 #define G4ELEMENT_HH 1
85 
86 #include "globals.hh"
87 #include <vector>
88 #include "G4ios.hh"
89 #include "G4Isotope.hh"
90 #include "G4IonisParamElm.hh"
91 #include "G4IsotopeVector.hh"
92 #include "G4ElementTable.hh"
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95 
96 class G4Element
97 {
98 public: // with description
99 
100  //
101  // Constructor to Build an element directly; no reference to isotopes
102  //
103  G4Element(const G4String& name, //its name
104  const G4String& symbol, //its symbol
105  G4double Zeff, //atomic number
106  G4double Aeff); //mass of mole
107 
108  //
109  // Constructor to Build an element from isotopes via AddIsotope
110  //
111  G4Element(const G4String& name, //its name
112  const G4String& symbol, //its symbol
113  G4int nbIsotopes); //nb of isotopes
114 
115  //
116  // Add an isotope to the element
117  //
118  void AddIsotope(G4Isotope* isotope, //isotope
119  G4double RelativeAbundance); //fraction of nb of
120  //atomes per volume
121  virtual ~G4Element();
122 
123  //
124  // Retrieval methods
125  //
126  inline const G4String& GetName() const {return fName;}
127  inline const G4String& GetSymbol() const {return fSymbol;}
128 
129  // Atomic number
130  inline G4double GetZ() const {return fZeff;}
131  inline G4int GetZasInt() const {return fZ;}
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&, const G4Element*);
203  friend std::ostream& operator<<(std::ostream&, const G4Element&);
204  friend std::ostream& operator<<(std::ostream&, G4ElementTable);
205 
206 public: // without description
207 
208  G4Element(__void__&);
209  // Fake default constructor for usage restricted to direct object
210  // persistency for clients requiring preallocation of memory for
211  // persistifiable objects.
212 
213  inline void SetName(const G4String& name) {fName=name;}
214 
215 private:
216 
217  void InitializePointers();
219  void ComputeCoulombFactor();
220  void ComputeLradTsaiFactor();
221  void AddNaturalIsotopes();
222 
223  G4Element(G4Element&) = delete;
224  const G4Element & operator=(const G4Element&) = delete;
225  G4bool operator==(const G4Element&) const = delete;
226  G4bool operator!=(const G4Element&) const = delete;
227 
228  //
229  // Basic data members (which define an Element)
230  //
231  G4String fName; // name
232  G4String fSymbol; // symbol
233  G4double fZeff; // Effective atomic number
234  G4double fNeff; // Effective number of nucleons
235  G4double fAeff; // Effective mass of a mole
237 
238  G4int fNbOfAtomicShells; // number of atomic shells
239  G4double* fAtomicShells ; // Pointer to atomic shell binding energies
240  G4int* fNbOfShellElectrons; // Pointer to the number of subshell electrons
241 
242  // Isotope vector contains constituent isotopes of the element
243  G4int fNumberOfIsotopes; // Number of isotopes added to the element
245  G4double* fRelativeAbundanceVector; // Fraction nb of atomes per volume
246  // for each constituent
247 
248  // Set up the static Table of Elements
252 
253  //
254  // Derived data members (computed from the basic data members)
255  //
256  G4double fCoulomb; // Coulomb correction factor
257  G4double fRadTsai; // Tsai formula for the radiation length
258  G4IonisParamElm* fIonisation; // Pointer to ionisation parameters
259 };
260 
262 {
263  return fNaturalAbundance;
264 }
265 
267 {
268  fNaturalAbundance = val;
269 }
270 
271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
272 
273 #endif