48std::vector<G4double*> G4QuasiFreeRatios::vT;
49std::vector<G4double*> G4QuasiFreeRatios::vL;
54 G4cout<<
"***^^^*** G4QuasiFreeRatios singletone is created ***^^^***"<<
G4endl;
61 std::vector<G4double*>::iterator pos;
62 for(pos=vT.begin(); pos<vT.end(); ++pos)
delete [] *pos;
64 for(pos=vL.begin(); pos<vL.end(); ++pos)
delete [] *pos;
80 G4cout<<
">>>IN>>>G4QFRat::GetQF:P="<<pIU<<
",pPDG="<<pPDG<<
",Z="<<tgZ<<
",N="<<tgN<<
G4endl;
85 if(tgA<2)
return std::make_pair(QF2In,R);
86 std::pair<G4double,G4double> ElTot=
GetElTot(pIU, pPDG, tgZ, tgN);
88 if(pPDG>999 && pIU<227. && tgZ+tgN>1) R=1.;
89 else if(ElTot.second>0.)
91 R=ElTot.first/ElTot.second;
92 QF2In=GetQF2IN_Ratio(ElTot.second/millibarn, tgZ+tgN);
95 G4cout<<
">>>OUT>>>G4QuasiFreeRatio::GetQF2IN_Ratio: QF2In="<<QF2In<<
", R="<<R<<
G4endl;
97 return std::make_pair(QF2In,R);
103 static const G4int nps=150;
104 static const G4int mps=nps+1;
107 static const G4int nls=100;
108 static const G4int mls=nls+1;
111 static const G4double mi=std::exp(lsi);
112 static const G4double max_s=std::exp(lsa);
113 static const G4double dl=(lsa-lsi)/nls;
114 static const G4double edl=std::exp(dl);
119 static std::vector<G4int> vA;
120 static std::vector<G4double> vH;
121 static std::vector<G4int> vN;
122 static std::vector<G4double> vM;
123 static std::vector<G4int> vK;
125 static G4int lastA=0;
127 static G4int lastN=0;
129 static G4int lastK=0;
134 G4cout<<
"+++G4QuasiFreeRatio::GetQF2IN_Ratio:A="<<A<<
", s="<<s_value<<
G4endl;
136 if(s_value<toler || A<2)
return 1.;
137 if(s_value>max_s)
return 0.;
140 G4cout<<
"-Warning-G4QuasiFreeRatio::GetQF2IN_Ratio:A="<<A<<
">238, return zero"<<
G4endl;
145 if(nDB && lastA==A && s_value==lastS)
return lastR;
148 if(nDB)
for (i=0; i<nDB; i++)
if(A==vA[i])
154 G4cout<<
"+++G4QuasiFreeRatio::GetQF2IN_Ratio: nDB="<<nDB<<
", found="<<found<<
G4endl;
160 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: NewT, A="<<A<<
", nDB="<<nDB<<
G4endl;
163 lastN =
static_cast<int>(s_value/ds)+1;
169 else lastH = lastN*ds;
172 for(
G4int j=1; j<=lastN; j++)
175 lastT[j]=CalcQF2IN_Ratio(sv,A);
181 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: NewL, A="<<A<<
", nDB="<<nDB<<
G4endl;
184 lastK =
static_cast<int>((ls-lsi)/dl)+1;
190 else lastM = lastK*dl;
192 for(
G4int j=0; j<=lastK; j++)
194 lastL[j]=CalcQF2IN_Ratio(sv,A);
195 if(j!=lastK) sv*=edl;
222 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: Found, s="<<s_value<<
", lastM="<<lastM<<
G4endl;
228 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: lastN="<<lastN<<
" ?< nps="<<nps<<
G4endl;
232 lastN =
static_cast<int>(s_value/ds)+1;
239 else lastH = lastN*ds;
240 for(
G4int j=nextN; j<=lastN; j++)
243 lastT[j]=CalcQF2IN_Ratio(sv,A);
246 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: End of LinTab update"<<
G4endl;
250 G4cout<<
"G4QFRatios::GetQF2IN_Ratio: lN="<<lastN<<
", nN="<<nextN<<
", i="<<i<<
G4endl;
260 G4cout<<
"G4QFRat::GetQF2IN_Ratio: sma="<<sma<<
", lastK="<<lastK<<
" < "<<nls<<
G4endl;
262 if(s_value>sma && lastK<nls)
266 lastK =
static_cast<int>((ls-lsi)/dl)+1;
272 else lastM = lastK*dl;
274 G4cout<<
"G4QFRat::GetQF2IN_Ratio: nK="<<nextK<<
", lK="<<lastK<<
", sv="<<sv<<
G4endl;
276 for(
G4int j=nextK; j<=lastK; j++)
280 G4cout<<
"G4QFRat::GetQF2IN_Ratio: j="<<j<<
", sv="<<sv<<
", A="<<A<<
G4endl;
282 lastL[j]=CalcQF2IN_Ratio(sv,A);
285 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: End of LinTab update"<<
G4endl;
289 G4cout<<
"G4QFRatios::GetQF2IN_Ratio: lK="<<lastK<<
", nK="<<nextK<<
", i="<<i<<
G4endl;
299 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: BeforeTab s="<<s_value<<
", sma="<<sma<<
G4endl;
304 G4int n=
static_cast<int>(s_value/ds);
307 lastR=v+d*(lastT[
n+1]-v)/ds;
312 G4int n=
static_cast<int>(ls/dl);
315 lastR=v+d*(lastL[
n+1]-v)/dl;
317 if(lastR<0.) lastR=0.;
318 if(lastR>1.) lastR=1.;
320 G4cout<<
"G4QuasiFreeRatios::GetQF2IN_Ratio: BeforeRet lastR="<<lastR<<
G4endl;
331 G4double ss=std::sqrt(std::sqrt(s_value));
332 G4double P=7.48e-5*s2/(1.+8.77e12/s4/s4/s2);
333 G4double E=.2644+.016/(1.+std::exp((29.54-s_value)/2.49));
334 G4double F=ss*.1526*std::exp(-s2*ss*.0000859);
344 if(PDG==130||PDG==310)
349 if ( (PDG == 2212 && F) || (PDG == 2112 && !F) ) ind=0;
350 else if ( (PDG == 2112 && F) || (PDG == 2212 && !F) ) ind=1;
351 else if ( (PDG == -211 && F) || (PDG == 211 && !F) ) ind=2;
352 else if ( (PDG == 211 && F) || (PDG == -211 && !F) ) ind=3;
353 else if ( PDG == -321 || PDG == -311 || (kf && !kfl) ) ind=4;
354 else if ( PDG == 321 || PDG == 311 || (kf && kfl) ) ind=5;
355 else if ( PDG > 3000 && PDG < 3335) ind=6;
356 else if ( PDG > -3335 && PDG < -2000) ind=7;
358 G4cout<<
"*Error*G4QuasiFreeRatios::CalcElTotXS: PDG="<<PDG
359 <<
", while it is defined only for p,n,hyperons,anti-baryons,pi,K/antiK"<<
G4endl;
371 G4cout<<
"-->G4QuasiFreeR::GetElTot: P="<<pIU<<
",pPDG="<<hPDG<<
",Z="<<Z<<
",N="<<N<<
G4endl;
375 G4cout<<
"-Warning-G4QuasiFreeRatio::GetElTot:Z="<<Z<<
",N="<<N<<
", return zero"<<
G4endl;
376 return std::make_pair(0.,0.);
378 std::pair<G4double,G4double> hp=QFreeScat->
FetchElTot(pGeV, hPDG,
true);
379 std::pair<G4double,G4double> hn=QFreeScat->
FetchElTot(pGeV, hPDG,
false);
381 G4cout<<
"-OUT->G4QFRat::GetElTot: hp("<<hp.first<<
","<<hp.second<<
"), hn("<<hn.first<<
","
385 return std::make_pair((Z*hp.first+N*hn.first)/A,(Z*hp.second+N*hn.second)/A);
397 G4cout<<
"-Warning-G4QuasiFreeRatio::GetChExF:Z="<<Z<<
",N="<<N<<
", return zero"<<
G4endl;
398 return std::make_pair(resP,resN);
403 if (hPDG==-211||hPDG==-321||hPDG==3112||hPDG==3212||hPDG==3312||hPDG==3334) pf=Z/(A+N);
404 else if(hPDG==211||hPDG==321||hPDG==3222||hPDG==3212||hPDG==3322) nf=N/(A+Z);
405 else if(hPDG==-311||hPDG==311||hPDG==130||hPDG==310)
414 mult=1./(1.+std::log(pGeV+pGeV))/pGeV;
419 std::pair<G4double,G4double> hp=QFreeScat->
FetchElTot(pGeV, hPDG,
true);
420 resP=pf*(hp.second/hp.first-1.)*mult;
424 std::pair<G4double,G4double> hn=QFreeScat->
FetchElTot(pGeV, hPDG,
false);
425 resN=nf*(hn.second/hn.first-1.)*mult;
427 return std::make_pair(resP,resN);
442 static const G4double two3d2= std::pow(2.,two3d);
443 static const G4double two3d3= std::pow(3.,two3d);
444 static const G4double two3d4= std::pow(4.,two3d);
446 N4M/=megaelectronvolt;
449 G4cerr<<
"->G4QFR::Scat:p4M="<<pr4M<<
",N4M="<<N4M<<
",t4M="<<tot4M<<
",NPDG="<<NPDG<<
G4endl;
454 if(NPDG==2212||NPDG==90001000)
460 else if(NPDG==90001001)
466 else if(NPDG==90002001)
472 else if(NPDG==90001002)
478 else if(NPDG==90002002)
484 else if(NPDG!=2112&&NPDG!=90000001)
486 G4cout<<
"Error:G4QuasiFreeRatios::Scatter:NPDG="<<NPDG<<
" is not 2212 or 2112"<<
G4endl;
494 G4cerr<<
"G4QFR::Scat:qM="<<mT<<
",qM2="<<mT2<<
",pM2="<<mP2<<
",totM2="<<tot4M.
m2()<<
G4endl;
500 G4cerr<<
"-Warning-G4QFR::Scat:*Negative Energy*E="<<E<<
",E2="<<E2<<
"<M2="<<mP2<<
G4endl;
508 G4cout<<
"G4QFR::Scatter: Before XS, P="<<P<<
", Z="<<Z<<
", N="<<N<<
", PDG="<<pPDG<<
G4endl;
511 if(pPDG>3400 || pPDG<-3400)
G4cout<<
"-Warning-G4QuasiFree::Scatter: pPDG="<<pPDG<<
G4endl;
513 if(pPDG==2112||pPDG==-211||pPDG==-321) PDG=2112;
518 if (PDG==2212) PDG=2112;
519 else if(PDG==2112) PDG=2212;
525 G4cout<<
"G4QuasiFreeRat::Scatter: pPDG="<<pPDG<<
",P="<<P<<
",CS="<<xSec/millibarn<<
G4endl;
528 if(xSec>0. || xSec<0. || xSec==0);
529 else G4cout<<
"*Warning*G4QuasiFreeRatios::Scatter: xSec="<<xSec/millibarn<<
G4endl;
535 G4cerr<<
"-Warning-G4QFR::Scat:**Zero XS**PDG="<<pPDG<<
",NPDG="<<NPDG<<
",P="<<P<<
G4endl;
542 if (mT==mDeut) mint/=two3d2;
543 else if(mT==mTrit || mT==mHel3) mint/=two3d3;
544 else if(mT==mAlph) mint/=two3d4;
546 if(PDG==2212) maxt=PCSmanager->
GetHMaxT();
549 G4cout<<
"G4QFR::Scat:PDG="<<PDG<<
",P="<<P<<
",X="<<xSec<<
",-t="<<mint<<
"<"<<maxt<<
", Z="
558 G4cout<<
"G4QFR::Scat:-t="<<mint<<
"<"<<maxt<<
", cost="<<cost<<
", Z="<<Z<<
",N="<<N<<
G4endl;
560 if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
562 if (cost>1.) cost=1.;
563 else if(cost<-1.) cost=-1.;
567 if(PDG==2212) tm=PCSmanager->
GetHMaxT();
569 G4cerr<<
"G4QuasiFreeRatio::Scat:*NAN* cost="<<cost<<
",-t="<<mint<<
",tm="<<tm<<
G4endl;
575 if(!
G4QHadron(tot4M).RelDecayIn2(pr4M, reco4M, dir4M, cost, cost))
577 G4cerr<<
"G4QFR::Scat:t="<<tot4M<<tot4M.
m()<<
",mT="<<mT<<
",mP="<<std::sqrt(mP2)<<
G4endl;
582 G4cout<<
"G4QFR::Scat:p4M="<<pr4M<<
"+r4M="<<reco4M<<
",dr="<<dir4M<<
",t4M="<<tot4M<<
G4endl;
584 return std::make_pair(reco4M*megaelectronvolt,pr4M*megaelectronvolt);
596 N4M/=megaelectronvolt;
603 G4cout<<
"-Warning-G4QFR::ChEx: Impossible for Omega-"<<
G4endl;
609 if(pPDG==-211) sPDG=111;
615 else if(pPDG==-311||pPDG==311||pPDG==130||pPDG==310) sPDG=321;
616 else if(pPDG==3112) sPDG=3212;
617 else if(pPDG==3212) sPDG=3222;
618 else if(pPDG==3312) sPDG=3322;
622 if(pPDG==211) sPDG=111;
628 else if(pPDG==-311||pPDG==311||pPDG==130||pPDG==310) sPDG=-321;
629 else if(pPDG==3222) sPDG=3212;
630 else if(pPDG==3212) sPDG=3112;
631 else if(pPDG==3322) sPDG=3312;
635 G4cout<<
"Error:G4QuasiFreeRatios::ChExer: NPDG="<<NPDG<<
" is not 2212 or 2112"<<
G4endl;
642 G4cout<<
"Error:G4QuasiFreeRatios::ChExer: BAD pPDG="<<pPDG<<
", NPDG="<<NPDG<<
G4endl;
653 G4cerr<<
"-Warning-G4QFR::ChEx:*Negative Energy*E="<<E<<
",E2="<<E2<<
"<M2="<<mS2<<
G4endl;
661 G4cout<<
"G4QFR::ChExer: Before XS, P="<<P<<
", Z="<<Z<<
", N="<<N<<
", PDG="<<pPDG<<
G4endl;
665 if(pPDG==2112||pPDG==-211||pPDG==-321) PDG=2112;
670 if (PDG==2212) PDG=2112;
671 else if(PDG==2112) PDG=2212;
677 G4cout<<
"G4QuasiFreeRat::ChExer: pPDG="<<pPDG<<
",P="<<P<<
", CS="<<xSec/millibarn<<
G4endl;
680 if(xSec>0. || xSec<0. || xSec==0);
681 else G4cout<<
"*Warning*G4QuasiFreeRatios::ChExer: xSec="<<xSec/millibarn<<
G4endl;
687 G4cerr<<
"-Warning-G4QFR::ChEx:**Zero XS**PDG="<<pPDG<<
",NPDG="<<NPDG<<
",P="<<P<<
G4endl;
695 G4cout<<
"G4QFR::ChEx:PDG="<<pPDG<<
", P="<<P<<
", CS="<<xSec<<
", -t="<<mint<<
G4endl;
699 else G4cout<<
"*Warning*G4QFR::ChExer: -t="<<mint<<
G4endl;
702 if(PDG==2212) maxt=PCSmanager->
GetHMaxT();
706 G4cout<<
"G4QuasiFfreeRatio::ChExer: -t="<<mint<<
", maxt="<<maxt<<
", cost="<<cost<<
G4endl;
708 if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
710 if (cost>1.) cost=1.;
711 else if(cost<-1.) cost=-1.;
714 G4cerr<<
"G4QuasiFreeRatio::ChExer:*NAN* c="<<cost<<
",t="<<mint<<
",tm="<<maxt<<
G4endl;
721 if(!
G4QHadron(tot4M).RelDecayIn2(pr4M, reco4M, dir4M, cost, cost))
723 G4cerr<<
"G4QFR::ChEx:t="<<tot4M<<tot4M.
m()<<
",mT="<<mT<<
",mP="<<mS<<
G4endl;
728 G4cout<<
"G4QFR::ChEx:p4M="<<p4M<<
"+r4M="<<reco4M<<
"="<<p4M+reco4M<<
"="<<tot4M<<
G4endl;
730 return std::make_pair(reco4M*megaelectronvolt,pr4M*megaelectronvolt);
740 if (pPDG==2212) C=N/(A+Z);
741 else if(pPDG==2112) C=Z/(A+N);
742 else G4cout<<
"*Warning*G4QCohChrgExchange::ChExElCoef: wrong PDG="<<pPDG<<
G4endl;
749 G4double T=(6.75+.14*dl1*dl1+13./p)/(1.+.14/p4)+.6/(p4+.00013);
750 G4double U=(6.25+8.33e-5/p4/p)*(p*sp+.34)/p2/p;
CLHEP::HepLorentzVector G4LorentzVector
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
std::pair< G4double, G4double > FetchElTot(G4double pGeV, G4int PDG, G4bool F)
std::pair< G4double, G4double > CalcElTot(G4double pGeV, G4int Index)
static G4QFreeScattering * GetPointer()
static G4VQCrossSection * GetPointer()
G4double GetNuclMass(G4int Z, G4int N, G4int S)
static G4VQCrossSection * GetPointer()
std::pair< G4LorentzVector, G4LorentzVector > ChExer(G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M)
std::pair< G4double, G4double > GetChExFactor(G4double pIU, G4int pPDG, G4int Z, G4int N)
G4double ChExElCoef(G4double p, G4int Z, G4int N, G4int pPDG)
std::pair< G4LorentzVector, G4LorentzVector > Scatter(G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M)
std::pair< G4double, G4double > GetElTot(G4double pIU, G4int hPDG, G4int Z, G4int N)
static G4QuasiFreeRatios * GetPointer()
std::pair< G4double, G4double > GetElTotXS(G4double Mom, G4int PDG, G4bool F)
std::pair< G4double, G4double > GetRatios(G4double pIU, G4int prPDG, G4int tgZ, G4int tgN)
virtual G4double GetExchangeT(G4int tZ, G4int tN, G4int pPDG)
virtual G4double GetCrossSection(G4bool, G4double, G4int, G4int, G4int pPDG=0)
virtual G4double GetHMaxT()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)