Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4IonTable.cc
Go to the documentation of this file.
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 //
27 // $Id$
28 //
29 //
30 // --------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // History: first implementation, based on object model of
34 // 27 June 1998 H.Kurashige
35 // ---------------------------------------------------------------
36 // modified GetIon 02 Aug., 98 H.Kurashige
37 // added Remove() 06 Nov.,98 H.Kurashige
38 // use G4NucleiPropoerties to get nuceli Mass 17 Nov.,98 H.Kurashige
39 // use G4GenericIon for process List
40 // modify fomula of Ion mass 09 Dec., 98 H.Kurashige
41 // -----
42 // Modified GetIon methods 17 Aug. 99 H.Kurashige
43 // New design using G4VIsotopeTable 5 Oct. 99 H.Kurashige
44 // Modified Element Name for Z>103 06 Apr. 01 H.Kurashige
45 // Remove test of cuts in SetCuts 16 Jan 03 V.Ivanchenko
46 
47 #include "G4IonTable.hh"
48 #include "G4PhysicalConstants.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "G4ParticleTable.hh"
51 #include "G4StateManager.hh"
52 #include "G4Ions.hh"
53 #include "G4UImanager.hh"
54 #include "G4NucleiProperties.hh"
56 
57 #include "G4IsotopeProperty.hh"
58 #include "G4VIsotopeTable.hh"
59 
60 #include "G4ios.hh"
61 #include <iostream>
62 #include <iomanip>
63 
64 #include <sstream>
65 
66 
69 {
70  fIonList = new G4IonList();
71  fIsotopeTableList = new std::vector<G4VIsotopeTable*>;
72 }
73 
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 }
97 
98 
100 // -- CreateIon method ------
103  G4double E, G4int J)
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 
152  G4int encoding = GetNucleusEncoding(Z,A,E,J);
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 }
182 
183 
186  G4double E, G4int J)
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 }
257 
259 // -- GetIon methods ------
262 {
263  return GetIon(Z, A);
264 }
265 
268 {
269  return GetIon( Z, A, 0.0, J);
270 }
271 
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 }
291 
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 }
315 
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 }
351 
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 }
394 
395 
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 }
443 
444 
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 
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 }
469 
472  G4double E, G4int )
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  //
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 }
492 
495  G4int &Z, G4int &A,
496  G4double &E, G4int &J)
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) {
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 }
528  G4int &Z, G4int &A,
529  G4int &L,
530  G4double &E, G4int &J)
531 {
532  if (encoding <= 0) {
533  // anti particle
534  return false;
535  }
536  if (encoding % 10 != 0) {
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 }
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 }
579 
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 }
592 
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 }
617 
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 }
641 
643 #include <algorithm>
644 
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 }
653 
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 }
662 
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 }
699 
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 }
736 
737 
739 // -- GetNucleusMass/GetIonMass ---
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 }
772 
775 {
776  return GetNucleusMass(Z,A,L);
777 }
778 
779 
781 // -- Methods for handling conatiner ---
783 
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 }
801 
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 }
815 
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 }
863 
864 
865 
867 // -- Dump Information
869 void G4IonTable::DumpTable(const G4String &particle_name) const
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 }
882 
884 const G4String G4IonTable::elementName[] = {
885  "H", "He",
886  "Li", "Be", "B", "C", "N", "O", "F", "Ne",
887  "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar",
888  "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr",
889  "Rb", "Sr", "Y", "Zr", "Nb", "Mo","Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe",
890  "Cs", "Ba",
891  "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu",
892  "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn",
893  "Fr", "Ra",
894  "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr",
895  "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg",
896  "Uub", "Uut", "Uuq","Uup","Uuh","Uus","Uuo"
897 };
898 
899 
902 {
904 }
905 
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 }
924 
925 #include <vector>
926 
929 {
930  fIsotopeTableList->push_back(table);
931 }
932 
935 {
936  G4VIsotopeTable* fIsotopeTable=0;
937  if ( index < fIsotopeTableList->size() ) {
938  fIsotopeTable = (*fIsotopeTableList)[index];
939  }
940  return fIsotopeTable;
941 }
942 
943 
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 }
993 
994 
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 }
1011 
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 }
1035 
1036 
1037 
1038 
1039 
1040 
1041 
1042 
1043 
1044 
1045