Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4IonTable Class Reference

#include <G4IonTable.hh>

Public Types

typedef std::multimap< G4int, const G4ParticleDefinition * > G4IonList
 
typedef std::multimap< G4int, constG4ParticleDefinition * >::iterator G4IonListIterator
 

Public Member Functions

 G4IonTable ()
 
virtual ~G4IonTable ()
 
G4int GetNumberOfElements () const
 
void RegisterIsotopeTable (G4VIsotopeTable *table)
 
G4VIsotopeTableGetIsotopeTable (size_t idx=0) const
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int encoding)
 
void CreateAllIon ()
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4double E, G4int J=0)
 
G4ParticleDefinitionFindIon (G4int Z, G4int A, G4int L, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int L, G4double E, G4int J=0)
 
G4ParticleDefinitionGetIon (G4int Z, G4int A, G4int J, G4int Q)
 
const G4StringGetIonName (G4int Z, G4int A, G4double E) const
 
const G4StringGetIonName (G4int Z, G4int A, G4int L, G4double E) const
 
G4double GetIonMass (G4int Z, G4int A, G4int L=0) const
 !! Only ground states are supported now

 
G4double GetNucleusMass (G4int Z, G4int A, G4int L=0) const
 
G4int Entries () const
 
G4ParticleDefinitionGetParticle (G4int index) const
 
G4bool Contains (const G4ParticleDefinition *particle) const
 
void Insert (const G4ParticleDefinition *particle)
 
void Remove (const G4ParticleDefinition *particle)
 
void clear ()
 
G4int size () const
 
void DumpTable (const G4String &particle_name="ALL") const
 

Static Public Member Functions

static G4bool IsIon (const G4ParticleDefinition *)
 
static G4bool IsAntiIon (const G4ParticleDefinition *)
 
static G4int GetNucleusEncoding (G4int Z, G4int A, G4double E=0.0, G4int J=0)
 
static G4int GetNucleusEncoding (G4int Z, G4int A, G4int L, G4double E=0.0, G4int J=0)
 !! I = 1 is assigned fo all excitation states in Geant4

 
static G4bool GetNucleusByEncoding (G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &J)
 !! I = 1 is assigned fo all excitation states in Geant4

 
static G4bool GetNucleusByEncoding (G4int encoding, G4int &Z, G4int &A, G4int &L, G4double &E, G4int &J)
 

Protected Member Functions

 G4IonTable (const G4IonTable &right)
 
G4IonTableoperator= (const G4IonTable &)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4double E, G4int J)
 
G4ParticleDefinitionCreateIon (G4int Z, G4int A, G4int L, G4double E, G4int J)
 
G4IsotopePropertyFindIsotope (G4int Z, G4int A, G4double E, G4int J)
 
G4ParticleDefinitionGetLightIon (G4int Z, G4int A) const
 
G4ParticleDefinitionGetLightAntiIon (G4int Z, G4int A) const
 
G4bool IsLightIon (const G4ParticleDefinition *) const
 
G4bool IsLightAntiIon (const G4ParticleDefinition *) const
 
void AddProcessManager (const G4String &ionName)
 
G4int GetVerboseLevel () const
 

Detailed Description

Definition at line 63 of file G4IonTable.hh.

Member Typedef Documentation

◆ G4IonList

Definition at line 72 of file G4IonTable.hh.

◆ G4IonListIterator

typedef std::multimap<G4int,constG4ParticleDefinition*>::iterator G4IonTable::G4IonListIterator

Definition at line 73 of file G4IonTable.hh.

Constructor & Destructor Documentation

◆ G4IonTable() [1/2]

G4IonTable::G4IonTable ( )

Definition at line 68 of file G4IonTable.cc.

69{
70 fIonList = new G4IonList();
71 fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
72}
std::multimap< G4int, const G4ParticleDefinition * > G4IonList
Definition: G4IonTable.hh:72

◆ G4IonTable() [2/2]

G4IonTable::G4IonTable ( const G4IonTable right)
protected

◆ ~G4IonTable()

G4IonTable::~G4IonTable ( )
virtual

Definition at line 75 of file G4IonTable.cc.

76{
77 // delete IsotopeTable if exists
78 if (fIsotopeTableList != 0) {
79 for (size_t i = 0; i< fIsotopeTableList->size(); ++i) {
80 G4VIsotopeTable* fIsotopeTable= (*fIsotopeTableList)[i];
81 delete fIsotopeTable;
82 }
83 fIsotopeTableList->clear();
84 delete fIsotopeTableList;
85 }
86 fIsotopeTableList =0;
87
88
89 if (fIonList ==0) return;
90 // remove all contents in the Ion List
91 // No need to delete here because all particles are dynamic objects
92 fIonList->clear();
93
94 delete fIonList;
95 fIonList =0;
96}

Member Function Documentation

◆ AddProcessManager()

void G4IonTable::AddProcessManager ( const G4String ionName)
protected

Definition at line 907 of file G4IonTable.cc.

908{
909 // create command string for addProcManager
910 std::ostringstream osAdd;
911 osAdd << "/run/particle/addProcManager "<< name;
912 G4String cmdAdd = osAdd.str();
913
914 // set /control/verbose 0
915 G4int tempVerboseLevel = G4UImanager::GetUIpointer()->GetVerboseLevel();
917
918 // issue /run/particle/addProcManage
920
921 // retreive /control/verbose
922 G4UImanager::GetUIpointer()->SetVerboseLevel(tempVerboseLevel);
923}
int G4int
Definition: G4Types.hh:66
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:369
G4int GetVerboseLevel() const
Definition: G4UImanager.hh:218
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:51
void SetVerboseLevel(G4int val)
Definition: G4UImanager.hh:216

