Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPNames Class Reference

#include <G4ParticleHPNames.hh>

Collaboration diagram for G4ParticleHPNames:

Public Member Functions

 G4ParticleHPNames ()
 
 G4ParticleHPNames (G4int maxOffSet)
 
 ~G4ParticleHPNames ()
 
G4ParticleHPDataUsed GetName (G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
 
G4ParticleHPDataUsed GetName (G4int A, G4int Z, G4int M, G4String base, G4String rest, G4bool &active)
 
G4String GetName (G4int i)
 
void SetMaxOffSet (G4int anOffset)
 
G4String itoa (int current)
 

Public Attributes

G4int theMaxOffSet
 

Static Public Attributes

static const G4String theString [100]
 

Detailed Description

Definition at line 39 of file G4ParticleHPNames.hh.

Constructor & Destructor Documentation

G4ParticleHPNames::G4ParticleHPNames ( )
inline

Definition at line 43 of file G4ParticleHPNames.hh.

43 {theMaxOffSet = 5;}
G4ParticleHPNames::G4ParticleHPNames ( G4int  maxOffSet)
inline

Definition at line 44 of file G4ParticleHPNames.hh.

44 {theMaxOffSet = maxOffSet;}
G4ParticleHPNames::~G4ParticleHPNames ( )
inline

Definition at line 45 of file G4ParticleHPNames.hh.

45 {}

Member Function Documentation

G4ParticleHPDataUsed G4ParticleHPNames::GetName ( G4int  A,
G4int  Z,
G4String  base,
G4String  rest,
G4bool active 
)
inline

Definition at line 48 of file G4ParticleHPNames.hh.

48 { G4int M = 0; return GetName( A, Z, M, base, rest, active); };
int G4int
Definition: G4Types.hh:78
double A(double temperature)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)

Here is the call graph for this function:

Here is the caller graph for this function:

G4ParticleHPDataUsed G4ParticleHPNames::GetName ( G4int  A,
G4int  Z,
G4int  M,
G4String  base,
G4String  rest,
G4bool active 
)

Definition at line 68 of file G4ParticleHPNames.cc.

