File indexing completed on 2025-12-16 10:16:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef G4IonTable_hh
0035 #define G4IonTable_hh 1
0036
0037 #include "G4Ions.hh"
0038 #include "G4ParticleDefinition.hh"
0039 #include "G4ParticleTable.hh"
0040 #include "G4ios.hh"
0041 #include "globals.hh"
0042
0043 #include <cmath>
0044 #include <map>
0045 #include <vector>
0046
0047 class G4ParticleTable;
0048 class G4VIsotopeTable;
0049 class G4IsotopeProperty;
0050 class G4NuclideTable;
0051
0052 class G4IonTable
0053 {
0054 public:
0055 using G4IonList = std::multimap<G4int, const G4ParticleDefinition*>;
0056 using G4IonListIterator = std::multimap<G4int, const G4ParticleDefinition*>::iterator;
0057
0058
0059 G4IonTable();
0060 ~G4IonTable();
0061
0062
0063 G4IonTable(const G4IonTable&) = delete;
0064 G4IonTable& operator=(const G4IonTable&) = delete;
0065
0066 static G4IonTable* GetIonTable();
0067
0068
0069
0070 void WorkerG4IonTable();
0071
0072
0073 void DestroyWorkerG4IonTable();
0074
0075
0076 G4int GetNumberOfElements() const;
0077
0078
0079 void RegisterIsotopeTable(G4VIsotopeTable* table);
0080
0081
0082
0083 G4VIsotopeTable* GetIsotopeTable(std::size_t idx = 0) const;
0084
0085
0086
0087 void CreateAllIon();
0088
0089
0090
0091 void CreateAllIsomer();
0092
0093
0094
0095 void PrepareNuclideTable();
0096 void PreloadNuclide();
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int lvl = 0);
0111 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4int lvl);
0112 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4int J = 0);
0113 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb,
0114 G4int J = 0);
0115 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4double E, char flbChar, G4int J = 0);
0116 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E, G4int J = 0);
0117 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E,
0118 G4Ions::G4FloatLevelBase flb, G4int J = 0);
0119 G4ParticleDefinition* GetIon(G4int Z, G4int A, G4int nL, G4double E, char flbChar, G4int J = 0);
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 G4ParticleDefinition* GetIon(G4int encoding);
0133
0134
0135
0136 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int lvl = 0);
0137 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4int lvl);
0138 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4int J = 0);
0139 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb,
0140 G4int J = 0);
0141 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4double E, char flbChar, G4int J = 0);
0142 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E, G4int J = 0);
0143 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E,
0144 G4Ions::G4FloatLevelBase flb, G4int J = 0);
0145 G4ParticleDefinition* FindIon(G4int Z, G4int A, G4int nL, G4double E, char flbChar,
0146 G4int J = 0);
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158 static G4bool IsIon(const G4ParticleDefinition*);
0159
0160
0161 static G4bool IsAntiIon(const G4ParticleDefinition*);
0162
0163
0164 G4String GetIonName(G4int Z, G4int A, G4int lvl = 0) const;
0165 G4String GetIonName(G4int Z, G4int A, G4double E,
0166 G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float) const;
0167 G4String GetIonName(G4int Z, G4int A, G4int nL, G4double E,
0168 G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float) const;
0169 G4String GetIonName(G4int Z, G4int A, G4int nL, G4int lvl) const;
0170
0171
0172
0173
0174
0175
0176
0177 static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E = 0.0, G4int lvl = 0);
0178
0179
0180
0181
0182
0183
0184
0185
0186 static G4int GetNucleusEncoding(G4int Z, G4int A, G4int nL, G4double E = 0.0, G4int lvl = 0);
0187
0188 static G4bool GetNucleusByEncoding(G4int encoding, G4int& Z, G4int& A, G4double& E, G4int& lvl);
0189 static G4bool GetNucleusByEncoding(G4int encoding, G4int& Z, G4int& A, G4int& L, G4double& E,
0190 G4int& lvl);
0191
0192
0193
0194
0195
0196
0197
0198 G4double GetIonMass(G4int Z, G4int A, G4int nL = 0, G4int lvl = 0) const;
0199 G4double GetNucleusMass(G4int Z, G4int A, G4int nL = 0, G4int lvl = 0) const;
0200 G4double GetIsomerMass(G4int Z, G4int A, G4int lvl = 0) const;
0201
0202
0203
0204 G4double GetLifeTime(const G4ParticleDefinition*) const;
0205 G4double GetLifeTime(G4int Z, G4int A, G4double E,
0206 G4Ions::G4FloatLevelBase flb = G4Ions::G4FloatLevelBase::no_Float) const;
0207 G4double GetLifeTime(G4int Z, G4int A, G4double E, char flbChar) const;
0208
0209 G4ParticleDefinition* GetMuonicAtom(G4Ions const*);
0210 G4ParticleDefinition* GetMuonicAtom(G4int Z, G4int A);
0211
0212
0213 G4int Entries() const;
0214
0215
0216 G4ParticleDefinition* GetParticle(G4int index) const;
0217
0218
0219 G4bool Contains(const G4ParticleDefinition* particle) const;
0220
0221
0222 void Insert(const G4ParticleDefinition* particle);
0223 void Remove(const G4ParticleDefinition* particle);
0224
0225
0226 void clear();
0227
0228
0229 G4int size() const;
0230
0231
0232 void DumpTable(const G4String& particle_name = "ALL") const;
0233
0234 public:
0235
0236 void InitializeLightIons();
0237
0238
0239
0240
0241
0242
0243
0244 static G4ThreadLocal G4IonList* fIonList;
0245 static G4ThreadLocal std::vector<G4VIsotopeTable*>* fIsotopeTableList;
0246 static G4IonList* fIonListShadow;
0247 static std::vector<G4VIsotopeTable*>* fIsotopeTableListShadow;
0248
0249 enum
0250 {
0251 numberOfElements = 118
0252 };
0253 static const G4String elementName[numberOfElements];
0254
0255 #ifdef G4MULTITHREADED
0256 static G4Mutex ionTableMutex;
0257 #endif
0258
0259 protected:
0260 G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int lvl = 0);
0261 G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int nL, G4int lvl);
0262 G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4double E,
0263 G4Ions::G4FloatLevelBase flb, G4int J = 0);
0264 G4ParticleDefinition* FindIonInMaster(G4int Z, G4int A, G4int nL, G4double E,
0265 G4Ions::G4FloatLevelBase flb, G4int J = 0);
0266
0267 G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4double E, G4Ions::G4FloatLevelBase flb);
0268 G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int nL, G4double E,
0269 G4Ions::G4FloatLevelBase flb);
0270 G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int lvl = 0);
0271 G4ParticleDefinition* CreateIon(G4int Z, G4int A, G4int nL, G4int lvl);
0272
0273 void InsertWorker(const G4ParticleDefinition* particle);
0274
0275
0276
0277 G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4double E,
0278 G4Ions::G4FloatLevelBase flb) const;
0279 G4IsotopeProperty* FindIsotope(G4int Z, G4int A, G4int lvl) const;
0280
0281
0282 G4ParticleDefinition* GetLightIon(G4int Z, G4int A) const;
0283 G4ParticleDefinition* GetLightAntiIon(G4int Z, G4int A) const;
0284
0285
0286 G4bool IsLightIon(const G4ParticleDefinition*) const;
0287 G4bool IsLightAntiIon(const G4ParticleDefinition*) const;
0288
0289
0290 void AddProcessManager(G4ParticleDefinition*);
0291
0292
0293 G4int GetVerboseLevel() const;
0294
0295 private:
0296 G4NuclideTable* pNuclideTable = nullptr;
0297
0298
0299 G4bool isIsomerCreated = false;
0300 };
0301
0302
0303
0304
0305
0306 inline G4int G4IonTable::GetNumberOfElements() const
0307 {
0308 return numberOfElements;
0309 }
0310
0311 #endif