Referenced by CreateIon().

◆ clear()

void G4IonTable::clear ( )

Definition at line 784 of file G4IonTable.cc.

785{
786 if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
787 G4Exception("G4IonTable::clear()",
788 "PART116", JustWarning,
789 "No effects because readyToUse is true.");
790 return;
791 }
792
793#ifdef G4VERBOSE
794 if (GetVerboseLevel()>2) {
795 G4cout << "G4IonTable::Clear() : number of Ion regsitered = ";
796 G4cout << fIonList->size() << G4endl;
797 }
798#endif
799 fIonList->clear();
800}
@ JustWarning
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4int GetVerboseLevel() const
Definition: G4IonTable.cc:901
static G4ParticleTable * GetParticleTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by G4ParticleTable::RemoveAllParticles().

◆ Contains()

G4bool G4IonTable::Contains ( const G4ParticleDefinition particle) const
inline

Definition at line 251 of file G4IonTable.hh.

252{
253 if (!IsIon(particle)) return false;
254
255 G4int Z = particle->GetAtomicNumber();
256 G4int A = particle->GetAtomicMass();
257 G4int L = particle->GetQuarkContent(3); //strangeness
259 G4bool found = false;
260 if (encoding !=0 ) {
261 G4IonList::iterator i = fIonList->find(encoding);
262 for( ;i != fIonList->end() ; i++) {
263 if (particle == i->second ) {
264 found = true;
265 break;
266 }
267 }
268 }
269 return found;
270}
bool G4bool
Definition: G4Types.hh:67
static G4int GetNucleusEncoding(G4int Z, G4int A, G4double E=0.0, G4int J=0)
Definition: G4IonTable.cc:446
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:594
G4int GetAtomicNumber() const
G4int GetAtomicMass() const
G4int GetQuarkContent(G4int flavor) const

Referenced by Insert().

◆ CreateAllIon()

void G4IonTable::CreateAllIon ( )

Definition at line 996 of file G4IonTable.cc.

997{
998 G4int Z;
999 G4int A;
1000 G4double E=0.0;
1001 G4int J=0;
1002
1003 for (Z=1; Z<=120; Z++) {
1004 for (A=Z;A<999 && A<Z*3+10; A++) {
1006 GetIon(Z,A,E,J);
1007 }
1008 }
1009 }
1010}
double G4double
Definition: G4Types.hh:64
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int J=0)
Definition: G4IonTable.cc:267
static bool IsInStableTable(const G4double A, const G4double Z)

Referenced by G4ParticleMessenger::SetNewValue().

◆ CreateIon() [1/2]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4double  E,
G4int  J 
)
protected

Definition at line 102 of file G4IonTable.cc.

104{
106
107 // check whether the cuurent state is not "PreInit"
108 // to make sure that GenericIon has processes
110 if (currentState == G4State_PreInit){
111#ifdef G4VERBOSE
112 if (GetVerboseLevel()>1) {
113 G4cerr << "G4IonTable::CreateIon() : can not create ion of "
114 << " Z =" << Z << " A = " << A
115 << " because the current state is PreInit !!" << G4endl;
116 }
117#endif
118 G4Exception( "G4IonTable::CreateIon()","PART105",
119 JustWarning, "Can not create ions in PreInit state");
120 return 0;
121 }
122
123 // get ion name
124 G4String name = GetIonName(Z, A, E);
125 if ( name(0) == '?') {
126#ifdef G4VERBOSE
127 if (GetVerboseLevel()>0) {
128 G4cerr << "G4IonTable::CreateIon() : can not create ions "
129 << " Z =" << Z << " A = " << A << G4endl;
130 }
131#endif
132 return 0;
133 }
134
135 G4double life = -1.0;
136 G4DecayTable* decayTable =0;
137 G4bool stable = true;
138 G4double mu = 0.0;
139
140 const G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, J);
141 if (fProperty !=0 ){
142 E = fProperty->GetEnergy();
143 J = fProperty->GetiSpin();
144 life = fProperty->GetLifeTime();
145 mu = fProperty->GetMagneticMoment();
146 decayTable = fProperty->GetDecayTable();
147 }
148 stable = life <= 0.;
149 G4double mass = GetNucleusMass(Z, A)+ E;
150 G4double charge = G4double(Z)*eplus;
151
153
154 // create an ion
155 // spin, parity, isospin values are fixed
156 //
157 ion = new G4Ions( name, mass, 0.0*MeV, charge,
158 J, +1, 0,
159 0, 0, 0,
160 "nucleus", 0, A, encoding,
161 stable, life, decayTable, false,
162 "generic", 0,
163 E );
164 ion->SetPDGMagneticMoment(mu);
165
166 //No Anti particle registered
167 ion->SetAntiPDGEncoding(0);
168
169#ifdef G4VERBOSE
170 if (GetVerboseLevel()>1) {
171 G4cout << "G4IonTable::CreateIon() : create ion of " << name
172 << " " << Z << ", " << A
173 << " encoding=" << encoding << G4endl;
174 }
175#endif
176
177 // Add process manager to the ion
178 AddProcessManager(name);
179
180 return ion;
181}
G4ApplicationState
@ G4State_PreInit
G4DLLIMPORT std::ostream G4cerr
G4double GetNucleusMass(G4int Z, G4int A, G4int L=0) const
Definition: G4IonTable.cc:741
const G4String & GetIonName(G4int Z, G4int A, G4double E) const
Definition: G4IonTable.cc:558
void AddProcessManager(const G4String &ionName)
Definition: G4IonTable.cc:907
G4IsotopeProperty * FindIsotope(G4int Z, G4int A, G4double E, G4int J)
Definition: G4IonTable.cc:945
Definition: G4Ions.hh:52
G4int GetiSpin() const
G4DecayTable * GetDecayTable() const
G4double GetEnergy() const
G4double GetLifeTime() const
G4double GetMagneticMoment() const
void SetPDGMagneticMoment(G4double mageticMoment)
void SetAntiPDGEncoding(G4int aEncoding)
G4ApplicationState GetCurrentState() const
static G4StateManager * GetStateManager()

