#include <G4NeutronHPNames.hh>
Public Member Functions | |
G4NeutronHPNames () | |
G4NeutronHPNames (G4int maxOffSet) | |
~G4NeutronHPNames () | |
G4NeutronHPDataUsed | GetName (G4int A, G4int Z, G4String base, G4String rest, G4bool &active) |
G4NeutronHPDataUsed | 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) |
Data Fields | |
G4int | theMaxOffSet |
Static Public Attributes | |
static const G4String | theString [100] |
Definition at line 39 of file G4NeutronHPNames.hh.
G4NeutronHPNames::G4NeutronHPNames | ( | ) | [inline] |
Definition at line 43 of file G4NeutronHPNames.hh.
References theMaxOffSet.
00043 {theMaxOffSet = 5;}
G4NeutronHPNames::G4NeutronHPNames | ( | G4int | maxOffSet | ) | [inline] |
Definition at line 44 of file G4NeutronHPNames.hh.
References theMaxOffSet.
00044 {theMaxOffSet = maxOffSet;}
G4NeutronHPNames::~G4NeutronHPNames | ( | ) | [inline] |
Definition at line 62 of file G4NeutronHPNames.cc.
References theString.
00062 { return theString[i]; }
G4NeutronHPDataUsed G4NeutronHPNames::GetName | ( | G4int | A, | |
G4int | Z, | |||
G4int | M, | |||
G4String | base, | |||
G4String | rest, | |||
G4bool & | active | |||
) |
Definition at line 65 of file G4NeutronHPNames.cc.
References G4cerr, G4cout, G4endl, G4NeutronHPDataUsed::GetA(), G4NeutronHPDataUsed::GetName(), G4NeutronHPDataUsed::GetZ(), G4SandiaTable::GetZtoA(), G4NeutronHPDataUsed::IsThisNaturalAbundance(), itoa(), G4NeutronHPDataUsed::SetA(), G4NeutronHPDataUsed::SetM(), G4NeutronHPDataUsed::SetName(), G4NeutronHPDataUsed::SetNaturalAbundanceFlag(), G4NeutronHPDataUsed::SetZ(), theMaxOffSet, and theString.
00066 { 00067 00068 //G4cout << Z << " " << A << " " << M << " " << base << " " << rest << G4endl; 00069 00070 //Excited isomer indicator 00071 std::stringstream ss; 00072 G4String sM; 00073 if ( M > 0 ) 00074 { 00075 ss << "m"; 00076 ss << M; 00077 ss >> sM; 00078 ss.clear(); 00079 } 00080 00081 G4NeutronHPDataUsed result; 00082 aFlag = true; 00083 if(getenv("NeutronHPNames")) G4cout << "Names::GetName entered for Z = " << Z << ", A = " << A <<G4endl; 00084 00085 G4int myA = A; 00086 G4int myZ = Z; 00087 00088 if(Z>92.5&&!getenv("AllowForHeavyElements") ) 00089 { 00090 //G4cerr << "Please contact Hans-Peter.Wellisch@cern.ch"<<G4endl; 00091 G4cerr << "Please contact Geant4 Hadron Group Coordinator"<<G4endl; 00092 throw G4HadronicException(__FILE__, __LINE__, "G4NeutronHPNames::GetName - data with Z>92 are not provided"); 00093 } 00094 00095 G4String * theName = 0; 00096 G4String theFileName(""); 00097 00098 // G4int inc = 1; 00099 00100 G4int flip_Z = 1; 00101 G4int delta_Z = 0; 00102 00103 G4int flip_A = 1; 00104 G4int delta_A = 0; 00105 00106 std::ifstream * check = new std::ifstream(".dummy"); 00107 G4bool first = true; 00108 if(getenv("NeutronHPNames")) G4cout << "entered GetName!!!"<<G4endl; 00109 do 00110 { 00111 aFlag = true; 00112 G4String * biff = new G4String(); // delete here as theName 00113 *biff = base+"/CrossSection/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1]; 00114 00115 if(theName!=0) delete theName; 00116 theName = biff; 00117 result.SetName(*theName); 00118 result.SetA(myA); 00119 result.SetZ(myZ); 00120 result.SetM(M); 00121 if(getenv("NeutronHPNames")) G4cout <<"HPWD 1 "<<*theName<<G4endl; 00122 00123 // T.K. debug for memory leak 00124 if ( check != 0 ) 00125 { 00126 check->close(); 00127 delete check; 00128 } 00129 check = new std::ifstream(*theName); 00130 if ( !(*check) ) 00131 { 00132 check->close(); 00133 delete check; 00134 check = 0; 00135 aFlag = false; 00136 if ( first ) 00137 { 00138 aFlag = true; 00139 first = false; 00140 biff = new G4String(); // delete here as theName 00141 *biff = base+"/CrossSection/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1]; 00142 if(theName!=0) delete theName; 00143 theName = biff; 00144 if(getenv("NeutronHPNames")) G4cout <<"HPWD 2 "<<*theName<<G4endl; 00145 result.SetName(*theName); 00146 G4double natA = myZ/G4SandiaTable::GetZtoA(myZ); 00147 result.SetA(natA); 00148 result.SetZ(myZ); 00149 result.SetM(M); 00150 check = new std::ifstream(*theName); 00151 if ( !(*check) ) 00152 { 00153 check->close(); 00154 delete check; 00155 check = 0; 00156 aFlag = false; 00157 } 00158 else 00159 { 00160 biff = new G4String(); // delete here as theName 00161 if(theName!=0) delete theName; 00162 *biff = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1]; 00163 if ( rest=="/CrossSection" ) *biff = base+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1]; 00164 theName = biff; 00165 if(getenv("NeutronHPNames")) G4cout <<"HPWD 3 "<<*theName<<G4endl; 00166 result.SetName(*theName); 00167 natA = myZ/G4SandiaTable::GetZtoA(myZ); 00168 result.SetA(natA); 00169 result.SetZ(myZ); 00170 result.SetM(M); 00171 result.SetNaturalAbundanceFlag(); 00172 } 00173 } 00174 } 00175 else 00176 { 00177 // 070706 T. Koi Modified 00178 /* 00179 biff = new G4String(); // delete here as theName 00180 *biff = base+"/"+rest+itoa(myZ)+"_"+itoa(myA)+"_"+theString[myZ-1]; 00181 if(theName!=0) delete theName; 00182 theName = biff; 00183 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4 "<<*theName<<G4endl; 00184 result.SetName(*theName); 00185 result.SetA(myA); 00186 result.SetZ(myZ); 00187 */ 00188 00189 G4double tmpA = myA; 00190 std::ifstream* file = NULL; 00191 G4String fileName; 00192 00193 if ( rest == "/CrossSection" ) 00194 { 00195 00196 //fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1]; 00197 fileName = base+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1]; 00198 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4a "<<*theName<<G4endl; 00199 00200 } 00201 else 00202 { 00203 00204 // For FS 00205 fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+itoa(myA)+sM+"_"+theString[myZ-1]; 00206 file = new std::ifstream(fileName); 00207 00208 if ( *file ) 00209 { 00210 00211 // isotope FS 00212 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b1 "<<*theName<<G4endl; 00213 } 00214 else 00215 { 00216 00217 // _nat_ FS 00218 fileName = base+"/"+rest+"/"+itoa(myZ)+"_"+"nat"+"_"+theString[myZ-1]; 00219 00220 delete file; 00221 file = new std::ifstream(fileName); 00222 if ( *file ) 00223 { 00224 00225 // FS neither isotope nor _nat_ 00226 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2a "<<*theName<<G4endl; 00227 G4double natA = myZ/G4SandiaTable::GetZtoA(myZ); 00228 tmpA = natA; 00229 } 00230 else 00231 { 00232 if(getenv("NeutronHPNames")) G4cout <<"HPWD 4b2c "<<*theName<<G4endl; 00233 fileName="INVALID"; 00234 } 00235 } 00236 00237 delete file; 00238 00239 } 00240 00241 result.SetName(fileName); 00242 result.SetA(tmpA); 00243 result.SetZ(myZ); 00244 result.SetM(M); 00245 00246 } 00247 00248 do 00249 { 00250 // if (std::abs(myZ-Z)>theMaxOffSet||myZ==0||myA==0) 00251 if ( delta_Z > theMaxOffSet ) 00252 { 00253 //if ( inc > 0 ) 00254 //{ 00255 // inc*= -1; 00256 // myZ = Z; 00257 // myA = A; 00258 //} 00259 //else 00260 //{ 00261 G4cout <<"G4NeutronHPNames: Sorry, this material does not come near to any data."<<G4endl; 00262 G4cout <<"G4NeutronHPNames: Please make sure G4NEUTRONHPDATA points to the" << G4endl; 00263 G4cout <<" directory, the neutron scattering data are located in." << G4endl; 00264 G4cout << "G4NeutronHPNames: The material was: A="<<A<<", Z="<<Z<<G4endl; 00265 //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"); 00266 throw G4HadronicException(__FILE__, __LINE__, "In case the data sets are at present not available in the neutron data library, please contact Hadron Group Coordinator"); 00267 delete theName; 00268 theFileName = ""; 00269 return result; 00270 //} 00271 } 00272 00273 //if ( std::abs( myA - A ) > theMaxOffSet ) 00274 if ( delta_A > 2*theMaxOffSet ) 00275 { 00276 delta_A = 0; 00277 flip_A = 1; 00278 00279 first = true; 00280 00281 if ( flip_Z > 0 ) 00282 { 00283 delta_Z +=1; 00284 } 00285 myZ = Z + flip_Z * delta_Z; 00286 flip_Z *= -1; 00287 00288 myA = A; 00289 if ( myZ > 100 ) 00290 { 00291 myZ = 100; 00292 } 00293 if ( myZ < 1 ) 00294 { 00295 myZ = 1; 00296 } 00297 00298 // myZ += inc; 00299 } 00300 else 00301 { 00302 if ( flip_A > 0 ) 00303 { 00304 delta_A += 1; 00305 } 00306 myA = A + flip_A * delta_A; 00307 flip_A *= -1; 00308 00309 if ( myA < 1 ) 00310 { 00311 myA = 1; 00312 } 00313 00314 // myA += inc; 00315 } 00316 00317 } 00318 while( myZ == 0 || myA == 0 ); // No meaning 00319 00320 } 00321 while((!check) || (!(*check))); 00322 00323 if(getenv("NeutronHPNamesLogging") || getenv("NeutronHPNames")) 00324 { 00325 G4cout << "Names::GetName: last theName proposal = "<< G4endl; 00326 G4cout << *theName <<" "<<A<<" "<<Z<<" "<<result.GetName()<<G4endl; 00327 } 00328 00329 // administration and anouncement for lacking of exact data in NDL 00330 if ( Z != result.GetZ() || A != result.GetA() ) 00331 { 00332 if ( rest == "/CrossSection" ) 00333 { 00334 G4String reac = base; 00335 G4String dir = getenv("G4NEUTRONHPDATA"); 00336 reac.erase ( 0 , dir.length() ); 00337 if ( getenv ( "G4NEUTRONHP_SKIP_MISSING_ISOTOPES" ) && !( Z == result.GetZ() && result.IsThisNaturalAbundance() ) ) 00338 { 00339 G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and CrossSection set to 0." << G4endl; 00340 G4String new_name = base+"/"+rest+"/"+"0_0_Zero"; 00341 result.SetName( new_name ); 00342 } 00343 else 00344 { 00345 //080901 Add protection that deuteron data do not selected for hydrogen and so on by T. Koi 00346 if ( ( reac.find("Inelastic") != reac.size() && ( (Z == 1 && A == 1) || (Z == 2 && A == 4) ) ) 00347 || ( reac.find("Capture") != reac.size() && ( (Z == 1 && A == 3) || (Z == 2 && A == 4) ) ) 00348 || ( reac.find("Fission") != reac.size() && ( (Z == 88 && A == 224) || (Z == 88 && A == 225) || (Z == 89 && A == 225) || (Z == 88 && A == 226) ) ) ) 00349 00350 { 00351 G4String new_name = base+"/"+rest+"/"+"0_0_Zero"; 00352 result.SetName( new_name ); 00353 } 00354 else 00355 { 00356 G4cout << "NeutronHP: " << reac << " file for Z = " << Z << ", A = " << A << " is not found and NeutronHP will use " << result.GetName() << G4endl; 00357 } 00358 } 00359 } 00360 } 00361 00362 delete theName; 00363 if(aFlag) 00364 { 00365 check->close(); 00366 delete check; 00367 check = 0; 00368 } 00369 return result; 00370 }
G4NeutronHPDataUsed G4NeutronHPNames::GetName | ( | G4int | A, | |
G4int | Z, | |||
G4String | base, | |||
G4String | rest, | |||
G4bool & | active | |||
) | [inline] |
Definition at line 48 of file G4NeutronHPNames.hh.
Referenced by G4NeutronHPorLFissionModel::ApplyYourself(), G4NeutronHPorLElasticModel::ApplyYourself(), G4NeutronHPorLEInelasticModel::ApplyYourself(), G4NeutronHPorLCaptureModel::ApplyYourself(), G4NeutronHPJENDLHEData::BuildPhysicsTable(), G4NeutronHPIsoData::GetName(), G4NeutronIsoIsoCrossSections::Init(), G4NeutronHPIsoData::Init(), G4NeutronHPInelasticCompFS::Init(), G4NeutronHPInelasticBaseFS::Init(), G4NeutronHPFSFissionFS::Init(), G4NeutronHPFissionBaseFS::Init(), G4NeutronHPFFFissionFS::Init(), G4NeutronHPElasticFS::Init(), G4NeutronHPCaptureFS::Init(), and G4FissionLibrary::Init().
G4String G4NeutronHPNames::itoa | ( | int | current | ) | [inline] |
Definition at line 57 of file G4NeutronHPNames.hh.
Referenced by GetName().
00058 { 00059 const char theDigits[11] = "0123456789"; 00060 G4String result; 00061 int digit; 00062 do 00063 { 00064 digit = current-10*(current/10); 00065 result=theDigits[digit]+result; 00066 current/=10; 00067 } 00068 while(current!=0); 00069 return result; 00070 }
void G4NeutronHPNames::SetMaxOffSet | ( | G4int | anOffset | ) | [inline] |
Definition at line 51 of file G4NeutronHPNames.hh.
References theMaxOffSet.
Referenced by G4NeutronIsoIsoCrossSections::Init().
00051 { theMaxOffSet = anOffset; }
Definition at line 56 of file G4NeutronHPNames.hh.
Referenced by G4NeutronHPNames(), GetName(), and SetMaxOffSet().
const G4String G4NeutronHPNames::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 G4NeutronHPNames.hh.
Referenced by GetName().