Geant4  10.02.p03
G4RIsotopeTable Class Reference

#include <G4RIsotopeTable.hh>

Inheritance diagram for G4RIsotopeTable:
Collaboration diagram for G4RIsotopeTable:

Public Types

typedef std::vector< G4IsotopeProperty * > G4IsotopeList
 
typedef std::vector< G4StringG4IsotopeNameList
 

Public Member Functions

 G4RIsotopeTable ()
 
virtual ~G4RIsotopeTable ()
 
virtual G4bool FindIsotope (G4IsotopeProperty *property)
 
virtual G4IsotopePropertyGetIsotope (G4int Z, G4int A, G4double E)
 
void AddUserDecayDataFile (G4int Z, G4int A, G4String filename)
 
- Public Member Functions inherited from G4VIsotopeTable
 G4VIsotopeTable ()
 
 G4VIsotopeTable (const G4String &)
 
 G4VIsotopeTable (const G4VIsotopeTable &)
 
G4VIsotopeTableoperator= (const G4VIsotopeTable &)
 
virtual ~G4VIsotopeTable ()
 
virtual G4IsotopePropertyGetIsotopeByIsoLvl (G4int Z, G4int A, G4int level=0)
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int level)
 
void DumpTable (G4int Zmin=1, G4int Zmax=118)
 
const G4StringGetName () const
 

Protected Member Functions

 G4RIsotopeTable (const G4RIsotopeTable &right)
 
G4RIsotopeTableoperator= (const G4RIsotopeTable &right)
 

Private Member Functions

G4String GetIsotopeName (G4int Z, G4int A, G4double E)
 
G4double GetMeanLifeTime (G4int Z, G4int A, G4double &E)
 
G4IsotopePropertyGetIsotope (G4int index) const
 
G4int GetVerboseLevel () const
 
G4int Entries () const
 

Private Attributes

G4IsotopeList fIsotopeList
 
G4IsotopeNameList fIsotopeNameList
 
std::map< G4int, G4StringtheUserRadioactiveDataFiles
 

Static Private Attributes

static const G4double levelTolerance = 2.0*keV
 

Detailed Description

Definition at line 64 of file G4RIsotopeTable.hh.

Member Typedef Documentation

◆ G4IsotopeList

Definition at line 72 of file G4RIsotopeTable.hh.

◆ G4IsotopeNameList

Definition at line 73 of file G4RIsotopeTable.hh.

Constructor & Destructor Documentation

◆ G4RIsotopeTable() [1/2]

G4RIsotopeTable::G4RIsotopeTable ( )

Definition at line 84 of file G4RIsotopeTable.cc.

84  :G4VIsotopeTable("RIsotopeTable")
85 {
86  // Reset the list of user defined data files
88 }
std::map< G4int, G4String > theUserRadioactiveDataFiles

◆ G4RIsotopeTable() [2/2]

G4RIsotopeTable::G4RIsotopeTable ( const G4RIsotopeTable right)
protected

◆ ~G4RIsotopeTable()

G4RIsotopeTable::~G4RIsotopeTable ( )
virtual

Definition at line 91 of file G4RIsotopeTable.cc.

92 {
93  for (G4int i = 0; i < G4int(fIsotopeList.size()); i++) delete fIsotopeList[i];
94  fIsotopeList.clear();
95  fIsotopeNameList.clear();
96 }
int G4int
Definition: G4Types.hh:78
G4IsotopeList fIsotopeList
G4IsotopeNameList fIsotopeNameList

Member Function Documentation

◆ AddUserDecayDataFile()

void G4RIsotopeTable::AddUserDecayDataFile ( G4int  Z,
G4int  A,
G4String  filename 
)

Definition at line 281 of file G4RIsotopeTable.cc.