Referenced by CreateIon(), and GetIon().

◆ CreateIon() [2/2]

G4ParticleDefinition * G4IonTable::CreateIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4int  J 
)
protected

Definition at line 185 of file G4IonTable.cc.

187{
188 if (L==0) return CreateIon(A,Z,E,J);
189
190 // create hyper nucleus
192
193 // check whether the cuurent state is not "PreInit"
194 // to make sure that GenericIon has processes
196 if (currentState == G4State_PreInit){
197#ifdef G4VERBOSE
198 if (GetVerboseLevel()>1) {
199 G4cerr << "G4IonTable::CreateIon() : can not create ion of "
200 << " Z =" << Z << " A = " << A << " L = " <<L
201 << " because the current state is PreInit !!" << G4endl;
202 }
203#endif
204 G4Exception( "G4IonTable::CreateIon()","PART105",
205 JustWarning, "Can not create ions in PreInit state");
206 return 0;
207 }
208
209 // get ion name
210 G4String name = GetIonName(Z, A, L, E);
211 if ( name(L) == '?') {
212#ifdef G4VERBOSE
213 if (GetVerboseLevel()>0) {
214 G4cerr << "G4IonTable::CreateIon() : can not create ions "
215 << " Z =" << Z << " A = " << A << " L = " << L << G4endl;
216 }
217#endif
218 return 0;
219 }
220
221 G4double life = -1.0;
222 G4DecayTable* decayTable =0;
223 G4bool stable = true;
224 G4double mu = 0.0;
225 G4double mass = GetNucleusMass(Z, A, L)+ E;
226 G4double charge = G4double(Z)*eplus;
227
228 G4int encoding = GetNucleusEncoding(Z,A,L,E,J);
229
230 // create an ion
231 // spin, parity, isospin values are fixed
232 //
233 ion = new G4Ions( name, mass, 0.0*MeV, charge,
234 J, +1, 0,
235 0, 0, 0,
236 "nucleus", 0, A, encoding,
237 stable, life, decayTable, false,
238 "generic", 0,
239 E );
240 ion->SetPDGMagneticMoment(mu);
241
242 //No Anti particle registered
243 ion->SetAntiPDGEncoding(0);
244
245#ifdef G4VERBOSE
246 if (GetVerboseLevel()>1) {
247 G4cout << "G4IonTable::CreateIon() : create hyper ion of " << name
248 << " encoding=" << encoding << G4endl;
249 }
250#endif
251
252 // Add process manager to the ion
253 AddProcessManager(name);
254
255 return ion;
256}
G4ParticleDefinition * CreateIon(G4int Z, G4int A, G4double E, G4int J)
Definition: G4IonTable.cc:102

◆ DumpTable()

void G4IonTable::DumpTable ( const G4String particle_name = "ALL") const

Definition at line 869 of file G4IonTable.cc.

870{
871 const G4ParticleDefinition* ion;
872 G4IonList::iterator idx;
873 for (idx = fIonList->begin(); idx!= fIonList->end(); ++idx) {
874 ion = idx->second;
875 if (( particle_name == "ALL" ) || (particle_name == "all")){
876 ion->DumpTable();
877 } else if ( particle_name == ion->GetParticleName() ) {
878 ion->DumpTable();
879 }
880 }
881}
const G4String & GetParticleName() const

◆ Entries()

G4int G4IonTable::Entries ( ) const
inline

Definition at line 272 of file G4IonTable.hh.

273{
274 return fIonList->size();
275}

Referenced by GetParticle().

◆ FindIon() [1/2]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4double  E,
G4int  J = 0 
)

Definition at line 353 of file G4IonTable.cc.

354{
355 const G4double EnergyTorelance = 0.1 * keV;
356
357 if ( (A<1) || (Z<=0) || (J<0) || (E<0.0) || (A>999) ) {
358#ifdef G4VERBOSE
359 if (GetVerboseLevel()>0) {
360 G4cerr << "G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
361 << " Z =" << Z << " A = " << A << " E = " << E/keV << G4endl;
362 }
363#endif
364 G4Exception( "G4IonTable::FindIon()","PART107",
365 JustWarning, "illegal atomic number/mass");
366 return 0;
367 }
368 // Search ions with A, Z ,E
369 // !! J is omitted now !!
370 const G4ParticleDefinition* ion=0;
371 G4bool isFound = false;
372
373 // -- loop over all particles in Ion table
375 G4IonList::iterator i = fIonList->find(encoding);
376 for( ;i != fIonList->end() ; i++) {
377 ion = i->second;
378 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
379
380 // excitation level
381 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
382 if ( ( std::fabs(E - anExcitaionEnergy ) < EnergyTorelance ) ) {
383 isFound = true;
384 break;
385 }
386 }
387
388 if ( isFound ){
389 return const_cast<G4ParticleDefinition*>(ion);
390 } else {
391 return 0;
392 }
393}

