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
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #include <cmath>
00061 #include <cstdlib>
00062
00063 #include "G4QEnvironment.hh"
00064 #include "G4PhysicalConstants.hh"
00065 #include "G4SystemOfUnits.hh"
00066
00067 using namespace std;
00068
00069 G4QEnvironment::G4QEnvironment(const G4QNucleus& theEnv)
00070 : theEnvironment(theEnv)
00071 {
00072 theQFScat = G4QFreeScattering::GetPointer();
00073 G4int envPDG = theEnv.GetPDG();
00074 G4QPDGCode envQPDG(envPDG);
00075 G4int envA = envQPDG.GetBaryNum();
00076 G4double envM = envQPDG.GetMass();
00077 theWorld = 0;
00078 nBarClust = 0;
00079 f2all = 0;
00080 totCharge = envQPDG.GetCharge();
00081 totBaryoN = envA;
00082 tot4Mom = G4LorentzVector(0.,0.,0.,envM);
00083 theTargetPDG = 0;
00084 #ifdef debug
00085 G4cout << "G4QEnviron::Const: t4M=" << tot4Mom << ",tC=" << totCharge
00086 << ",tB=" << totBaryoN << G4endl;
00087 #endif
00088 }
00089
00090
00091 G4QEnvironment::G4QEnvironment(const G4QHadronVector& projHadrons,
00092 const G4int targPDG)
00093 : theEnvironment(90000000)
00094 {
00095
00096
00097 static const G4QPDGCode pimQPDG(-211);
00098 theQFScat = G4QFreeScattering::GetPointer();
00099 theWorld = G4QCHIPSWorld::Get();
00100 nBarClust = 0;
00101 totCharge = 0;
00102 totBaryoN = 0;
00103 f2all = 0;
00104 G4bool fake=false;
00105 theTargetPDG=targPDG;
00106 G4int nHadrons=projHadrons.size();
00107
00108 #ifdef debug
00109 G4cout<<"--->>G4QE::Const: Called targPDG="<<targPDG<<", nInpHadr="<<nHadrons<<G4endl;
00110 #endif
00111 if(nHadrons<1 || targPDG==90000000)
00112 {
00113 G4cout << "---Warning---G4QEnv::Const:a#ofINPHadr=" << nHadrons
00114 << ",tPDG=" << targPDG << G4endl;
00115
00116 if(nHadrons)
00117 {
00118 for (G4int ih=0; ih<nHadrons; ih++)
00119 {
00120 G4QHadron* curQH = new G4QHadron(projHadrons[ih]);
00121 #ifdef debug
00122 G4cout << "*G4QE::Const:iH#" << ih << "," << curQH->GetQC()
00123 << curQH->Get4Momentum() << G4endl;
00124 #endif
00125
00126 if (curQH->GetPDGCode() == 10) {
00127
00128
00129 G4QContent chQC=curQH->GetQC();
00130
00131 G4QChipolino QCh(chQC);
00132
00133
00134 G4LorentzVector ch4M=curQH->Get4Momentum();
00135 G4QPDGCode h1QPDG=QCh.GetQPDG1();
00136 G4double h1M =h1QPDG.GetMass();
00137 G4QPDGCode h2QPDG=QCh.GetQPDG2();
00138 G4double h2M =h2QPDG.GetMass();
00139 G4double chM2 =ch4M.m2();
00140 if( sqr(h1M+h2M) < chM2 )
00141 {
00142 G4LorentzVector h14M(0.,0.,0.,h1M);
00143 G4LorentzVector h24M(0.,0.,0.,h2M);
00144 if(!G4QHadron(ch4M).DecayIn2(h14M,h24M))
00145 {
00146 G4ExceptionDescription ed;
00147 ed << "QChip DecIn2 error: CM=" << std::sqrt(chM2) << " -> h1="
00148 << h1QPDG << "(" << h1M << ") + h2=" << h1QPDG << "(" << h2M
00149 << ") = " << h1M+h2M << " **Failed**" << G4endl;
00150 G4Exception("G4QEnvironment::G4QEnvironment()", "HAD_CHPS_0000",
00151 FatalException, ed);
00152 }
00153 delete curQH;
00154 G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
00155 theQHadrons.push_back(h1H);
00156 curQH = new G4QHadron(h1H);
00157 theProjectiles.push_back(curQH);
00158
00159 #ifdef debug
00160 G4cout<<"G4QE::Constr: QChipolino -> H1="<<h1QPDG<<h14M<<G4endl;
00161 #endif
00162 curQH = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
00163 theQHadrons.push_back(curQH);
00164 #ifdef debug
00165 G4cout<<"G4QE::Constr: QChipolino -> H2="<<h2QPDG<<h24M<<G4endl;
00166 #endif
00167 }
00168 else
00169 {
00170 G4ExceptionDescription ed;
00171 ed << "LowMassChipolino in Input: " << ih << "," << curQH->GetQC()
00172 << curQH->Get4Momentum() << ", chipoM=" << std::sqrt(chM2) << " < m1="
00173 << h1M << "(" << h1QPDG << ") + m2=" << h2M << "(" << h2QPDG << ") = "
00174 << h1M+h2M << G4endl;
00175 G4Exception("G4QEnvironment::G4QEnvironment()", "HAD_CHPS_0001",
00176 FatalException, ed);
00177 }
00178 }
00179 theQHadrons.push_back(curQH);
00180 curQH = new G4QHadron(curQH);
00181 theProjectiles.push_back(curQH);
00182 }
00183 }
00184 else if(targPDG!=90000000)
00185 {
00186 G4QHadron* curQH = new G4QHadron(targPDG);
00187 #ifdef debug
00188 G4cout<<"**G4QE::Const:No iHad,eH="<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
00189 #endif
00190 theQHadrons.push_back(curQH);
00191 }
00192 if (nHadrons<0) G4cout<<"***Warning****G4QE::Const:NH="<<nHadrons<<" < 0 !"<<G4endl;
00193 return;
00194 }
00195 G4QPDGCode targQPDG(targPDG);
00196 #ifdef debug
00197 G4cout<<"G4QE::C:targQPDG="<<targQPDG<<G4endl;
00198 #endif
00199 G4int targA=targQPDG.GetBaryNum();
00200 G4double targM=targQPDG.GetMass();
00201 totCharge=targQPDG.GetCharge();
00202 totBaryoN=targA;
00203 tot4Mom=G4LorentzVector(0.,0.,0.,targM);
00204
00205 #ifdef debug
00206 G4cout<<"G4QE::C:PDG="<<targPDG<<",C="<<totCharge<<",M="<<targM<<",n="<<nHadrons<<G4endl;
00207 #endif
00208 for(G4int ipr=0; ipr<nHadrons; ipr++)
00209 {
00210 G4QHadron* prHadr = projHadrons[ipr];
00211 G4QHadron* curQH = new G4QHadron(prHadr);
00212 theProjectiles.push_back(curQH);
00213 G4LorentzVector h4Mom = prHadr->Get4Momentum();
00214 tot4Mom += h4Mom;
00215 totCharge += prHadr->GetCharge();
00216 totBaryoN += prHadr->GetBaryonNumber();
00217 #ifdef debug
00218 G4int hPDG = prHadr->GetPDGCode();
00219 G4int hNFrag= prHadr->GetNFragments();
00220 G4QContent hQC = prHadr->GetQC();
00221 G4cout<<"G4QE::C:#"<<ipr<<",PDG="<<hPDG<<hQC<<",4M="<<h4Mom<<",hNFr="<<hNFrag<<G4endl;
00222 #endif
00223 }
00224 #ifdef debug
00225 G4cout<<"G4QEnv::Const:tC="<<totCharge<<",tB="<<totBaryoN<<",tot4M="<<tot4Mom<<G4endl;
00226 #endif
00227 #ifdef debug
00228 G4cout<<"G4QEnv::Const: --> tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
00229 #endif
00230 G4int nP=theWorld->GetQPEntries();
00231
00232 G4int nCl=nP-53;
00233 #ifdef debug
00234 G4cout<<"G4QEnv:Const:Before NCI:n="<<nP<<",F="<<projHadrons[0]->GetNFragments()<<",tC="
00235 <<totCharge<<",tB="<<totBaryoN<<", nCl="<<nCl<<G4endl;
00236 #endif
00237 InitClustersVector(nCl,targA);
00238 #ifdef debug
00239 G4cout<<"G4QEnv::Const:NucClust,n="<<nCl<<",F="<<projHadrons[0]->GetNFragments()<<",tC="
00240 <<totCharge<<",tB="<<totBaryoN<<G4endl;
00241 #endif
00242 if(targPDG>80000000)
00243 {
00244 theEnvironment.InitByPDG(targPDG);
00245 #ifdef debug
00246 G4cout<<"G4QEnv::Const:nH="<<nHadrons<<",PDG="<<projHadrons[0]->GetPDGCode()<<",tC="
00247 <<totCharge<<",tB="<<totBaryoN<<G4endl;
00248 #endif
00249 if(nHadrons==1)
00250 {
00251 G4QHadron* opHad=projHadrons[0];
00252 G4int opPDG=opHad->GetPDGCode();
00253 #ifdef debug
00254 G4cout<<"G4QEnviron::Constructor: *** Only one input hadron*** PDG="<<opPDG<<G4endl;
00255 #endif
00256 if(opPDG==22)
00257 {
00258 G4double exMass=tot4Mom.m();
00259 #ifdef debug
00260 G4cout<<"G4QEnvironment::Const: exM="<<exMass-targM<<" > mPi0 ?"<<G4endl;
00261 #endif
00262 if(exMass<targM+135.977)
00263 {
00264 G4QNucleus exEnviron(tot4Mom,targPDG);
00265
00266 if(targM>999.&&!exEnviron.SplitBaryon())
00267 {
00268 #ifdef debug
00269 G4cout<<"G4QEnv::Const:Photon's added to Output, Env="<<theEnvironment<<G4endl;
00270 #endif
00271 G4QHadron* photon = new G4QHadron(opHad);
00272 #ifdef debug
00273 G4cout<<"**G4QE::Const:Phot="<<photon->GetQC()<<photon->Get4Momentum()<<G4endl;
00274 #endif
00275 theQHadrons.push_back(photon);
00276 return;
00277 }
00278 else if(targM<=999.)
00279 {
00280 G4LorentzVector prot4m(0.,0.,0.,targM);
00281 G4LorentzVector gam4m(0.,0.,0.,0.);
00282 if(!G4QHadron(tot4Mom).DecayIn2(prot4m,gam4m))
00283 {
00284 #ifdef debug
00285 G4cout<<"*War*G4QEnv::Const:(P)Photon->Output, Env="<<theEnvironment<<G4endl;
00286 #endif
00287 G4QHadron* photon = new G4QHadron(opHad);
00288 #ifdef debug
00289 G4cout<<"**G4QE::Const:Ph="<<photon->GetQC()<<photon->Get4Momentum()<<G4endl;
00290 #endif
00291 theQHadrons.push_back(photon);
00292 return;
00293 }
00294 G4QHadron* proton = new G4QHadron(targPDG,prot4m);
00295 theQHadrons.push_back(proton);
00296 G4QHadron* photon = new G4QHadron(22,gam4m);
00297 theQHadrons.push_back(photon);
00298 theEnvironment.InitByPDG(90000000);
00299 #ifdef debug
00300 G4cout<<"G4QEnv::Const:Fill gamma and N from gam+N"<<targPDG<<prot4m<<G4endl;
00301 #endif
00302 return;
00303 }
00304 }
00305 }
00306 else if(opPDG==13 || opPDG==15)
00307 {
00308 G4int nuPDG=14;
00309 if(opPDG==15) nuPDG=16;
00310 G4LorentzVector mu4m=opHad->Get4Momentum();
00311
00312 G4double qpen=465.*sqrt(sqrt(G4UniformRand()));
00313 G4double qpct=2*G4UniformRand()-1.;
00314 G4double qpst=sqrt(1.-qpct*qpct);
00315 G4double qppt=qpen*qpst;
00316 G4double qphi=twopi*G4UniformRand();
00317 G4LorentzVector qi4m(qppt*sin(qphi),qppt*cos(qphi),qpen*qpct,qpen);
00318 G4LorentzVector qt4m=mu4m+qi4m;
00319 G4LorentzVector nu4m(0.,0.,0.,0.);
00320 G4LorentzVector qf4m(0.,0.,0.,0.);
00321 G4QContent targQC=targQPDG.GetQuarkContent();
00322 targQC+=G4QContent(1,0,0,0,1,0);
00323 G4LorentzVector fn4m=G4LorentzVector(0.,0.,0.,0.);
00324 G4QNucleus fnN(targQC,fn4m);
00325 G4double fnm=fnN.GetMZNS();
00326
00327
00328
00329 G4double tm=0.;
00330 G4LorentzVector tg4m=G4LorentzVector(0.,0.,0.,targM);
00331 G4LorentzVector fd4m=tg4m-qi4m;
00332 #ifdef debug
00333
00334 G4cout<<"G4QEnvironment::Const:mu4M="<<mu4m<<",t4M="<<qt4m<<",tgQP="<<qi4m<<G4endl;
00335 #endif
00336 while (tm<=fnm)
00337 {
00338 if(!G4QHadron(qt4m).DecayIn2(nu4m,qf4m))
00339 {
00340 G4cout<<"***G4QE::Constr:Muon error (1) 4M="<<mu4m<<". Fill as it is."<<G4endl;
00341 G4QHadron* lepton = new G4QHadron(opHad);
00342 theQHadrons.push_back(lepton);
00343 return;
00344 }
00345 #ifdef mudebug
00346 G4cout<<"G4QEnv::Const:i="<<qi4m<<",t="<<qt4m<<"->n="<<nu4m<<"+q="<<qf4m<<G4endl;
00347 #endif
00348 fn4m=fd4m+qf4m;
00349 tm=fn4m.m();
00350 #ifdef mudebug
00351 G4cout<<"--G4QEnv::Const:M="<<tm<<",GSM=="<<fnm<<G4endl;
00352 #endif
00353 }
00354 fnN.Set4Momentum(fn4m);
00355
00356 G4QHadron* neutrino = 0;
00357 #ifdef mudebug
00358 G4cout<<"G4QEnv::Const:fM="<<tm<<fn4m<<",GSM="<<fnm<<G4endl;
00359 #endif
00360 if(tm<fnm)
00361 {
00362 qf4m=G4LorentzVector(0.,0.,0.,fnm);
00363 qt4m=tg4m+mu4m;
00364 if(!G4QHadron(qt4m).DecayIn2(nu4m,qf4m))
00365 {
00366 G4cout<<"***G4QE::Constr:Muon error (2) 4M="<<mu4m<<". Fill as it is."<<G4endl;
00367 G4QHadron* muon = new G4QHadron(opHad);
00368 theQHadrons.push_back(muon);
00369 return;
00370 }
00371 G4QHadron* fnuc = new G4QHadron(targQC,qf4m);
00372
00373 EvaporateResidual(fnuc);
00374 neutrino = new G4QHadron(nuPDG,nu4m);
00375 theEnvironment.InitByPDG(90000000);
00376 #ifdef debug
00377 G4cout<<"G4QEnv::Const:Fill neutrino (1) "<<nuPDG<<nu4m<<G4endl;
00378 #endif
00379 theQHadrons.push_back(neutrino);
00380 return;
00381 }
00382 neutrino = new G4QHadron(nuPDG,nu4m);
00383 #ifdef debug
00384 G4cout<<"G4QEnv::Const:Fill neutrino (2) "<<nuPDG<<nu4m<<G4endl;
00385 #endif
00386 theQHadrons.push_back(neutrino);
00387 if(tm<fnm+135.98)
00388 {
00389 if(!fnN.SplitBaryon())
00390 {
00391 #ifdef mudebug
00392 G4cout<<"G4QEnv::Const: impossible to split nucleon after mu->nu"<<G4endl;
00393 #endif
00394 G4LorentzVector ga4m(0.,0.,0.,0.);
00395 qf4m=G4LorentzVector(0.,0.,0.,fnm);
00396 if(!G4QHadron(fn4m).DecayIn2(ga4m,qf4m))
00397 {
00398 G4cout<<"***G4QE::Constr:LepCapError(3),M="<<fn4m.m()<<"<"<<fnm<<G4endl;
00399 G4QHadron* resid = new G4QHadron(targQC,qt4m);
00400 theQHadrons.push_back(resid);
00401 theEnvironment.InitByPDG(90000000);
00402 return;
00403 }
00404 G4QHadron* photon = new G4QHadron(22,ga4m);
00405 #ifdef debug
00406 G4cout<<"G4QEnv::Const:Fill photon "<<ga4m<<G4endl;
00407 #endif
00408 theQHadrons.push_back(photon);
00409 G4QHadron* fnuc = new G4QHadron(targQC,qf4m);
00410 #ifdef debug
00411 G4cout<<"G4QEnv::Const:Fill target "<<targQC<<qf4m<<" in any form"<<G4endl;
00412 #endif
00413 EvaporateResidual(fnuc);
00414 theEnvironment.InitByPDG(90000000);
00415 return;
00416 }
00417 }
00418
00419 fn4m=qf4m-qi4m;
00420 opHad->SetQPDG(pimQPDG);
00421 fake=false;
00422
00423
00424 opHad->Set4Momentum(fn4m);
00425 }
00426 }
00427 for(G4int ih=0; ih<nHadrons; ih++)
00428 {
00429 G4QHadron* curHadr=projHadrons[ih];
00430 G4int hNFrag = curHadr->GetNFragments();
00431 G4LorentzVector ch4M=curHadr->Get4Momentum();
00432 #ifdef debug
00433 G4cout<<"G4QE:C:"<<ih<<",F="<<hNFrag<<",0="<<projHadrons[0]->GetNFragments()<<G4endl;
00434 #endif
00435 if(!hNFrag&&ch4M.e()>0.)
00436 {
00437 G4int envPDG=theEnvironment.GetPDG();
00438 if(envPDG==90000000||(theEnvironment.Get4Momentum().m2())<1.)
00439 {
00440 G4int hPDG = curHadr->GetPDGCode();
00441
00442 if(!hPDG)
00443 {
00444
00445
00446
00447 }
00448 else
00449 {
00450 G4int hQ = curHadr->GetQCode();
00451 if(hQ<0)
00452 {
00453
00454
00455 }
00456 else
00457 {
00458 G4QHadron* newHadr = new G4QHadron(curHadr);
00459 #ifdef debug
00460 G4cout<<"*G4QE::Const:H="<<newHadr->GetQC()<<newHadr->Get4Momentum()<<G4endl;
00461 #endif
00462 theQHadrons.push_back(newHadr);
00463 #ifdef debug
00464 G4cout<<"G4QEnviron::Constructor: Fill h="<<hPDG<<ch4M<<G4endl;
00465 for(unsigned ipo=0; ipo<theQHadrons.size(); ipo++)
00466 {
00467 G4int hPDG = theQHadrons[ipo]->GetPDGCode();
00468 G4LorentzVector h4Mom = theQHadrons[ipo]->Get4Momentum();
00469 G4int hNFrag= theQHadrons[ipo]->GetNFragments();
00470 G4QContent hQC = theQHadrons[ipo]->GetQC();
00471 G4cout<<"h#"<<ipo<<": "<<hPDG<<hQC<<",4M="<<h4Mom<<",nFr="<<hNFrag<<G4endl;
00472 }
00473 #endif
00474 }
00475 }
00476 }
00477 else
00478 {
00479 G4QContent hQC = curHadr->GetQC();
00480 #ifdef debug
00481 G4cout<<"G4QE::Const:CreateQuasm, 4M="<<ch4M<<",QC="<<hQC<<",E="<<envPDG<<",tC="
00482 <<totCharge<<",tB="<<totBaryoN<<G4endl;
00483 #endif
00484 CreateQuasmon(hQC, ch4M, fake);
00485 }
00486 }
00487 }
00488 }
00489 else
00490 {
00491
00492 G4QHadron* curHadr=projHadrons[0];
00493 G4int hPDG = curHadr->GetPDGCode();
00494 if(!hPDG||hPDG==10)
00495 {
00496 G4cout<<"---Warning---G4QEnvironment::Constructor:Vacuum,1st Hadron wrong PDG="<<hPDG
00497 <<", HQC="<<curHadr->GetQC()<<", HM="<<curHadr->GetMass()<<G4endl;
00498
00499 }
00500 else
00501 {
00502 G4int hQ = curHadr->GetQCode();
00503 if(hQ<0)
00504 {
00505 G4cout<<"---Warning---G4QEnviron::Constructor:Vacuum,Q<0, 1st HPDG="<<hPDG<<G4endl;
00506
00507 }
00508 else
00509 {
00510 G4LorentzVector h4Mom = curHadr->Get4Momentum();
00511 G4QContent hQC = curHadr->GetQC();
00512 if(!targPDG||targPDG==10) G4cout<<"G4QEnv::CreateQ; (1) PDG="<<targPDG<<G4endl;
00513 G4QPDGCode tQPDG(targPDG);
00514 G4int tQ = tQPDG.GetQCode();
00515 if(tQ<0||targPDG==10)
00516 {
00517 G4cout<<"---Warning---G4QEnv::Constructor:TrgQC<0, Chipo?,PDG="<<targPDG<<G4endl;
00518
00519 }
00520 else
00521 {
00522 h4Mom+=G4LorentzVector(0.,0.,0.,tQPDG.GetMass());
00523 hQC+=tQPDG.GetQuarkContent();
00524 #ifdef debug
00525 G4cout<<"G4QEnv::Const:VacHadrTarg="<<h4Mom<<hQC<<",E="<<theEnvironment<<G4endl;
00526 #endif
00527 G4Quasmon* curQuasmon = new G4Quasmon(hQC, h4Mom);
00528 theQuasmons.push_back(curQuasmon);
00529 }
00530 }
00531 }
00532 if(nHadrons>1) for(G4int ih=0; ih<nHadrons; ih++)
00533 {
00534 G4QHadron* newHadr = new G4QHadron(curHadr);
00535 #ifdef debug
00536 G4cout<<"*G4QE::Const:#"<<ih<<","<<curHadr->GetQC()<<curHadr->Get4Momentum()<<G4endl;
00537 #endif
00538 theQHadrons.push_back(newHadr);
00539 }
00540 }
00541 #ifdef chdebug
00542 G4int finCharge=theEnvironment.GetCharge();
00543 G4int finBaryoN=theEnvironment.GetA();
00544 G4int nHad=theQHadrons.size();
00545 if(nHad) for(G4int ih=0; ih<nHad; ih++)
00546 {
00547 finCharge+=theQHadrons[ih]->GetCharge();
00548 finBaryoN+=theQHadrons[ih]->GetBaryonNumber();
00549 }
00550 G4int nQuas=theQuasmons.size();
00551 if(nQuas) for(G4int iq=0; iq<nQuas; iq++)
00552 {
00553 finCharge+=theQuasmons[iq]->GetCharge();
00554 finBaryoN+=theQuasmons[iq]->GetBaryonNumber();
00555 }
00556 if(finCharge!=totCharge || finBaryoN!=totBaryoN)
00557 {
00558 G4cout<<"*::*G4QEnv::C:(0) tC="<<totCharge<<",C="<<finCharge<<",tB="<<totBaryoN
00559 <<",B="<<finBaryoN<<",E="<<theEnvironment<<G4endl;
00560 if(nHad) for(G4int h=0; h<nHad; h++)
00561 {
00562 G4QHadron* cH = theQHadrons[h];
00563 G4cout<<"*:*G4QE::C:h#"<<h<<",QC="<<cH->GetQC()<<",PDG="<<cH->GetPDGCode()<<G4endl;
00564 }
00565 if(nQuas) for(G4int q=0; q<nQuas; q++)
00566 {
00567 G4Quasmon* cQ = theQuasmons[q];
00568 G4cout<<"::G4QE::C:q#"<<q<<",C="<<cQ->GetCharge()<<",QuarkCon="<<cQ->GetQC()<<G4endl;
00569 }
00570 }
00571 #endif
00572 }
00573
00574
00575 G4QEnvironment::G4QEnvironment(const G4QEnvironment &right)
00576 {
00577
00578 theQFScat = G4QFreeScattering::GetPointer();
00579 G4int nQH = right.theQHadrons.size();
00580 if(nQH) for(G4int ih=0; ih<nQH; ih++)
00581 {
00582 G4QHadron* curQH = new G4QHadron(right.theQHadrons[ih]);
00583 #ifdef debug
00584 G4cout<<"G4QE::CopyByVal:cH#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
00585 #endif
00586 theQHadrons.push_back(curQH);
00587 }
00588
00589 G4int nP = right.theProjectiles.size();
00590 if(nP) for(G4int ip=0; ip<nP; ip++)
00591 {
00592 G4QHadron* curP = new G4QHadron(right.theProjectiles[ip]);
00593 theProjectiles.push_back(curP);
00594 }
00595 theTargetPDG = right.theTargetPDG;
00596 theWorld = right.theWorld;
00597 nBarClust = right.nBarClust;
00598 f2all = right.f2all;
00599 tot4Mom = right.tot4Mom;
00600 totCharge = right.totCharge;
00601 totBaryoN = right.totBaryoN;
00602
00603
00604 G4int nQ = right.theQuasmons.size();
00605 if(nQ) for(G4int iq=0; iq<nQ; iq++)
00606 {
00607 G4Quasmon* curQ = new G4Quasmon(right.theQuasmons[iq]);
00608 theQuasmons.push_back(curQ);
00609 }
00610
00611
00612 G4int nQC = right.theQCandidates.size();
00613 if(nQC) for(G4int ic=0; ic<nQC; ic++)
00614 {
00615 G4QCandidate* curQC = new G4QCandidate(right.theQCandidates[ic]);
00616 theQCandidates.push_back(curQC);
00617 }
00618
00619 theEnvironment = right.theEnvironment;
00620 }
00621
00622 G4QEnvironment::G4QEnvironment(G4QEnvironment* right)
00623 {
00624
00625 theQFScat = G4QFreeScattering::GetPointer();
00626 G4int nQH = right->theQHadrons.size();
00627 if(nQH) for(G4int ih=0; ih<nQH; ih++)
00628 {
00629 G4QHadron* curQH = new G4QHadron(right->theQHadrons[ih]);
00630 #ifdef debug
00631 G4cout<<"G4QE::CopyByPtr:cH#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
00632 #endif
00633 theQHadrons.push_back(curQH);
00634 }
00635
00636
00637 G4int nP = right->theProjectiles.size();
00638 if(nP) for(G4int ip=0; ip<nP; ip++)
00639 {
00640 G4QHadron* curP = new G4QHadron(right->theProjectiles[ip]);
00641 theProjectiles.push_back(curP);
00642 }
00643 theTargetPDG = right->theTargetPDG;
00644 theWorld = right->theWorld;
00645 nBarClust = right->nBarClust;
00646 f2all = right->f2all;
00647 tot4Mom = right->tot4Mom;
00648 totCharge = right->totCharge;
00649 totBaryoN = right->totBaryoN;
00650
00651
00652 G4int nQ = right->theQuasmons.size();
00653 if(nQ) for(G4int iq=0; iq<nQ; iq++)
00654 {
00655 G4Quasmon* curQ = new G4Quasmon(right->theQuasmons[iq]);
00656 theQuasmons.push_back(curQ);
00657 }
00658
00659
00660 G4int nQC = right->theQCandidates.size();
00661 if(nQC) for(G4int ic=0; ic<nQC; ic++)
00662 {
00663 G4QCandidate* curQC = new G4QCandidate(right->theQCandidates[ic]);
00664 theQCandidates.push_back(curQC);
00665 }
00666
00667 theEnvironment = right->theEnvironment;
00668 }
00669
00670 G4QEnvironment::~G4QEnvironment()
00671 {
00672 #ifdef debug
00673 G4cout<<"~G4QEnvironment: before theQCandidates nC="<<theQCandidates.size()<<G4endl;
00674 #endif
00675 for_each(theQCandidates.begin(), theQCandidates.end(), DeleteQCandidate());
00676 #ifdef debug
00677 G4cout<<"~G4QEnvironment: before theQuasmons nQ="<<theQuasmons.size()<<G4endl;
00678 #endif
00679 for_each(theQuasmons.begin(), theQuasmons.end(), DeleteQuasmon());
00680 #ifdef debug
00681 G4cout<<"~G4QEnvironment: before theQHadrons nH="<<theQHadrons.size()<<G4endl;
00682 #endif
00683 for_each(theQHadrons.begin(), theQHadrons.end(), DeleteQHadron());
00684 #ifdef debug
00685 G4cout<<"~G4QEnvironment: before theProjectiles nP="<<theProjectiles.size()<<G4endl;
00686 #endif
00687 for_each(theProjectiles.begin(), theProjectiles.end(), DeleteQHadron());
00688 #ifdef debug
00689 G4cout<<"~G4QEnvironment: === DONE ==="<<G4endl;
00690 #endif
00691 }
00692
00693 G4double G4QEnvironment::SolidAngle=0.8;
00694 G4bool G4QEnvironment::EnergyFlux=false;
00695 G4bool G4QEnvironment::WeakDecays=false;
00696 G4bool G4QEnvironment::ElMaDecays=true;
00697 G4double G4QEnvironment::PiPrThresh=141.4;
00698 G4double G4QEnvironment::M2ShiftVir=20000.;
00699 G4double G4QEnvironment::DiNuclMass=1880.;
00700
00701
00702 void G4QEnvironment::OpenElectromagneticDecays(){ElMaDecays=true;}
00703
00704
00705 void G4QEnvironment::CloseElectromagneticDecays(){ElMaDecays=false;}
00706
00707
00708 void G4QEnvironment::SetParameters(G4double solAn, G4bool efFlag, G4double piThresh,
00709 G4double mpisq, G4double dinum)
00710 {
00711 EnergyFlux=efFlag;
00712 SolidAngle=solAn;
00713 PiPrThresh=piThresh;
00714 M2ShiftVir=mpisq;
00715 DiNuclMass=dinum;
00716 }
00717
00718 const G4QEnvironment& G4QEnvironment::operator=(const G4QEnvironment &right)
00719 {
00720 if(this != &right)
00721 {
00722
00723 theQFScat = G4QFreeScattering::GetPointer();
00724 G4int iQH = theQHadrons.size();
00725 if(iQH) for(G4int ii=0; ii<iQH; ii++) delete theQHadrons[ii];
00726 theQHadrons.clear();
00727 G4int nQH = right.theQHadrons.size();
00728 if(nQH) for(G4int ih=0; ih<nQH; ih++)
00729 {
00730 G4QHadron* curQH = new G4QHadron(right.theQHadrons[ih]);
00731 #ifdef debug
00732 G4cout<<"G4QE::Operator=:c#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
00733 #endif
00734 theQHadrons.push_back(curQH);
00735 }
00736
00737 theWorld = right.theWorld;
00738 nBarClust = right.nBarClust;
00739 f2all = right.f2all;
00740
00741
00742 G4int iQ = theQuasmons.size();
00743 if(iQ) for(G4int jq=0; jq<iQ; jq++) delete theQuasmons[jq];
00744 theQuasmons.clear();
00745 G4int nQ = right.theQuasmons.size();
00746 if(nQ) for(G4int iq=0; iq<nQ; iq++)
00747 {
00748 G4Quasmon* curQ = new G4Quasmon(right.theQuasmons[iq]);
00749 theQuasmons.push_back(curQ);
00750 }
00751
00752
00753 G4int iQC = theQCandidates.size();
00754 if(iQC) for(G4int jc=0; jc<iQC; jc++) delete theQCandidates[jc];
00755 theQCandidates.clear();
00756 G4int nQC = right.theQCandidates.size();
00757 if(nQC) for(G4int ic=0; ic<nQC; ic++)
00758 {
00759 G4QCandidate* curQC = new G4QCandidate(right.theQCandidates[ic]);
00760 theQCandidates.push_back(curQC);
00761 }
00762
00763 theEnvironment = right.theEnvironment;
00764 }
00765 return *this;
00766 }
00767
00768
00769 void G4QEnvironment::CreateQuasmon(const G4QContent& projQC, const G4LorentzVector& pro4M,
00770 G4bool fake)
00771 {
00772
00773 static const G4double mNeut= G4QPDGCode(2112).GetMass();
00774 static const G4double mNeu2 = mNeut*mNeut;
00775 static const G4double mProt= G4QPDGCode(2212).GetMass();
00776 static const G4double mPro2 = mProt*mProt;
00777
00778 static const G4double mPi = G4QPDGCode(211).GetMass();
00779 static const G4double mPi2 = mPi*mPi;
00780
00781
00782
00783
00784
00785 static const G4QContent neutQC(2,1,0,0,0,0);
00786 static const G4QContent protQC(1,2,0,0,0,0);
00787 static const G4QContent deutQC(3,3,0,0,0,0);
00788 static const G4QContent lambQC(1,1,1,0,0,0);
00789 static const G4QNucleus vacuum(90000000);
00790 G4QContent valQ(0,0,0,0,0,0);
00791 G4LorentzVector q4Mom(0.,0.,0.,0.);
00792 nBarClust = 1;
00793 G4LorentzVector proj4M=pro4M;
00794 G4double projE=proj4M.e();
00795 G4int projPDG=projQC.GetSPDGCode();
00796 if(projE<0.)
00797 {
00798 G4cout<<"*Warning*G4QEnvironment::CreateQuasmon:Epr="<<projE<<"<0,QC="<<projQC<<G4endl;
00799 projE=0.;
00800 proj4M=G4LorentzVector(0.,0.,0.,0.);
00801 }
00802 G4double projM2=proj4M.m2();
00803 G4bool Pr1 = theProjectiles.size() == 1;
00804 if(Pr1 && std::fabs(G4QPDGCode(projPDG).GetMass2()-projM2) > .1 ) Pr1=false;
00805 G4int targPDG=theEnvironment.GetPDG();
00806 if(targPDG>80000000&&targPDG!=90000000&&(theEnvironment.Get4Momentum().m2())>1000.)
00807 {
00808 G4double tgMass=theEnvironment.GetMass();
00809 #ifdef debug
00810 G4cout<<"G4QEnvironment::CreateQ:Interact "<<projQC<<proj4M<<"(m2="<<projM2<<") + A="
00811 <<targPDG<<",M="<<tgMass<<",tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
00812 #endif
00813 G4int envZ=theEnvironment.GetZ();
00814 G4int envN=theEnvironment.GetN();
00815 G4int envS=theEnvironment.GetS();
00816 G4int envBN=envZ+envN+envS;
00817 G4int nP =theWorld->GetQPEntries();
00818
00819 G4int nCl =nP-53;
00820 if(nCl<0) G4cout<<"---Warning---G4QEnv::CreaQ:nP="<<nP<<" for Targ="<<targPDG<<G4endl;
00821 if (nCl<3) nBarClust=1;
00822 else if(nCl<9) nBarClust=2;
00823 else
00824 {
00825 G4int v=nCl-9;
00826 G4int d=v/15;
00827 G4int r=v%15;
00828 if(r<7) nBarClust=3+d+d;
00829 else nBarClust=4+d+d;
00830 }
00831 #ifdef debug
00832 G4cout<<"G4QE::CrQ:TNuc:Z="<<envZ<<",N="<<envN<<",nC="<<nBarClust<<",tC="
00833 <<totCharge<<", tB="<<totBaryoN<<G4endl;
00834 #endif
00835 G4bool pbpt=projE<PiPrThresh+(M2ShiftVir+projM2)/DiNuclMass;
00836 G4bool din=false;
00837 G4bool piF=false;
00838 G4bool gaF=false;
00839 if((projM2-mPi2<.00001||projE-mPi<2.7)&&projPDG==-211&&!fake) piF=true;
00840
00841 if(pbpt&&projPDG==22) gaF=true;
00842 theEnvironment.SetMaxClust(nBarClust);
00843 nBarClust=theEnvironment.UpdateClusters(din);
00844 #ifdef debug
00845 G4cout<<"G4QEnv::CreateQ: Nucleus("<<targPDG<<") is created ("<<nBarClust<<" clast's)";
00846 for(G4int ic=0;ic<nBarClust;ic++)
00847 G4cout<<" #"<<ic<<"("<<theEnvironment.GetProbability(ic)<<")";
00848 G4cout<<G4endl;
00849 #endif
00850 theEnvironment.PrepareCandidates(theQCandidates,piF,gaF,proj4M);
00851 G4QNucleus memEnviron=theEnvironment;
00852 #ifdef debug
00853 G4cout<<"G4QE::CrQ:ClusterProbabCalculation tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
00854 #endif
00855
00856 G4bool efFlag = false;
00857
00858
00859 G4int efCounter=0;
00860 G4QContent EnFlQC(0,0,0,0,0,0);
00861 G4LorentzVector ef4Mom(0.,0.,0.,0.);
00862 G4double proj3M=proj4M.rho();
00863
00864 if((projPDG==-2212||projPDG==-2112||projPDG==-3122||projPDG==-3112||projPDG==-3212||
00865 projPDG==-3222) && envBN>1 && proj3M<10.)
00866
00867 {
00868
00869 #ifdef debug
00870 G4cout<<"G4QE::CreQ:Annihilation on a perif. nucleon, Z="<<envZ<<",N="<<envN<<G4endl;
00871 #endif
00872 G4double zpn=envZ+envN;
00873 G4double rnd=zpn*G4UniformRand();
00874
00875
00876
00877 G4int targNPDG = 90000000;
00878 G4QContent targQC(0,0,0,0,0,0);
00879 if (rnd<envN)
00880 {
00881 targNPDG = 90000001;
00882 targQC = neutQC;
00883 }
00884 else
00885
00886 {
00887 targNPDG = 90001000;
00888 targQC = protQC;
00889 }
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900 theEnvironment.Reduce(targNPDG);
00901 G4double resMass=theEnvironment.GetGSMass();
00902 G4double barMass=tgMass-resMass;
00903 tgMass=resMass;
00904 q4Mom=G4LorentzVector(0,0,0,barMass)+proj4M;
00905 valQ=targQC+projQC;
00906 #ifdef debug
00907 G4cout<<"G4QEnviron::CQ:"<<targNPDG<<" + Env="<<theEnvironment<<",QC="<<valQ<<G4endl;
00908 #endif
00909
00910 G4Quasmon fakeQ;
00911 G4double QTemper=fakeQ.GetTemper();
00912 G4double QSOverU=fakeQ.GetSOverU();
00913 G4double QEtaSup=fakeQ.GetEtaSup();
00914 G4Quasmon::SetParameters(180.,QSOverU,.3);
00915 G4Quasmon::CloseElectromagneticDecays();
00916 G4Quasmon* pan = new G4Quasmon(valQ,q4Mom);
00917 G4QNucleus vE(90000000);
00918 #ifdef debug
00919 G4cout<<"G4QE::CreQ: before Fragment, vE="<<vE<<",vP="<<vE.GetProbability()<<",QQC="
00920 <<valQ<<",Q4M="<<q4Mom<<G4endl;
00921 #endif
00922 G4QHadronVector* output=pan->Fragment(vE,1);
00923 #ifdef debug
00924 G4cout<<"G4QE::CrQ:NucleonAntinucleonAnnihilation's done,N="<<output->size()<<G4endl;
00925 #endif
00926 G4Quasmon::OpenElectromagneticDecays();
00927 #ifdef debug
00928 G4cout<<"G4QE::CrQ:>>AnnihilationIsDone,C="<<totCharge<<",B="<<totBaryoN<<G4endl;
00929 #endif
00930 delete pan;
00931 G4QHadronVector input;
00932
00933 G4LorentzVector trg4M(0.,0.,0.,resMass);
00934 G4int tNH = output->size();
00935 G4ThreeVector dir = G4RandomDirection();
00936
00937 G4double ra=G4QThd(totBaryoN);
00938 #ifdef debug
00939 G4cout<<"G4QE::CQ:N="<<tNH<<",T="<<totCharge<<","<<totBaryoN<<",A="<<ra<<G4endl;
00940 #endif
00941 for (G4int ind=0; ind<tNH; ind++)
00942 {
00943
00944 G4QHadron* curHadr = (*output)[ind];
00945 G4int shDFL= curHadr->GetNFragments();
00946 G4LorentzVector sh4m = curHadr->Get4Momentum();
00947 G4ThreeVector shDIR= sh4m.vect().unit();
00948 G4int shPDG= curHadr->GetPDGCode();
00949 G4int shCHG= curHadr->GetCharge();
00950 G4double shMOM= sh4m.rho();
00951 #ifdef debug
00952 G4cout<<"G4QE::CrQ:"<<ind<<","<<shDFL<<",PDG="<<shPDG<<",4M="<<sh4m<<G4endl;
00953 #endif
00954 G4double solAnCut=SolidAngle;
00955 if(fabs(ra)<.1) solAnCut=3.;
00956 else if(shMOM<.1)
00957 {
00958 if(shCHG<=0.) solAnCut=-3.;
00959 else solAnCut= 3.;
00960 }
00961 else solAnCut+=1000*shCHG/shMOM/ra;
00962
00963 #ifdef debug
00964 G4cout<<"G4QE::CrQ: PDG="<<shPDG<<", p="<<shMOM<<", r="<<ra<<G4endl;
00965 #endif
00966 if(!shDFL)
00967 {
00968 #ifdef debug
00969 G4cout<<"G4QE::CQ:>H="<<shPDG<<":"<<dir.dot(shDIR)<<">"<<solAnCut<<G4endl;
00970 #endif
00971
00972 if(dir.dot(shDIR)>solAnCut && abs(shPDG)>99)
00973 {
00974 #ifdef debug
00975 G4cout<<"G4QE::CQ:>H="<<shPDG<<":"<<dir.dot(shDIR)<<">"<<solAnCut<<", P="
00976 << shMOM <<" < 120" << G4endl;
00977 #endif
00978
00979
00980
00981
00982
00983
00984
00985 #ifdef debug
00986
00987
00988
00989 #endif
00990
00991
00992 {
00993 G4QHadron* mqHadron = new G4QHadron(curHadr);
00994 input.push_back(mqHadron);
00995 #ifdef debug
00996 G4int hPDG=curHadr->GetPDGCode();
00997 G4LorentzVector h4M = curHadr->Get4Momentum();
00998 G4cout<<"G4QE::CrQ:Absorb#"<<ind<<", PDG="<<hPDG<<", h4M="<<h4M<<G4endl;
00999 #endif
01000 }
01001 }
01002 else
01003 {
01004 #ifdef debug
01005 G4int hPDG=curHadr->GetPDGCode();
01006 G4LorentzVector h4M = curHadr->Get4Momentum();
01007 G4cout<<"G4QE::CrQ: Fill OUT #"<<ind<<",PDG="<<hPDG<<",h4M="<<h4M<<G4endl;
01008 #endif
01009
01010 G4QHadron* curHadron = new G4QHadron(curHadr);
01011 theQHadrons.push_back(curHadron);
01012 }
01013 }
01014 }
01015 for_each(output->begin(), output->end(), DeleteQHadron());
01016 output->clear();
01017 delete output;
01018 if(!efFlag)
01019 {
01020 G4int noh = theQHadrons.size();
01021 if(noh) for(G4int kh=0; kh<noh; kh++)
01022 {
01023 #ifdef debug
01024 G4cout<<"G4QE::CreateQ:H#"<<kh<<", QC="<<theQHadrons[kh]->GetQC()
01025 <<", 4M="<<theQHadrons[kh]->Get4Momentum()<<G4endl;
01026 #endif
01027 G4QHadronVector* tmpQHadVec=G4Quasmon().DecayQHadron(theQHadrons[kh]);
01028 G4int tmpS=tmpQHadVec->size();
01029 intQHadrons.resize(tmpS+intQHadrons.size());
01030 copy(tmpQHadVec->begin(), tmpQHadVec->end(), intQHadrons.end()-tmpS);
01031 tmpQHadVec->clear();
01032 delete tmpQHadVec;
01033 }
01034 theQHadrons.clear();
01035 #ifdef debug
01036 G4int nInH=intQHadrons.size();
01037 G4cout<<"G4QE::CrQ:nH="<<nInH<<",C="<<totCharge<<",B="<<totBaryoN<<G4endl;
01038 #endif
01039 if(!(input.size()))
01040 {
01041 #ifdef debug
01042 G4cout<<"*G4QEnv::CrQ:AnnihStack tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
01043 #endif
01044 return;
01045 }
01046 #ifdef debug
01047 G4cout<<"G4QE::CrQ:fakeQ, restPars tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
01048 #endif
01049 G4Quasmon::SetParameters(QTemper,QSOverU,QEtaSup);
01050 G4Quasmon::OpenElectromagneticDecays();
01051
01052 G4QEnvironment* muq = new G4QEnvironment(input,theEnvironment.GetPDG());
01053 #ifdef debug
01054 G4cout<<"G4QE::CrQ:befCl&Dest tC="<<totCharge<<", tB="<<totBaryoN<<G4endl;
01055 #endif
01056 for_each(input.begin(), input.end(), DeleteQHadron());
01057 input.clear();
01058 theEnvironment = muq->GetEnvironment();
01059 G4QHadronVector* outH = muq->GetQHadrons();
01060 G4QuasmonVector* outQ = muq->GetQuasmons();
01061 delete muq;
01062 noh = outH->size();
01063 #ifdef debug
01064 G4cout<<"G4QEnv::CreateQ:*** #ofNotInterQH="<<noh<<" is found ***"<<G4endl;
01065 #endif
01066 if(noh) for(G4int nh=0; nh<noh; nh++)
01067 {
01068 #ifdef debug
01069 G4cout<<"G4QE::CreateQ: NotIntQH#"<<nh<<", QC="<<(*outH)[nh]->GetQC()
01070 <<", 4M="<<(*outH)[nh]->Get4Momentum()<<G4endl;
01071 #endif
01072 G4QHadronVector* tmpQHadVec=G4Quasmon().DecayQHadron((*outH)[nh]);
01073 G4int tmpS=tmpQHadVec->size();
01074 intQHadrons.resize(tmpS+intQHadrons.size());
01075 copy(tmpQHadVec->begin(), tmpQHadVec->end(), intQHadrons.end()-tmpS);
01076 tmpQHadVec->clear();
01077 delete tmpQHadVec;
01078 }
01079 outH->clear();
01080 delete outH;
01081 G4int nMQ = outQ->size();
01082 #ifdef debug
01083 G4LorentzVector eLorV=theEnvironment.Get4Momentum();
01084 G4cout<<"G4QE::CrQ:nMQ="<<nMQ<<",tC="<<totCharge<<", tB="<<totBaryoN<<G4endl;
01085 G4cout<<"G4QE::CrQ:Env4M="<<eLorV<<G4endl;
01086 G4LorentzVector contr4M=eLorV;
01087 #endif
01088 if(nMQ) for(G4int mh=0; mh<nMQ; mh++)
01089 {
01090 G4Quasmon* curQ = new G4Quasmon((*outQ)[mh]);
01091 #ifdef debug
01092 G4LorentzVector qLorV=curQ->Get4Momentum();
01093 G4cout<<"G4QE::CrQ:Q#"<<mh<<",4M="<<qLorV<<curQ->GetQC()<<G4endl;
01094 contr4M+=qLorV;
01095 #endif
01096 theQuasmons.push_back(curQ);
01097 }
01098 for_each(outQ->begin(), outQ->end(), DeleteQuasmon());
01099 outQ->clear();
01100 delete outQ;
01101 #ifdef debug
01102 G4int nsHadr = theQHadrons.size();
01103 G4cout<<"G4QEnvironment::CreateQ: before return nH="<<nsHadr<<G4endl;
01104 if(nsHadr) for(G4int jso=0; jso<nsHadr; jso++)
01105 {
01106 G4int hsNF = theQHadrons[jso]->GetNFragments();
01107 if(!hsNF)
01108 {
01109 G4LorentzVector hLorV=theQHadrons[jso]->Get4Momentum();
01110 G4int hPDGC=theQHadrons[jso]->GetPDGCode();
01111 G4cout<<"G4QE::CrQ: H#"<<jso<<",4M="<<hLorV<<hPDGC<<G4endl;
01112 contr4M+=hLorV;
01113 }
01114 else
01115 G4cout<<"G4Q::CrQ:"<<jso<<"NF=0,4M="<<theQHadrons[jso]->Get4Momentum()<<G4endl;
01116 }
01117 G4cout<<"G4QEnvironment::CreateQ: before return tot4M="<<contr4M<<G4endl;
01118 #endif
01119 return;
01120 }
01121 else
01122 {
01123 if (!efCounter) return;
01124 }
01125 }
01126 else EnFlQC=projQC;
01127 G4double EnFlP=ef4Mom.rho();
01128 PrepareInteractionProbabilities(EnFlQC,EnFlP);
01129 G4int nCandid = theQCandidates.size();
01130 #ifdef debug
01131 G4cout<<"G4QEnvironment::CrQ: InteractionProbabilities are done, nC="<<nCandid<<G4endl;
01132 #endif
01133 if(nCandid<=0)
01134 {
01135
01136
01137 G4ExceptionDescription ed;
01138 ed << "Cannot select a cluster: nC=" << nCandid << ",E="
01139 << theEnvironment << G4endl;
01140 G4Exception("G4QEnvironment::CreateQuasmon()", "HAD_CHPS_0000",
01141 FatalException, ed);
01142 }
01143 G4double maxP = theQCandidates[nCandid-1]->GetIntegProbability();
01144 G4int i=0;
01145 G4QContent curQC;
01146 if(nCandid==1||maxP==0.)
01147 {
01148 #ifdef debug
01149 G4cout<<"***G4QEnv::CrQ:MaxP=0||nCand=1: Use all Env., Env="<<theEnvironment<<G4endl;
01150 #endif
01151 curQC=theEnvironment.GetQCZNS();
01152 theEnvironment=vacuum;
01153 }
01154 else
01155 {
01156 G4double totP = maxP * G4UniformRand();
01157 #ifdef debug
01158 G4cout<<"G4QEnvironment::CrQ:nC="<<nCandid<<", maxP="<<maxP<<", totP="<<totP<<G4endl;
01159 #endif
01160 while(theQCandidates[i]->GetIntegProbability()<totP) i++;
01161 G4QCandidate* curCand = theQCandidates[i];
01162 curQC = curCand->GetQC();
01163 G4QNucleus targClust(curQC.GetP(),curQC.GetN(),curQC.GetL());
01164 G4double clMass=targClust.GetGSMass();
01165 #ifdef cldebug
01166 G4cout<<"G4QEnv::CrQ:Cl#"<<i<<"(of "<<nCandid<<"),QC="<<curQC<<",M="<<clMass<<G4endl;
01167 #endif
01168 G4LorentzVector pq4M=proj4M+G4LorentzVector(0.,0.,0.,clMass);
01169 if(pq4M.m()>=clMass)
01170 {
01171 #ifdef debug
01172 G4cout<<"G4QEnv::CQ:#"<<i<<"("<<targClust<<curQC<<") Env="<<theEnvironment<<G4endl;
01173 #endif
01174 theEnvironment.Reduce(targClust.GetPDG());
01175 }
01176 else
01177 {
01178 G4double teMass=theEnvironment.GetGSMass();
01179 G4LorentzVector te4M=proj4M+G4LorentzVector(0.,0.,0.,teMass);
01180 if(te4M.m()>=teMass)
01181 {
01182 #ifdef debug
01183 G4cout<<"***G4QEnv::CrQ: Deep virtual, use all Env,Env="<<theEnvironment<<G4endl;
01184 #endif
01185 curQC=theEnvironment.GetQCZNS();
01186 theEnvironment=vacuum;
01187 }
01188 else
01189 {
01190 G4QHadron* projH = new G4QHadron(projQC,proj4M);
01191 theQHadrons.push_back(projH);
01192 G4cout<<"---Warning---G4QE::CrQ:Fill Proj asItIs QC/4m="<<projQC<<proj4M<<G4endl;
01193 return;
01194 }
01195 }
01196 }
01197 G4double envMass=theEnvironment.GetGSMass();
01198
01199 if(Pr1&&projPDG==22&&projE<PiPrThresh+(M2ShiftVir+projM2)/DiNuclMass)
01200
01201 {
01202 q4Mom=G4LorentzVector(0.,0.,0.,tgMass-envMass);
01203 valQ=curQC;
01204 #ifdef debug
01205 G4cout<<"G4QE::CrQ:Q="<<q4Mom<<valQ<<"+vg="<<proj4M<<",Env="<<theEnvironment<<G4endl;
01206 #endif
01207 G4Quasmon* curQuasmon = new G4Quasmon(valQ, q4Mom, proj4M);
01208 theQuasmons.push_back(curQuasmon);
01209 }
01210 else if(Pr1&&(std::fabs(projM2-mPi2)<.00001 && projE-mPi<0.1) && projPDG==-211 &&!fake)
01211
01212 {
01213 q4Mom=proj4M+G4LorentzVector(0.,0.,0.,tgMass-envMass);
01214 valQ=EnFlQC+curQC;
01215 #ifdef debug
01216 if(projE<mPi)G4cout<<"*VirtualPiM*G4QE::CrQ:Ener(pi-)="<<projE<<"<mPi="<<mPi<<G4endl;
01217 G4cout<<"G4QEnv::CrQ:Q="<<q4Mom<<valQ<<"+pi="<<proj4M<<",E="<<theEnvironment<<G4endl;
01218 #endif
01219 G4Quasmon* curQuasmon = new G4Quasmon(valQ, q4Mom, -proj4M);
01220 theQuasmons.push_back(curQuasmon);
01221 }
01222
01223 else if(2>3)
01224 {
01225 q4Mom=proj4M;
01226 valQ=EnFlQC;
01227 theEnvironment=memEnviron;
01228 #ifdef debug
01229 G4cout<<"G4QEnv::CreQAll: Q="<<q4Mom<<valQ<<", QEnv="<<theEnvironment<<G4endl;
01230 #endif
01231 G4Quasmon* curQuasmon = new G4Quasmon(valQ, q4Mom);
01232 theQuasmons.push_back(curQuasmon);
01233 }
01234 else if(Pr1&&projPDG==2212&&G4UniformRand()>15./(proj4M.e()-mProt))
01235
01236 {
01237 G4double prM=mProt;
01238 G4double prM2=mPro2;
01239 G4double scM=mProt;
01240 G4double scM2=mPro2;
01241 G4QContent scQC=projQC;
01242 G4QContent chQC(0,0,0,0,0,0);
01243 if(G4UniformRand()<.5*envN/envBN)
01244 {
01245 scM=mNeut;
01246 scM2=mNeu2;
01247 scQC=neutQC;
01248 chQC=projQC-scQC;
01249 }
01250 G4double tnM=tgMass-envMass;
01251 G4double tnM2=tnM*tnM;
01252 G4double dtnM=tnM+tnM;
01253 G4double prE=proj4M.e();
01254 G4double mu2=tnM2+dtnM*(prE-scM);
01255
01256 G4double B=.00001;
01257 G4double rmu2=0.;
01258 G4double tmax=0.;
01259 G4double rt=0.;
01260 G4double om=0.;
01261 G4double ep=0.;
01262 if (prE<prM)G4cout<<"-Warn-G4QEnv::CreQAll:(scat w ex)E="<<prE<<" < M="<<prM<<G4endl;
01263 G4double Pi=std::sqrt(prE*prE-prM2);
01264 G4double po=0.;
01265 G4double cost=2.;
01266 G4int cct=0;
01267 while ( std::fabs(cost) > 1. )
01268 {
01269 cct++;
01270 #ifdef debug
01271 G4cout<<"-Warning-G4QEnv::CreQAll: c="<<cct<<" (scat w ex) cost="<<cost<<G4endl;
01272 #endif
01273 rmu2=tnM2*pow(mu2/tnM2,G4UniformRand());
01274 tmax=mu2-rmu2;
01275 rt=-std::log(1.-G4UniformRand()*(1.-std::exp(-B*tmax)))/B;
01276 om=(tnM2+rmu2+rt)/dtnM;
01277 ep=prE+tnM-om;
01278 #ifdef debug
01279 G4cout<<"G4QEnv::CreQAll: m2="<<tnM2<<" < mu2="<<rmu2<<" < "<<mu2<<"=Max2"<<G4endl;
01280 G4cout<<"G4QEnv::CreQAll: -t="<<rt<<" < "<<tmax<<"=tmax"<<G4endl;
01281 G4cout<<"G4QEnv::CreQAl: om="<<om<<" > m="<<tnM<<", ep="<<ep<<" > M="<<prM<<G4endl;
01282 #endif
01283 if(ep<scM)G4cout<<"+Warn-G4QEnv::CreQAl:(scat w ex)Eo="<<prE<<" < M="<<prM<<G4endl;
01284 po=std::sqrt(ep*ep-scM2);
01285 cost=(prE*ep-0.5*(rt+prM2+scM2))/Pi/po;
01286 }
01287 G4double om2=om*om;
01288 if(om2<rmu2)G4cout<<"-Warn-G4QEnv::CreQA:(scat w ex)e2="<<om<<" < mu2="<<tnM<<G4endl;
01289 #ifdef debug
01290 G4cout<<"G4QEnv::CreQAll: ct="<<cost<<",pio="<<Pi*po<<",()="<<cost*Pi*po<<G4endl;
01291 G4double ps=std::sqrt(om2-rmu2);
01292 #endif
01293 G4double pfc=po*cost;
01294 G4double pfs=po*std::sqrt(1.-cost*cost);
01295
01296 G4ThreeVector vdir = proj4M.vect();
01297 G4ThreeVector vx(0.,0.,1.);
01298 G4ThreeVector vy(0.,1.,0.);
01299 G4ThreeVector vz(1.,0.,0.);
01300 if(vdir.mag2() > 0.)
01301 {
01302 vx = vdir.unit();
01303 G4ThreeVector vv= vx.orthogonal();
01304 vy = vv.unit();
01305 vz = vx.cross(vy);
01306 }
01307
01308 G4double phi=twopi*G4UniformRand();
01309 G4ThreeVector fp=pfc*vx+pfs*(std::sin(phi)*vy+std::cos(phi)*vz);
01310 G4LorentzVector s4M(fp,ep);
01311 #ifdef debug
01312 G4cout<<"G4QEnv::CreQA:ps="<<po<<"="<<fp.mag()<<",sM="<<prM<<"="<<s4M.m()<<G4endl;
01313 G4cout<<"G4QEnv::CreQA:Ee="<<prE*ep<<" =? "<<(prM2+rt/2-Pi*po*cost)<<G4endl;
01314 #endif
01315 if(std::fabs(s4M.m()-scM)>.001)G4cout<<"-W-G4QE::CQA:M="<<prM<<"#"<<s4M.m()<<G4endl;
01316 G4LorentzVector c4M=proj4M+G4LorentzVector(0.,0.,0.,tnM)-s4M;
01317 #ifdef debug
01318 G4cout<<"G4QEnv::CreQA: ec="<<om<<" = "<<c4M.e()<<", pc="<<ps<<" = "
01319 <<c4M.rho()<<", mc2="<<rmu2<<" = "<<c4M.m2()<<G4endl;
01320 G4cout<<"G4QEnv::CQA:ht="<<(tnM2+rmu2)/2-tnM*om<<"="<<prM2-prE*ep+Pi*po*cost<<G4endl;
01321 #endif
01322 if(std::fabs(c4M.m2()-rmu2)>.1)
01323 G4cout<<"-W-G4QE::CrQ:m2="<<rmu2<<"#"<<c4M.m2()<<",P="<<proj4M<<",M="<<tnM<<G4endl;
01324 G4QHadron* projH = new G4QHadron(scQC,s4M);
01325 theQHadrons.push_back(projH);
01326 G4Quasmon* curQuasmon = new G4Quasmon(curQC+chQC, c4M);
01327 theQuasmons.push_back(curQuasmon);
01328 }
01329 else
01330 {
01331 q4Mom=proj4M+G4LorentzVector(0.,0.,0.,tgMass-envMass);
01332 valQ=EnFlQC+curQC;
01333 #ifdef debug
01334 G4cout<<"G4QEnv::CreQAll: Q="<<q4Mom<<valQ<<", QEnv="<<theEnvironment<<G4endl;
01335 #endif
01336 G4Quasmon* curQuasmon = new G4Quasmon(valQ, q4Mom);
01337 theQuasmons.push_back(curQuasmon);
01338 }
01339 }
01340 else
01341 {
01342 G4cout<<"---Warning---G4QEnvironment::CreateQuasmon:Strange targPDG="<<targPDG<<G4endl;
01343
01344 }
01345 }
01346
01347
01348 void G4QEnvironment::PrepareInteractionProbabilities(const G4QContent& projQC, G4double AP)
01349 {
01350 G4double sum = 0.;
01351 G4double probab = 0.;
01352 G4double denseB = 0.;
01353 G4double allB = 0.;
01354 G4int pPDG = projQC.GetSPDGCode();
01355 if(2>3) {allB=AP; allB=pPDG;}
01356 for (unsigned index=0; index<theQCandidates.size(); index++)
01357 {
01358 G4QCandidate* curCand=theQCandidates[index];
01359 G4int cPDG = curCand->GetPDGCode();
01360 G4int cST = curCand->GetStrangeness();
01361 G4int cBN = curCand->GetBaryonNumber();
01362 G4int cCH = curCand->GetCharge();
01363 #ifdef sdebug
01364 G4cout<<"G4QE::PIP:=---=> #"<<index<<", cPDG="<<cPDG<<",S="<<cST<<G4endl;
01365 #endif
01366 if(cPDG>80000000&&cPDG!=90000000&&!cST&&cCH>0&&cBN>0&&cCH<=cBN)
01367 {
01368 G4int zc = cCH;
01369 G4int nc = cBN-cCH;
01370 G4double nOfCl=curCand->GetPreProbability();
01371 G4double dOfCl=curCand->GetDenseProbability();
01372 #ifdef sdebug
01373 G4cout<<"G4QE::PIP:Z="<<zc<<",N="<<nc<<",nC="<<nOfCl<<",dC="<<dOfCl<<G4endl;
01374 #endif
01375 if(cPDG==91000000||cPDG==90001000||cPDG==90000001)
01376 {
01377 allB+=nOfCl;
01378 denseB+=dOfCl;
01379 }
01380 G4QContent pQC=curCand->GetQC();
01382 G4QContent qQC=pQC+projQC;
01383 G4QPDGCode qQPDG(qQC);
01384 G4int qC = qQPDG.GetQCode();
01385 G4double d = abs(zc-nc);
01386 G4double fact=1./pow(2.,d);
01387 if (qC<-1) probab=0.;
01388
01389
01390 else if(pPDG==22 && AP<152.)
01391 {
01392 if(cBN<2) probab=nOfCl*cBN*fact;
01393 else probab=0.;
01394 }
01395 else if(pPDG==2212)
01396 {
01397
01398
01399 probab=nOfCl*cBN*fact;
01400
01401 }
01403
01404
01405
01406
01407 else probab=nOfCl*cBN*fact;
01408
01409
01410
01411 #ifdef sdebug
01412 G4int pPDG = projQC.GetSPDGCode();
01413 G4int rPDG = qQC.GetSPDGCode();
01414 G4double baryn = qQC.GetBaryonNumber();
01415 G4double charge= qQC.GetCharge();
01416 G4double dq= abs(baryn-charge-charge);
01417 G4cout<<"G4QE::PIP:P="<<probab<<",ac="<<cBN<<",dq="<<dq<<",f="<<fact<<",qC="
01418 <<qC<<",rPDG="<<rPDG<<",pPDG="<<pPDG<<",nCP="<<nOfCl<<",dCP="<<dOfCl<<G4endl;
01419 #endif
01420 }
01421 else probab=0.;
01422 sum+=probab;
01423 curCand->SetIntegProbability(sum);
01424 }
01425 if(allB>0.)f2all=(allB-denseB)/allB;
01426 else f2all=0.;
01427 }
01428
01429
01430 void G4QEnvironment::InitClustersVector(G4int maxClust, G4int maxA)
01431 {
01432 #ifdef debug
01433 G4cout<<"G4QEnvironment::InitClustersVector called with nC="<<maxClust<<G4endl;
01434 #endif
01435 if(maxClust>=0) for (G4int i=0; i<maxClust; i++)
01436 {
01437
01438 G4int clustQCode = i+53;
01439 #ifdef sdebug
01440 G4cout<<"G4QEnvironment::InitClustersVector: Before Init Q ="<<clustQCode<<G4endl;
01441 #endif
01442 G4QPDGCode clustQPDG(true,clustQCode);
01443
01444 G4int clusterPDG=clustQPDG.GetPDGCode();
01445 G4int clustB=clustQPDG.GetBaryNum();
01446 #ifdef sdebug
01447 G4cout<<"G4QEnvironment::InitClustersVector: Before insert ="<<clusterPDG<<G4endl;
01448 #endif
01449
01450 if(clustB<=maxA) theQCandidates.push_back(new G4QCandidate(clusterPDG));
01451 #ifdef sdebug
01452 G4cout<<"G4QEnvironment::InitClustersVector: Cluster # "<<i<<" with code = "
01453 <<clusterPDG<<", QC="<<clustQPDG.GetQuarkContent()<<G4endl;
01454 #endif
01455 }
01456 }
01457
01458
01459 G4QHadronVector G4QEnvironment::HadronizeQEnvironment()
01460 {
01461 static const G4int NUCPDG = 90000000;
01462 static const G4QNucleus vacuum(NUCPDG);
01463 static const G4LorentzVector zeroLV(0.,0.,0.,0.);
01464
01465 static const G4QContent PiQC(0,1,0,1,0,0);
01466 static const G4QContent K0QC(1,0,0,0,0,1);
01467 static const G4QContent KpQC(0,1,0,0,0,1);
01468 static const G4QContent SiPQC(0,2,1,0,0,0);
01469 static const G4QContent SiMQC(2,0,1,0,0,0);
01470 static const G4QContent protQC(1,2,0,0,0,0);
01471 static const G4QContent neutQC(2,1,0,0,0,0);
01472
01473 static const G4QPDGCode nQPDG(2112);
01474 static const G4QPDGCode pQPDG(2212);
01475 static const G4QPDGCode lQPDG(3122);
01476 static const G4QPDGCode s0QPDG(3122);
01477 static const G4double mPi0 = G4QPDGCode(111).GetMass();
01478
01479 static const G4double fPi0 = 4*mPi0;
01480 static const G4double mPi = G4QPDGCode(211).GetMass();
01481 static const G4double mK = G4QPDGCode(321).GetMass();
01482 static const G4double mK0 = G4QPDGCode(311).GetMass();
01483 static const G4double mNeut= G4QPDGCode(2112).GetMass();
01484 static const G4double mProt= G4QPDGCode(2212).GetMass();
01485 static const G4double mLamb= G4QPDGCode(3122).GetMass();
01486 static const G4double mSigZ= G4QPDGCode(3212).GetMass();
01487 static const G4double mSigM= G4QPDGCode(3112).GetMass();
01488 static const G4double mSigP= G4QPDGCode(3222).GetMass();
01489
01490 static const G4double eps=.003;
01491 G4int nQuasmons = theQuasmons.size();
01492 #ifdef chdebug
01493 G4int finCharge=theEnvironment.GetCharge();
01494 G4int finBaryoN=theEnvironment.GetA();
01495 G4int nHad=theQHadrons.size();
01496 if(nHad) for(G4int ih=0; ih<nHad; ih++)
01497 {
01498 finCharge+=theQHadrons[ih]->GetCharge();
01499 finBaryoN+=theQHadrons[ih]->GetBaryonNumber();
01500 }
01501
01502 if(nQuasmons)for(G4int iq=0; iq<nQuasmons; iq++)
01503 {
01504 finCharge+=theQuasmons[iq]->GetCharge();
01505 finBaryoN+=theQuasmons[iq]->GetBaryonNumber();
01506 }
01507 if(finCharge!=totCharge || finBaryoN!=totBaryoN)
01508 {
01509 G4cout<<"*::*G4QE::HQ:T(1) tC="<<totCharge<<",C="<<finCharge<<",tB="<<totBaryoN
01510 <<",B="<<finBaryoN<<",E="<<theEnvironment<<G4endl;
01511 if(nHad) for(G4int h=0; h<nHad; h++)
01512 {
01513 G4QHadron* cH = theQHadrons[h];
01514 G4cout<<"*::*G4QE::HQ:h#"<<h<<",QC="<<cH->GetQC()<<",PDG="<<cH->GetPDGCode()<<G4endl;
01515 }
01516 if(nQuasmons) for(G4int q=0; q<nQuasmons; q++)
01517 {
01518 G4Quasmon* cQ = theQuasmons[q];
01519 G4cout<<"*::*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QCont="<<cQ->GetQC()<<G4endl;
01520 }
01521 }
01522 #endif
01523 #ifdef debug
01524 G4cout<<"G4QE::HQE:*HADRONIZE Q-ENVIRONMENT="<<theEnvironment<<",nQ="<<nQuasmons<<G4endl;
01525 #endif
01526 if(nQuasmons<1)
01527 {
01528 G4int nPDG = theEnvironment.GetPDG();
01529 #ifdef debug
01530 G4cout<<"G4QE::HQE:***NO QUASMONS***Env="<<nPDG<<theEnvironment.Get4Momentum()<<G4endl;
01531 #endif
01532 if(nPDG==90000000) return theQHadrons;
01533 if(nPDG>80000000)
01534 {
01535 G4QHadron* rNucleus = new G4QHadron(theEnvironment);
01536 theQHadrons.push_back(rNucleus);
01537 #ifdef fdebug
01538 G4cout<<"G4QEnv::HadrQE: ---->> Fill Environment="<<theEnvironment<<G4endl;
01539 #endif
01540 }
01541 return theQHadrons;
01542 }
01543 if(theEnvironment.GetPDG()==NUCPDG)
01544 {
01545 #ifdef rdebug
01546 G4cout<<"G4QEnv::HadrQE: ***Vacuum*** #ofQ="<<nQuasmons<<G4endl;
01547 G4int totInC=0;
01548 G4LorentzVector totIn4M(0.,0.,0.,0.);
01549 for (G4int is=0; is<nQuasmons; is++)
01550 {
01551 G4Quasmon* pQ = theQuasmons[is];
01552 G4LorentzVector Q4M= pQ->Get4Momentum();
01553 totIn4M += Q4M;
01554 totInC += pQ->GetQC().GetCharge();
01555 }
01556 G4int nsHadr = theQHadrons.size();
01557 if(nsHadr) for(G4int jso=0; jso<nsHadr; jso++)
01558 {
01559 G4int hsNF = theQHadrons[jso]->GetNFragments();
01560 if(!hsNF)
01561 {
01562 G4LorentzVector hs4Mom = theQHadrons[jso]->Get4Momentum();
01563 totIn4M += hs4Mom;
01564 totInC += theQHadrons[jso]->GetCharge();
01565 }
01566 }
01567 #endif
01568 G4QNucleus vE(90000000);
01569 G4int nlq = 0;
01570 if(nQuasmons) for(G4int lq=0; lq<nQuasmons; lq++)if(theQuasmons[lq]->GetStatus())nlq++;
01571 if(nQuasmons) for(G4int iq=0; iq<nQuasmons; iq++)
01572 {
01573 #ifdef chdebug
01574 G4int f1Charge=theEnvironment.GetCharge();
01575 G4int f1BaryoN=theEnvironment.GetA();
01576 G4int nHad=theQHadrons.size();
01577 if(nHad) for(G4int ih=0; ih<nHad; ih++)
01578 {
01579 f1Charge+=theQHadrons[ih]->GetCharge();
01580 f1BaryoN+=theQHadrons[ih]->GetBaryonNumber();
01581 }
01582 G4int nQuas=theQuasmons.size();
01583 if(nQuas)for(G4int iqs=0; iqs<nQuas; iqs++)
01584 {
01585 f1Charge+=theQuasmons[iqs]->GetCharge();
01586 f1BaryoN+=theQuasmons[iqs]->GetBaryonNumber();
01587 }
01588 if(f1Charge!=totCharge || f1BaryoN!=totBaryoN)
01589 {
01590 G4cout<<"*::*G4QE::HQ:(2)q#"<<iq<<",tC="<<totCharge<<",C="<<f1Charge<<",tB="
01591 <<totBaryoN<<",B="<<f1BaryoN<<",E="<<theEnvironment<<G4endl;
01592 if(nHad) for(G4int h=0; h<nHad; h++)
01593 {
01594 G4QHadron* cH = theQHadrons[h];
01595 G4cout<<"*:*G4QE::HQ:#"<<h<<",QC="<<cH->GetQC()<<",P="<<cH->GetPDGCode()<<G4endl;
01596 }
01597 if(nQuas) for(G4int q=0; q<nQuas; q++)
01598 {
01599 G4Quasmon* cQ = theQuasmons[q];
01600 G4cout<<"*:*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QC="<<cQ->GetQC()<<G4endl;
01601 }
01602 }
01603 #endif
01604 G4int ist=theQuasmons[iq]->GetStatus();
01605 if(ist)
01606 {
01607 G4QHadronVector* output=theQuasmons[iq]->Fragment(vE,1);
01608 G4int ast=theQuasmons[iq]->GetStatus();
01609 if(!ast) nlq--;
01610 G4int nHadrons = output->size();
01611 #ifdef debug
01612 G4cout<<"G4QEnv::HadrQE: ***Vacuum*** Q#"<<iq<<", nHadr="<<nHadrons<<G4endl;
01613 #endif
01614 if(nHadrons>0)
01615 {
01616 for (G4int ih=0; ih<nHadrons; ih++)
01617 {
01618
01619 G4QHadron* curH = new G4QHadron((*output)[ih]);
01620 #ifdef debug
01621 G4cout<<"G4QEnv::HadrQE:Vacuum, H#"<<ih<<", QPDG="<<curH->GetQPDG()
01622 <<",4M="<<curH->Get4Momentum()<<G4endl;
01623 #endif
01624 theQHadrons.push_back(curH);
01625 }
01626 }
01627 else
01628 {
01629 G4QContent totQC=theQuasmons[iq]->GetQC();
01630 G4int tQBN=totQC.GetBaryonNumber();
01631 G4QNucleus tqN(totQC);
01632 G4double gsM=tqN.GetMZNS();
01633 G4LorentzVector tot4M=theQuasmons[iq]->Get4Momentum();
01634 G4double totQM=tot4M.m();
01635 if(tQBN>0&&totQM>gsM)
01636 {
01637 G4QHadron* nuclQ = new G4QHadron(totQC,tot4M);
01638 #ifdef fdebug
01639 G4cout<<"G4QEnv::HadrQE:Vac,tQC"<<totQC<<",t4M="<<tot4M<<G4endl;
01640 #endif
01641 EvaporateResidual(nuclQ);
01642 theQuasmons[iq]->KillQuasmon();
01643 nlq--;
01644 }
01645 else if(iq+1<nQuasmons&&nlq>1)
01646 {
01647 G4int s_value=theQuasmons[iq+1]->GetStatus();
01648 theQuasmons[iq+1]->IncreaseBy(theQuasmons[iq]);
01649 theQuasmons[iq]->KillQuasmon();
01650 if(s_value) nlq--;
01651 }
01652 else if(iq+1==nQuasmons&&iq&&nlq>1)
01653 {
01654 G4int s_value=theQuasmons[0]->GetStatus();
01655 theQuasmons[0]->IncreaseBy(theQuasmons[iq]);
01656 theQuasmons[iq]->KillQuasmon();
01657 if(s_value) nlq--;
01658 }
01659 else
01660 {
01661 #ifdef debug
01662 G4cout<<"***G4QE::HQE:"<<iq<<",n="<<nHadrons<<",Tot="<<totQC<<totQM<<G4endl;
01663 for (G4int kq=0; kq<nQuasmons; kq++)
01664 G4cout<<kq<<",St/QC="<<theQuasmons[kq]->GetStatus()<<theQuasmons[kq]
01665 ->GetQC()<<",M="<<theQuasmons[kq]->Get4Momentum().m()<<G4endl;
01666 #endif
01667 G4int nOfOUT = theQHadrons.size();
01668 G4double dM = totQM-gsM;
01669 G4bool corrf = true;
01670 while(nOfOUT && corrf)
01671 {
01672 G4QHadron* theLast = theQHadrons[nOfOUT-1];
01673 G4LorentzVector last4M = theLast->Get4Momentum();
01674 G4QContent lastQC = theLast->GetQC();
01675 G4int lastS = lastQC.GetStrangeness();
01676 G4int totS = totQC.GetStrangeness();
01677 G4int nFr = theLast->GetNFragments();
01678 G4int gam = theLast->GetPDGCode();
01679 if(gam!=22&&!nFr&&lastS<0&&lastS+totS<0&&nOfOUT>1)
01680 {
01681 G4QHadron* thePrev = theQHadrons[nOfOUT-2];
01682 theQHadrons.pop_back();
01683 theQHadrons.pop_back();
01684 theQHadrons.push_back(thePrev);
01685 delete theLast;
01686 theLast = thePrev;
01687 last4M = theLast->Get4Momentum();
01688 lastQC = theLast->GetQC();
01689 }
01690 else
01691 {
01692 theQHadrons.pop_back();
01693 delete theLast;
01694 }
01695 totQC+=lastQC;
01696 tot4M+=last4M;
01697 totQM=tot4M.m();
01698 G4QNucleus nN(totQC);
01699 gsM=nN.GetMZNS();
01700 dM = totQM-gsM;
01701 if(dM>0)
01702 {
01703 theQuasmons[iq]->InitQuasmon(totQC,tot4M);
01704 G4QHadronVector* curout=theQuasmons[iq]->Fragment(vE,1);
01705 ast=theQuasmons[iq]->GetStatus();
01706 if(!ast) nlq--;
01707 nHadrons=curout->size();
01708 #ifdef debug
01709 G4cout<<"G4QEnv::HadrQE:VacuumRecoverQ#"<<iq<<",n="<<nHadrons<<G4endl;
01710 #endif
01711 if(nHadrons>0)
01712 {
01713 for (G4int ih=0; ih<nHadrons; ih++)
01714 {
01715
01716 G4QHadron* curH = new G4QHadron((*curout)[ih]);
01717 #ifdef debug
01718 G4cout<<"G4QEnv::HadrQE:Recovered, H#"<<ih<<", QPDG="
01719 <<curH->GetQPDG()<<",4M="<<curH->Get4Momentum()<<G4endl;
01720 #endif
01721 totQC-=curH->GetQC();
01722 tot4M-=curH->Get4Momentum();
01723 theQHadrons.push_back(curH);
01724
01725 delete (*curout)[ih];
01726 }
01727 curout->clear();
01728 delete curout;
01729 corrf = false;
01730
01731 }
01732 else
01733 {
01734 for_each(curout->begin(), curout->end(), DeleteQHadron());
01735 curout->clear();
01736 delete curout;
01737 }
01738 }
01739 nOfOUT = theQHadrons.size();
01740 #ifdef rdebug
01741 G4int tC=totInC;
01742 G4LorentzVector t4M=totIn4M;
01743 for (G4int js=0; js<nQuasmons; js++)
01744 {
01745 G4Quasmon* pQ = theQuasmons[js];
01746 if(pQ->GetStatus())
01747 {
01748 G4LorentzVector Q4M= pQ->Get4Momentum();
01749 t4M -= Q4M;
01750 tC -= pQ->GetQC().GetCharge();
01751 }
01752 else G4cout<<"G4QE::HQ:SUM-4-Mom s("<<js<<")="<<pQ->GetStatus()<<G4endl;
01753 }
01754 if(nOfOUT) for(G4int jpo=0; jpo<nOfOUT; jpo++)
01755 {
01756 G4int hsNF = theQHadrons[jpo]->GetNFragments();
01757 if(!hsNF)
01758 {
01759 G4LorentzVector hs4Mom = theQHadrons[jpo]->Get4Momentum();
01760 t4M -= hs4Mom;
01761 tC -= theQHadrons[jpo]->GetCharge();
01762 }
01763 }
01764 G4cout<<"G4QE::HQ:|||Vacuum|||4-MomCHECK|||d4M="<<t4M<<",dC="<<tC<<G4endl;
01765 #endif
01766 }
01767
01768 if((!nOfOUT&&nQuasmons==1)||theEnvironment.GetPDGCode()==NUCPDG)
01769 {
01770 G4int totS=totQC.GetStrangeness();
01771
01772 G4int totPDG=totQC.GetZNSPDGCode();
01773 if(totS) totPDG-=totS*999999;
01774 #ifdef fdebug
01775 G4cout<<"G4QE::HQE: totPDG="<<totPDG<<",totM="<<totQM<<G4endl;
01776 #endif
01777 G4QHadron* evH = new G4QHadron(totQC,tot4M);
01778 CleanUp();
01779 EvaporateResidual(evH);
01780 for_each(output->begin(), output->end(), DeleteQHadron());
01781 output->clear();
01782 delete output;
01783 return theQHadrons;
01784 }
01785 else if(!nOfOUT)
01786 {
01787 G4ExceptionDescription ed;
01788 ed <<"Can't decay Quasmon: T="<< tot4M << totQC << ",M=" << totQM
01789 <<" < gsM="<< gsM <<", d="<< dM <<",Env="<< theEnvironment << G4endl;
01790 G4Exception("G4QEnvironment::HadronizeQEnvironment()", "HAD_CHPS_0000",
01791 FatalException, ed);
01792 }
01793 }
01794 }
01795 for_each(output->begin(), output->end(), DeleteQHadron());
01796 output->clear();
01797 delete output;
01798 }
01799 }
01800 }
01801 else
01802 {
01803 #ifdef rdebug
01804 G4cout<<"G4QEnv::HadrQE:FRAGMENTATION IN NUCLEAR ENVIRONMENT nQ="<<nQuasmons<<G4endl;
01805 G4int totInC=theEnvironment.GetZ();
01806 G4LorentzVector totIn4M=theEnvironment.Get4Momentum();
01807 for (G4int is=0; is<nQuasmons; is++)
01808 {
01809 G4Quasmon* pQ = theQuasmons[is];
01810 G4LorentzVector Q4M= pQ->Get4Momentum();
01811 totIn4M += Q4M;
01812 totInC += pQ->GetQC().GetCharge();
01813 }
01814 G4int nsHadr = theQHadrons.size();
01815 if(nsHadr) for(G4int jso=0; jso<nsHadr; jso++)
01816 {
01817 G4int hsNF = theQHadrons[jso]->GetNFragments();
01818 if(!hsNF)
01819 {
01820 G4LorentzVector hs4Mom = theQHadrons[jso]->Get4Momentum();
01821 totIn4M += hs4Mom;
01822 totInC += theQHadrons[jso]->GetCharge();
01823 }
01824 }
01825 #endif
01826
01827 G4QContent totInQC=theEnvironment.GetQCZNS();
01828 G4LorentzVector totIn4M=theEnvironment.Get4Momentum();
01829 for (G4int is=0; is<nQuasmons; is++)
01830 {
01831 G4Quasmon* pQ = theQuasmons[is];
01832 totIn4M += pQ->Get4Momentum();
01833 totInQC += pQ->GetQC();
01834 }
01835 G4double totMass=totIn4M.m();
01836 G4QNucleus totN(totInQC);
01837 G4double totM=totN.GetMZNS();
01838 G4double excE = totMass-totM;
01839
01840 G4int envA=theEnvironment.GetA();
01841
01842
01844 G4int c3Max = 1;
01845 if(excE > fPi0) c3Max=(G4int)(excE/mPi0);
01846
01847
01848
01849
01850
01851
01852
01853
01854 G4int premC = 1;
01855
01856 if(envA>1&&envA<19) premC = 36/envA;
01857
01858
01859 G4int sumstat= 2;
01860 G4bool force = false;
01861 G4int cbR =0;
01862
01863
01864
01865
01866
01867 G4int cbRM = c3Max;
01868 G4int totC = 0;
01869
01870 G4int totCM = envA;
01871
01872
01873
01874
01875 G4int nCnMax = c3Max;
01876 G4bool first=true;
01877 G4int cAN=0;
01878
01880
01881 G4int mcAN=1;
01882 G4double proNorm=.001;
01883
01884 while (sumstat||totC<totCM)
01885 {
01886 #ifdef chdebug
01887 G4int f2Charge=0;
01888 G4int f2BaryoN=0;
01889 if(theEnvironment.GetMass()>0.)
01890 {
01891 f2Charge=theEnvironment.GetCharge();
01892 f2BaryoN=theEnvironment.GetA();
01893 }
01894 G4int nHad=theQHadrons.size();
01895 if(nHad) for(G4int ih=0; ih<nHad; ih++)
01896 {
01897 f2Charge+=theQHadrons[ih]->GetCharge();
01898 f2BaryoN+=theQHadrons[ih]->GetBaryonNumber();
01899 }
01900 G4int nQuas=theQuasmons.size();
01901 if(nQuas)for(G4int iqs=0; iqs<nQuas; iqs++)
01902 {
01903 f2Charge+=theQuasmons[iqs]->GetCharge();
01904 f2BaryoN+=theQuasmons[iqs]->GetBaryonNumber();
01905 }
01906 if(f2Charge!=totCharge || f2BaryoN!=totBaryoN)
01907 {
01908 G4cout<<"*::*G4QE::HQ:(3)(NucEnv)i#"<<totC<<",tC="<<totCharge<<",C="<<f2Charge
01909 <<",tB="<<totBaryoN<<",B="<<f2BaryoN<<",E="<<theEnvironment<<G4endl;
01910 if(nHad) for(G4int h=0; h<nHad; h++)
01911 {
01912 G4QHadron* cH = theQHadrons[h];
01913 G4cout<<"*:*G4QE::HQ:#"<<h<<",QC="<<cH->GetQC()<<",P="<<cH->GetPDGCode()<<G4endl;
01914 }
01915 if(nQuas) for(G4int q=0; q<nQuas; q++)
01916 {
01917 G4Quasmon* cQ = theQuasmons[q];
01918 G4cout<<"*:*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QC="<<cQ->GetQC()<<G4endl;
01919 }
01920 }
01921 #endif
01922 totC++;
01923 if( nQuasmons==1 && sumstat==3 ) cbR++;
01924 else cbR=0;
01925 G4QContent envQC=theEnvironment.GetQCZNS();
01926 G4QContent totQC=envQC;
01927 G4double envM =theEnvironment.GetMass();
01928 G4double sumM =envM;
01929 G4LorentzVector env4M=theEnvironment.Get4Momentum();
01930 G4LorentzVector tot4M=env4M;
01931 sumstat =0;
01932 G4int nCount=0;
01933 G4int fCount=0;
01934 G4int eCount=0;
01935 for (G4int iq=0; iq<nQuasmons; iq++)
01936 {
01937 G4Quasmon* pQ = theQuasmons[iq];
01938 G4QContent QQC= pQ->GetQC();
01939 totQC += QQC;
01940 G4LorentzVector Q4M= pQ->Get4Momentum();
01941 tot4M += Q4M;
01942 G4double QM = Q4M.m();
01943 sumM += QM;
01944 G4int Qst= pQ->GetStatus();
01945 sumstat += Qst;
01946 #ifdef debug
01947 G4cout<<"G4QEnv::HadrQE:#"<<iq<<", Qst="<<Qst<<", Q="<<Q4M<<Q4M.m()<<QQC<<", Env="
01948 <<theEnvironment<<",nQ="<<nQuasmons<<G4endl;
01949 #endif
01950 if(nQuasmons>1 && iq+1==nQuasmons && !Qst && Q4M==zeroLV)
01951 {
01952 theQuasmons.pop_back();
01953 delete pQ;
01954 nQuasmons--;
01955 }
01956 if(Qst==1||Qst==3||Qst==4)
01957 {
01958 fCount++;
01959 nCount=0;
01960 }
01961 if(Qst>0) eCount++;
01962 }
01963 G4int totS =totQC.GetStrangeness();
01964 G4int totBN =totQC.GetBaryonNumber();
01965 G4int totPDG=0;
01966 totM =0.;
01967 if(totBN < 2)
01968 {
01969 totPDG=totQC.GetSPDGCode();
01970 if(totPDG) totM=G4QPDGCode(totPDG).GetMass();
01971 else
01972 {
01973
01974 G4Exception("G4QEnvironment::HadronizeQEnvironment()", "HAD_CHPS_0001",
01975 FatalException, "Impossible PDG for B=1");
01976 }
01977 }
01978 else
01979 {
01980 G4QNucleus totN_temporary(totQC,tot4M);
01981 totN=totN_temporary;
01982 totM=totN.GetMZNS();
01983 totPDG=totN.GetPDG();
01984 }
01985 #ifdef fdebug
01986 G4cout<<"G4QEnv::HadrQE:totC="<<totC<<"<totCM="<<totCM<<",ss="<<sumstat<<G4endl;
01987 #endif
01988 if ( totC >= totCM || cbR > cbRM)
01989 {
01990 CleanUp();
01991 G4QHadron* evH = new G4QHadron(totQC,tot4M);
01992 EvaporateResidual(evH);
01993 return theQHadrons;
01994 }
01995
01996 G4int totChg=totQC.GetCharge();
01997 #ifdef debug
01998 if(totPDG==90999999||totPDG==90999000||totPDG==90000999||totPDG==89999001)
01999 G4cout<<"***G4QEnv::HadrQEnv: Meson (1) PDG="<<totPDG<<", M="<<tot4M.m()<<G4endl;
02000 G4int nOH=theQHadrons.size();
02001 G4LorentzVector s4M=tot4M;
02002 if(nOH) for(G4int ih=0; ih<nOH; ih++) s4M+=theQHadrons[ih]->Get4Momentum();
02003 G4cout<<"G4QEnv::HadrQE:tBN="<<totBN<<",s="<<sumstat<<",fC="<<fCount<<",eC="<<eCount
02004 <<",En="<<theEnvironment<<",nH="<<nOH<<",tLV="<<s4M<<totQC<<nCount<<G4endl;
02005 #endif
02006 if(totBN<2)
02007 {
02008 totPDG =totQC.GetSPDGCode();
02009 if(totPDG && totPDG!=10 && totPDG!=1114 && totPDG!=2224)
02010 totM=G4QPDGCode(totPDG).GetMass();
02011 else if(totPDG==1114) totM=mNeut+mPi;
02012 else if(totPDG==2224) totM=mProt+mPi;
02013 else if(totPDG==10)
02014 {
02015 G4QChipolino totChip(totQC);
02016 totM =totChip.GetQPDG1().GetMass()+totChip.GetQPDG2().GetMass();
02017 }
02018 else
02019 {
02020 G4ExceptionDescription ed;
02021 ed << "Impossible Hadron in CHIPS: totPDG=" << totPDG << ", totQC="
02022 << totQC << G4endl;
02023 G4Exception("G4QEnvironment::HadronizeQEnvironment()", "HAD_CHPS_0002",
02024 FatalException, ed);
02025 }
02026 }
02027 totMass = tot4M.m();
02028 G4bool Premium = eCount && premC && envM;
02029 G4int count3 = 0;
02030 if(sumstat && (fCount||Premium) && !force && count3<c3Max)
02031 {
02032 if(!fCount) premC--;
02033 if(nQuasmons) for (G4int jq=0; jq<nQuasmons; jq++)
02034 {
02035 G4Quasmon* pQ = theQuasmons[jq];
02036 G4int status = pQ->GetStatus();
02037 #ifdef debug
02038 G4cout<<"G4QE::HQE:Status of Q#"<<jq<<" (before Fragment)="<<status<<G4endl;
02039 #endif
02040 if(status)
02041 {
02042 G4int nQuas=eCount;
02043 if(nQuas==1&&first) nQuas=-nQuas;
02044 G4QHadronVector* output=pQ->Fragment(theEnvironment,nQuas);
02045 #ifdef debug
02046 G4cout<<"G4QE::HQE:Q#"<<jq<<",*afterFragm* Env="<<theEnvironment<<G4endl;
02047 #endif
02048 envM =theEnvironment.GetMass();
02049 status = pQ->GetStatus();
02050 if(!status) eCount--;
02051 G4int nHadrons = output->size();
02052 #ifdef rdebug
02053 G4cout<<"G4QE::HQE:**AfterFragmAttempt**#"<<jq<<",stat="<<status<<", Q4M="
02054 <<pQ->Get4Momentum()<<", Env="<<theEnvironment<<",nH="<<nHadrons
02055 <<",c3="<<count3<<" < "<<c3Max<<",eC="<<eCount<<G4endl;
02056 G4int tC=totInC-theEnvironment.GetZ();
02057 G4LorentzVector t4M=totIn4M;
02058 G4LorentzVector theEnv4m=theEnvironment.Get4Momentum();
02059 t4M-=theEnv4m;
02060 G4cout<<"G4QEnv::HadrQE:SUM-4Mom e4M="<<theEnv4m<<theEnvironment<<G4endl;
02061 for (G4int js=0; js<nQuasmons; ++js)
02062 {
02063 G4Quasmon* prQ = theQuasmons[js];
02064 if(prQ->GetStatus())
02065 {
02066 G4LorentzVector Q4M= prQ->Get4Momentum();
02067 G4QContent qQC= prQ->GetQC();
02068 G4cout<<"G4QE::HQE:SUM-4Mom q("<<js<<")4M="<<Q4M<<",QC="<<qQC<<G4endl;
02069 t4M -= Q4M;
02070 tC -= prQ->GetQC().GetCharge();
02071 }
02072 else G4cout<<"G4QE::HQE:SUM-4M,st("<<js<<")="<<prQ->GetStatus()<<G4endl;
02073 }
02074 G4int nsbHadr=theQHadrons.size();
02075 if(nsbHadr) for(G4int jpo=0; jpo<nsbHadr; jpo++)
02076 {
02077 G4int hsNF = theQHadrons[jpo]->GetNFragments();
02078 if(!hsNF)
02079 {
02080 G4LorentzVector hs4Mom = theQHadrons[jpo]->Get4Momentum();
02081 G4int hPDG = theQHadrons[jpo]->GetPDGCode();
02082 G4cout<<"G4QE::HQE:SUM-4-Mom eh("<<jpo<<")4M="<<hs4Mom<<hPDG<<G4endl;
02083 t4M -= hs4Mom;
02084 tC -= theQHadrons[jpo]->GetCharge();
02085 }
02086 }
02087 if(nHadrons) for(G4int kpo=0; kpo<nHadrons; ++kpo)
02088 {
02089
02090 G4QHadron* insH = (*output)[kpo];
02091 G4int qhsNF = insH->GetNFragments();
02092 if(!qhsNF)
02093 {
02094 G4LorentzVector qhs4Mom = insH->Get4Momentum();
02095 G4int hPDG = insH->GetPDGCode();
02096 G4cout<<"G4QE::HQE:SUM-4-Mom qh("<<kpo<<")4M="<<qhs4Mom<<hPDG<<G4endl;
02097 t4M -= qhs4Mom;
02098 tC -= insH->GetCharge();
02099 }
02100 }
02101 G4cout<<"G4QEnv::HadrQE:|||||4-MomCHECK||||d4M="<<t4M<<",dC="<<tC<<G4endl;
02102 #endif
02103 if(!status||status==1||nHadrons)
02104 {
02105 nCount=0;
02106 if(nHadrons>0)
02107 {
02108 for (G4int ih=0; ih<nHadrons; ++ih)
02109 {
02110 G4QHadron* inpH = (*output)[ih];
02111 G4int hC=inpH->GetCharge();
02112 G4int hF=inpH->GetNFragments();
02113 G4double hCB=0.;
02114 G4double hKE=0.;
02115 G4LorentzVector hLV=inpH->Get4Momentum();
02116 #ifdef debug
02117 G4cout<<"->G4QEnv::HadrQE:H#"<<ih<<", hC="<<hC<<",hF="<<hF<<",4M="
02118 <<hLV<<inpH->GetPDGCode()<<G4endl;
02119 #endif
02120 G4bool can = hC && !hF;
02121 if(can)
02122 {
02123 G4int hB=inpH->GetBaryonNumber();
02124 hCB=theEnvironment.CoulombBarrier(hC,hB);
02125 hKE=hLV.e()-hLV.m();
02126 }
02127 if(can && hKE < hCB)
02128 {
02129 if(status)
02130 {
02131 G4QContent tQC=inpH->GetQC()+pQ->GetQC();
02132 G4LorentzVector tLV=hLV+pQ->Get4Momentum();
02133 pQ->InitQuasmon(tQC,tLV);
02134 #ifdef debug
02135 G4cout<<"G4QE::HQE:Medium, H#"<<ih<<", QPDG="<<inpH->GetQPDG()
02136 <<",4M="<<inpH->Get4Momentum()<<" is suckedInQ"<<G4endl;
02137 #endif
02138 }
02139 else
02140 {
02141 G4QContent tQC=inpH->GetQC()+theEnvironment.GetQCZNS();
02142 G4LorentzVector tLV=hLV+theEnvironment.Get4Momentum();
02143 theEnvironment=G4QNucleus(tQC,tLV);
02144 #ifdef debug
02145 G4cout<<"G4QE::HQE:Med,H#"<<ih<<",PDG="<<inpH->GetQPDG()<<",4M="
02146 <<inpH->Get4Momentum()<<" is suckedInEnvironment"<<G4endl;
02147 #endif
02148 }
02149 }
02150 else if(!hF)
02151 {
02152 G4QHadron* curH = new G4QHadron(inpH);
02153 #ifdef debug
02154 G4LorentzVector ph4M=curH->Get4Momentum();
02155 G4double phX=ph4M.x();
02156 G4double phY=ph4M.y();
02157 G4double phZ=ph4M.z();
02158 G4double phCost=phZ/sqrt(phX*phX+phY*phY+phZ*phZ);
02159 G4cout<<"G4QEnv::HadrQE:Medium, H#"<<ih<<",QPDG="<<curH->GetQPDG()
02160 <<", 4M="<<ph4M<<", ct="<<phCost<<G4endl;
02161 #endif
02162 G4QContent qhdQC=curH->GetQC();
02163 G4LorentzVector qhd4M=curH->Get4Momentum();
02164
02165 G4int qhdBN=curH->GetBaryonNumber();
02166 G4bool scat= false;
02167 G4int EnvZ = theEnvironment.GetZ();
02168 G4int EnvN = theEnvironment.GetN();
02169 G4int EnvS = theEnvironment.GetS();
02170 G4int EnvA = EnvZ + EnvN + EnvS;
02171 G4double EnvM = theEnvironment.GetMZNS();
02172 G4LorentzVector Env4M= theEnvironment.Get4Momentum();
02173 #ifdef debug
02174 G4cout<<"=*=>G4QE::HQEnv: Env4M="<<Env4M<<",Z="<<EnvZ<<",N="<<EnvN
02175 <<",S="<<EnvS<<G4endl;
02176 #endif
02177 G4int hPDG = curH->GetPDGCode();
02178 G4LorentzVector h4M = curH->Get4Momentum();
02179 if(EnvA>1 && qhdBN>-1 && qhdBN<2 && h4M.vect().mag() > 0.000001 && hPDG>111 &&
02180 hPDG!=222 && hPDG!=333)
02181 {
02182 --EnvA;
02183 G4double hM2 = h4M.m2();
02184 G4double hP = h4M.rho();
02185 G4int pi0F=0;
02186 if(hPDG==111 || hPDG==222 || hPDG==333) pi0F=hPDG;
02187 if(pi0F) hPDG=211;
02188 pair<G4double,G4double> Xp=theQFScat->FetchElTot(hP,hPDG,false);
02189 if(pi0F)
02190 {
02191 hPDG=-211;
02192 pair<G4double,G4double>Y=theQFScat->FetchElTot(hP,hPDG,false);
02193 G4double fst=(Xp.first+Y.first)/2;
02194 G4double snd=(Xp.second+Y.second)/2;
02195 Xp.first = fst;
02196 Xp.second = snd;
02197 hPDG=211;
02198 }
02199 G4double XSp = Xp.second;
02200 pair<G4double,G4double> Xn=theQFScat->FetchElTot(hP,hPDG,true);
02201 if(pi0F)
02202 {
02203 hPDG=-211;
02204 pair<G4double,G4double> Y=theQFScat->FetchElTot(hP,hPDG,true);
02205 G4double fst=(Xn.first+Y.first)/2;
02206 G4double snd=(Xn.second+Y.second)/2;
02207 Xn.first = fst;
02208 Xn.second = snd;
02209 hPDG=pi0F;
02210 pi0F=0;
02211 }
02212 G4double XSn = Xn.second;
02213 G4double XSZ = XSp * EnvZ;
02214 G4double XSN = XSn * EnvN;
02215 G4double XSA = XSZ + XSN;
02216 if(hM2 > 10000. && XSA > 0.)
02217 {
02218 G4double Prob=XSA*sqrt(hM2)*G4QThd(EnvA)*proNorm/h4M.e()/EnvA;
02219 if(G4UniformRand() < Prob)
02220 {
02221 G4double XEp = Xp.first;
02222 G4double XEn = Xn.first;
02223 G4double XEZ = XEp * EnvZ;
02224 G4double XEN = XEn * EnvN;
02225 G4double XEA = XEZ + XEN;
02226 G4int NPDG=2112;
02227 G4bool flN=true;
02228 G4QNucleus newE(1,0);
02229 G4LorentzVector N4M(0.,0.,0.,0.);
02230 if(G4UniformRand() < XEA/XSA)
02231 {
02232 if(G4UniformRand() < XEZ/XEA)
02233 {
02234 NPDG= 2212;
02235 flN = false;
02236 }
02237 if(flN) newE=G4QNucleus(EnvZ, EnvN-1, EnvS);
02238 else newE=G4QNucleus(EnvZ-1, EnvN, EnvS);
02239 G4double mT=EnvM - newE.GetMZNS();
02240 N4M = (mT/EnvM)*Env4M;
02241 newE.Set4Momentum(Env4M-N4M);
02242 #ifdef debug
02243 G4cout<<"==>G4QE::HQE:QEl,NPDG=="<<NPDG<<",N4M="<<N4M
02244 <<",hPDG="<<hPDG<<",h4M="<<h4M<<G4endl;
02245 #endif
02246 pair<G4LorentzVector,G4LorentzVector> RS =
02247 theQFScat->Scatter(NPDG, N4M, hPDG, h4M);
02248 #ifdef debug
02249 G4cout<<"**>G4QE::HQE:QEl,N4M="<<RS.first<<",h4M="
02250 <<RS.second<<",d="<<N4M+h4M-RS.first-RS.second<<G4endl;
02251 #endif
02252 if((RS.first).e() > 0.)
02253 {
02254 curH->Set4Momentum(RS.second);
02255 G4QHadron* qfN = new G4QHadron(NPDG, RS.first);
02256 theQHadrons.push_back(qfN);
02257 theEnvironment=newE;
02258 #ifdef debug
02259 G4cout<<"*>G4QE::HQE:QE,PDG="<<NPDG<<",4M="
02260 <<RS.first<<",***newEnv***: "<<newE<<G4endl;
02261 #endif
02262
02263 tot4M-=RS.first;
02264 if (NPDG==2212) totQC-=protQC;
02265 else if(NPDG==2112) totQC-=neutQC;
02266 else G4cout<<"*W*>G4QE::HQE:QE,Bad PDG="<<NPDG<<G4endl;
02267 }
02268 }
02269 else
02270 {
02271 if(G4UniformRand() < (XSZ-XEZ)/(XSA-XEA))
02272 {
02273 NPDG= 2212;
02274 flN = false;
02275 }
02276 if(flN) newE=G4QNucleus(EnvZ, EnvN-1, EnvS);
02277 else newE=G4QNucleus(EnvZ-1, EnvN, EnvS);
02278 G4double mT=EnvM - newE.GetMZNS();
02279 N4M = (mT/EnvM)*Env4M;
02280 newE.Set4Momentum(Env4M-N4M);
02281 #ifdef debug
02282 G4cout<<"==>G4QE::HQE:QInEl,NPDG=="<<NPDG<<",N4M="<<N4M
02283 <<",hPDG="<<hPDG<<",h4M="<<h4M<<G4endl;
02284 #endif
02285 G4QHadronVector* Q=theQFScat->InElF(NPDG, N4M, hPDG, h4M);
02286 if(Q)
02287 {
02288 theQHadrons.push_back((*Q)[0]);
02289 theQHadrons.push_back((*Q)[1]);
02290 theQHadrons.push_back((*Q)[2]);
02291 theEnvironment=newE;
02292 #ifdef debug
02293 G4cout<<"*>G4QE::HQE:QIE,PDG1="<<(*Q)[0]->GetPDGCode()
02294 <<",4M1="<<(*Q)[0]->Get4Momentum()<<G4endl;
02295 G4cout<<"*>G4QE::HQE:QIE,PDG2="<<(*Q)[1]->GetPDGCode()
02296 <<",4M1="<<(*Q)[1]->Get4Momentum()<<G4endl;
02297 G4cout<<"*>G4QE::HQE:QIE,PDG3="<<(*Q)[2]->GetPDGCode()
02298 <<",4M1="<<(*Q)[2]->Get4Momentum()<<G4endl;
02299 G4cout<<"*>G4QE::HQE:QIE,***NewEnv***: "<<newE<<G4endl;
02300 #endif
02301 scat=true;
02302 delete Q;
02303 }
02304 }
02305 }
02306 }
02307 }
02308 if(!scat)
02309
02310 theQHadrons.push_back(curH);
02311 totQC-=qhdQC;
02312 tot4M-=qhd4M;
02313 }
02314 }
02315 pQ->ClearOutput();
02316 count3=0;
02317
02318 first=false;
02319 }
02320 else count3++;
02321 }
02322 else if(status<0||status==2)
02323 {
02324 #ifdef debug
02325 G4cout<<"G4QE::HQE:***PANIC***,status="<<status<<",nC="<<nCount<<G4endl;
02326 #endif
02327 ++nCount;
02328 if(eCount==1 && status<0 && CheckGroundState(pQ,true))
02329 {
02330 for_each(output->begin(), output->end(), DeleteQHadron());
02331 output->clear();
02332 delete output;
02333 pQ->KillQuasmon();
02334 delete pQ;
02335 eCount--;
02336 return theQHadrons;
02337 }
02338 else if(status<0&&nHadrons)
02339 {
02340 G4cerr<<"***G4QEnv::HadrQE: nH="<<nHadrons<<"< status="<<status<<G4endl;
02341 for_each(output->begin(), output->end(), DeleteQHadron());
02342 output->clear();
02343 delete output;
02344 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
02345 "HAD_CHPS_0003", JustWarning, "Do Nothing Er");
02346 }
02347 else if(status==2 && eCount==1 && cAN<mcAN && envM>500.)
02348 {
02349 #ifdef debug
02350 G4cout<<"G4QE::HQE:E="<<theEnvironment<<",M="<<envM<<",c="<<cAN<<G4endl;
02351 #endif
02352 cAN++;
02353 G4int envPDG = theEnvironment.GetPDG();
02354 env4M=theEnvironment.Get4Momentum();
02355 G4int envN=theEnvironment.GetN();
02356 G4int envZ=theEnvironment.GetZ();
02357 G4int resPDG=envPDG-1;
02358 G4QContent nucQC=neutQC;
02359 if ( envN && (envN+envZ)*G4UniformRand() > envZ )
02360 {
02361 resPDG=envPDG-1000;
02362 nucQC=protQC;
02363 }
02364 #ifdef debug
02365 G4cout<<"G4QE::HQE:P,eZ="<<envZ<<",eN="<<envN<<",rPDG="<<resPDG<<G4endl;
02366 #endif
02367 G4QNucleus resNuc(resPDG);
02368 G4double resM=resNuc.GetGSMass();
02369 G4double eM=theEnvironment.GetGSMass();
02370 G4double nucM=eM-resM;
02371 G4LorentzVector res4M(0.,0.,0.,resM);
02372 G4LorentzVector nuc4M(0.,0.,0.,nucM);
02373 if(std::fabs(env4M.e()-eM) > 0.001)
02374 {
02375 res4M=(resM/eM)*env4M;
02376 nuc4M=(nucM/eM)*env4M;
02377 }
02378 theEnvironment=G4QNucleus(res4M,resPDG);
02379 theQuasmons[0]->IncreaseBy(nucQC,nuc4M);
02380 #ifdef debug
02381 G4cout<<"G4QE::HQE:P,Q="<<nucQC<<nuc4M<<",env="<<theEnvironment<<G4endl;
02382 #endif
02383 }
02384 else if(status==2&&nCount>nCnMax)
02385 {
02386 #ifdef debug
02387 G4cout<<"G4QE::HQE:PANIC,nC="<<nCount<<">"<<nCnMax<<G4endl;
02388 #endif
02389 G4QContent qQC=pQ->GetQC();
02390 G4int pqC=qQC.GetCharge();
02391 G4int pqS=qQC.GetStrangeness();
02392 G4int pqB=qQC.GetBaryonNumber();
02393 G4LorentzVector cq4M=pQ->Get4Momentum();
02394 G4double cqMass=cq4M.m();
02395 G4double fqMass=G4QPDGCode(22).GetNuclMass(pqC,pqB-pqC-pqS,pqS);
02396 #ifdef edebug
02397 G4cout<<"G4QEnv::HQE:M="<<cqMass<<">fM="<<fqMass<<",S="<<pqS<<",C="<<pqC
02398 <<",ePDG="<<theEnvironment.GetPDG()<<",qQC="<<qQC<<",eC="<<eCount
02399 <<G4endl;
02400 #endif
02401 if(pqB>0&&pqS<0&&cqMass>fqMass)
02402 {
02403 G4QHadron* nuclQ = new G4QHadron(qQC,cq4M);
02404 theEnvironment.DecayAntiStrange(nuclQ,&theQHadrons);
02405 pQ->KillQuasmon();
02406 #ifdef edebug
02407 G4cout<<"G4QEnv::HQE:Status after kill (#"<<jq<<")="<<pQ->GetStatus()
02408 <<", nH="<<theQHadrons.size()<<G4endl;
02409 #endif
02410 tot4M-=cq4M;
02411 totQC-=qQC;
02412 eCount--;
02413 }
02414 else if(theEnvironment.GetPDG()!=NUCPDG)
02415 {
02416 if(eCount>1)
02417 {
02418 #ifdef fdebug
02419 G4cout<<"G4QE::HQE:TOTEVAP tPDG="<<totPDG<<",t4M="<<tot4M<<G4endl;
02420 #endif
02421 G4QHadron* evH = new G4QHadron(totQC,tot4M);
02422 CleanUp();
02423 EvaporateResidual(evH);
02424 for_each(output->begin(), output->end(), DeleteQHadron());
02425 output->clear();
02426 delete output;
02427 return theQHadrons;
02428 }
02429 G4LorentzVector t4M=cq4M+theEnvironment.Get4Momentum();
02430 G4double tM=t4M.m();
02431 envQC=theEnvironment.GetQCZNS();
02432 G4QContent curQC=envQC+qQC;
02433 G4QNucleus curE(curQC);
02434 G4double curM=curE.GetGSMass();
02435 #ifdef edebug
02436 G4cout<<"G4QEnv::HQE:Q#"<<jq<<",tM="<<tM<<">gsM="<<curM<<curE<<G4endl;
02437 #endif
02438 if(tM<curM)
02439 {
02440 G4int qPDG=qQC.GetZNSPDGCode();
02441 G4double qMass=G4QPDGCode(qPDG).GetMass();
02442 #ifdef edebug
02443 G4cout<<"G4QE::HQE:nQ="<<nQuasmons<<",eC="<<eCount<<",qPDG="<<qPDG
02444 <<",qM="<<qMass<<",eM="<<envM<<",tM="<<tM<<",Q+E="<<qMass+envM
02445 <<G4endl;
02446 #endif
02447 if(eCount==1&&qPDG&&qMass&&tM>qMass+envM)
02448
02449 {
02450 G4int envPDG = theEnvironment.GetPDG();
02451 #ifdef edebug
02452 G4cout<<"G4QEnv::HadrQEnv: Q+E decay, nQ=1, qPDG=="<<qPDG<<G4endl;
02453 #endif
02454
02455 if(qPDG==10 || qPDG==92000000 || qPDG==90002000 || qPDG==90000002)
02456 {
02457 G4QPDGCode h1QPDG=nQPDG;
02458 G4double h1M =mNeut;
02459 G4QPDGCode h2QPDG=h1QPDG;
02460 G4double h2M =mNeut;
02461 if(qPDG==10)
02462 {
02463 G4QChipolino QChip(qQC);
02464 h1QPDG=QChip.GetQPDG1();
02465 h1M =h1QPDG.GetMass();
02466 h2QPDG=QChip.GetQPDG2();
02467 h2M =h2QPDG.GetMass();
02468 }
02469 else if(qPDG==90002000)
02470 {
02471 h1QPDG=pQPDG;
02472 h1M =mProt;
02473 h2QPDG=h1QPDG;
02474 h2M =mProt;
02475 }
02476 else if(qPDG==92000000)
02477 {
02478 h1QPDG=lQPDG;
02479 h1M =mLamb;
02480 h2QPDG=h1QPDG;
02481 h2M =mLamb;
02482 G4double ddMass=totMass-envM;
02483 if(ddMass>mSigZ+mSigZ)
02484 {
02485 G4double dd2=ddMass*ddMass;
02486 G4double sma=mLamb+mLamb;
02487 G4double pr1=0.;
02488 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
02489 sma=mLamb+mSigZ;
02490 G4double smi=mSigZ-mLamb;
02491 G4double pr2=pr1;
02492 if(ddMass>sma&&ddMass>smi)
02493 pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
02494 sma=mSigZ+mSigZ;
02495 G4double pr3=pr2;
02496 if(ddMass>sma) pr3+=sqrt((dd2-sma*sma)*dd2);
02497 G4double hhRND=pr3*G4UniformRand();
02498 if(hhRND>pr2)
02499 {
02500 h1QPDG=s0QPDG;
02501 h1M =mSigZ;
02502 h2QPDG=h1QPDG;
02503 h2M =mSigZ;
02504 }
02505 else if(hhRND>pr1)
02506 {
02507 h1QPDG=s0QPDG;
02508 h1M =mSigZ;
02509 }
02510 }
02511 else if(ddMass>mSigZ+mLamb)
02512 {
02513 G4double dd2=ddMass*ddMass;
02514 G4double sma=mLamb+mLamb;
02515 G4double pr1=0.;
02516 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
02517 sma=mLamb+mSigZ;
02518 G4double smi=mSigZ-mLamb;
02519 G4double pr2=pr1;
02520 if(ddMass>sma && ddMass>smi)
02521 pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
02522 if(pr2*G4UniformRand()>pr1)
02523 {
02524 h1QPDG=s0QPDG;
02525 h1M =mSigZ;
02526 }
02527 }
02528 }
02529 if(h1M+h2M+envM<totMass)
02530 {
02531 G4LorentzVector h14M(0.,0.,0.,h1M);
02532 G4LorentzVector h24M(0.,0.,0.,h2M);
02533 G4LorentzVector e4M(0.,0.,0.,envM);
02534 if(!G4QHadron(tot4M).DecayIn3(h14M,h24M,e4M))
02535 {
02536 G4ExceptionDescription ed;
02537 ed << "QChip+E DecIn3 error: (0)tM=" << tot4M.m()
02538 << "->h1=" << h1QPDG << "(" << h1M << ")+h2="
02539 << h1QPDG << "(" << h2M << ")+envM=" << envM
02540 << "==" << h1M+h2M+envM << G4endl;
02541 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
02542 "HAD_CHPS_0004", FatalException, ed);
02543 }
02544 G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
02545 theQHadrons.push_back(h1H);
02546 #ifdef debug
02547 G4cout<<"G4QE::HQE:(1) H1="<<h1QPDG<<h14M<<G4endl;
02548 #endif
02549 G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
02550 theQHadrons.push_back(h2H);
02551 #ifdef debug
02552 G4cout<<"G4QE::HQE:(1) H2="<<h2QPDG<<h24M<<G4endl;
02553 #endif
02554 G4QHadron* qeH = new G4QHadron(envPDG,e4M);
02555 theQHadrons.push_back(qeH);
02556 #ifdef debug
02557 G4cout<<"G4QE::HQE:(1) QEnv="<<envPDG<<e4M<<G4endl;
02558 #endif
02559 }
02560 else
02561 {
02562
02563 if(eCount==1&&CheckGroundState(pQ))
02564 {
02565 pQ->KillQuasmon();
02566 eCount--;
02567 for_each(output->begin(),output->end(),DeleteQHadron());
02568 output->clear();
02569 delete output;
02570 return theQHadrons;
02571 }
02572 for_each(output->begin(),output->end(),DeleteQHadron());
02573 output->clear();
02574 delete output;
02575 #ifdef fdebug
02576 G4cout<<"--Warning--G4QE::HQE:tM="<<tot4M.m()<<"< h1="<<h1QPDG
02577 <<"(M="<<h1M<<")+h2="<<h1QPDG<<"(M="<<h2M<<")+EM="<<envM
02578 <<"="<<h1M+h2M+envM<<G4endl;
02579
02580 #endif
02581 CleanUp();
02582 G4QHadron* evH = new G4QHadron(totQC,tot4M);
02583 EvaporateResidual(evH);
02584 return theQHadrons;
02585 }
02586 }
02587 else
02588 {
02589 G4LorentzVector fq4M(0.,0.,0.,qMass);
02590 G4LorentzVector qe4M(0.,0.,0.,envM);
02591 if(!G4QHadron(tot4M).RelDecayIn2(fq4M,qe4M,cq4M,1.,1.))
02592 {
02593 G4cerr<<"***G4QEnv::HadQE:(0)tM="<<tot4M.m()<<"-> qPDG="<<qPDG
02594 <<"(M="<<qMass<<") + envM="<<envM<<")"<<G4endl;
02595 for_each(output->begin(),output->end(),DeleteQHadron());
02596 output->clear();
02597 delete output;
02598
02599 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
02600 "HAD_CHPS_0005", FatalException,
02601 "Q+Env DecIn2 error");
02602 }
02603 G4QHadron* qH = new G4QHadron(qPDG,fq4M);
02604 theQHadrons.push_back(qH);
02605 #ifdef debug
02606 G4cout<<"G4QE::HQE:QuasmH="<<qPDG<<fq4M<<G4endl;
02607 #endif
02608 G4QHadron* qeH = new G4QHadron(envPDG,qe4M);
02609 #ifdef debug
02610 G4cout<<"G4QE::HQE:EnvironH="<<envPDG<<qe4M<<G4endl;
02611 #endif
02612 if(envPDG==92000000||envPDG==90002000||envPDG==90000002)
02613 theEnvironment.DecayDibaryon(qeH,&theQHadrons);
02614 else theQHadrons.push_back(qeH);
02615 }
02616 for_each(output->begin(),output->end(),DeleteQHadron());
02617 output->clear();
02618 delete output;
02619 CleanUp();
02620 return theQHadrons;
02621 }
02622 else status=-1;
02623 }
02624 else if(eCount>1&&(nCount>nCnMax||theEnvironment.GetA()<2))
02625 {
02626 theEnvironment.InitByPDG(NUCPDG);
02627 #ifdef fdebug
02628 G4cout<<"G4QEnv::HQE:Evaporate Env+Quasm Env="<<curE<<G4endl;
02629 #endif
02630 G4QHadron* nucQE = new G4QHadron(curQC,t4M);
02631 EvaporateResidual(nucQE);
02632 pQ->KillQuasmon();
02633 #ifdef edebug
02634 G4cout<<"G4QEnv::HQE:StatusAfterKill (#"<<jq<<")="<<pQ->GetStatus()
02635 <<", nH="<<theQHadrons.size()<<G4endl;
02636 #endif
02637 tot4M-=t4M;
02638 totQC-=curQC;
02639 eCount--;
02640 }
02641 if(eCount==1 && tM>=curM)
02642 {
02643 theEnvironment.InitByPDG(NUCPDG);
02644 G4int ttPDG=totQC.GetSPDGCode();
02645 #ifdef pcdebug
02646 G4cout<<"G4QE::HQE:BefEv 4M="<<tot4M<<",QC="<<totQC<<ttPDG<<G4endl;
02647 #endif
02648 for_each(output->begin(),output->end(),DeleteQHadron());
02649 output->clear();
02650 delete output;
02651 CleanUp();
02652 G4int ttBN=totQC.GetBaryonNumber();
02653 if(ttPDG==10&&ttBN<2)
02654 {
02655 G4QChipolino QCh(totQC);
02656 G4QPDGCode h1QPDG=QCh.GetQPDG1();
02657 G4double h1M =h1QPDG.GetMass();
02658 G4QPDGCode h2QPDG=QCh.GetQPDG2();
02659 G4double h2M =h2QPDG.GetMass();
02660 G4double ttM=tot4M.m();
02661 if(h1M+h2M<ttM)
02662 {
02663 G4LorentzVector h14M(0.,0.,0.,h1M);
02664 G4LorentzVector h24M(0.,0.,0.,h2M);
02665 if(!G4QHadron(tot4M).DecayIn2(h14M,h24M))
02666 {
02667 G4ExceptionDescription ed;
02668 ed << "QChip (1) DecIn2 error: tM=" << ttM << "->h1="
02669 << h1QPDG << "(" << h1M << ")+h2=" << h1QPDG
02670 << "(" << h2M << ")=" << h1M+h2M << G4endl;
02671 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
02672 "HAD_CHPS_0006", FatalException, ed);
02673 }
02674 G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
02675 theQHadrons.push_back(h1H);
02676 #ifdef debug
02677 G4cout<<"G4QE::HQE: QCip-> H1="<<h1QPDG<<h14M<<G4endl;
02678 #endif
02679 G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
02680 theQHadrons.push_back(h2H);
02681 #ifdef debug
02682 G4cout<<"G4QE::HQE: QChip->H2="<<h2QPDG<<h24M<<G4endl;
02683 #endif
02684 }
02685 else
02686 {
02687 G4ExceptionDescription ed;
02688 ed << " QChip (2) DecIn2 error: tM=" << ttM << totQC << "->h1="
02689 << h1QPDG << "(" << h2M << "=" << h1M+h2M << G4endl;
02690 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
02691 "HAD_CHPS_0007", FatalException, ed);
02692 }
02693 }
02694 else
02695 {
02696 #ifdef edebug
02697 if(ttPDG<80000000&&ttBN<1)
02698 G4cout<<"---Warning---G4QE::HQE: NotNuc, tPDG="<<ttPDG<<G4endl;
02699 #endif
02700 G4QHadron* evH = new G4QHadron(totQC,tot4M);
02701 EvaporateResidual(evH);
02702 }
02703 return theQHadrons;
02704 }
02705 else if(eCount==1 && CheckGroundState(pQ,true))
02706 {
02707 for_each(output->begin(), output->end(), DeleteQHadron());
02708 output->clear();
02709 delete output;
02710 pQ->KillQuasmon();
02711 delete pQ;
02712 eCount--;
02713 return theQHadrons;
02714 }
02715 }
02716 else
02717 {
02718 G4QPDGCode QPDGQ=pQ->GetQPDG();
02719 G4int PDGQ=QPDGQ.GetPDGCode();
02720 #ifdef edebug
02721 G4cout<<"G4QEnv::HadrQEnv: vacuum PDGQ="<<PDGQ<<G4endl;
02722 #endif
02723 if(!PDGQ) status=-1;
02724
02725 else if(PDGQ==3112||PDGQ==3222||PDGQ==90999001||PDGQ==91000999)
02726 {
02727 #ifdef edebug
02728 G4cout<<"G4QEnv::HadrQEnv:Sigma Mass="<<cqMass<<G4endl;
02729 #endif
02730 G4double hyM=mNeut;
02731 G4int hyPDG=2112;
02732 G4double pigM=mPi;
02733 G4int pigPDG=-211;
02734 if(PDGQ==3112||PDGQ==90999001)
02735 {
02736 if(cqMass>mPi+mLamb)
02737 {
02738 hyM = mLamb;
02739 hyPDG = 3122;
02740 }
02741 else if(cqMass>mSigM)
02742 {
02743 hyM=mSigM;
02744 hyPDG=3112;
02745 pigM=0.;
02746 pigPDG=22;
02747 }
02748 }
02749 else if(PDGQ==3222||PDGQ==91000999)
02750 {
02751 pigPDG= 211;
02752 if(cqMass>mPi+mLamb)
02753 {
02754 hyM = mLamb;
02755 hyPDG = 3122;
02756 pigM = mPi;
02757 pigPDG= 211;
02758 }
02759 else if(cqMass>mSigP)
02760 {
02761 hyM=mSigP;
02762 hyPDG=3222;
02763 pigM=0.;
02764 pigPDG=22;
02765 }
02766 else if(cqMass>mPi0+mProt&&G4UniformRand()>.5)
02767 {
02768 hyM = mProt;
02769 hyPDG = 2212;
02770 pigM = mPi0;
02771 pigPDG= 111;
02772 }
02773 else if(cqMass<mPi+mNeut)
02774 {
02775 hyM = mProt;
02776 hyPDG = 2212;
02777 pigM=0.;
02778 pigPDG=22;
02779 }
02780
02781 }
02782 G4LorentzVector b4Mom(0.,0.,0.,hyM);
02783 G4LorentzVector m4Mom(0.,0.,0.,pigM);
02784 if(!G4QHadron(cq4M).DecayIn2(b4Mom, m4Mom))
02785 {
02786 G4cout<<"---Warning---G4QE::HQE:H="<<hyPDG<<"(m="<<hyM<<")+G/Pi="
02787 <<pigPDG<<"(m="<<pigM<<")="<<hyM+pigM<<">"<<cqMass<<G4endl;
02788 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
02789 CleanUp();
02790 if(!CheckGroundState(quasH,true))
02791 {
02792 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
02793 theQHadrons.push_back(hadr);
02794 #ifdef debug
02795 G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;
02796 #endif
02797
02798 }
02799 delete quasH;
02800 return theQHadrons;
02801 }
02802 #ifdef debug
02803 G4cout<<"G4QEnv::HadronizeQEnv: Sigma="<<PDGQ<<cq4M<<" -> Hyperon="
02804 <<hyPDG<<b4Mom<<" + Gamma/Pi="<<pigPDG<<m4Mom<<G4endl;
02805 #endif
02806 G4QHadron* curBar = new G4QHadron(hyPDG,b4Mom);
02807 theQHadrons.push_back(curBar);
02808 G4QHadron* curMes = new G4QHadron(pigPDG,m4Mom);
02809 theQHadrons.push_back(curMes);
02810 pQ->KillQuasmon();
02811 tot4M-=cq4M;
02812 totQC-=qQC;
02813 eCount--;
02814 }
02815 else if(PDGQ==90999002||PDGQ==91001999)
02816 {
02817 #ifdef edebug
02818 G4cout<<"G4QEnv::HadrQEnv: Nucleon+Sigma Mass="<<cqMass<<G4endl;
02819 #endif
02820 G4bool dinFlag = false;
02821 G4double hyM=mSigM;
02822 G4int hyPDG=3112;
02823 G4double pigM=mNeut;
02824 G4int pigPDG=2112;
02825 if (PDGQ==90999002)
02826 {
02827 if(cqMass<mNeut+mSigM)
02828 {
02829 dinFlag = true;
02830 hyM=mNeut+mNeut;
02831 hyPDG=2112;
02832 pigM=mPi;
02833 pigPDG=-211;
02834 }
02835 }
02836 else if(PDGQ==91001999)
02837 {
02838 hyM=mSigP;
02839 hyPDG=3222;
02840 pigM=mProt;
02841 pigPDG=2212;
02842 if(cqMass<mProt+mSigP)
02843 {
02844 hyM=mProt;
02845 hyPDG=2212;
02846 pigM=mProt;
02847 pigPDG=2212;
02848 }
02849 }
02850 G4LorentzVector b4Mom(0.,0.,0.,hyM);
02851 G4LorentzVector m4Mom(0.,0.,0.,pigM);
02852 if(!G4QHadron(cq4M).DecayIn2(b4Mom, m4Mom))
02853 {
02854 G4cout<<"--Warning--G4QE::HQE:S/D="<<hyPDG<<"(m="<<hyM<<")+N/Pi="
02855 <<pigPDG<<"(m="<<pigM<<")="<<hyM+pigM<<">"<<cqMass<<G4endl;
02856 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
02857 CleanUp();
02858 if(!CheckGroundState(quasH,true))
02859 {
02860 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
02861 theQHadrons.push_back(hadr);
02862 #ifdef debug
02863 G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;
02864 #endif
02865
02866 }
02867 delete quasH;
02868 return theQHadrons;
02869 }
02870 #ifdef debug
02871 G4cout<<"G4QEnv::HadronizeQEnv: NSigma="<<PDGQ<<cq4M<<"-> Sigma/dN="
02872 <<hyPDG<<b4Mom<<" + N/Pi="<<pigPDG<<m4Mom<<G4endl;
02873 #endif
02874 if(dinFlag) b4Mom/=2.;
02875 G4QHadron* curBar = new G4QHadron(hyPDG,b4Mom);
02876 theQHadrons.push_back(curBar);
02877 if(dinFlag)
02878 {
02879 G4QHadron* secBar = new G4QHadron(hyPDG,b4Mom);
02880 theQHadrons.push_back(secBar);
02881 }
02882 G4QHadron* curMes = new G4QHadron(pigPDG,m4Mom);
02883 theQHadrons.push_back(curMes);
02884 pQ->KillQuasmon();
02885 tot4M-=cq4M;
02886 totQC-=qQC;
02887 eCount--;
02888 }
02889 else if(PDGQ==90999003||PDGQ==91002999)
02890 {
02891 #ifdef edebug
02892 G4cout<<"G4QEnv::HadrQEnv: DiNucleon+Sigma Mass="<<cqMass<<G4endl;
02893 #endif
02894 G4bool dinFlag = false;
02895 G4double hyM=mSigM;
02896 G4int hyPDG=3112;
02897 G4double pigM=mNeut+mNeut;
02898 G4int pigPDG=2112;
02899 if (PDGQ==90999003)
02900 {
02901 if(cqMass<pigM+mSigM)
02902 {
02903 dinFlag = true;
02904 pigM=mNeut+mNeut+mNeut;
02905 pigPDG=2112;
02906 hyM=mPi;
02907 hyPDG=-211;
02908 }
02909 }
02910 else if(PDGQ==91002999)
02911 {
02912 hyM=mSigP;
02913 hyPDG=3222;
02914 pigM=mProt+mProt;
02915 pigPDG=2212;
02916 if(cqMass<pigM+mSigP)
02917 {
02918 dinFlag = true;
02919 pigM=mProt+mProt+mProt;
02920 pigPDG=2212;
02921 hyM=mPi;
02922 hyPDG=211;
02923 }
02924 }
02925 G4LorentzVector b4Mom(0.,0.,0.,hyM);
02926 G4LorentzVector m4Mom(0.,0.,0.,pigM);
02927 if(!G4QHadron(cq4M).DecayIn2(b4Mom, m4Mom))
02928 {
02929 G4cout<<"--Warning--G4QE::HQE:S/Pi="<<hyPDG<<"(m="<<hyM<<")+D/T="
02930 <<pigPDG<<"(m="<<pigM<<")="<<hyM+pigM<<">"<<cqMass<<G4endl;
02931 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
02932 CleanUp();
02933 if(!CheckGroundState(quasH,true))
02934 {
02935 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
02936 theQHadrons.push_back(hadr);
02937 #ifdef debug
02938 G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;
02939 #endif
02940
02941 }
02942 delete quasH;
02943 return theQHadrons;
02944 }
02945 #ifdef debug
02946 G4cout<<"G4QEnv::HadronizeQEnv:2NSigma="<<PDGQ<<cq4M<<"-> Sigma/Pi="
02947 <<hyPDG<<b4Mom<<" + 2N/3N="<<pigPDG<<m4Mom<<dinFlag<<G4endl;
02948 #endif
02949 G4QHadron* curBar = new G4QHadron(hyPDG,b4Mom);
02950 theQHadrons.push_back(curBar);
02951 if(dinFlag) m4Mom/=3.;
02952 else m4Mom/=2.;
02953 G4QHadron* curMes = new G4QHadron(pigPDG,m4Mom);
02954 theQHadrons.push_back(curMes);
02955 G4QHadron* secBar = new G4QHadron(pigPDG,m4Mom);
02956 theQHadrons.push_back(secBar);
02957 if(dinFlag)
02958 {
02959 G4QHadron* triBar = new G4QHadron(pigPDG,m4Mom);
02960 theQHadrons.push_back(triBar);
02961 }
02962 pQ->KillQuasmon();
02963 tot4M-=cq4M;
02964 totQC-=qQC;
02965 eCount--;
02966 }
02967 else if (PDGQ!=10)
02968 {
02969 G4double qM =cq4M.m();
02970 G4double gsM=QPDGQ.GetMass();
02971 #ifdef edebug
02972 G4cout<<"G4QEnv::HadrQEnv:#"<<jq<<",qM="<<qM<<">gsM="<<gsM<<G4endl;
02973 #endif
02974 if(fabs(qM-gsM)<0.0001)
02975 {
02976 G4QHadron* resQ = new G4QHadron(PDGQ,cq4M);
02977 #ifdef debug
02978 G4cout<<"G4QEnv::HadrQEnv:ResQ="<<PDGQ<<cq4M<<G4endl;
02979 #endif
02980 theQHadrons.push_back(resQ);
02981 pQ->KillQuasmon();
02982 tot4M-=cq4M;
02983 totQC-=qQC;
02984 eCount--;
02985 }
02986 else if(eCount==1 && qM<gsM && CheckGroundState(pQ,true))
02987 {
02988 #ifdef edebug
02989 G4cout<<"G4QEnv::HadrQEnv:**>>** CGS Correction **>>**"<<G4endl;
02990 #endif
02991 for_each(output->begin(), output->end(), DeleteQHadron());
02992 output->clear();
02993 delete output;
02994 pQ->KillQuasmon();
02995 eCount--;
02996 return theQHadrons;
02997 }
02998 else if(qM<gsM&&(pQ->GetQC().GetSPDGCode()==1114
02999 || pQ->GetQC().GetSPDGCode()==2224)
03000 &&qM>theWorld->GetQParticle(QPDGQ)->MinMassOfFragm())
03001 {
03002 #ifdef edebug
03003 G4cout<<"G4QEnv::HadrQEnv:**||** Copy&Decay **||**"<<G4endl;
03004 #endif
03005 G4QHadronVector* decHV=pQ->DecayQuasmon();
03006 CopyAndDeleteHadronVector(decHV);
03007 tot4M-=pQ->Get4Momentum();
03008 totQC-=pQ->GetQC();
03009 pQ->KillQuasmon();
03010 eCount--;
03011 }
03012 }
03013 }
03014 }
03015 else if(status==3) count3++;
03016 if(status<0)
03017 {
03018
03019
03020
03021
03022
03023
03024
03025
03026
03027 G4int ppm=jq;
03028 G4int nRQ=0;
03029 #ifdef edebug
03030 G4cout<<"G4QEnv::HadrQEnv: ***PANIC*** for jq="<<jq<<G4endl;
03031 #endif
03032 G4ThreeVector vp= pQ->Get4Momentum().vect();
03033 G4double dpm=1.e+30;
03034 if(nQuasmons>1) for(G4int ir=0; ir<nQuasmons; ir++)
03035 {
03036 if(ir!=jq)
03037 {
03038 G4Quasmon* rQ = theQuasmons[ir];
03039 G4int Qst = rQ->GetStatus();
03040 #ifdef edebug
03041 G4cout<<"G4QEnv::HadrQEnv: ir="<<ir<<",Qstatus="<<Qst<<G4endl;
03042 #endif
03043 if(Qst>0)
03044 {
03045 nRQ++;
03046 G4double dp=vp.dot(rQ->Get4Momentum().vect());
03047 if(dp<dpm)
03048 {
03049 ppm=ir;
03050 dpm=dp;
03051 }
03052 }
03053 }
03054 }
03055 if(nRQ)
03056 {
03057 G4Quasmon* rQ = theQuasmons[ppm];
03058 G4QContent rQC= rQ->GetQC();
03059 G4LorentzVector r4M= rQ->Get4Momentum();
03060 rQC += pQ->GetQC();
03061 r4M += pQ->Get4Momentum();
03062 rQ->InitQuasmon(rQC, r4M);
03063 #ifdef edebug
03064 G4cout<<"G4QE::HQE:"<<pQ->GetQC()<<"+"<<rQ->GetQC()<<"="<<rQC<<G4endl;
03065 #endif
03066 pQ->KillQuasmon();
03067 eCount--;
03068 }
03069 else
03070 {
03071 #ifdef edebug
03072 G4cout<<"G4QEnv::HQE: No Q-cand. nRQ="<<nRQ<<",eC="<<eCount<<G4endl;
03073 #endif
03074
03075 if(CheckGroundState(pQ,true))
03076 {
03077 for_each(output->begin(), output->end(), DeleteQHadron());
03078 output->clear();
03079 delete output;
03080 pQ->KillQuasmon();
03081 eCount--;
03082 return theQHadrons;
03083 }
03084 #ifdef fdebug
03085 G4cout<<"G4QEnv::HadrQEnv:NO PANICsolution,t="<<tot4M<<totQC<<G4endl;
03086 #endif
03087 totQC=theEnvironment.GetQC();
03088 tot4M=theEnvironment.Get4Momentum();
03089 if(nQuasmons) for(G4int jr=0; jr<nQuasmons; jr++)
03090 {
03091 G4Quasmon* rQ = theQuasmons[jr];
03092 G4int Qst = rQ->GetStatus();
03093 if(jr==jq)
03094 {
03095 totQC+=rQ->GetQC();
03096 tot4M+=rQ->Get4Momentum();
03097 }
03098 else if(Qst)
03099 {
03100 totQC+=rQ->GetQC();
03101 tot4M+=rQ->Get4Momentum();
03102 }
03103 }
03104 pQ->KillQuasmon();
03105 eCount--;
03106 CleanUp();
03107 G4QHadron* evH = new G4QHadron(totQC,tot4M);
03108 EvaporateResidual(evH);
03109 for_each(output->begin(), output->end(), DeleteQHadron());
03110 output->clear();
03111 delete output;
03112 force=true;
03113 break;
03114 }
03115 }
03116 }
03117 for_each(output->begin(), output->end(), DeleteQHadron());
03118 output->clear();
03119 delete output;
03120 }
03121 #ifdef debug
03122 G4cout<<"G4QE::HQE:QStat("<<jq<<"="<<status<<pQ->Get4Momentum()<<G4endl;
03123 #endif
03124 }
03125 cAN=0;
03126 }
03127 else if(totMass>totM+.001)
03128 {
03129 #ifdef edebug
03130 G4cout<<"G4QEnv::HadrQE: NQ="<<nQuasmons<<",tM="<<totMass<<",tPDG="<<totPDG<<",tB="
03131 <<totBN<<",GSM="<<totM<<",dM="<<totMass-totM<<",totQC="<<totQC<<G4endl;
03132 #endif
03133
03134 if(2>3)
03135 {
03136 G4QContent quasQC=totQC-envQC;
03137 G4int resQPDG=quasQC.GetSPDGCode();
03138 G4int resQB=quasQC.GetBaryonNumber();
03139 G4int resQCh=quasQC.GetCharge();
03140
03141 if((resQPDG==0 || resQPDG==10) && resQB>0) resQPDG=quasQC.GetZNSPDGCode();
03142 G4double resQM=G4QPDGCode(resQPDG).GetMass();
03143 G4double qCB=theEnvironment.CoulombBarrier(resQCh,resQB);
03144 G4double de=totMass-envM-resQM-qCB;
03145 #ifdef debug
03146 G4cout<<"G4QEnv::HadrQE:NQ==1,tM="<<totMass<<",qM="<<resQM<<",eM="<<envM<<",CB="
03147 <<qCB<<",dE="<<totMass-envM-resQM-qCB<<G4endl;
03148 #endif
03149 if(de>0.)
03150 {
03151 G4LorentzVector fq4M=G4LorentzVector(0.,0.,0.,resQM);
03152 G4LorentzVector fe4M=env4M;
03153 G4LorentzVector dir4M=tot4M-env4M;
03154 if(!G4QHadron(tot4M).RelDecayIn2(fe4M,fq4M,dir4M,1.,1.))
03155 {
03156 G4ExceptionDescription ed;
03157 ed << "Can't decay Q+E: t4M=" << tot4M << ",d=" << de << G4endl;
03158 G4Exception("G4QEnvironment::HadronizeQEnvironment()", "HAD_CHPS_0008",
03159 FatalException, ed);
03160 }
03161 G4QHadron* hQua = new G4QHadron(resQPDG,fq4M);
03162 theQHadrons.push_back(hQua);
03163 G4int envPDG=theEnvironment.GetPDGCode();
03164 G4QHadron* hEnv = new G4QHadron(envPDG,fe4M);
03165 theQHadrons.push_back(hEnv);
03166 #ifdef debug
03167 G4cout<<"G4QEnv::HadrQEnv:fQ="<<resQPDG<<fq4M<<", fE="<<envPDG<<fe4M<<G4endl;
03168 #endif
03169 return theQHadrons;
03170 }
03171 }
03172 #ifdef debug
03173 G4cout<<"G4QEnv::HadrQE: M="<<totMass<<",PDG="<<totPDG<<",B="<<totBN<<",GSM="<<totM
03174 <<",dM="<<totMass-totM<<",totQC="<<totQC<<G4endl;
03175 #endif
03176 if(totBN<2)
03177 {
03178 if(totPDG==90999999||totPDG==90999000||totPDG==90000999||totPDG==89999001)
03179 {
03180 G4cout<<"---Warning---G4QE::HQE:Meson(2) PDG="<<totPDG<<",M="<<totMass<<G4endl;
03181 }
03182 else if(totPDG==1114||totPDG==2224)
03183 {
03184 G4double mBar=mProt;
03185 G4int bPDG=2212;
03186 G4double mMes=mPi;
03187 G4int mPDG=211;
03188 if(totPDG==1114)
03189 {
03190 mBar=mNeut;
03191 bPDG=2112;
03192 mPDG=-211;
03193 }
03194 if(totMass<mBar+mMes)
03195 {
03196 G4cout<<"--Warning--G4QE::HQE:tM="<<totMass<<"<GSM+mPi0="<<totM+mPi0<<G4endl;
03197 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03198 CleanUp();
03199 if(!CheckGroundState(quasH,true))
03200 {
03201 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03202 theQHadrons.push_back(hadr);
03203 #ifdef debug
03204 G4cout<<"***G4QE::HQE:FillAsIs(-4),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03205 #endif
03206
03207 }
03208 delete quasH;
03209 return theQHadrons;
03210 }
03211 else
03212 {
03213
03214
03215
03216
03217
03218
03219 G4LorentzVector b4Mom(0.,0.,0.,mBar);
03220 G4LorentzVector m4Mom(0.,0.,0.,mMes);
03221 if(!G4QHadron(tot4M).DecayIn2(b4Mom, m4Mom))
03222 {
03223 G4cout<<"---Warning---G4QEnv::HadronizeQE:B="<<bPDG<<"(m="<<mBar<<") + M="
03224 <<mPDG<<"(m="<<mMes<<")="<<mBar+mMes<<" > mDel="<<totMass<<G4endl;
03225 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03226 CleanUp();
03227 if(!CheckGroundState(quasH,true))
03228 {
03229 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03230 theQHadrons.push_back(hadr);
03231 #ifdef debug
03232 G4cout<<"***G4QE::HQE:FillAsIs(-3),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03233 #endif
03234
03235 }
03236 delete quasH;
03237 return theQHadrons;
03238 }
03239 #ifdef debug
03240 G4cout<<"G4QEnv::HadronizeQEnv: DELTA="<<totPDG<<tot4M<<" -> Bar="
03241 <<bPDG<<b4Mom<<" + Mes="<<mPDG<<m4Mom<<G4endl;
03242 #endif
03243 G4QHadron* curBar = new G4QHadron(bPDG,b4Mom);
03244 theQHadrons.push_back(curBar);
03245 #ifdef edebug
03246 G4cout<<"G4QEnv::HadrQEnv:BaryonH="<<bPDG<<b4Mom<<G4endl;
03247 #endif
03248 G4QHadron* curMes = new G4QHadron(mPDG,m4Mom);
03249 theQHadrons.push_back(curMes);
03250 #ifdef edebug
03251 G4cout<<"G4QEnv::HadrQEnv:MesonH="<<mPDG<<m4Mom<<G4endl;
03252 #endif
03253 return theQHadrons;
03254 }
03255 }
03256 else if(totPDG==10)
03257 {
03258 G4QChipolino resChip(totQC);
03259 G4QPDGCode h1QPDG=resChip.GetQPDG1();
03260 G4int h1PDG=h1QPDG.GetPDGCode();
03261 G4double h1M =h1QPDG.GetMass();
03262 G4QPDGCode h2QPDG=resChip.GetQPDG2();
03263 G4int h2PDG=h2QPDG.GetPDGCode();
03264 G4double h2M =h2QPDG.GetMass();
03265 G4LorentzVector h14Mom(0.,0.,0.,h1M);
03266 G4LorentzVector h24Mom(0.,0.,0.,h2M);
03267 if(!G4QHadron(tot4M).DecayIn2(h14Mom, h24Mom))
03268 {
03269 G4cout<<"---Warning---G4QEnv::HadronizeQE:h1="<<h1PDG<<"(m="<<h1M<<") + h2="
03270 <<h2PDG<<"(m="<<h2M<<")="<<h1M+h2M<<" > mChipo="<<totMass<<G4endl;
03271 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03272 CleanUp();
03273 if(!CheckGroundState(quasH,true))
03274 {
03275 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03276 theQHadrons.push_back(hadr);
03277 #ifdef debug
03278 G4cout<<"***G4QE::HQE:FillAsIs(-2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03279 #endif
03280
03281 }
03282 delete quasH;
03283 return theQHadrons;
03284 }
03285 #ifdef debug
03286 G4cout<<"G4QEnv::HadronizeQEnv: Chipo="<<tot4M<<" -> h1="
03287 <<h1PDG<<h14Mom<<" + Mes="<<h2PDG<<h24Mom<<G4endl;
03288 #endif
03289 G4QHadron* curH1 = new G4QHadron(h1PDG,h14Mom);
03290 theQHadrons.push_back(curH1);
03291 #ifdef edebug
03292 G4cout<<"G4QEnv::HadrQEnv:HadronH="<<h1PDG<<h14Mom<<G4endl;
03293 #endif
03294 G4QHadron* curH2 = new G4QHadron(h2PDG,h24Mom);
03295 theQHadrons.push_back(curH2);
03296 #ifdef edebug
03297 G4cout<<"G4QEnv::HadrQEnv:MesAsHadrPartnerH="<<h2PDG<<h24Mom<<G4endl;
03298 #endif
03299 return theQHadrons;
03300 }
03301 else if(totBN<2&&totPDG&&totMass<totM+mPi0+.001)
03302 {
03303 G4LorentzVector h4Mom(0.,0.,0.,totM);
03304 G4LorentzVector g4Mom(0.,0.,0.,0.);
03305 if(!G4QHadron(tot4M).DecayIn2(h4Mom, g4Mom))
03306 {
03307 G4cout<<"---Warning---G4QEnv::HadronizeQEnv: h="<<totPDG<<"(m="<<totM
03308 <<") + gamma > mTot="<<totMass<<G4endl;
03309 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03310 CleanUp();
03311 if(!CheckGroundState(quasH,true))
03312 {
03313 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03314 theQHadrons.push_back(hadr);
03315 #ifdef debug
03316 G4cout<<"***G4QE::HQE:FillAsIs(-1),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03317 #endif
03318
03319 }
03320 delete quasH;
03321 return theQHadrons;
03322 }
03323 #ifdef debug
03324 G4cout<<"G4QE::HQE:"<<tot4M<<"->h="<<totPDG<<h4Mom<<" + gamma="<<g4Mom<<G4endl;
03325 #endif
03326 G4QHadron* curG = new G4QHadron(22,g4Mom);
03327 theQHadrons.push_back(curG);
03328 #ifdef edebug
03329 G4cout<<"G4QEnv::HadrQEnv:PhotonH="<<g4Mom<<G4endl;
03330 #endif
03331 G4QHadron* curH = new G4QHadron(totPDG,h4Mom);
03332 #ifdef edebug
03333 G4cout<<"G4QEnv::HadrQEnv:GamPartnerH="<<totPDG<<h4Mom<<G4endl;
03334 #endif
03335 if(totPDG==92000000||totPDG==90002000||totPDG==90000002)
03336 theEnvironment.DecayDibaryon(curH,&theQHadrons);
03337 else theQHadrons.push_back(curH);
03338 return theQHadrons;
03339 }
03340 else if(totBN<2&&totPDG)
03341 {
03342 G4int piPDG=111;
03343 G4double mpi=mPi0;
03344 G4int mbPDG=totPDG;
03345 G4double mbm=totM;
03346 if(totPDG==1114)
03347 {
03348 piPDG=-211;
03349 mpi=mPi;
03350 mbPDG=2112;
03351 mbm=mNeut;
03352 }
03353 else if(totPDG==2224)
03354 {
03355 piPDG=211;
03356 mpi=mPi;
03357 mbPDG=2212;
03358 mbm=mProt;
03359 }
03360 else if(totPDG==113)
03361 {
03362 piPDG=-211;
03363 mpi=mPi;
03364 mbPDG=211;
03365 mbm=mPi;
03366 }
03367 G4LorentzVector h4Mom(0.,0.,0.,mbm);
03368 G4LorentzVector g4Mom(0.,0.,0.,mpi);
03369 if(!G4QHadron(tot4M).DecayIn2(h4Mom, g4Mom))
03370 {
03371 G4cout<<"---Warning---G4QEnv::HadronizeQEnv: h="<<mbPDG<<"(m="<<mbm
03372 <<") + pi(m="<<mpi<<")="<<mbm+mpi<<" > mTot="<<totMass<<G4endl;
03373 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03374 CleanUp();
03375 if(!CheckGroundState(quasH,true))
03376 {
03377 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03378 theQHadrons.push_back(hadr);
03379 #ifdef debug
03380 G4cout<<"***G4QE::HQE:FillAsIs(0),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03381 #endif
03382
03383 }
03384 delete quasH;
03385 return theQHadrons;
03386 }
03387 #ifdef debug
03388 G4cout<<"G4QE::HQE:"<<tot4M<<"->h="<<mbPDG<<h4Mom<<"+p="<<piPDG<<g4Mom<<G4endl;
03389 #endif
03390 G4QHadron* curH = new G4QHadron(mbPDG,h4Mom);
03391 if(totPDG==92000000||totPDG==90002000||totPDG==90000002)
03392 theEnvironment.DecayDibaryon(curH,&theQHadrons);
03393 else theQHadrons.push_back(curH);
03394 G4QHadron* curG = new G4QHadron(piPDG,g4Mom);
03395 #ifdef edebug
03396 G4cout<<"G4QEnv::HadrQEnv:Gamma/Pi0H="<<piPDG<<g4Mom<<G4endl;
03397 #endif
03398 theQHadrons.push_back(curG);
03399 return theQHadrons;
03400 }
03401 else
03402 {
03403 G4Quasmon* resid = new G4Quasmon(totQC,tot4M);
03404 G4QNucleus vacuum_value(90000000);
03405 G4QHadronVector* curout=resid->Fragment(vacuum_value,1);
03406 G4int rest = resid->GetStatus();
03407 if(!rest) eCount--;
03408 delete resid;
03409 G4int nHadrons = curout->size();
03410 if(nHadrons>0)
03411 {
03412 for (G4int ih=0; ih<nHadrons; ih++)
03413 {
03414 #ifdef debug
03415 G4cout<<"G4QEnv::HadrQE:NewB<2, H#"<<ih
03416 <<", QPDG="<<(*curout)[ih]->GetQPDG()
03417 <<", 4M="<<(*curout)[ih]->Get4Momentum()<<G4endl;
03418 #endif
03419
03420 theQHadrons.push_back((*curout)[ih]);
03421 }
03422 }
03423 else
03424 {
03425 G4ExceptionDescription ed;
03426 ed << " Quasmon decay? : MQ=" << tot4M.m() << ",QC=" << totQC
03427 << G4endl;
03428 G4Exception("G4QEnvironment::HadronizeQEnvironment()", "HAD_CHPS_0009",
03429 FatalException, ed);
03430 }
03431 curout->clear();
03432 delete curout;
03433 return theQHadrons;
03434 }
03435 }
03436 else
03437 {
03438 G4QContent tQC =totQC;
03439 G4int NSi =0;
03440 G4int SiPDG =0;
03441 G4double MSi =0.;
03442 G4int NaK =0;
03443 G4int aKPDG =0;
03444 G4double MaK =0.;
03445 G4int NPi =0;
03446 G4int PiPDG =0;
03447 G4double MPi =0.;
03448 if (totBN>0&&totS<0&&totChg+totChg>=totBN)
03449 {
03450 aKPDG=321;
03451 NaK=-totS;
03452 MaK=mK*NaK;
03453 tQC+=totS*KpQC;
03454 totChg+=totS;
03455 totS=0;
03456 }
03457 else if (totBN>0&&totS<0)
03458 {
03459 aKPDG=311;
03460 NaK=-totS;
03461 MaK=mK0*NaK;
03462 tQC+=totS*K0QC;
03463 totS=0;
03464 }
03465 else if (totBN>1&&totS>0&&(totChg<0||totChg>totBN-totS))
03466 {
03467 NSi=totS;
03468 if(totChg<0)
03469 {
03470 SiPDG=3112;
03471 if(-totChg<NSi) NSi=-totChg;
03472 MSi=mSigM*NSi;
03473 tQC-=NSi*SiMQC;
03474 totChg+=NSi;
03475 }
03476 else
03477 {
03478 SiPDG=3222;
03479 G4int exChg=totChg-totBN+totS;
03480 if(exChg<NSi) NSi=exChg;
03481 MSi=mSigP*NSi;
03482 tQC-=NSi*SiPQC;
03483 totChg-=NSi;
03484 }
03485 totS-=NSi;
03486 totBN-=NSi;
03487 }
03488 else if (totBN>0&&totS>totBN&&totBN<totS+totChg)
03489 {
03490 aKPDG=-311;
03491 NaK=totS-totBN;
03492 MaK=mK0*NaK;
03493 tQC+=NaK*K0QC;
03494 totS-=NaK;
03495 }
03496 else if (totBN>0&&totS>totBN&&totChg<0)
03497 {
03498 aKPDG=-321;
03499 NaK=totS-totBN;
03500 MaK=mK0*NaK;
03501 tQC+=NaK*KpQC;
03502 totChg+=NaK;
03503 totS-=NaK;
03504 }
03505
03506 if (totBN>0&&totChg>totBN-totS)
03507 {
03508 PiPDG=211;
03509 NPi=totChg-totBN+totS;
03510 MPi=mPi*NPi;
03511 tQC-=NPi*PiQC;
03512 totChg-=NPi;
03513 }
03514 else if (totBN>0&&totChg<0)
03515 {
03516 PiPDG=-211;
03517 NPi=-totChg;
03518 MPi=mPi*NPi;
03519 tQC+=NPi*PiQC;
03520 totChg+=NPi;
03521 }
03522 else if (!totBN&&totChg>1-totS)
03523 {
03524 PiPDG=211;
03525 NPi=totChg+totS-1;
03526 MPi=mPi*NPi;
03527 tQC-=NPi*PiQC;
03528 totChg-=NPi;
03529 }
03530 else if (!totBN&&totChg<-1-totS)
03531 {
03532 PiPDG=-211;
03533 NPi-=totChg+totS+1;
03534 MPi=mPi*NPi;
03535 tQC+=NPi*PiQC;
03536 totChg+=NPi;
03537 }
03538 G4double totRM=0.;
03539 if(totBN<2)
03540 {
03541 totPDG=tQC.GetSPDGCode();
03542 if(totPDG==10&&tQC.GetBaryonNumber()>0) totPDG=tQC.GetZNSPDGCode();
03543 if(totPDG) totRM=G4QPDGCode(totPDG).GetMass();
03544 else
03545 {
03546
03547
03548 G4ExceptionDescription ed;
03549 ed << "Impossible PDG for B=1: totPDG=0" << G4endl;
03550 G4Exception("G4QEnvironment::HadronizeQEnvironment()",
03551 "HAD_CHPS_0010", FatalException, ed);
03552 }
03553 }
03554 else
03555 {
03556 G4QNucleus totN_temporary(tQC,tot4M);
03557 totN=totN_temporary;
03558 totRM=totN.GetMZNS();
03559 totPDG=totN.GetPDG();
03560 }
03561 if(NaK)
03562 {
03563 if(!NPi)
03564 {
03565 G4LorentzVector m4Mom(0.,0.,0.,MaK);
03566 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03567 G4double sum=MaK+totRM;
03568 if(fabs(totMass-sum)<eps)
03569 {
03570 m4Mom=tot4M*(MaK/sum);
03571 n4Mom=tot4M*(totRM/sum);
03572 }
03573 else if(totMass<sum || !G4QHadron(tot4M).DecayIn2(m4Mom, n4Mom))
03574 {
03575 #ifdef edebug
03576 G4cout<<"***G4QE::HadronizeQE:M="<<aKPDG<<"(m="<<MaK<<")+N="<<totPDG<<"(m="
03577 <<totRM<<")="<<sum<<" > mSN="<<totMass<<",d="<<sum-totMass<<G4endl;
03578 #endif
03579 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03580 CleanUp();
03581 if(!CheckGroundState(quasH,true))
03582 {
03583 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03584 theQHadrons.push_back(hadr);
03585 #ifdef debug
03586 G4cout<<"***G4QEnv::HQE:FillAsItIs(1),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03587 #endif
03588
03589 }
03590 delete quasH;
03591 return theQHadrons;
03592 }
03593 #ifdef debug
03594 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> M="
03595 <<aKPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<totQC<<G4endl;
03596 #endif
03597 G4LorentzVector oneK=m4Mom;
03598 if(NaK>1) oneK = m4Mom/NaK;
03599 for (G4int jp=0; jp<NaK; jp++)
03600 {
03601 G4QHadron* curK = new G4QHadron(aKPDG,oneK);
03602 theQHadrons.push_back(curK);
03603 }
03604 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03605 EvaporateResidual(curN);
03606 }
03607 else
03608 {
03609 G4LorentzVector m4Mom(0.,0.,0.,MPi);
03610 G4LorentzVector k4Mom(0.,0.,0.,MaK);
03611 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03612 if(!G4QHadron(tot4M).DecayIn3(m4Mom, k4Mom, n4Mom))
03613 {
03614 G4cout<<"---Warning---G4QE::HadronQE:K="<<aKPDG<<"(m="<<MaK<<")+PI="<<PiPDG
03615 <<"(m="<<MPi<<")+N="<<totPDG<<"(m="<<totRM<<")>tM="<<totMass<<G4endl;
03616 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03617 CleanUp();
03618 if(!CheckGroundState(quasH,true))
03619 {
03620 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03621 theQHadrons.push_back(hadr);
03622 #ifdef debug
03623 G4cout<<"***G4QEnv::HQE:FillAsItIs(2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03624 #endif
03625
03626 }
03627 delete quasH;
03628 return theQHadrons;
03629 }
03630 #ifdef fdebug
03631 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> nK="<<aKPDG<<k4Mom
03632 <<" + nPi="<<PiPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<G4endl;
03633 #endif
03634 G4LorentzVector onePi=m4Mom;
03635 if(NPi>1) onePi = m4Mom/NPi;
03636 for (G4int ip=0; ip<NPi; ip++)
03637 {
03638 G4QHadron* curP = new G4QHadron(PiPDG,onePi);
03639 #ifdef debug
03640 G4cout<<"G4QEnv::HadrQEnv:SPion#"<<ip<<",H="<<PiPDG<<onePi<<G4endl;
03641 #endif
03642 theQHadrons.push_back(curP);
03643 }
03644 G4LorentzVector oneK=k4Mom;
03645 if(NaK>1) oneK = k4Mom/NaK;
03646 for (G4int jp=0; jp<NaK; jp++)
03647 {
03648 G4QHadron* curP = new G4QHadron(aKPDG,oneK);
03649 #ifdef debug
03650 G4cout<<"G4QEnv::HadrQEnv:Kaon#"<<jp<<",H="<<aKPDG<<oneK<<G4endl;
03651 #endif
03652 theQHadrons.push_back(curP);
03653 }
03654 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03655 EvaporateResidual(curN);
03656 }
03657 return theQHadrons;
03658 }
03659 else if(NSi)
03660 {
03661 if(!NPi)
03662 {
03663 G4LorentzVector m4Mom(0.,0.,0.,MSi);
03664 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03665 G4double sum=MSi+totRM;
03666 if(fabs(totMass-sum)<eps)
03667 {
03668 m4Mom=tot4M*(MSi/sum);
03669 n4Mom=tot4M*(totRM/sum);
03670 }
03671 else if(totMass<sum || !G4QHadron(tot4M).DecayIn2(m4Mom, n4Mom))
03672 {
03673 #ifdef edebug
03674 G4cout<<"***G4QE::HadronizeQE:M="<<aKPDG<<"(s="<<MSi<<")+N="<<totPDG<<"(m="
03675 <<totRM<<")="<<sum<<" > mSN="<<totMass<<",d="<<sum-totMass<<G4endl;
03676 #endif
03677 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03678 CleanUp();
03679 if(!CheckGroundState(quasH,true))
03680 {
03681 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03682 theQHadrons.push_back(hadr);
03683 #ifdef debug
03684 G4cout<<"***G4QEnv::HQE:FillAsItIs(2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03685 #endif
03686
03687 }
03688 delete quasH;
03689 return theQHadrons;
03690 }
03691 #ifdef debug
03692 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> Sig="
03693 <<SiPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<totQC<<G4endl;
03694 #endif
03695 G4LorentzVector oneS=m4Mom;
03696 if(NSi>1) oneS = m4Mom/NSi;
03697 for (G4int jp=0; jp<NSi; jp++)
03698 {
03699 G4QHadron* curS = new G4QHadron(SiPDG,oneS);
03700 theQHadrons.push_back(curS);
03701 }
03702 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03703 EvaporateResidual(curN);
03704 }
03705 else
03706 {
03707 G4LorentzVector m4Mom(0.,0.,0.,MPi);
03708 G4LorentzVector k4Mom(0.,0.,0.,MSi);
03709 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03710 if(!G4QHadron(tot4M).DecayIn3(m4Mom, k4Mom, n4Mom))
03711 {
03712 G4cout<<"---Warning---G4QE::HadronQE:S="<<SiPDG<<"(m="<<MSi<<")+PI="<<PiPDG
03713 <<"(m="<<MPi<<")+N="<<totPDG<<"(m="<<totRM<<")>tM="<<totMass<<G4endl;
03714 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03715 CleanUp();
03716 if(!CheckGroundState(quasH,true))
03717 {
03718 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03719 theQHadrons.push_back(hadr);
03720 #ifdef debug
03721 G4cout<<"***G4QEnv::HQE:FillAsItIs(3),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03722 #endif
03723
03724 }
03725 delete quasH;
03726 return theQHadrons;
03727 }
03728 #ifdef fdebug
03729 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> nS="<<SiPDG<<k4Mom
03730 <<" + nPi="<<PiPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<G4endl;
03731 #endif
03732 G4LorentzVector onePi=m4Mom;
03733 if(NPi>1) onePi = m4Mom/NPi;
03734 for (G4int ip=0; ip<NPi; ip++)
03735 {
03736 G4QHadron* curP = new G4QHadron(PiPDG,onePi);
03737 #ifdef debug
03738 G4cout<<"G4QEnv::HadrQEnv:SPion#"<<ip<<",H="<<PiPDG<<onePi<<G4endl;
03739 #endif
03740 theQHadrons.push_back(curP);
03741 }
03742 G4LorentzVector oneS=k4Mom;
03743 if(NSi>1) oneS = k4Mom/NSi;
03744 for (G4int jp=0; jp<NSi; jp++)
03745 {
03746 G4QHadron* curP = new G4QHadron(SiPDG,oneS);
03747 #ifdef debug
03748 G4cout<<"G4QEnv::HadrQEnv:Sigma#"<<jp<<",H="<<SiPDG<<oneS<<G4endl;
03749 #endif
03750 theQHadrons.push_back(curP);
03751 }
03752 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03753 EvaporateResidual(curN);
03754 }
03755 return theQHadrons;
03756 }
03757 else if(NPi)
03758 {
03759 if(NPi==1)
03760 {
03761 G4LorentzVector m4Mom(0.,0.,0.,MPi);
03762 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03763 if(!G4QHadron(tot4M).DecayIn2(m4Mom, n4Mom))
03764 {
03765 G4cout<<"---Warning---G4QEnv::HadronizeQEnv:M="<<PiPDG<<"(m="<<MPi<<")+N="
03766 <<totPDG<<"(m="<<totRM<<")="<<MPi+totRM<<" > mSN="<<totMass<<G4endl;
03767 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03768 CleanUp();
03769 if(!CheckGroundState(quasH,true))
03770 {
03771 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03772 theQHadrons.push_back(hadr);
03773 #ifdef debug
03774 G4cout<<"***G4QEnv::HQE:FillAsItIs(5),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03775 #endif
03776
03777 }
03778 delete quasH;
03779 return theQHadrons;
03780 }
03781 #ifdef debug
03782 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> M="<<PiPDG<<m4Mom<<" + N="
03783 <<totPDG<<n4Mom<<totQC<<G4endl;
03784 #endif
03785 G4QHadron* curK = new G4QHadron(PiPDG,m4Mom);
03786 theQHadrons.push_back(curK);
03787 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03788 EvaporateResidual(curN);
03789 }
03790 else
03791 {
03792 G4int N1Pi = NPi/2;
03793 G4int N2Pi = NPi-N1Pi;
03794 G4double mM = MPi/NPi;
03795 G4double m1M = mM*N1Pi;
03796 G4double m2M = mM*N2Pi;
03797 G4LorentzVector m4Mom(0.,0.,0.,m1M);
03798 G4LorentzVector k4Mom(0.,0.,0.,m2M);
03799 G4LorentzVector n4Mom(0.,0.,0.,totRM);
03800 if(!G4QHadron(tot4M).DecayIn3(m4Mom, k4Mom, n4Mom))
03801 {
03802 G4cout<<"---Warning---G4QEnv::HadronizeQE:N*Pi="<<PiPDG<<"(m="<<mM<<")+N="
03803 <<totPDG<<"(m="<<totRM<<") >(?)SN="<<totMass<<G4endl;
03804 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03805 CleanUp();
03806 if(!CheckGroundState(quasH,true))
03807 {
03808 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03809 theQHadrons.push_back(hadr);
03810 #ifdef debug
03811 G4cout<<"***G4QEnv::HQE:FillAsItIs(5),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03812 #endif
03813
03814 }
03815 delete quasH;
03816 return theQHadrons;
03817 }
03818 #ifdef debug
03819 G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> N*PI="<<PiPDG
03820 <<" (4M1="<<m4Mom<<" + 4M2="<<k4Mom<<") + N="<<totPDG<<n4Mom<<G4endl;
03821 #endif
03822 G4LorentzVector one1=m4Mom;
03823 if(N1Pi>1) one1=m4Mom/N1Pi;
03824 for (G4int ip=0; ip<N1Pi; ip++)
03825 {
03826 G4QHadron* curP = new G4QHadron(PiPDG,one1);
03827 theQHadrons.push_back(curP);
03828 }
03829 G4LorentzVector one2=k4Mom;
03830 if(N2Pi>1) one2=k4Mom/N2Pi;
03831 for (G4int jp=0; jp<N2Pi; jp++)
03832 {
03833 G4QHadron* curP = new G4QHadron(PiPDG,one2);
03834 theQHadrons.push_back(curP);
03835 }
03836 G4QHadron* curN = new G4QHadron(totPDG,n4Mom);
03837 EvaporateResidual(curN);
03838 }
03839 return theQHadrons;
03840 }
03841 }
03842 #ifdef fdebug
03843 G4cout<<"G4QE::HadrQEnv: Try FinalEvaporation t4M="<<tot4M<<",tQC="<<totQC<<G4endl;
03844 #endif
03845 CleanUp();
03846 G4QHadron* evH = new G4QHadron(totQC,tot4M);
03847 EvaporateResidual(evH);
03848 return theQHadrons;
03849 }
03850 else
03851 {
03852 if(totPDG==90000000 || fabs(totMass)<0.000001)
03853 {
03854 CleanUp();
03855 return theQHadrons;
03856 }
03857 G4double dM=totMass-totM;
03858 #ifdef debug
03859 G4cout<<"G4QEnv::HadrQEnv:GroundState tM-GSM="<<dM<<",GSM="<<totM<<",tPDG="<<totPDG
03860 <<",nQ="<<nQuasmons<<G4endl;
03861 #endif
03862 G4Quasmon* pQ = theQuasmons[0];
03863 G4QPDGCode QQPDG = pQ->GetQPDG();
03864 G4int QPDG = QQPDG.GetPDGCode();
03865 G4QNucleus totRN(totQC,tot4M);
03866 G4int spbRN=totRN.SplitBaryon();
03867 if(dM>-0.001)
03868 {
03869 #ifdef fdebug
03870 G4cout<<"G4QE::HadrQE:ExcitedNucleus, dM="<<dM<<">0,tBN="<<totBN<<",nQ="<<G4endl;
03871 #endif
03872 CleanUp();
03873 G4QHadron* evH = new G4QHadron(totQC,tot4M);
03874 EvaporateResidual(evH);
03875 }
03876 else if(nQuasmons==1&&QPDG!=22&&QPDG!=111)
03877 {
03878 G4int envPDG = theEnvironment.GetPDG();
03879 #ifdef debug
03880 G4cout<<"G4QEnv::HadrQEnv: nQ=1, QPDG=="<<QPDG<<G4endl;
03881 #endif
03882 if(!QPDG)
03883 {
03884 G4ExceptionDescription ed;
03885 ed <<"(2)Can't Decay QEnv: Quasmon is an unknown QHadron: PDG="<< QPDG<<G4endl;
03886 G4Exception("G4QEnvironment::HadronizeQEnvironmen()", "HAD_CHPS_0011",
03887 FatalException, ed);
03888 }
03889
03890 else if(QPDG==10||QPDG==92000000||QPDG==90002000||QPDG==90000002)
03891 {
03892 G4QContent QQC = pQ->GetQC();
03893 G4QPDGCode h1QPDG=nQPDG;
03894 G4double h1M =mNeut;
03895 G4QPDGCode h2QPDG=h1QPDG;
03896 G4double h2M =mNeut;
03897 if(QPDG==10)
03898 {
03899 G4QChipolino QChip(QQC);
03900 h1QPDG=QChip.GetQPDG1();
03901 h1M =h1QPDG.GetMass();
03902 h2QPDG=QChip.GetQPDG2();
03903 h2M =h2QPDG.GetMass();
03904 }
03905 else if(QPDG==90002000)
03906 {
03907 h1QPDG=pQPDG;
03908 h1M =mProt;
03909 h2QPDG=h1QPDG;
03910 h2M =mProt;
03911 }
03912 else if(QPDG==92000000)
03913 {
03914 h1QPDG=lQPDG;
03915 h1M =mLamb;
03916 h2QPDG=h1QPDG;
03917 h2M =mLamb;
03918 G4double ddMass=totMass-envM;
03919 if(ddMass>mSigZ+mSigZ)
03920 {
03921 G4double dd2=ddMass*ddMass;
03922 G4double sma=mLamb+mLamb;
03923 G4double pr1=0.;
03924 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
03925 sma=mLamb+mSigZ;
03926 G4double smi=mSigZ-mLamb;
03927 G4double pr2=pr1;
03928 if(ddMass>sma && ddMass>smi) pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
03929 sma=mSigZ+mSigZ;
03930 G4double pr3=pr2;
03931 if(ddMass>sma) pr3+=sqrt((dd2-sma*sma)*dd2);
03932 G4double hhRND=pr3*G4UniformRand();
03933 if(hhRND>pr2)
03934 {
03935 h1QPDG=s0QPDG;
03936 h1M =mSigZ;
03937 h2QPDG=h1QPDG;
03938 h2M =mSigZ;
03939 }
03940 else if(hhRND>pr1)
03941 {
03942 h1QPDG=s0QPDG;
03943 h1M =mSigZ;
03944 }
03945 }
03946 else if(ddMass>mSigZ+mLamb)
03947 {
03948 G4double dd2=ddMass*ddMass;
03949 G4double sma=mLamb+mLamb;
03950 G4double pr1=0.;
03951 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
03952 sma=mLamb+mSigZ;
03953 G4double smi=mSigZ-mLamb;
03954 G4double pr2=pr1;
03955 if(ddMass>sma && ddMass>smi) pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
03956 if(pr2*G4UniformRand()>pr1)
03957 {
03958 h1QPDG=s0QPDG;
03959 h1M =mSigZ;
03960 }
03961 }
03962 }
03963 if(h1M+h2M+envM<totMass)
03964 {
03965 G4LorentzVector h14M(0.,0.,0.,h1M);
03966 G4LorentzVector h24M(0.,0.,0.,h2M);
03967 G4LorentzVector e4M(0.,0.,0.,envM);
03968 if(!G4QHadron(tot4M).DecayIn3(h14M,h24M,e4M))
03969 {
03970 G4cout<<"Warning->G4QE::HQE:M="<<tot4M.m()<<","<<totMass<<"->"<<h1QPDG<<"("
03971 <<h1M<<")+"<<h1QPDG<<"("<<h2M<<")+"<<envM<<"="<<h1M+h2M+envM<<G4endl;
03972 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
03973 CleanUp();
03974 if(!CheckGroundState(quasH,true))
03975 {
03976 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
03977 theQHadrons.push_back(hadr);
03978 #ifdef debug
03979 G4cout<<"***G4QEnv::HQE:FillAsItIs(6),QC="<<totQC<<",4M="<<tot4M<<G4endl;
03980 #endif
03981
03982 }
03983 delete quasH;
03984 return theQHadrons;
03985
03986 }
03987 G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
03988 theQHadrons.push_back(h1H);
03989 #ifdef debug
03990 G4cout<<"G4QE::HQE:(2) H1="<<h1QPDG<<h14M<<G4endl;
03991 #endif
03992 G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
03993 theQHadrons.push_back(h2H);
03994 #ifdef debug
03995 G4cout<<"G4QE::HQE:(2) H2-"<<h2QPDG<<h24M<<G4endl;
03996 #endif
03997 G4QHadron* qeH = new G4QHadron(envPDG,e4M);
03998 theQHadrons.push_back(qeH);
03999 #ifdef debug
04000 G4cout<<"G4QE::HQE:(2) QEenv="<<envPDG<<e4M<<G4endl;
04001 #endif
04002 }
04003 #ifdef fdebug
04004 G4cout<<"***G4QEnv::HadQEnv:tM="<<tot4M.m()<<totQC<<"< h1="<<h1QPDG<<"(M="<<h1M
04005 <<")+h2="<<h1QPDG<<"(M="<<h2M<<")+eM="<<envM<<"="<<h1M+h2M+envM<<G4endl;
04006
04007 #endif
04008 CleanUp();
04009 G4QHadron* evH = new G4QHadron(totQC,tot4M);
04010 EvaporateResidual(evH);
04011 return theQHadrons;
04012 }
04013 else
04014 {
04015 G4int nHadrs=theQHadrons.size();
04016 for(G4int ih=0; ih<nHadrs; ++ih)
04017 {
04018 G4QHadron* ch=theQHadrons[ih];
04019 G4LorentzVector ch4M=ch->Get4Momentum();
04020 G4double chM=ch4M.m();
04021 G4LorentzVector tch4M=ch4M+tot4M;
04022 if(tch4M.m() > chM + totM)
04023 {
04024 G4LorentzVector h14M(0.,0.,0.,chM);
04025 G4LorentzVector h24M(0.,0.,0.,totM);
04026 if(!G4QHadron(tch4M).DecayIn2(h14M,h24M))
04027 {
04028 G4cout<<"-Warning->G4QE::HQE:M="<<tch4M.m()<<"->"<<chM<<"+"<<totM<<"="
04029 <<chM+totM<<G4endl;
04030 }
04031 else
04032 {
04033 tot4M=h24M;
04034 ch->Set4Momentum(h14M);
04035 break;
04036 }
04037 }
04038 }
04039 G4QHadron* rH = new G4QHadron(totQC,tot4M);
04040 theQHadrons.push_back(rH);
04041 }
04042 }
04043 else if(spbRN)
04044 {
04045 #ifdef fdebug
04046 G4cout<<"***G4QEnv::HadQEnv: Evaporate the total residual tRN="<<totRN<<G4endl;
04047 #endif
04048 CleanUp();
04049 G4QHadron* evH = new G4QHadron(totQC,tot4M);
04050 EvaporateResidual(evH);
04051 return theQHadrons;
04052 }
04053
04054 else if(2>3)
04055 {
04056 #ifdef debug
04057 G4cout<<"***G4QEnv::HadrQE: M="<<totMass<<",dM="<<dM<<",nQ="<<nQuasmons<<G4endl;
04058 #endif
04059 G4int nOfOUT = theQHadrons.size();
04060 while(nOfOUT)
04061 {
04062 G4QHadron* theLast = theQHadrons[nOfOUT-1];
04063 G4LorentzVector last4M = theLast->Get4Momentum();
04064 G4QContent lastQC = theLast->GetQC();
04065 G4int lastS = lastQC.GetStrangeness();
04066 totS = totQC.GetStrangeness();
04067 G4int nFr = theLast->GetNFragments();
04068 G4int gam = theLast->GetPDGCode();
04069 if(gam!=22&&!nFr&&lastS<0&&lastS+totS<0&&nOfOUT>1)
04070 {
04071 G4QHadron* thePrev = theQHadrons[nOfOUT-2];
04072 theQHadrons.pop_back();
04073 theQHadrons.pop_back();
04074 theQHadrons.push_back(thePrev);
04075 delete theLast;
04076 theLast = thePrev;
04077 last4M = theLast->Get4Momentum();
04078 lastQC = theLast->GetQC();
04079 }
04080 else
04081 {
04082 theQHadrons.pop_back();
04083 delete theLast;
04084 }
04085 totQC+=lastQC;
04086 tot4M+=last4M;
04087 totMass=tot4M.m();
04088 G4int bn=totQC.GetBaryonNumber();
04089 totPDG=totQC.GetSPDGCode();
04090 if(totPDG==10&&totQC.GetBaryonNumber()>0) totPDG=totQC.GetZNSPDGCode();
04091 if(bn>1)
04092 {
04093 totS =totQC.GetStrangeness();
04094 if(totS>=0)
04095 {
04096 G4QNucleus newN(totQC,tot4M);
04097 totPDG=newN.GetPDG();
04098 totM =newN.GetMZNS();
04099 }
04100 else if(totS==-1)
04101 {
04102 G4double m1=mK;
04103 G4int PDG1=321;
04104 G4QNucleus newNp(totQC-KpQC);
04105 G4int PDG2=newNp.GetPDG();
04106 G4double m2_value=newNp.GetMZNS();
04107 G4QNucleus newN0(totQC-K0QC);
04108 G4double m3_value=newN0.GetMZNS();
04109 if (m3_value+mK0<m2_value+mK)
04110 {
04111 m1 =mK0;
04112 PDG1=311;
04113 m2_value =m3_value;
04114 PDG2=newN0.GetPDG();
04115 }
04116 if(totMass>m1+m2_value)
04117 {
04118 G4LorentzVector fq4M(0.,0.,0.,m1);
04119 G4LorentzVector qe4M(0.,0.,0.,m2_value);
04120 if(!G4QHadron(tot4M).DecayIn2(fq4M,qe4M))
04121 {
04122 G4cout<<"---Warning---G4QE::HadQE:tM="<<tot4M.m()<<"->aK="<<PDG1<<"(M="
04123 <<m1<<")+ResA="<<PDG2<<"(M="<<m2_value<<")="<<m1+m2_value<<G4endl;
04124 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
04125 CleanUp();
04126 if(!CheckGroundState(quasH,true))
04127 {
04128 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
04129 theQHadrons.push_back(hadr);
04130 #ifdef debug
04131 G4cout<<"***G4QE::HQE:FillAsIs(7),QC="<<totQC<<",4M="<<tot4M<<G4endl;
04132 #endif
04133
04134 }
04135 delete quasH;
04136 return theQHadrons;
04137 }
04138 G4QHadron* H1 = new G4QHadron(PDG1,fq4M);
04139 #ifdef debug
04140 G4cout<<"G4QE::HQE:Kaon(Env)="<<PDG1<<fq4M<<G4endl;
04141 #endif
04142 theQHadrons.push_back(H1);
04143 G4QHadron* H2 = new G4QHadron(PDG2,qe4M);
04144 #ifdef debug
04145 G4cout<<"G4QE::HQE:ResidEnv="<<PDG2<<qe4M<<G4endl;
04146 #endif
04147 theQHadrons.push_back(H2);
04148 break;
04149 }
04150 else totM=250000.;
04151 }
04152 else if(totS==-2)
04153 {
04154 G4double m1=mK;
04155 G4int PDG1=321;
04156 G4double m2_value=mK0;
04157 G4int PDG2=311;
04158 G4QNucleus newNp0(totQC-KpQC-K0QC);
04159 G4int PDG3=newNp0.GetPDG();
04160 G4double m3_value=newNp0.GetMZNS();
04161 G4QNucleus newN00(totQC-K0QC-K0QC);
04162 G4double m4=newN00.GetMZNS();
04163 G4QNucleus newNpp(totQC-KpQC-KpQC);
04164 G4double m5=newNpp.GetMZNS();
04165 if (m4+mK0+mK0<m3_value+mK+mK0 && m4+mK0+mK0<=m5+mK+mK)
04166 {
04167 m1 =mK0;
04168 PDG1=311;
04169 m3_value =m4;
04170 PDG3=newN00.GetPDG();
04171 }
04172 else if(m5+mK+mK<m3_value+mK+mK0 && m5+mK+mK<=m4+mK0+mK0)
04173 {
04174 m2_value =mK;
04175 PDG1=321;
04176 m3_value =m5;
04177 PDG3=newNpp.GetPDG();
04178 }
04179 if(totMass>m1+m2_value+m3_value)
04180 {
04181 G4LorentzVector k14M(0.,0.,0.,m1);
04182 G4LorentzVector k24M(0.,0.,0.,m2_value);
04183 G4LorentzVector ra4M(0.,0.,0.,m3_value);
04184 if(!G4QHadron(tot4M).DecayIn3(k14M,k24M,ra4M))
04185 {
04186 G4cout<<"--Warning--G4QE::HQE:tM="<<tot4M.m()<<"->aK="<<PDG1<<"(M="<<m1
04187 <<")+K2="<<PDG2<<"(M="<<m2_value<<")+A="<<PDG3<<"(M="<<m3_value<<")"<<G4endl;
04188 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
04189 CleanUp();
04190 if(!CheckGroundState(quasH,true))
04191 {
04192 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
04193 theQHadrons.push_back(hadr);
04194 #ifdef debug
04195 G4cout<<"***G4QE::HQE:FillAsIs(8),QC="<<totQC<<",4M="<<tot4M<<G4endl;
04196 #endif
04197
04198 }
04199 delete quasH;
04200 return theQHadrons;
04201 }
04202 G4QHadron* H1 = new G4QHadron(PDG1,k14M);
04203 theQHadrons.push_back(H1);
04204 #ifdef debug
04205 G4cout<<"G4QE::HQE:K1(Env)="<<PDG1<<k14M<<G4endl;
04206 #endif
04207 G4QHadron* H2 = new G4QHadron(PDG2,k24M);
04208 theQHadrons.push_back(H2);
04209 #ifdef debug
04210 G4cout<<"G4QE::HQE:K2(Env)="<<PDG2<<k24M<<G4endl;
04211 #endif
04212 G4QHadron* H3 = new G4QHadron(PDG3,ra4M);
04213 theQHadrons.push_back(H3);
04214 #ifdef debug
04215 G4cout<<"G4QE::HQE:ResKKEnv="<<PDG3<<ra4M<<G4endl;
04216 #endif
04217 break;
04218 }
04219 else totM=270000.;
04220 }
04221 else totM=300000.;
04222 }
04223 else
04224 {
04225 if (totPDG==1114||totPDG==2224||totPDG==10)
04226 {
04227 G4double m1=mNeut;
04228 G4int PDG1=2112;
04229 G4double m2_value=mPi;
04230 G4int PDG2=-211;
04231 if(totPDG==2224)
04232 {
04233 m1=mProt;
04234 PDG1=2212;
04235 m2_value=mPi;
04236 PDG2=211;
04237 }
04238 else if(totPDG==10)
04239 {
04240 G4QChipolino resChip(totQC);
04241 G4QPDGCode h1=resChip.GetQPDG1();
04242 PDG1=h1.GetPDGCode();
04243 m1 =h1.GetMass();
04244 G4QPDGCode h2=resChip.GetQPDG2();
04245 PDG2=h2.GetPDGCode();
04246 m2_value =h2.GetMass();
04247 }
04248 if(totMass>m1+m2)
04249 {
04250 G4LorentzVector fq4M(0.,0.,0.,m1);
04251 G4LorentzVector qe4M(0.,0.,0.,m2_value);
04252 if(!G4QHadron(tot4M).DecayIn2(fq4M,qe4M))
04253 {
04254 G4cout<<"---Warning---G4QE::HaQE:tM="<<tot4M.m()<<"-> h1="<<PDG1<<"(M="
04255 <<m1<<") + h2="<<PDG2<<"(M="<<m2_value<<")="<<m1+m2_value<<G4endl;
04256 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
04257 CleanUp();
04258 if(!CheckGroundState(quasH,true))
04259 {
04260 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
04261 theQHadrons.push_back(hadr);
04262 #ifdef debug
04263 G4cout<<"***G4QE::HQE:FillAsIs(9),QC="<<totQC<<",4M="<<tot4M<<G4endl;
04264 #endif
04265
04266 }
04267 delete quasH;
04268 return theQHadrons;
04269 }
04270 G4QHadron* H1 = new G4QHadron(PDG1,fq4M);
04271 theQHadrons.push_back(H1);
04272 #ifdef debug
04273 G4cout<<"G4QE::HQE:h1="<<PDG1<<fq4M<<G4endl;
04274 #endif
04275 G4QHadron* H2 = new G4QHadron(PDG2,qe4M);
04276 #ifdef debug
04277 G4cout<<"G4QE::HQE:h2="<<PDG2<<qe4M<<G4endl;
04278 #endif
04279 theQHadrons.push_back(H2);
04280 break;
04281 }
04282 else totM=350000.;
04283 }
04284 else if(totPDG) totM=G4QPDGCode(totPDG).GetMass();
04285 else totM=400000.;
04286 }
04287 totBN=totQC.GetBaryonNumber();
04288 totS=totQC.GetStrangeness();
04289 dM=totMass-totM;
04290 #ifdef fdebug
04291 G4cout<<"G4QEnv::HadrQE: Add H="<<last4M<<lastQC<<",tM="<<tot4M<<totM<<totQC
04292 <<",dM="<<dM<<", tB="<<totBN<<", tS="<<totS<<G4endl;
04293 #endif
04294 if(dM>-0.001&&totPDG)
04295 {
04296 CleanUp();
04297 G4QHadron* evH = new G4QHadron(totPDG,tot4M);
04298 EvaporateResidual(evH);
04299 break;
04300 }
04301 nOfOUT = theQHadrons.size();
04302 }
04303 nOfOUT = theQHadrons.size();
04304 if(!nOfOUT)
04305 {
04306 G4cout<<"---Warning---G4QEnv::HadrQE:M="<<totMass<<"<gsM="<<totM<<",dM="<<dM
04307 <<", tPDG="<<totPDG<<", t4M="<<tot4M<<G4endl;
04308
04309 CleanUp();
04310 G4QHadron* evH = new G4QHadron(totPDG,tot4M);
04311 EvaporateResidual(evH);
04312 }
04313 }
04314 else
04315 {
04316 #ifdef debug
04317 G4cout<<"***G4QEnv::HadrQE: M="<<totMass<<",dM="<<dM<<",nQ="<<nQuasmons<<G4endl;
04318 #endif
04319 G4Quasmon* quasH = new G4Quasmon(totQC,tot4M);
04320 CleanUp();
04321 if(!CheckGroundState(quasH,true))
04322 {
04323 G4QHadron* hadr = new G4QHadron(totQC,tot4M);
04324 #ifdef debug
04325 G4cout<<"G4QE::HQE:CheckGS failed H="<<totQC<<tot4M<<G4endl;
04326 #endif
04327 theQHadrons.push_back(hadr);
04328 }
04329 delete quasH;
04330 }
04331 CleanUp();
04332 }
04333 }
04334 }
04335 return theQHadrons;
04336 }
04337
04338
04339 void G4QEnvironment::CleanUp()
04340 {
04341 static const G4QNucleus vacuum(90000000);
04342 theEnvironment=vacuum;
04343 G4int nQuasmons = theQuasmons.size();
04344 if (nQuasmons) for (G4int iq=0; iq<nQuasmons; iq++)theQuasmons[iq]->KillQuasmon();
04345 }
04346
04347
04348 void G4QEnvironment::EvaporateResidual(G4QHadron* qH, G4bool fCGS)
04349 {
04350 static const G4double mAlph = G4QPDGCode(2112).GetNuclMass(2,2,0);
04351 static const G4double mDeut = G4QPDGCode(2112).GetNuclMass(1,1,0);
04352 static const G4double mNeut = G4QPDGCode(2112).GetMass();
04353 static const G4double mProt = G4QPDGCode(2212).GetMass();
04354 static const G4double mAlPr = mAlph+mProt;
04355 static const G4double mAlNt = mAlph+mNeut;
04356 static const G4double dProt = mProt+mProt;
04357 static const G4double dNeut = mNeut+mNeut;
04358 static const G4double dAlph = mAlph+mAlph;
04359 static const G4double eps=.003;
04360 G4int thePDG = qH->GetPDGCode();
04361 G4int theBN = qH->GetBaryonNumber();
04362 G4QContent theQC = qH->GetQC();
04363 G4int theS=theQC.GetStrangeness();
04364 #ifdef debug
04365 G4cout<<"G4QE::EvaporateRes:Called for PDG="<<thePDG<<",4M="<<qH->Get4Momentum()<<G4endl;
04366 #endif
04367 if(thePDG==10)
04368 {
04369 G4QContent chQC=qH->GetQC();
04370 G4QChipolino QCh(chQC);
04371 G4LorentzVector ch4M=qH->Get4Momentum();
04372 G4QPDGCode h1QPDG=QCh.GetQPDG1();
04373 G4double h1M =h1QPDG.GetMass();
04374 G4QPDGCode h2QPDG=QCh.GetQPDG2();
04375 G4double h2M =h2QPDG.GetMass();
04376 G4double chM2 =ch4M.m2();
04377 if( sqr(h1M+h2M) < chM2 )
04378 {
04379 G4LorentzVector h14M(0.,0.,0.,h1M);
04380 G4LorentzVector h24M(0.,0.,0.,h2M);
04381 if(!G4QHadron(ch4M).DecayIn2(h14M,h24M))
04382 {
04383 G4ExceptionDescription ed;
04384 ed << "QChipolino DecIn2 error: CM=" << std::sqrt(chM2) << " -> h1="
04385 << h1QPDG << "(" << h1M << ") + h2=" << h1QPDG << "(" << h2M
04386 << ") = " << h1M+h2M << " **Failed**" << G4endl;
04387 G4Exception("G4QEnvironment::EvaporateResidual()", "HAD_CHPS_0000",
04388 FatalException, ed);
04389 }
04390 delete qH;
04391 G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
04392 theQHadrons.push_back(h1H);
04393 #ifdef debug
04394 G4cout<<"G4QE::EvaporateResidual: Chipolino -> H1="<<h1QPDG<<h14M<<G4endl;
04395 #endif
04396 qH = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
04397 theQHadrons.push_back(qH);
04398 #ifdef debug
04399 G4cout<<"G4QE::EvaporateResidual: Chipolino -> H2="<<h2QPDG<<h24M<<G4endl;
04400 #endif
04401 }
04402 else
04403 {
04404
04405
04406
04407
04408 G4ExceptionDescription ed;
04409 ed << "LowMassChipolino in Input: ChipoMeson=" << qH->GetQC()
04410 << qH->Get4Momentum() << ", chipoM=" << std::sqrt(chM2) << " < m1="
04411 << h1M << "(" << h1QPDG << ") + m2=" << h2M << "(" << h2QPDG << ") = "
04412 << h1M+h2M << G4endl;
04413 G4Exception("G4QEnvironment::EvaporateResidual()", "HAD_CHPS_0001",
04414 FatalException, ed);
04415 }
04416 return;
04417 }
04418 else if(theS<0)
04419 {
04420 #ifdef debug
04421 G4cout<<"G4QE::EvaporateRes: AntistrangeNucleus="<<thePDG<<qH->Get4Momentum()<<G4endl;
04422 #endif
04423 DecayAntistrange(qH, &theQHadrons);
04424 return;
04425 }
04426 else if(theBN==1)
04427 {
04428 #ifdef debug
04429 G4cout<<"G4QE::EvaporateRes: Baryon="<<thePDG<<qH->Get4Momentum()<<G4endl;
04430 #endif
04431 DecayBaryon(qH, &theQHadrons);
04432 return;
04433 }
04434 else if(!theBN)
04435 {
04436 #ifdef debug
04437 G4LorentzVector mesLV=qH->Get4Momentum();
04438 G4cout<<"G4QE::EvaporateRes:(!)Meson(!) PDG="<<thePDG<<",4M="<<mesLV<<mesLV.m()
04439 <<",QC="<<qH->GetQC()<<",MPDG="<<G4QPDGCode(thePDG).GetMass()<<G4endl;
04440 #endif
04441 DecayMeson(qH, &theQHadrons);
04442
04443 return;
04444 }
04445 G4int theC=theQC.GetCharge();
04446 if(!thePDG) thePDG = theQC.GetSPDGCode();
04447 if(thePDG==10 && theBN>0) thePDG=theQC.GetZNSPDGCode();
04448 if(theS>0) thePDG-=theS*999999;
04449 G4double totGSM = G4QNucleus(thePDG).GetGSMass();
04450 if(theBN==2)
04451 {
04452 if(!theC) totGSM=dNeut;
04453 else if(theC==2) totGSM=dProt;
04454 else totGSM=mDeut;
04455 }
04456 else if(theBN==5)
04457 {
04458 if (theC==3) totGSM=mAlPr;
04459 else if(theC==2) totGSM=mAlNt;
04460 }
04461 else if(theBN==8) totGSM=dAlph;
04462
04463 G4LorentzVector q4M = qH->Get4Momentum();
04464 G4double totMass = q4M.m();
04465 if(fabs(totMass-totGSM)<eps)
04466 {
04467 theQHadrons.push_back(qH);
04468 }
04469 else if(totMass>totGSM)
04470 {
04471 theEnvironment.EvaporateNucleus(qH,&theQHadrons);
04472 #ifdef qdebug
04473 qH=0;
04474 #endif
04475 }
04476 else
04477 {
04478 #ifdef debug
04479 G4cout<<"G4QE::EvaRes: *Correct* "<<theQC<<q4M<<totMass<<"<"<<totGSM<<G4endl;
04480 #endif
04481 G4Quasmon* quasH = new G4Quasmon(theQC,q4M);
04482 if(fCGS && !CheckGroundState(quasH, true) )
04483 {
04484 #ifdef debug
04485 G4cout<<"***G4QE::EvaporResid:GSCorFailed.FillAsItIs,n="<<theQHadrons.size()<<G4endl;
04486 #endif
04487 theQHadrons.push_back(qH);
04488 #ifdef qdebug
04489 qH=0;
04490 #endif
04491 }
04492 else
04493 {
04494 delete qH;
04495 #ifdef qdebug
04496 qH=0;
04497 #endif
04498 }
04499 delete quasH;
04500 }
04501 #ifdef qdebug
04502 if (qH)
04503 {
04504 G4cout<<"G4QEnvironment::EvaporateResidual:EndDeleted, PDG="<<qH->GetPDGCode()<<G4endl;
04505 delete qH;
04506 }
04507 #endif
04508 return;
04509 }
04510
04511
04512 G4QHadronVector* G4QEnvironment::Fragment()
04513 {
04514 #ifdef chdebug
04515 G4int fCharge=theEnvironment.GetCharge();
04516 G4int fBaryoN=theEnvironment.GetA();
04517 G4int nHad=theQHadrons.size();
04518 if(nHad) for(G4int ih=0; ih<nHad; ih++)
04519 {
04520 fCharge+=theQHadrons[ih]->GetCharge();
04521 fBaryoN+=theQHadrons[ih]->GetBaryonNumber();
04522 }
04523 G4int nQuas=theQuasmons.size();
04524 if(nQuas)for(G4int iqs=0; iqs<nQuas; iqs++)
04525 {
04526 fCharge+=theQuasmons[iqs]->GetCharge();
04527 fBaryoN+=theQuasmons[iqs]->GetBaryonNumber();
04528 }
04529 if(fCharge!=totCharge || fBaryoN!=totBaryoN)
04530 {
04531 G4cout<<"*::*G4QE::Frag:(4) tC="<<totCharge<<",C="<<fCharge<<",tB="<<totBaryoN
04532 <<",B="<<fBaryoN<<",E="<<theEnvironment<<G4endl;
04533 if(nHad) for(G4int h=0; h<nHad; h++)
04534 {
04535 G4QHadron* cH = theQHadrons[h];
04536 G4cout<<"*::*G4QE::HQ:h#"<<h<<",QC="<<cH->GetQC()<<",PDG="<<cH->GetPDGCode()<<G4endl;
04537 }
04538 if(nQuas) for(G4int q=0; q<nQuas; q++)
04539 {
04540 G4Quasmon* cQ = theQuasmons[q];
04541 G4cout<<"*::*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QCont="<<cQ->GetQC()<<G4endl;
04542 }
04543 }
04544 #endif
04545 G4QHadronVector dummy;
04546 G4QHadronVector* theFragments = &dummy;
04547 G4int ExCount =0;
04548 G4int MaxExCnt=1;
04549 G4bool RepFlag=true;
04550
04551 G4QuasmonVector* reQuasmons = new G4QuasmonVector;
04552 G4int nQ = theQuasmons.size();
04553 if(nQ)
04554 {
04555 for(G4int iq=0; iq<nQ; iq++)
04556 {
04557 G4Quasmon* curQ = new G4Quasmon(theQuasmons[iq]);
04558 reQuasmons->push_back(curQ);
04559 }
04560 }
04561 G4QHadronVector* reQHadrons = new G4QHadronVector;
04562 G4int nH = theQHadrons.size();
04563 if(nH)
04564 {
04565 for(G4int ih=0; ih<nH; ih++)
04566 {
04567 G4QHadron* curH = new G4QHadron(theQHadrons[ih]);
04568 reQHadrons->push_back(curH);
04569 }
04570 }
04571 G4QNucleus reEnvironment=theEnvironment;
04572 G4LorentzVector rem4M=tot4Mom;
04573 while (RepFlag && ExCount<MaxExCnt)
04574 {
04575 try
04576 {
04577 RepFlag=false;
04578 theFragments = FSInteraction();
04579 }
04580 catch (G4QException& error)
04581 {
04582 G4cout<<"***G4QEnvironment::Fragment: Exception is catched"<<G4endl;
04583 RepFlag=true;
04584 ExCount++;
04585 G4cout<<"***G4QEnv::Fragment:Exception #"<<ExCount<<": "<<error.GetMessage()<<G4endl;
04586 G4LorentzVector dif=rem4M-theEnvironment.Get4Momentum();
04587 G4int nHp=theQHadrons.size();
04588 G4int nQp = theQuasmons.size();
04589 G4cout<<"***G4QEnvir::Fragment:nH="<<nHp<<",nQ="<<nQp<<",E="<<theEnvironment<<G4endl;
04590 for(G4int ph=0; ph<nHp; ph++)
04591 {
04592 G4QHadron* cH = theQHadrons[ph];
04593 dif-=cH->Get4Momentum();
04594 G4cout<<"***G4QEnvir::Fr:H"<<ph<<"="<<cH->Get4Momentum()<<cH->GetPDGCode()<<G4endl;
04595 }
04596 for(G4int pq=0; pq<nQp; pq++)
04597 {
04598 G4Quasmon* cQ = theQuasmons[pq];
04599 dif-=cQ->Get4Momentum();
04600 G4cout<<"***G4QEnvir::Fr:Quasm#"<<pq<<"="<<cQ->Get4Momentum()<<cQ->GetQC()<<G4endl;
04601 }
04602
04603 for_each(theFragments->begin(), theFragments->end(), DeleteQHadron());
04604 theFragments->clear();
04605 for_each(theQHadrons.begin(), theQHadrons.end(), DeleteQHadron());
04606 theQHadrons.clear();
04607 for_each(theQuasmons.begin(), theQuasmons.end(), DeleteQuasmon());
04608 theQuasmons.clear();
04609 G4cout<<"***G4QEnv::Fragment: ----------- End of CleaningUp: 4Mdif="<<dif<<G4endl;
04610
04611 theEnvironment=reEnvironment;
04612 tot4Mom=rem4M;
04613 G4cout<<"***G4QEnv::Fragment:*Recover*Env="<<theEnvironment<<",4M="<<tot4Mom<<G4endl;
04614 G4int mQ = reQuasmons->size();
04615 for(G4int jq=0; jq<mQ; jq++)
04616 {
04617
04618 G4Quasmon* curQ = new G4Quasmon((*reQuasmons)[jq]);
04619 G4cout<<"***G4QE::Fragm:Q("<<jq<<")="<<curQ->Get4Momentum()<<curQ->GetQC()<<G4endl;
04620 theQuasmons.push_back(curQ);
04621 }
04622 G4int mH = reQHadrons->size();
04623 for(G4int jh=0; jh<mH; jh++)
04624 {
04625
04626 G4QHadron* curH = new G4QHadron((*reQHadrons)[jh]);
04627 G4cout<<"***G4QE::Fragm:H("<<jh<<")="<<curH->Get4Momentum()<<curH->GetQC()<<G4endl;
04628 theQHadrons.push_back(curH);
04629 }
04630 }
04631 }
04632 if(reQuasmons->size())
04633 {
04634 for_each(reQuasmons->begin(),reQuasmons->end(),DeleteQuasmon());
04635 reQuasmons->clear();
04636 }
04637 delete reQuasmons;
04638 if(reQHadrons->size())
04639 {
04640 for_each(reQHadrons->begin(),reQHadrons->end(),DeleteQHadron());
04641 reQHadrons->clear();
04642 }
04643 delete reQHadrons;
04644 if(ExCount>=MaxExCnt)
04645 {
04646 G4int nProj=theProjectiles.size();
04647 G4cerr<<"*G4QEnv::Fragment:Exception.Target="<<theTargetPDG<<". #Proj="<<nProj<<G4endl;
04648 if(nProj) for(G4int ipr=0; ipr<nProj; ipr++)
04649 {
04650 G4QHadron* prH = theProjectiles[ipr];
04651 G4cerr<<"G4QE::F:#"<<ipr<<",PDG/4M="<<prH->GetPDGCode()<<prH->Get4Momentum()<<G4endl;
04652 }
04653 G4Exception("G4QEnvironment::Fragment()", "HAD_CHPS_0000",
04654 FatalException, "This reaction caused the CHIPSException");
04655 }
04656
04657 G4int tmpS=intQHadrons.size();
04658 if(tmpS)
04659 {
04660
04661
04662
04663
04664
04665
04666
04667
04668
04669
04670
04671 theFragments->insert(theFragments->begin(), intQHadrons.begin(), intQHadrons.end() );
04672 intQHadrons.clear();
04673 }
04674
04675 CheckMassShell(theFragments);
04676 return theFragments;
04677 }
04678
04679
04680 G4QHadronVector* G4QEnvironment::FSInteraction()
04681 {
04682 static const G4QPDGCode gQPDG(22);
04683 static const G4QPDGCode pizQPDG(111);
04684 static const G4QPDGCode pipQPDG(211);
04685 static const G4QPDGCode pimQPDG(-211);
04686 static const G4QPDGCode nQPDG(2112);
04687 static const G4QPDGCode pQPDG(2212);
04688 static const G4QPDGCode lQPDG(3122);
04689 static const G4QPDGCode s0QPDG(3212);
04690
04691 static const G4QPDGCode tQPDG(90001002);
04692 static const G4QPDGCode he3QPDG(90002001);
04693 static const G4QPDGCode aQPDG(90002002);
04694 static const G4QPDGCode a6QPDG(90002004);
04695 static const G4QPDGCode be6QPDG(90004002);
04696
04697
04698 static const G4QPDGCode c8QPDG(90006002);
04699 static const G4QPDGCode a8QPDG(90002006);
04700 static const G4QPDGCode c10QPDG(90006004);
04701 static const G4QPDGCode o14QPDG(90008006);
04702 static const G4QPDGCode o15QPDG(90008007);
04703 static const G4QContent K0QC(1,0,0,0,0,1);
04704 static const G4QContent KpQC(0,1,0,0,0,1);
04705 static const G4double mPi = G4QPDGCode(211).GetMass();
04706 static const G4double mPi0 = G4QPDGCode(111).GetMass();
04707 static const G4double mK = G4QPDGCode(321).GetMass();
04708 static const G4double mK0 = G4QPDGCode(311).GetMass();
04709 static const G4double mNeut= G4QPDGCode(2112).GetMass();
04710 static const G4double mProt= G4QPDGCode(2212).GetMass();
04711 static const G4double mLamb= G4QPDGCode(3122).GetMass();
04712 static const G4double mSigZ= G4QPDGCode(3212).GetMass();
04713 static const G4double mSigM= G4QPDGCode(3112).GetMass();
04714 static const G4double mSigP= G4QPDGCode(3222).GetMass();
04715 static const G4double mXiZ = G4QPDGCode(3322).GetMass();
04716 static const G4double mXiM = G4QPDGCode(3312).GetMass();
04717 static const G4double mOmM = G4QPDGCode(3334).GetMass();
04718 static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
04719 static const G4double mTrit= G4QPDGCode(2112).GetNuclMass(1,2,0);
04720 static const G4double mHe3 = G4QPDGCode(2112).GetNuclMass(2,1,0);
04721 static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
04722 static const G4double mHe6 = G4QPDGCode(2112).GetNuclMass(2,4,0);
04723 static const G4double mBe6 = G4QPDGCode(2112).GetNuclMass(4,2,0);
04724
04725
04726 static const G4double mHe8 = G4QPDGCode(2112).GetNuclMass(2,6,0);
04727 static const G4double mC8 = G4QPDGCode(2112).GetNuclMass(6,2,0);
04728 static const G4double mC10 = G4QPDGCode(2112).GetNuclMass(6,4,0);
04729 static const G4double mO14 = G4QPDGCode(2112).GetNuclMass(8,6,0);
04730 static const G4double mO15 = G4QPDGCode(2112).GetNuclMass(8,7,0);
04731 static const G4double mKmP = mK+mProt;
04732 static const G4double mKmN = mK+mNeut;
04733 static const G4double mK0mP = mK0+mProt;
04734 static const G4double mK0mN = mK0+mNeut;
04735 static const G4QNucleus vacuum(90000000);
04736 static const G4double eps=0.003;
04739 G4int envA=theEnvironment.GetBaryonNumber();
04741 #ifdef rdebug
04742 G4int totInC=theEnvironment.GetZ();
04743 G4LorentzVector totIn4M=theEnvironment.Get4Momentum();
04744 G4cout<<"G4QEnvironment(G4QE)::FSInter(FSI): ***called*** envA="<<envA<<totIn4M<<G4endl;
04745 G4int nQuasmons=theQuasmons.size();
04746 for (G4int is=0; is<nQuasmons; is++)
04747 {
04748 G4Quasmon* pQ = theQuasmons[is];
04749 G4LorentzVector Q4M= pQ->Get4Momentum();
04750 G4cout<<"G4QE::FSI: Quasmon ("<<is<<") is added, 4M="<<Q4M<<G4endl;
04751 totIn4M += Q4M;
04752 totInC += pQ->GetQC().GetCharge();
04753 }
04754 G4int nsHadr = theQHadrons.size();
04755 if(nsHadr) for(G4int jso=0; jso<nsHadr; jso++)
04756 {
04757 G4int hsNF = theQHadrons[jso]->GetNFragments();
04758 if(!hsNF)
04759 {
04760 G4LorentzVector hs4Mom = theQHadrons[jso]->Get4Momentum();
04761 G4cout<<"G4QE::FSI: Hadron ("<<jso<<") is added, 4M="<<hs4Mom<<G4endl;
04762 totIn4M += hs4Mom;
04763 totInC += theQHadrons[jso]->GetCharge();
04764 }
04765 }
04766 G4cout<<"G4QE::FSI: The resulting 4Momentum="<<totIn4M<<G4endl;
04767 #endif
04768 #ifdef chdebug
04769 G4int fCharge=theEnvironment.GetCharge();
04770 G4int fBaryoN=theEnvironment.GetA();
04771 G4int nHad=theQHadrons.size();
04772 if(nHad) for(G4int ih=0; ih<nHad; ih++)
04773 {
04774 fCharge+=theQHadrons[ih]->GetCharge();
04775 fBaryoN+=theQHadrons[ih]->GetBaryonNumber();
04776 }
04777 G4int nQuas=theQuasmons.size();
04778 if(nQuas)for(G4int iqs=0; iqs<nQuas; iqs++)
04779 {
04780 fCharge+=theQuasmons[iqs]->GetCharge();
04781 fBaryoN+=theQuasmons[iqs]->GetBaryonNumber();
04782 }
04783 if(fCharge!=totCharge || fBaryoN!=totBaryoN)
04784 {
04785 G4cout<<"*::*G4QE::FSI:(5) tC="<<totCharge<<",C="<<fCharge<<",tB="<<totBaryoN
04786 <<",B="<<fBaryoN<<",E="<<theEnvironment<<G4endl;
04787 if(nHad) for(G4int h=0; h<nHad; h++)
04788 {
04789 G4QHadron* cH = theQHadrons[h];
04790 G4cout<<"*::*G4QE::HQ:h#"<<h<<",QC="<<cH->GetQC()<<",PDG="<<cH->GetPDGCode()<<G4endl;
04791 }
04792 if(nQuas) for(G4int q=0; q<nQuas; q++)
04793 {
04794 G4Quasmon* cQ = theQuasmons[q];
04795 G4cout<<"*::*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QCont="<<cQ->GetQC()<<G4endl;
04796 }
04797 }
04798 #endif
04799 G4QHadronVector* theFragments = new G4QHadronVector;
04800 HadronizeQEnvironment();
04801 #ifdef rdebug
04802 G4int tC=totInC-theEnvironment.GetZ();
04803 G4LorentzVector t4M=totIn4M;
04804 G4cout<<"G4QEnv::FSI: Initial tot4M="<<t4M<<" to be subtracted"<<G4endl;
04805 G4LorentzVector theEnv4m=theEnvironment.Get4Momentum();
04806 t4M-=theEnv4m;
04807 G4cout<<"G4QEnv::FSI: Subtract Environ="<<theEnv4m<<theEnvironment<<G4endl;
04808 for (G4int js=0; js<nQuasmons; js++)
04809 {
04810 G4Quasmon* prQ = theQuasmons[js];
04811 if(prQ->GetStatus())
04812 {
04813 G4LorentzVector Q4M= prQ->Get4Momentum();
04814 G4QContent qQC= prQ->GetQC();
04815 G4cout<<"G4QE::FSI: Subtract Quasmon("<<js<<"),4M="<<Q4M<<",QC="<<qQC<<G4endl;
04816 t4M -= Q4M;
04817 tC -= prQ->GetQC().GetCharge();
04818 }
04819 else G4cout<<"G4QE::FSI:Dead Quasmon("<<js<<")="<<prQ->GetStatus()<<G4endl;
04820 }
04821 G4int nsbHadr=theQHadrons.size();
04822 if(nsbHadr) for(G4int jpo=0; jpo<nsbHadr; jpo++)
04823 {
04824 G4int hsNF = theQHadrons[jpo]->GetNFragments();
04825 if(!hsNF)
04826 {
04827 G4LorentzVector hs4Mom = theQHadrons[jpo]->Get4Momentum();
04828 G4int hPDG = theQHadrons[jpo]->GetPDGCode();
04829 G4cout<<"G4QE::FSI: Subtract Hadron("<<jpo<<"), 4M="<<hs4Mom<<hPDG<<G4endl;
04830 t4M -= hs4Mom;
04831 tC -= theQHadrons[jpo]->GetCharge();
04832 }
04833 }
04834 G4cout<<"G4QEnv::FSI:|||||4-MomCHECK||||d4M="<<t4M<<",dCharge="<<tC<<G4endl;
04835 #endif
04836 unsigned nHadr=theQHadrons.size();
04837 if(nHadr<=0)
04838 {
04839 G4cout<<"---Warning---G4QEnvironment::FSInteraction: nHadrons="<<nHadr<<G4endl;
04840
04841 return theFragments;
04842 }
04843 G4int lHadr=theQHadrons[nHadr-1]->GetBaryonNumber();
04844 #ifdef debug
04845 G4cout<<"G4QE::FSI:after HQE,nH="<<nHadr<<",lHBN="<<lHadr<<",E="<<theEnvironment<<G4endl;
04846 #endif
04847 if(lHadr>1)
04848 {
04849 G4QHadron* theLast = theQHadrons[nHadr-1];
04850 G4QHadron* curHadr = new G4QHadron(theLast);
04851 G4LorentzVector lh4M=curHadr->Get4Momentum();
04852 G4double lhM=lh4M.m();
04853 G4int lhPDG=curHadr->GetPDGCode();
04854 G4double lhGSM=G4QPDGCode(lhPDG).GetMass();
04855 #ifdef debug
04856 G4cout<<"G4QE::FSI:lastHadr 4M/M="<<lh4M<<lhM<<",GSM="<<lhGSM<<",PDG="<<lhPDG<<G4endl;
04857 #endif
04858 if(lhM>lhGSM+eps)
04859 {
04860 theQHadrons.pop_back();
04861 delete theLast;
04862 EvaporateResidual(curHadr);
04863 nHadr=theQHadrons.size();
04864 #ifdef debug
04865 G4cout<<"G4QE::FSI:After nH="<<nHadr<<",PDG="<<curHadr->GetPDGCode()<<G4endl;
04866 #endif
04867 }
04868 else if(lhM<lhGSM-eps)
04869 {
04870 theQHadrons.pop_back();
04871 delete theLast;
04872 G4Quasmon* quasH = new G4Quasmon(curHadr->GetQC(),lh4M);
04873 if(!CheckGroundState(quasH,true))
04874 {
04875 #ifdef debug
04876
04877 G4cout<<"---Warning---G4QEnv::FSI:Correction error LeaveAsItIs h4m="<<lh4M<<G4endl;
04878 #endif
04879 theQHadrons.push_back(curHadr);
04880
04881 }
04882 else
04883 {
04884 delete curHadr;
04885 nHadr=theQHadrons.size();
04886 }
04887 delete quasH;
04888 }
04889 else delete curHadr;
04890 }
04891 #ifdef debug
04892 G4LorentzVector ccs4M(0.,0.,0.,0.);
04893 #endif
04894
04895 G4int chContSum=0;
04896 G4int bnContSum=0;
04897 if(nHadr)for(unsigned ich=0; ich<nHadr; ich++) if(!(theQHadrons[ich]->GetNFragments()))
04898 {
04899 chContSum+=theQHadrons[ich]->GetCharge();
04900 bnContSum+=theQHadrons[ich]->GetBaryonNumber();
04901 }
04902 #ifdef chdebug
04903 if(chContSum!=totCharge || bnContSum!=totBaryoN)
04904 {
04905 G4cout<<"*::*G4QE::Fr:(6)tC="<<totCharge<<",C="<<chContSum<<",tB="<<totBaryoN
04906 <<",B="<<bnContSum<<",E="<<theEnvironment<<G4endl;
04907 if(nHadr) for(unsigned h=0; h<nHadr; h++)
04908 {
04909 G4QHadron* cH = theQHadrons[h];
04910 G4cout<<"*::*G4QE::HQ:h#"<<h<<",QC="<<cH->GetQC()<<",PDG="<<cH->GetPDGCode()<<G4endl;
04911 }
04912 if(nQuas) for(G4int q=0; q<nQuas; q++)
04913 {
04914 G4Quasmon* cQ = theQuasmons[q];
04915 G4cout<<"*::*G4QE::HQ:q#"<<q<<",C="<<cQ->GetCharge()<<",QCont="<<cQ->GetQC()<<G4endl;
04916 }
04917 }
04918 #endif
04919
04920 if(nHadr)for(unsigned ipo=0; ipo<theQHadrons.size(); ipo++)
04921 {
04922 unsigned jpo=ipo;
04923 nHadr=theQHadrons.size();
04924 lHadr=theQHadrons[nHadr-1]->GetBaryonNumber();
04925 G4QHadron* theCurr = theQHadrons[ipo];
04926 G4int hBN = theCurr->GetBaryonNumber();
04927 G4int sBN = theCurr->GetStrangeness();
04928 G4int cBN = theCurr->GetCharge();
04929 G4int hPDG = theCurr->GetPDGCode();
04930 G4LorentzVector h4Mom = theCurr->Get4Momentum();
04931 #ifdef debug
04932 G4int hNF = theCurr->GetNFragments();
04933 G4cout<<"G4QE::FSI:h#"<<ipo<<",PDG="<<hPDG<<h4Mom<<",mGS="<<G4QPDGCode(hPDG).GetMass()
04934 <<",F="<<hNF<<",nH="<<theQHadrons.size()<<G4endl;
04935 #endif
04936 if(hBN>lHadr && ipo+1<theQHadrons.size())
04937 {
04938 G4QHadron* curHadr = new G4QHadron(theCurr);
04939 G4QHadron* theLast = theQHadrons[theQHadrons.size()-1];
04940 G4QPDGCode lQP=theLast->GetQPDG();
04941 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
04942 else theCurr->SetQC(theLast->GetQC());
04943 theCurr->Set4Momentum(theLast->Get4Momentum());
04944 h4Mom = theCurr->Get4Momentum();
04945 hBN = theCurr->GetBaryonNumber();
04946 cBN = theCurr->GetCharge();
04947 sBN = theCurr->GetStrangeness();
04948 hPDG = theCurr->GetPDGCode();
04949 theQHadrons.pop_back();
04950 delete theLast;
04951 theQHadrons.push_back(curHadr);
04952 nHadr=theQHadrons.size();
04953 }
04954 if(hPDG==89002000||hPDG==89001001||hPDG==89000002)
04955 {
04956 #ifdef debug
04957 G4cout<<"G4QE::FSI:***ANTISTRANGE*** i="<<ipo<<",PDG="<<hPDG<<",BaryN="<<hBN<<G4endl;
04958 #endif
04959 G4double hM=h4Mom.m();
04960 G4double hMi=hM+eps;
04961 G4QPDGCode fQPDG = pQPDG;
04962 G4double fM = mProt;
04963 G4int sPDG = 321;
04964 G4double sM = mK;
04965 G4int tPDG = 0;
04966 G4double tM = 0.;
04967 if(hPDG==89002000)
04968 {
04969 if(hMi<mKmP)
04970 {
04971 if(hMi>mProt+mPi+mPi0)
04972 {
04973 sPDG=211;
04974 sM =mPi;
04975 tPDG=111;
04976 tM =mPi0;
04977 }
04978 else if(hMi>mProt+mPi)
04979 {
04980 #ifdef debug
04981 G4cout<<"**G4QE::FSI:ANTISTRANGE*++*STRANGENESS,PDG="<<hPDG<<",M="<<hM<<G4endl;
04982 #endif
04983 sPDG=211;
04984 sM =mPi;
04985 }
04986 else sPDG=0;
04987 }
04988 }
04989 else if(hPDG==89001001)
04990 {
04991 fQPDG= nQPDG;
04992 fM = mNeut;
04993 sPDG = 321;
04994 sM = mK;
04995 if(hMi>mK0mP&&G4UniformRand()>.5)
04996 {
04997 fQPDG= pQPDG;
04998 fM = mProt;
04999 sPDG = 311;
05000 sM = mK0;
05001 }
05002 else if(hMi<mKmN)
05003 {
05004 if(hMi>mProt+mPi0+mPi0)
05005 {
05006 fQPDG= pQPDG;
05007 fM = mProt;
05008 sPDG = 111;
05009 sM = mPi0;
05010 tPDG = 111;
05011 tM = mPi0;
05012 if(hMi>mNeut+mPi+mPi0&&G4UniformRand()>.67)
05013 {
05014 fQPDG= nQPDG;
05015 fM = mNeut;
05016 tPDG = 211;
05017 tM = mPi;
05018 }
05019 if(hMi>mProt+mPi+mPi&&G4UniformRand()>.5)
05020 {
05021 sPDG = 211;
05022 sM = mPi;
05023 tPDG =-211;
05024 tM = mPi;
05025 }
05026 }
05027 else if(hMi>mProt+mPi0)
05028 {
05029 #ifdef debug
05030 G4cout<<"**G4QE::FSI:*ANTISTRANGE*+*STRANGENESS*PDG="<<hPDG<<",M="<<hM<<G4endl;
05031 #endif
05032 fQPDG= pQPDG;
05033 fM = mProt;
05034 sPDG = 111;
05035 sM = mPi0;
05036 }
05037 else sPDG=0;
05038 }
05039 }
05040 else if(hPDG==89000002)
05041 {
05042 fQPDG= nQPDG;
05043 fM = mNeut;
05044 sPDG = 311;
05045 sM = mK0;
05046 if(hMi<mK0mN)
05047 {
05048 if(hMi>mNeut+mPi+mPi)
05049 {
05050 sPDG = 211;
05051 sM = mPi;
05052 tPDG =-211;
05053 tM = mPi;
05054 }
05055 if(hMi>mProt+mPi+mPi0)
05056 {
05057 fQPDG= pQPDG;
05058 fM = mProt;
05059 sPDG = 111;
05060 sM = mPi0;
05061 tPDG =-211;
05062 tM = mPi;
05063 }
05064 else if(hMi>mProt+mPi)
05065 {
05066 #ifdef debug
05067 G4cout<<"**G4QE::FSI:**ANTISTRANGE*0*STRANGENE**PDG="<<hPDG<<",M="<<hM<<G4endl;
05068 #endif
05069 fQPDG= pQPDG;
05070 fM = mProt;
05071 sPDG =-211;
05072 sM = mPi;
05073 }
05074 else sPDG=0;
05075 }
05076 }
05077 if(!sPDG)
05078 {
05079 #ifdef debug
05080 G4cout<<"***G4QE::FSI:***ANTISTRANGE***CANN'T DECAY,PDG="<<hPDG<<",M="<<hM<<G4endl;
05081 #endif
05082 }
05083 else if(!tPDG)
05084 {
05085 G4bool fOK=true;
05086 G4LorentzVector f4M(0.,0.,0.,fM);
05087 G4LorentzVector s4M(0.,0.,0.,sM);
05088 G4double sum=fM+sM;
05089 if(fabs(hM-sum)<=eps)
05090 {
05091 f4M=h4Mom*(fM/sum);
05092 s4M=h4Mom*(sM/sum);
05093 }
05094 else if(hM<sum || !G4QHadron(h4Mom).DecayIn2(f4M,s4M))
05095 {
05096 G4cout<<"---Warning---G4QE::FSI: Still try(2),M="<<hM<<"->"<<fM<<"("<<fQPDG<<")+"
05097 <<sM<<"("<<sPDG<<")="<<sum<<G4endl;
05098
05099
05100
05101 if(!theEnvironment.GetA())
05102 {
05103
05104 G4QHadron* theLast = theCurr;
05105 G4QHadron* qH = new G4QHadron(theCurr);
05106 if(ipo+1<theQHadrons.size())
05107 {
05108 theLast = theQHadrons[theQHadrons.size()-1];
05109 G4QPDGCode lQP=theLast->GetQPDG();
05110 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
05111 else theCurr->SetQC(theLast->GetQC());
05112 theCurr->Set4Momentum(theLast->Get4Momentum());
05113 }
05114 theQHadrons.pop_back();
05115 delete theLast;
05116 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
05117
05118 if(!CheckGroundState(quasH,true))
05119 {
05120 G4cout<<"---Warning---G4QEnv::FSI:Failed (2) LeaveAsItIs 4m="<<h4Mom<<G4endl;
05121 theQHadrons.push_back(qH);
05122 }
05123 else
05124 {
05125 delete qH;
05126
05127 jpo--;
05128
05129 nHadr=theQHadrons.size();
05130 }
05131
05132 delete quasH;
05133
05134 fOK=false;
05135 }
05136 else
05137 {
05138
05139
05140 G4ExceptionDescription ed;
05141 ed << "FSI:ANTISTRANGE DecayIn2 did not succeed: FSI: No recovery (1) Env="
05142 << theEnvironment << G4endl;
05143 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0000",
05144 FatalException, ed);
05145 }
05146 }
05147 if(fOK)
05148 {
05149 theQHadrons[ipo]->SetQPDG(fQPDG);
05150 theQHadrons[ipo]->Set4Momentum(f4M);
05151 G4QHadron* sH = new G4QHadron(sPDG,s4M);
05152 theQHadrons.push_back(sH);
05153 }
05154 }
05155 else
05156 {
05157 G4bool fOK=true;
05158 G4LorentzVector f4M(0.,0.,0.,fM);
05159 G4LorentzVector s4M(0.,0.,0.,sM);
05160 G4LorentzVector t4M(0.,0.,0.,tM);
05161 G4double sum=fM+sM+tM;
05162 if(fabs(hM-sum)<=eps)
05163 {
05164 f4M=h4Mom*(fM/sum);
05165 s4M=h4Mom*(sM/sum);
05166 t4M=h4Mom*(tM/sum);
05167 }
05168 else if(hM<sum || !G4QHadron(h4Mom).DecayIn3(f4M,s4M,t4M))
05169 {
05170 G4cout<<"---Warning---G4QE::FSI: Still try(3), M"<<hM<<"->"<<fM<<"("<<fQPDG<<")+"
05171 <<sM<<"("<<sPDG<<")+"<<tM<<"("<<tPDG<<")="<<sum<<G4endl;
05172
05173 if(!theEnvironment.GetA())
05174 {
05175 G4QHadron* theLast = theCurr;
05176 G4QHadron* qH = new G4QHadron(theCurr);
05177 if(ipo+1<theQHadrons.size())
05178 {
05179 theLast = theQHadrons[theQHadrons.size()-1];
05180 G4QPDGCode lQP=theLast->GetQPDG();
05181 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
05182 else theCurr->SetQC(theLast->GetQC());
05183 theCurr->Set4Momentum(theLast->Get4Momentum());
05184 }
05185 theQHadrons.pop_back();
05186 delete theLast;
05187 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
05188 if(!CheckGroundState(quasH,true))
05189 {
05190 G4cout<<"---Warning---G4QEnv::FSI:Failed (3) LeaveAsItIs,4M="<<h4Mom<<G4endl;
05191 theQHadrons.push_back(qH);
05192 }
05193 else
05194 {
05195 delete qH;
05196 jpo--;
05197 nHadr=theQHadrons.size();
05198 }
05199 delete quasH;
05200 fOK=false;
05201 }
05202 else
05203 {
05204
05205
05206 G4ExceptionDescription ed;
05207 ed << "ANTISTRANGE DecayIn3 did not succeed: No recovery (2) Env="
05208 << theEnvironment << G4endl;
05209 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0001",
05210 FatalException, ed);
05211 }
05212 }
05213 if(fOK)
05214 {
05215 theQHadrons[ipo]->SetQPDG(fQPDG);
05216 theQHadrons[ipo]->Set4Momentum(f4M);
05217 G4QHadron* sH = new G4QHadron(sPDG,s4M);
05218 theQHadrons.push_back(sH);
05219 G4QHadron* tH = new G4QHadron(tPDG,t4M);
05220 theQHadrons.push_back(tH);
05221 }
05222 }
05223 nHadr=theQHadrons.size();
05224 }
05225 else if(hPDG==89999003||hPDG==90002999||hPDG==90000003||hPDG==90003000||
05226 hPDG==90999002||hPDG==91001999)
05227 {
05228 #ifdef debug
05229 G4cout<<"G4QE::FSI:***nD-/pD++/nnn/ppp***i="<<ipo<<",PDG="<<hPDG<<",A="<<hBN<<G4endl;
05230 #endif
05231 G4double hM=h4Mom.m();
05232 G4QPDGCode nuQPDG=nQPDG;
05233 G4double nucM = mNeut;
05234 G4int barPDG = 2112;
05235 G4double barM = mNeut;
05236 G4int tPDG = -211;
05237 G4double tM = mPi;
05238 if(hPDG==90002999)
05239 {
05240 nuQPDG = pQPDG;
05241 nucM = mProt;
05242 barPDG = 2212;
05243 barM = mProt;
05244 tPDG = 211;
05245 }
05246 else if(hPDG==90003000)
05247 {
05248 nuQPDG = pQPDG;
05249 nucM = mProt;
05250 barPDG = 2212;
05251 barM = mProt;
05252 tPDG = 2212;
05253 tM = mProt;
05254 }
05255 else if(hPDG==90999002)
05256 {
05257 if(hM>mSigZ+mNeut+mPi)
05258 {
05259 G4double ddMass=hM-mPi;
05260 G4double dd2=ddMass*ddMass;
05261 G4double sma=mLamb+mNeut;
05262 G4double pr1=0.;
05263 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
05264 sma=mNeut+mSigZ;
05265 G4double smi=mSigZ-mNeut;
05266 G4double pr2=pr1;
05267 if(ddMass>sma && ddMass>smi) pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
05268 if(pr2*G4UniformRand()>pr1)
05269 {
05270 barPDG = 3212;
05271 barM = mSigZ;
05272 }
05273 else
05274 {
05275 barPDG = 3122;
05276 barM = mLamb;
05277 }
05278 }
05279 else if(hM>mLamb+mNeut+mPi)
05280 {
05281 barPDG = 3122;
05282 barM = mLamb;
05283 }
05284 else if(hM>mSigM+mNeut)
05285 {
05286 barPDG = 3112;
05287 barM = mSigM;
05288 tPDG = 22;
05289 tM = 0;
05290 }
05291 }
05292 else if(hPDG==91001999)
05293 {
05294 nuQPDG = pQPDG;
05295 nucM = mProt;
05296 tPDG = 211;
05297 if(hM>mSigZ+mProt+mPi)
05298 {
05299 G4double ddMass=hM-mPi;
05300 G4double dd2=ddMass*ddMass;
05301 G4double sma=mLamb+mProt;
05302 G4double pr1=0.;
05303 if(ddMass>sma) pr1=sqrt((dd2-sma*sma)*dd2);
05304 sma=mProt+mSigZ;
05305 G4double smi=mSigZ-mProt;
05306 G4double pr2=pr1;
05307 if(ddMass>sma && ddMass>smi) pr2+=sqrt((dd2-sma*sma)*(dd2-smi*smi));
05308 if(pr2*G4UniformRand()>pr1)
05309 {
05310 barPDG = 3212;
05311 barM = mSigZ;
05312 }
05313 else
05314 {
05315 barPDG = 3122;
05316 barM = mLamb;
05317 }
05318 }
05319 if(hM>mLamb+mProt+mPi)
05320 {
05321 barPDG = 3122;
05322 barM = mLamb;
05323 }
05324 else if(hM>mSigP+mProt)
05325 {
05326 barPDG = 3222;
05327 barM = mSigP;
05328 tPDG = 22;
05329 tM = 0;
05330 }
05331 }
05332 else if(hPDG==90000003)
05333 {
05334 tPDG = 2112;
05335 tM = mNeut;
05336 }
05337 G4bool fOK=true;
05338 G4LorentzVector nu4M(0.,0.,0.,nucM);
05339 G4LorentzVector ba4M(0.,0.,0.,barM);
05340 G4LorentzVector pi4M(0.,0.,0.,tM);
05341 G4double sum=nucM+barM+tM;
05342 if(fabs(hM-sum)<=eps)
05343 {
05344 nu4M=h4Mom*(nucM/sum);
05345 ba4M=h4Mom*(barM/sum);
05346 pi4M=h4Mom*(tM/sum);
05347 }
05348 if(hM<sum || !G4QHadron(h4Mom).DecayIn3(nu4M,ba4M,pi4M))
05349 {
05350 #ifdef debug
05351 G4int eA=theEnvironment.GetA();
05352 G4cout<<"***G4QEnv::FSI:T="<<hPDG<<"("<<hM<<")-> N="<<nuQPDG<<"(M="<<nucM<<") + B="
05353 <<barPDG<<"("<<barM<<")+N/pi="<<tPDG<<"("<<tM<<")="<<sum<<", A="<<eA<<G4endl;
05354 #endif
05355
05356
05357 G4QHadron* theLast = theCurr;
05358 G4QHadron* qH = new G4QHadron(theCurr);
05359 #ifdef debug
05360 G4cout<<"***G4QE::FSI:#"<<ipo<<",4MQC="<<qH->Get4Momentum()<<qH->GetQC()<<G4endl;
05361 #endif
05362 if(ipo+1<theQHadrons.size())
05363 {
05364 G4int nhd1=theQHadrons.size()-1;
05365 theLast = theQHadrons[nhd1];
05366 G4LorentzVector l4M=theLast->Get4Momentum();
05367 G4QPDGCode lQP=theLast->GetQPDG();
05368 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
05369 else theCurr->SetQC(theLast->GetQC());
05370 #ifdef debug
05371 G4cout<<"---Warning---G4QE::FSI:l#"<<nhd1<<",4M="<<l4M<<",PDG="<<lQP<<G4endl;
05372 #endif
05373 theCurr->Set4Momentum(theLast->Get4Momentum());
05374 }
05375 theQHadrons.pop_back();
05376 delete theLast;
05377 G4QContent cqQC=qH->GetQC();
05378 G4LorentzVector tqLV=qH->Get4Momentum();
05379 G4Quasmon* quasH = new G4Quasmon(cqQC,tqLV);
05380 if(!CheckGroundState(quasH,true))
05381 {
05382 #ifdef chdebug
05383 G4cout<<":W:G4QE::FSI:E="<<theEnvironment<<",Q="<<cqQC<<tqLV<<tqLV.m()<<G4endl;
05384 #endif
05385 theQHadrons.push_back(qH);
05386 }
05387 else
05388 {
05389 delete qH;
05390 jpo--;
05391 nHadr=theQHadrons.size();
05392 }
05393 delete quasH;
05394 fOK=false;
05395
05396
05397
05398
05399
05400
05401 }
05402 if(fOK)
05403 {
05404 theQHadrons[ipo]->SetQPDG(nuQPDG);
05405 theQHadrons[ipo]->Set4Momentum(nu4M);
05406 G4QHadron* baH = new G4QHadron(barPDG,ba4M);
05407 theQHadrons.push_back(baH);
05408 G4QHadron* piH = new G4QHadron(tPDG,pi4M);
05409 theQHadrons.push_back(piH);
05410 nHadr=theQHadrons.size();
05411 }
05412 }
05413 else if(hBN>1 && !sBN && (cBN<0 || cBN>hBN))
05414 {
05415 #ifdef debug
05416 G4cout<<"G4QE::FSI:nNmD-/nPmD++ #"<<ipo<<",P="<<hPDG<<",B="<<hBN<<",C="<<cBN<<G4endl;
05417 #endif
05418 G4double hM=h4Mom.m();
05419 G4QPDGCode nuQPDG=nQPDG;
05420 G4double nucM = mNeut;
05421 G4int barPDG = 2112;
05422 G4double barM = mNeut;
05423 G4int nN = hBN-1;
05424 G4int tPDG = -211;
05425 G4double tM = mPi;
05426 G4int nPi = -cBN;
05427 if( cBN>hBN)
05428 {
05429 nuQPDG = pQPDG;
05430 nucM = mProt;
05431 barPDG = 2212;
05432 barM = mProt;
05433 tPDG = 211;
05434 nPi = cBN-hBN;
05435 }
05436 if(nPi>1) tM*=nPi;
05437 if(nN >1) barM*=nN;
05438 G4bool fOK=true;
05439 G4LorentzVector nu4M(0.,0.,0.,nucM);
05440 G4LorentzVector ba4M(0.,0.,0.,barM);
05441 G4LorentzVector pi4M(0.,0.,0.,tM);
05442 G4double sum=nucM+barM+tM;
05443 if(fabs(hM-sum)<=eps)
05444 {
05445 nu4M=h4Mom*(nucM/sum);
05446 ba4M=h4Mom*(barM/sum);
05447 pi4M=h4Mom*(tM/sum);
05448 }
05449 if(hM<sum || !G4QHadron(h4Mom).DecayIn3(nu4M,ba4M,pi4M))
05450 {
05451 #ifdef debug
05452 G4cout<<"***G4QEnv::FSI:IsN M="<<hM<<","<<hPDG<<"->N="<<nuQPDG<<"(M="<<nucM<<")+"
05453 <<nN<<"*B="<<barPDG<<"(M="<<barM<<")+"<<nPi<<"*pi="<<tPDG<<"(M="<<tM<<")="
05454 <<nucM+barM+tM<<G4endl;
05455 G4cout<<"***G4QEnv::FSI:IsN BaryN="<<hBN<<",Charge="<<cBN<<",Stran="<<sBN<<G4endl;
05456 #endif
05457 if(!theEnvironment.GetA())
05458 {
05459 G4QHadron* theLast = theCurr;
05460 G4QHadron* qH = new G4QHadron(theCurr);
05461 if(ipo+1<theQHadrons.size())
05462 {
05463 theLast = theQHadrons[theQHadrons.size()-1];
05464 G4QPDGCode lQP=theLast->GetQPDG();
05465 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
05466 else theCurr->SetQC(theLast->GetQC());
05467 theCurr->Set4Momentum(theLast->Get4Momentum());
05468 }
05469 theQHadrons.pop_back();
05470 delete theLast;
05471 G4QContent cqQC=qH->GetQC();
05472 G4LorentzVector cq4M=qH->Get4Momentum();
05473 G4Quasmon* quasH = new G4Quasmon(cqQC,cq4M);
05474 if(!CheckGroundState(quasH,true))
05475 {
05476 G4cout<<"---Warning---G4QEnv::FSI:IN Failed, FillAsItIs: "<<cqQC<<cq4M<<G4endl;
05477 theQHadrons.push_back(qH);
05478 }
05479 else
05480 {
05481 delete qH;
05482 jpo--;
05483 nHadr=theQHadrons.size();
05484 }
05485 delete quasH;
05486 fOK=false;
05487 }
05488 else
05489 {
05490 G4ExceptionDescription ed;
05491 ed << "IN Multy ISO-dibaryon DecayIn3 did not succeed: IN,NoRec(4) Env="
05492 << theEnvironment << ",PDG=" << hPDG << G4endl;
05493 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0002",
05494 FatalException, ed);
05495 }
05496 }
05497 if(fOK)
05498 {
05499 theQHadrons[ipo]->SetQPDG(nuQPDG);
05500 theQHadrons[ipo]->Set4Momentum(nu4M);
05501 if(nN>1) ba4M=ba4M/nN;
05502 for(G4int ib=0; ib<nN; ib++)
05503 {
05504 G4QHadron* baH = new G4QHadron(barPDG,ba4M);
05505 theQHadrons.push_back(baH);
05506 }
05507 if(nPi>1) pi4M=pi4M/nPi;
05508 for(G4int im=0; im<nPi; im++)
05509 {
05510 G4QHadron* piH = new G4QHadron(tPDG,pi4M);
05511 theQHadrons.push_back(piH);
05512 }
05513 nHadr=theQHadrons.size();
05514 }
05515 }
05516 #ifdef debug
05517 G4int hNFrag= theQHadrons[ipo]->GetNFragments();
05518 G4QContent hQC = theQHadrons[ipo]->GetQC();
05519 hPDG = theQHadrons[ipo]->GetPDGCode();
05520 h4Mom = theQHadrons[ipo]->Get4Momentum();
05521 ccs4M+=h4Mom;
05522 G4cout<<"G4QE::FSI:#"<<ipo<<": h="<<hPDG<<hQC<<",h4M="<<h4Mom<<h4Mom.m()<<",hNF="
05523 <<hNFrag<<G4endl;
05524 #endif
05525 ipo=jpo;
05526 }
05527 #ifdef debug
05528 G4cout<<"G4QE::FSI: --->>CurrentControlSumOf4MomOfHadrons="<<ccs4M<<G4endl;
05529 #endif
05530 nHadr=theQHadrons.size();
05531 #ifdef chdebug
05532
05533 G4int ccContSum=0;
05534 G4int cbContSum=0;
05535 if(nHadr)for(unsigned ic1=0; ic1<nHadr; ic1++) if(!(theQHadrons[ic1]->GetNFragments()))
05536 {
05537 ccContSum+=theQHadrons[ic1]->GetCharge();
05538 cbContSum+=theQHadrons[ic1]->GetBaryonNumber();
05539 }
05540 if(ccContSum-chContSum || cbContSum-bnContSum)
05541 {
05542 G4cout<<"*::*G4QE::FSI:(7)dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
05543 <<G4endl;
05544
05545 }
05546
05547 #endif
05548 G4double p2cut=250000.;
05549 if(envA>0) p2cut/=envA*envA;
05550
05551
05552 G4int bfCountM=3;
05553 if(envA>10) bfCountM*=(envA-1)/3;
05554 G4bool bfAct = true;
05555 G4int bfCount= 0;
05556 G4LorentzVector tmp4Mom=tot4Mom;
05557 G4LorentzVector postp4M(0.,0.,0.,0.);
05558 G4int nPost=intQHadrons.size();
05559 if(nPost) for(G4int psp=0; psp<nPost; psp++)
05560 if(!(intQHadrons[psp]->GetNFragments())) postp4M+=intQHadrons[psp]->Get4Momentum();
05561 while(bfAct&&bfCount<bfCountM)
05562 {
05563 tot4Mom=tmp4Mom-postp4M;
05564 bfAct=false;
05565 bfCount++;
05566 nHadr=theQHadrons.size();
05567 if(nHadr) for(unsigned hadron=0; hadron<theQHadrons.size(); hadron++)
05568 {
05569 G4QHadron* curHadr = theQHadrons[hadron];
05570 G4int hPDG = curHadr->GetPDGCode();
05571 G4QPDGCode hQPDG(hPDG);
05572 G4double hGSM = hQPDG.GetMass();
05573 #ifdef debug
05574 G4cout<<"G4QE::FSI:LOOP START,h#"<<hadron<<curHadr->Get4Momentum()<<hPDG<<G4endl;
05575 #endif
05576 if(hPDG==89999003||hPDG==90002999)
05577 {
05578 G4cout<<"---WARNING---G4QE::FSI:**nD-/pD++**(3),PDG="<<hPDG<<" CORRECTION"<<G4endl;
05579 G4LorentzVector h4Mom=curHadr->Get4Momentum();
05580 G4double hM=h4Mom.m();
05581 G4QPDGCode fQPDG=nQPDG;
05582 G4double fM =mNeut;
05583 G4int sPDG =2112;
05584 G4double sM =mNeut;
05585 G4int tPDG =-211;
05586 G4double tM =mPi;
05587 if(hPDG==90002999)
05588 {
05589 fQPDG=pQPDG;
05590 fM =mProt;
05591 sPDG =2212;
05592 sM =mProt;
05593 tPDG =211;
05594 }
05595 G4bool fOK=true;
05596 G4LorentzVector f4M(0.,0.,0.,fM);
05597 G4LorentzVector s4M(0.,0.,0.,sM);
05598 G4LorentzVector t4M(0.,0.,0.,tM);
05599 G4double sum=fM+sM+tM;
05600 if(fabs(hM-sum)<=eps)
05601 {
05602 f4M=h4Mom*(fM/sum);
05603 s4M=h4Mom*(sM/sum);
05604 t4M=h4Mom*(tM/sum);
05605 }
05606 else if(hM<sum || !G4QHadron(h4Mom).DecayIn3(f4M,s4M,t4M))
05607 {
05608 G4cout<<"---WARNING---G4QE::FSI: Still trying, NDM="<<hM<<"->"<<fM<<"("<<fQPDG
05609 <<")+"<<sM<<"("<<sPDG<<")+"<<tM<<"("<<tPDG<<")="<<sum<<G4endl;
05610 if(!theEnvironment.GetA())
05611 {
05612 G4QHadron* theLast = curHadr;
05613 G4QHadron* qH = new G4QHadron(curHadr);
05614 if(hadron+1<theQHadrons.size())
05615 {
05616 theLast = theQHadrons[theQHadrons.size()-1];
05617 G4QPDGCode lQP=theLast->GetQPDG();
05618 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
05619 else curHadr->SetQC(theLast->GetQC());
05620 curHadr->Set4Momentum(theLast->Get4Momentum());
05621 }
05622 theQHadrons.pop_back();
05623 delete theLast;
05624 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
05625 if(!CheckGroundState(quasH,true))
05626 {
05627 G4cout<<"---Warning---G4QE::FSI:NDel Failed LeaveAsItIs, 4m="<<h4Mom<<G4endl;
05628 theQHadrons.push_back(qH);
05629 }
05630 else
05631 {
05632 delete qH;
05633 nHadr=theQHadrons.size();
05634 }
05635 delete quasH;
05636 fOK=false;
05637 }
05638 else
05639 {
05640
05641
05642 G4ExceptionDescription ed;
05643 ed << "ND DecayIn3 did not succeed: No ND recovery Env="
05644 << theEnvironment << G4endl;
05645 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0003",
05646 FatalException, ed);
05647 }
05648 }
05649 if(fOK)
05650 {
05651 curHadr->SetQPDG(fQPDG);
05652 curHadr->Set4Momentum(f4M);
05653 G4QHadron* sH = new G4QHadron(sPDG,s4M);
05654 theQHadrons.push_back(sH);
05655 G4QHadron* tH = new G4QHadron(tPDG,t4M);
05656 theQHadrons.push_back(tH);
05657 }
05658 hPDG = curHadr->GetPDGCode();
05659 hQPDG= G4QPDGCode(hPDG);
05660 hGSM = hQPDG.GetMass();
05661 }
05662 nHadr=theQHadrons.size();
05663 if(hPDG==89001001||hPDG==89002000||hPDG==89000002)
05664 {
05665 G4cout<<"---WARNING---G4QE::FSI:***(K+N)*** (2),PDG="<<hPDG<<" CORRECTION"<<G4endl;
05666 G4LorentzVector h4Mom=curHadr->Get4Momentum();
05667 G4double hM=h4Mom.m();
05668 G4QPDGCode fQPDG=nQPDG;
05669 G4double fM =mNeut;
05670 G4int sPDG =311;
05671 G4double sM =mK0;
05672 if(hPDG==89000002)
05673 {
05674 fQPDG=pQPDG;
05675 fM =mProt;
05676 sPDG =321;
05677 sM =mK;
05678 }
05679 if(hPDG==89001001)
05680 {
05681 if(hM<mK0+mProt || G4UniformRand()>.5)
05682 {
05683 sPDG =321;
05684 sM =mK;
05685 }
05686 else
05687 {
05688 fQPDG=pQPDG;
05689 fM =mProt;
05690 }
05691 }
05692 G4bool fOK=true;
05693 G4LorentzVector f4M(0.,0.,0.,fM);
05694 G4LorentzVector s4M(0.,0.,0.,sM);
05695 G4double sum=fM+sM;
05696 if(fabs(hM-sum)<=eps)
05697 {
05698 f4M=h4Mom*(fM/sum);
05699 s4M=h4Mom*(sM/sum);
05700 }
05701 else if(hM<sum || !G4QHadron(h4Mom).DecayIn2(f4M,s4M))
05702 {
05703 G4cout<<"---WARNING---G4QE::FSI: Still trying (2),NDM="<<hM<<"->"<<fM<<"("<<fQPDG
05704 <<")+"<<sM<<"("<<sPDG<<")="<<sum<<G4endl;
05705 if(!theEnvironment.GetA())
05706 {
05707 G4QHadron* theLast = curHadr;
05708 G4QHadron* qH = new G4QHadron(curHadr);
05709 if(hadron+1<theQHadrons.size())
05710 {
05711 theLast = theQHadrons[theQHadrons.size()-1];
05712 G4QPDGCode lQP=theLast->GetQPDG();
05713 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
05714 else curHadr->SetQC(theLast->GetQC());
05715 curHadr->Set4Momentum(theLast->Get4Momentum());
05716 }
05717 theQHadrons.pop_back();
05718 delete theLast;
05719 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
05720 if(!CheckGroundState(quasH,true))
05721 {
05722 G4cout<<"---Warning---G4QE::FSI:KN Failed LeaveAsItIs 4m="<<h4Mom<<G4endl;
05723 theQHadrons.push_back(qH);
05724 }
05725 else
05726 {
05727 delete qH;
05728 nHadr=theQHadrons.size();
05729 }
05730 delete quasH;
05731 fOK=false;
05732 }
05733 else
05734 {
05735
05736
05737 G4ExceptionDescription ed;
05738 ed << "KN DecayIn2 did not succeed: No KN recovery Env="
05739 << theEnvironment << G4endl;
05740 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0004",
05741 FatalException, ed);
05742 }
05743 }
05744 if(fOK)
05745 {
05746 curHadr->SetQPDG(fQPDG);
05747 curHadr->Set4Momentum(f4M);
05748 G4QHadron* sH = new G4QHadron(sPDG,s4M);
05749 theQHadrons.push_back(sH);
05750 }
05751 hPDG = curHadr->GetPDGCode();
05752 hQPDG= G4QPDGCode(hPDG);
05753 hGSM = hQPDG.GetMass();
05754 }
05755 nHadr=theQHadrons.size();
05756 G4int hS = curHadr->GetStrangeness();
05757 G4int hF = curHadr->GetNFragments();
05758 G4LorentzVector h4m= curHadr->Get4Momentum();
05759 G4double hM = h4m.m();
05760 G4int hB = curHadr->GetBaryonNumber();
05762 #ifdef debug
05763 if(!hF && ( (hPDG>80000000 && hPDG<90000000) || hPDG==90000000 ||
05764 (hPDG>90000000 && (hPDG%1000000>200000 || hPDG%1000>300) ) ) )
05765 G4cout<<"**G4QEnv::FSInteraction: PDG("<<hadron<<")="<<hPDG<<", M="<<hM<<G4endl;
05766 #endif
05767 #ifdef debug
05768 G4cout<<"G4QE::FSI:h="<<hPDG<<",S="<<hS<<",B="<<hB<<",#"<<hadron<<"<"<<nHadr<<G4endl;
05769 #endif
05770
05771
05772 if(hadron&&!hF&&hB>0&&!hS)
05773
05774
05775
05776 {
05777 #ifdef debug
05778
05779 G4cout<<"G4QE::FSI: h="<<hPDG<<",B="<<hB<<",h#"<<hadron<<" < nH="<<nHadr<<G4endl;
05780 #endif
05781 G4QContent hQC = curHadr->GetQC();
05782 if(hadron&&!hF&&hB>0) for(unsigned pt=0; pt<hadron; pt++)
05783 {
05784 G4QHadron* backH = theQHadrons[pt];
05785 G4int bF = backH->GetNFragments();
05786 G4LorentzVector b4m= backH->Get4Momentum();
05787 G4double bM= b4m.m();
05788 G4QContent bQC = backH->GetQC();
05789 G4int bPDG=bQC.GetZNSPDGCode();
05790 G4QPDGCode bQPDG(bPDG);
05791 G4double bGSM=bQPDG.GetMass();
05792 G4int bB = backH->GetBaryonNumber();
05793
05795 G4QContent sQC=bQC+hQC;
05796 G4int sPDG=sQC.GetZNSPDGCode();
05797 G4QPDGCode sQPDG(sPDG);
05798 G4double tM=sQPDG.GetMass();
05799 G4LorentzVector s4M=h4m+b4m;
05800 G4double sM2=s4M.m2();
05801 G4double sM=sqrt(sM2);
05802 G4double dsM2=sM2+sM2;
05803 G4double rm=bM-hM;
05804 G4double sm=bM+hM;
05805 G4double pCM2=(sM2-rm*rm)*(sM2-sm*sm)/(dsM2+dsM2);
05806 G4int bS = backH->GetStrangeness();
05807 #ifdef debug
05808
05809 G4cout<<"G4QE::FSI:"<<pt<<",B="<<bB<<",S="<<bS<<",p="<<pCM2<<"<"<<p2cut<<",hB="
05810 <<hB<<",bM+hM="<<bM+hM<<">tM="<<tM<<",tQC="<<sQC<<G4endl;
05811 #endif
05812
05813
05814
05815
05816
05817
05818 if(!bF&&!bS&&bB>0&&bM+hM>tM+.001&&pCM2<p2cut)
05819
05820
05821
05822
05823
05824 {
05825 #ifdef fdebug
05826 G4int bPDG = backH->GetPDGCode();
05827 if(sPDG==89999003||sPDG==90002999||sPDG==89999002||sPDG==90001999)
05828 G4cout<<"G4QE::FSI:**nD-/pD++**,h="<<hPDG<<",hB="<<hB<<",b="<<bPDG<<",bB="
05829 <<bB<<G4endl;
05830
05831 G4cout<<"G4QE::FSI:*FUSION*#"<<hadron<<"["<<hPDG<<"]"<<hM<<"+#"<<pt<<"["<<bPDG
05832 <<"]"<<bM<<"="<<bM+hM<<", sM="<<sM<<">["<<sPDG<<"]"<<tM<<",p2="<<pCM2
05833 <<"<"<<p2cut<<G4endl;
05834 #endif
05835 bfAct=true;
05836
05837 G4bool three=false;
05838 G4QPDGCode fQPDG=sQPDG;
05839 G4QPDGCode rQPDG=gQPDG;
05840 hQPDG=gQPDG;
05841 G4LorentzVector f4Mom(0.,0.,0.,tM);
05842 G4LorentzVector g4Mom(0.,0.,0.,0.);
05843 G4LorentzVector t4Mom(0.,0.,0.,0.);
05844 if(sPDG==89999002)
05845 {
05846 fQPDG=nQPDG;
05847 rQPDG=pimQPDG;
05848 f4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05849 g4Mom=G4LorentzVector(0.,0.,0.,mPi);
05850 }
05851 else if(sPDG==90001999)
05852 {
05853 fQPDG=pQPDG;
05854 rQPDG=pipQPDG;
05855 f4Mom=G4LorentzVector(0.,0.,0.,mProt);
05856 g4Mom=G4LorentzVector(0.,0.,0.,mPi);
05857 }
05858 else if(sPDG==90000002)
05859 {
05860 fQPDG=nQPDG;
05861 rQPDG=nQPDG;
05862 f4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05863 g4Mom=f4Mom;
05864 }
05865 else if(sPDG==90002000)
05866 {
05867 fQPDG=pQPDG;
05868 rQPDG=pQPDG;
05869 f4Mom=G4LorentzVector(0.,0.,0.,mProt);
05870 g4Mom=f4Mom;
05871 }
05872 else if(sPDG==92000000)
05873 {
05874 fQPDG=lQPDG;
05875 rQPDG=lQPDG;
05876 f4Mom=G4LorentzVector(0.,0.,0.,mLamb);
05877 g4Mom=f4Mom;
05878 if(sM>mSigZ+mSigZ)
05879 {
05880 G4double sma=mLamb+mLamb;
05881 G4double pr1=0.;
05882 if(sM>sma) pr1=sqrt((sM2-sma*sma)*sM2);
05883 sma=mLamb+mSigZ;
05884 G4double smi=mSigZ-mLamb;
05885 G4double pr2=pr1;
05886 if(sM>sma && sM>smi) pr2+=sqrt((sM2-sma*sma)*(sM2-smi*smi));
05887 sma=mSigZ+mSigZ;
05888 G4double pr3=pr2;
05889 if(sM>sma) pr3+=sqrt((sM2-sma*sma)*sM2);
05890 G4double hhRND=pr3*G4UniformRand();
05891 if(hhRND>pr2)
05892 {
05893 fQPDG=s0QPDG;
05894 f4Mom=G4LorentzVector(0.,0.,0.,mSigZ);
05895 rQPDG=s0QPDG;
05896 g4Mom=f4Mom;
05897 }
05898 else if(hhRND>pr1)
05899 {
05900 fQPDG=s0QPDG;
05901 f4Mom=G4LorentzVector(0.,0.,0.,mSigZ);
05902 }
05903 }
05904 else if(sM>mSigZ+mLamb)
05905 {
05906 G4double sma=mLamb+mLamb;
05907 G4double pr1=0.;
05908 if(sM>sma) pr1=sqrt((sM2-sma*sma)*sM2);
05909 sma=mLamb+mSigZ;
05910 G4double smi=mSigZ-mLamb;
05911 G4double pr2=pr1;
05912 if(sM>sma && sM>smi) pr2+=sqrt((sM2-sma*sma)*(sM2-smi*smi));
05913 if(pr2*G4UniformRand()>pr1)
05914 {
05915 fQPDG=s0QPDG;
05916 f4Mom=G4LorentzVector(0.,0.,0.,mSigZ);
05917 }
05918 }
05919 }
05920 else if(sPDG==89999003)
05921 {
05922 hQPDG=nQPDG;
05923 rQPDG=nQPDG;
05924 fQPDG=pimQPDG;
05925 t4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05926 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05927 f4Mom=G4LorentzVector(0.,0.,0.,mPi);
05928 three=true;
05929 }
05930 else if(sPDG==90002999)
05931 {
05932 hQPDG=pQPDG;
05933 rQPDG=pQPDG;
05934 fQPDG=pipQPDG;
05935 t4Mom=G4LorentzVector(0.,0.,0.,mProt);
05936 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
05937 f4Mom=G4LorentzVector(0.,0.,0.,mPi);
05938 three=true;
05939 }
05940 else if(sPDG==90000003)
05941 {
05942 hQPDG=nQPDG;
05943 rQPDG=nQPDG;
05944 fQPDG=nQPDG;
05945 t4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05946 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05947 f4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05948 three=true;
05949 }
05950 else if(sPDG==90003000)
05951 {
05952 hQPDG=pQPDG;
05953 rQPDG=pQPDG;
05954 fQPDG=pQPDG;
05955 t4Mom=G4LorentzVector(0.,0.,0.,mProt);
05956 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
05957 f4Mom=G4LorentzVector(0.,0.,0.,mProt);
05958 three=true;
05959 }
05960 else if(sPDG==90001003)
05961 {
05962 rQPDG=nQPDG;
05963 fQPDG=tQPDG;
05964 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05965 f4Mom=G4LorentzVector(0.,0.,0.,mTrit);
05966 }
05967 else if(sPDG==90003001)
05968 {
05969 rQPDG=pQPDG;
05970 fQPDG=he3QPDG;
05971 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
05972 f4Mom=G4LorentzVector(0.,0.,0.,mHe3);
05973 }
05974 else if(sPDG==90002003)
05975 {
05976 rQPDG=nQPDG;
05977 fQPDG=aQPDG;
05978 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
05979 f4Mom=G4LorentzVector(0.,0.,0.,mAlph);
05980 }
05981 else if(sPDG==90003002)
05982 {
05983 rQPDG=pQPDG;
05984 fQPDG=aQPDG;
05985 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
05986 f4Mom=G4LorentzVector(0.,0.,0.,mAlph);
05987 }
05988 else if(sPDG==90004002)
05989 {
05990 hQPDG=pQPDG;
05991 rQPDG=pQPDG;
05992 fQPDG=aQPDG;
05993 t4Mom=G4LorentzVector(0.,0.,0.,mProt);
05994 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
05995 f4Mom=G4LorentzVector(0.,0.,0.,mAlph);
05996 three=true;
05997 }
05998 else if(sPDG==90002005)
05999 {
06000 rQPDG=nQPDG;
06001 fQPDG=a6QPDG;
06002 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
06003 f4Mom=G4LorentzVector(0.,0.,0.,mHe6);
06004 }
06005 else if(sPDG==90005002)
06006 {
06007 rQPDG=pQPDG;
06008 fQPDG=be6QPDG;
06009 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06010 f4Mom=G4LorentzVector(0.,0.,0.,mBe6);
06011 }
06012 else if(sPDG==90004004)
06013 {
06014 fQPDG=aQPDG;
06015 rQPDG=aQPDG;
06016 f4Mom=G4LorentzVector(0.,0.,0.,mAlph);
06017 g4Mom=f4Mom;
06018 }
06019
06020
06021
06022
06023
06024
06025
06026
06027
06028
06029
06030
06031
06032
06033
06034
06035
06036
06037
06038
06039 else if(sPDG==90002007)
06040 {
06041 rQPDG=nQPDG;
06042 fQPDG=a8QPDG;
06043 g4Mom=G4LorentzVector(0.,0.,0.,mNeut);
06044 f4Mom=G4LorentzVector(0.,0.,0.,mHe8);
06045 }
06046 else if(sPDG==90005004)
06047 {
06048 rQPDG=pQPDG;
06049 fQPDG=aQPDG;
06050 hQPDG=aQPDG;
06051 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06052 f4Mom=G4LorentzVector(0.,0.,0.,mAlph);
06053 t4Mom=G4LorentzVector(0.,0.,0.,mAlph);
06054 three=true;
06055 }
06056 else if(sPDG==90007002)
06057 {
06058 rQPDG=pQPDG;
06059 fQPDG=c8QPDG;
06060 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06061 f4Mom=G4LorentzVector(0.,0.,0.,mC8);
06062 }
06063 else if(sPDG==90008004)
06064 {
06065 hQPDG=pQPDG;
06066 rQPDG=pQPDG;
06067 fQPDG=c10QPDG;
06068 t4Mom=G4LorentzVector(0.,0.,0.,mProt);
06069 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06070 f4Mom=G4LorentzVector(0.,0.,0.,mC10);
06071 three=true;
06072 }
06073 else if(sPDG==90009006)
06074 {
06075 rQPDG=pQPDG;
06076 fQPDG=o14QPDG;
06077 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06078 f4Mom=G4LorentzVector(0.,0.,0.,mO14);
06079 }
06080 else if(sPDG==90009007)
06081 {
06082 rQPDG=pQPDG;
06083 fQPDG=o15QPDG;
06084 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06085 f4Mom=G4LorentzVector(0.,0.,0.,mO15);
06086 }
06087 else if(sPDG==90010006)
06088 {
06089 hQPDG=pQPDG;
06090 rQPDG=pQPDG;
06091 fQPDG=o14QPDG;
06092 t4Mom=G4LorentzVector(0.,0.,0.,mProt);
06093 g4Mom=G4LorentzVector(0.,0.,0.,mProt);
06094 f4Mom=G4LorentzVector(0.,0.,0.,mO14);
06095 three=true;
06096 }
06097 #ifdef debug
06098 G4cout<<"G4QE::FSI: "<<three<<",r="<<rQPDG<<",f="<<fQPDG<<",t="<<hQPDG<<G4endl;
06099 #endif
06100 if(!three)
06101 {
06102 if(!G4QHadron(s4M).DecayIn2(f4Mom,g4Mom))
06103 {
06104 G4ExceptionDescription ed;
06105 ed << "Fusion (1) DecIn2 error: (2)*FUSION*,tM[" << sPDG << "]="
06106 << tM << ">sM=" << sM << " of " << h4m << hM << hQC << hGSM
06107 << " & " << b4m << bM << bQC << bGSM << G4endl;
06108 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0005",
06109 FatalException, ed);
06110 }
06111 else
06112 {
06113 #ifdef debug
06114 G4cout<<"G4QE::FSI:*FUSION IS DONE*,fPDG="<<sPDG<<",PDG1="<<hPDG<<",PDG2="
06115 <<bPDG<<G4endl;
06116 #endif
06117 curHadr->SetQPDG(fQPDG);
06118 curHadr->Set4Momentum(f4Mom);
06119 backH->SetQPDG(rQPDG);
06120 backH->Set4Momentum(g4Mom);
06121 #ifdef debug
06122 G4cout<<"G4QE::FSI:h="<<h4m<<",b="<<b4m<<",s="<<s4M<<G4endl;
06123 G4cout<<"G4QE::FSI:f="<<f4Mom<<",g="<<g4Mom<<",s="<<f4Mom+g4Mom<<G4endl;
06124 #endif
06125 }
06126 }
06127 else
06128 {
06129 if(!G4QHadron(s4M).DecayIn3(f4Mom,g4Mom,t4Mom))
06130 {
06131 G4ExceptionDescription ed;
06132 ed << "Fusion(2) DecayIn3 error: (3)*FUSION*,tM[" << sPDG
06133 << "]=" << tM << ">sM=" << sM << " of " << h4m << hM << hQC
06134 << hGSM << " & " << b4m << bM << bQC << bGSM << G4endl;
06135 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0006",
06136 FatalException, ed);
06137 }
06138 else
06139 {
06140 #ifdef debug
06141 G4cout<<"G4QE::FSI:DONE,n="<<nHadr<<",PDG="<<sPDG<<",1="<<hPDG<<",2="<<bPDG
06142 <<G4endl;
06143 #endif
06144 curHadr->SetQPDG(fQPDG);
06145 curHadr->Set4Momentum(f4Mom);
06146 backH->SetQPDG(rQPDG);
06147 backH->Set4Momentum(g4Mom);
06148 G4QHadron* newH = new G4QHadron(hQPDG.GetPDGCode(),t4Mom);
06149 theQHadrons.push_back(newH);
06150 nHadr=theQHadrons.size();
06151 #ifdef debug
06152 G4cout<<"G4QE::FSI:h="<<h4m<<",b="<<b4m<<G4endl;
06153 G4cout<<"G4QE::FSI:s="<<s4M<<" = Sum"<<f4Mom+g4Mom+t4Mom<<G4endl;
06154 G4cout<<"G4QE::FSI:*Products*,nH="<<nHadr<<",f="<<fQPDG<<f4Mom<<",b="
06155 <<rQPDG<<g4Mom<<",new="<<hQPDG<<t4Mom<<",nH="<<nHadr<<",nD="
06156 <<theQHadrons.size()<<G4endl;
06157 #endif
06158 }
06159 }
06160 tot4Mom+=b4m;
06161 tot4Mom-=g4Mom;
06163
06164 hQPDG=fQPDG;
06165 hPDG=hQPDG.GetPDGCode();
06166 hQC=fQPDG.GetQuarkContent();
06167 hS=hQC.GetStrangeness();
06168 hB=hQC.GetBaryonNumber();
06169 hGSM = hQPDG.GetMass();
06170 h4m=f4Mom;
06171 hM=h4m.m();
06172
06173 #ifdef debug
06174 G4cout<<"G4QE::FSI:cH4M="<<curHadr->Get4Momentum()<<G4endl;
06175 #endif
06176 }
06177 }
06178 }
06179 #ifdef chdebug
06180
06181 ccContSum=0;
06182 cbContSum=0;
06183 if(nHadr)for(unsigned ic2=0;ic2<nHadr;ic2++) if(!(theQHadrons[ic2]->GetNFragments()))
06184 {
06185 ccContSum+=theQHadrons[ic2]->GetCharge();
06186 cbContSum+=theQHadrons[ic2]->GetBaryonNumber();
06187 }
06188 unsigned pHadr=intQHadrons.size();
06189 if(pHadr)for(unsigned ic3=0;ic3<pHadr;ic3++) if(!(intQHadrons[ic3]->GetNFragments()))
06190 {
06191 ccContSum+=intQHadrons[ic3]->GetCharge();
06192 cbContSum+=intQHadrons[ic3]->GetBaryonNumber();
06193 }
06194 if(ccContSum-chContSum || cbContSum-bnContSum)
06195 {
06196 G4cout<<"*::*G4QE::FSI:(8) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06197 <<G4endl;
06198
06199 }
06200
06201 #endif
06202 G4LorentzVector cH4Mom = curHadr->Get4Momentum();
06203 tot4Mom-=cH4Mom;
06204 totCharge-=curHadr->GetCharge();
06205 totBaryoN-=curHadr->GetBaryonNumber();
06206 #ifdef pdebug
06207 G4cout<<"G4QE::FSI:Cur4M="<<tot4Mom<<",tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
06208 #endif
06209 if(hadron+1==nHadr)
06210 {
06211 #ifdef pdebug
06212 G4cout<<"G4QE::FSI:Last4M="<<tot4Mom<<",tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
06213 #endif
06214 G4double misM=0.;
06215 G4int mPDG=0;
06216 if(totCharge>=0 && totBaryoN > 0)
06217 {
06218 mPDG=90000000+999*totCharge+totBaryoN;
06219 misM=G4QPDGCode(mPDG).GetMass();
06220 }
06221 G4double re =tot4Mom.e();
06222 G4double rpx=tot4Mom.px();
06223 G4double rpy=tot4Mom.py();
06224 G4double rpz=tot4Mom.pz();
06225 G4double re2=re*re;
06226 G4double dmo=rpx*rpx+rpy*rpy+rpz*rpz;
06227 G4double dem=re2+dmo;
06228 G4double dm2=re2-dmo;
06229 G4double sdm=0.;
06230 if(dm2>0.) sdm=std::sqrt(dm2);
06231 #ifdef debug
06232 G4cout<<"G4QE::FSI: Is En&Mom conserved? t4M="<<tot4Mom<<",dM="<<sdm<<", mM="<<misM
06233 <<",mPDG="<<mPDG<<",dCH="<<totCharge<<",dBN="<<totBaryoN<<G4endl;
06234 #endif
06235 G4LorentzVector cor4M(0.,0.,0.,0.);
06236 if(dem>0.1)
06237 {
06238 G4bool corf=false;
06239 #ifdef pdebug
06240 G4cout<<"--Warning--G4QE::FSI:dE/Mc4M="<<tot4Mom<<sdm<<". Correct it!"<<G4endl;
06241 #endif
06242 if(sdm < .01 || (re2 > 0. && !totCharge && !totBaryoN && sdm/re2 < .0001))
06243 {
06244 #ifdef pdebug
06245 G4cout<<"...G4QE::FSI:E/M conservation is corrected by a photon"<<G4endl;
06246 #endif
06247 cor4M=tot4Mom;
06248 G4QHadron* theH = new G4QHadron(22,tot4Mom);
06249 theQHadrons.push_back(theH);
06250 corf=true;
06251 }
06252 else
06253 {
06254 if(dmo<0.0001 && re>900.)
06255 {
06256 if(fabs(re-mNeut)<.01)
06257 {
06258 #ifdef pdebug
06259 G4cout<<"...G4QE::FSI:E/M conservation is corrected by neutron"<<G4endl;
06260 #endif
06261 cor4M=G4LorentzVector(0.,0.,0.,mNeut);
06262 G4QHadron* theH = new G4QHadron(90000001,G4LorentzVector(0.,0.,0.,mNeut));
06263 theQHadrons.push_back(theH);
06264 corf=true;
06265 }
06266 else if(fabs(re-mProt)<.01)
06267 {
06268 #ifdef pdebug
06269 G4cout<<"...G4QE::FSI:E/M conservation is corrected by proton"<<G4endl;
06270 #endif
06271 cor4M=G4LorentzVector(0.,0.,0.,mProt);
06272 G4QHadron* theH = new G4QHadron(90001000,G4LorentzVector(0.,0.,0.,mProt));
06273 theQHadrons.push_back(theH);
06274 corf=true;
06275 }
06276 else if(fabs(re-mDeut)<.01)
06277 {
06278 #ifdef pdebug
06279 G4cout<<"...G4QE::FSI:E/M conservation is corrected by deuteron"<<G4endl;
06280 #endif
06281 cor4M=G4LorentzVector(0.,0.,0.,mDeut);
06282 G4QHadron* theH = new G4QHadron(90001001,G4LorentzVector(0.,0.,0.,mDeut));
06283 theQHadrons.push_back(theH);
06284 corf=true;
06285 }
06286 else if(fabs(re-mTrit)<.01)
06287 {
06288 #ifdef pdebug
06289 G4cout<<"...G4QE::FSI:E/M conservation is corrected by tritium"<<G4endl;
06290 #endif
06291 cor4M=G4LorentzVector(0.,0.,0.,mTrit);
06292 G4QHadron* theH = new G4QHadron(90001002,G4LorentzVector(0.,0.,0.,mTrit));
06293 theQHadrons.push_back(theH);
06294 corf=true;
06295 }
06296 else if(fabs(re-mHe3)<.01)
06297 {
06298 #ifdef pdebug
06299 G4cout<<"...G4QE::FSI:E/M conservation is corrected by He3"<<G4endl;
06300 #endif
06301 cor4M=G4LorentzVector(0.,0.,0.,mHe3);
06302 G4QHadron* theH = new G4QHadron(90002001,G4LorentzVector(0.,0.,0.,mHe3));
06303 theQHadrons.push_back(theH);
06304 corf=true;
06305 }
06306 else if(fabs(re-mAlph)<.01)
06307 {
06308 #ifdef pdebug
06309 G4cout<<"...G4QE::FSI:E/M conservation is corrected by alpha"<<G4endl;
06310 #endif
06311 cor4M=G4LorentzVector(0.,0.,0.,mAlph);
06312 G4QHadron* theH = new G4QHadron(90002002,G4LorentzVector(0.,0.,0.,mAlph));
06313 theQHadrons.push_back(theH);
06314 corf=true;
06315 }
06316 else if(fabs(re-mNeut-mNeut)<.01)
06317 {
06318 cor4M=G4LorentzVector(0.,0.,0.,mNeut+mNeut);
06319 #ifdef pdebug
06320 G4cout<<"...G4QE::FSI:E/M conservation is corrected by 2 neutrons"<<G4endl;
06321 #endif
06322 G4QHadron* theH1 = new G4QHadron(90000001,G4LorentzVector(0.,0.,0.,mNeut));
06323 theQHadrons.push_back(theH1);
06324 G4QHadron* theH2 = new G4QHadron(90000001,G4LorentzVector(0.,0.,0.,mNeut));
06325 theQHadrons.push_back(theH2);
06326 corf=true;
06327 }
06328 else if(fabs(re-mProt-mProt)<.01)
06329 {
06330 #ifdef pdebug
06331 G4cout<<"...G4QE::FSI:E/M conservation is corrected by 2 protons"<<G4endl;
06332 #endif
06333 cor4M=G4LorentzVector(0.,0.,0.,mProt+mProt);
06334 G4QHadron* theH1 = new G4QHadron(90001000,G4LorentzVector(0.,0.,0.,mProt));
06335 theQHadrons.push_back(theH1);
06336 G4QHadron* theH2 = new G4QHadron(90001000,G4LorentzVector(0.,0.,0.,mProt));
06337 theQHadrons.push_back(theH2);
06338 corf=true;
06339 }
06340 else G4Exception("G4QEnvironment::FSInteract()", "HAD_CHPS_0007",
06341 JustWarning, "Try heavier nuclei at rest");
06342 }
06343 else if(std::abs(sdm-misM) < 0.01)
06344 {
06345 #ifdef pdebug
06346 G4cout<<"...G4QE::FSI:E/M conservation is corrected by ResidualNucl"<<G4endl;
06347 #endif
06348 if(!misM) mPDG=22;
06349 G4QHadron* theH = new G4QHadron(mPDG,tot4Mom);
06350 cor4M=tot4Mom;
06351 if(std::fabs(sdm-misM) <= 0.01) theQHadrons.push_back(theH);
06352 else EvaporateResidual(theH);
06353 corf=true;
06354 }
06355 else if(tot4Mom.e() > 0 && cH4Mom.e() > 0 && nHadr > 1)
06356 {
06357 G4QHadron* prevHadr = theQHadrons[nHadr-2];
06358 G4LorentzVector pH4Mom = prevHadr->Get4Momentum();
06359 G4double cHM = curHadr->GetMass();
06360 G4double pHM = prevHadr->GetMass();
06361 #ifdef pdebug
06362 G4cout<<"G4QE::FSI:Bt4M="<<tot4Mom<<",c4M="<<cH4Mom<<",p4M="<<pH4Mom<<G4endl;
06363 #endif
06364 G4LorentzVector tt4Mom=tot4Mom+cH4Mom+pH4Mom;
06365 G4double totRM=tt4Mom.m();
06366 #ifdef pdebug
06367 G4cout<<"G4QE::FS:"<<tt4Mom<<",tM="<<totRM<<",cM="<<cHM<<",pM="<<pHM<<G4endl;
06368 #endif
06369 if(cHM+pHM<=totRM)
06370 {
06371 if(!G4QHadron(tt4Mom).DecayIn2(pH4Mom,cH4Mom))
06372 {
06373 G4cout<<"***G4QE::FSI:**Correction**tot4M="<<tt4Mom<<totRM<<">sM="
06374 <<cHM+cHM<<G4endl;
06375 #ifdef pdebug
06376 G4ExceptionDescription ed;
06377 ed << "CORRECT DecIn2 error: **Correction**tot4M=" << tt4Mom
06378 << totRM << ">sM=" << cHM+cHM << G4endl;
06379 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0007",
06380 JustWarning, ed);
06381 #endif
06382 }
06383 #ifdef chdebug
06384 G4cout<<"-:-Warning-:-G4QE::FSI:***CORRECTION IS DONE*** d="<<dem<<G4endl;
06385 #endif
06386 cor4M=tot4Mom;
06387 curHadr->Set4Momentum(cH4Mom);
06388 prevHadr->Set4Momentum(pH4Mom);
06389 corf=true;
06390 }
06391 else
06392 {
06393 #ifdef pdebug
06394 G4cerr<<"*!*G4QE::FSI: "<<cHM<<"+"<<pHM<<"="<<cHM+pHM<<">"<<totRM<<G4endl;
06395 G4ExceptionDescription ed;
06396 ed <<"TEMPORARY EXCEPTION: "<<cHM<<"+"<<pHM<<" = "<<cHM+pHM<<" > "<<totRM
06397 <<", tot4M="<<tot4Mom<<", c4M="<<cH4Mom<<", p4M="<<pH4Mom<< G4endl;
06398 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0008",
06399 JustWarning, ed);
06400 #endif
06401 }
06402 }
06403 else
06404 {
06405 G4cerr<<"*!*G4QE::FSI: tE="<<tot4Mom.e()<<", nHadr="<<nHadr<<G4endl;
06406 G4ExceptionDescription ed;
06407 ed << "TEMPORARY EXCEPTION: *check energy!* tot4M=" << tot4Mom << ", c4M="
06408 << cH4Mom << ", nHadr="<< nHadr << " > 1 ?" << G4endl;
06409 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0009",
06410 JustWarning, ed);
06411 }
06412 tot4Mom=tot4Mom-cor4M;
06413 #ifdef pdebug
06414 G4cout<<"---Warning---G4QE::FSI:En/MomCons.Error is corrected:"<<cor4M<<G4endl;
06415 #endif
06416 }
06417 if(nHadr>2 && !corf)
06418 {
06419 G4double cHM = curHadr->GetMass();
06420 G4int ch=0;
06421 for(ch=nHadr-3; ch>-1; --ch)
06422 {
06423 G4QHadron* prevHadr = theQHadrons[ch];
06424 G4LorentzVector pH4Mom = prevHadr->Get4Momentum();
06425 G4double pHM = prevHadr->GetMass();
06426 tot4Mom+=cH4Mom+pH4Mom;
06427 G4double totRM=tot4Mom.m();
06428 if(cHM+pHM<=totRM)
06429 {
06430 if(!G4QHadron(tot4Mom).DecayIn2(pH4Mom,cH4Mom))
06431 {
06432 G4cout<<"***G4QEnv::FSI:**Correction**,tot4M="<<tot4Mom<<totRM<<" > sM="
06433 <<cHM+cHM<<G4endl;
06434 #ifdef debug
06435 G4ExceptionDescription ed;
06436 ed << "CORRECTION DecIn2Error: **Correction**,tot4M=" << tot4Mom
06437 << totRM << " > sM=" << cHM+cHM << G4endl;
06438 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0010",
06439 FatalException, ed);
06440 #endif
06441 }
06442 #ifdef chdebug
06443 G4cout<<"-:-!!!-:-G4QE::FSI:***CORRECTION IS DONE*** d="<<dem<<G4endl;
06444 #endif
06445 curHadr->Set4Momentum(cH4Mom);
06446 prevHadr->Set4Momentum(pH4Mom);
06447 break;
06448 }
06449 else tot4Mom-=cH4Mom+pH4Mom;
06450 }
06451 #ifdef ppdebug
06452 if(ch<0)
06453 {
06454 G4ExceptionDescription ed;
06455 ed << "EnMomCorrectionFailed: EnergyMomentumCorrection FAILED "
06456 << G4endl;
06457 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0011",
06458 FatalException, ed);
06459 }
06460 #endif
06461 }
06462 }
06463 #ifdef debug
06464 else G4cout<<"...G4QE::FSI:E/M conservation is good enough"<<G4endl;
06465 G4cout<<"G4QE::FSI:EMCorrection by "<<theQHadrons.size()-nHadr<<" hadrons"<<G4endl;
06466 #endif
06467 break;
06468 }
06469 }
06470
06471
06472
06473
06474
06475
06476 #ifdef chdebug
06477
06478 ccContSum=0;
06479 cbContSum=0;
06480 if(nHadr)for(unsigned ic3=0; ic3<nHadr; ic3++) if(!(theQHadrons[ic3]->GetNFragments()))
06481 {
06482 ccContSum+=theQHadrons[ic3]->GetCharge();
06483 cbContSum+=theQHadrons[ic3]->GetBaryonNumber();
06484 }
06485 if(ccContSum-chContSum || cbContSum-bnContSum)
06486 {
06487 G4cout<<"*::*G4QE::FSI:(9) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06488 <<G4endl;
06489
06490 }
06491
06492 #endif
06493 G4LorentzVector sum(0.,0.,0.,0.);
06494 G4int gamCount=0;
06495 nHadr=theQHadrons.size();
06496 G4bool frag=false;
06497 if(nHadr>2)for(unsigned f=0; f<theQHadrons.size(); f++)
06498 {
06499 G4int fBN=theQHadrons[f]->GetBaryonNumber();
06500 #ifdef debug
06501 G4int fPDG=theQHadrons[f]->GetPDGCode();
06502 G4LorentzVector fLV=theQHadrons[f]->Get4Momentum();
06503 G4cout<<"G4QE::FSI:"<<f<<",PDG="<<fPDG<<",fBN="<<fBN<<",f4M="<<fLV<<G4endl;
06504 #endif
06505 if(fBN>1)
06506 {
06507 frag=true;
06508 break;
06509 }
06510 }
06511 #ifdef debug
06512 G4cout<<"G4QE::FSI:===Before Gamma Compression===, nH="<<nHadr<<",frag="<<frag<<G4endl;
06513 #endif
06514 if(nHadr>2 && frag) for(G4int h=nHadr-1; h>=0; h--)
06515 {
06516 G4QHadron* curHadr = theQHadrons[h];
06517 G4int hF = curHadr->GetNFragments();
06518 G4int hPDG = curHadr->GetPDGCode();
06519 if(hPDG==89999003||hPDG==90002999)
06520 G4cout<<"---Warning---G4QEnv::FSI:nD-/pD++(1)="<<hPDG<<G4endl;
06521 #ifdef debug
06522 G4cout<<"G4QE::FSI: h#"<<h<<", hPDG="<<hPDG<<", hNFrag="<<hF<<G4endl;
06523 #endif
06524 if(hF||hPDG==22)
06525 {
06526 G4QHadron* theLast = theQHadrons[theQHadrons.size()-1];
06527 if(hPDG==22)
06528 {
06529 G4LorentzVector g4M=curHadr->Get4Momentum();
06530 sum+=g4M;
06531 gamCount++;
06532 #ifdef debug
06533 G4cout<<"G4QE::FSI: gam4M="<<g4M<<" is added to s4M="<<sum<<G4endl;
06534 #endif
06535 }
06536 nHadr = theQHadrons.size()-1;
06537 if(h < static_cast<G4int>(nHadr))
06538 {
06539 curHadr->SetNFragments(0);
06540 curHadr->Set4Momentum(theLast->Get4Momentum());
06541 G4QPDGCode lQP=theLast->GetQPDG();
06542 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
06543 else curHadr->SetQC(theLast->GetQC());
06544 #ifdef debug
06545 G4cout<<"G4QE::FSI: Exchange with the last is done"<<G4endl;
06546 #endif
06547 }
06548 theQHadrons.pop_back();
06549 delete theLast;
06550 #ifdef debug
06551 G4cout<<"G4QE::FSI: The last is compessed"<<G4endl;
06552 #endif
06553 }
06554 }
06555 #ifdef debug
06556 G4cout<<"G4QE::FSI: nH="<<nHadr<<"="<<theQHadrons.size()<<", sum="<<sum<<G4endl;
06557 #endif
06558 #ifdef chdebug
06559
06560 ccContSum=0;
06561 cbContSum=0;
06562 if(nHadr)for(unsigned ic4=0; ic4<nHadr; ic4++) if(!(theQHadrons[ic4]->GetNFragments()))
06563 {
06564 ccContSum+=theQHadrons[ic4]->GetCharge();
06565 cbContSum+=theQHadrons[ic4]->GetBaryonNumber();
06566 }
06567 if(ccContSum-chContSum || cbContSum-bnContSum)
06568 {
06569 G4cout<<"*::*G4QE::FSI:(A) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06570 <<G4endl;
06571
06572 }
06573
06574 #endif
06575 if(nHadr>1)for(unsigned hdr=0; hdr<theQHadrons.size()-1; hdr++)
06576 {
06577 G4QHadron* curHadr = theQHadrons[hdr];
06578 #ifdef debug
06579 G4cout<<"G4QE::FSI:ORD,h="<<hdr<<"<"<<nHadr<<",hPDG="<<curHadr->GetPDGCode()<<G4endl;
06580 #endif
06581 G4QHadron* theLast = theQHadrons[theQHadrons.size()-1];
06582 G4int hB = curHadr->GetBaryonNumber();
06583 G4int lB = theLast->GetBaryonNumber();
06584 #ifdef debug
06585 G4cout<<"G4QE::FSI:hBN="<<hB<<"<lBN="<<lB<<",lstPDG="<<theLast->GetPDGCode()<<G4endl;
06586 #endif
06587 if(lB<hB)
06588 {
06589 G4QPDGCode hQPDG = curHadr->GetQPDG();
06590 G4LorentzVector h4m= curHadr->Get4Momentum();
06591 curHadr->Set4Momentum(theLast->Get4Momentum());
06592 G4QPDGCode lQP=theLast->GetQPDG();
06593 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
06594 else curHadr->SetQC(theLast->GetQC());
06595 theLast->Set4Momentum(h4m);
06596 theLast->SetQPDG(hQPDG);
06597 }
06598 }
06599 nHadr=theQHadrons.size();
06600 #ifdef chdebug
06601
06602 ccContSum=0;
06603 cbContSum=0;
06604 if(nHadr)for(unsigned ic5=0; ic5<nHadr; ic5++) if(!(theQHadrons[ic5]->GetNFragments()))
06605 {
06606 ccContSum+=theQHadrons[ic5]->GetCharge();
06607 cbContSum+=theQHadrons[ic5]->GetBaryonNumber();
06608 }
06609 if(ccContSum-chContSum || cbContSum-bnContSum)
06610 {
06611 G4cout<<"*::*G4QE::FSI:(B) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06612 <<G4endl;
06613
06614 }
06615
06616 #endif
06617 if(gamCount)
06618 {
06619 G4QHadron* theLast = theQHadrons[nHadr-1];
06620 if(theLast->GetBaryonNumber()>0)
06621 {
06622 G4QHadron* theNew = new G4QHadron(theLast);
06623 #ifdef ffdebug
06624 G4cout<<"G4QE::FSI:BeforeLastSub,n="<<nHadr<<",PDG="<<theNew->GetPDGCode()<<G4endl;
06625 #endif
06626 theQHadrons.pop_back();
06627 delete theLast;
06628 nHadr--;
06629 G4int newPDG=theNew->GetPDGCode();
06630 G4LorentzVector new4M=theNew->Get4Momentum();
06631 #ifdef debug
06632 G4cout<<"G4QE::FSI:gSum4M="<<sum<<" is added to "<<new4M<<", PDG="<<newPDG<<G4endl;
06633 #endif
06634 G4LorentzVector exRes4M=new4M+sum;
06635 G4QNucleus exResidN(exRes4M,newPDG);
06636
06637 G4double mGamEva=1700.;
06638 if(exResidN.SplitBaryon())
06639
06640 {
06641 theNew->Set4Momentum(exRes4M);
06642 #ifdef ffdebug
06643 G4cout<<"G4QE::FSI:BeforeE(1),n="<<nHadr<<",nPDG="<<theNew->GetPDGCode()<<G4endl;
06644 #endif
06645 EvaporateResidual(theNew);
06646 }
06647 else if(theNew->GetPDGCode()==90002002&&exRes4M.m()>mHe3+mNeut&&G4UniformRand()>.5)
06648 {
06649 theNew->Set4Momentum(exRes4M);
06650 G4LorentzVector n4M(0.,0.,0.,mNeut);
06651 G4LorentzVector h4M(0.,0.,0.,mHe3);
06652 if(!theNew->DecayIn2(n4M,h4M))
06653 {
06654 G4ExceptionDescription ed;
06655 ed << "GamSUPPRES DecIn2(n+He3)error: GamSup, tM=" << exRes4M.m()
06656 << "<n+He3=" << mNeut+mHe3 << G4endl;
06657 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0012",
06658 FatalException, ed);
06659 }
06660 #ifdef ffdebug
06661 G4cout<<"G4QE::FSI:Gamma Suppression succided, n="<<n4M<<", He3="<<h4M<<G4endl;
06662 #endif
06663 theNew->Set4Momentum(n4M);
06664 theNew->SetQPDG(nQPDG);
06665 theQHadrons.push_back(theNew);
06666 G4QHadron* theHe3 = new G4QHadron(90002001,h4M);
06667 theQHadrons.push_back(theHe3);
06668 }
06669 else if(nHadr)
06670
06671 {
06672 if(nHadr>1)for(unsigned sh=0; sh<theQHadrons.size()-1; sh++)
06673 {
06674 G4QHadron* curHadr = theQHadrons[sh];
06675 G4QHadron* thePrev = theQHadrons[theQHadrons.size()-1];
06676 G4LorentzVector h4M= curHadr->Get4Momentum();
06677 G4LorentzVector l4M= thePrev->Get4Momentum();
06678 #ifdef ffdebug
06679 G4cout<<"G4QE::FSI:SO,h="<<sh<<"<"<<nHadr<<",PDG/LV="<<curHadr->GetPDGCode()
06680 <<h4M<<G4endl;
06681 #endif
06682 G4double hM=h4M.m();
06683 G4double hT=h4M.e()-hM;
06684 G4double lT=l4M.e()-l4M.m();
06685 #ifdef ffdebug
06686 G4cout<<"G4QE::FSI:hT="<<hT<<"<T="<<lT<<".PDG="<<thePrev->GetPDGCode()<<G4endl;
06687 #endif
06688 if(hM>mGamEva&&lT>hT)
06689 {
06690 G4QPDGCode hQPDG = curHadr->GetQPDG();
06691 curHadr->Set4Momentum(l4M);
06692 G4QPDGCode lQP=thePrev->GetQPDG();
06693 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
06694 else curHadr->SetQC(thePrev->GetQC());
06695 thePrev->Set4Momentum(h4M);
06696 thePrev->SetQPDG(hQPDG);
06697 }
06698 }
06699 nHadr=theQHadrons.size();
06700 G4QHadron* thePrev = theQHadrons[nHadr-1];
06701 if(thePrev->Get4Momentum().m()>mGamEva)
06702 {
06703 G4QHadron* theHad = new G4QHadron(thePrev);
06704 #ifdef ffdebug
06705 G4cout<<"G4QE::FSI:BeforeResidNucHadr nH="<<nHadr<<",hPDG="
06706 <<theHad->GetPDGCode()<<G4endl;
06707 #endif
06708 theQHadrons.pop_back();
06709 delete thePrev;
06710 G4LorentzVector n4M=theNew->Get4Momentum();
06711 G4LorentzVector h4M=theHad->Get4Momentum();
06712 G4LorentzVector dh4M=exRes4M+h4M;
06713 G4double dhM=dh4M.m();
06714 if(theHad->GetPDGCode()==90001001&&dhM>n4M.m()+mProt+mNeut&&G4UniformRand()>.5)
06715
06716 {
06717 G4double nuM=n4M.m();
06718 h4M=G4LorentzVector(0.,0.,0.,mNeut);
06719 G4LorentzVector p4M(0.,0.,0.,mProt);
06720 G4double sum_value=nuM+mNeut+mProt;
06721 if(fabs(dhM-sum_value)<eps)
06722 {
06723 n4M=dh4M*(nuM/sum_value);
06724 h4M=dh4M*(mNeut/sum_value);
06725 p4M=dh4M*(mProt/sum_value);
06726 }
06727 else if(dhM<sum_value || !G4QHadron(dh4M).DecayIn3(n4M,h4M,p4M))
06728 {
06729 G4ExceptionDescription ed;
06730 ed << "Gamma SUPPRESSION by D DecIn3error: GamSupByD,M="
06731 << dhM << "<A+p+n=" << sum_value << G4endl;
06732 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0013",
06733 FatalException, ed);
06734 }
06735 #ifdef ffdebug
06736 G4cout<<"G4QE::FSI:GamSuppression by d succided,h="<<h4M<<",A="<<n4M<<G4endl;
06737 #endif
06738 theHad->Set4Momentum(h4M);
06739 theHad->SetQPDG(nQPDG);
06740 theQHadrons.push_back(theHad);
06741 G4QHadron* theProt = new G4QHadron(90001000,p4M);
06742 theQHadrons.push_back(theProt);
06743 theNew->Set4Momentum(n4M);
06744 EvaporateResidual(theNew);
06745 }
06746 else
06747 {
06748 if(!G4QHadron(dh4M).DecayIn2(n4M,h4M))
06749 {
06750 G4ExceptionDescription ed;
06751 ed << "GamSUPPRESSION (3) DecIn2 error: GamSup,M=" << dh4M.m()
06752 << "<A+h=" << n4M.m()+h4M.m() << G4endl;
06753 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0014",
06754 FatalException, ed);
06755 }
06756 #ifdef ffdebug
06757 G4cout<<"G4QE::FSI:Gamma Suppression succided, h="<<h4M<<", A="<<n4M<<G4endl;
06758 #endif
06759 theHad->Set4Momentum(h4M);
06760 theQHadrons.push_back(theHad);
06761 theNew->Set4Momentum(n4M);
06762 EvaporateResidual(theNew);
06763 }
06764 }
06765 else
06766 {
06767 theNew->Set4Momentum(exRes4M);
06768 #ifdef ffdebug
06769 G4cout<<"G4QE::FSI:BeforE(2),n="<<nHadr<<",PDG="<<theNew->GetPDGCode()<<G4endl;
06770 #endif
06771 EvaporateResidual(theNew);
06772 }
06773 }
06774 else
06775 {
06776 theNew->Set4Momentum(exRes4M);
06777 EvaporateResidual(theNew);
06778 #ifdef ffdebug
06779 G4cout<<"G4QE::FSI:Bef.E(3),n="<<nHadr<<",PDG="<<newPDG<<",4M="<<exRes4M<<G4endl;
06780 unsigned nHN=theQHadrons.size();
06781 G4cout<<"G4QE::FSI:AfterEvaporation: nNew="<<nHN<<G4endl;
06782 if(nHN>nHadr)for(unsigned idp=nHadr; idp<nHN; idp++)
06783 G4cout<<"G4QE::FSI: h#"<<idp<<", PDG="<<theQHadrons[idp]->GetPDGCode()<<G4endl;
06784 #endif
06785 }
06786
06787 nHadr=theQHadrons.size();
06788
06789 }
06790 }
06791 }
06792 tot4Mom=tmp4Mom;
06793
06794 G4int gamcnt=0;
06795 nHadr=theQHadrons.size();
06796 unsigned maxB=nHadr-1;
06797 #ifdef chdebug
06798
06799 ccContSum=0;
06800 cbContSum=0;
06801 if(nHadr)for(unsigned ic6=0; ic6<nHadr; ic6++) if(!(theQHadrons[ic6]->GetNFragments()))
06802 {
06803 ccContSum+=theQHadrons[ic6]->GetCharge();
06804 cbContSum+=theQHadrons[ic6]->GetBaryonNumber();
06805 }
06806 if(ccContSum-chContSum || cbContSum-bnContSum)
06807 {
06808 G4cout<<"*::*G4QE::FSI:(C) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06809 <<G4endl;
06810
06811 }
06812
06813 #endif
06814 lHadr=theQHadrons[maxB]->GetBaryonNumber();
06815 G4int tHadr=lHadr;
06816 if(nHadr>1)for(unsigned ipo=0; ipo<theQHadrons.size()-1; ipo++)
06817 {
06818 G4int hPDG = theQHadrons[ipo]->GetPDGCode();
06819 if(hPDG==22) gamcnt++;
06820 else
06821 {
06822 G4int hBN = theQHadrons[ipo]->GetBaryonNumber();
06823 tHadr+=hBN;
06824 #ifdef debug
06825 G4cout<<"G4QE::FSI:h#"<<ipo<<":hPDG="<<hPDG<<",hBN="<<hBN<<",nH="<<theQHadrons.size()
06826 <<G4endl;
06827 #endif
06828 if(hBN>lHadr)
06829 {
06830 lHadr=hBN;
06831 maxB=ipo;
06832 }
06833 }
06834 }
06835 #ifdef debug
06836 G4cout<<"G4QE::FSI:max#"<<maxB<<",lB="<<lHadr<<",tBN="<<tHadr<<",gam="<<gamcnt<<G4endl;
06837 #endif
06838 nHadr=theQHadrons.size();
06839 #ifdef chdebug
06840
06841 ccContSum=0;
06842 cbContSum=0;
06843 if(nHadr)for(unsigned ic7=0; ic7<nHadr; ic7++) if(!(theQHadrons[ic7]->GetNFragments()))
06844 {
06845 ccContSum+=theQHadrons[ic7]->GetCharge();
06846 cbContSum+=theQHadrons[ic7]->GetBaryonNumber();
06847 }
06848 if(ccContSum-chContSum || cbContSum-bnContSum)
06849 {
06850 G4cout<<"*::*G4QE::FSI:(D) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
06851 <<G4endl;
06852
06853 }
06854
06855 #endif
06856 if(gamcnt&&tHadr>1)
06857 {
06858 if(maxB+1<nHadr)
06859 {
06860 G4QHadron* theCurr = theQHadrons[maxB];
06861 G4QHadron* theLast = theQHadrons[nHadr-1];
06862 G4QHadron* curHadr = new G4QHadron(theCurr);
06863 G4QPDGCode lQP=theLast->GetQPDG();
06864 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
06865 else theCurr->SetQC(theLast->GetQC());
06866 theCurr->Set4Momentum(theLast->Get4Momentum());
06867 theQHadrons.pop_back();
06868 delete theLast;
06869 theQHadrons.push_back(curHadr);
06870 }
06871 nHadr=theQHadrons.size();
06872
06873 G4LorentzVector gamSum(0.,0.,0.,0.);
06874 if(nHadr>1)for(unsigned gp=0; gp<nHadr-1; gp++)
06875 {
06876 G4QHadron* theCurr = theQHadrons[gp];
06877 G4int hPDG=theCurr->GetPDGCode();
06878 #ifdef debug
06879 G4cout<<"G4QE::FSI:gp#"<<gp<<", PDG="<<hPDG<<", is found"<<G4endl;
06880 #endif
06881 if(hPDG==22)
06882 {
06883 gamSum=gamSum+theCurr->Get4Momentum();
06884 #ifdef debug
06885 G4cout<<"G4QE::FSI:Photon gp#"<<gp<<",nH="<<nHadr<<", update gS="<<gamSum<<G4endl;
06886 #endif
06887 unsigned nLast=nHadr-1;
06888 G4QHadron* theLast = theQHadrons[nLast];
06889 #ifdef debug
06890 G4int wcn=0;
06891 #endif
06892 while(nLast>=gp && theLast->GetPDGCode()==22)
06893 {
06894 #ifdef debug
06895 ++wcn;
06896 #endif
06897 if(nLast>gp)
06898 {
06899 gamSum=gamSum+theLast->Get4Momentum();
06900 #ifdef debug
06901 G4cout<<"G4QE::FSI:TheLastPhotonIsFound #"<<wcn<<",update gS="<<gamSum<<G4endl;
06902 #endif
06903 }
06904 theQHadrons.pop_back();
06905 delete theLast;
06906 nHadr=theQHadrons.size();
06907 nLast=nHadr-1;
06908 theLast = theQHadrons[nLast];
06909 }
06910 if(nLast>gp)
06911 {
06912 G4QPDGCode lQP=theLast->GetQPDG();
06913 if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP);
06914 else theCurr->SetQC(theLast->GetQC());
06915 theCurr->Set4Momentum(theLast->Get4Momentum());
06916 theQHadrons.pop_back();
06917 delete theLast;
06918 nHadr=theQHadrons.size();
06919 #ifdef debug
06920 G4cout<<"G4QE::FSI:RepBy lPDG="<<lQP<<", nH="<<nHadr<<", gS="<<gamSum<<G4endl;
06921 #endif
06922 }
06923 }
06924 }
06925
06926 G4QHadron* theLast = theQHadrons[nHadr-1];
06927 if(theLast->GetPDGCode()==22)
06928 {
06929 gamSum=gamSum+theLast->Get4Momentum();
06930 theQHadrons.pop_back();
06931 delete theLast;
06932 nHadr=theQHadrons.size();
06933 #ifdef debug
06934 G4cout<<"-Warning-G4QE::FSI: LastPhotonIsKilled, nH="<<nHadr<<",gS="<<gamSum<<G4endl;
06935 #endif
06936 theLast = theQHadrons[nHadr-1];
06937 }
06938 G4int nEx=nHadr-2;
06939 while(theLast->GetBaryonNumber()<1 && nEx>=0)
06940 {
06941 G4QHadron* theEx=theQHadrons[nEx];
06942 G4LorentzVector ex4Mom=theEx->Get4Momentum();
06943 G4QPDGCode exQPDG=theEx->GetQPDG();
06944 G4QContent exQC=theEx->GetQC();
06945 G4QPDGCode lQP=theLast->GetQPDG();
06946 if(lQP.GetPDGCode()!=10) theEx->SetQPDG(lQP);
06947 else theEx->SetQC(theLast->GetQC());
06948 theEx->Set4Momentum(theLast->Get4Momentum());
06949 if(exQPDG.GetPDGCode()!=10) theLast->SetQPDG(exQPDG);
06950 else theLast->SetQC(exQC);
06951 theLast->Set4Momentum(ex4Mom);
06952 nEx--;
06953 }
06954 G4QHadron* curHadr = new G4QHadron(theLast);
06955 theQHadrons.pop_back();
06956 delete theLast;
06957 G4int theLB= curHadr->GetBaryonNumber();
06958 G4LorentzVector tR4M=curHadr->Get4Momentum()+gamSum;
06959 G4double tRM=tR4M.m();
06960 if(theLB>4)
06961 {
06962 G4QContent lrQC=curHadr->GetQC()-G4QContent(6,6,0,0,0,0);
06963 G4QNucleus lrN(lrQC);
06964 G4double lrM=lrN.GetMZNS();
06965 if(tRM>lrM+mAlph)
06966 {
06967 G4LorentzVector lr4M(0.,0.,0.,lrM);
06968 G4LorentzVector al4M(0.,0.,0.,mAlph);
06969 if(!G4QHadron(tR4M).DecayIn2(lr4M,al4M))
06970 {
06971 curHadr->Set4Momentum(tR4M);
06972 EvaporateResidual(curHadr);
06973 #ifdef fdebug
06974 G4cout<<"G4QE::FSI: After Evap (1) nH="<<theQHadrons.size()<<G4endl;
06975 #endif
06976 }
06977 else
06978 {
06979 delete curHadr;
06980 G4int APDG=lrN.GetPDG();
06981 #ifdef debug
06982 G4cout<<"G4QE::FSI: Final A+alpha, A="<<APDG<<lr4M<<", a="<<al4M<<G4endl;
06983 #endif
06984 G4QHadron* lrH = new G4QHadron(APDG,lr4M);
06985 theQHadrons.push_back(lrH);
06986 G4QHadron* alH = new G4QHadron(90002002,al4M);
06987 theQHadrons.push_back(alH);
06988 }
06989 }
06990 else
06991 {
06992 curHadr->Set4Momentum(tR4M);
06993 EvaporateResidual(curHadr);
06994 #ifdef fdebug
06995 G4cout<<"G4QE::FSI: After Evap (2) nH="<<theQHadrons.size()<<G4endl;
06996 #endif
06997 }
06998 }
06999 else
07000 {
07001 curHadr->Set4Momentum(tR4M);
07002 EvaporateResidual(curHadr);
07003 #ifdef fdebug
07004 G4cout<<"G4QE::FSI: After Evap (5) nH="<<theQHadrons.size()<<G4endl;
07005 #endif
07006 }
07007 }
07008
07009 nHadr=theQHadrons.size();
07010 #ifdef chdebug
07011
07012 ccContSum=0;
07013 cbContSum=0;
07014 if(nHadr)for(unsigned ic8=0; ic8<nHadr; ic8++) if(!(theQHadrons[ic8]->GetNFragments()))
07015 {
07016 ccContSum+=theQHadrons[ic8]->GetCharge();
07017 cbContSum+=theQHadrons[ic8]->GetBaryonNumber();
07018 }
07019 if(ccContSum-chContSum || cbContSum-bnContSum)
07020 {
07021 G4cout<<"*::*G4QE::FSI:(E) dC="<<ccContSum-chContSum<<",dB="<<cbContSum-bnContSum
07022 <<G4endl;
07023
07024 }
07025
07026 #endif
07027 if(nHadr) for(unsigned hd=0; hd<theQHadrons.size(); hd++)
07028 {
07029
07030 G4QHadron* curHadr = theQHadrons[hd];
07031 G4int hPDG=curHadr->GetPDGCode();
07032 if(hPDG==22 && fabs(curHadr->Get4Momentum().e())<.00001)
07033 {
07034 unsigned lin=theQHadrons.size()-1;
07035 G4QHadron* theLast = theQHadrons[lin];
07036 if(lin>hd)
07037 {
07038 G4QPDGCode lQP=theLast->GetQPDG();
07039 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
07040 else curHadr->SetQC(theLast->GetQC());
07041 curHadr->Set4Momentum(theLast->Get4Momentum());
07042 }
07043
07044 delete theLast;
07045 theQHadrons.pop_back();
07046 hPDG=curHadr->GetPDGCode();
07047 if(lin==hd) break;
07048 }
07049 #ifdef fdebug
07050 G4cout<<"G4QE::FSI: LOOP starts nH="<<nHadr<<", h#"<<hd<<", PDG="<<hPDG<<G4endl;
07051 #endif
07052 if(hPDG==89999003||hPDG==90002999) G4cout<<"G4QEnv::FSI:nD-/pD++(0)="<<hPDG<<G4endl;
07053 if(hPDG==89999004||hPDG==90003999) G4cout<<"G4QEnv::FSI:nnD-/ppD++(0)="<<hPDG<<G4endl;
07054
07055 if(hPDG>100000000) G4cout<<"***G4QE::FSI: h#"<<hd<<", wrong PDGCode="<<hPDG<<G4endl;
07056 #ifdef fdebug
07057 G4cout<<"G4QE::FSI:Copy is made with PDG="<<hPDG<<G4endl;
07058 #endif
07059 G4int hBN=curHadr->GetBaryonNumber();
07060 G4int hCG=curHadr->GetCharge();
07061 G4int hST=curHadr->GetStrangeness();
07062 G4int hNF=curHadr->GetNFragments();
07063 G4bool fOK=true;
07064 if(hNF==-1) curHadr->SetNFragments(0);
07065 else if(hPDG==91000000) curHadr->SetQPDG(G4QPDGCode(3122));
07066 else if(hPDG==90998003||hPDG==91002998)
07067 {
07068 #ifdef fdebug
07069 G4cout<<"G4QE::FSI: Pi+Nuc+Sigma state decay is found PDG="<<hPDG<<G4endl;
07070 #endif
07071 G4LorentzVector r4M=curHadr->Get4Momentum();
07072 G4double reM=r4M.m();
07073 G4bool dub=false;
07074 G4int PDGnu=2112;
07075 G4double mNucl=mNeut;
07076 G4int PDGpi=-211;
07077 G4double mPion=mPi;
07078 G4int PDGsi=3112;
07079 G4double mSi=mSigM;
07080 G4double sum=mNucl+mPion+mSi;
07081 if(hPDG==90998003&&reM<sum)
07082 {
07083 PDGsi=2112;
07084 mSi=mNeut;
07085 mPion=mPi+mPi;
07086 sum=mNucl+mPion+mSi;
07087 dub=true;
07088 }
07089 if(hPDG==91002998)
07090 {
07091 mNucl=mProt;
07092 PDGnu=2212;
07093 PDGpi=211;
07094 PDGsi=3222;
07095 mSi =mSigP;
07096 sum=mNucl+mPion+mSi;
07097 if(reM<sum)
07098 {
07099 PDGsi=2212;
07100 mSi=mProt;
07101 sum=mNucl+mPion+mSi;
07102 }
07103 }
07104 G4LorentzVector n4M(0.,0.,0.,mNucl);
07105 G4LorentzVector p4M(0.,0.,0.,mPion);
07106 G4LorentzVector k4M(0.,0.,0.,mSi);
07107 if(fabs(reM-sum)<eps)
07108 {
07109
07110 n4M=r4M*(mNucl/sum);
07111 p4M=r4M*(mPion/sum);
07112 k4M=r4M*(mSi/sum);
07113 }
07114 else if(reM<sum || !G4QHadron(r4M).DecayIn3(n4M,p4M,k4M))
07115 {
07116 G4cout<<"---Warning---G4QE::FSI:Pi+N+Sigma recovery INPDG="<<hPDG<<","<<reM<<" < "
07117 <<mNucl<<"(PDG="<<PDGnu<<")+Pi="<<mPion<<")+Sigma="<<mSi<<"="<<sum<<G4endl;
07118 if(!theEnvironment.GetA())
07119 {
07120 G4QHadron* theLast = curHadr;
07121 G4QHadron* qH = new G4QHadron(curHadr);
07122 if(hd+1<theQHadrons.size())
07123 {
07124 theLast = theQHadrons[theQHadrons.size()-1];
07125 G4QPDGCode lQP=theLast->GetQPDG();
07126 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
07127 else curHadr->SetQC(theLast->GetQC());
07128 curHadr->Set4Momentum(theLast->Get4Momentum());
07129 }
07130 theQHadrons.pop_back();
07131 delete theLast;
07132 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
07133 if(!CheckGroundState(quasH,true))
07134 {
07135 qH->SetNFragments(-1);
07136 G4cout<<"---Warning---G4QE::FSI:PiNSig Failed, LeaveAsItIs 4m="<<r4M<<G4endl;
07137 theQHadrons.push_back(qH);
07138 }
07139 else
07140 {
07141 #ifdef fdebug
07142 for(unsigned hp=0; hp<theQHadrons.size(); hp++)
07143 {
07144 G4QHadron* cpHadr = new G4QHadron(theQHadrons[hp]);
07145 G4int hpPDG=cpHadr->GetPDGCode();
07146 G4LorentzVector hpLV=cpHadr->Get4Momentum();
07147 G4cout<<"G4QE::FSI:h#"<<hp<<": hPDG="<<hpPDG<<", h4M="<<hpLV<<G4endl;
07148 }
07149 #endif
07150 delete qH;
07151 nHadr=theQHadrons.size();
07152 }
07153 delete quasH;
07154 fOK=false;
07155 }
07156 else
07157 {
07158 G4ExceptionDescription ed;
07159 ed << "PiNucSigma Final Decay Error: No Final PiNSig recovery, Env="
07160 << theEnvironment << G4endl;
07161 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0015",
07162 FatalException, ed);
07163 }
07164 #ifdef fdebug
07165 G4cout<<"G4QEnv::FSI: PiNSi recover #"<<hd<<",PDG="<<curHadr->GetPDGCode()<<G4endl;
07166 #endif
07167 }
07168 if(fOK)
07169 {
07170 #ifdef fdebug
07171 G4cout<<"G4QE::FSI:PiNSigma==>"<<r4M<<"->N="<<PDGnu<<n4M<<"+Pi="<<PDGpi<<p4M
07172 <<"+ Sigma="<<PDGsi<<k4M<<G4endl;
07173 #endif
07174 curHadr->Set4Momentum(n4M);
07175 curHadr->SetQPDG(G4QPDGCode(PDGnu));
07176 if(dub)
07177 {
07178 p4M/=2.;
07179 G4QHadron* Pid = new G4QHadron(PDGpi,p4M);
07180 theQHadrons.push_back(Pid);
07181 }
07182 G4QHadron* Pi = new G4QHadron(PDGpi,p4M);
07183 theQHadrons.push_back(Pi);
07184 G4QHadron* Si = new G4QHadron(PDGsi,k4M);
07185 theQHadrons.push_back(Si);
07186 }
07187 #ifdef fdebug
07188 G4cout<<"G4QE::FSI:*TMP* PiNSigma end up PDG="<<hPDG<<G4endl;
07189 #endif
07190 }
07191 else if(hPDG==89998003||hPDG==90002998)
07192 {
07193
07194 G4double mNucl=mNeut;
07195 G4int PDGnu=2112;
07196 G4int PDGpi=-211;
07197 if(hPDG==90002998)
07198 {
07199 mNucl=mProt;
07200 PDGnu=2212;
07201 PDGpi=211;
07202 }
07203
07204 G4LorentzVector r4M=curHadr->Get4Momentum();
07205 G4double reM=r4M.m();
07206 G4LorentzVector n4M(0.,0.,0.,mNucl);
07207 G4LorentzVector p4M(0.,0.,0.,mPi);
07208 G4LorentzVector k4M(0.,0.,0.,mPi);
07209 G4double sum=mNucl+mPi+mPi;
07210 if(fabs(reM-sum)<eps)
07211 {
07212
07213 n4M=r4M*(mNucl/sum);
07214 p4M=r4M*(mPi/sum);
07215 k4M=r4M*(mPi/sum);
07216 }
07217 else if(reM<sum || !G4QHadron(r4M).DecayIn3(n4M,p4M,k4M))
07218 {
07219 G4cout<<"---Warning---G4QE::FSI: Isonuc+Pi recovery INPDG="<<hPDG<<","<<reM<<" < "
07220 <<mNucl<<"(PDG="<<PDGnu<<") + 2*"<<mPi<<"="<<sum<<G4endl;
07221 if(!theEnvironment.GetA())
07222 {
07223 G4QHadron* theLast = curHadr;
07224 G4QHadron* qH = new G4QHadron(curHadr);
07225 if(hd+1<theQHadrons.size())
07226 {
07227 theLast = theQHadrons[theQHadrons.size()-1];
07228 G4QPDGCode lQP=theLast->GetQPDG();
07229 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
07230 else curHadr->SetQC(theLast->GetQC());
07231 curHadr->Set4Momentum(theLast->Get4Momentum());
07232 }
07233 theQHadrons.pop_back();
07234 delete theLast;
07235 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
07236 if(!CheckGroundState(quasH,true))
07237 {
07238 qH->SetNFragments(-1);
07239 G4cout<<"---Warning---G4QE::FSI:IsoN+Pi Failed, LeaveAsItIs 4m="<<r4M<<G4endl;
07240 theQHadrons.push_back(qH);
07241 }
07242 else
07243 {
07244 delete qH;
07245 nHadr=theQHadrons.size();
07246 }
07247 delete quasH;
07248 fOK=false;
07249 }
07250 else
07251 {
07252 G4ExceptionDescription ed;
07253 ed << "IsoNucl+Pi FinalDecayError: No Final IsoN+Pi recovery, Env="
07254 << theEnvironment << G4endl;
07255 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0016",
07256 FatalException, ed);
07257 }
07258 #ifdef fdebug
07259 G4cout<<"G4QEnv::FSI: PiDel recover #"<<hd<<",PDG="<<curHadr->GetPDGCode()<<G4endl;
07260 #endif
07261 }
07262 if(fOK)
07263 {
07264 #ifdef fdebug
07265 G4cout<<"G4QE::FSI:IsoNuc+Pi==>"<<r4M<<"->N="<<PDGnu<<n4M<<"+Pi="<<PDGpi<<p4M
07266 <<"+ Pi="<<PDGpi<<k4M<<G4endl;
07267 #endif
07268 curHadr->Set4Momentum(n4M);
07269 curHadr->SetQPDG(G4QPDGCode(PDGnu));
07270 G4QHadron* Pi1 = new G4QHadron(PDGpi,p4M);
07271 theQHadrons.push_back(Pi1);
07272 G4QHadron* Pi2 = new G4QHadron(PDGpi,k4M);
07273 theQHadrons.push_back(Pi2);
07274 }
07275 #ifdef fdebug
07276 G4cout<<"G4QE::FSI:*TMP* PiDelta end up PDG="<<hPDG<<G4endl;
07277 #endif
07278 }
07279 else if(hBN>0 && !hST && (hCG<0||hCG>hBN))
07280 {
07281 G4double mNucl=mNeut;
07282 G4int PDGnu=2112;
07283 G4int PDGpi=-211;
07284 G4int nPi=-hCG;
07285 if(hCG>0)
07286 {
07287 mNucl=mProt;
07288 PDGnu=2212;
07289 PDGpi=211;
07290 nPi=hCG-hBN;
07291 }
07292 G4double nucM=mNucl*hBN;
07293 G4double pioM=mPi*nPi;
07294 G4LorentzVector r4M=curHadr->Get4Momentum();
07295 G4double reM=r4M.m();
07296 G4LorentzVector n4M(0.,0.,0.,nucM);
07297 G4LorentzVector k4M(0.,0.,0.,pioM);
07298 G4double sum=nucM+pioM;
07299 if(fabs(reM-sum)<eps)
07300 {
07301 n4M=r4M*(nucM/sum);
07302 k4M=r4M*(pioM/sum);
07303 }
07304 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,k4M))
07305 {
07306 #ifdef fdebug
07307 G4cout<<"---Warning---G4QE::FSI: Isonucleus recovery INPDG="<<hPDG<<", M="<<reM
07308 <<" < "<<nucM<<"+"<<pioM<<"="<<sum<<G4endl;
07309 #endif
07310 if(!theEnvironment.GetA())
07311 {
07312 G4QHadron* theLast = curHadr;
07313 G4QHadron* qH = new G4QHadron(curHadr);
07314 G4QContent tQC=qH->GetQC();
07315 G4LorentzVector t4M=qH->Get4Momentum();
07316 if(hd+1<theQHadrons.size())
07317 {
07318 theLast = theQHadrons[theQHadrons.size()-1];
07319 G4QPDGCode lQP=theLast->GetQPDG();
07320 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
07321 else curHadr->SetQC(theLast->GetQC());
07322 curHadr->Set4Momentum(theLast->Get4Momentum());
07323 }
07324 theQHadrons.pop_back();
07325 delete theLast;
07326 G4Quasmon* quasH = new G4Quasmon(tQC,t4M);
07327 if(!CheckGroundState(quasH,true))
07328 {
07329 G4int tPDG=qH->GetPDGCode();
07330 qH->SetNFragments(-1);
07331 G4cout<<"---Warning---G4QE::FSI:IsoN="<<tPDG<<tQC<<" FAsIs 4m="<<t4M<<G4endl;
07332 theQHadrons.push_back(qH);
07333 }
07334 else
07335 {
07336 #ifdef fdebug
07337 for(unsigned hp=0; hp<theQHadrons.size(); hp++)
07338 {
07339 G4QHadron* cpHadr = new G4QHadron(theQHadrons[hp]);
07340 G4int hpPDG=cpHadr->GetPDGCode();
07341 G4LorentzVector hpLV=cpHadr->Get4Momentum();
07342 G4cout<<"G4QE::FSI:h#"<<hp<<": hPDG="<<hpPDG<<", h4M="<<hpLV<<G4endl;
07343 }
07344 #endif
07345 delete qH;
07346 nHadr=theQHadrons.size();
07347 }
07348 delete quasH;
07349 fOK=false;
07350 }
07351 else
07352 {
07353 G4ExceptionDescription ed;
07354 ed << "IsoNucleus FinalDecayError: No FinalIsoNucRecovery, Env="
07355 << theEnvironment << G4endl;
07356 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0017",
07357 FatalException, ed);
07358 }
07359 #ifdef fdebug
07360 G4cout<<"G4QEnv::FSI: Isonucleus recovery outPDG="<<curHadr->GetPDGCode()<<G4endl;
07361 #endif
07362 }
07363 if(fOK)
07364 {
07365 #ifdef fdebug
07366 G4cout<<"G4QE::FSI:IsoN==>"<<r4M<<"->N="<<PDGnu<<n4M<<"+Pi="<<PDGpi<<k4M<<G4endl;
07367 #endif
07368 if(hBN>1) n4M/=hBN;
07369 curHadr->Set4Momentum(n4M);
07370 curHadr->SetQPDG(G4QPDGCode(PDGnu));
07371 if(hBN>1) for(G4int ih=1; ih<hBN; ih++)
07372 {
07373 G4QHadron* Hi = new G4QHadron(PDGnu,n4M);
07374 theQHadrons.push_back(Hi);
07375
07376 }
07377 if(nPi>1) k4M/=nPi;
07378 for(G4int ip=0; ip<nPi; ip++)
07379 {
07380 G4QHadron* Hj = new G4QHadron(PDGpi,k4M);
07381 theQHadrons.push_back(Hj);
07382 }
07383 }
07384 #ifdef fdebug
07385 G4cout<<"G4QEnv::FSI: Isonucleus decay result h#="<<hd<<", outPDG="<<hPDG<<G4endl;
07386 #endif
07387 }
07388 else if ( hBN > 1 &&
07389 ( (hBN == hCG && !hST) ||
07390 (!hCG && !hST) ||
07391 (!hCG && hST==hBN) ) )
07392 {
07393
07394 if(hPDG==90000003 && fabs(curHadr->Get4Momentum().m()-mNeut-mNeut)<.1) {
07395 hPDG=90000002;
07396 hBN=2;
07397 G4cout<<"--Warning--G4QEnv::FSI:3->2 neutrons conversion (***Check it***)"<<G4endl;
07398 }
07399
07400 if (!hCG&&!hST) hPDG=90000001;
07401 else if(hBN==hCG&&!hST) hPDG=90001000;
07402 else if(!hCG&&hST==hBN) hPDG=91000000;
07403 else {
07404
07405 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0018",
07406 FatalException, "MultyDibaryon cant be here");
07407 }
07408 G4LorentzVector newLV=(curHadr->Get4Momentum())/hBN;
07409 curHadr->Set4Momentum(newLV);
07410 curHadr->SetQPDG(G4QPDGCode(hPDG));
07411 for(G4int bd=1; bd<hBN; bd++)
07412 {
07413 G4QHadron* secHadr = new G4QHadron(curHadr);
07414 theQHadrons.push_back(secHadr);
07415
07416 }
07417 }
07418 else if(hST<0 && hBN>0)
07419 {
07420 G4LorentzVector r4M=curHadr->Get4Momentum();
07421 G4double reM=r4M.m();
07422 G4QContent nQC=curHadr->GetQC();
07423 G4QNucleus newN0(nQC-K0QC);
07424 G4int RPDG=newN0.GetPDG();
07425 G4double mR=newN0.GetMZNS();
07426 G4double mKaon=mK0;
07427 G4int kPDG =311;
07428 G4QNucleus newNp(nQC-KpQC);
07429 G4double mp=newNp.GetMZNS();
07430 if(mp+mK<mR+mK0)
07431 {
07432 mR=mp;
07433 RPDG=newNp.GetPDG();
07434 mKaon=mK;
07435 kPDG=321;
07436 }
07437 G4double sum=mR+mKaon;
07438 if(sum>reM)
07439 {
07440 if(kPDG==321)
07441 {
07442 kPDG=211;
07443 mKaon=mPi;
07444 }
07445 else
07446 {
07447 kPDG=111;
07448 mKaon=mPi0;
07449 }
07450 sum=mR+mKaon;
07451 }
07452 G4LorentzVector n4M(0.,0.,0.,mR);
07453 G4LorentzVector k4M(0.,0.,0.,mKaon);
07454 if(fabs(reM-sum)<eps)
07455 {
07456 n4M=r4M*(mR/sum);
07457 k4M=r4M*(mKaon/sum);
07458 }
07459 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,k4M))
07460 {
07461 #ifdef debug
07462
07463 G4cout<<"---Warning---G4QE::FSI: Try to recover ASN="<<hPDG<<","<<reM<<"<"<<mR<<"+"
07464 <<mKaon<<"="<<sum<<G4endl;
07465 #endif
07466 if(!theEnvironment.GetA())
07467 {
07468 G4QHadron* theLast = curHadr;
07469 G4QHadron* qH = new G4QHadron(curHadr);
07470 if(hd+1<theQHadrons.size())
07471 {
07472 theLast = theQHadrons[theQHadrons.size()-1];
07473 G4QPDGCode lQP=theLast->GetQPDG();
07474 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
07475 else curHadr->SetQC(theLast->GetQC());
07476 curHadr->Set4Momentum(theLast->Get4Momentum());
07477 }
07478 theQHadrons.pop_back();
07479 delete theLast;
07480 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
07481 if(!CheckGroundState(quasH,true))
07482 {
07483 qH->SetNFragments(-1);
07484 #ifdef debug
07485 G4cout<<"---Warning---G4QE::FSI:AntiStraN Failed LeaveAsItIs 4m="<<r4M<<G4endl;
07486 #endif
07487 theQHadrons.push_back(qH);
07488 }
07489 else
07490 {
07491 delete qH;
07492 nHadr=theQHadrons.size();
07493 }
07494 delete quasH;
07495 fOK=false;
07496 }
07497 else
07498 {
07499 G4ExceptionDescription ed;
07500 ed << "AntistrangeNucleus decayError: No Final AntiSN recovery, E="
07501 << theEnvironment << G4endl;
07502 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0019",
07503 FatalException, ed);
07504 }
07505 }
07506 if(fOK)
07507 {
07508 #ifdef fdebug
07509 G4cout<<"G4QE::FSI:AntiSN==>"<<r4M<<"->A="<<RPDG<<n4M<<"+K="<<kPDG<<k4M<<G4endl;
07510 #endif
07511 curHadr->Set4Momentum(k4M);
07512 curHadr->SetQPDG(G4QPDGCode(kPDG));
07513 G4QHadron* theRes = new G4QHadron(RPDG,n4M);
07514 EvaporateResidual(theRes);
07515 }
07516 }
07517
07518 else if(hPDG>90500000 && hPDG!=91000000 && hPDG!=91000999 && hPDG!=90999001 &&
07519 hPDG!=91999000 && hPDG!=91999999 && hPDG!=92998999 )
07520
07521 {
07522 #ifdef pdebug
07523 G4cout<<"***G4QEnvironment::FSI:*G4* Hypernucleus PDG="<<hPDG<<" must decay"<<G4endl;
07524 #endif
07525 G4int nL=curHadr->GetStrangeness();
07526 G4int nB=curHadr->GetBaryonNumber();
07527 G4int nC=curHadr->GetCharge();
07528 G4int nSM=0;
07529 G4int nSP=0;
07530 G4int nXZ=0;
07531 G4int nXM=0;
07532 G4int nOM=0;
07533
07534 if(nC < 0)
07535 {
07536 if(-nC <= nL)
07537 {
07538 if(nL <= nB)
07539 {
07540 nSM=-nC;
07541 nL+=nC;
07542 }
07543 else
07544 {
07545 G4int nX=nL-nB;
07546 if(-nC <= nX && nL >= nX+nX)
07547 {
07548 nXM=-nC;
07549 if(nXM != nX) nXZ=nX-nXM;
07550 nL-=nX+nX;
07551 }
07552 else if(nL >= nX-nC)
07553 {
07554 nXM=nX;
07555 nSM=-nC-nX;
07556 nL-=nX-nC;
07557 }
07558
07559 else G4cout<<"-Warning-G4QEn::FSI:*Improve*,-nC<=nL,nL>nB, PDG="<<hPDG<<G4endl;
07560 }
07561 }
07562 else
07563 {
07564 nSM=nL;
07565 nL=0;
07566 }
07567 }
07568 else if(nC>nB-nL)
07569 {
07570 if(nC<=nB)
07571 {
07572 if(nL <= nB)
07573 {
07574 G4int dH=nB-nC;
07575 nSP=nL-dH;
07576 nL=dH;
07577 }
07578 else if(nL<nB+nB)
07579 {
07580 nXZ=nL-nB;
07581 nL=nB-nL+nB;
07582 if(nC <= nL)
07583 {
07584 nSP=nC;
07585 nL-=nSP;
07586 }
07587 else
07588 {
07589 nSP=nL;
07590 nL=0;
07591 }
07592 }
07593 else if(nL > nB && ((nL-nB)/2)*2 == nL-nB && nC+nL <= nB+nB)
07594 {
07595 nOM=(nL-nB)/2;
07596 nL=nB+nB-nL-nC;
07597 nSP=nOM-nC;
07598 }
07599
07600 else G4cout<<"-Warning-G4QEn::FSI:*Improve*,nC>nB-nL,nC<=nB, PDG="<<hPDG<<G4endl;
07601 }
07602 else
07603 {
07604 nSP=nL;
07605 nL=0;
07606 }
07607 }
07608
07609 G4LorentzVector r4M=curHadr->Get4Momentum();
07610 G4double reM=r4M.m();
07611
07612 G4int SS=nL+nSP+nSM+nXZ+nXM;
07613 if(SS<nB && !nOM)
07614 {
07615 G4int rlPDG = hPDG-nL*1000000-nSP*1000999-nSM*999001;
07616 G4int sPDG=3122;
07617 G4double MLa=mLamb;
07618 #ifdef pdebug
07619 G4cout<<"G4QEnvironment::FSI:*G4* nS+="<<nSP<<", nS-="<<nSM<<", nL="<<nL<<G4endl;
07620 #endif
07621 if(nSP || nSM)
07622 {
07623 if(nL)
07624 {
07625
07626 G4cout<<"-Warning-G4QE::FSI:*Improve*,PDG="<<hPDG<<": both Sigma&Lamb"<<G4endl;
07627
07628 if(nSP) nL+=nSP;
07629 else nL+=nSM;
07630 }
07631 if(nSP)
07632 {
07633 nL=nSP;
07634 sPDG=3222;
07635 MLa=mSigP;
07636 }
07637 else
07638 {
07639 nL=nSM;
07640 sPDG=3112;
07641 MLa=mSigM;
07642 }
07643 }
07644 #ifdef pdebug
07645 G4cout<<"G4QEnvironment::FSI:*G4* mS="<<MLa<<", sPDG="<<sPDG<<", nL="<<nL<<G4endl;
07646 #endif
07647 if(nL>1) MLa*=nL;
07648 G4double rlM=G4QNucleus(rlPDG).GetMZNS();
07649 if(!nSP&&!nSM&&nL==1&&reM>rlM+mSigZ&&G4UniformRand()>.5)
07650 {
07651 sPDG=3212;
07652 MLa=mSigZ;
07653 }
07654 G4int rnPDG = hPDG-nL*999999;
07655 G4QNucleus rnN(rnPDG);
07656 G4double rnM=rnN.GetMZNS();
07657
07658 if(rlPDG==90000000)
07659 {
07660 if(nL>1) r4M=r4M/nL;
07661 for(G4int il=0; il<nL; il++)
07662 {
07663 G4QHadron* theLam = new G4QHadron(sPDG,r4M);
07664 theQHadrons.push_back(theLam);
07665 }
07666 }
07667 else if(reM>rlM+MLa-eps)
07668 {
07669 G4LorentzVector n4M(0.,0.,0.,rlM);
07670 G4LorentzVector h4M(0.,0.,0.,MLa);
07671 G4double sum=rlM+MLa;
07672 if(fabs(reM-sum)<eps)
07673 {
07674 n4M=r4M*(rlM/sum);
07675 h4M=r4M*(MLa/sum);
07676 }
07677 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
07678 {
07679 G4ExceptionDescription ed;
07680 ed << "Hypernuclear L-decay error: Hypern, M=" << reM << "<A+n*L="
07681 << sum << ",d=" << sum-reM << G4endl;
07682 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0020",
07683 FatalException, ed);
07684 }
07685 #ifdef pdebug
07686 G4cout<<"*G4QE::FSI:HypN="<<r4M<<"->A="<<rlPDG<<n4M<<",n*Lamb="<<nL<<h4M<<G4endl;
07687 #endif
07688 curHadr->Set4Momentum(n4M);
07689 curHadr->SetQPDG(G4QPDGCode(rlPDG));
07690 if(rlPDG==90000002)
07691 {
07692 G4LorentzVector newLV=n4M/2.;
07693 curHadr->Set4Momentum(newLV);
07694 curHadr->SetQPDG(G4QPDGCode(90000001));
07695 G4QHadron* secHadr = new G4QHadron(curHadr);
07696 theQHadrons.push_back(secHadr);
07697 }
07698 else if(rlPDG==90002000)
07699 {
07700 G4LorentzVector newLV=n4M/2.;
07701 curHadr->Set4Momentum(newLV);
07702 curHadr->SetQPDG(G4QPDGCode(90001000));
07703 G4QHadron* secHadr = new G4QHadron(curHadr);
07704 theQHadrons.push_back(secHadr);
07705 }
07706
07707 #ifdef pdebug
07708 G4cout<<"*G4QE::FSI: resNucPDG="<<curHadr->GetPDGCode()<<G4endl;
07709 #endif
07710 if(nL>1) h4M=h4M/nL;
07711 for(G4int il=0; il<nL; il++)
07712 {
07713 G4QHadron* theLamb = new G4QHadron(sPDG,h4M);
07714 theQHadrons.push_back(theLamb);
07715 }
07716 }
07717 else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)
07718 {
07719 G4int nPi=static_cast<G4int>((reM-rnM)/mPi0);
07720 if (nPi>nL) nPi=nL;
07721 G4double npiM=nPi*mPi0;
07722 G4LorentzVector n4M(0.,0.,0.,rnM);
07723 G4LorentzVector h4M(0.,0.,0.,npiM);
07724 G4double sum=rnM+npiM;
07725 if(fabs(reM-sum)<eps)
07726 {
07727 n4M=r4M*(rnM/sum);
07728 h4M=r4M*(npiM/sum);
07729 }
07730 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
07731 {
07732 G4ExceptionDescription ed;
07733 ed << "Hypernuclear decay error: HyperN,M=" << reM << "<A+n*Pi0="
07734 << sum << ",d=" << sum-reM << G4endl;
07735 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0021",
07736 FatalException, ed);
07737 }
07738 curHadr->Set4Momentum(n4M);
07739 curHadr->SetQPDG(G4QPDGCode(rnPDG));
07740 #ifdef pdebug
07741 G4cout<<"*G4QE::FSI:HypN "<<r4M<<"->A="<<rnPDG<<n4M<<",n*Pi0="<<nPi<<h4M<<G4endl;
07742 #endif
07743 if(nPi>1) h4M=h4M/nPi;
07744 for(G4int ihn=0; ihn<nPi; ihn++)
07745 {
07746 G4QHadron* thePion = new G4QHadron(111,h4M);
07747 theQHadrons.push_back(thePion);
07748
07749 }
07750 if(rnPDG==90000002)
07751 {
07752 G4LorentzVector newLV=n4M/2.;
07753 curHadr->Set4Momentum(newLV);
07754 curHadr->SetQPDG(G4QPDGCode(90000001));
07755 G4QHadron* secHadr = new G4QHadron(curHadr);
07756 theQHadrons.push_back(secHadr);
07757
07758 }
07759 else if(rnPDG==90002000)
07760 {
07761 G4LorentzVector newLV=n4M/2.;
07762 curHadr->Set4Momentum(newLV);
07763 curHadr->SetQPDG(G4QPDGCode(90001000));
07764 G4QHadron* secHadr = new G4QHadron(curHadr);
07765 theQHadrons.push_back(secHadr);
07766
07767 }
07768
07769 }
07770 else if(reM>rnM-eps)
07771 {
07772 G4LorentzVector n4M(0.,0.,0.,rnM);
07773 G4LorentzVector h4M(0.,0.,0.,0.);
07774 G4double sum=rnM;
07775 if(fabs(reM-sum)<eps) n4M=r4M;
07776 else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
07777 {
07778 G4ExceptionDescription ed;
07779 ed << "Hypernuclear GammaDecay error: Hypern,M=" << reM << "<A+n*Pi0="
07780 << sum << ",d=" << sum-reM << G4endl;
07781 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0022",
07782 FatalException, ed);
07783 }
07784 curHadr->Set4Momentum(n4M);
07785 curHadr->SetQPDG(G4QPDGCode(rnPDG));
07786 #ifdef pdebug
07787 G4cout<<"*G4QE::FSI:HypNg "<<r4M<<"->A="<<rnPDG<<n4M<<",gamma="<<h4M<<G4endl;
07788 #endif
07789 G4QHadron* theGamma = new G4QHadron(22,h4M);
07790 theQHadrons.push_back(theGamma);
07791 if(rnPDG==90000002)
07792 {
07793 G4LorentzVector newLV=n4M/2.;
07794 curHadr->Set4Momentum(newLV);
07795 curHadr->SetQPDG(G4QPDGCode(90000001));
07796 G4QHadron* secHadr = new G4QHadron(curHadr);
07797 theQHadrons.push_back(secHadr);
07798
07799 }
07800 else if(rnPDG==90002000)
07801 {
07802 G4LorentzVector newLV=n4M/2.;
07803 curHadr->Set4Momentum(newLV);
07804 curHadr->SetQPDG(G4QPDGCode(90001000));
07805 G4QHadron* secHadr = new G4QHadron(curHadr);
07806 theQHadrons.push_back(secHadr);
07807
07808 }
07809
07810 }
07811 #ifdef pdebug
07812 else
07813 {
07814 G4cout<<"-Warning-G4QEnv::F:R="<<rlM<<",S+="<<nSP<<",S-="<<nSM<<",L="<<nL<<",d1="
07815 <<rlM+MLa-reM<<G4endl;
07816 G4cout<<"-Warning-G4QEnv::FSI:HyperN="<<hPDG<<", M="<<reM<<"<"<<rnM+mPi0<<", d2="
07817 <<rnM+mPi0-reM<<G4endl;
07818
07819 }
07820 #endif
07821 }
07822 else if(SS==nB && !nOM)
07823 {
07824 #ifdef pdebug
07825 G4cout<<"G4QEnvironment::FSI:OnlyHyp,B="<<nB<<",SP="<<nSP<<",SM="<<nSM<<",L="<<nL
07826 <<",XM="<<nXM<<",XZ="<<nXZ<<G4endl;
07827 #endif
07828 G4int SP=0;
07829 if(nL) ++SP;
07830 if(nSP) ++SP;
07831 if(nSM) ++SP;
07832 if(nXZ) ++SP;
07833 if(nXM) ++SP;
07834 if(SP>1 && SP<4)
07835 {
07836 G4int fPDG=3122;
07837 G4double fM=mLamb;
07838 G4int fS=nL;
07839 G4int sPDG=3222;
07840 G4double sM=mSigP;
07841 G4int sS=nSP;
07842 G4int uPDG=3322;
07843 G4double uM=mXiZ;
07844 G4int uS=nSP;
07845 if(nL)
07846 {
07847 if(nSM)
07848 {
07849 sPDG=3112;
07850 sM =mSigM;
07851 sS =nSM;
07852 if(SP==3)
07853 {
07854 if(nXM)
07855 {
07856 uPDG=3312;
07857 uM =mXiM;
07858 uS =nXM;
07859 }
07860 }
07861 }
07862 else if(nXZ)
07863 {
07864 sPDG=3322;
07865 sM =mXiZ;
07866 sS =nXZ;
07867 if(SP==3)
07868 {
07869 if(nSP)
07870 {
07871 uPDG=3222;
07872 uM =mSigP;
07873 uS =nSP;
07874 }
07875 else if(nXM)
07876 {
07877 uPDG=3312;
07878 uM =mXiM;
07879 uS =nXM;
07880 }
07881 }
07882 }
07883 else if(nXM)
07884 {
07885 sPDG=3312;
07886 sM =mXiM;
07887 sS =nXM;
07888
07889 }
07890 else if(SP==3)
07891 {
07892 if(nXZ)
07893 {
07894 uPDG=3322;
07895 uM =mXiZ;
07896 uS =nXZ;
07897 }
07898 else G4cout<<"-Warning-G4QE::FSI: *Improve* StrangeComb, PDG="<<hPDG<<G4endl;
07899 }
07900 }
07901 else if(nSM)
07902 {
07903 fPDG=3112;
07904 fM =mSigM;
07905 fS =nSM;
07906 if(nXZ)
07907 {
07908 sPDG=3322;
07909 sM =mXiZ;
07910 sS =nXZ;
07911 if(SP==3)
07912 {
07913 if(nXM)
07914 {
07915 uPDG=3312;
07916 uM =mXiM;
07917 uS =nXM;
07918 }
07919 else if(nXZ)
07920 {
07921 uPDG=3322;
07922 uM =mXiZ;
07923 uS =nXZ;
07924 }
07925 }
07926 }
07927 else if(nXM)
07928 {
07929 sPDG=3312;
07930 sM =mXiM;
07931 sS =nXM;
07932 }
07933 }
07934 else if(nSP)
07935 {
07936 fPDG=3222;
07937 fM =mSigP;
07938 fS =nSP;
07939 if(nXZ)
07940 {
07941 sPDG=3322;
07942 sM =mXiZ;
07943 sS =nXZ;
07944 if(SP==3)
07945 {
07946 if(nXZ)
07947 {
07948 uPDG=3322;
07949 uM =mXiZ;
07950 uS =nXZ;
07951 }
07952 }
07953 }
07954 else if(nXM)
07955 {
07956 sPDG=3312;
07957 sM =mXiM;
07958 sS =nXM;
07959 }
07960 }
07961 else if(nXZ)
07962 {
07963 fPDG=3322;
07964 fM =mXiZ;
07965 fS =nXZ;
07966 if(nXM)
07967 {
07968 sPDG=3312;
07969 sM =mXiM;
07970 sS =nXM;
07971 }
07972 }
07973 else G4cout<<"-Warning-G4QE::FSI: *Improve* StrangeFragment, PDG="<<hPDG<<G4endl;
07974
07975 if(SP==2)
07976 {
07977 #ifdef pdebug
07978 G4cout<<"G4QEnvironment::FSI:2HypD,fS="<<fS<<",fPDG="<<sPDG<<",fM="<<fM<<",sS="
07979 <<sS<<",sPDG="<<sPDG<<",sM="<<sM<<",rM="<<reM<<G4endl;
07980 #endif
07981 fM*=fS;
07982 sM*=sS;
07983 G4double mm_value=fM+sM;
07984 G4double MM=reM+eps;
07985 if(MM<=mm_value && fPDG==3122 && sPDG==3222)
07986 {
07987 fPDG= 2212;
07988 fM = mProt;
07989 sPDG= 3322;
07990 sM = mXiZ;
07991 mm_value = fM+sM;
07992 }
07993 if(MM>mm_value)
07994 {
07995 G4LorentzVector f4M(0.,0.,0.,fM);
07996 G4LorentzVector s4M(0.,0.,0.,sM);
07997 G4double sum=fM+sM;
07998 if(fabs(reM-sum)<=eps)
07999 {
08000 f4M=r4M*(fM/sum);
08001 s4M=r4M*(sM/sum);
08002 }
08003 else if(reM<sum || !G4QHadron(r4M).DecayIn2(f4M,s4M))
08004 {
08005
08006
08007 G4ExceptionDescription ed;
08008 ed << "HypernucOnlyStran2 error: Hyp2,M=" << reM << "< sum=" << sum
08009 << ",d=" << sum-reM << G4endl;
08010 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0023",
08011 FatalException, ed);
08012 }
08013 #ifdef pdebug
08014 G4cout<<"G4QEnv::FSI:2,HN="<<r4M<<hPDG<<"->First="<<fS<<f4M<<fPDG<<",Second="
08015 <<sS<<s4M<<sPDG<<G4endl;
08016 #endif
08017 if(fS>1)
08018 {
08019 f4M/=fS;
08020 for(G4int il=1; il<fS; il++)
08021 {
08022 G4QHadron* theHyp = new G4QHadron(fPDG,f4M);
08023 theQHadrons.push_back(theHyp);
08024 }
08025 }
08026 curHadr->Set4Momentum(f4M);
08027 curHadr->SetQPDG(G4QPDGCode(fPDG));
08028 if(sS>1) s4M/=sS;
08029 for(G4int il=0; il<sS; il++)
08030 {
08031 G4QHadron* theHyp = new G4QHadron(sPDG,s4M);
08032 theQHadrons.push_back(theHyp);
08033 }
08034 }
08035
08036 else G4cout<<"-Warning-G4QE::FSI:*Improve* S2, PDG="<<hPDG<<",M="<<reM<<",fS="
08037 <<fS<<",sS="<<sS<<",fM="<<fM<<",sM="<<sM<<G4endl;
08038 }
08039 else
08040 {
08041 #ifdef pdebug
08042 G4cout<<"G4QEnvironment::FSI:3HypD,fS="<<fS<<",fPDG="<<sPDG<<",fM="<<fM<<",sS="
08043 <<sS<<",sPDG="<<sPDG<<",fM="<<fM<<",uS="<<sS<<",uPDG="<<sPDG<<",uM="<<sM
08044 <<",rM="<<reM<<G4endl;
08045 #endif
08046 fM*=fS;
08047 sM*=sS;
08048 uM*=sS;
08049 G4double mm_value=fM+sM+uM;
08050 G4double MM=reM+eps;
08051
08052
08053
08054
08055
08056
08057
08058
08059
08060 if(MM>mm_value)
08061 {
08062 G4LorentzVector f4M(0.,0.,0.,fM);
08063 G4LorentzVector s4M(0.,0.,0.,sM);
08064 G4LorentzVector u4M(0.,0.,0.,uM);
08065 G4double sum=fM+sM+uM;
08066 if(fabs(reM-sum)<=eps)
08067 {
08068 f4M=r4M*(fM/sum);
08069 s4M=r4M*(sM/sum);
08070 u4M=r4M*(uM/sum);
08071 }
08072 else if(reM<sum || !G4QHadron(r4M).DecayIn2(f4M,s4M))
08073 {
08074 G4ExceptionDescription ed;
08075 ed << "HypernucOnlyStran3 error: Hyp3,M=" << reM << "< sum="
08076 << sum << ",d=" << sum-reM << G4endl;
08077 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0024",
08078 FatalException, ed);
08079 }
08080 #ifdef pdebug
08081 G4cout<<"G4QEnv::FSI:3,HN="<<r4M<<hPDG<<"->First="<<fS<<f4M<<fPDG<<",Second="
08082 <<sS<<s4M<<sPDG<<",Third="<<fS<<f4M<<fPDG<<G4endl;
08083 #endif
08084 if(fS>1)
08085 {
08086 f4M/=fS;
08087 for(G4int il=1; il<fS; ++il)
08088 {
08089 G4QHadron* theHyp = new G4QHadron(fPDG,f4M);
08090 theQHadrons.push_back(theHyp);
08091 }
08092 }
08093 curHadr->Set4Momentum(f4M);
08094 curHadr->SetQPDG(G4QPDGCode(fPDG));
08095 if(sS>1) s4M/=sS;
08096 for(G4int il=0; il<sS; ++il)
08097 {
08098 G4QHadron* theHyp = new G4QHadron(sPDG,s4M);
08099 theQHadrons.push_back(theHyp);
08100 }
08101 if(uS>1) u4M/=uS;
08102 for(G4int il=0; il<uS; ++il)
08103 {
08104 G4QHadron* theHyp = new G4QHadron(uPDG,u4M);
08105 theQHadrons.push_back(theHyp);
08106 }
08107 }
08108
08109 else G4cout<<"-Warn-G4QE::FSI:*Improve* S3, PDG="<<hPDG<<",M="<<reM<<",fS="<<fS
08110 <<",sS="<<sS<<",uS="<<uS<<",fM="<<fM<<",sM="<<sM<<",uM="<<uM<<G4endl;
08111 }
08112 }
08113 }
08114 else if(nOM)
08115 {
08116 #ifdef pdebug
08117 G4cout<<"G4QEnvir::FSI:Omega-,B="<<nB<<",SP="<<nSP<<",OM="<<nOM<<",L="<<nL<<G4endl;
08118 #endif
08119 G4int SP=0;
08120 if(nL) ++SP;
08121 if(nSP) ++SP;
08122 if(nOM) ++SP;
08123 if(!nL)
08124 {
08125 G4int fPDG= 3334;
08126 G4double fM = mOmM;
08127 G4int fS = nOM;
08128 G4int sPDG= 3222;
08129 G4double sM = mSigP;
08130 G4int sS = nSP;
08131 #ifdef pdebug
08132 G4cout<<"G4QEnvironment::FSI:2HypD,fS="<<fS<<",fPDG="<<sPDG<<",fM="<<fM<<",sS="
08133 <<sS<<",sPDG="<<sPDG<<",sM="<<sM<<",rM="<<reM<<G4endl;
08134 #endif
08135 fM*=fS;
08136 sM+=sS;
08137 if(reM>fM+sM-eps)
08138 {
08139 G4LorentzVector f4M(0.,0.,0.,fM);
08140 G4LorentzVector s4M(0.,0.,0.,sM);
08141 G4double sum=fM+sM;
08142 if(fabs(reM-sum)<eps)
08143 {
08144 f4M=r4M*(fM/sum);
08145 s4M=r4M*(sM/sum);
08146 }
08147 else if(reM<sum || !G4QHadron(r4M).DecayIn2(f4M,s4M))
08148 {
08149 G4ExceptionDescription ed;
08150 ed << "HypernucOnlyStran3 error: Hyp,M=" << reM << "<OM+SP="
08151 << sum << ",d=" << sum-reM << G4endl;
08152 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0025",
08153 FatalException, ed);
08154 }
08155 #ifdef pdebug
08156 G4cout<<"G4QEnv::FSI:OHNuc="<<r4M<<hPDG<<"->First="<<fS<<f4M<<fPDG<<",Second="
08157 <<sS<<s4M<<sPDG<<G4endl;
08158 #endif
08159 if(fS>1)
08160 {
08161 f4M/=fS;
08162 for(G4int il=1; il<fS; il++)
08163 {
08164 G4QHadron* theHyp = new G4QHadron(fPDG,f4M);
08165 theQHadrons.push_back(theHyp);
08166 }
08167 }
08168 curHadr->Set4Momentum(f4M);
08169 curHadr->SetQPDG(G4QPDGCode(fPDG));
08170 if(sS>1) s4M/=sS;
08171 for(G4int il=0; il<sS; il++)
08172 {
08173 G4QHadron* theHyp = new G4QHadron(sPDG,s4M);
08174 theQHadrons.push_back(theHyp);
08175 }
08176 }
08177
08178 else G4cout<<"-Warning-G4QE::FSI:*Improve* OMSP, PDG="<<hPDG<<",M="<<reM<<",nSP="
08179 <<nSP<<",nOM="<<nOM<<",mOM="<<fM<<",mSP="<<sM<<G4endl;
08180 }
08181
08182 else G4cout<<"-Warning-G4QE::FSI:*Improve* nLamb="<<nL<<" # 0, PDG="<<hPDG<<G4endl;
08183 }
08184
08185 else G4cout<<"-Warning-G4QE::FSI:*Improve*,S="<<SS<<">B="<<nB<<",PDG="<<hPDG<<G4endl;
08186 }
08187 if(!fOK) hd--;
08188 }
08189 #ifdef pdebug
08190 G4cout<<"G4QE::FSI:==>OUT,nH="<<theQHadrons.size()<<",nF="<<theFragments->size()<<G4endl;
08191 #endif
08192
08193
08194 nHadr=theQHadrons.size();
08195 G4int cfContSum=0;
08196 G4int bfContSum=0;
08197 if(nHadr)for(unsigned f=0; f<nHadr; f++)
08198 {
08199 G4QHadron* curHadr = new G4QHadron(theQHadrons[f]);
08200 #ifdef debug
08201 G4cout<<"G4QE::FSI:#"<<f<<curHadr->Get4Momentum()<<curHadr->GetPDGCode()<<G4endl;
08202 #endif
08203 if(!(curHadr->GetNFragments()))
08204 {
08205 G4int chg=curHadr->GetCharge();
08206 cfContSum+=chg;
08207 G4int brn=curHadr->GetBaryonNumber();
08208 bfContSum+=brn;
08209 G4int str=curHadr->GetStrangeness();
08210 if ( brn > 1 &&
08211 ( (!str && (chg == brn || !chg)) ||
08212 (!chg && str == brn) ) )
08213 {
08214 G4int bPDG=90000001;
08215 if (chg==brn) bPDG=90001000;
08216 else if(str==brn) bPDG=91000000;
08217 G4LorentzVector sp4m=curHadr->Get4Momentum()/brn;
08218 curHadr->Set4Momentum(sp4m);
08219 curHadr->SetQPDG(G4QPDGCode(bPDG));
08220 for (G4int ib=1; ib<brn; ib++)
08221 {
08222 G4QHadron* bH = new G4QHadron(bPDG, sp4m);
08223 theFragments->push_back(bH);
08224 }
08225 }
08226 theFragments->push_back(curHadr);
08227 }
08228 }
08229 #ifdef chdebug
08230 if(cfContSum-chContSum || bfContSum-bnContSum)
08231 {
08232 G4ExceptionDescription ed;
08233 ed << "::(F) Charge is not conserved: Ch=" << cfContSum-chContSum << ",Bn="
08234 << bfContSum-bnContSum << G4endl;
08235 G4Exception("G4QEnvironment::FSInteraction()", "HAD_CHPS_0026",
08236 FatalException, ed);
08237 }
08238 #endif
08239
08240 return theFragments;
08241 }
08242
08243
08244 G4QuasmonVector* G4QEnvironment::GetQuasmons()
08245 {
08246 G4int nQ=theQuasmons.size();
08247 #ifdef debug
08248 G4cout<<"G4QEnvironment::GetQuasmons is called nQ="<<nQ<<G4endl;
08249 #endif
08250 G4QuasmonVector* quasmons = new G4QuasmonVector;
08251 if(nQ) for(G4int iq=0; iq<nQ; iq++)
08252 {
08253 #ifdef debug
08254 G4cout<<"G4QEnv::GetQuasm:Q#"<<iq<<",QQPDG="<<theQuasmons[iq]->GetQPDG()<<",QQC="
08255 <<theQuasmons[iq]->GetQC()<<",M="<<theQuasmons[iq]->Get4Momentum().m()<<G4endl;
08256 #endif
08257 G4Quasmon* curQ = new G4Quasmon(theQuasmons[iq]);
08258 quasmons->push_back(curQ);
08259 }
08260 #ifdef debug
08261 G4cout<<"G4QEnvironment::GetQuasmons ===OUT==="<<G4endl;
08262 #endif
08263 return quasmons;
08264 }
08265
08266
08267 G4QHadronVector* G4QEnvironment::GetQHadrons()
08268 {
08269 G4int nH=theQHadrons.size();
08270 #ifdef debug
08271 G4cout<<"G4QEnvironment::GetQHadrons is called nH="<<nH<<G4endl;
08272 #endif
08273 G4QHadronVector* hadrons = new G4QHadronVector;
08274 if(nH) for(G4int ih=0; ih<nH; ih++)
08275 {
08276 #ifdef debug
08277 G4cout<<"G4QEnv::GetQHadrons:H#"<<ih<<",HQPDG="<<theQHadrons[ih]->GetQPDG()<<",HQC="
08278 <<theQHadrons[ih]->GetQC()<<",HM="<<theQHadrons[ih]->GetMass()<<G4endl;
08279 #endif
08280 G4QHadron* curH = new G4QHadron(theQHadrons[ih]);
08281 hadrons->push_back(curH);
08282 }
08283 #ifdef debug
08284 G4cout<<"G4QEnvironment::GetQHadrons ===OUT=== Copied nQH="<<hadrons->size()<<G4endl;
08285 #endif
08286 return hadrons;
08287 }
08288
08289
08290 void G4QEnvironment::CleanUpQHadrons()
08291 {
08292 for_each(theQHadrons.begin(), theQHadrons.end(), DeleteQHadron());
08293 theQHadrons.clear();
08294 }
08295
08296
08297 void G4QEnvironment::FillQHadrons(G4QHadronVector* input)
08298 {
08299 G4int nH=input->size();
08300 #ifdef debug
08301 G4cout<<"G4QEnvironment::FillQHadrons is called nH="<<nH<<G4endl;
08302 #endif
08303 if(nH) for(G4int ih=0; ih<nH; ih++)
08304 {
08305 #ifdef debug
08306 G4cout<<"G4QEnv::FillQHadrons:H#"<<ih<<",HQPDG="<<(*input)[ih]->GetQPDG()<<",HQC="
08307 <<(*input)[ih]->GetQC()<<",HM="<<(*input)[ih]->GetMass()<<G4endl;
08308 #endif
08309 G4QHadron* curH = new G4QHadron((*input)[ih]);
08310 theQHadrons.push_back(curH);
08311 }
08312 #ifdef debug
08313 G4cout<<"G4QEnvironment::FillQHadrons ===OUT=== Filled nQH="<<theQHadrons.size()<<G4endl;
08314 #endif
08315 }
08316
08317
08318 void G4QEnvironment::DecayBaryon(G4QHadron* qH, G4QHadronVector* HV)
08319 {
08320 static const G4QPDGCode gQPDG(22);
08321 static const G4QPDGCode pizQPDG(111);
08322 static const G4QPDGCode pipQPDG(211);
08323 static const G4QPDGCode pimQPDG(-211);
08324 static const G4QPDGCode kmQPDG(-321);
08325 static const G4QPDGCode kzQPDG(-311);
08326 static const G4QPDGCode nQPDG(2112);
08327 static const G4QPDGCode pQPDG(2212);
08328 static const G4QPDGCode lQPDG(3122);
08329 static const G4QPDGCode laQPDG(3122);
08330 static const G4QPDGCode smQPDG(3112);
08331 static const G4QPDGCode szQPDG(3212);
08332 static const G4QPDGCode spQPDG(3222);
08333 static const G4QPDGCode kszQPDG(3322);
08334 static const G4QPDGCode ksmQPDG(3312);
08335 static const G4double mPi = G4QPDGCode(211).GetMass();
08336 static const G4double mPi0 = G4QPDGCode(111).GetMass();
08337 static const G4double mK = G4QPDGCode(321).GetMass();
08338 static const G4double mK0 = G4QPDGCode(311).GetMass();
08339 static const G4double mNeut= G4QPDGCode(2112).GetMass();
08340 static const G4double mProt= G4QPDGCode(2212).GetMass();
08341 static const G4double mSigM= G4QPDGCode(3112).GetMass();
08342 static const G4double mLamb= G4QPDGCode(3122).GetMass();
08343 static const G4double mSigZ= G4QPDGCode(3212).GetMass();
08344 static const G4double mSigP= G4QPDGCode(3222).GetMass();
08345
08346
08347
08348 static const G4double mNPi0 = mPi0+ mNeut;
08349 static const G4double mNPi = mPi + mNeut;
08350 static const G4double mPPi0 = mPi0+ mProt;
08351 static const G4double mPPi = mPi + mProt;
08352 static const G4double mLPi0 = mPi0+ mLamb;
08353 static const G4double mLPi = mPi + mLamb;
08354 static const G4double mSpPi = mPi + mSigP;
08355 static const G4double mSmPi = mPi + mSigM;
08356 static const G4double mPK = mK + mProt;
08357 static const G4double mPKZ = mK0 + mProt;
08358 static const G4double mNKZ = mK0 + mNeut;
08359 static const G4double mSpPi0= mPi0+ mSigP;
08360 static const G4double mSzPi0= mPi0+ mSigZ;
08361 static const G4double mSzPi = mPi + mSigZ;
08362 static const G4double eps = 0.003;
08363
08364 G4int theLB= qH->GetBaryonNumber();
08365 if(theLB!=1)
08366 {
08367 G4cerr<<"***G4QEnvironment::DecayBaryon: A!=1 -> fill as it is"<<G4endl;
08368 #ifdef ppdebug
08369
08370 G4Exception("G4QEnvironment::DecayBaryon()", "HAD_CHPS_0000",
08371 FatalException, "Unknown Baryon with A!=1");
08372 #endif
08373 HV->push_back(qH);
08374 return;
08375 }
08376 G4int theLC= qH->GetCharge();
08377 G4int theLS= qH->GetStrangeness();
08378
08379 G4LorentzVector q4M = qH->Get4Momentum();
08380 G4double qM = q4M.m();
08381 #ifdef debug
08382 G4cout<<"G4QEnv::DecayBaryon: *Called* S="<<theLS<<",C="<<theLC<<",4M="<<q4M<<qM<<G4endl;
08383 #endif
08384
08385 G4QPDGCode fQPDG = pQPDG;
08386 G4double fMass= mProt;
08387 G4QPDGCode sQPDG = pizQPDG;
08388 G4double sMass= mPi0;
08389 if(!theLS)
08390 {
08391 if(!theLC)
08392 {
08393 if(qM<mNPi0)
08394 {
08395 if(qM < mNeut+eps)
08396 {
08397 #ifdef debug
08398 G4cout<<"G4QEnv::DecayBaryon: Fill Neutron AsIs"<<G4endl;
08399 #endif
08400 qH->SetQPDG(nQPDG);
08401 HV->push_back(qH);
08402 if(qM+eps<mNeut) G4cout<<"-Warning-G4QEnv::DecayBaryon: N0 AsIs, M="<<qM<<G4endl;
08403 return;
08404 }
08405 fQPDG=nQPDG;
08406 fMass=mNeut;
08407 sQPDG=gQPDG;
08408 sMass=0.;
08409 #ifdef debug
08410 G4cout<<"-Warning-G4QEnv::DecayBaryon: Gamma+n, M="<<qM<<",d="<<qM-mNeut<<G4endl;
08411 #endif
08412 }
08413 else if(qM>mPPi)
08414 {
08415 if(G4UniformRand()>.333333333)
08416 {
08417 fQPDG=nQPDG;
08418 fMass=mNeut;
08419 }
08420 else
08421 {
08422 sQPDG=pimQPDG;
08423 sMass=mPi;
08424 }
08425 }
08426 else
08427 {
08428 fQPDG=nQPDG;
08429 fMass=mNeut;
08430 }
08431 }
08432 else if(theLC==1)
08433 {
08434 if(qM<mPPi0)
08435 {
08436 if(qM < mProt+eps)
08437 {
08438 #ifdef debug
08439 G4cout<<"G4QEnv::DecayBaryon: Fill Proton AsIs"<<G4endl;
08440 #endif
08441 qH->SetQPDG(pQPDG);
08442 HV->push_back(qH);
08443 #ifdef debug
08444 if(qM+eps<mProt)G4cout<<"-Warning-G4QEnv::DecayBaryon: Pr+ AsIs, M="<<qM<<G4endl;
08445 #endif
08446 return;
08447 }
08448 sQPDG=gQPDG;
08449 sMass=0.;
08450 }
08451 else if(qM>mNPi)
08452 {
08453 if(G4UniformRand()<.333333333)
08454 {
08455 fQPDG=nQPDG;
08456 fMass=mNeut;
08457 sQPDG=pipQPDG;
08458 sMass=mPi;
08459 }
08460
08461 }
08462
08463 }
08464 else if(theLC==2)
08465 {
08466 if(qM>mPPi)
08467 {
08468 sQPDG=pipQPDG;
08469 sMass=mPi;
08470 }
08471 else
08472 {
08473 #ifdef debug
08474 G4cout<<"-Warning-G4QE::DecBary:*AsIs* DEL++ M="<<qM<<"<"<<mPPi<<G4endl;
08475 #endif
08476 HV->push_back(qH);
08477 return;
08478 }
08479 }
08480 else if(theLC==-1)
08481 {
08482 if(qM+eps>mNPi)
08483 {
08484 fQPDG=nQPDG;
08485 fMass=mNeut;
08486 sQPDG=pimQPDG;
08487 sMass=mPi;
08488 }
08489 else
08490 {
08491 #ifdef debug
08492 G4cout<<"-Warning-G4QE::DecBary:*AsIs* DEL++ M="<<qM<<"<"<<mNPi<<G4endl;
08493 #endif
08494 HV->push_back(qH);
08495 return;
08496 }
08497 }
08498 else
08499 {
08500 #ifdef debug
08501 G4cout<<"-Warning-G4QE::DecBary:*AsIs* UnknBaryon (S=0) QC="<<qH->GetQC()<<G4endl;
08502 #endif
08503 HV->push_back(qH);
08504 return;
08505 }
08506 }
08507 else if(theLS==1)
08508 {
08509 if(!theLC)
08510 {
08511 if(qM<mLPi0)
08512 {
08513 if(qM < mLamb+eps)
08514 {
08515 #ifdef debug
08516 G4cout<<"G4QEnv::DecayBaryon: Fill Lambda AsIs"<<G4endl;
08517 #endif
08518 qH->SetQPDG(lQPDG);
08519 HV->push_back(qH);
08520 if(qM+eps<mLamb)G4cout<<"-Warning-G4QEnv::DecayBaryon: La0 AsIs, M="<<qM<<G4endl;
08521 return;
08522 }
08523 fQPDG=lQPDG;
08524 fMass=mLamb;
08525 sQPDG=gQPDG;
08526 sMass=0.;
08527 }
08528 else if(qM<mSzPi0)
08529 {
08530 fQPDG=lQPDG;
08531 fMass=mLamb;
08532 }
08533 else if(qM<mSpPi)
08534 {
08535 if(G4UniformRand()>.6)
08536 {
08537 fQPDG=szQPDG;
08538 fMass=mSigZ;
08539 }
08540 else
08541 {
08542 fQPDG=lQPDG;
08543 fMass=mLamb;
08544 }
08545 }
08546 else if(qM<mSmPi)
08547 {
08548 G4double ra=G4UniformRand();
08549 if(ra<.4)
08550 {
08551 fQPDG=lQPDG;
08552 fMass=mLamb;
08553 }
08554 else if(ra<.7)
08555 {
08556 fQPDG=szQPDG;
08557 fMass=mSigZ;
08558 }
08559 else
08560 {
08561 fQPDG=spQPDG;
08562 fMass=mSigP;
08563 sQPDG=pimQPDG;
08564 sMass=mPi;
08565 }
08566 }
08567 else if(qM<mPK)
08568 {
08569 G4double ra=G4UniformRand();
08570 if(ra<.35)
08571 {
08572 fQPDG=lQPDG;
08573 fMass=mLamb;
08574 }
08575 else if(ra<.6)
08576 {
08577 fQPDG=szQPDG;
08578 fMass=mSigZ;
08579 }
08580 else if(ra<.8)
08581 {
08582 fQPDG=smQPDG;
08583 fMass=mSigM;
08584 sQPDG=pipQPDG;
08585 sMass=mPi;
08586 }
08587 else
08588 {
08589 fQPDG=spQPDG;
08590 fMass=mSigP;
08591 sQPDG=pimQPDG;
08592 sMass=mPi;
08593 }
08594 }
08595 else if(qM<mNKZ)
08596 {
08597 G4double ra=G4UniformRand();
08598 if(ra<.3)
08599 {
08600 fQPDG=lQPDG;
08601 fMass=mLamb;
08602 }
08603 else if(ra<.5)
08604 {
08605 fQPDG=szQPDG;
08606 fMass=mSigZ;
08607 }
08608 else if(ra<.7)
08609 {
08610 fQPDG=smQPDG;
08611 fMass=mSigM;
08612 sQPDG=pipQPDG;
08613 sMass=mPi;
08614 }
08615 else if(ra<.9)
08616 {
08617 fQPDG=spQPDG;
08618 fMass=mSigP;
08619 sQPDG=pimQPDG;
08620 sMass=mPi;
08621 }
08622 else
08623 {
08624 fQPDG=pQPDG;
08625 fMass=mProt;
08626 sQPDG=kmQPDG;
08627 sMass=mK;
08628 }
08629 }
08630 else
08631 {
08632 G4double ra=G4UniformRand();
08633 if(ra<.3)
08634 {
08635 fQPDG=lQPDG;
08636 fMass=mLamb;
08637 }
08638 else if(ra<.5)
08639 {
08640 fQPDG=szQPDG;
08641 fMass=mSigZ;
08642 }
08643 else if(ra<.65)
08644 {
08645 fQPDG=smQPDG;
08646 fMass=mSigM;
08647 sQPDG=pipQPDG;
08648 sMass=mPi;
08649 }
08650 else if(ra<.8)
08651 {
08652 fQPDG=spQPDG;
08653 fMass=mSigP;
08654 sQPDG=pimQPDG;
08655 sMass=mPi;
08656 }
08657 else if(ra<.9)
08658 {
08659 fQPDG=pQPDG;
08660 fMass=mProt;
08661 sQPDG=kmQPDG;
08662 sMass=mK;
08663 }
08664 else
08665 {
08666 fQPDG=nQPDG;
08667 fMass=mNeut;
08668 sQPDG=kzQPDG;
08669 sMass=mK0;
08670 }
08671 }
08672 }
08673 else if(theLC==1)
08674 {
08675 if(qM<mLPi)
08676 {
08677 if(qM < mSigP+eps)
08678 {
08679 #ifdef debug
08680 G4cout<<"G4QEnv::DecayBaryon: Fill SigmaPlus AsIs"<<G4endl;
08681 #endif
08682 qH->SetQPDG(spQPDG);
08683 HV->push_back(qH);
08684 if(qM+eps<mSigP)G4cout<<"-Warning-G4QEnv::DecayBaryon: Si+ AsIs, M="<<qM<<G4endl;
08685 return;
08686 }
08687 fQPDG=spQPDG;
08688 fMass=mSigP;
08689 sQPDG=gQPDG;
08690 sMass=0.;
08691 }
08692 else if(qM<mSpPi0)
08693 {
08694 fQPDG=lQPDG;
08695 fMass=mLamb;
08696 sQPDG=pipQPDG;
08697 sMass=mPi;
08698 }
08699 else if(qM<mSzPi)
08700 {
08701 if(G4UniformRand()<.6)
08702 {
08703 fQPDG=lQPDG;
08704 fMass=mLamb;
08705 sQPDG=pipQPDG;
08706 sMass=mPi;
08707 }
08708 else
08709 {
08710 fQPDG=spQPDG;
08711 fMass=mSigP;
08712 }
08713 }
08714 else if(qM<mPKZ)
08715 {
08716 G4double ra=G4UniformRand();
08717 if(ra<.4)
08718 {
08719 fQPDG=lQPDG;
08720 fMass=mLamb;
08721 sQPDG=pipQPDG;
08722 sMass=mPi;
08723 }
08724 else if(ra<.7)
08725 {
08726 fQPDG=spQPDG;
08727 fMass=mSigP;
08728 }
08729 else
08730 {
08731 fQPDG=szQPDG;
08732 fMass=mSigZ;
08733 sQPDG=pipQPDG;
08734 sMass=mPi;
08735 }
08736 }
08737 else
08738 {
08739 G4double ra=G4UniformRand();
08740 if(ra<.35)
08741 {
08742 fQPDG=lQPDG;
08743 fMass=mLamb;
08744 sQPDG=pipQPDG;
08745 sMass=mPi;
08746 }
08747 else if(ra<.6)
08748 {
08749 fQPDG=spQPDG;
08750 fMass=mSigP;
08751 }
08752 else if(ra<.8)
08753 {
08754 fQPDG=szQPDG;
08755 fMass=mSigZ;
08756 sQPDG=pipQPDG;
08757 sMass=mPi;
08758 }
08759 else
08760 {
08761 fQPDG=pQPDG;
08762 fMass=mProt;
08763 sQPDG=kzQPDG;
08764 sMass=mK0;
08765 }
08766 }
08767 }
08768 else if(theLC==-1)
08769 {
08770 if(qM<mLPi)
08771 {
08772 if(qM < mSigM+eps)
08773 {
08774 #ifdef debug
08775 G4cout<<"G4QEnv::DecayBaryon: Fill SigmaMinus AsIs"<<G4endl;
08776 #endif
08777 qH->SetQPDG(smQPDG);
08778 HV->push_back(qH);
08779 if(qM+eps<mSigM)G4cout<<"-Warning-G4QEnv::DecayBaryon: Si- AsIs, M="<<qM<<G4endl;
08780 return;
08781 }
08782 fQPDG=smQPDG;
08783 fMass=mSigM;
08784 sQPDG=gQPDG;
08785 sMass=0.;
08786 }
08787 else if(qM<mSzPi)
08788 {
08789 fQPDG=lQPDG;
08790 fMass=mLamb;
08791 sQPDG=pimQPDG;
08792 sMass=mPi;
08793 }
08794 else if(qM<mSzPi)
08795 {
08796 if(G4UniformRand()<.6)
08797 {
08798 fQPDG=lQPDG;
08799 fMass=mLamb;
08800 sQPDG=pimQPDG;
08801 sMass=mPi;
08802 }
08803 else
08804 {
08805 fQPDG=szQPDG;
08806 fMass=mSigZ;
08807 sQPDG=pimQPDG;
08808 sMass=mPi;
08809 }
08810 }
08811 else if(qM<mPKZ)
08812 {
08813 G4double ra=G4UniformRand();
08814 if(ra<.4)
08815 {
08816 fQPDG=lQPDG;
08817 fMass=mLamb;
08818 sQPDG=pimQPDG;
08819 sMass=mPi;
08820 }
08821 else if(ra<.7)
08822 {
08823 fQPDG=szQPDG;
08824 fMass=mSigZ;
08825 sQPDG=pimQPDG;
08826 sMass=mPi;
08827 }
08828 else
08829 {
08830 fQPDG=smQPDG;
08831 fMass=mSigM;
08832 }
08833 }
08834 else
08835 {
08836 G4double ra=G4UniformRand();
08837 if(ra<.35)
08838 {
08839 fQPDG=lQPDG;
08840 fMass=mLamb;
08841 sQPDG=pimQPDG;
08842 sMass=mPi;
08843 }
08844 else if(ra<.6)
08845 {
08846 fQPDG=szQPDG;
08847 fMass=mSigZ;
08848 sQPDG=pimQPDG;
08849 sMass=mPi;
08850 }
08851 else if(ra<.8)
08852 {
08853 fQPDG=smQPDG;
08854 fMass=mSigM;
08855 }
08856 else
08857 {
08858 fQPDG=nQPDG;
08859 fMass=mNeut;
08860 sQPDG=kmQPDG;
08861 sMass=mK;
08862 }
08863 }
08864 }
08865 else if(theLC==2 || theLC==-2)
08866 {
08867 if(theLC==2 && qM>=mSpPi)
08868 {
08869 fQPDG=spQPDG;
08870 fMass=mSigP;
08871 sQPDG=pipQPDG;
08872 sMass=mPi;
08873 }
08874 if(theLC==-2 && qM>=mSmPi)
08875 {
08876 fQPDG=smQPDG;
08877 fMass=mSigM;
08878 sQPDG=pimQPDG;
08879 sMass=mPi;
08880 }
08881 else
08882 {
08883 #ifdef debug
08884 G4cout<<"-Warning-G4QE::DecBary:*AsIs* Baryon(S=1,|C|=2),QC="<<qH->GetQC()<<G4endl;
08885 #endif
08886 HV->push_back(qH);
08887 return;
08888 }
08889 }
08890 else
08891 {
08892
08893
08894
08895 G4cout<<"-Warning-G4QE::DecBary:*AsIs* UnknownBaryon(S=1)QC="<<qH->GetQC()<<G4endl;
08896 HV->push_back(qH);
08897 return;
08898 }
08899 }
08900 else
08901 {
08902 #ifdef debug
08903 G4cout<<"---Warning---G4QE::DecBary:*AsIso*UnknBaryon(AntiS),QC="<<qH->GetQC()<<G4endl;
08904 #endif
08905 HV->push_back(qH);
08906 return;
08907 }
08908 G4LorentzVector f4Mom(0.,0.,0.,fMass);
08909 G4LorentzVector s4Mom(0.,0.,0.,sMass);
08910 G4double sum=fMass+sMass;
08911 if(fabs(qM-sum)<eps)
08912 {
08913 f4Mom=q4M*(fMass/sum);
08914 s4Mom=q4M*(sMass/sum);
08915 }
08916 else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
08917 {
08918 #ifdef debug
08919 G4cout<<"---Warning---G4QE::DecBar:fPDG="<<fQPDG<<"(M="<<fMass<<")+sPDG="<<sQPDG<<"(M="
08920 <<sMass<<") > TotM="<<q4M.m()<<G4endl;
08921 #endif
08922 if(!theEnvironment.GetA())
08923 {
08924 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
08925 if(!CheckGroundState(quasH,true)) HV->push_back(qH);
08926 else delete qH;
08927 delete quasH;
08928 return;
08929 }
08930 else
08931 {
08932 delete qH;
08933 G4ExceptionDescription ed;
08934 ed << "Baryon DecayIn2 error: Can't Correct, *EmptyEnv*="
08935 << theEnvironment << G4endl;
08936 G4Exception("G4QEnvironment::DecayBaryon()", "HAD_CHPS_0001",
08937 FatalException, ed);
08938 }
08939 }
08940 #ifdef debug
08941 G4cout<<"G4QEnv::DecayBaryon: *DONE* f4M="<<f4Mom<<",fPDG="<<fQPDG<<", s4M="<<s4Mom
08942 <<",sPDG="<<sQPDG<<G4endl;
08943 #endif
08944 delete qH;
08945
08946 G4QHadron* H1 = new G4QHadron(fQPDG,f4Mom);
08947 HV->push_back(H1);
08948 G4QHadron* H2 = new G4QHadron(sQPDG,s4Mom);
08949 HV->push_back(H2);
08950 }
08951
08952
08953 void G4QEnvironment::DecayMeson(G4QHadron* qH, G4QHadronVector* HV)
08954 {
08955 static const G4QPDGCode gQPDG(22);
08956 static const G4QPDGCode pizQPDG(111);
08957 static const G4QPDGCode pipQPDG(211);
08958 static const G4QPDGCode pimQPDG(-211);
08959 static const G4QPDGCode kmQPDG(-321);
08960 static const G4QPDGCode kzQPDG(-311);
08961 static const G4QPDGCode kpQPDG(321);
08962 static const G4QPDGCode akzQPDG(311);
08963 static const G4double mPi = G4QPDGCode(211).GetMass();
08964 static const G4double mPi0 = G4QPDGCode(111).GetMass();
08965 static const G4double mK = G4QPDGCode(321).GetMass();
08966 static const G4double mK0 = G4QPDGCode(311).GetMass();
08967 static const G4double m2Pi0 = mPi0+ mPi0;
08968 static const G4double mPiPi0= mPi + mPi0;
08969 static const G4double mPiPi = mPi + mPi;
08970 static const G4double mKPi0 = mPi0+ mK;
08971 static const G4double mK0Pi0= mPi0+ mK0;
08972 static const G4double mKPi = mPi + mK;
08973 static const G4double mK0Pi = mPi + mK0;
08974 static const G4double mK0K = mK0 + mK;
08975 static const G4double mK0K0 = mK0 + mK0;
08976 static const G4double mKK = mK + mK;
08977 static const G4double eps = 0.003;
08978
08979 G4int theLB= qH->GetBaryonNumber();
08980 if(theLB)
08981 {
08982 G4cerr<<"*Warning*G4QEnvironment::DecayMeson:A="<<theLB<<" != 0 -> Fill asIs"<<G4endl;
08983 #ifdef ppdebug
08984
08985 G4Exception("G4QEnvironment::DecayMeson()", "HAD_CHPS_0000",
08986 FatalException, "Unknown Meson with A!=0");
08987 #endif
08988 HV->push_back(qH);
08989 return;
08990 }
08991 G4LorentzVector q4M = qH->Get4Momentum();
08992 G4double qM = q4M.m();
08993 G4int theLC= qH->GetCharge();
08994 G4int theLS= qH->GetStrangeness();
08995 if(qM < eps)
08996 {
08997 HV->push_back(qH);
08998 if(theLC || theLS) G4cout<<"-Warning-G4QEnv::DecMes: S="<<theLS<<", C="<<theLC<<G4endl;
08999 return;
09000 }
09001 #ifdef debug
09002 G4cout<<"G4QEnv::DecayMeson: *Called* S="<<theLS<<",C="<<theLC<<",4M="<<q4M<<qM<<G4endl;
09003 #endif
09004
09005 G4QPDGCode fQPDG = pipQPDG;
09006 G4double fMass= mPi;
09007 G4QPDGCode sQPDG = pizQPDG;
09008 G4double sMass= mPi0;
09009 if(!theLS)
09010 {
09011 if(!theLC)
09012 {
09013 if(qM < m2Pi0)
09014 {
09015 if(qM < mPi0+eps)
09016 {
09017 #ifdef debug
09018 G4cout<<"G4QEnv::DecayMeson: Fill Pi0 AsIs"<<G4endl;
09019 #endif
09020 qH->SetQPDG(pizQPDG);
09021 HV->push_back(qH);
09022 if(qM+eps < mPi0)G4cout<<"-Warning-G4QEnv::DecayMeson: Pi0 AsIs, M="<<qM<<G4endl;
09023 return;
09024 }
09025 fQPDG=gQPDG;
09026 fMass=0.;
09027 #ifdef debug
09028 G4cout<<"-Warning-G4QEnv::DecayMeson: Gamma+Pi0, M="<<qM<<",d="<<qM-mPi0<<G4endl;
09029 #endif
09030 }
09031 else if(qM < mPiPi)
09032 {
09033 fQPDG=pizQPDG;
09034 fMass=mPi0;
09035 }
09036 else
09037 {
09038 if(G4UniformRand() < .333333333)
09039 {
09040 fQPDG=pizQPDG;
09041 fMass=mPi0;
09042 }
09043 else
09044 {
09045 sQPDG=pimQPDG;
09046 sMass=mPi;
09047 }
09048 }
09049 }
09050 else if(theLC==1)
09051 {
09052 if(qM < mPiPi0)
09053 {
09054 if(qM < mPi+eps)
09055 {
09056 #ifdef debug
09057 G4cout<<"G4QEnv::DecayMeson: Fill Pi+ AsIs"<<G4endl;
09058 #endif
09059 qH->SetQPDG(pipQPDG);
09060 HV->push_back(qH);
09061 if(qM+eps < mPi) G4cout<<"-Warning-G4QEnv::DecayMeson: Pi+ AsIs, M="<<qM<<G4endl;
09062 return;
09063 }
09064 sQPDG=gQPDG;
09065 sMass=0.;
09066 #ifdef debug
09067 G4cout<<"-Warning-G4QEnv::DecayMeson: Gamma+Pi+, M="<<qM<<",d="<<qM-mPi0<<G4endl;
09068 #endif
09069 }
09070
09071 }
09072 else if(theLC==2)
09073 {
09074 if(qM > mPiPi)
09075 {
09076 sQPDG=pipQPDG;
09077 sMass=mPi;
09078 }
09079 else
09080 {
09081 #ifdef debug
09082 G4cout<<"-Warning-G4QE::DecayMeson:*AsIs* Meson++ M="<<qM<<",d="<<qM-mPiPi<<G4endl;
09083 #endif
09084 HV->push_back(qH);
09085 return;
09086 }
09087 }
09088 else if(theLC==-1)
09089 {
09090 if(qM < mPiPi0)
09091 {
09092 if(qM < mPi+eps)
09093 {
09094 #ifdef debug
09095 G4cout<<"G4QEnv::DecayMeson: Fill Pi- AsIs"<<G4endl;
09096 #endif
09097 qH->SetQPDG(pimQPDG);
09098 HV->push_back(qH);
09099 if(qM+eps < mPi) G4cout<<"-Warning-G4QEnv::DecayMeson: Pi- AsIs, M="<<qM<<G4endl;
09100 return;
09101 }
09102 fQPDG=pimQPDG;
09103 sQPDG=gQPDG;
09104 sMass=0.;
09105 #ifdef debug
09106 G4cout<<"-Warning-G4QEnv::DecayMeson: Gamma+Pi-, M="<<qM<<",d="<<qM-mPi<<G4endl;
09107 #endif
09108 }
09109 else fQPDG=pimQPDG;
09110 }
09111 else if(theLC==-2)
09112 {
09113 if(qM > mPiPi)
09114 {
09115 fQPDG=pimQPDG;
09116 sQPDG=pimQPDG;
09117 sMass=mPi;
09118 }
09119 else
09120 {
09121 #ifdef debug
09122 G4cout<<"-Warning-G4QE::DecayMeson:*AsIs* Meson-- M="<<qM<<",d="<<qM-mPiPi<<G4endl;
09123 #endif
09124 HV->push_back(qH);
09125 return;
09126 }
09127 }
09128 else
09129 {
09130 #ifdef debug
09131 G4cout<<"-Warning-G4QE::DecayMeson:*AsIs* UnknMeson (S=0) QC="<<qH->GetQC()<<G4endl;
09132 #endif
09133 HV->push_back(qH);
09134 return;
09135 }
09136 }
09137 else if( theLS == 1 )
09138 {
09139 if(!theLC)
09140 {
09141 if(qM < mKPi)
09142 {
09143 if(qM < mK0+eps)
09144 {
09145 #ifdef debug
09146 G4cout << "G4QEnv::DecayMeson: Fill K0 AsIs" << G4endl;
09147 #endif
09148 qH->SetQPDG(kzQPDG);
09149 HV->push_back(qH);
09150 if(qM+eps < mK0) G4cout<<"-Warning-G4QEnv::DecayMeson: K0 AsIs, M="<<qM<<G4endl;
09151 return;
09152 }
09153 fQPDG=kzQPDG;
09154 fMass=mK0;
09155 sQPDG=gQPDG;
09156 sMass=0.;
09157 }
09158 else if(qM < mK0Pi0)
09159 {
09160 sQPDG=kmQPDG;
09161 sMass=mK;
09162 }
09163 else
09164 {
09165 if(G4UniformRand()>.5)
09166 {
09167 sQPDG=kmQPDG;
09168 sMass=mK;
09169 }
09170 else
09171 {
09172 fQPDG=kzQPDG;
09173 fMass=mK0;
09174 }
09175 }
09176 }
09177 else if(theLC==-1)
09178 {
09179 if(qM < mKPi0)
09180 {
09181 if(qM < mK+eps)
09182 {
09183 #ifdef debug
09184 G4cout << "G4QEnv::DecayMeson: Fill K- AsIs" << G4endl;
09185 #endif
09186 qH->SetQPDG(kmQPDG);
09187 HV->push_back(qH);
09188 if(qM+eps < mK) G4cout<<"-Warning-G4QEnv::DecayMeson: K- AsIs, M="<<qM<<G4endl;
09189 return;
09190 }
09191 fQPDG=kmQPDG;
09192 fMass=mK;
09193 sQPDG=gQPDG;
09194 sMass=0.;
09195 }
09196 else if(qM < mKPi0)
09197 {
09198 fQPDG=kmQPDG;
09199 fMass=mK;
09200 }
09201 else
09202 {
09203 if(G4UniformRand()>.5)
09204 {
09205 fQPDG=kmQPDG;
09206 fMass=mK;
09207 }
09208 else
09209 {
09210 fQPDG=pimQPDG;
09211 sQPDG=kzQPDG;
09212 sMass=mK0;
09213 }
09214 }
09215 }
09216 else if(theLC== 1)
09217 {
09218 if(qM+eps < mK0Pi)
09219 {
09220 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassPositive Strange Meson AsIs"<<G4endl;
09221 HV->push_back(qH);
09222 return;
09223 }
09224 else
09225 {
09226 sQPDG=kzQPDG;
09227 sMass=mK0;
09228 }
09229 }
09230 else if(theLC== -2)
09231 {
09232 if(qM+eps < mKPi)
09233 {
09234 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassDNegativeStrange Meson AsIs"<<G4endl;
09235 HV->push_back(qH);
09236 return;
09237 }
09238 else
09239 {
09240 fQPDG=pimQPDG;
09241 sQPDG=kmQPDG;
09242 sMass=mK;
09243 }
09244 }
09245 else
09246 {
09247 G4cout<<"-Warning-G4QE::DecMeson:*AsIs*UnknownMeson.(S=1), QC="<<qH->GetQC()<<G4endl;
09248 HV->push_back(qH);
09249 return;
09250 }
09251 }
09252 else if(theLS==2)
09253 {
09254 if(theLC== 0)
09255 {
09256 if(qM+eps < mK0K0)
09257 {
09258 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassNeutral DStrange Meson AsIs"<<G4endl;
09259 HV->push_back(qH);
09260 return;
09261 }
09262 else
09263 {
09264 fQPDG=kzQPDG;
09265 fMass=mK0;
09266 sQPDG=kzQPDG;
09267 sMass=mK0;
09268 }
09269 }
09270 else if(theLC== -1)
09271 {
09272 if(qM+eps < mK0K)
09273 {
09274 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassNegativeDStrange Meson AsIs"<<G4endl;
09275 HV->push_back(qH);
09276 return;
09277 }
09278 else
09279 {
09280 fQPDG=kmQPDG;
09281 fMass=mK;
09282 sQPDG=kzQPDG;
09283 sMass=mK0;
09284 }
09285 }
09286 else if(theLC==-2)
09287 {
09288 if(qM+eps < mKK)
09289 {
09290 G4cout<<"-Warniong-G4QEnv::DecayMeson:LowMassDNegativeADStrangeMeson AsIs"<<G4endl;
09291 HV->push_back(qH);
09292 return;
09293 }
09294 else
09295 {
09296 fQPDG=kmQPDG;
09297 fMass=mK;
09298 sQPDG=kmQPDG;
09299 sMass=mK;
09300 }
09301 }
09302 else
09303 {
09304 G4cout<<"-Warning-G4QE::DecMeson:*AsIs*UnknownMeson.(S=2), QC="<<qH->GetQC()<<G4endl;
09305 HV->push_back(qH);
09306 return;
09307 }
09308 }
09309 else if( theLS ==-1 )
09310 {
09311 if(!theLC)
09312 {
09313 if(qM < mKPi)
09314 {
09315 if(qM < mK0+eps)
09316 {
09317 #ifdef debug
09318 G4cout << "G4QEnv::DecayMeson: Fill K0 AsIs" << G4endl;
09319 #endif
09320 qH->SetQPDG(akzQPDG);
09321 HV->push_back(qH);
09322 if(qM+eps < mK0) G4cout<<"-Warning-G4QEnv::DecayMeson: aK0 AsIs, M="<<qM<<G4endl;
09323 return;
09324 }
09325 fQPDG=akzQPDG;
09326 fMass=mK0;
09327 sQPDG=gQPDG;
09328 sMass=0.;
09329 }
09330 else if(qM < mK0Pi0)
09331 {
09332 fQPDG=pimQPDG;
09333 sQPDG=kpQPDG;
09334 sMass=mK;
09335 }
09336 else
09337 {
09338 if(G4UniformRand()>.5)
09339 {
09340 fQPDG=pimQPDG;
09341 sQPDG=kpQPDG;
09342 sMass=mK;
09343 }
09344 else
09345 {
09346 fQPDG=akzQPDG;
09347 fMass=mK0;
09348 }
09349 }
09350 }
09351 else if(theLC == 1)
09352 {
09353 if(qM < mKPi0)
09354 {
09355 if(qM < mK+eps)
09356 {
09357 #ifdef debug
09358 G4cout << "G4QEnv::DecayMeson: Fill K+ AsIs" << G4endl;
09359 #endif
09360 HV->push_back(qH);
09361 if(qM+eps < mK) G4cout<<"-Warning-G4QEnv::DecayMeson: K+ AsIs, M="<<qM<<G4endl;
09362 return;
09363 }
09364 fQPDG=kpQPDG;
09365 fMass=mK;
09366 sQPDG=gQPDG;
09367 sMass=0.;
09368 }
09369 else if(qM < mKPi0)
09370 {
09371 fQPDG=kpQPDG;
09372 fMass=mK;
09373 }
09374 else
09375 {
09376 if(G4UniformRand()>.5)
09377 {
09378 fQPDG=kpQPDG;
09379 fMass=mK;
09380 }
09381 else
09382 {
09383 sQPDG=akzQPDG;
09384 sMass=mK0;
09385 }
09386 }
09387 }
09388 else if(theLC==-1)
09389 {
09390 if(qM+eps < mK0Pi)
09391 {
09392 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassNegativeAStrange Meson AsIs"<<G4endl;
09393 HV->push_back(qH);
09394 return;
09395 }
09396 else
09397 {
09398 fQPDG=pimQPDG;
09399 sQPDG=akzQPDG;
09400 sMass=mK0;
09401 }
09402 }
09403 else if(theLC== 2)
09404 {
09405 if(qM+eps < mKPi)
09406 {
09407 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassDPositiveStrange Meson AsIs"<<G4endl;
09408 HV->push_back(qH);
09409 return;
09410 }
09411 else
09412 {
09413 sQPDG=kpQPDG;
09414 sMass=mK;
09415 }
09416 }
09417 else
09418 {
09419 G4cout<<"-Warning-G4QE::DecMeson:*AsIs*UnknownMeson.(S=-1),QC="<<qH->GetQC()<<G4endl;
09420 HV->push_back(qH);
09421 return;
09422 }
09423 }
09424 else if(theLS==-2)
09425 {
09426 if(theLC== 0)
09427 {
09428 if(qM+eps < mK0K0)
09429 {
09430 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassNeutralADStrange Meson AsIs"<<G4endl;
09431 HV->push_back(qH);
09432 return;
09433 }
09434 else
09435 {
09436 fQPDG=akzQPDG;
09437 fMass=mK0;
09438 sQPDG=akzQPDG;
09439 sMass=mK0;
09440 }
09441 }
09442 else if(theLC== 1)
09443 {
09444 if(qM+eps < mK0K)
09445 {
09446 G4cout<<"-Warniong-G4QEnv::DecayMeson: LowMassPositiveADStrangeMeson AsIs"<<G4endl;
09447 HV->push_back(qH);
09448 return;
09449 }
09450 else
09451 {
09452 fQPDG=kpQPDG;
09453 fMass=mK;
09454 sQPDG=akzQPDG;
09455 sMass=mK0;
09456 }
09457 }
09458 else if(theLC== 2)
09459 {
09460 if(qM+eps < mKK)
09461 {
09462 G4cout<<"-Warniong-G4QEnv::DecayMeson:LowMassDPositiveADStrangeMeson AsIs"<<G4endl;
09463 HV->push_back(qH);
09464 return;
09465 }
09466 else
09467 {
09468 fQPDG=kpQPDG;
09469 fMass=mK;
09470 sQPDG=kpQPDG;
09471 sMass=mK;
09472 }
09473 }
09474 else
09475 {
09476 G4cout<<"-Warning-G4QE::DecMeson:*AsIs*UnknownMeson.(S=-2),QC="<<qH->GetQC()<<G4endl;
09477 HV->push_back(qH);
09478 return;
09479 }
09480 }
09481 else
09482 {
09483
09484 G4cout<<"---Warning---G4QE::DecMeso: *Fill AsIso* UnknMeson, QC="<<qH->GetQC()<<G4endl;
09485
09486 HV->push_back(qH);
09487 return;
09488 }
09489 G4LorentzVector f4Mom(0.,0.,0.,fMass);
09490 G4LorentzVector s4Mom(0.,0.,0.,sMass);
09491 G4double sum=fMass+sMass;
09492 if(fabs(qM-sum)<eps)
09493 {
09494 f4Mom=q4M*(fMass/sum);
09495 s4Mom=q4M*(sMass/sum);
09496 }
09497 else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
09498 {
09499 #ifdef debug
09500 G4cout<<"---Warning---G4QE::DecMes:fPDG="<<fQPDG<<"(M="<<fMass<<")+sPDG="<<sQPDG<<"(M="
09501 <<sMass<<") > TotM="<<q4M.m()<<G4endl;
09502 #endif
09503 if(!theEnvironment.GetA())
09504 {
09505 G4Quasmon* quasH = new G4Quasmon(qH->GetQC(),qH->Get4Momentum());
09506 if(!CheckGroundState(quasH,true)) HV->push_back(qH);
09507 else delete qH;
09508 delete quasH;
09509 return;
09510 }
09511 else
09512 {
09513 delete qH;
09514 G4ExceptionDescription ed;
09515 ed << "Meson DecayIn2 error: Can't Correct, *EmptyEnv*="
09516 << theEnvironment << G4endl;
09517 G4Exception("G4QEnvironment::DecayMeson()", "HAD_CHPS_0001",
09518 FatalException, ed);
09519 }
09520 }
09521 #ifdef debug
09522 G4cout<<"G4QEnv::DecayMeson: *DONE* f4M="<<f4Mom<<",fPDG="<<fQPDG<<", s4M="<<s4Mom
09523 <<",sPDG="<<sQPDG<<G4endl;
09524 #endif
09525 delete qH;
09526
09527 G4QHadron* H1 = new G4QHadron(fQPDG,f4Mom);
09528 HV->push_back(H1);
09529 G4QHadron* H2 = new G4QHadron(sQPDG,s4Mom);
09530 HV->push_back(H2);
09531 }
09532
09533
09534 void G4QEnvironment::DecayAntistrange(G4QHadron* qH, G4QHadronVector* HV)
09535 {
09536 static const G4QPDGCode kpQPDG(321);
09537 static const G4QPDGCode kzQPDG(311);
09538 static const G4double mK =G4QPDGCode(321).GetMass();
09539 static const G4double mK0=G4QPDGCode(311).GetMass();
09540 static const G4double eps=0.003;
09541
09542 G4int theLS= qH->GetStrangeness();
09543 if(theLS>=0)
09544 {
09545 G4cerr<<"***G4QEnvironment::DecayAntistrange: S="<<theLS<<", but must be <0"<<G4endl;
09546
09547
09548 G4Exception("G4QEnvironment::DecayAntistrange()", "HAD_CHPS_0000",
09549 FatalException, "Not Antistrange nucleus");
09550
09551
09552 return;
09553 }
09554
09555
09556
09557
09558
09559
09560 G4int astr=-theLS;
09561 G4int theLB= qH->GetBaryonNumber();
09562 G4int theLC= qH->GetCharge();
09563 G4int qPDG = qH->GetPDGCode();
09564 G4int K0PDG= qPDG+astr*999999;
09565 G4QPDGCode K0QPDG(K0PDG);
09566 G4double rK0M=K0QPDG.GetMass();
09567 G4int KpPDG= qPDG+astr*999000;
09568 G4QPDGCode KpQPDG(KpPDG);
09569 G4double rKpM=KpQPDG.GetMass();
09570 G4LorentzVector q4M = qH->Get4Momentum();
09571 G4double qM = q4M.m();
09572 #ifdef debug
09573 G4cout<<"G4QE::DecayAntistrang:S="<<theLS<<",C="<<theLC<<",B="<<theLB<<",M="<<qM<<G4endl;
09574 #endif
09575
09576 G4QPDGCode fQPDG = kzQPDG;
09577 G4double fMass= mK0;
09578 G4QPDGCode sQPDG = K0QPDG;
09579 G4double sMass= rK0M;
09580 if(astr*mK0+rK0M>qM)
09581 {
09582 if(astr*mK+rKpM>qM)
09583 {
09584 #ifdef debug
09585
09586 G4cout<<"*Warning*G4QEnvironment::DecayAntistrange: Too low mass, keep AsIs"<<G4endl;
09587 #endif
09588 HV->push_back(qH);
09589 return;
09590 }
09591 else
09592 {
09593 fQPDG = kpQPDG;
09594 fMass= mK;
09595 sQPDG = KpQPDG;
09596 sMass= rKpM;
09597 }
09598 }
09599 else if(astr*mK+rKpM<qM && theLC>theLB-theLC)
09600 {
09601 fQPDG = kpQPDG;
09602 fMass= mK;
09603 sQPDG = KpQPDG;
09604 sMass= rKpM;
09605 }
09606 G4double afMass=fMass;
09607 if(astr>1) afMass*=astr;
09608 G4LorentzVector f4Mom(0.,0.,0.,afMass);
09609 G4LorentzVector s4Mom(0.,0.,0.,sMass);
09610 G4double sum=afMass+sMass;
09611 if(fabs(qM-sum)<eps)
09612 {
09613 f4Mom=q4M*(afMass/sum);
09614 s4Mom=q4M*(sMass/sum);
09615 }
09616 else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
09617 {
09618 #ifdef debug
09619 G4cout<<"--Warning--G4QE::DecAntistrange: fPDG="<<fQPDG<<"(M="<<fMass<<")+sPDG="<<sQPDG
09620 <<"(M="<<sMass<<") > TotM="<<q4M.m()<<G4endl;
09621 #endif
09622
09623
09624 G4ExceptionDescription ed;
09625 ed << "Nucleus DecayIn2 error: DecayAntistrange: M=" << qM << ", sum="
09626 << sum << G4endl;
09627 G4Exception("G4QEnvironment::DecayAntistrange()", "HAD_CHPS_0001",
09628 FatalException, ed);
09629 }
09630 #ifdef debug
09631 G4cout<<"G4QEnv::DecayAntistrange: *Done* f4M="<<f4Mom<<",fPDG="<<fQPDG<<", s4M="<<s4Mom
09632 <<",sPDG="<<sQPDG<<G4endl;
09633 #endif
09634 delete qH;
09635
09636 if(astr>1) f4Mom/=astr;
09637 G4QHadron* H1 = new G4QHadron(fQPDG,f4Mom);
09638 HV->push_back(H1);
09639 for(G4int ia=1; ia < astr; ++ia)
09640 {
09641 H1 = new G4QHadron(fQPDG,f4Mom);
09642 HV->push_back(H1);
09643 }
09644 G4QHadron* H2 = new G4QHadron(sQPDG,s4Mom);
09645 HV->push_back(H2);
09646 }
09647
09648
09649
09650 G4bool G4QEnvironment::CheckGroundState(G4Quasmon* quasm, G4bool corFlag)
09651 {
09652 static const G4QPDGCode gamQPDG(22);
09653 static const G4QContent neutQC(2,1,0,0,0,0);
09654 static const G4QContent protQC(1,2,0,0,0,0);
09655 static const G4QContent lambQC(1,1,1,0,0,0);
09656 static const G4QContent pimQC(1,0,0,0,1,0);
09657 static const G4QContent pipQC(0,1,0,1,0,0);
09658 static const G4double mNeut= G4QPDGCode(2112).GetMass();
09659 static const G4double mProt= G4QPDGCode(2212).GetMass();
09660 static const G4double mLamb= G4QPDGCode(3122).GetMass();
09661 static const G4double mPi = G4QPDGCode(211).GetMass();
09662
09666 G4QContent valQ=quasm->GetQC();
09667 G4int resQPDG=valQ.GetSPDGCode();
09668 G4int resB=valQ.GetBaryonNumber();
09669 G4int resC=valQ.GetCharge();
09670 G4int resS=valQ.GetStrangeness();
09671 if(resQPDG==10 && resB>0) resQPDG=valQ.GetZNSPDGCode();
09672 G4double resQMa=G4QPDGCode(resQPDG).GetMass();
09673 G4double resEMa=0.;
09674 G4bool bsCond=false;
09675 G4LorentzVector enva4M=G4LorentzVector(0.,0.,0.,0.);
09676 G4QContent reTQC=valQ;
09677 G4LorentzVector reTLV=quasm->Get4Momentum();
09678 G4double reTM=reTLV.m();
09679 G4int envPDG=theEnvironment.GetPDG();
09680
09681 if ( resB > 1 &&
09682 ( ( !resS &&
09683 ( (resC == resB && reTM > resC*mProt) || (!resC && reTM > resB*mNeut) )
09684 ) ||
09685 (resS == resB && reTM > resS*mLamb)
09686 )
09687 )
09688 {
09689 #ifdef chdebug
09690 G4cout<<"::G4QE::CGS:*MultyB*E="<<envPDG<<",B="<<resB<<",C="<<resC<<",S"<<resS<<G4endl;
09691 #endif
09692 if(envPDG!=90000000)
09693 {
09694 resEMa=theEnvironment.GetMZNS();
09695 enva4M=theEnvironment.Get4Momentum();
09696 G4LorentzVector toLV=reTLV+enva4M;
09697 enva4M=G4LorentzVector(0.,0.,0.,resEMa);
09698 reTLV=G4LorentzVector(0.,0.,0.,resQMa);
09699 if(G4QHadron(toLV).DecayIn2(reTLV,enva4M))
09700 {
09701 #ifdef debug
09702 G4cout<<"G4QE::CGS: fill EnvPDG="<<envPDG<<",4M="<<enva4M<<" and continue"<<G4endl;
09703 #endif
09704 theQHadrons.push_back(new G4QHadron(envPDG,enva4M));
09705 theEnvironment=G4QNucleus(G4QContent(0,0,0,0,0,0), G4LorentzVector(0.,0.,0.,0.));
09706 }
09707 else G4cout<<"*G4QE::CGS:tM="<<toLV.m()<<toLV<<"<q="<<resQMa<<"+EM="<<resEMa<<G4endl;
09708 }
09709 G4int baPDG=3122;
09710 if(!resS) baPDG = (!resC) ? 2112 : 2212;
09711 #ifdef debug
09712 G4cout<<"G4QE::CGS: fill "<<resB<<" of "<<baPDG<<" with t4M="<<reTLV<<G4endl;
09713 #endif
09714 reTLV/=resB;
09715 for(G4int ib=0; ib<resB; ib++) theQHadrons.push_back(new G4QHadron(baPDG,reTLV));
09716 return true;
09717 }
09718 #ifdef cdebug
09719 if(resQPDG==89998005)
09720 G4cout<<"G4QE::CGS:Q="<<valQ<<resQPDG<<",GM="<<resQMa<<",4M="<<reTLV<<reTLV.m()<<G4endl;
09721 #endif
09722 G4double resSMa=resQMa;
09723 enva4M=theEnvironment.Get4Momentum();
09724 if(envPDG!=90000000 && fabs(enva4M.m2())>1.)
09725 {
09726 resEMa=theEnvironment.GetMZNS();
09727 #ifdef cdebug
09728 G4cout<<"G4QE::CGS:EnvironmentExists,gsM="<<resEMa<<",4M="<<enva4M<<enva4M.m()<<G4endl;
09729 #endif
09730 reTQC+=theEnvironment.GetQCZNS();
09731 reTLV+=enva4M;
09732
09733 resSMa=G4QPDGCode(reTQC).GetMass();
09734 }
09735 else
09736 {
09737 G4double resQM=reTLV.m();
09738 G4int baryn=valQ.GetBaryonNumber();
09739 if(baryn>1)
09740 {
09741 if(valQ.GetN())
09742 {
09743 G4QContent resQC=valQ-neutQC;
09744 G4int resPDG=resQC.GetSPDGCode();
09745 if(resPDG==10&&resQC.GetBaryonNumber()>0) resPDG=resQC.GetZNSPDGCode();
09746 G4double resMas=G4QPDGCode(resPDG).GetMass();
09747 if(resMas+mNeut<resQM) bsCond=true;
09748 }
09749 else if(valQ.GetP())
09750 {
09751 G4QContent resQC=valQ-protQC;
09752 G4int resPDG=resQC.GetSPDGCode();
09753 if(resPDG==10&&resQC.GetBaryonNumber()>0) resPDG=resQC.GetZNSPDGCode();
09754 G4double resMas=G4QPDGCode(resPDG).GetMass();
09755 if(resMas+mProt<resQM) bsCond=true;
09756 }
09757 else if(valQ.GetL())
09758 {
09759 G4QContent resQC=valQ-lambQC;
09760 G4int resPDG=resQC.GetSPDGCode();
09761 if(resPDG==10&&resQC.GetBaryonNumber()>0) resPDG=resQC.GetZNSPDGCode();
09762 G4double resMas=G4QPDGCode(resPDG).GetMass();
09763 if(resMas+mLamb<resQM) bsCond=true;
09764 }
09765 }
09766 }
09767 G4double resTMa=reTLV.m();
09768
09769 G4int nOfOUT = theQHadrons.size();
09770 #ifdef cdebug
09771 G4int reTPDG=reTQC.GetSPDGCode();
09772 if(reTPDG==10&&reTQC.GetBaryonNumber()>0) reTPDG=reTQC.GetZNSPDGCode();
09773 G4cout<<"G4QEnv::CheckGS:(tM="<<resTMa<<"<rQM+rEM="<<resSMa<<",d="<<resSMa-resTMa
09774 <<" || rEM="<<resEMa<<"=0 & "<<!bsCond<<"=1) & n="<<nOfOUT<<">0 & F="<<corFlag
09775 <<" then the correction must be done for PDG="<<reTPDG<<G4endl;
09776 #endif
09777 if ( (resTMa < resSMa || (!resEMa && !bsCond) ) && nOfOUT > 0 && corFlag)
09778 {
09779 G4QHadron* theLast = theQHadrons[nOfOUT-1];
09780 G4int cNf=theLast->GetNFragments();
09781 G4int crPDG=theLast->GetPDGCode();
09782 #ifdef cdebug
09783 G4cout<<"G4QE::CGS: **Correction** lNF="<<cNf<<",lPDG="<<crPDG<<",Q4M="<<reTLV<<G4endl;
09784 #endif
09785 G4LorentzVector hadr4M = theLast->Get4Momentum();
09786 G4double hadrMa=hadr4M.m();
09787 G4LorentzVector tmpTLV=reTLV+hadr4M;
09788 #ifdef cdebug
09789 G4cout<<"G4QE::CGS:YES, s4M/M="<<tmpTLV<<tmpTLV.m()<<">rSM+hM="<<resSMa+hadrMa<<G4endl;
09790 #endif
09791 G4double tmpTM=tmpTLV.m();
09792 if(tmpTM>resSMa+hadrMa &&!cNf && crPDG!=22)
09793 {
09794 if(resEMa)
09795 {
09796 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resQMa);
09797 enva4M = G4LorentzVector(0.,0.,0.,resEMa);
09798 if(tmpTM>=resQMa+resEMa+hadrMa && G4QHadron(tmpTLV).DecayIn3(hadr4M,quas4M,enva4M))
09799 {
09800
09801 #ifdef debug
09802 G4cout<<"G4QE::CGS: Modify the Last 4-momentum to "<<hadr4M<<G4endl;
09803 #endif
09804 theLast->Set4Momentum(hadr4M);
09805 G4QHadron* quasH = new G4QHadron(valQ, quas4M);
09806 G4QContent theEQC=theEnvironment.GetQCZNS();
09807 G4QHadron* envaH = new G4QHadron(theEQC,enva4M);
09808 #ifdef debug
09809 G4cout<<"G4QE::CGS: Fill Quasm "<<valQ<<quas4M<<" in any form"<<G4endl;
09810 #endif
09811 EvaporateResidual(quasH, false);
09812 #ifdef debug
09813 G4cout<<"G4QE::CGS: Fill envir "<<theEQC<<enva4M<<" in any form"<<G4endl;
09814 #endif
09815
09816 envaH->Set4Momentum(enva4M);
09817 EvaporateResidual(envaH);
09818
09819 theEnvironment=G4QNucleus(G4QContent(0,0,0,0,0,0), G4LorentzVector(0.,0.,0.,0.));
09820 }
09821 else
09822 {
09823 #ifdef cdebug
09824 G4cout<<"***G4QEnv::CheckGroundState: Decay in Frag+ResQ+ResE error"<<G4endl;
09825 #endif
09826 return false;
09827 }
09828 }
09829 else
09830 {
09831 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resQMa);
09832 G4QHadron* quasH = new G4QHadron(valQ, quas4M);
09833 if(tmpTM>=resQMa+hadrMa && G4QHadron(tmpTLV).DecayIn2(hadr4M,quas4M))
09834 {
09835
09836 theLast->Set4Momentum(hadr4M);
09837 #ifdef debug
09838 G4cout<<"G4QE::CGS: modify theLast 4M="<<hadr4M<<hadr4M.m()<<G4endl;
09839 #endif
09840 quasH->Set4Momentum(quas4M);
09841 #ifdef debug
09842 G4cout<<"G4QE::CGS: fill newQH "<<valQ<<quas4M<<quas4M.m()<<" inAnyForm"<<G4endl;
09843 #endif
09844 EvaporateResidual(quasH, false);
09845 }
09846 else
09847 {
09848 delete quasH;
09849 #ifdef cdebug
09850 G4cout<<"***G4QEnv::CheckGS: Decay in Fragm+ResQ did not succeeded"<<G4endl;
09851 #endif
09852 return false;
09853 }
09854 }
09855 }
09856 else
09857 {
09858 #ifdef cdebug
09859 G4cout<<"G4QEnv::CheckGS: the Last did not help, nH="<<nOfOUT<<G4endl;
09860 #endif
09861 if(nOfOUT>1)
09862 {
09863 G4QHadron* thePrev = theQHadrons[nOfOUT-2];
09864 if(thePrev->GetNFragments()||thePrev->GetNFragments()) return false;
09865 G4LorentzVector prev4M = thePrev->Get4Momentum();
09866 G4double prevMa=prev4M.m();
09867 tmpTLV+=prev4M;
09868 G4int totPDG=reTQC.GetSPDGCode();
09869 if(totPDG==10&&reTQC.GetBaryonNumber()>0) totPDG=reTQC.GetZNSPDGCode();
09870 G4double tQMa=G4QPDGCode(totPDG).GetMass();
09871 #ifdef cdebug
09872 G4cout<<"G4QE::CGS:T3="<<tmpTLV<<tmpTLV.m()<<">t+h+p="<<tQMa+hadrMa+prevMa<<G4endl;
09873 #endif
09874 if(tmpTLV.m()>tQMa+hadrMa+prevMa)
09875 {
09876 G4LorentzVector nuc4M = G4LorentzVector(0.,0.,0.,tQMa);
09877 G4QHadron* nucH = new G4QHadron(reTQC, nuc4M);
09878 if(!G4QHadron(tmpTLV).DecayIn3(hadr4M,prev4M,nuc4M))
09879 {
09880 delete nucH;
09881 G4cout<<"---Warning---G4QE::CGS:DecayIn ResNuc+LastH+PrevH Error"<<G4endl;
09882 return false;
09883 }
09884 else
09885 {
09886 theLast->Set4Momentum(hadr4M);
09887 thePrev->Set4Momentum(prev4M);
09888 nucH->Set4Momentum(nuc4M);
09889 #ifdef cdebug
09890 G4cout<<"G4QE::CGS:*SUCCESS**>CHECK, D4M="<<tmpTLV-hadr4M-prev4M-nuc4M<<G4endl;
09891 #endif
09892 #ifdef debug
09893 G4cout<<"G4QE::CGS: Fill nucleus "<<reTQC<<nuc4M<<" in any form"<<G4endl;
09894 #endif
09895 EvaporateResidual(nucH, false);
09896 }
09897 }
09898 else
09899 {
09900 #ifdef cdebug
09901 G4cout<<"G4QE::CGS:Prev&Last didn't help,nH="<<nOfOUT<<">2, MQ="<<resQMa<<G4endl;
09902 #endif
09903 G4int nphot=-1;
09904 G4int npip=-1;
09905 G4int npiz=-1;
09906 G4int npim=-1;
09907 G4double emaz=0.;
09908 for(G4int id=nOfOUT-1; id>=0; id--)
09909 {
09910 G4QHadron* curHadr = theQHadrons[id];
09911 G4int hPDG=curHadr->GetPDGCode();
09912 if(hPDG == 22) nphot=id;
09913 else if(hPDG==211 && npip<1) npip=id;
09914 else if(hPDG==111)
09915 {
09916 G4double piE=curHadr->Get4Momentum().e();
09917 #ifdef chdebug
09918 G4cout<<"::G4QE::CheckGroundState:"<<id<<",Epi0="<<piE<<">"<<emaz<<G4endl;
09919 #endif
09920 if(piE>emaz)
09921 {
09922 npiz=id;
09923 emaz=piE;
09924 }
09925 }
09926 else if(hPDG==-211 && npim<1) npim=id;
09927 }
09928 if(nphot>=0)
09929 {
09930 G4QHadron* curHadr = theQHadrons[nphot];
09931 G4LorentzVector ch4M=curHadr->Get4Momentum();
09932 G4LorentzVector tt4M=ch4M+reTLV;
09933 G4double ttM=tt4M.m();
09934 if(resQMa<ttM)
09935 {
09936 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resSMa);
09937 G4QHadron* rqH = new G4QHadron(reTQC,quas4M);
09938 if(!G4QHadron(tt4M).DecayIn2(ch4M,quas4M))
09939 {
09940 delete rqH;
09941 #ifdef cdebug
09942 G4cout<<"***G4QEnv::CheckGS: Decay in Photon+ResQ tM="<<ttM<<G4endl;
09943 #endif
09944 }
09945 else
09946 {
09947 curHadr->Set4Momentum(ch4M);
09948 rqH->Set4Momentum(quas4M);
09949 #ifdef cdebug
09950 G4cout<<"G4QE::CGS:nPhot="<<nphot<<",ph4M="<<ch4M<<"+r4M="<<quas4M<<G4endl;
09951 #endif
09952 #ifdef debug
09953 G4cout<<"G4QE::CGS: Fill Resid "<<reTQC<<quas4M<<" in any form"<<G4endl;
09954 #endif
09955 EvaporateResidual(rqH, false);
09956 if(envPDG!=90000000) theEnvironment=G4QNucleus(G4QContent(0,0,0,0,0,0),
09957 G4LorentzVector(0.,0.,0.,0.));
09958 return true;
09959 }
09960 }
09961 }
09962 #ifdef chdebug
09963 if(resQPDG==89998004) G4cout<<"::G4QE::CGS:S="<<resS<<",B="<<resB<<",C="<<resC
09964 <<",+#"<<npip<<",-#"<<npim<<",0#"<<npiz<<",E="<<envPDG<<G4endl;
09965 #endif
09966
09967 if (envPDG == 90000000 && !resS && resB > 1 &&
09968 ((npip >= 0 && resC == -2) || (npim >= 0 && resC-resB == 2)) )
09969 {
09970 G4int npi=npip;
09971 G4int piPD=-211;
09972 G4int nuPD=2112;
09973 G4double nuM=mNeut;
09974 if(resC!=-2)
09975 {
09976 npi=npim;
09977 piPD=211;
09978 nuPD=2212;
09979 nuM=mProt;
09980 }
09981 G4QPDGCode piQPDG(piPD);
09982 G4int rB=resB-1;
09983 G4double suB=rB*nuM;
09984 G4double suM=suB+nuM+mPi;
09985 G4QHadron* curHadr = theQHadrons[npi];
09986 G4LorentzVector ch4M=curHadr->Get4Momentum();
09987 G4LorentzVector tt4M=ch4M+reTLV;
09988 G4double ttM=tt4M.m();
09989 #ifdef cdebug
09990 if(resQPDG==89998005)
09991 G4cout<<"G4QE::CGS:Sm="<<suM<<"<Tot="<<ttM<<tt4M
09992 <<",pi="<<ch4M<<",Q="<<reTLV.m()<<reTLV<<G4endl;
09993 #endif
09994 if(suM<ttM)
09995 {
09996 G4LorentzVector fn4M = G4LorentzVector(0.,0.,0.,suB);
09997 G4LorentzVector sn4M = G4LorentzVector(0.,0.,0.,nuM);
09998 G4LorentzVector pi4M = G4LorentzVector(0.,0.,0.,mPi);
09999 if(!G4QHadron(tt4M).DecayIn3(fn4M,sn4M,pi4M))
10000 {
10001 #ifdef cdebug
10002 if(resQPDG==89998005)
10003 G4cout<<"***G4QEnv::CheckGS:DecayIn3 2N+Pi,tM="<<ttM<<","<<suM<<G4endl;
10004 #endif
10005 }
10006 else
10007 {
10008 if(rB>1) fn4M/=rB;
10009 for(G4int ib=0; ib<rB; ib++)
10010 {
10011 G4QHadron* fnH = new G4QHadron(nuPD,fn4M);
10012 #ifdef debug
10013 G4cout<<"G4QE::CGS: fill Nucleon #"<<ib<<", "<<nuPD<<fn4M<<G4endl;
10014 #endif
10015 theQHadrons.push_back(fnH);
10016 }
10017 G4QHadron* snH = new G4QHadron(nuPD,sn4M);
10018 #ifdef debug
10019 G4cout<<"G4QE::CGS: fill the Last Nucleon, "<<nuPD<<sn4M<<G4endl;
10020 #endif
10021 theQHadrons.push_back(snH);
10022 curHadr->Set4Momentum(pi4M);
10023 curHadr->SetQPDG(piQPDG);
10024 #ifdef cdebug
10025 if(resQPDG==89998005)
10026 G4cout<<"G4QE::CGS:1="<<nuPD<<fn4M<<rB<<",2="<<sn4M<<",p="<<pi4M<<G4endl;
10027 #endif
10028 return true;
10029 }
10030 }
10031 }
10032 if(envPDG==90000000&&!resS&&resB>1&&npiz>=0&&(resC<-1||resC-resB>1))
10033 {
10034 #ifdef chdebug
10035 G4cout<<"*::*G4QE::CGS:Pi0,rPDG="<<resQPDG<<",rC="<<resC<<",rB="<<resB<<G4endl;
10036 #endif
10037 G4int npi=-resC;
10038 G4int piPD=-211;
10039 G4int nuPD=2112;
10040 G4double nuM=mNeut;
10041 if(resC!=-2)
10042 {
10043 npi=resC-resB;
10044 piPD=211;
10045 nuPD=2212;
10046 nuM=mProt;
10047 }
10048 G4QPDGCode piQPDG(piPD);
10049 G4double suB=resB*nuM;
10050 G4double suM=npi*mPi;
10051 G4double sum=suB+suM;
10052 G4QHadron* curHadr = theQHadrons[npiz];
10053 G4LorentzVector ch4M=curHadr->Get4Momentum();
10054 G4LorentzVector tt4M=ch4M+reTLV;
10055 G4double ttM=tt4M.m();
10056 #ifdef chdebug
10057 G4cout<<"::G4QE::CGS:sum="<<sum<<"<"<<ttM<<tt4M<<",pi0="<<ch4M<<",Q="
10058 <<reTLV.m()<<reTLV<<G4endl;
10059 #endif
10060 if(sum<ttM)
10061 {
10062 G4LorentzVector fn4M = G4LorentzVector(0.,0.,0.,suB);
10063 G4LorentzVector pi4M = G4LorentzVector(0.,0.,0.,suM);
10064 if(G4QHadron(tt4M).DecayIn2(fn4M,pi4M))
10065 {
10066 if(npi>1) pi4M/=npi;
10067 curHadr->Set4Momentum(pi4M);
10068 curHadr->SetQPDG(piQPDG);
10069 if(npi>1) for(G4int ip=1; ip<npi; ip++)
10070 {
10071 G4QHadron* piH = new G4QHadron(piPD,pi4M);
10072 #ifdef debug
10073 G4cout<<"G4QE::CGS: fill Pion #"<<ip<<", "<<piPD<<pi4M<<G4endl;
10074 #endif
10075 theQHadrons.push_back(piH);
10076 }
10077 if(resB>1) fn4M/=resB;
10078 for(G4int ib=0; ib<resB; ib++)
10079 {
10080 G4QHadron* fnH = new G4QHadron(nuPD,fn4M);
10081 #ifdef debug
10082 G4cout<<"G4QE::CGS: fill IsoNucleon #"<<ib<<", "<<nuPD<<fn4M<<G4endl;
10083 #endif
10084 theQHadrons.push_back(fnH);
10085 }
10086 #ifdef chdebug
10087 G4cout<<"::G4QE::CGS:nucl="<<nuPD<<fn4M<<resB<<",pion="<<pi4M<<npi<<G4endl;
10088 #endif
10089
10090 return true;
10091 }
10092 #ifdef chdebug
10093 else G4cout<<"*::*G4QEnv::CheckGS:DecayIn3:*Pi0* tM="<<ttM<<","<<sum<<G4endl;
10094 #endif
10095 }
10096 }
10097 #ifdef cdebug
10098 G4cout<<"G4QE::CGS: Photons can't help nP="<<nphot<<". TryChangeCharge."<<G4endl;
10099 #endif
10100
10101 G4int reTBN=reTQC.GetBaryonNumber();
10102 G4int reTCH=reTQC.GetCharge();
10103 G4bool isoN = reTCH-reTBN>0 || reTCH<0;
10104 G4bool norN = reTCH<=reTBN || reTCH>=0;
10105 G4double nnM=resSMa;
10106 G4QContent ipiQC=pipQC;
10107 G4QContent nnQC=reTQC+pimQC;
10108 G4int nnPDG=nnQC.GetSPDGCode();
10109 if((!nnPDG||nnPDG==10)&&nnQC.GetBaryonNumber()>0) nnPDG=nnQC.GetZNSPDGCode();
10110 #ifdef cdebug
10111 G4cout<<"G4QE::CGS: nnPDR="<<nnPDG<<". TryChangeCharge nOUT="<<nOfOUT<<",Iso="
10112 <<isoN<<",Nor="<<norN<<",C="<<reTCH<<",B="<<reTBN<<G4endl;
10113 #endif
10114 if(isoN)
10115 {
10116 if(reTCH<0)
10117 {
10118 ipiQC=pimQC;
10119 nnQC=reTQC+pipQC;
10120 nnPDG=nnQC.GetSPDGCode();
10121 if(nnPDG==10&&nnQC.GetBaryonNumber()>0) nnPDG=nnQC.GetZNSPDGCode();
10122 }
10123 G4QPDGCode nnQPDG(nnPDG);
10124 if(nnPDG<80000000) nnM=nnQPDG.GetMass();
10125 else nnM=nnQPDG.GetNuclMass(nnPDG);
10126 }
10127 G4bool chx2g=true;
10128 G4bool force=false;
10129 while(chx2g)
10130 {
10131 if(force) chx2g=false;
10132 for(G4int hd=nOfOUT-1; hd>=0; hd--)
10133 {
10134 G4QHadron* curHadr = theQHadrons[hd];
10135 G4int chNF=curHadr->GetNFragments();
10136 G4int chCH=curHadr->GetCharge();
10137 G4int chBN=curHadr->GetBaryonNumber();
10138
10139 G4LorentzVector ch4M=curHadr->Get4Momentum();
10140 #ifdef cdebug
10141 G4cout<<"G4QE::CGS:#"<<hd<<",ch="<<chCH<<",b="<<chBN<<",4M="<<ch4M<<G4endl;
10142 #endif
10143 if(!chNF)
10144 {
10145 G4LorentzVector tt4M=ch4M+reTLV;
10146 G4double chM=ch4M.m();
10147 G4double ttM=tt4M.m();
10148 if(isoN)
10149 {
10150 if(nnM+mPi+chM<ttM)
10151 {
10152 #ifdef cdebug
10153 G4cout<<"G4QE::CGS:CurH+ResQ+Pion t="<<tt4M<<ttM<<",cM="<<chM<<",rM="
10154 <<nnM<<", d="<<ttM-chM-nnM-mPi<<G4endl;
10155 #endif
10156 ch4M = G4LorentzVector(0.,0.,0.,chM);
10157 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,nnM);
10158 G4LorentzVector ipi4M = G4LorentzVector(0.,0.,0.,mPi);
10159 if(G4QHadron(tt4M).DecayIn3(ch4M,ipi4M,quas4M))
10160 {
10161 curHadr->Set4Momentum(ch4M);
10162 G4QHadron* rpH = new G4QHadron(ipiQC,ipi4M);
10163 #ifdef debug
10164 G4cout<<"G4QE::CGS: fill Pion "<<ipiQC<<ipi4M<<G4endl;
10165 #endif
10166 theQHadrons.push_back(rpH);
10167 G4QHadron* rqH = new G4QHadron(nnQC,quas4M);
10168 #ifdef debug
10169 G4cout<<"G4QE::CGS:Fill isoRes "<<nnQC<<quas4M<<" inAnyForm"<<G4endl;
10170 #endif
10171 #ifdef cdebug
10172
10173 G4cout<<"G4QE::CGS:#"<<hd<<"is h="<<curHadr->GetPDGCode()<<ch4M
10174 <<curHadr->Get4Momentum()<<" + rq="<<nnPDG<<quas4M<<" + pi="
10175 <<ipiQC<<ipi4M<<G4endl;
10176 #endif
10177 EvaporateResidual(rqH, false);
10178 if(envPDG!=90000000)theEnvironment=G4QNucleus(G4QContent(0,0,0,0,0,0)
10179 ,G4LorentzVector(0.,0.,0.,0.));
10180 return true;
10181 }
10182 #ifdef cdebug
10183 else G4cout<<"***G4QE::CGS:DecIn3 CurH+ResQ+Pion dM="<<ttM-chM<<G4endl;
10184 #endif
10185 }
10186 if ( (reTCH < 0 && chCH > 0) || (reTCH > reTBN && chCH < chBN) )
10187 {
10188 G4QContent chQC=curHadr->GetQC();
10189 if(reTCH<0)chQC+=pimQC;
10190 else chQC+=pipQC;
10191 G4QPDGCode nnQPDG=G4QPDGCode(nnPDG);
10192 nnM=nnQPDG.GetMass();
10193 G4QPDGCode chQPDG=G4QPDGCode(chQC.GetSPDGCode());
10194 chM=chQPDG.GetMass();
10195 if(force && nnPDG==111) nnM=0.;
10196 #ifdef cdebug
10197 G4cout<<"G4QE::CGS:ChargeExchange,cx="<<chx2g<<",rC="<<reTCH<<",rB="
10198 <<reTBN<<",rM="<<nnM<<",hC="<<chCH<<",hB="<<chBN<<",hM="<<chM
10199 <<",rM+hB="<<nnM+chM<<" < "<<ttM<<G4endl;
10200 #endif
10201 if(nnM+chM<ttM)
10202 {
10203 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,nnM);
10204 G4LorentzVector gam4M = G4LorentzVector(0.,0.,0.,0.);
10205 ch4M = G4LorentzVector(0.,0.,0.,chM);
10206 G4QHadron* rqH = new G4QHadron(nnQPDG,quas4M);
10207 if(!nnM)
10208 {
10209 if(!G4QHadron(tt4M).DecayIn3(ch4M,quas4M,gam4M))
10210 {
10211 delete rqH;
10212 #ifdef cdebug
10213 G4cout<<"***G4QE::CGS:DecayIn3 CurH+2Gammas,d="<<ttM-chM<<G4endl;
10214 #endif
10215 }
10216 else
10217 {
10218 if(chCH+reTCH-chQC.GetCharge()-nnQC.GetCharge())
10219 G4cout<<"**G4QE::CGS:ChEx CH+2G i="<<reTCH<<"+h="<<chCH<<", f="
10220 <<nnQC.GetCharge()<<"+o="<<chQC.GetCharge()<<G4endl;
10221 curHadr->Set4Momentum(ch4M);
10222 curHadr->SetQPDG(chQPDG);
10223 #ifdef cdebug
10224 G4cout<<"G4QE::CGS:SubstituteH#"<<hd<<"->"<<chQPDG<<ch4M<<G4endl;
10225 #endif
10226 rqH->Set4Momentum(quas4M);
10227 rqH->SetQPDG(gamQPDG);
10228 theQHadrons.push_back(rqH);
10229 #ifdef debug
10230 G4cout<<"G4QE::CGS:Fill (SubRQ) Gamma 1,(22)4M="<<quas4M<<G4endl;
10231 #endif
10232 G4QHadron* gamH = new G4QHadron(gamQPDG, gam4M);
10233 theQHadrons.push_back(gamH);
10234 #ifdef debug
10235 G4cout<<"G4QE::CGS:Fill newMadeGamma 2, (22) 4M="<<gam4M<<G4endl;
10236 #endif
10237 if(envPDG!=90000000) theEnvironment=
10238 G4QNucleus(G4QContent(0,0,0,0,0,0),G4LorentzVector(0.,0.,0.,0.));
10239 return true;
10240 }
10241 }
10242 else
10243 {
10244 if(!G4QHadron(tt4M).DecayIn2(ch4M,quas4M))
10245 {
10246 delete rqH;
10247 #ifdef cdebug
10248 G4cout<<"**G4QE::CGS:DecayIn2 CurH+ResQ d="<<ttM-chM-nnM<<G4endl;
10249 #endif
10250 }
10251 else
10252 {
10253 if(chCH+reTCH-chQC.GetCharge()-nnQC.GetCharge())
10254 G4cout<<"**G4QE::CGS:ChEx CH+RQ i="<<reTCH<<"+h="<<chCH<<", f="
10255 <<nnQC.GetCharge()<<"+o="<<chQC.GetCharge()<<G4endl;
10256 curHadr->Set4Momentum(ch4M);
10257 curHadr->SetQPDG(chQPDG);
10258 rqH->Set4Momentum(quas4M);
10259 #ifdef cdebug
10260 G4cout<<"G4QE::CGS:#"<<hd<<",h="<<ch4M<<"+rq="<<quas4M<<G4endl;
10261 #endif
10262 #ifdef debug
10263 G4cout<<"G4QE::CGS:FilFr "<<nnQPDG<<quas4M<<" inAnyForm"<<G4endl;
10264 #endif
10265 EvaporateResidual(rqH, false);
10266 if(envPDG!=90000000) theEnvironment=
10267 G4QNucleus(G4QContent(0,0,0,0,0,0),G4LorentzVector(0.,0.,0.,0.));
10268 return true;
10269 }
10270 }
10271 }
10272 else
10273 {
10274 #ifdef cdebug
10275 G4cout<<"**G4QE::CGS:rM+hB="<<nnM+chM<<">"<<ttM<<",B="<<chBN<<G4endl;
10276 #endif
10277 if(chBN>1)
10278 {
10279 G4QContent tcQC=chQC+nnQC;
10280 G4QPDGCode tcQPDG(tcQC);
10281 G4double tcM=tcQPDG.GetMass();
10282 G4QHadron* tcH = new G4QHadron(tcQPDG,tt4M);
10283 G4int tcS=tcQC.GetStrangeness();
10284 G4int tcC=tcQC.GetCharge();
10285 G4int tcBN=tcQC.GetBaryonNumber();
10286
10287 if ( tcBN == 2 || (!tcS && !tcC) || tcS == tcBN || tcC == tcBN )
10288 {
10289 if(tcBN==2) theEnvironment.DecayDibaryon(tcH,&theQHadrons);
10290 else theEnvironment.DecayMultyBaryon(tcH,&theQHadrons);
10291 G4QHadron* theLast_value = theQHadrons[theQHadrons.size()-1];
10292 curHadr->Set4Momentum(theLast_value->Get4Momentum());
10293 G4QPDGCode lQP=theLast_value->GetQPDG();
10294 if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP);
10295 else curHadr->SetQC(theLast_value->GetQC());
10296 theQHadrons.pop_back();
10297 delete theLast_value;
10298 }
10299 else if(tcM<ttM)
10300 {
10301 G4LorentzVector tc4M=G4LorentzVector(0.,0.,0.,tcM);
10302 G4LorentzVector gc4M=G4LorentzVector(0.,0.,0.,0.);
10303 if(!G4QHadron(tt4M).DecayIn2(tc4M,gc4M))
10304 {
10305 delete tcH;
10306 curHadr->Set4Momentum(tt4M);
10307 curHadr->SetQPDG(tcQPDG);
10308 #ifdef cdebug
10309 G4cout<<"**G4QE::CGS:DecayIn2 TotComp+gam d="<<ttM-tcM<<G4endl;
10310 #endif
10311 }
10312 else
10313 {
10314 curHadr->Set4Momentum(gc4M);
10315 curHadr->SetQPDG(gamQPDG);
10316 tcH->Set4Momentum(tc4M);
10317 #ifdef cdebug
10318 G4cout<<"G4QE::CGS:#"<<hd<<",ch="<<ch4M<<"+t4M="<<tc4M<<G4endl;
10319 #endif
10320 #ifdef debug
10321 G4cout<<"G4QE::CGS:FilTC "<<tcQPDG<<tc4M<<" inAnyForm"<<G4endl;
10322 #endif
10323 EvaporateResidual(tcH, false);
10324 }
10325 }
10326 else
10327 {
10328 #ifdef cdebug
10329 G4cout<<"G4QE::CGS:**CEF,M="<<tcM<<">"<<ttM<<",B="<<chBN<<G4endl;
10330 #endif
10331 delete tcH;
10332 curHadr->Set4Momentum(tt4M);
10333 curHadr->SetQPDG(tcQPDG);
10334 }
10335 return true;
10336 }
10337 }
10338 }
10339 }
10340 else if(norN)
10341 {
10342 if(resSMa+chM<ttM)
10343 {
10344 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resSMa);
10345 G4QHadron* rqH = new G4QHadron(reTQC,quas4M);
10346 if(!G4QHadron(tt4M).DecayIn2(ch4M,quas4M))
10347 {
10348 delete rqH;
10349 #ifdef cdebug
10350 G4cout<<"***G4QE::CheckGS:Decay in CurH+ResQ dM="<<ttM-chM<<G4endl;
10351 #endif
10352 }
10353 else
10354 {
10355 curHadr->Set4Momentum(ch4M);
10356 rqH->Set4Momentum(quas4M);
10357 #ifdef cdebug
10358 G4cout<<"G4QEnv::CheckGS:#"<<hd<<",ch4M="<<curHadr->GetPDGCode()
10359 <<ch4M<<" + ResQ4M="<<totPDG<<quas4M<<G4endl;
10360 #endif
10361 #ifdef debug
10362 G4cout<<"G4QE::CGS:Fill GSRes "<<reTQC<<quas4M<<" inAnyForm"<<G4endl;
10363 #endif
10364 EvaporateResidual(rqH, false);
10365 if(envPDG!=90000000)theEnvironment=G4QNucleus(G4QContent(0,0,0,0,0,0)
10366 ,G4LorentzVector(0.,0.,0.,0.));
10367 return true;
10368 }
10369 }
10370 }
10371 }
10372 }
10373 #ifdef cdebug
10374 G4cout<<"G4QEnv::CheckGS:***Any hadron from the OUTPUT did not help"<<G4endl;
10375 #endif
10376 force=true;
10377 }
10378 if(resB>1)
10379 {
10380 G4int hind=-1;
10381 if(npiz>-1) hind=npiz;
10382 else
10383 {
10384 if(resC+resC>resB && npim>-1) hind=npim;
10385 else hind=npip;
10386 }
10387 if(hind>-1)
10388 {
10389 G4QHadron* curHadr = theQHadrons[hind];
10390 G4int chNF=curHadr->GetNFragments();
10391 if(!chNF)
10392 {
10393 G4LorentzVector ch4M=curHadr->Get4Momentum();
10394 G4LorentzVector tt4M=ch4M+reTLV;
10395 G4double ttM=tt4M.m();
10396 G4QContent ttQC=valQ+curHadr->GetQC();
10397 G4int ttPDG=ttQC.GetZNSPDGCode();
10398 G4QPDGCode ttQPDG(ttPDG);
10399 G4double ttGSM=ttQPDG.GetMass();
10400 if(ttM>ttGSM && ttQC.GetStrangeness()>0)
10401 {
10402 ttPDG-=ttQC.GetStrangeness()*999999;
10403 ttQPDG=G4QPDGCode(ttPDG);
10404 ttGSM=ttQPDG.GetMass();
10405 #ifdef debug
10406 G4cout<<"G4QEnv::CheckGS:Hypernucleus degraded to QPDG="<<ttQPDG<<G4endl;
10407 #endif
10408 }
10409 if(ttM>ttGSM)
10410 {
10411 #ifdef cdebug
10412 G4cout<<"G4QEnv::CheckGS: Decay in ResQ="<<ttQPDG<<" & 2 gammas"<<G4endl;
10413 #endif
10414 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,ttGSM);
10415 G4LorentzVector fgam4M = G4LorentzVector(0.,0.,0.,0.);
10416 G4LorentzVector sgam4M = G4LorentzVector(0.,0.,0.,0.);
10417 if(!G4QHadron(tt4M).DecayIn3(quas4M,fgam4M,sgam4M))G4cout<<"*3*"<<G4endl;
10418 else
10419 {
10420 curHadr->Set4Momentum(fgam4M);
10421 curHadr->SetQPDG(gamQPDG);
10422 G4QHadron* sgH = new G4QHadron(gamQPDG,sgam4M);
10423 theQHadrons.push_back(sgH);
10424 G4QHadron* rqH = new G4QHadron(ttQPDG,quas4M);
10425 theQHadrons.push_back(rqH);
10426 return true;
10427 }
10428 }
10429 #ifdef debug
10430 else G4cout<<"-W-G4QEn::CheckGS:M="<<ttM<<" < GSM="<<ttGSM<<ttQPDG<<G4endl;
10431 #endif
10432 }
10433 }
10434 }
10435 return false;
10436 }
10437 }
10438 else return false;
10439 }
10440 }
10441 else return false;
10442 return true;
10443 }
10444
10445
10446 void G4QEnvironment::CopyAndDeleteHadronVector(G4QHadronVector* HV)
10447 {
10448 G4int nHadrons = HV->size();
10449 if(nHadrons)
10450 {
10451 for(G4int ih=0; ih<nHadrons; ++ih)
10452 {
10453
10454 G4QHadron* inH = (*HV)[ih];
10455 G4int hNF = inH->GetNFragments();
10456 if(!hNF)
10457 {
10458 #ifdef debug
10459 G4cout<<"G4QEnv::Copy&DeleteHV:#"<<ih<<", hPDG="<<inH->GetPDGCode()<<G4endl;
10460 #endif
10461 G4QHadron* curH = new G4QHadron(inH);
10462 theQHadrons.push_back(curH);
10463 }
10464 }
10465 for_each(HV->begin(), HV->end(), DeleteQHadron());
10466 HV->clear();
10467 }
10468 #ifdef debug
10469 else G4cout<<"***G4QEnv::Kopy&DelHV: No hadrons in the QHadronVector"<<G4endl;
10470 #endif
10471 delete HV;
10472 }
10473
10474
10475 G4bool G4QEnvironment::DecayInEnvQ(G4Quasmon* quasm)
10476 {
10477 G4QContent valQ=quasm->GetQC();
10478 G4int resQPDG=valQ.GetSPDGCode();
10479 if(resQPDG==10&&valQ.GetBaryonNumber()>0) resQPDG=valQ.GetZNSPDGCode();
10480 G4double resQMa=G4QPDGCode(resQPDG).GetMass();
10481 G4LorentzVector enva4M=G4LorentzVector(0.,0.,0.,0.);
10482 G4LorentzVector reTLV=quasm->Get4Momentum();
10483 G4double resSMa=resQMa;
10484 G4int envPDG=theEnvironment.GetPDG();
10485 if(envPDG!=90000000)
10486 {
10487 G4double resEMa=theEnvironment.GetMZNS();
10488 enva4M=G4LorentzVector(0.,0.,0.,resEMa);
10489 reTLV+=enva4M;
10490 resSMa+=resEMa;
10491 G4double resTMa=reTLV.m();
10492
10493 G4cout<<"G4QEnv::DecayInEnvQ: totM="<<reTLV<<resTMa<<" > rQM+rEM="<<resSMa<<G4endl;
10494
10495 if(resTMa>resSMa)
10496 {
10497 G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resQMa);
10498 G4QHadron* quasH = new G4QHadron(valQ, quas4M);
10499 G4QHadron* envaH = new G4QHadron(envPDG, enva4M);
10500 if(!G4QHadron(reTLV).DecayIn2(enva4M,quas4M))
10501 {
10502 delete quasH;
10503 delete envaH;
10504 G4cout<<"---Warning---G4Q::DecInEnvQ:Decay in Environment+ResidualQuasmon"<<G4endl;
10505 return false;
10506 }
10507 else
10508 {
10509 quasH->Set4Momentum(quas4M);
10510 EvaporateResidual(quasH);
10511 envaH->Set4Momentum(enva4M);
10512 EvaporateResidual(envaH);
10513 }
10514 }
10515 else return false;
10516 }
10517 else return false;
10518 return true;
10519 }
10520
10521
10522 void G4QEnvironment::AddQuasmon(G4Quasmon* Q)
10523 {
10524 theQuasmons.push_back(Q);
10525 totCharge+=Q->GetCharge();
10526 totBaryoN+=Q->GetBaryonNumber();
10527 tot4Mom +=Q->Get4Momentum();
10528 #ifdef debug
10529 G4cout<<"G4QEnv::AddQuasmon:t4M="<<tot4Mom<<",tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
10530 #endif
10531 }
10532
10533
10534 void G4QEnvironment::CheckMassShell(G4QHadronVector* HV)
10535 {
10536 static const G4double eps=.003;
10537 G4int nHadrons = HV->size();
10538 if(nHadrons)
10539 {
10540 for(G4int ih=0; ih<nHadrons; ++ih)
10541 {
10542 G4QHadron* inH = (*HV)[ih];
10543 G4int hNF = inH->GetNFragments();
10544 if(!hNF)
10545 {
10546 G4LorentzVector q4M = inH->Get4Momentum();
10547 G4double qM2 = q4M.m2();
10548 G4double qGM = inH->GetQPDG().GetMass();
10549 G4double qGM2= qGM*qGM;
10550 #ifdef debug
10551 G4cout << "G4QEnv::ChkMassShell:#" << ih <<", hPDG="<< inH->GetPDGCode() <<", dM2="
10552 << qM2 - qGM*qGM << G4endl;
10553 #endif
10554 if( fabs(qM2 - qGM*qGM) > eps)
10555 {
10556 G4double mins= 10000000000.;
10557 G4int nj = -1;
10558 for(G4int jh=0; jh<nHadrons; ++jh)
10559 {
10560 if(jh != ih)
10561 {
10562 G4QHadron* jnH = (*HV)[jh];
10563 hNF = inH->GetNFragments();
10564 if(!hNF)
10565 {
10566 G4LorentzVector j4M = jnH->Get4Momentum();
10567 G4double jGM = jnH->GetQPDG().GetMass();
10568 G4double jGM2= jGM*jGM;
10569 G4LorentzVector s4M = j4M+q4M;
10570 G4double jqM = qGM * jGM;
10571 G4double s2M = s4M.m2()-qGM2-jGM2-jqM-jqM;
10572 if(s2M > eps && s2M < mins)
10573 {
10574 mins = s2M;
10575 nj = jh;
10576 }
10577 }
10578 }
10579 }
10580
10581
10582 if(nj >= 0)
10583 {
10584 G4QHadron* jnH = (*HV)[nj];
10585 G4LorentzVector j4M = jnH->Get4Momentum();
10586 G4double jGM = jnH->GetQPDG().GetMass();
10587 G4LorentzVector c4M = q4M + j4M;
10588 G4LorentzVector i4Mom(0.,0.,0.,qGM);
10589 G4LorentzVector j4Mom(0.,0.,0.,jGM);
10590
10591
10592
10593
10594
10595 if(!G4QHadron(c4M).DecayIn2(i4Mom, j4Mom))
10596 {
10597 G4cout<<"-Warning-G4QEnv::ChkMShell: tM="<< c4M.m() <<", iM="<< qGM <<", jM="
10598 << jGM <<", d="<< c4M.m()-qGM-jGM << G4endl;
10599
10600
10601
10602
10603 }
10604 else
10605 {
10606 inH->Set4Momentum(i4Mom);
10607 jnH->Set4Momentum(j4Mom);
10608 }
10609 }
10610 }
10611 }
10612 }
10613 }
10614 }