99{
100
101
102
103 std::stringstream ss;
106 ss << "m";
108 ss >> sM;
109 ss.clear();
110 }
111
113 aFlag = true;
114
115#ifdef G4VERBOSE
117 G4cout <<
"Names::GetName entered for Z = " << Z <<
", A = " <<
A <<
G4endl;
118#endif
119
122
125
126
127
130
133
134 std::istringstream* check = nullptr;
136
137#ifdef G4VERBOSE
140#endif
141
142 do {
143 aFlag = true;
145 *biff = base +
"/CrossSection/" +
itoa(myZ) +
"_" +
itoa(myA) + sM +
"_" + theString[myZ - 1];
146
147 delete theName;
148 theName = biff;
153 delete check;
154
155 check = new std::istringstream(std::ios::in);
157 if (!(*check)) {
158 delete check;
159 check = nullptr;
160 aFlag = false;
161 if (first) {
162 aFlag = true;
163 first = false;
165 *biff = base +
"/CrossSection/" +
itoa(myZ) +
"_" +
"nat" +
"_" + theString[myZ - 1];
166 delete theName;
167 theName = biff;
173
174 check = new std::istringstream(std::ios::in);
176 if (!(*check)) {
177
178 delete check;
179 check = nullptr;
180 aFlag = false;
181 }
182 else {
184 *biff = base +
"/" + rest +
"/" +
itoa(myZ) +
"_" +
"nat" +
"_" + theString[myZ - 1];
185 if (rest == "/CrossSection")
186 *biff = base + rest +
"/" +
itoa(myZ) +
"_" +
"nat" +
"_" + theString[myZ - 1];
187 delete theName;
188 theName = biff;
195 }
196 }
197 }
198 else {
200 std::istringstream* file = nullptr;
202
203 if (rest == "/CrossSection") {
204 fileName = base + rest +
"/" +
itoa(myZ) +
"_" +
itoa(myA) + sM +
"_" + theString[myZ - 1];
205
206 }
207 else {
208
209 fileName =
210 base +
"/" + rest +
"/" +
itoa(myZ) +
"_" +
itoa(myA) + sM +
"_" + theString[myZ - 1];
211 file = new std::istringstream(std::ios::in);
213
214 if (*file) {
215
216
217 }
218 else {
219
220 fileName = base +
"/" + rest +
"/" +
itoa(myZ) +
"_" +
"nat" +
"_" + theString[myZ - 1];
221
222 delete file;
223 file = new std::istringstream(std::ios::in);
225 if (*file) {
226
227
229 tmpA = natA;
230 }
231 else {
232
233 fileName = "INVALID";
234 }
235 }
236 delete file;
237 }
238
243 }
244
245 do {
246 if (delta_Z > theMaxOffSet) {
248#ifdef G4VERBOSE
250 G4cout <<
"G4ParticleHPNames: There are no data available for some isotopes in this "
251 "material "
253 G4cout <<
"G4ParticleHPNames: nor are there data for nearby isotopes." <<
G4endl;
254 G4cout <<
"G4ParticleHPNames: Please make sure G4NEUTRONHPDATA points to the directory "
256 G4cout <<
"G4ParticleHPNames: in which the neutron scattering data are located."
258 G4cout <<
"G4ParticleHPNames: The material was A = " <<
A <<
", Z = " << Z <<
G4endl;
259 }
260#endif
262 ed <<
"Data for Z=" << Z <<
" A=" <<
A <<
" M=" <<
M <<
" does not exist in G4NEUTRONHPDATA";
263 G4Exception(
"G4ParticleHPName::Init(...)",
"hadhp01",
265 }
266 check = new std::istringstream(std::ios::in);
267 break;
268 }
269 if (delta_A > 2 * theMaxOffSet) {
270 delta_A = 0;
271 flip_A = 1;
272
273 first = true;
274
275 if (flip_Z > 0) {
276 delta_Z += 1;
277 }
278 myZ = Z + flip_Z * delta_Z;
279 flip_Z *= -1;
280
282 if (myZ > 100) {
283 myZ = 100;
284 }
285 if (myZ < 1) {
286 myZ = 1;
287 }
288
289
290 }
291 else {
292 if (flip_A > 0) {
293 delta_A += 1;
294 }
295 myA =
A + flip_A * delta_A;
296 flip_A *= -1;
297
298 if (myA < 1) {
299 myA = 1;
300 }
301
302
303 }
304
305 } while (myZ == 0 || myA == 0);
306
307 } while ((check == nullptr) || (!(*check)));
308
309#ifdef G4VERBOSE
311 {
312 G4cout <<
"Names::GetName: last theName proposal = " <<
G4endl;
314 }
315#endif
316
317
318 if (Z != result.
GetZ() ||
A != result.
GetA()) {
319 if (rest == "/CrossSection") {
322 reac.erase(0, dir.length());
325 {
326#ifdef G4VERBOSE
328 G4cout <<
"NeutronHP: " << reac <<
" file for Z = " << Z <<
", A = " <<
A
329 <<
" is not found and CrossSection set to 0." <<
G4endl;
330 }
331#endif
332 G4String new_name = base +
"/" + rest +
"/" +
"0_0_Zero";
334 }
335 else {
336
337
338 if ((reac.find("Inelastic") != reac.size()
339 && ((Z == 1 &&
A == 1) || (Z == 1 &&
A == 2) || (Z == 1 &&
A == 3)
340 || (Z == 2 &&
A == 3) || (Z == 2 &&
A == 4)))
341 || (reac.find(
"Capture") != reac.size() && ((Z == 1 &&
A == 3) || (Z == 2 &&
A == 4)))
342 || (reac.find("Fission") != reac.size()
343 && ((Z == 88 &&
A == 224) || (Z == 88 &&
A == 225) || (Z == 89 &&
A == 225)
344 || (Z == 88 &&
A == 226))))
345
346 {
347 G4String new_name = base +
"/" + rest +
"/" +
"0_0_Zero";
349 }
350 else {
351#ifdef G4VERBOSE
353 G4cout <<
"NeutronHP: " << reac <<
" file for Z = " << Z <<
", A = " <<
A
354 <<
" is not found and NeutronHP will use " << result.
GetName() <<
G4endl;
355 }
356#endif
357 }
358 }
359 }
360 }
361
362 delete theName;
363 delete check;
364
365 return result;
366}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
void SetName(const G4String &aName)
G4bool IsThisNaturalAbundance()
void SetNaturalAbundanceFlag()
void GetDataStream2(const G4String &, std::istringstream &iss)
G4int GetVerboseLevel() const
const G4String & GetNeutronHPPath() const
G4bool GetSkipMissingIsotopes() const
G4String itoa(G4int current)
static G4double GetZtoA(G4int Z)