Referenced by G4ParticleTable::FindIon(), FindIon(), and GetIon().

◆ FindIon() [2/2]

G4ParticleDefinition * G4IonTable::FindIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4int  J = 0 
)

Definition at line 397 of file G4IonTable.cc.

398{
399 if (L==0) return FindIon(Z,A,E,J);
400
401 const G4double EnergyTorelance = 0.1 * keV;
402
403 if (A < 2 || Z < 0 || Z > A-L || L>A || A>999 ) {
404#ifdef G4VERBOSE
405 if (GetVerboseLevel()>0) {
406 G4cerr << "G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
407 << " Z =" << Z << " A = " << A << " L = " << L
408 <<" E = " << E/keV << G4endl;
409 }
410#endif
411 G4Exception( "G4IonTable::FindIon()","PART107",
412 JustWarning, "illegal atomic number/mass");
413 return 0;
414 }
415 // Search ions with A, Z ,E
416 // !! J is omitted now !!
417 const G4ParticleDefinition* ion=0;
418 G4bool isFound = false;
419
420 // -- loop over all particles in Ion table
422 G4IonList::iterator i = fIonList->find(encoding);
423 for( ;i != fIonList->end() ; i++) {
424 ion = i->second;
425 if ( ( ion->GetAtomicNumber() != Z) || (ion->GetAtomicMass()!=A) ) break;
426 if( ion->GetQuarkContent(3) != L) break;
427
428 // excitation level
429 G4double anExcitaionEnergy = ((const G4Ions*)(ion))->GetExcitationEnergy();
430
431 if ( ( std::fabs(E - anExcitaionEnergy ) < EnergyTorelance ) ) {
432 isFound = true;
433 break;
434 }
435 }
436
437 if ( isFound ){
438 return const_cast<G4ParticleDefinition*>(ion);
439 } else {
440 return 0;
441 }
442}
G4ParticleDefinition * FindIon(G4int Z, G4int A, G4double E, G4int J=0)
Definition: G4IonTable.cc:353

◆ FindIsotope()

G4IsotopeProperty * G4IonTable::FindIsotope ( G4int  Z,
G4int  A,
G4double  E,
G4int  J 
)
protected

Definition at line 945 of file G4IonTable.cc.

946{
947 if (fIsotopeTableList ==0) return 0;
948 if (fIsotopeTableList->size()==0) return 0;
949
950 // ask IsotopeTable
951 G4IsotopeProperty* property =0;
952
953 // iterate
954 for (size_t i = 0; i< fIsotopeTableList->size(); ++i) {
955 G4VIsotopeTable* fIsotopeTable= (*fIsotopeTableList)[i];
956 G4IsotopeProperty* tmp = fIsotopeTable->GetIsotope(Z,A,E);
957 if ( tmp !=0) {
958
959#ifdef G4VERBOSE
960 if (GetVerboseLevel()>1) {
961 G4cout << "G4IonTable::FindIsotope:";
962 G4cout << " Z: " << Z;
963 G4cout << " A: " << A;
964 G4cout << " E: " << E;
965 G4cout << G4endl;
966 tmp->DumpInfo();
967 }
968#endif
969 if (property !=0) {
970 // overwrite spin/magnetic moment/decay table if not defined
971 if( property->GetiSpin() ==0) {
972 property->SetiSpin( tmp->GetiSpin() );
973 }
974 if( property->GetMagneticMoment() <= 0.0) {
975 property->SetMagneticMoment( tmp->GetMagneticMoment() );
976 }
977 if( property->GetLifeTime() <= 0.0) {
978 property->SetLifeTime( tmp->GetLifeTime() );
979 if ( (property->GetLifeTime() > 0.0)
980 && (property->GetDecayTable() ==0 ) ) {
981 property->SetDecayTable( tmp->GetDecayTable() );
982 tmp->SetDecayTable( 0 );
983 }
984 }
985 } else {
986 property = tmp;
987 }
988 }
989 }
990
991 return property;
992}
void SetDecayTable(G4DecayTable *table)
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E)=0

Referenced by CreateIon().

◆ GetIon() [1/5]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  encoding)

Definition at line 273 of file G4IonTable.cc.

274{
275 G4int Z, A, L, J;
276 G4double E;
277 if (!GetNucleusByEncoding(encoding,Z,A,L,E,J) ){
278#ifdef G4VERBOSE
279 if (GetVerboseLevel()>0) {
280 G4cerr << "G4IonTable::GetIon() : illegal encoding"
281 << " CODE:" << encoding << G4endl;
282 }
283#endif
284 G4Exception( "G4IonTable::GetIon()","PART106",
285 JustWarning, "illegal encoding for an ion");
286 return 0;
287 }
288 // Only ground state is supported
289 return GetIon( Z, A, L, 0.0, J);
290}
static G4bool GetNucleusByEncoding(G4int encoding, G4int &Z, G4int &A, G4double &E, G4int &J)
!! I = 1 is assigned fo all excitation states in Geant4
Definition: G4IonTable.cc:494