69 {
70 
72 
73  //G4cout << Z << " " << A << " " << M << " " << base << " " << rest << G4endl;
74 
75  //Excited isomer indicator
76  std::stringstream ss;
77  G4String sM;
78  if ( M > 0 )
79  {
80  ss << "m";
81  ss << M;
82  ss >> sM;
83  ss.clear();
84  }
85 
87  aFlag = true;
88 if(getenv("NeutronHPNames")) G4cout << "Names::GetName entered for Z = " << Z << ", A = " << A <<G4endl;
89 
90  G4int myA = A;
91  G4int myZ = Z;
92 
93  if(Z>92.5&&!getenv("AllowForHeavyElements") )
94  {
95  //G4cerr << "Please contact Hans-Peter.Wellisch@cern.ch"<<G4endl;
96  G4cerr << "Please contact Geant4 Hadron Group Coordinator"<<G4endl;
97  throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPNames::GetName - data with Z>92 are not provided");
98  }
99 
100  G4String * theName = 0;
101  G4String theFileName("");
102 
103 // G4int inc = 1;
104 
105  G4int flip_Z = 1;
106  G4int delta_Z = 0;
107 
108  G4int flip_A = 1;
109  G4int delta_A = 0;
110 
111  //std::ifstream * check = new std::ifstream(".dummy");
112  std::istringstream* check = NULL;
113  G4bool first = true;
114 if(getenv("NeutronHPNames")) G4cout << "entered GetName!!!"<<G4endl;
115  do
116  {
117  aFlag = true;
118  G4String * biff = new G4String(); // delete here as theName
119  *biff = base+"/CrossSection/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
120 
121  if(theName!=0) delete theName;
122  theName = biff;
123  result.SetName(*theName);
124  result.SetA(myA);
125  result.SetZ(myZ);
126  result.SetM(M);
127 if(getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl;
128 
129  // T.K. debug for memory leak
130  if ( check != NULL ) {
131  //check->close();
132  delete check;
133  }
134 
135  //check = new std::ifstream(*theName);
136  check = new std::istringstream(std::ios::in);
138  if ( !(*check) )
139  {
140  //check->close();
141  delete check;
142  check = 0;
143  aFlag = false;
144  if ( first )
145  {
146  aFlag = true;
147  first = false;
148  biff = new G4String(); // delete here as theName
149  *biff = base+"/CrossSection/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
150  delete theName;
151  theName = biff;
152 if(getenv("NeutronHPNames")) G4cout <<"HPWD 2 "<<*theName<<G4endl;
153  result.SetName(*theName);
154  G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
155  result.SetA(natA);
156  result.SetZ(myZ);
157  result.SetM(M);
158  //check = new std::ifstream(*theName);
159  check = new std::istringstream(std::ios::in);
161  if ( !(*check) )
162  {
163  //check->close();
164  delete check;
165  check = 0;
166  aFlag = false;
167  }
168  else
169  {
170  biff = new G4String(); // delete here as theName
171  *biff = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
172  if ( rest=="/CrossSection" ) *biff = base+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
173  delete theName;
174  theName = biff;
175 if(getenv("NeutronHPNames")) G4cout <<"HPWD 3 "<<*theName<<G4endl;
176  result.SetName(*theName);
177  natA = myZ/G4SandiaTable::GetZtoA(myZ);
178  result.SetA(natA);
179  result.SetZ(myZ);
180  result.SetM(M);
181  result.SetNaturalAbundanceFlag();
182  }
183  }
184  }
185  else
186  {
187 // 070706 T. Koi Modified
188 /*
189  biff = new G4String(); // delete here as theName
190  *biff = base+"/"+rest+itoa(myZ)+"_"+itoa(myA)+"_"+theString[myZ-1];
191  if(theName!=0) delete theName;
192  theName = biff;
193 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4 "<<*theName<<G4endl;
194  result.SetName(*theName);
195  result.SetA(myA);
196  result.SetZ(myZ);
197 */
198 
199  G4double tmpA = myA;
200  //std::ifstream* file = NULL;
201  std::istringstream* file = NULL;
202  G4String fileName;
203 
204  if ( rest == "/CrossSection" )
205  {
206 
207  //fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
208  fileName = base+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
209 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4a "<<*theName<<G4endl;
210 
211  }
212  else
213  {
214 
215 // For FS
216  fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1];
217  //file = new std::ifstream(fileName);
218  file = new std::istringstream(std::ios::in);
220 
221  if ( *file )
222  {
223 
224 // isotope FS
225 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b1 "<<*theName<<G4endl;
226  }
227  else
228  {
229 
230 // _nat_ FS
231  fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1];
232 
233  delete file;
234  //file = new std::ifstream(fileName);
235  file = new std::istringstream(std::ios::in);
237  if ( *file )
238  {
239 
240 // FS neither isotope nor _nat_
241 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2a "<<*theName<<G4endl;
242  G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
243  tmpA = natA;
244  }
245  else
246  {
247 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl;
248  fileName="INVALID";
249  }
250  }
251 
252  delete file;
253 
254  }
255 
256  result.SetName(fileName);
257  result.SetA(tmpA);
258  result.SetZ(myZ);
259  result.SetM(M);
260 
261  }
262 
263  do
264  {
265 // if (std::abs(myZ-Z)>theMaxOffSet||myZ==0||myA==0)
266  if ( delta_Z > theMaxOffSet )
267  {
268  //if ( inc > 0 )
269  //{
270  // inc*= -1;
271  // myZ = Z;
272  // myA = A;
273  //}
274  //else
275  //{
276  G4cout <<"G4ParticleHPNames: Sorry, this material does not come near to any data."<<G4endl;
277  G4cout <<"G4ParticleHPNames: Please make sure G4NEUTRONHPDATA points to the" << G4endl;
278  G4cout <<" directory, the neutron scattering data are located in." << G4endl;
279  G4cout << "G4ParticleHPNames: The material was: A="<<A<<", Z="<<Z<<G4endl;
280  //throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hans-Peter.Wellisch@cern.ch");
281  throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hadron Group Coordinator");
282 /*
283 160910 TK makes commented out sructurally dead code
284  delete theName;
285  theFileName = "";
286  return result;
287 */
288  //}
289  }
290 
291  //if ( std::abs( myA - A ) > theMaxOffSet )
292  if ( delta_A > 2*theMaxOffSet )
293  {
294  delta_A = 0;
295  flip_A = 1;
296 
297  first = true;
298 
299  if ( flip_Z > 0 )
300  {
301  delta_Z +=1;
302  }
303  myZ = Z + flip_Z * delta_Z;
304  flip_Z *= -1;
305 
306  myA = A;
307  if ( myZ > 100 )
308  {
309  myZ = 100;
310  }
311  if ( myZ < 1 )
312  {
313  myZ = 1;
314  }
315 
316 // myZ += inc;
317  }
318  else
319  {
320  if ( flip_A > 0 )
321  {
322  delta_A += 1;
323  }
324  myA = A + flip_A * delta_A;
325  flip_A *= -1;
326 
327  if ( myA < 1 )
328  {
329  myA = 1;
330  }
331 
332 // myA += inc;
333  }
334 
335  }
336  while( myZ == 0 || myA == 0 ); // No meaning // Loop checking, 11.05.2015, T. Koi
337 
338  }
339  while((!check) || (!(*check))); // Loop checking, 11.05.2015, T. Koi
340 
341  if(getenv("NeutronHPNamesLogging") || getenv("NeutronHPNames"))
342  {
343  G4cout << "Names::GetName: last theName proposal = "<< G4endl;
344  G4cout << *theName <<" "<<A<<" "<<Z<<" "<<result.GetName()<<G4endl;
345  }
346 
347 // administration and anouncement for lacking of exact data in NDL
348  if ( Z != result.GetZ() || A != result.GetA() )
349  {
350  if ( rest == "/CrossSection" )
351  {
352  G4String reac = base;
353  G4String dir = getenv("G4NEUTRONHPDATA");
354  reac.erase ( 0 , dir.length() );
355  if ( G4ParticleHPManager::GetInstance()->GetSkipMissingIsotopes() && !( Z == result.GetZ() && result.IsThisNaturalAbundance() ) )
356  {
357  if ( verboseLevel > 0 ) {
358  G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and CrossSection set to 0." << G4endl;
359  }
360  G4String new_name = base+"/"+rest+"/"+"0_0_Zero";
361  result.SetName( new_name );
362  }
363  else
364  {
365  //080901 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi
366  //160216 Increase protencted isotopes for fixing problem on charged particle HP
367  if ( ( reac.find("Inelastic") != reac.size() && ( (Z == 1 && A == 1) || (Z == 1 && A == 2) || (Z == 1 && A == 3) || (Z == 2 && A == 3) || (Z == 2 && A == 4) ) )
368  || ( reac.find("Capture") != reac.size() && ( (Z == 1 && A == 3) || (Z == 2 && A == 4) ) )
369  || ( reac.find("Fission") != reac.size() && ( (Z == 88 && A == 224) || (Z == 88 && A == 225) || (Z == 89 && A == 225) || (Z == 88 && A == 226) ) ) )
370 
371  {
372  G4String new_name = base+"/"+rest+"/"+"0_0_Zero";
373  result.SetName( new_name );
374  }
375  else
376  {
377  if ( verboseLevel > 0 ) {
378  G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and NeutronHP will use " << result.GetName() << G4endl;
379  }
380  }
381  }
382  }
383  }
384 
385  delete theName;
386  if(aFlag)
387  {
388  //check->close();
389  delete check;
390  check = NULL;
391  }
392  return result;
393  }
G4double G4ParticleHPJENDLHEData::G4double result
static G4ParticleHPManager * GetInstance()
static const G4String theString[100]
const XML_Char int const XML_Char int const XML_Char * base
Definition: expat.h:331
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
bool G4bool
Definition: G4Types.hh:79
void GetDataStream2(G4String, std::istringstream &iss)
void SetName(G4String aName)
static G4double GetZtoA(G4int Z)
G4String itoa(int current)
#define G4endl
Definition: G4ios.hh:61
void SetA(G4double anA)
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