282 { if (Z<1 || A<2) {
283  G4cout<<"Z and A not valid!"<<G4endl;
284  }
285 
286  std::ifstream DecaySchemeFile(filename);
287  if (DecaySchemeFile){
288  G4int ID_ion=A*1000+Z;
289  theUserRadioactiveDataFiles[ID_ion]=filename;
290  }
291  else {
292  G4cout<<"The file "<<filename<<" does not exist!"<<G4endl;
293  }
294 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
Float_t Z
#define G4endl
Definition: G4ios.hh:61
std::map< G4int, G4String > theUserRadioactiveDataFiles

◆ Entries()

G4int G4RIsotopeTable::Entries ( ) const
inlineprivate

Definition at line 137 of file G4RIsotopeTable.hh.

138  {return fIsotopeNameList.size();}
G4IsotopeNameList fIsotopeNameList
Here is the caller graph for this function:

◆ FindIsotope()

G4bool G4RIsotopeTable::FindIsotope ( G4IsotopeProperty property)
virtual

Definition at line 105 of file G4RIsotopeTable.cc.

106 {
107  // do nothing, it is here just for the compiler
108  // it is required by the base class
109  return true;
110 }

◆ GetIsotope() [1/2]

G4IsotopeProperty * G4RIsotopeTable::GetIsotope ( G4int  Z,
G4int  A,
G4double  E 
)
virtual

Implements G4VIsotopeTable.

Definition at line 113 of file G4RIsotopeTable.cc.

114 {
116  G4int j = -1;
117  for (G4int i = 0 ; i< Entries(); i++) {
118  if(fIsotopeNameList[i] == fname) j = i;}
119  if (j >=0) {
120  if (GetVerboseLevel() > 1) {
121  G4cout <<"G4RIsotopeTable::GetIsotope No. : ";
122  G4cout <<j<<G4endl;
123  }
124  return GetIsotope(j);
125  // isotope property data has been loaded already - just return the pointer
126 
127  } else {
128  G4double meanlife = GetMeanLifeTime(Z, A, E);
129  // E is passed as a refence hence on entry E is supplied by the user and it
130  // could be slightly different from the returned value which is the one
131  // defined in the database.
132  // this call is to ensure the code uses a consistent E value throughout.
133 
134  G4IsotopeProperty* fProperty = new G4IsotopeProperty();
135  // Set Isotope Property
136  fProperty->SetLifeTime(meanlife);
137  fProperty->SetAtomicNumber(Z);
138  fProperty->SetAtomicMass(A);
139  // Notic that the value of E may have been changed
140  fProperty->SetEnergy(E);
141  // The spin is not being used in the current implementation
142  fProperty->SetiSpin(0);
143  // the decaytable will be loaded later in G4RadioactiveDecay when it is needed
144  fProperty->SetDecayTable(0);
145 
146  fIsotopeList.push_back(fProperty);
147  fname = GetIsotopeName(Z, A, E);
148  fIsotopeNameList.push_back(fname);
149  if (GetVerboseLevel()>1) {
150  G4cout <<"G4RIsotopeTable::GetIsotope create: ";
151  G4cout <<fname <<G4endl;
152  }
153  return fProperty;
154 
155  }
156 }
void SetAtomicMass(G4int A)
virtual G4IsotopeProperty * GetIsotope(G4int Z, G4int A, G4double E)
int G4int
Definition: G4Types.hh:78
void SetiSpin(G4int J)
G4int Entries() const
void SetLifeTime(G4double T)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
Float_t Z
void SetEnergy(G4double E)
void SetDecayTable(G4DecayTable *table)
G4double GetMeanLifeTime(G4int Z, G4int A, G4double &E)
G4int GetVerboseLevel() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4IsotopeList fIsotopeList
void SetAtomicNumber(G4int Z)
G4String GetIsotopeName(G4int Z, G4int A, G4double E)
G4IsotopeNameList fIsotopeNameList
Here is the call graph for this function:

◆ GetIsotope() [2/2]

G4IsotopeProperty * G4RIsotopeTable::GetIsotope ( G4int  index) const
inlineprivate

Definition at line 140 of file G4RIsotopeTable.hh.

141 {
142  if ( (index >=0 ) && (index < Entries()) ){
143  return fIsotopeList[index];
144  } else {
145  return 0;
146  }
147 }
Int_t index
G4int Entries() const
G4IsotopeList fIsotopeList
Here is the call graph for this function:

◆ GetIsotopeName()

G4String G4RIsotopeTable::GetIsotopeName ( G4int  Z,
G4int  A,
G4double  E 
)
private

Definition at line 159 of file G4RIsotopeTable.cc.

160 {
161  std::ostringstream os;
162  os.setf(std::ios::fixed);
163  os <<"A"<< A << "Z" << Z <<'[' << std::setprecision(1) << E/keV << ']';
164  G4String name = os.str();
165  if (GetVerboseLevel()>1) {
166  G4cout <<"G4RIsotopeTable::GetIsotope Name: ";
167  G4cout <<name <<G4endl;
168  }
169  return name;
170 }
G4String name
Definition: TRTMaterials.hh:40
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
Float_t Z
G4int GetVerboseLevel() const
#define G4endl
Definition: G4ios.hh:61
static const double keV
Definition: G4SIunits.hh:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMeanLifeTime()

G4double G4RIsotopeTable::GetMeanLifeTime ( G4int  Z,
G4int  A,
G4double E 
)
private

Definition at line 173 of file G4RIsotopeTable.cc.

174 {
175 
176  G4double lifetime = -1.0;
177 
178  //Check if data have been provided by the user
179  std::map<int,G4String>::iterator it = theUserRadioactiveDataFiles.find(1000*A+Z);
180  G4String file="";
181  if ( it != theUserRadioactiveDataFiles.end() ){
182  file=it->second;
183  }
184  if (file ==""){
185  if (!getenv("G4RADIOACTIVEDATA")) {
186  G4cout << "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files." << G4endl;
187  throw G4HadronicException(__FILE__, __LINE__,
188  "Please setenv G4RADIOACTIVEDATA to point to the radioactive decay data files.");
189  }
190  G4String dirName = getenv("G4RADIOACTIVEDATA");
191 
192  std::ostringstream os;
193  os <<dirName <<"/z" <<Z <<".a" <<A ;
194  file = os.str();
195  }
196  std::ifstream DecaySchemeFile(file);
197 
198  G4bool found_in_raddecay_data(false);
199  if (!DecaySchemeFile) {
200  if (GetVerboseLevel()>1) {
201  G4cout <<"G4RIsotopeTable::GetMeanLife() : "
202  <<"cannot find ion radioactive decay file: "
203  <<file <<G4endl;
204  }
205  } else {
206  char inputChars[100]={' '};
207  G4String inputLine;
208  G4String recordType("");
209  G4double a(0.0);
210  G4double b(0.0);
211 
212  G4int loop = 0;
214  ed << " While count exceeded " << G4endl;
215  while (!found_in_raddecay_data && !DecaySchemeFile.getline(inputChars, 100).eof()) { /* Loop checking, 01.09.2015, D.Wright */
216  loop++;
217  if (loop > 100000) {
218  G4Exception("G4RIsotopeTable::GetMeanLifeTime()", "HAD_RDM_100", JustWarning, ed);
219  break;
220  }
221 
222  inputLine = inputChars;
223  inputLine = inputLine.strip(1);
224 
225  if (inputChars[0] != '#' && inputLine.length() != 0) {
226  std::istringstream tmpstream(inputLine);
227  tmpstream >> recordType >> a >> b;
228  if (recordType == "P") {
229  if (std::abs(a*keV-aE) < levelTolerance) {
230  found_in_raddecay_data = true;
231  lifetime = b/0.693147*s ;
232  }
233  }
234  }
235  }
236  DecaySchemeFile.close();
237  }
238 
239  if (!found_in_raddecay_data && aE) {
240  G4double half_life=-1.;
241  lifetime = 1.0E-20*s;
242 
243 
244  //added by L.Desorgher If the life time is not found in raddecay database
245  // then it is deduced from photo-evaporation level
246  const G4NuclearLevel* aLevel =
249  if (aLevel) {
250  half_life = aLevel->HalfLife();
251  lifetime = half_life/0.693147;
252  }
253 
254  if (GetVerboseLevel()>1 && half_life<0) {
255  G4cout << "G4RIsotopeTable::GetMeanLife() : ";
256  G4cout << "cannot find ion of required excitation E = " << aE << G4endl;
257  G4cout << "state in radioactive or photoevaporation data file " << G4endl;
258  G4cout <<"The nucleus is assumed to be IT decayed with life = 1E-20 s" << G4endl;
259  G4cout <<" -----------* THIS MAY CAUSE PROBLEM IN ITS DECAY-----------" << G4endl;
260  }
261  }
262 
263  if (!found_in_raddecay_data && !aE) {
264  if (GetVerboseLevel()>1) {
265  G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
266  G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
267  G4cout <<"state in radioactive or photoevaporation data file" <<G4endl;
268  G4cout <<"The nucleus is assumed to be stable" <<G4endl;
269  lifetime = -1.0;
270  }
271  }
272 
273  if (GetVerboseLevel()>1) {
274  G4cout <<"G4RIsotopeTable::GetMeanLifeTime: ";
275  G4cout <<lifetime << " for " << GetIsotopeName(Z, A, aE) <<G4endl;
276  }
277  return lifetime;
278 }
const G4NuclearLevel * NearestLevel(G4double energy, G4double eDiffMax=1.e+8) const
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4String strip(G4int strip_Type=trailing, char c=' ')
G4double HalfLife() const
static G4NuclearLevelStore * GetInstance()
static const G4double levelTolerance
TFile * file
int G4int
Definition: G4Types.hh:78
static const double s
Definition: G4SIunits.hh:168
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
Float_t Z
bool G4bool
Definition: G4Types.hh:79
G4NuclearLevelManager * GetManager(G4int Z, G4int A)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int GetVerboseLevel() const
#define G4endl
Definition: G4ios.hh:61
static const double keV
Definition: G4SIunits.hh:213
double G4double
Definition: G4Types.hh:76
std::map< G4int, G4String > theUserRadioactiveDataFiles
G4String GetIsotopeName(G4int Z, G4int A, G4double E)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVerboseLevel()

G4int G4RIsotopeTable::GetVerboseLevel ( ) const
private

Definition at line 99 of file G4RIsotopeTable.cc.

100 {
102 }
G4int GetVerboseLevel() const
static G4ParticleTable * GetParticleTable()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4RIsotopeTable& G4RIsotopeTable::operator= ( const G4RIsotopeTable right)
protected

Member Data Documentation

◆ fIsotopeList

G4IsotopeList G4RIsotopeTable::fIsotopeList
private

Definition at line 128 of file G4RIsotopeTable.hh.

◆ fIsotopeNameList

G4IsotopeNameList G4RIsotopeTable::fIsotopeNameList
private

Definition at line 129 of file G4RIsotopeTable.hh.

◆ levelTolerance

const G4double G4RIsotopeTable::levelTolerance = 2.0*keV
staticprivate

Definition at line 130 of file G4RIsotopeTable.hh.

◆ theUserRadioactiveDataFiles

std::map<G4int, G4String> G4RIsotopeTable::theUserRadioactiveDataFiles
private

Definition at line 133 of file G4RIsotopeTable.hh.


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