◆ GetIon() [2/5]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4double  E,
G4int  J = 0 
)

Definition at line 293 of file G4IonTable.cc.

294{
295 if ( (A<1) || (Z<=0) || (J<0) || (E<0.0) || (A>999) ) {
296#ifdef G4VERBOSE
297 if (GetVerboseLevel()>0) {
298 G4cerr << "G4IonTable::GetIon() : illegal atomic number/mass"
299 << " Z =" << Z << " A = " << A << " E = " << E/keV << G4endl;
300 }
301#endif
302 return 0;
303 }
304
305 // Search ions with A, Z
306 G4ParticleDefinition* ion = FindIon(Z,A,E,J);
307
308 // create ion
309 if (ion == 0) {
310 ion = CreateIon(Z, A, E, J);
311 }
312
313 return ion;
314}

◆ GetIon() [3/5]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  J,
G4int  Q 
)

Definition at line 261 of file G4IonTable.cc.

262{
263 return GetIon(Z, A);
264}

◆ GetIon() [4/5]

◆ GetIon() [5/5]

G4ParticleDefinition * G4IonTable::GetIon ( G4int  Z,
G4int  A,
G4int  L,
G4double  E,
G4int  J = 0 
)

Definition at line 317 of file G4IonTable.cc.

318{
319 if (L==0) return GetIon(Z,A,E,J);
320
321 if (A < 2 || Z < 0 || Z > A-L || L>A || A>999 ) {
322#ifdef G4VERBOSE
323 if (GetVerboseLevel()>0) {
324 G4cerr << "G4IonTable::GetIon() : illegal atomic number/mass"
325 << " Z =" << Z << " A = " << A << " L = " << L
326 <<" E = " << E/keV << G4endl;
327 }
328#endif
329 return 0;
330 } else if( A==2 ) {
331#ifdef G4VERBOSE
332 if (GetVerboseLevel()>0) {
333 G4cerr << "G4IonTable::GetIon() : No boud state for "
334 << " Z =" << Z << " A = " << A << " L = " << L
335 << " E = " << E/keV << G4endl;
336 }
337#endif
338 return 0;
339 }
340
341 // Search ions with A, Z
342 G4ParticleDefinition* ion = FindIon(Z,A,L,E,J);
343
344 // create ion
345 if (ion == 0) {
346 ion = CreateIon(Z, A, L, E, J);
347 }
348
349 return ion;
350}

◆ GetIonMass()

◆ GetIonName() [1/2]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4double  E 
) const

Definition at line 558 of file G4IonTable.cc.

559{
560 static G4String name;
561 name ="";
562 if ( (0< Z) && (Z <=numberOfElements) ) {
563 name = elementName[Z-1];
564 } else if (Z > numberOfElements) {
565 std::ostringstream os1;
566 os1.setf(std::ios::fixed);
567 os1 << Z ;
568 name = "E" + os1.str() + "-";
569 } else {
570 name = "?";
571 return name;
572 }
573 std::ostringstream os;
574 os.setf(std::ios::fixed);
575 os << A << '[' << std::setprecision(1) << E/keV << ']';
576 name += os.str();
577 return name;
578}

Referenced by CreateIon(), GetIonName(), and G4LENDManager::GetLENDTarget().

◆ GetIonName() [2/2]

const G4String & G4IonTable::GetIonName ( G4int  Z,
G4int  A,
G4int  L,
G4double  E 
) const

Definition at line 581 of file G4IonTable.cc.

582{
583 if (L==0) return GetIonName(Z, A, E);
584 static G4String name;
585 name ="";
586 for (int i =0; i<L; i++){
587 name +="L";
588 }
589 name += GetIonName(Z, A, E);
590 return name;
591}

◆ GetIsotopeTable()

G4VIsotopeTable * G4IonTable::GetIsotopeTable ( size_t  idx = 0) const

Definition at line 934 of file G4IonTable.cc.

935{
936 G4VIsotopeTable* fIsotopeTable=0;
937 if ( index < fIsotopeTableList->size() ) {
938 fIsotopeTable = (*fIsotopeTableList)[index];
939 }
940 return fIsotopeTable;
941}
G4int size() const
Definition: G4IonTable.hh:277

◆ GetLightAntiIon()

G4ParticleDefinition * G4IonTable::GetLightAntiIon ( G4int  Z,
G4int  A 
) const
protected

Definition at line 701 of file G4IonTable.cc.

