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