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