702{
703 // returns pointer to pre-defined ions
704 static G4bool isInitialized = false;
705 static const G4ParticleDefinition* p_proton=0;
706 static const G4ParticleDefinition* p_deuteron=0;
707 static const G4ParticleDefinition* p_triton=0;
708 static const G4ParticleDefinition* p_alpha=0;
709 static const G4ParticleDefinition* p_He3=0;
710
711 if (!isInitialized) {
712 p_proton = G4ParticleTable::GetParticleTable()->FindParticle("anti_proton"); // proton
713 p_deuteron = G4ParticleTable::GetParticleTable()->FindParticle("anti_deuteron"); // deuteron
714 p_triton = G4ParticleTable::GetParticleTable()->FindParticle("anti_triton"); // tritoon
715 p_alpha = G4ParticleTable::GetParticleTable()->FindParticle("anti_alpha"); // alpha
716 p_He3 = G4ParticleTable::GetParticleTable()->FindParticle("anti_He3"); // He3
717 isInitialized = true;
718 }
719
720 const G4ParticleDefinition* ion=0;
721 if ( (Z<=2) ) {
722 if ( (Z==1)&&(A==1) ) {
723 ion = p_proton;
724 } else if ( (Z==1)&&(A==2) ) {
725 ion = p_deuteron;
726 } else if ( (Z==1)&&(A==3) ) {
727 ion = p_triton;
728 } else if ( (Z==2)&&(A==4) ) {
729 ion = p_alpha;
730 } else if ( (Z==2)&&(A==3) ) {
731 ion = p_He3;
732 }
733 }
734 return const_cast<G4ParticleDefinition*>(ion);
735}
G4ParticleDefinition * FindParticle(G4int PDGEncoding)

◆ GetLightIon()

G4ParticleDefinition * G4IonTable::GetLightIon ( G4int  Z,
G4int  A 
) const
protected

Definition at line 664 of file G4IonTable.cc.

665{
666 // returns pointer to pre-defined ions
667 static G4bool isInitialized = false;
668 static const G4ParticleDefinition* p_proton=0;
669 static const G4ParticleDefinition* p_deuteron=0;
670 static const G4ParticleDefinition* p_triton=0;
671 static const G4ParticleDefinition* p_alpha=0;
672 static const G4ParticleDefinition* p_He3=0;
673
674 if (!isInitialized) {
675 p_proton = G4ParticleTable::GetParticleTable()->FindParticle("proton"); // proton
676 p_deuteron = G4ParticleTable::GetParticleTable()->FindParticle("deuteron"); // deuteron
677 p_triton = G4ParticleTable::GetParticleTable()->FindParticle("triton"); // tritoon
678 p_alpha = G4ParticleTable::GetParticleTable()->FindParticle("alpha"); // alpha
679 p_He3 = G4ParticleTable::GetParticleTable()->FindParticle("He3"); // He3
680 isInitialized = true;
681 }
682
683 const G4ParticleDefinition* ion=0;
684 if ( (Z<=2) ) {
685 if ( (Z==1)&&(A==1) ) {
686 ion = p_proton;
687 } else if ( (Z==1)&&(A==2) ) {
688 ion = p_deuteron;
689 } else if ( (Z==1)&&(A==3) ) {
690 ion = p_triton;
691 } else if ( (Z==2)&&(A==4) ) {
692 ion = p_alpha;
693 } else if ( (Z==2)&&(A==3) ) {
694 ion = p_He3;
695 }
696 }
697 return const_cast<G4ParticleDefinition*>(ion);
698}

Referenced by GetNucleusMass().

◆ GetNucleusByEncoding() [1/2]

G4bool G4IonTable::GetNucleusByEncoding ( G4int  encoding,
G4int Z,
G4int A,
G4double E,
G4int J 
)
static

!! I = 1 is assigned fo all excitation states in Geant4

!!not supported for excitation states !!!

Definition at line 494 of file G4IonTable.cc.

497{
498 if (encoding <= 0) {
499 // anti particle
500 return false;
501 }
502 if (encoding == 2212) {
503 // proton
504 Z = 1;
505 A = 1;
506 E=0.0;
507 J=0;
508 return true;
509 }
510
511 if (encoding % 10 != 0) {
512 //!!!not supported for excitation states !!!
513 return false;
514 }
515
516 encoding -= 1000000000;
517 Z = encoding/10000;
518 encoding -= 10000*Z;
519 A = encoding/10;
520
521 E=0.0;
522 J=0;
523
524 return true;
525}

Referenced by GetIon().

◆ GetNucleusByEncoding() [2/2]

G4bool G4IonTable::GetNucleusByEncoding ( G4int  encoding,
G4int Z,
G4int A,
G4int L,
G4double E,
G4int J 
)
static

!!not supported for excitation states !!!

Definition at line 527 of file G4IonTable.cc.

531{
532 if (encoding <= 0) {
533 // anti particle
534 return false;
535 }
536 if (encoding % 10 != 0) {
537 //!!!not supported for excitation states !!!
538 return false;
539 }
540 if (encoding < 1000000000) {
541 // anti particle
542 return false;
543 }
544
545 encoding -= 1000000000;
546 L = encoding/10000000;
547 encoding -= 10000000*L;
548 Z = encoding/10000;
549 encoding -= 10000*Z;
550 A = encoding/10;
551
552 E=0.0;
553 J=0;
554
555 return true;
556}

◆ GetNucleusEncoding() [1/2]

G4int G4IonTable::GetNucleusEncoding ( G4int  Z,
G4int  A,
G4double  E = 0.0,
G4int  J = 0 
)
static

!! I = 1 is assigned fo all excitation states !!!

Definition at line 446 of file G4IonTable.cc.

