Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:11

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 
0026 //---------------------------------------------------------------------------
0027 //
0028 // ClassName:   G4Element
0029 //
0030 // Description: Contains element properties
0031 //
0032 // Class description:
0033 //
0034 // An element is a chemical element either directly defined in terms of
0035 // its characteristics: its name, symbol,
0036 //                      Z (effective atomic number)
0037 //                      N (effective number of nucleons)
0038 //                      A (effective mass of a mole)
0039 // or in terms of a collection of constituent isotopes with specified
0040 // relative abundance (i.e. fraction of nb of atoms per volume).
0041 //
0042 // Quantities, with physical meaning or not, which are constant in a given
0043 // element are computed and stored here as Derived data members.
0044 //
0045 // The class contains as a private static member the table of defined
0046 // elements (an ordered vector of elements).
0047 //
0048 // Elements can be assembled singly or in mixtures into materials used
0049 // in volume definitions via the G4Material class.
0050 //
0051 // It is strongly recommended do not delete G4Element instance in the
0052 // user code. All G4Elements will be automatically deleted at the end
0053 // of Geant4 session
0054 
0055 // 09-07-96, new data members added by L.Urban
0056 // 17-01-97, aesthetic rearrangement, M.Maire
0057 // 20-01-97, Tsai formula for the rad length, M.Maire
0058 // 21-01-97, remove mixture flag, M.Maire
0059 // 24-01-97, new data member: fTaul
0060 //           new method: ComputeIonisationPara, M.Maire
0061 // 20-03-97, corrected initialization of pointers, M.Maire
0062 // 27-06-97, new function GetIsotope(int), M.Maire
0063 // 24-02-98, fWeightVector becomes fRelativeAbundanceVector
0064 // 27-04-98, atomic shell stuff, V. Grichine
0065 // 09-07-98, Ionisation parameters removed from the class, M.Maire
0066 // 04-08-98, new method GetElement(elementName), M.Maire
0067 // 16-11-98, Subshell -> Shell, mma
0068 // 30-03-01, suppression of the warning message in GetElement
0069 // 17-07-01, migration to STL, M. Verderi
0070 // 13-09-01, stl migration. Suppression of the data member fIndexInTable
0071 // 14-09-01, fCountUse: nb of materials which use this element
0072 // 26-02-02, fIndexInTable renewed
0073 // 01-04-05, new data member fIndexZ to count the number of elements with same Z
0074 // 17-10-06: Add Get/Set fNaturalAbundance (V.Ivanchenko)
0075 // 17.09.09, add fNbOfShellElectrons and methods (V. Grichine)
0076 
0077 #ifndef G4ELEMENT_HH
0078 #define G4ELEMENT_HH 1
0079 
0080 #include "G4ElementTable.hh"
0081 #include "G4ElementVector.hh"
0082 #include "G4IonisParamElm.hh"
0083 #include "G4Isotope.hh"
0084 #include "G4IsotopeVector.hh"
0085 #include "G4ios.hh"
0086 #include "globals.hh"
0087 
0088 #include <vector>
0089 
0090 class G4Element
0091 {
0092  public:  // with description
0093   // Constructor to Build an element directly; no reference to isotopes
0094   G4Element(const G4String& name,  // its name
0095     const G4String& symbol,  // its symbol
0096     G4double Zeff,  // atomic number
0097     G4double Aeff);  // mass of mole
0098 
0099   // Constructor to Build an element from isotopes via AddIsotope
0100   G4Element(const G4String& name,  // its name
0101     const G4String& symbol,  // its symbol
0102     G4int nbIsotopes);  // nb of isotopes
0103 
0104   virtual ~G4Element();
0105 
0106   G4Element(G4Element&) = delete;
0107   const G4Element& operator=(const G4Element&) = delete;
0108 
0109   // Add an isotope to the element
0110   void AddIsotope(G4Isotope* isotope,  // isotope
0111     G4double RelativeAbundance);  // fraction of nb of
0112                                   // atomes per volume
0113 
0114   // Retrieval methods
0115   inline const G4String& GetName() const { return fName; }
0116   inline const G4String& GetSymbol() const { return fSymbol; }
0117 
0118   // Atomic number
0119   inline G4double GetZ() const { return fZeff; }
0120   inline G4int GetZasInt() const { return fZ; }
0121 
0122   // Atomic weight in atomic units
0123   inline G4double GetN() const { return fNeff; }
0124   inline G4double GetAtomicMassAmu() const { return fNeff; }
0125 
0126   // Mass of a mole in Geant4 units for atoms with atomic shell
0127   inline G4double GetA() const { return fAeff; }
0128 
0129   inline G4bool GetNaturalAbundanceFlag() const;
0130 
0131   inline void SetNaturalAbundanceFlag(G4bool);
0132 
0133   // the number of atomic shells in this element:
0134   inline G4int GetNbOfAtomicShells() const { return fNbOfAtomicShells; }
0135 
0136   // the binding energy of the shell, ground shell index=0
0137   G4double GetAtomicShell(G4int index) const;
0138 
0139   // the number of electrons at the shell, ground shell index=0
0140   G4int GetNbOfShellElectrons(G4int index) const;
0141 
0142   // number of isotopes constituing this element:
0143   inline size_t GetNumberOfIsotopes() const { return fNumberOfIsotopes; }
0144 
0145   // vector of pointers to isotopes constituing this element:
0146   inline G4IsotopeVector* GetIsotopeVector() const { return theIsotopeVector; }
0147 
0148   // vector of relative abundance of each isotope:
0149   inline G4double* GetRelativeAbundanceVector() const { return fRelativeAbundanceVector; }
0150 
0151   inline const G4Isotope* GetIsotope(G4int iso) const { return (*theIsotopeVector)[iso]; }
0152 
0153   // the (static) Table of Elements:
0154   static G4ElementTable* GetElementTable();
0155 
0156   static size_t GetNumberOfElements();
0157 
0158   // the index of this element in the Table:
0159   inline size_t GetIndex() const { return fIndexInTable; }
0160 
0161   // return pointer to an element, given its name:
0162   static G4Element* GetElement(const G4String& name, G4bool warning = true);
0163 
0164   // Coulomb correction factor:
0165   inline G4double GetfCoulomb() const { return fCoulomb; }
0166 
0167   // Tsai formula for the radiation length:
0168   inline G4double GetfRadTsai() const { return fRadTsai; }
0169 
0170   // pointer to ionisation parameters:
0171   inline G4IonisParamElm* GetIonisation() const { return fIonisation; }
0172 
0173   // printing methods
0174   friend std::ostream& operator<<(std::ostream&, const G4Element*);
0175   friend std::ostream& operator<<(std::ostream&, const G4Element&);
0176   friend std::ostream& operator<<(std::ostream&, const G4ElementTable&);
0177   friend std::ostream& operator<<(std::ostream&, const G4ElementVector&);
0178 
0179   inline void SetName(const G4String& name) { fName = name; }
0180 
0181   G4bool operator==(const G4Element&) const = delete;
0182   G4bool operator!=(const G4Element&) const = delete;
0183 
0184  private:
0185   void InitializePointers();
0186   void ComputeDerivedQuantities();
0187   void ComputeCoulombFactor();
0188   void ComputeLradTsaiFactor();
0189   void AddNaturalIsotopes();
0190 
0191   // Basic data members (which define an Element)
0192 
0193   G4String fName;  // name
0194   G4String fSymbol;  // symbol
0195   G4double fZeff;  // Effective atomic number
0196   G4double fNeff;  // Effective number of nucleons
0197   G4double fAeff;  // Effective mass of a mole
0198   G4int fZ;
0199 
0200   G4int fNbOfAtomicShells;  // number  of atomic shells
0201   G4double* fAtomicShells;  // Pointer to atomic shell binding energies
0202   G4int* fNbOfShellElectrons;  // Pointer to the number of subshell electrons
0203 
0204   G4int fNumberOfIsotopes;  // Number of isotopes added to the element
0205   G4IsotopeVector* theIsotopeVector;  // vector of constituent isotopes of the element
0206   G4double* fRelativeAbundanceVector;  // Fraction nb of atomes per volume
0207                                        // for each constituent
0208 
0209   // Set up the static Table of Elements
0210   static G4ElementTable theElementTable;
0211   size_t fIndexInTable;
0212   G4bool fNaturalAbundance;
0213 
0214   // Derived data members (computed from the basic data members)
0215 
0216   G4double fCoulomb;  // Coulomb correction factor
0217   G4double fRadTsai;  // Tsai formula for the radiation length
0218   G4IonisParamElm* fIonisation;  // Pointer to ionisation parameters
0219 };
0220 
0221 inline G4bool G4Element::GetNaturalAbundanceFlag() const { return fNaturalAbundance; }
0222 
0223 inline void G4Element::SetNaturalAbundanceFlag(G4bool val) { fNaturalAbundance = val; }
0224 
0225 #endif