Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4NuclideTable
0027 //
0028 // Class description:
0029 //
0030 // Table of pointers to G4IsotopeProperty, which has magnetic moment
0031 // and spin. Data File name is given by G4ENSDFSTATEDATA.
0032 // Table based on G4IsomerTable.
0033 
0034 // Author: T.Koi, SLAC - 10 October 2013
0035 // --------------------------------------------------------------------
0036 #ifndef G4NuclideTable_hh
0037 #define G4NuclideTable_hh 1
0038 
0039 #include "G4DecayTable.hh"
0040 #include "G4IonTable.hh"
0041 #include "G4Ions.hh"
0042 #include "G4IsotopeProperty.hh"
0043 #include "G4ParticleTable.hh"
0044 #include "G4VIsotopeTable.hh"
0045 #include "globals.hh"
0046 
0047 #include <cmath>
0048 #include <vector>
0049 
0050 class G4NuclideTableMessenger;
0051 
0052 class G4NuclideTable : public G4VIsotopeTable
0053 {
0054   public:
0055     using G4IsotopeList = std::vector<G4IsotopeProperty*>;
0056 
0057     ~G4NuclideTable() override;
0058 
0059     G4NuclideTable(const G4NuclideTable&) = delete;
0060     G4NuclideTable& operator=(const G4NuclideTable&) = delete;
0061 
0062     static G4NuclideTable* GetInstance();
0063     static G4NuclideTable* GetNuclideTable();
0064 
0065     void GenerateNuclide();
0066 
0067     void SetThresholdOfHalfLife(G4double);
0068     inline G4double GetThresholdOfHalfLife();
0069 
0070     void SetMeanLifeThreshold(G4double);
0071     inline G4double GetMeanLifeThreshold();
0072 
0073     inline void SetLevelTolerance(G4double x);
0074     inline G4double GetLevelTolerance();
0075 
0076     void AddState(G4int, G4int, G4double, G4double, G4int ionJ = 0, G4double ionMu = 0.0);
0077     void AddState(G4int, G4int, G4double, G4int, G4double, G4int ionJ = 0, G4double ionMu = 0.0);
0078     void AddState(G4int, G4int, G4double, G4Ions::G4FloatLevelBase, G4double, G4int ionJ = 0,
0079                   G4double ionMu = 0.0);
0080 
0081     inline std::size_t GetSizeOfIsotopeList();
0082 
0083     // It will replace the pure virtual one in the abstract base class.
0084     //   Z: Atomic Number
0085     //   A: Atomic Mass
0086     //   E: Excitaion energy
0087     //   flb: floating level base (enum defined in G4Ions.hh)
0088     //    or
0089     //   lvl: isomer level
0090     G4IsotopeProperty*
0091     GetIsotope(G4int Z, G4int A, G4double E,
0092                G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float) override;
0093     G4IsotopeProperty* GetIsotopeByIsoLvl(G4int Z, G4int A, G4int lvl = 0) override;
0094 
0095     inline std::size_t entries() const;
0096     inline G4IsotopeProperty* GetIsotopeByIndex(std::size_t idx) const;
0097 
0098     // utility methods
0099 
0100     static G4double GetTruncationError(G4double eex);
0101     static G4double Round(G4double eex);
0102     static G4long Truncate(G4double eex);
0103     static G4double Tolerance();
0104 
0105   private:
0106     G4NuclideTable();
0107 
0108     G4double StripFloatLevelBase(G4double E, G4int& flbIndex);
0109     G4Ions::G4FloatLevelBase StripFloatLevelBase(const G4String&);
0110 
0111   private:
0112     G4double mean_life_threshold = 0.0;
0113     G4double minimum_mean_life_threshold = DBL_MAX;
0114 
0115     G4IsotopeList* fUserDefinedList = nullptr;
0116 
0117     // pre_load_list: contains state data for current run defined
0118     // by mean_life_threshold
0119     std::map<G4int, std::multimap<G4double, G4IsotopeProperty*>> map_pre_load_list;
0120 
0121     // full_list: keeps all state data during running application
0122     // defined by minimum_mean_life_threshold
0123     std::map<G4int, std::multimap<G4double, G4IsotopeProperty*>> map_full_list;
0124 
0125     // Table of Nuclide Property
0126     //  0: Z
0127     //  1: A
0128     //  2: Energy [keV]
0129     //  3: Life Time [ns]
0130     //  4: Spin  [h_bar/2]
0131     //  5: Magnetic Moment [joule/tesla]
0132     enum
0133     {
0134       idxZ = 0,
0135       idxA,
0136       idxEnergy,
0137       idxLife,
0138       idxSpin,
0139       idxMu
0140     };
0141 
0142     G4IsotopeList* fIsotopeList = nullptr;
0143     G4double flevelTolerance = 0.0;
0144     G4NuclideTableMessenger* fMessenger = nullptr;
0145 };
0146 
0147 // ------------------------
0148 // Inline methods
0149 // ------------------------
0150 
0151 inline G4double G4NuclideTable::GetThresholdOfHalfLife()
0152 {
0153   return mean_life_threshold * 0.69314718;
0154 }
0155 
0156 inline G4double G4NuclideTable::GetMeanLifeThreshold()
0157 {
0158   return mean_life_threshold;
0159 }
0160 
0161 inline void G4NuclideTable::SetLevelTolerance(G4double x)
0162 {
0163   flevelTolerance = x;
0164 }
0165 
0166 inline G4double G4NuclideTable::GetLevelTolerance()
0167 {
0168   return flevelTolerance;
0169 }
0170 
0171 inline std::size_t G4NuclideTable::GetSizeOfIsotopeList()
0172 {
0173   return (fIsotopeList != nullptr ? fIsotopeList->size() : static_cast<size_t>(0));
0174 }
0175 
0176 inline std::size_t G4NuclideTable::entries() const
0177 {
0178   return (fIsotopeList != nullptr ? fIsotopeList->size() : std::size_t(0));
0179 }
0180 
0181 inline G4IsotopeProperty* G4NuclideTable::GetIsotopeByIndex(std::size_t idx) const
0182 {
0183   if ((fIsotopeList != nullptr) && idx < fIsotopeList->size()) return (*fIsotopeList)[idx];
0184   return nullptr;
0185 }
0186 
0187 #endif