447{
448 // PDG code for Ions
449 // Nuclear codes are given as 10-digit numbers +-100ZZZAAAI.
450 //For a nucleus consisting of np protons and nn neutrons
451 // A = np + nn and Z = np.
452 // I gives the isomer level, with I = 0 corresponding
453 // to the ground state and I >0 to excitations
454
455 //!!! I = 1 is assigned fo all excitation states !!!
456 const G4double EnergyTorelance = 0.1 * keV;
457 if ( Z==1 && A==1 && E< EnergyTorelance ) {
458 //proton
459 return 2212;
460 }
461
462 G4int encoding = 1000000000;
463 encoding += Z * 10000;
464 encoding += A *10;
465 if (E>0.0) encoding += 1;
466
467 return encoding;
468}
#define encoding
Definition: xmlparse.cc:588

Referenced by Contains(), CreateIon(), FindIon(), G4LENDManager::GetLENDTarget(), G4LENDManager::GetNucleusEncoding(), Insert(), G4InuclNuclei::makeNuclearFragment(), and Remove().

◆ GetNucleusEncoding() [2/2]

G4int G4IonTable::GetNucleusEncoding ( G4int  Z,
G4int  A,
G4int  L,
G4double  E = 0.0,
G4int  J = 0 
)
static

!! I = 1 is assigned fo all excitation states in Geant4

!! I = 1 is assigned fo all excitation states in Geant4

Definition at line 471 of file G4IonTable.cc.

473{
474 // get PDG code for Hyper-Nucleus Ions
475 // Nuclear codes are given as 10-digit numbers +-10LZZZAAAI.
476 //For a nucleus consisting of np protons and nn neutrons
477 // A = np + nn +nlambda and Z = np.
478 // L = nlambda
479 // I gives the isomer level, with I = 0 corresponding
480 // to the ground state and I >0 to excitations
481 //
482 //!!! I = 1 is assigned fo all excitation states in Geant4
483
484 G4int encoding = 1000000000;
485 encoding += L* 10000000;
486 encoding += Z * 10000;
487 encoding += A *10;
488 if (E>0.0) encoding += 1;
489
490 return encoding;
491}

◆ GetNucleusMass()

G4double G4IonTable::GetNucleusMass ( G4int  Z,
G4int  A,
G4int  L = 0 
) const

Definition at line 741 of file G4IonTable.cc.

742{
743 if ( (A<1) || (Z<0) || (L<0) ){
744#ifdef G4VERBOSE
745 if (GetVerboseLevel()>0) {
746 G4cerr << "G4IonTable::GetNucleusMass() : illegal atomic number/mass "
747 << " Z =" << Z << " A = " << A << G4endl;
748 }
749#endif
750 G4Exception( "G4IonTable::GetNucleusMass()","PART107",
751 EventMustBeAborted, "illegal atomic number/mass");
752 return -1.0;
753 }
754
755 G4double mass;
756 if (L == 0) {
757 // calculate nucleus mass
758 const G4ParticleDefinition* ion=GetLightIon(Z, A);
759
760 if (ion!=0) {
761 mass = ion->GetPDGMass();
762 } else {
763 // use G4NucleiProperties::GetNuclearMass
765 }
766
767 } else {
769 }
770 return mass;
771}
@ EventMustBeAborted
static G4double GetNuclearMass(G4int A, G4int Z, G4int L)
G4ParticleDefinition * GetLightIon(G4int Z, G4int A) const
Definition: G4IonTable.cc:664
static G4double GetNuclearMass(const G4double A, const G4double Z)

Referenced by CreateIon(), GetIonMass(), and G4INCL::ParticleTable::getRealMass().

◆ GetNumberOfElements()

G4int G4IonTable::GetNumberOfElements ( ) const
inline

Definition at line 246 of file G4IonTable.hh.

247{
248 return numberOfElements;
249}

◆ GetParticle()

G4ParticleDefinition * G4IonTable::GetParticle ( G4int  index) const

Definition at line 1013 of file G4IonTable.cc.

1014{
1015 if ( (index >=0) && (index < Entries()) ) {
1016 G4IonList::iterator idx = fIonList->begin();
1017 G4int counter = 0;
1018 while( idx != fIonList->end() ){
1019 if ( counter == index ) {
1020 return const_cast<G4ParticleDefinition*>(idx->second);
1021 }
1022 counter++;
1023 idx++;
1024 }
1025 }
1026#ifdef G4VERBOSE
1027 if (GetVerboseLevel()>1){
1028 G4cerr << " G4IonTable::GetParticle"
1029 << " invalid index (=" << index << ")"
1030 << " entries = " << Entries() << G4endl;
1031 }
1032#endif
1033 return 0;
1034}
G4int Entries() const
Definition: G4IonTable.hh:272

◆ GetVerboseLevel()

G4int G4IonTable::GetVerboseLevel ( ) const
protected

Definition at line 901 of file G4IonTable.cc.

902{
904}
G4int GetVerboseLevel() const

Referenced by clear(), CreateIon(), FindIon(), FindIsotope(), GetIon(), GetNucleusMass(), GetParticle(), and Remove().

◆ Insert()

void G4IonTable::Insert ( const G4ParticleDefinition particle)

Definition at line 802 of file G4IonTable.cc.

803{
804 if (!IsIon(particle)) return;
805 if (Contains(particle)) return;
806
807 G4int Z = particle->GetAtomicNumber();
808 G4int A = particle->GetAtomicMass();
809 G4int L = particle->GetQuarkContent(3); //strangeness
811
812 fIonList->insert( std::pair<const G4int, const G4ParticleDefinition*>(encoding, particle) );
813
814}
G4bool Contains(const G4ParticleDefinition *particle) const
Definition: G4IonTable.hh:251