G4String G4ParticleHPNames::GetName ( G4int  i)

Definition at line 65 of file G4ParticleHPNames.cc.

65 { return theString[i]; }
static const G4String theString[100]
G4String G4ParticleHPNames::itoa ( int  current)
inline

Definition at line 57 of file G4ParticleHPNames.hh.

58  {
59  const char theDigits[11] = "0123456789";
61  int digit;
62  do
63  {
64  digit = current-10*(current/10);
65  result=theDigits[digit]+result;
66  current/=10;
67  }
68  while(current!=0); // Loop checking, 11.05.2015, T. Koi
69  return result;
70  }
G4double G4ParticleHPJENDLHEData::G4double result

Here is the caller graph for this function:

void G4ParticleHPNames::SetMaxOffSet ( G4int  anOffset)
inline

Definition at line 51 of file G4ParticleHPNames.hh.

51 { theMaxOffSet = anOffset; }

Member Data Documentation

G4int G4ParticleHPNames::theMaxOffSet

Definition at line 56 of file G4ParticleHPNames.hh.

const G4String G4ParticleHPNames::theString
static
Initial value:
= {"Hydrogen", "Helium",
"Lithium", "Berylium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine",
"Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorous",
"Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium",
"Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel",
"Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine",
"Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium",
"Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver",
"Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon",
"Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium",
"Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium",
"Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium",
"Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinium", "Gold",
"Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon",
"Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium",
"Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium",
"Einsteinium","Fermium"}

Definition at line 55 of file G4ParticleHPNames.hh.


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