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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4NuclideTable
 27 //
 28 // Class description:
 29 //
 30 // Table of pointers to G4IsotopeProperty, which has magnetic moment
 31 // and spin. Data File name is given by G4ENSDFSTATEDATA.
 32 // Table based on G4IsomerTable.
 33 
 34 // Author: T.Koi, SLAC - 10 October 2013
 35 // --------------------------------------------------------------------
 36 #ifndef G4NuclideTable_hh
 37 #define G4NuclideTable_hh 1
 38 
 39 #include "G4DecayTable.hh"
 40 #include "G4IonTable.hh"
 41 #include "G4Ions.hh"
 42 #include "G4IsotopeProperty.hh"
 43 #include "G4ParticleTable.hh"
 44 #include "G4VIsotopeTable.hh"
 45 #include "globals.hh"
 46 
 47 #include <cmath>
 48 #include <vector>
 49 
 50 class G4NuclideTableMessenger;
 51 
 52 class G4NuclideTable : public G4VIsotopeTable
 53 {
 54   public:
 55     using G4IsotopeList = std::vector<G4IsotopeProperty*>;
 56 
 57     ~G4NuclideTable() override;
 58 
 59     G4NuclideTable(const G4NuclideTable&) = delete;
 60     G4NuclideTable& operator=(const G4NuclideTable&) = delete;
 61 
 62     static G4NuclideTable* GetInstance();
 63     static G4NuclideTable* GetNuclideTable();
 64 
 65     void GenerateNuclide();
 66 
 67     void SetThresholdOfHalfLife(G4double);
 68     inline G4double GetThresholdOfHalfLife();
 69 
 70     void SetMeanLifeThreshold(G4double);
 71     inline G4double GetMeanLifeThreshold();
 72 
 73     inline void SetLevelTolerance(G4double x);
 74     inline G4double GetLevelTolerance();
 75 
 76     void AddState(G4int, G4int, G4double, G4double, G4int ionJ = 0, G4double ionMu = 0.0);
 77     void AddState(G4int, G4int, G4double, G4int, G4double, G4int ionJ = 0, G4double ionMu = 0.0);
 78     void AddState(G4int, G4int, G4double, G4Ions::G4FloatLevelBase, G4double, G4int ionJ = 0,
 79                   G4double ionMu = 0.0);
 80 
 81     inline std::size_t GetSizeOfIsotopeList();
 82 
 83     // It will replace the pure virtual one in the abstract base class.
 84     //   Z: Atomic Number
 85     //   A: Atomic Mass
 86     //   E: Excitaion energy
 87     //   flb: floating level base (enum defined in G4Ions.hh)
 88     //    or
 89     //   lvl: isomer level
 90     G4IsotopeProperty*
 91     GetIsotope(G4int Z, G4int A, G4double E,
 92                G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float) override;
 93     G4IsotopeProperty* GetIsotopeByIsoLvl(G4int Z, G4int A, G4int lvl = 0) override;
 94 
 95     inline std::size_t entries() const;
 96     inline G4IsotopeProperty* GetIsotopeByIndex(std::size_t idx) const;
 97 
 98     // utility methods
 99 
100     static G4double GetTruncationError(G4double eex);
101     static G4double Round(G4double eex);
102     static G4long Truncate(G4double eex);
103     static G4double Tolerance();
104 
105   private:
106     G4NuclideTable();
107 
108     G4double StripFloatLevelBase(G4double E, G4int& flbIndex);
109     G4Ions::G4FloatLevelBase StripFloatLevelBase(const G4String&);
110 
111   private:
112     G4double mean_life_threshold = 0.0;
113     G4double minimum_mean_life_threshold = DBL_MAX;
114 
115     G4IsotopeList* fUserDefinedList = nullptr;
116 
117     // pre_load_list: contains state data for current run defined
118     // by mean_life_threshold
119     std::map<G4int, std::multimap<G4double, G4IsotopeProperty*>> map_pre_load_list;
120 
121     // full_list: keeps all state data during running application
122     // defined by minimum_mean_life_threshold
123     std::map<G4int, std::multimap<G4double, G4IsotopeProperty*>> map_full_list;
124 
125     // Table of Nuclide Property
126     //  0: Z
127     //  1: A
128     //  2: Energy [keV]
129     //  3: Life Time [ns]
130     //  4: Spin  [h_bar/2]
131     //  5: Magnetic Moment [joule/tesla]
132     enum
133     {
134       idxZ = 0,
135       idxA,
136       idxEnergy,
137       idxLife,
138       idxSpin,
139       idxMu
140     };
141 
142     G4IsotopeList* fIsotopeList = nullptr;
143     G4double flevelTolerance = 0.0;
144     G4NuclideTableMessenger* fMessenger = nullptr;
145 };
146 
147 // ------------------------
148 // Inline methods
149 // ------------------------
150 
151 inline G4double G4NuclideTable::GetThresholdOfHalfLife()
152 {
153   return mean_life_threshold * 0.69314718;
154 }
155 
156 inline G4double G4NuclideTable::GetMeanLifeThreshold()
157 {
158   return mean_life_threshold;
159 }
160 
161 inline void G4NuclideTable::SetLevelTolerance(G4double x)
162 {
163   flevelTolerance = x;
164 }
165 
166 inline G4double G4NuclideTable::GetLevelTolerance()
167 {
168   return flevelTolerance;
169 }
170 
171 inline std::size_t G4NuclideTable::GetSizeOfIsotopeList()
172 {
173   return (fIsotopeList != nullptr ? fIsotopeList->size() : static_cast<size_t>(0));
174 }
175 
176 inline std::size_t G4NuclideTable::entries() const
177 {
178   return (fIsotopeList != nullptr ? fIsotopeList->size() : std::size_t(0));
179 }
180 
181 inline G4IsotopeProperty* G4NuclideTable::GetIsotopeByIndex(std::size_t idx) const
182 {
183   if ((fIsotopeList != nullptr) && idx < fIsotopeList->size()) return (*fIsotopeList)[idx];
184   return nullptr;
185 }
186 
187 #endif
188