Referenced by G4ParticleTable::Insert().

◆ IsAntiIon()

G4bool G4IonTable::IsAntiIon ( const G4ParticleDefinition particle)
static

Definition at line 619 of file G4IonTable.cc.

620{
621 // return true if the particle is ion
622
623 static G4String anti_nucleus("anti_nucleus");
624 static G4String anti_proton("anti_proton");
625
626 // anti_neutron is not ion
627 if ((particle->GetAtomicMass()>0) &&
628 (particle->GetAtomicNumber()>0) ){
629 if (particle->GetBaryonNumber()<0) return true;
630 else return false;
631 }
632
633 // particles derived from G4Ions
634 if (particle->GetParticleType() == anti_nucleus) return true;
635
636 // anti_proton (Anti_Hydrogen nucleus)
637 if (particle->GetParticleName() == anti_proton) return true;
638
639 return false;
640}
const G4String & GetParticleType() const

Referenced by G4ParticleDefinition::DumpTable(), and G4ParticleDefinition::G4ParticleDefinition().

◆ IsIon()

G4bool G4IonTable::IsIon ( const G4ParticleDefinition particle)
static

Definition at line 594 of file G4IonTable.cc.

595{
596 // return true if the particle is ion
597
598 static G4String nucleus("nucleus");
599 static G4String proton("proton");
600
601 // neutron is not ion
602 if ((particle->GetAtomicMass()>0) &&
603 (particle->GetAtomicNumber()>0) ){
604 if (particle->GetBaryonNumber()>0) return true;
605 else return false;
606 }
607
608
609 // particles derived from G4Ions
610 if (particle->GetParticleType() == nucleus) return true;
611
612 // proton (Hydrogen nucleus)
613 if (particle->GetParticleName() == proton) return true;
614
615 return false;
616}

Referenced by G4DynamicParticle::AllocateElectronOccupancy(), Contains(), G4ParticleDefinition::DumpTable(), G4ParticleDefinition::G4ParticleDefinition(), Insert(), G4ParticleTable::Insert(), Remove(), and G4ParticleTable::Remove().

◆ IsLightAntiIon()

G4bool G4IonTable::IsLightAntiIon ( const G4ParticleDefinition particle) const
protected

Definition at line 654 of file G4IonTable.cc.

655{
656 static const std::string names[] = { "anti_proton", "anti_alpha", "anti_deuteron",
657 "anti_triton", "anti_He3"};
658
659 // return true if the particle is pre-defined ion
660 return std::find(names, names+5, particle->GetParticleName())!=names+5;
661}

◆ IsLightIon()

G4bool G4IonTable::IsLightIon ( const G4ParticleDefinition particle) const
protected

Definition at line 645 of file G4IonTable.cc.

646{
647 static const std::string names[] = { "proton", "alpha", "deuteron",
648 "triton", "He3"};
649
650 // return true if the particle is pre-defined ion
651 return std::find(names, names+5, particle->GetParticleName())!=names+5;
652}

◆ operator=()

G4IonTable & G4IonTable::operator= ( const G4IonTable )
inlineprotected

Definition at line 82 of file G4IonTable.hh.

82{return *this;}

◆ RegisterIsotopeTable()

void G4IonTable::RegisterIsotopeTable ( G4VIsotopeTable table)

Definition at line 928 of file G4IonTable.cc.

929{
930 fIsotopeTableList->push_back(table);
931}

Referenced by G4RadioactiveDecay::G4RadioactiveDecay().

◆ Remove()

void G4IonTable::Remove ( const G4ParticleDefinition particle)

Definition at line 817 of file G4IonTable.cc.

818{
819 if (G4ParticleTable::GetParticleTable()->GetReadiness()) {
821 G4ApplicationState currentState = pStateManager->GetCurrentState();
822 if (currentState != G4State_PreInit) {
823 G4String msg = "Request of removing ";
824 msg += particle->GetParticleName();
825 msg += " has No effects other than Pre_Init";
826 G4Exception("G4IonTable::Remove()",
827 "PART117", JustWarning, msg);
828 return;
829 } else {
830#ifdef G4VERBOSE
831 if (GetVerboseLevel()>0){
832 G4cout << particle->GetParticleName()
833 << " will be removed from the IonTable " << G4endl;
834 }
835#endif
836 }
837 }
838
839 if (IsIon(particle)) {
840 G4int Z = particle->GetAtomicNumber();
841 G4int A = particle->GetAtomicMass();
842 G4int L = particle->GetQuarkContent(3); //strangeness
844 if (encoding !=0 ) {
845 G4IonList::iterator i = fIonList->find(encoding);
846 for( ;i != fIonList->end() ; i++) {
847 if (particle == i->second) {
848 fIonList->erase(i);
849 break;
850 }
851 }
852 }
853 } else {
854#ifdef G4VERBOSE
855 if (GetVerboseLevel()>1) {
856 G4cerr << "G4IonTable::Remove :" << particle->GetParticleName()
857 << " is not ions" << G4endl;
858 }
859#endif
860 }
861
862}

Referenced by G4ParticleTable::Remove().

◆ size()

G4int G4IonTable::size ( ) const
inline

Definition at line 277 of file G4IonTable.hh.

278{
279 return fIonList->size();
280}

Referenced by GetIsotopeTable().


The documentation for this class was generated from the following files: