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