100 namespace antilightions {
116 #ifdef G4MULTITHREADED
122 : pNuclideTable(nullptr),
123 isIsomerCreated(
false),
242 G4cout <<
"G4IonTable::CreateIon() : can not create ion of "
243 <<
" Z =" << Z <<
" A = " << A
244 <<
" because GenericIon is not ready !!" <<
G4endl;
249 "Can not create ions because GenericIon is not ready");
262 if (fProperty !=
nullptr ){
269 stable = (life <= 0.) || (decayTable ==
nullptr);
276 ed <<
"G4IonTable::CreateIon() : G4IsotopeProperty object was not found for"
277 <<
" Z = " << Z <<
" A = " << A <<
" E = " << E/
keV <<
" (keV)";
278 if(flb!=G4Ions::G4FloatLevelBase::no_Float){
282 <<
" Physics quantities such as life are not set for this ion.";
297 if (lvl==0 && flb==G4Ions::G4FloatLevelBase::no_Float) name =
GetIonName(Z, A, lvl);
316 ion =
new G4Ions( name, mass, 0.0*
MeV, charge,
319 "nucleus", 0, A, encoding,
320 stable, life, decayTable,
false,
328 static_cast<G4Ions*
>(ion)->SetFloatLevelBase(flb);
335 G4cout <<
"G4IonTable::CreateIon() : create ion of " << name
336 <<
" " << Z <<
", " << A
339 G4cout <<
" IsomerLVL=" << lvl
340 <<
" excited energy=" << Eex/
keV <<
"[keV]";
349 #ifdef G4MULTITHREADED
352 if(!stable && decayTable) {
354 for(
G4int iCh=0;iCh<nCh;iCh++) {
382 G4cout <<
"G4IonTable::CreateIon() : can not create ion of "
383 <<
" Z =" << Z <<
" A = " << A
384 <<
" because GenericIon is not ready !!" <<
G4endl;
388 "Can not create ions because GenericIon is not ready");
417 ion =
new G4Ions( name, mass, 0.0*
MeV, charge,
420 "nucleus", 0, A, encoding,
421 stable, life, decayTable,
false,
429 static_cast<G4Ions*
>(ion)->SetFloatLevelBase(flb);
436 G4cout <<
"G4IonTable::CreateIon() : create hyper ion of " << name
437 <<
" " << Z <<
", " << A <<
", " << LL
440 G4cout <<
" IsomerLVL=" << lvl
441 <<
" excited energy=" << Eex/
keV <<
"[keV]";
456 if(lvl == 0)
return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
458 "Ion cannot be created by an isomer level. Use excitation energy.");
467 if(lvl == 0)
return CreateIon(Z,A,0.0,G4Ions::G4FloatLevelBase::no_Float);
471 ed <<
"Isomer level " << lvl <<
" is unknown for the isotope (Z="
472 << Z <<
", A=" << A <<
", L=" << LL <<
"). Null pointer is returned.";
485 if ( (A<1) || (Z<=0) || (lvl<0) || (A>999) ) {
488 G4cout <<
"G4IonTable::GetIon() : illegal atomic number/mass"
489 <<
" Z =" << Z <<
" A = " << A <<
" Lvl = " << lvl <<
G4endl;
494 if ( lvl == 0 )
return GetIon(Z,A,0.0);
500 #ifdef G4MULTITHREADED
501 if (ion ==
nullptr ){
510 if (ion ==
nullptr ){
512 "Ion cannot be created by an isomer level. Use excitation energy.");
521 if (LL==0)
return GetIon(Z,A,lvl);
523 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 ) {
526 G4cout <<
"G4IonTable::GetIon() : illegal atomic number/mass"
527 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
528 <<
" IsomerLvl = " << lvl <<
G4endl;
535 G4cout <<
"G4IonTable::GetIon() : No boud state for "
536 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
537 <<
" IsomerLvl = " << lvl <<
G4endl;
547 if (ion ==
nullptr) {
549 #ifdef G4MULTITHREADED
553 if(ion ==
nullptr) ion =
CreateIon(Z, A, LL, lvl);
571 return GetIon(Z,A,E,G4Ions::G4FloatLevelBase::no_Float,J);
576 char flbChar,
G4int J)
585 if ( (A<1) || (Z<=0) || (E<0.0) || (A>999) || (J<0) ) {
588 G4cout <<
"G4IonTable::GetIon() : illegal atomic number/mass"
589 <<
" Z =" << Z <<
" A = " << A <<
" E = " << E/
keV <<
G4endl;
599 #ifdef G4MULTITHREADED
604 if(ion ==
nullptr) ion =
CreateIon(Z,A,E,flb);
612 if (ion ==
nullptr) ion =
CreateIon(Z,A,E,flb);
621 return GetIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::no_Float,J);
626 char flbChar,
G4int J)
635 if (LL==0)
return GetIon(Z,A,E,flb,J);
637 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 ) {
640 G4cout <<
"G4IonTable::GetIon() : illegal atomic number/mass"
641 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
649 G4cout <<
"G4IonTable::GetIon() : No boud state for "
650 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
661 #ifdef G4MULTITHREADED
666 if(ion ==
nullptr) ion =
CreateIon(Z,A,LL,E,flb);
674 if(ion ==
nullptr) ion =
CreateIon(Z,A,LL,E,flb);
688 G4cout <<
"G4IonTable::GetIon() : illegal encoding"
689 <<
" CODE:" << encoding <<
G4endl;
697 return GetIon( Z, A, LL, IsoLvl);
705 return FindIon(Z,A,E,G4Ions::G4FloatLevelBase::no_Float,J);
710 char flbChar,
G4int J)
719 if ( (A<1) || (Z<=0) || (J<0) || (E<0.0) || (A>999) ) {
722 G4cout <<
"G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
723 <<
" Z =" << Z <<
" A = " << A <<
" E = " << E/
keV <<
G4endl;
737 if (ion!=
nullptr && E == 0.0) {
743 G4IonList::iterator i =
fIonList->find(encoding);
748 G4double anExcitaionEnergy = ((
const G4Ions*)(ion))->GetExcitationEnergy();
750 if(((
const G4Ions*)(ion))->GetFloatLevelBase()==flb){
769 return FindIon(Z,A,LL,E,G4Ions::G4FloatLevelBase::no_Float,J);
774 char flbChar,
G4int J)
783 if (LL==0)
return FindIon(Z,A,E,flb,J);
785 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 ) {
788 G4cout <<
"G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
789 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
804 G4IonList::iterator i =
fIonList->find(encoding);
810 G4double anExcitaionEnergy = ((
const G4Ions*)(ion))->GetExcitationEnergy();
812 if(((
const G4Ions*)(ion))->GetFloatLevelBase()==flb){
830 if ( (A<1) || (Z<=0) || (lvl<0) || (A>999) ) {
833 G4cout <<
"G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
834 <<
" Z =" << Z <<
" A = " << A <<
" IsoLvl = " << lvl <<
G4endl;
848 if (ion !=
nullptr && lvl==0) {
854 G4IonList::iterator i =
fIonList->find(encoding);
859 if ( ((
const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
869 "Isomer level 9 may be ambiguous.");
881 if (LL==0)
return FindIon(Z,A,lvl);
883 if (A < 2 || Z < 0 || Z > A-LL || LL>A || A>999 ) {
886 G4cout <<
"G4IonTable::FindIon() : illegal atomic number/mass or excitation level "
887 <<
" Z =" << Z <<
" A = " << A <<
" L = " << LL
888 <<
" IsomerLvl = " << lvl <<
G4endl;
901 G4IonList::iterator i =
fIonList->find(encoding);
907 if ( ((
const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
916 "Isomer level 9 may be ambiguous.");
935 if ( Z==1 && A==1 && E==0.0 )
return 2212;
938 encoding += Z * 10000;
940 if (lvl>0&&lvl<10) encoding +=lvl;
941 else if (E>0.0) encoding += 9;
960 encoding += LL* 10000000;
961 if ( Z==1 && A==1 && E==0.0 ) encoding = 3122;
971 if (encoding <= 0)
return false;
973 if (encoding == 2212) {
979 encoding -= 1000000000;
993 if (encoding <= 0)
return false;
995 if (encoding == 3122) {
996 Z = 1; A = 1; LL = 1;
1001 if (encoding % 10 != 0) {
1005 if (encoding < 1000000000) {
1010 encoding -= 1000000000;
1011 LL = encoding/10000000;
1012 encoding -= 10000000*
LL;
1014 encoding -= 10000*
Z;
1016 lvl = encoding % 10;
1030 if ( os ==
nullptr ) {
1031 os =
new std::ostringstream();
1033 os->setf(std::ios::fixed);
1040 if ( E>0 || flb!=G4Ions::G4FloatLevelBase::no_Float){
1042 std::ostringstream& oo = *os;
1045 if(flb!=G4Ions::G4FloatLevelBase::no_Float)
1063 for (
int i =0; i<
LL; i++){
1078 if ( os ==
nullptr ) {
1079 os =
new std::ostringstream();
1081 os->setf(std::ios::fixed);
1089 name =
"E" + os->str() +
"-";
1099 std::ostringstream& oo = *os;
1101 oo<<
'['<<lvl <<
']';
1115 for (
int i =0; i<
LL; i++){
1127 static const G4String nucleus(
"nucleus");
1150 static const G4String anti_nucleus(
"anti_nucleus");
1151 static const G4String anti_proton(
"anti_proton");
1170 #include <algorithm>
1174 static const std::string names[] = {
"proton",
"alpha",
"deuteron",
1178 return std::find(names, names+5, particle->
GetParticleName())!=names+5;
1183 static const std::string names[] = {
"anti_proton",
"anti_alpha",
"anti_deuteron",
1184 "anti_triton",
"anti_He3"};
1187 return std::find(names, names+5, particle->
GetParticleName())!=names+5;
1196 #ifndef G4MULTITHREADED
1200 if ( (Z==1)&&(A==1) ) {
1202 }
else if ( (Z==1)&&(A==2) ) {
1204 }
else if ( (Z==1)&&(A==3) ) {
1206 }
else if ( (Z==2)&&(A==4) ) {
1208 }
else if ( (Z==2)&&(A==3) ) {
1221 #ifndef G4MULTITHREADED
1225 if ( (Z==1)&&(A==1) ) {
1227 }
else if ( (Z==1)&&(A==2) ) {
1229 }
else if ( (Z==1)&&(A==3) ) {
1231 }
else if ( (Z==2)&&(A==4) ) {
1233 }
else if ( (Z==2)&&(A==3) ) {
1246 if ( (A<1) || (Z<0) || (LL<0) || (lvl<0) || (lvl>9) ){
1249 G4cout <<
"G4IonTable::GetNucleusMass() : illegal atomic number/mass "
1250 <<
" Z =" << Z <<
" A = " << A
1251 <<
" L = " << LL <<
" lvl = " << lvl <<
G4endl;
1254 G4Exception(
"G4IonTable::GetNucleusMass()",
"PART107",
1264 if (ion !=
nullptr) {
1275 G4IonList::iterator i =
fIonList->find(encoding);
1277 for( ;i !=
fIonList->end() ; i++) {
1281 if ( ((
const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1292 if (fProperty !=0 ) mass += fProperty->
GetEnergy();
1324 "No effects because readyToUse is true.");
1330 G4cout <<
"G4IonTable::Clear() : number of Ion regsitered = ";
1339 if (!
IsIon(particle))
return;
1348 fIonListShadow->insert( std::pair<const G4int, const G4ParticleDefinition*>(encoding, particle) );
1354 if(!particle)
return;
1361 if (encoding !=0 ) {
1362 G4IonList::iterator i =
fIonList->find(encoding);
1363 for( ;i !=
fIonList->end() ; i++) {
1364 if (particle == i->second ) {
1373 fIonList->insert( std::pair<const G4int, const G4ParticleDefinition*>(encoding, particle) );
1380 if(!particle)
return;
1381 #ifdef G4MULTITHREADED
1385 <<
" is ignored as it is invoked from a worker thread.";
1394 G4String msg =
"Request of removing ";
1396 msg +=
" has No effects other than Pre_Init";
1404 <<
" will be removed from the IonTable " <<
G4endl;
1410 if (
IsIon(particle)) {
1415 if (encoding !=0 ) {
1418 if (particle == i->second) {
1428 <<
" is not ions" <<
G4endl;
1443 G4IonList::iterator
idx;
1446 if (( particle_name ==
"ALL" ) || (particle_name ==
"all")){
1457 "Li",
"Be",
"B",
"C",
"N",
"O",
"F",
"Ne",
1458 "Na",
"Mg",
"Al",
"Si",
"P",
"S",
"Cl",
"Ar",
1459 "K",
"Ca",
"Sc",
"Ti",
"V",
"Cr",
"Mn",
"Fe",
"Co",
"Ni",
"Cu",
"Zn",
"Ga",
"Ge",
"As",
"Se",
"Br",
"Kr",
1460 "Rb",
"Sr",
"Y",
"Zr",
"Nb",
"Mo",
"Tc",
"Ru",
"Rh",
"Pd",
"Ag",
"Cd",
"In",
"Sn",
"Sb",
"Te",
"I",
"Xe",
1462 "La",
"Ce",
"Pr",
"Nd",
"Pm",
"Sm",
"Eu",
"Gd",
"Tb",
"Dy",
"Ho",
"Er",
"Tm",
"Yb",
"Lu",
1463 "Hf",
"Ta",
"W",
"Re",
"Os",
"Ir",
"Pt",
"Au",
"Hg",
"Tl",
"Pb",
"Bi",
"Po",
"At",
"Rn",
1465 "Ac",
"Th",
"Pa",
"U",
"Np",
"Pu",
"Am",
"Cm",
"Bk",
"Cf",
"Es",
"Fm",
"Md",
"No",
"Lr",
1466 "Rf",
"Db",
"Sg",
"Bh",
"Hs",
"Mt",
"Ds",
"Rg",
"Cn",
"Nh",
"Fl",
"Mc",
"Lv",
"Ts",
"Og"
1487 G4cout <<
"G4IonTable::AddProcessManager() : can not create ion of "
1489 <<
" because GenericIon is not available!!" <<
G4endl;
1491 "Can not create ions because GenericIon is not available");
1501 if ( muatom !=
nullptr ) {
1504 G4cout <<
"G4IonTable::AddProcessManager() : MuonicAtom dynamic_cast succeeded for "
1515 G4cout <<
"G4IonTable::AddProcessManager() : can not create MuonicAtom "
1517 <<
" because GenericMuonicAtom is not available!!" <<
G4endl;
1519 "Can not create MuonicAtoms because GenericMuonicAtom is not available");
1527 G4cout <<
"G4IonTable::AddProcessManager() : can not create "
1529 <<
" because of unsupported particle type !!" <<
G4endl;
1531 "Can not create particle");
1546 if (name == fIsotopeTable->
GetName())
return;
1556 if ( index < fIsotopeTableList->
size() ) {
1557 fIsotopeTable = (*fIsotopeTableList)[index];
1559 return fIsotopeTable;
1575 property = fIsotopeTable->
GetIsotope(Z,A,E,flb);
1593 property = fIsotopeTable->
GetIsotope(Z,A,lvl);
1641 if ( (index >=0) && (index <
Entries()) ) {
1645 if ( counter == index ) {
1654 G4cout <<
" G4IonTable::GetParticle"
1655 <<
" invalid index (=" << index <<
")"
1665 if (!
IsIon(particle))
return false;
1672 if (encoding !=0 ) {
1675 if (particle == i->second ) {
1713 G4double anExcitaionEnergy = ((
const G4Ions*)(ion))->GetExcitationEnergy();
1715 if(((
const G4Ions*)(ion))->GetFloatLevelBase()==flb){
1734 if (LL==0)
return FindIon(Z,A,E,flb,J);
1749 G4double anExcitaionEnergy = ((
const G4Ions*)(ion))->GetExcitationEnergy();
1751 if(((
const G4Ions*)(ion))->GetFloatLevelBase()==flb){
1781 if ( ((
const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1798 if (LL==0)
return FindIon(Z,A,lvl);
1812 if ( ((
const G4Ions*)(ion))->GetIsomerLevel() == lvl) {
1831 "Method is invoked before G4IonTable is initialized.");
1849 if( fProperty !=
nullptr ) life = fProperty->
GetLifeTime();
1857 if (base==0 || !
IsIon(base)){
1868 auto const encoding = baseenc+1000000000;
1882 #ifdef G4MULTITHREADED
1909 #ifdef G4MULTITHREADED