00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "G4QDiffractionRatio.hh"
00045 #include "G4SystemOfUnits.hh"
00046
00047
00048 G4QDiffractionRatio* G4QDiffractionRatio::GetPointer()
00049 {
00050 static G4QDiffractionRatio theRatios;
00051 return &theRatios;
00052 }
00053
00054
00055 G4double G4QDiffractionRatio::GetRatio(G4double pIU, G4int pPDG, G4int tgZ, G4int tgN)
00056 {
00057 static const G4double mNeut= G4QPDGCode(2112).GetMass()/GeV;
00058 static const G4double mProt= G4QPDGCode(2212).GetMass()/GeV;
00059 static const G4double mN=.5*(mNeut+mProt);
00060 static const G4double dmN=mN+mN;
00061 static const G4double mN2=mN*mN;
00062
00063 static const G4int nps=100;
00064 static const G4int mps=nps+1;
00065 static const G4double sma=6.;
00066 static const G4double ds=sma/nps;
00067 static const G4int nls=150;
00068 static const G4int mls=nls+1;
00069 static const G4double lsi=1.79;
00070 static const G4double lsa=8.;
00071 static const G4double mi=std::exp(lsi);
00072 static const G4double max_s=std::exp(lsa);
00073 static const G4double dl=(lsa-lsi)/nls;
00074 static const G4double edl=std::exp(dl);
00075 static const G4double toler=.0001;
00076 static G4double lastS=0.;
00077 static G4double lastR=0.;
00078
00079 static std::vector<G4int> vA;
00080
00081
00082
00083
00084 static std::vector<G4double*> vT;
00085 static std::vector<G4double*> vL;
00086
00087
00088 static G4int lastA=0;
00089
00090
00091
00092
00093 static G4double* lastT=0;
00094 static G4double* lastL=0;
00095
00096 G4int A=tgN+tgZ;
00097 if(pIU<toler || A<1) return 1.;
00098 if(A>238)
00099 {
00100 G4cout<<"-*-Warning-*-G4QuasiFreeRatio::GetRatio: A="<<A<<">238, return zero"<<G4endl;
00101 return 0.;
00102 }
00103
00104
00105 G4double pM=G4QPDGCode(pPDG).GetMass()/GeV;
00106 G4double pM2=pM*pM;
00107 G4double mom=pIU/GeV;
00108 G4double s_value=std::sqrt(mN2+pM2+dmN*std::sqrt(pM2+mom*mom));
00109 G4int nDB=vA.size();
00110 if(nDB && lastA==A && std::fabs(s_value-lastS)<toler) return lastR;
00111 if(s_value>max_s)
00112 {
00113 lastR=CalcDiff2Prod_Ratio(s_value,A);
00114 return lastR;
00115 }
00116 G4bool found=false;
00117 G4int i=-1;
00118 if(nDB) for (i=0; i<nDB; i++) if(A==vA[i])
00119 {
00120 found=true;
00121 break;
00122 }
00123 if(!nDB || !found)
00124 {
00125 lastA = A;
00126 lastT = new G4double[mps];
00127
00128
00129
00130
00131
00132
00133
00134 G4double sv=0;
00135 lastT[0]=1.;
00136
00137 for(G4int j=1; j<=nps; j++)
00138 {
00139 sv+=ds;
00140 lastT[j]=CalcDiff2Prod_Ratio(sv,A);
00141 }
00142 lastL = new G4double[mls];
00143
00144
00145
00146
00147
00148
00149
00150
00151 sv=mi;
00152
00153 for(G4int j=0; j<=nls; j++)
00154 {
00155 lastL[j]=CalcDiff2Prod_Ratio(sv,A);
00156
00157 sv*=edl;
00158 }
00159 i++;
00160 vA.push_back(lastA);
00161
00162
00163
00164
00165 vT.push_back(lastT);
00166 vL.push_back(lastL);
00167 }
00168 else
00169 {
00170 lastA=vA[i];
00171
00172
00173
00174
00175 lastT=vT[i];
00176 lastL=vL[i];
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 }
00227
00228 if(s_value<sma)
00229 {
00230 G4int n=static_cast<int>(s_value/ds);
00231 G4double d=s_value-n*ds;
00232 G4double v=lastT[n];
00233 lastR=v+d*(lastT[n+1]-v)/ds;
00234 }
00235 else
00236 {
00237 G4double ls=std::log(s_value)-lsi;
00238 G4int n=static_cast<int>(ls/dl);
00239 G4double d=ls-n*dl;
00240 G4double v=lastL[n];
00241 lastR=v+d*(lastL[n+1]-v)/dl;
00242 }
00243 if(lastR<0.) lastR=0.;
00244 if(lastR>1.) lastR=1.;
00245 return lastR;
00246 }
00247
00248
00249 G4double G4QDiffractionRatio::CalcDiff2Prod_Ratio(G4double s_value, G4int A)
00250 {
00251 static G4int mA=0;
00252 static G4double S=.1;
00253 static G4double R=0.;
00254 static G4double p1=0.;
00255 static G4double p2=0.;
00256 static G4double p4=0.;
00257 static G4double p5=0.;
00258 static G4double p6=0.;
00259 static G4double p7=0.;
00260 if(s_value<=0. || A<=1) return 0.;
00261 if(A!=mA && A!=1)
00262 {
00263 S=s_value;
00264 mA=A;
00265 G4double a=mA;
00266 G4double sa=std::sqrt(a);
00267 G4double a2=a*a;
00268 G4double a3=a2*a;
00269 G4double a4=a3*a;
00270 G4double a5=a4*a;
00271 G4double a6=a5*a;
00272 G4double a7=a6*a;
00273 G4double a8=a7*a;
00274 G4double a11=a8*a3;
00275 G4double a12=a8*a4;
00276 p1=(.023*std::pow(a,0.37)+3.5/a3+2.1e6/a12+4.e-14*a5)/(1.+7.6e-4*a*sa+2.15e7/a11);
00277 p2=(1.42*std::pow(a,0.61)+1.6e5/a8+4.5e-8*a4)/(1.+4.e-8*a4+1.2e4/a6);
00278 G4double q=std::pow(a,0.7);
00279 p4=(.036/q+.0009*q)/(1.+6./a3+1.e-7*a3);
00280 p5=1.3*std::pow(a,0.1168)/(1.+1.2e-8*a3);
00281 p6=.00046*(a+11830./a2);
00282 p7=1./(1.+6.17/a2+.00406*a);
00283 }
00284 else if(A==1 && mA!=1)
00285 {
00286 S=s_value;
00287 p1=.0315;
00288 p2=.73417;
00289 p4=.01109;
00290 p5=1.0972;
00291 p6=.065787;
00292 p7=.62976;
00293 }
00294 else if(std::fabs(s_value-S)/S<.0001) return R;
00295 G4double s2=s_value*s_value;
00296 G4double s4=s2*s2;
00297 G4double dl=std::log(s_value)-p5;
00298 R=1./(1.+1./(p1+p2/s4+p4*dl*dl/(1.+p6*std::pow(s_value,p7))));
00299 return R;
00300 }
00301
00302
00303 G4QHadronVector* G4QDiffractionRatio::TargFragment(G4int pPDG, G4LorentzVector p4M,
00304 G4int tgZ, G4int tgN)
00305 {
00306 static const G4double pFm= 0.;
00307
00308 static const G4double pFm2= pFm*pFm;
00309 static const G4double mPi0= G4QPDGCode(111).GetMass();
00310
00311 static const G4double mNeut= G4QPDGCode(2112).GetMass();
00312 static const G4double mNeut2=mNeut*mNeut;
00313 static const G4double dmNeut=mNeut+mNeut;
00314 static const G4double mProt= G4QPDGCode(2212).GetMass();
00315 static const G4double mProt2=mProt*mProt;
00316 static const G4double dmProt=mProt+mProt;
00317 static const G4double maxDM=mProt*12.;
00318
00319
00320
00321
00322
00323 static const G4double third=1./3.;
00324
00325 G4LorentzVector pr4M=p4M/megaelectronvolt;
00326
00327 G4QHadronVector* ResHV = new G4QHadronVector;
00328 G4QHadron* hadron = new G4QHadron(pPDG,p4M);
00329 ResHV->push_back(hadron);
00330
00331 G4int tgA=tgZ+tgN;
00332 G4int tPDG=90000000+tgZ*1000+tgN;
00333 G4double tgM=G4QPDGCode(tPDG).GetMass();
00334 G4int rPDG=2112;
00335 if(tgA*G4UniformRand()>tgN)
00336 {
00337 rPDG=2212;
00338 tPDG-=1000;
00339 }
00340 else tPDG-=1;
00341 G4double tM=G4QPDGCode(tPDG).GetMass();
00342 G4double tE=std::sqrt(tM*tM+pFm2);
00343 G4ThreeVector tP=pFm*G4RandomDirection();
00344 G4LorentzVector t4M(tP,tE);
00345 G4LorentzVector tg4M(0.,0.,0.,tgM);
00346 G4LorentzVector N4M=tg4M-t4M;
00347 G4LorentzVector tot4M=N4M+p4M;
00348 G4double mT=mNeut;
00349 G4double mT2=mNeut2;
00350 G4double dmT=dmNeut;
00351
00352
00353 if(rPDG==2212)
00354 {
00355 mT=mProt;
00356 mT2=mProt2;
00357 dmT=dmProt;
00358
00359
00360 }
00361 G4double mP2=pr4M.m2();
00362 if(mP2<0.) mP2=0.;
00363 G4double s_value=tot4M.m2();
00364 G4double E=(s_value-mT2-mP2)/dmT;
00365 G4double E2=E*E;
00366 if(E<0. || E2<mP2)
00367 {
00368 #ifdef pdebug
00369 G4cerr<<"-Warning-G4DifR::TFra:<NegativeEnergy>E="<<E<<",E2="<<E2<<"<M2="<<mP2<<G4endl;
00370 #endif
00371 return ResHV;
00372 }
00373 G4double mP=std::sqrt(mP2);
00374 if(mP<.1) mP=mPi0;
00375
00376 G4double mMin=mP+mPi0;
00377 G4double tA=tgA;
00378 G4double sA=5./std::pow(tA,third);
00379
00380 mMin+=G4UniformRand()*(mP*sA+mPi0);
00381 G4double ss=std::sqrt(s_value);
00382 G4double mMax=ss-mP;
00383 if(mMax>maxDM) mMax=maxDM;
00384 if(mMin>=mMax)
00385 {
00386 #ifdef pdebug
00387 G4cerr<<"-Warning-G4DifR::TFra:ZeroDiffractionMRange, mi="<<mMin<<",ma="<<mMax<<G4endl;
00388 #endif
00389 return ResHV;
00390 }
00391 G4double R = G4UniformRand();
00392 G4double mDif=std::exp(R*std::log(mMax)+(1.-R)*std::log(mMin));
00393 G4double mDif2=mDif*mDif;
00394 G4double ds=s_value-mP2-mDif2;
00395
00396
00397 #ifdef debug
00398 G4cout<<"G4QDiffR::TargFrag:Before XS, P="<<P<<",Z="<<Z<<",N="<<N<<",PDG="<<pPDG<<G4endl;
00399 #endif
00400
00401 if(pPDG>3400 || pPDG<-3400) G4cout<<"-Warning-G4QDifR::Fragment: pPDG="<<pPDG<<G4endl;
00402 G4double maxt=(ds*ds-4*mP2*mDif2)/s_value;
00403 G4double tsl=140000.;
00404 G4double t=-std::log(G4UniformRand())*tsl;
00405 #ifdef pdebug
00406 G4cout<<"G4QDifR::TFra:ph="<<pPDG<<",P="<<P<<",t="<<t<<"<"<<maxt<<G4endl;
00407 #endif
00408 #ifdef nandebug
00409 if(mint>-.0000001);
00410 else G4cout<<"******G4QDiffractionRatio::TargFragment: -t="<<mint<<G4endl;
00411 #endif
00412 G4double rt=t/maxt;
00413 G4double cost=1.-rt-rt;
00414 #ifdef ppdebug
00415 G4cout<<"G4QDiffraRatio::TargFragment: -t="<<t<<", maxt="<<maxt<<", cost="<<cost<<G4endl;
00416 #endif
00417 if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
00418 {
00419 if (cost>1.) cost=1.;
00420 else if(cost<-1.) cost=-1.;
00421 else
00422 {
00423 G4cerr<<"G4QDiffRat::TargFragm: *NAN* cost="<<cost<<",t="<<t<<",tmax="<<maxt<<G4endl;
00424 return ResHV;
00425 }
00426 }
00427 G4LorentzVector r4M=G4LorentzVector(0.,0.,0.,mP);
00428 G4LorentzVector d4M=G4LorentzVector(0.,0.,0.,mDif);
00429 G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-mT)*.01);
00430 if(!G4QHadron(tot4M).RelDecayIn2(r4M, d4M, dir4M, cost, cost))
00431 {
00432 G4cerr<<"G4QDifR::TFr:M="<<tot4M.m()<<",T="<<mT<<",D="<<mDif<<",T+D="<<mT+mDif<<G4endl;
00433
00434 return ResHV;
00435 }
00436 #ifdef debug
00437 G4cout<<"G4QDifRat::TargFragm:d4M="<<d4M<<"+r4M="<<r4M<<"="<<d4M+r4M<<"="<<tot4M<<G4endl;
00438 #endif
00439
00440 delete hadron;
00441 ResHV->pop_back();
00442 hadron = new G4QHadron(pPDG,r4M);
00443 ResHV->push_back(hadron);
00444 #ifdef debug
00445 G4cout<<"G4QDiffractionRatio::TargFragm: *Filled* LeadingNuc="<<r4M<<pPDG<<G4endl;
00446 #endif
00447 G4QHadronVector* leadhs = 0;
00448 G4QContent dQC=G4QPDGCode(rPDG).GetQuarkContent();
00449 G4Quasmon* quasm = new G4Quasmon(dQC,d4M);
00450 #ifdef debug
00451 G4cout<<"G4QDiffRatio::TgFrag:tPDG="<<tPDG<<",rPDG="<<rPDG<<",d4M="<<d4M<<G4endl;
00452 #endif
00453 G4QEnvironment* pan= new G4QEnvironment(G4QNucleus(tPDG));
00454 pan->AddQuasmon(quasm);
00455 #ifdef debug
00456 G4cout<<"G4QDiffractionRatio::TargFragment: EnvPDG="<<tPDG<<G4endl;
00457 #endif
00458 try
00459 {
00460 leadhs = pan->Fragment();
00461 }
00462 catch (G4QException& error)
00463 {
00464
00465 G4cerr<<"***G4QDiffractionRatio::TargFrag: G4QException is catched"<<G4endl;
00466
00467
00468 G4Exception("G4QDiffractionRatio::TargFragment()","HAD_CHPS_0027",
00469 FatalException, "Nucl");
00470 }
00471 delete pan;
00472 G4int qNH=leadhs->size();
00473 if(qNH) for(G4int iq=0; iq<qNH; iq++)
00474 {
00475 G4QHadron* loh=(*leadhs)[iq];
00476 ResHV->push_back(loh);
00477 }
00478 leadhs->clear();
00479 delete leadhs;
00480 return ResHV;
00481 }
00482
00483
00484 G4QHadronVector* G4QDiffractionRatio::ProjFragment(G4int pPDG, G4LorentzVector p4M,
00485 G4int tgZ, G4int tgN)
00486 {
00487 static const G4double pFm= 250.;
00488 static const G4double pFm2= pFm*pFm;
00489 static const G4double mPi0= G4QPDGCode(111).GetMass();
00490 static const G4double mPi= G4QPDGCode(211).GetMass();
00491 static const G4double mNeut= G4QPDGCode(2112).GetMass();
00492 static const G4double mNeut2=mNeut*mNeut;
00493 static const G4double dmNeut=mNeut+mNeut;
00494 static const G4double mProt= G4QPDGCode(2212).GetMass();
00495 static const G4double mProt2=mProt*mProt;
00496 static const G4double dmProt=mProt+mProt;
00497 static const G4double maxDM=mProt*12.;
00498 static const G4double mLamb= G4QPDGCode(3122).GetMass();
00499 static const G4double mSigZ= G4QPDGCode(3212).GetMass();
00500 static const G4double mSigM= G4QPDGCode(3112).GetMass();
00501 static const G4double mSigP= G4QPDGCode(3222).GetMass();
00502 static const G4double eps=.003;
00503
00504 G4LorentzVector pr4M=p4M/megaelectronvolt;
00505
00506 G4QHadronVector* ResHV = new G4QHadronVector;
00507 G4QHadron* hadron = new G4QHadron(pPDG,p4M);
00508 ResHV->push_back(hadron);
00509
00510 G4int tgA=tgZ+tgN;
00511 G4int tPDG=90000000+tgZ*1000+tgN;
00512 G4double tgM=G4QPDGCode(tPDG).GetMass();
00513 G4int rPDG=2112;
00514 if(tgA*G4UniformRand()>tgN)
00515 {
00516 rPDG=2212;
00517 tPDG-=1000;
00518 }
00519 else tPDG-=1;
00520 G4double tM=G4QPDGCode(tPDG).GetMass();
00521 G4double tE=std::sqrt(tM*tM+pFm2);
00522 G4ThreeVector tP=pFm*G4RandomDirection();
00523 G4LorentzVector t4M(tP,tE);
00524 G4LorentzVector tg4M(0.,0.,0.,tgM);
00525 G4LorentzVector N4M=tg4M-t4M;
00526 G4LorentzVector tot4M=N4M+p4M;
00527 G4double mT=mNeut;
00528 G4double mT2=mNeut2;
00529 G4double dmT=dmNeut;
00530
00531
00532 if(rPDG==2212)
00533 {
00534 mT=mProt;
00535 mT2=mProt2;
00536 dmT=dmProt;
00537
00538
00539 }
00540 G4double mP2=pr4M.m2();
00541 if(mP2<0.) mP2=0.;
00542 G4double s_value=tot4M.m2();
00543 G4double E=(s_value-mT2-mP2)/dmT;
00544 G4double E2=E*E;
00545 if(E<0. || E2<mP2)
00546 {
00547 #ifdef pdebug
00548 G4cerr<<"-Warning-G4DifR::PFra:<NegativeEnergy>E="<<E<<",E2="<<E2<<"<M2="<<mP2<<G4endl;
00549 #endif
00550 return ResHV;
00551 }
00552 G4double mP=std::sqrt(mP2);
00553 if(mP<.1)mP=mPi0;
00554 G4double mMin=mP+mPi0;
00555 G4double ss=std::sqrt(s_value);
00556 G4double mMax=ss-mT;
00557 if(mMax>maxDM) mMax=maxDM;
00558 if(mMin>=mMax)
00559 {
00560 #ifdef pdebug
00561 G4cerr<<"-Warning-G4DifR::PFra:ZeroDiffractionMRange, mi="<<mMin<<",ma="<<mMax<<G4endl;
00562 #endif
00563 return ResHV;
00564 }
00565 G4double R = G4UniformRand();
00566 G4double mDif=std::exp(R*std::log(mMax)+(1.-R)*std::log(mMin));
00567 G4double mDif2=mDif*mDif;
00568 G4double ds=s_value-mT2-mDif2;
00569
00570
00571 #ifdef debug
00572 G4cout<<"G4QDiffR::PFra: Before XS, P="<<P<<", Z="<<Z<<", N="<<N<<", PDG="<<pPDG<<G4endl;
00573 #endif
00574
00575 if(pPDG>3400 || pPDG<-3400) G4cout<<"-Warning-G4QDifR::Fragment: pPDG="<<pPDG<<G4endl;
00576 G4double tsl=140000.;
00577 G4double t=-std::log(G4UniformRand())*tsl;
00578 G4double maxt=(ds*ds-4*mT2*mDif2)/s_value;
00579 #ifdef pdebug
00580 G4cout<<"G4QDifR::PFra:ph="<<pPDG<<",P="<<P<<",t="<<mint<<"<"<<maxt<<G4endl;
00581 #endif
00582 #ifdef nandebug
00583 if(mint>-.0000001);
00584 else G4cout<<"******G4QDiffractionRatio::ProjFragment: -t="<<mint<<G4endl;
00585 #endif
00586 G4double rt=t/maxt;
00587 G4double cost=1.-rt-rt;
00588 #ifdef ppdebug
00589 G4cout<<"G4QDiffRatio::ProjFragment: -t="<<t<<", maxt="<<maxt<<", cost="<<cost<<G4endl;
00590 #endif
00591 if(cost>1. || cost<-1. || !(cost>-1. || cost<=1.))
00592 {
00593 if (cost>1.) cost=1.;
00594 else if(cost<-1.) cost=-1.;
00595 else
00596 {
00597 G4cerr<<"G4QDiffRat::ProjFragm: *NAN* cost="<<cost<<",t="<<t<<",tmax="<<maxt<<G4endl;
00598 return ResHV;
00599 }
00600 }
00601 G4LorentzVector r4M=G4LorentzVector(0.,0.,0.,mT);
00602 G4LorentzVector d4M=G4LorentzVector(0.,0.,0.,mDif);
00603 G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-mT)*.01);
00604 if(!G4QHadron(tot4M).RelDecayIn2(d4M, r4M, dir4M, cost, cost))
00605 {
00606 G4cerr<<"G4QDifR::PFr:M="<<tot4M.m()<<",T="<<mT<<",D="<<mDif<<",T+D="<<mT+mDif<<G4endl;
00607
00608 return ResHV;
00609 }
00610 #ifdef debug
00611 G4cout<<"G4QDiffR::ProjFragm:d4M="<<d4M<<"+r4M="<<r4M<<"="<<d4M+r4M<<"="<<tot4M<<G4endl;
00612 #endif
00613
00614 delete hadron;
00615 ResHV->pop_back();
00616 hadron = new G4QHadron(tPDG,t4M);
00617 ResHV->push_back(hadron);
00618 #ifdef debug
00619 G4cout<<"G4QDiffractionRatio::ProjFragment: *Filled* RecNucleus="<<t4M<<tPDG<<G4endl;
00620 #endif
00621 hadron = new G4QHadron(rPDG,r4M);
00622 ResHV->push_back(hadron);
00623 #ifdef debug
00624 G4cout<<"G4QDiffractionRatio::ProjFragment: *Filled* RecNucleon="<<r4M<<rPDG<<G4endl;
00625 #endif
00626 G4LorentzVector sum4M(0.,0.,0.,0.);
00627
00628 G4QHadronVector* leadhs = 0;
00629 G4QContent dQC=G4QPDGCode(pPDG).GetQuarkContent();
00630 G4Quasmon* pan= new G4Quasmon(dQC,d4M);
00631 try
00632 {
00633 G4QNucleus vac(90000000);
00634 leadhs=pan->Fragment(vac,1);
00635 }
00636 catch (G4QException& error)
00637 {
00638 G4cerr<<"***G4QDiffractionRatio::ProjFragment: G4Quasmon Exception"<<G4endl;
00639
00640 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0072",
00641 FatalException, "*Quasmon");
00642 }
00643 delete pan;
00644 G4int qNH=leadhs->size();
00645 if(qNH) for(G4int iq=0; iq<qNH; iq++)
00646 {
00647 G4QHadron* loh=(*leadhs)[iq];
00648 G4int nL=loh->GetStrangeness();
00649 G4int nB=loh->GetBaryonNumber();
00650 G4int nC = loh->GetCharge();
00651 G4int oPDG = loh->GetPDGCode();
00652
00653 if(2>3)
00654 {
00655 G4LorentzVector q4M = loh->Get4Momentum();
00656 G4double qM=q4M.m();
00657 #ifdef fdebug
00658 G4cout<<"G4QDR::PF:"<<oPDG<<",M="<<qM<<",B="<<nB<<",S="<<nL<<",C="<<nC<<G4endl;
00659 #endif
00660 G4int qPN=nC-nB;
00661 G4int fPDG = 2212;
00662 G4int sPDG = 211;
00663 tPDG = 3122;
00664 G4double fMass= mProt;
00665 G4double sMass= mPi;
00666 G4double tMass= mLamb;
00667 G4bool cont=true;
00668
00669 if(nC<0)
00670 {
00671 if(nL&&nB==nL)
00672 {
00673 sPDG = -211;
00674 if(-nC==nL && nL==1)
00675 {
00676 if(std::fabs(qM-mSigM)<eps)
00677 {
00678 loh->SetQPDG(G4QPDGCode(3112));
00679 cont=false;
00680 }
00681 else if(qM>mLamb+mPi)
00682 {
00683 fPDG = 3122;
00684 fMass= mLamb;
00685 }
00686 else if(qM>mSigM)
00687 {
00688 fPDG = 3112;
00689 fMass= mSigM;
00690 sPDG = 22;
00691 sMass= 0.;
00692 }
00693 else
00694 {
00695 fPDG = 2112;
00696 fMass= mNeut;
00697 }
00698 qPN = 1;
00699 }
00700 else if(-nC==nL)
00701 {
00702 qPN = 1;
00703 fPDG = 3112;
00704 sPDG = 3112;
00705 sMass= mSigM;
00706 nB--;
00707 fMass= mSigM;
00708 }
00709 else if(-nC>nL)
00710 {
00711 qPN = -nC-nL;
00712 fPDG = 3112;
00713 fMass= mSigM;
00714 }
00715 else
00716 {
00717 nB += nC;
00718 fPDG = 3122;
00719 fMass= mLamb;
00720 qPN = -nC;
00721 sPDG = 3112;
00722 sMass= mSigM;
00723 }
00724 nL = 0;
00725 }
00726 else if(nL)
00727 {
00728 nB -= nL;
00729 fPDG = 2112;
00730 fMass= mNeut;
00731 G4int nPin = -nC;
00732 if(nL==nPin)
00733 {
00734 qPN = nL;
00735 sPDG = 3112;
00736 sMass= mSigM;
00737 nL = 0;
00738 }
00739 else if(nL>nPin)
00740 {
00741 nL-=nPin;
00742 qPN = nPin;
00743 sPDG = 3112;
00744 sMass= mSigM;
00745 }
00746 else
00747 {
00748 qPN = nPin-nL;
00749 sPDG = -211;
00750 tPDG = 3112;
00751 tMass= mSigM;
00752 }
00753 }
00754 else
00755 {
00756 sPDG = -211;
00757 qPN = -nC;
00758 fPDG = 2112;
00759 fMass= mNeut;
00760 }
00761 }
00762 else if(!nC)
00763 {
00764 if(nL && nL<nB)
00765 {
00766 qPN = nL;
00767 fPDG = 2112;
00768 sPDG = 3122;
00769 sMass= mLamb;
00770 nB -= nL;
00771 fMass= mNeut;
00772 nL = 0;
00773 }
00774 else if(nL>1 && nB==nL)
00775 {
00776 qPN = 1;
00777 fPDG = 3122;
00778 sPDG = 3122;
00779 sMass= mLamb;
00780 nB--;
00781 fMass= mLamb;
00782 }
00783 else if(!nL && nB>1)
00784 {
00785 qPN = 1;
00786 fPDG = 2112;
00787 sPDG = 2112;
00788 sMass= mNeut;
00789 nB--;
00790 fMass= mNeut;
00791 }
00792 else G4cout<<"*?*G4QDiffractionRatio::ProjFragment: (1) oPDG="<<oPDG<<G4endl;
00793 }
00794 else if(nC>0)
00795 {
00796 if(nL && nL+nC==nB)
00797 {
00798 qPN = nL;
00799 nL = 0;
00800 fPDG = 2212;
00801 sPDG = 3122;
00802 sMass= mLamb;
00803 nB = nC;
00804 fMass= mProt;
00805 }
00806 else if(nL && nC<nB-nL)
00807 {
00808 qPN = nC;
00809 fPDG = 2112;
00810 sPDG = 2212;
00811 sMass= mProt;
00812 nB -= nL+nC;
00813 fMass= mNeut;
00814 }
00815 else if(nL && nB==nL)
00816 {
00817 if(nC==nL && nL==1)
00818 {
00819 if(std::fabs(qM-mSigP)<eps)
00820 {
00821 loh->SetQPDG(G4QPDGCode(3222));
00822 cont=false;
00823 }
00824 else if(qM>mLamb+mPi)
00825 {
00826 fPDG = 3122;
00827 fMass= mLamb;
00828 }
00829 else if(qM>mNeut+mPi)
00830 {
00831 fPDG = 2112;
00832 fMass= mNeut;
00833 }
00834 else if(qM>mSigP)
00835 {
00836 fPDG = 3222;
00837 fMass= mSigP;
00838 sPDG = 22;
00839 sMass= 0.;
00840 }
00841 else
00842 {
00843 fPDG = 2212;
00844 fMass= mProt;
00845 sPDG = 22;
00846 sMass= 0.;
00847 }
00848 qPN = 1;
00849 }
00850 else if(nC==nL)
00851 {
00852 qPN = 1;
00853 fPDG = 3222;
00854 sPDG = 3222;
00855 sMass= mSigP;
00856 nB--;
00857 fMass= mSigP;
00858 }
00859 else if(nC>nL)
00860 {
00861 qPN = nC-nL;
00862 fPDG = 3222;
00863 nB = nL;
00864 fMass= mSigP;
00865 }
00866 else
00867 {
00868 nB -= nC;
00869 fPDG = 3122;
00870 fMass= mLamb;
00871 qPN = nC;
00872 sPDG = 3222;
00873 sMass= mSigP;
00874 }
00875 nL = 0;
00876 }
00877 else if(nL && nC>nB-nL)
00878 {
00879 nB -= nL;
00880 G4int nPip = nC-nB;
00881 if(nL==nPip)
00882 {
00883 qPN = nL;
00884 sPDG = 3222;
00885 sMass= mSigP;
00886 nL = 0;
00887 }
00888 else if(nL>nPip)
00889 {
00890 nL -= nPip;
00891 qPN = nPip;
00892 sPDG = 3222;
00893 sMass= mSigP;
00894 }
00895 else
00896 {
00897 qPN = nPip-nL;
00898 tPDG = 3222;
00899 tMass= mSigP;
00900 }
00901 }
00902 if(nC<nB)
00903 {
00904 fPDG = 2112;
00905 fMass= mNeut;
00906 qPN = nC;
00907 sPDG = 2212;
00908 sMass= mProt;
00909 }
00910 else if(nB==nC && nC>1)
00911 {
00912 qPN = 1;
00913 fPDG = 2212;
00914 sPDG = 2212;
00915 sMass= mProt;
00916 nB--;
00917 fMass= mProt;
00918 }
00919 else if(nC<=nB||!nB) G4cout<<"*?*G4QDR::ProjFragm: (2) oPDG="<<oPDG<<G4endl;
00920
00921 }
00922 if(cont)
00923 {
00924 G4double tfM=nB*fMass;
00925 G4double tsM=qPN*sMass;
00926 G4double ttM=0.;
00927 if(nL) ttM=nL*tMass;
00928 G4LorentzVector f4Mom(0.,0.,0.,tfM);
00929 G4LorentzVector s4Mom(0.,0.,0.,tsM);
00930 G4LorentzVector t4Mom(0.,0.,0.,ttM);
00931 G4double sum=tfM+tsM+ttM;
00932 if(std::fabs(qM-sum)<eps)
00933 {
00934 f4Mom=q4M*(tfM/sum);
00935 s4Mom=q4M*(tsM/sum);
00936 if(nL) t4Mom=q4M*(ttM/sum);
00937 }
00938 else if(!nL && (qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom)))
00939 {
00940
00941 G4cout<<"***G4QDR::PrFragm:fPDG="<<fPDG<<"*"<<nB<<"(fM="<<fMass<<")+sPDG="<<sPDG
00942 <<"*"<<qPN<<"(sM="<<sMass<<")"<<"="<<sum<<" > TM="<<qM<<q4M<<oPDG<<G4endl;
00943
00944
00945 G4ExceptionDescription ed;
00946 ed << "***G4QDR::PrFragm:fPDG=" << fPDG << "*" << nB << "(fM="
00947 << fMass << ")+sPDG=" << sPDG << "*" << qPN << "(sM=" << sMass
00948 << ")" << "=" << sum << " > TM=" << qM << q4M << oPDG << G4endl;
00949 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0002",
00950 FatalException, ed);
00951 }
00952 else if(nL && (qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom)))
00953 {
00954
00955 G4cout<<"***G4DF::PrFrag: "<<fPDG<<"*"<<nB<<"("<<fMass<<")+"<<sPDG<<"*"<<qPN<<"("
00956 <<sMass<<")+Lamb*"<<nL<<"="<<sum<<" > TotM="<<qM<<q4M<<oPDG<<G4endl;
00957
00958
00959 G4ExceptionDescription ed;
00960 ed << "***G4DF::PrFrag: " << fPDG << "*" << nB << "(" << fMass << ")+"
00961 << sPDG << "*" << qPN << "(" << sMass << ")+Lamb*" << nL << "="
00962 << sum << " > TotM=" << qM << q4M << oPDG << G4endl;
00963 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0003",
00964 FatalException, ed);
00965 }
00966 #ifdef fdebug
00967 G4cout<<"G4QDF::ProjFragm: *DONE* n="<<nB<<f4Mom<<fPDG<<", m="<<qPN<<s4Mom<<sPDG
00968 <<", l="<<nL<<t4Mom<<G4endl;
00969 #endif
00970 G4bool notused=true;
00971 if(nB)
00972 {
00973 f4Mom/=nB;
00974 loh->Set4Momentum(f4Mom);
00975 loh->SetQPDG(G4QPDGCode(fPDG));
00976 notused=false;
00977 if(nB>1) for(G4int ih=1; ih<nB; ih++)
00978 {
00979 G4QHadron* Hi = new G4QHadron(fPDG,f4Mom);
00980 ResHV->push_back(Hi);
00981 #ifdef fdebug
00982 sum4M+=r4M;
00983 G4cout<<"G4QDR::ProjFrag: *additional Nucleon*="<<f4Mom<<fPDG<<G4endl;
00984 #endif
00985 }
00986 }
00987 if(qPN)
00988 {
00989 s4Mom/=qPN;
00990 G4int min=0;
00991 if(notused)
00992 {
00993 loh->Set4Momentum(s4Mom);
00994 loh->SetQPDG(G4QPDGCode(sPDG));
00995 notused=false;
00996 min=1;
00997 }
00998 if(qPN>min) for(G4int ip=min; ip<qPN; ip++)
00999 {
01000 G4QHadron* Hj = new G4QHadron(sPDG,s4Mom);
01001 ResHV->push_back(Hj);
01002 #ifdef fdebug
01003 sum4M+=r4M;
01004 G4cout<<"G4QDR::ProjFragm: *additional Pion*="<<f4Mom<<fPDG<<G4endl;
01005 #endif
01006 }
01007 }
01008 if(nL)
01009 {
01010 t4Mom/=nL;
01011 G4int min=0;
01012 if(notused)
01013 {
01014 loh->Set4Momentum(t4Mom);
01015 loh->SetQPDG(G4QPDGCode(tPDG));
01016 notused=false;
01017 min=1;
01018 }
01019 if(nL>min) for(G4int il=min; il<nL; il++)
01020 {
01021 G4QHadron* Hk = new G4QHadron(tPDG,t4Mom);
01022 ResHV->push_back(Hk);
01023 #ifdef fdebug
01024 sum4M+=r4M;
01025 G4cout<<"G4QDR::ProjFragm: *additional Hyperon*="<<f4Mom<<fPDG<<G4endl;
01026 #endif
01027 }
01028 }
01029 }
01030 }
01031 else if( (nL > 0 && nB > 1) || (nL < 0 && nB < -1) )
01032 {
01033 G4bool anti=false;
01034 if(nB<0)
01035 {
01036 anti=true;
01037 nB=-nB;
01038 nC=-nC;
01039 nL=-nL;
01040 }
01041 G4int hPDG = 90000000+nL*999999+nC*999+nB;
01042 G4int nSM=0;
01043 G4int nSP=0;
01044 if(nC<0)
01045 {
01046 if(-nC<=nL)
01047 {
01048 nSM=-nC;
01049 nL+=nC;
01050 }
01051 else
01052 {
01053 nSM=nL;
01054 nL=0;
01055 }
01056 }
01057 else if(nC>nB-nL)
01058 {
01059 if(nC<=nB)
01060 {
01061 G4int dH=nB-nC;
01062 nSP=nL-dH;
01063 nL=dH;
01064 }
01065 else
01066 {
01067 nSP=nL;
01068 nL=0;
01069 }
01070 }
01071 r4M=loh->Get4Momentum();
01072 G4double reM=r4M.m();
01073 #ifdef fdebug
01074 G4cout<<"G4QDiffRatio::PrFrag:oPDG=="<<oPDG<<",hPDG="<<hPDG<<",M="<<reM<<G4endl;
01075 #endif
01076 G4int rlPDG=hPDG-nL*1000000-nSP*1000999-nSM*999001;
01077 G4int sPDG=3122;
01078 G4double MLa=mLamb;
01079 #ifdef fdebug
01080 G4cout<<"G4QDiffRatio::PrFrag:*G4*nS+="<<nSP<<",nS-="<<nSM<<",nL="<<nL<<G4endl;
01081 #endif
01082 if(nSP||nSM)
01083 {
01084 if(nL)
01085 {
01086 G4cout<<"***G4QDR::PFr:HypN="<<hPDG<<": bothSigm&Lamb -> ImproveIt"<<G4endl;
01087
01088
01089 if(nSP) nL+=nSP;
01090 else nL+=nSM;
01091 }
01092 if(nSP)
01093 {
01094 nL=nSP;
01095 sPDG=3222;
01096 MLa=mSigP;
01097 }
01098 else
01099 {
01100 nL=nSM;
01101 sPDG=3112;
01102 MLa=mSigM;
01103 }
01104 }
01105 #ifdef fdebug
01106 G4cout<<"G4QDiffRat::ProjFrag:*G4*mS="<<MLa<<",sPDG="<<sPDG<<",nL="<<nL<<G4endl;
01107 #endif
01108 if(nL>1) MLa*=nL;
01109 G4double rlM=G4QNucleus(rlPDG).GetMZNS();
01110 if(!nSP&&!nSM&&nL==1&&reM>rlM+mSigZ&&G4UniformRand()>.5)
01111 {
01112 sPDG=3212;
01113 MLa=mSigZ;
01114 }
01115 G4int rnPDG = hPDG-nL*999999;
01116 G4QNucleus rnN(rnPDG);
01117 G4double rnM=rnN.GetMZNS();
01118
01119 if(rlPDG==90000000)
01120 {
01121 if(nL>1) r4M=r4M/nL;
01122 for(G4int il=0; il<nL; il++)
01123 {
01124 if(anti) sPDG=-sPDG;
01125 G4QHadron* theLam = new G4QHadron(sPDG,r4M);
01126 ResHV->push_back(theLam);
01127 #ifdef fdebug
01128 sum4M+=r4M;
01129 G4cout<<"G4QDR::ProjFrag: *additional Lambda*="<<r4M<<sPDG<<G4endl;
01130 #endif
01131 }
01132 }
01133 else if(reM>rlM+MLa-eps)
01134 {
01135 G4LorentzVector n4M(0.,0.,0.,rlM);
01136 G4LorentzVector h4M(0.,0.,0.,MLa);
01137 G4double sum=rlM+MLa;
01138 if(std::fabs(reM-sum)<eps)
01139 {
01140 n4M=r4M*(rlM/sum);
01141 h4M=r4M*(MLa/sum);
01142 }
01143 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
01144 {
01145 G4cerr<<"***G4QDF::PF:HypN,M="<<reM<<"<A+n*L="<<sum<<",d="<<sum-reM<<G4endl;
01146
01147 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0100",
01148 FatalException, "Error in hypernuclus decay");
01149 }
01150 #ifdef fdebug
01151 G4cout<<"*G4QDR::PF:HypN="<<r4M<<"->A="<<rlPDG<<n4M<<",n*L="<<nL<<h4M<<G4endl;
01152 #endif
01153 loh->Set4Momentum(n4M);
01154 if(anti && rlPDG==90000001) rlPDG=-2112;
01155 if(anti && rlPDG==90001000) rlPDG=-2212;
01156 loh->SetQPDG(G4QPDGCode(rlPDG));
01157 if(rlPDG==90000002)
01158 {
01159 G4LorentzVector newLV=n4M/2.;
01160 loh->Set4Momentum(newLV);
01161 if(anti) loh->SetQPDG(G4QPDGCode(-2112));
01162 else loh->SetQPDG(G4QPDGCode(2112));
01163 G4QHadron* secHadr = new G4QHadron(loh);
01164 ResHV->push_back(secHadr);
01165 #ifdef fdebug
01166 sum4M+=r4M;
01167 G4cout<<"G4QDR::ProgFrag: *additional Neutron*="<<r4M<<sPDG<<G4endl;
01168 #endif
01169 }
01170 else if(rlPDG==90002000)
01171 {
01172 G4LorentzVector newLV=n4M/2.;
01173 loh->Set4Momentum(newLV);
01174 if(anti) loh->SetQPDG(G4QPDGCode(-2212));
01175 else loh->SetQPDG(G4QPDGCode(2112));
01176 G4QHadron* secHadr = new G4QHadron(loh);
01177 ResHV->push_back(secHadr);
01178 #ifdef fdebug
01179 sum4M+=r4M;
01180 G4cout<<"G4QDR::ProjFrag: *additional Proton*="<<r4M<<sPDG<<G4endl;
01181 #endif
01182 }
01183
01184 #ifdef fdebug
01185 G4cout<<"*G4QDiffractionRatio::PrFrag:resNucPDG="<<loh->GetPDGCode()<<G4endl;
01186 #endif
01187 if(nL>1) h4M=h4M/nL;
01188 for(G4int il=0; il<nL; il++)
01189 {
01190 if(anti) sPDG=-sPDG;
01191 G4QHadron* theLamb = new G4QHadron(sPDG,h4M);
01192 ResHV->push_back(theLamb);
01193 #ifdef fdebug
01194 sum4M+=r4M;
01195 G4cout<<"G4QDR::ProjFrag: *additional Hyperon*="<<r4M<<sPDG<<G4endl;
01196 #endif
01197 }
01198 }
01199 else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)
01200 {
01201 G4int nPi=static_cast<G4int>((reM-rnM)/mPi0);
01202 if (nPi>nL) nPi=nL;
01203 G4double npiM=nPi*mPi0;
01204 G4LorentzVector n4M(0.,0.,0.,rnM);
01205 G4LorentzVector h4M(0.,0.,0.,npiM);
01206 G4double sum=rnM+npiM;
01207 if(std::fabs(reM-sum)<eps)
01208 {
01209 n4M=r4M*(rnM/sum);
01210 h4M=r4M*(npiM/sum);
01211 }
01212 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
01213 {
01214 G4cerr<<"*G4QDR::PF:HypN,M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
01215
01216 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0101",
01217 FatalException, "Error in HypernuclDecay");
01218 }
01219 loh->Set4Momentum(n4M);
01220 if(anti && rnPDG==90000001) rnPDG=-2112;
01221 if(anti && rnPDG==90001000) rnPDG=-2212;
01222 loh->SetQPDG(G4QPDGCode(rnPDG));
01223 #ifdef fdebug
01224 G4cout<<"*G4QDR::PF:R="<<r4M<<"->A="<<rnPDG<<n4M<<",n*Pi0="<<nPi<<h4M<<G4endl;
01225 #endif
01226 if(nPi>1) h4M=h4M/nPi;
01227 for(G4int ihn=0; ihn<nPi; ihn++)
01228 {
01229 G4QHadron* thePion = new G4QHadron(111,h4M);
01230 ResHV->push_back(thePion);
01231 #ifdef fdebug
01232 sum4M+=r4M;
01233 G4cout<<"G4QDR::ProjFrag: *additional Pion*="<<r4M<<sPDG<<G4endl;
01234 #endif
01235 }
01236 if(rnPDG==90000002)
01237 {
01238 G4LorentzVector newLV=n4M/2.;
01239 loh->Set4Momentum(newLV);
01240 if(anti) loh->SetQPDG(G4QPDGCode(-2112));
01241 else loh->SetQPDG(G4QPDGCode(2112));
01242 G4QHadron* secHadr = new G4QHadron(loh);
01243 ResHV->push_back(secHadr);
01244 #ifdef fdebug
01245 sum4M+=r4M;
01246 G4cout<<"G4QDR::ProjFrag: *additional Neutron*="<<r4M<<sPDG<<G4endl;
01247 #endif
01248 }
01249 else if(rnPDG==90002000)
01250 {
01251 G4LorentzVector newLV=n4M/2.;
01252 loh->Set4Momentum(newLV);
01253 if(anti) loh->SetQPDG(G4QPDGCode(-2212));
01254 else loh->SetQPDG(G4QPDGCode(2112));
01255 G4QHadron* secHadr = new G4QHadron(loh);
01256 ResHV->push_back(secHadr);
01257 #ifdef fdebug
01258 sum4M+=r4M;
01259 G4cout<<"G4QDR::ProjFrag: *additional Proton*="<<r4M<<sPDG<<G4endl;
01260 #endif
01261 }
01262
01263 }
01264 else
01265 {
01266 G4double d=rlM+MLa-reM;
01267 G4cerr<<"G4QDR::PF:R="<<rlM<<",S+="<<nSP<<",S-="<<nSM<<",L="<<nL<<",d="<<d<<G4endl;
01268 d=rnM+mPi0-reM;
01269 G4cerr<<"G4QDR::PF:"<<oPDG<<","<<hPDG<<",M="<<reM<<"<"<<rnM+mPi0<<",d="<<d<<G4endl;
01270
01271 G4Exception("G4QDiffractionRatio::ProjFragment()", "HAD_CHPS_0102",
01272 FatalException, "Excessive hypernuclear energy");
01273 }
01274 }
01275 ResHV->push_back(loh);
01276 #ifdef debug
01277 sum4M+=loh->Get4Momentum();
01278 G4cout<<"G4QDR::PrFra:#"<<iq<<","<<loh->Get4Momentum()<<loh->GetPDGCode()<<G4endl;
01279 #endif
01280 }
01281 leadhs->clear();
01282 delete leadhs;
01283 #ifdef debug
01284 G4cout<<"G4QDiffractionRatio::ProjFragment: *End* Sum="<<sum4M<<" =?= d4M="<<d4M<<G4endl;
01285 #endif
01286 return ResHV;
01287 }
01288
01289
01290 G4double G4QDiffractionRatio::GetTargSingDiffXS(G4double pIU, G4int pPDG, G4int Z, G4int N)
01291 {
01292 G4double mom=pIU/gigaelectronvolt;
01293 if ( mom < 1. || (pPDG != 2212 && pPDG != 2112) )
01294 G4cerr<<"G4QDiffractionRatio::GetTargSingDiffXS isn't applicable p="<<mom<<" GeV, PDG="
01295 <<pPDG<<G4endl;
01296 G4double A=Z+N;
01297
01298 return 3.7*std::pow(A,.364)*millibarn;
01299
01300 }