288{
289
290 static std::vector <G4double> PIN;
291
293 onlyCS=CS;
294#ifdef pdebug
295 G4cout<<
"G4QProtonElasticCrossS::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 pdebug
315 G4cout<<
"G4QElasticCS::CalcCS: DB is updated for I="<<I<<
",*,PIN4="<<PIN[4]<<
G4endl;
316#endif
317 }
318#ifdef pdebug
319 G4cout<<
"G4QProtonElasticCrossS::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 pdebug
325 G4cout<<
"G4QElCS::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 pdebug
345 G4cout<<
"G4QProtonElasticCrossS::CalcCS:*ini*,lastLP="<<lastLP<<
",min="<<lPMin<<
G4endl;
346#endif
347 lastPIN = GetPTables(lastLP,lPMin,PDG,tgZ,tgN);
348#ifdef pdebug
349 G4cout<<
"G4QProtElCS::CCS: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 pdebug
366 G4cout<<
"G4QElCS::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 pdebug
372 G4cout<<
"G4QElCS::CalcCS: *updated(O)*, LP="<<lastLP<<
" < IN="<<lastPIN<<
G4endl;
373#endif
374 }
375#ifdef pdebug
376 G4cout<<
"G4QElastCS::CalcCS: lastLP="<<lastLP<<
",lPM="<<lPMin<<
",lPIN="<<lastPIN<<
G4endl;
377#endif
378 if(!onlyCS) lastTM=GetQ2max(PDG, tgZ, tgN, pMom);
379#ifdef pdebug
380 G4cout<<
"G4QElasticCrosSec::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<<
"G4QEleastCS::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 pdebug
403 G4cout<<
"G4QProtonElasticCrossS::CalculateCS:(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 pdebug
417 G4cout<<
"G4QElCS::CalcCrossSection: Sig="<<lastSIG<<
", P="<<pMom<<
", Z="<<tgZ<<
", N="
418 <<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 pdebug
428 G4cout<<
"G4QElCS::CalcCrossSection:bl="<<blast<<
",ls="<<lastL<<
",SL="<<S1TL<<
",SU="
429 <<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 pdebug
439 G4cout<<
"G4QElCS::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 pdebug
447 G4cout<<
"G4QElCS::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 pdebug
454 G4cout<<
"G4QProtonElasticCrossS::CalculateCS:(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 pdebug
461 G4cout<<
"G4QProtonElasticCrossSection::CalculateCS: END, onlyCS="<<onlyCS<<
G4endl;
462#endif
463 return lastSIG;
464}
G4DLLIMPORT std::ostream G4cout