288{
289
290 static std::vector <G4double> PIN;
291
293 onlyCS=CS;
294#ifdef debug
295 G4cout<<
"G4QNeutronElasticCrosS::CalcCS:->onlyCS="<<onlyCS<<
",F="<<F<<
",p="<<pIU<<
G4endl;
296#endif
297 lastLP=std::log(pMom);
298 if(F)
299 {
300 if(F<0)
301 {
302 lastPIN = PIN[I];
303 lastPAR = PAR[I];
304 lastCST = CST[I];
305 lastSST = SST[I];
306 lastS1T = S1T[I];
307 lastB1T = B1T[I];
308 lastS2T = S2T[I];
309 lastB2T = B2T[I];
310 lastS3T = S3T[I];
311 lastB3T = B3T[I];
312 lastS4T = S4T[I];
313 lastB4T = B4T[I];
314#ifdef debug
315 G4cout<<
"G4QNElasticCS::CalcCS: DB is updated for I="<<I<<
",*,PIN4="<<PIN[4]<<
G4endl;
316#endif
317 }
318#ifdef debug
319 G4cout<<
"G4QNeutronElasticCrosS::CalcCS:*read*, LP="<<lastLP<<
",PIN="<<lastPIN<<
G4endl;
320#endif
321 if(lastLP>lastPIN && lastLP<lPMax)
322 {
323 lastPIN=GetPTables(lastLP,lastPIN,PDG,tgZ,tgN);
324#ifdef debug
325 G4cout<<
"G4QNElCrS::CalcCS:updated(I),LP="<<lastLP<<
"<IN["<<I<<
"]="<<lastPIN<<
G4endl;
326#endif
327 PIN[I]=lastPIN;
328 }
329 }
330 else
331 {
333 lastPAR[nLast]=0;
344#ifdef debug
345 G4cout<<
"G4QNeutronElasticCrosS::CalcCS:*ini*,lastLP="<<lastLP<<
",min="<<lPMin<<
G4endl;
346#endif
347 lastPIN = GetPTables(lastLP,lPMin,PDG,tgZ,tgN);
348#ifdef debug
349 G4cout<<
"G4QNElCS::CalcCS:i,Z="<<tgZ<<
",N="<<tgN<<
",PDG="<<PDG<<
",LP"<<lastPIN<<
G4endl;
350#endif
351 PIN.push_back(lastPIN);
352 PAR.push_back(lastPAR);
353 CST.push_back(lastCST);
354 SST.push_back(lastSST);
355 S1T.push_back(lastS1T);
356 B1T.push_back(lastB1T);
357 S2T.push_back(lastS2T);
358 B2T.push_back(lastB2T);
359 S3T.push_back(lastS3T);
360 B3T.push_back(lastB3T);
361 S4T.push_back(lastS4T);
362 B4T.push_back(lastB4T);
363 }
364
365#ifdef debug
366 G4cout<<
"G4QNElCrS::CalcCS:?update?,LP="<<lastLP<<
",IN="<<lastPIN<<
",ML="<<lPMax<<
G4endl;
367#endif
368 if(lastLP>lastPIN && lastLP<lPMax)
369 {
370 lastPIN = GetPTables(lastLP,lastPIN,PDG,tgZ,tgN);
371#ifdef debug
372 G4cout<<
"G4QNeutronElCrS::CalcCS:*updated(O)*, LP="<<lastLP<<
" < IN="<<lastPIN<<
G4endl;
373#endif
374 }
375#ifdef debug
376 G4cout<<
"G4QNEltCrS::CalcCS: lastLP="<<lastLP<<
",lPM="<<lPMin<<
",lPIN="<<lastPIN<<
G4endl;
377#endif
378 if(!onlyCS) lastTM=GetQ2max(PDG, tgZ, tgN, pMom);
379#ifdef debug
380 G4cout<<
"G4QNeutElastCroSec::CalcCS:oCS="<<onlyCS<<
",-t="<<lastTM<<
",p="<<lastLP<<
G4endl;
381#endif
382 if(lastLP>lPMin && lastLP<=lastPIN)
383 {
384 if(lastLP==lastPIN)
385 {
386 G4double shift=(lastLP-lPMin)/dlnP+.000001;
387 G4int blast=
static_cast<int>(shift);
388 if(blast<0 || blast>=nLast)
G4cout<<
"G4QNeutElCS::CCS:b="<<blast<<
","<<nLast<<
G4endl;
389 lastSIG = lastCST[blast];
390 if(!onlyCS)
391 {
392 theSS = lastSST[blast];
393 theS1 = lastS1T[blast];
394 theB1 = lastB1T[blast];
395 theS2 = lastS2T[blast];
396 theB2 = lastB2T[blast];
397 theS3 = lastS3T[blast];
398 theB3 = lastB3T[blast];
399 theS4 = lastS4T[blast];
400 theB4 = lastB4T[blast];
401 }
402#ifdef debug
403 G4cout<<
"G4QNeutronElasticCrossSection::CalcCS:(E)S1="<<theS1<<
",B1="<<theB1<<
G4endl;
404#endif
405 }
406 else
407 {
409 G4int blast=
static_cast<int>(shift);
410 if(blast<0) blast=0;
411 if(blast>=nLast) blast=nLast-1;
412 shift-=blast;
415 lastSIG= SIGL+shift*(lastCST[lastL]-SIGL);
416#ifdef debug
417 G4cout<<
"G4QNeutronElCS::CalcCrossSection: Sig="<<lastSIG<<
", P="<<pMom<<
", Z="<<tgZ
418 <<
", N="<<tgN<<
", PDG="<<PDG<<
", onlyCS="<<onlyCS<<
G4endl;
419#endif
420 if(!onlyCS)
421 {
423 theSS=SSTL+shift*(lastSST[lastL]-SSTL);
425 theS1=S1TL+shift*(lastS1T[lastL]-S1TL);
427#ifdef debug
428 G4cout<<
"G4QNeutronElCrS::CalcCrossSection:bl="<<blast<<
",ls="<<lastL<<
",SL="<<S1TL
429 <<
",SU="<<lastS1T[lastL]<<
",BL="<<B1TL<<
",BU="<<lastB1T[lastL]<<
G4endl;
430#endif
431 theB1=B1TL+shift*(lastB1T[lastL]-B1TL);
433 theS2=S2TL+shift*(lastS2T[lastL]-S2TL);
435 theB2=B2TL+shift*(lastB2T[lastL]-B2TL);
437 theS3=S3TL+shift*(lastS3T[lastL]-S3TL);
438#ifdef debug
439 G4cout<<
"G4QNElCS::CCS: s3l="<<S3TL<<
",sh3="<<shift<<
",s3h="<<lastS3T[lastL]<<
",b="
440 <<blast<<
",l="<<lastL<<
G4endl;
441#endif
443 theB3=B3TL+shift*(lastB3T[lastL]-B3TL);
445 theS4=S4TL+shift*(lastS4T[lastL]-S4TL);
446#ifdef debug
447 G4cout<<
"G4QNElCS::CCS: s4l="<<S4TL<<
",sh4="<<shift<<
",s4h="<<lastS4T[lastL]<<
",b="
448 <<blast<<
",l="<<lastL<<
G4endl;
449#endif
451 theB4=B4TL+shift*(lastB4T[lastL]-B4TL);
452 }
453#ifdef debug
454 G4cout<<
"G4QNeutronElasticCrossSection::CalcCS:(I)S1="<<theS1<<
",B1="<<theB1<<
G4endl;
455#endif
456 }
457 }
458 else lastSIG=GetTabValues(lastLP, PDG, tgZ, tgN);
459 if(lastSIG<0.) lastSIG = 0.;
460#ifdef debug
461 G4cout<<
"G4QNeutronElasticCrossSection::CalculateCS: END, onlyCS="<<onlyCS<<
G4endl;
462#endif
463 return lastSIG;
464}
G4DLLIMPORT std::ostream G4cout