Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Quasmon.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // 1 2 3 4 5 6 7 8 9
27 //34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
28 //
29 //
30 // $Id$
31 //
32 // ---------------- G4Quasmon ----------------
33 // by Mikhail Kossov, July 1999.
34 // class for an excited hadronic state used by the CHIPS Model
35 // ---------------------------------------------------------------------------
36 // Short description: The Quasmon is the main object of the CHIPS model, where
37 // hadronic states are defined by the quark content and the 4-momentum (mass).
38 // In this sense a Quasmon is a generalised hadron - hadrons are the low
39 // mass discrete states of quasmons. Here the hadron can be not only an
40 // elementary particle, consisting of 2 or 3 quarks, but a nucleonic
41 // cluster, consisting of 6, 9, ... , 3n, ... quarks. In the CHIPS model
42 // the nucleus is considered as a group of the nucleons and the nucleonic
43 // clusters. In hadronic reactions a Quasmon is constructed in vacuum as
44 // a result of the collision (G4QCollision process). In this case only
45 // the G4Quasmon class can be used for the reaction. In nuclear reactions
46 // one or a few Quasmons can be created as a result of the colision of
47 // the projectile hadrons with the nucleons and the nucleonic clusters
48 // of the nuclear target. In this case the Quasmons are created and
49 // fragmented in the nuclear environment (G4QNucleus) and the G4QEnvironment
50 // class must be used for the reaction. For nuclear-nuclear reactions
51 // two G4QEnvironments are used with the common (which can fragment in both
52 // nuclear environments - mostly at low energies), individual (which can
53 // fragment in only one of two G4QEnvironments) and vacuum (which can
54 // fragment in vacuum being too far by rapidity from both nuclei) Quasmons.
55 // --------------------------------------------------------------------------
56 //
57 //#define debug
58 //#define pdebug
59 //#define pardeb
60 //#define psdebug
61 //#define rdebug
62 //#define ppdebug
63 //#define chdebug
64 //#define tdebug
65 //#define sdebug
66 #include <cmath>
67 #include <cstdlib>
68 
69 #include "G4Quasmon.hh"
70 #include "G4SystemOfUnits.hh"
71 
72 using namespace std;
73 
75  : q4Mom(q4M), valQ(qQCont), theWorld(0), phot4M(ph4M), f2all(0), rEP(0.), rMo(0.)
76 {
77 #ifdef debug
78  G4cout<<"G4Quasmon:Constructor:QC="<<qQCont<<",Q4M="<<q4M<<",photonE="<<ph4M.e()<<G4endl;
79 #endif
80 #ifdef pardeb
81  G4cout<<"**>G4Q:Con:(1),T="<<Temperature<<",S="<<SSin2Gluons<<",E="<<EtaEtaprime<<G4endl;
82 #endif
83  if(phot4M.e()>0.) q4Mom+=phot4M; // InCaseOf CaptureByQuark it will be subtracted back
84  valQ.DecQAQ(-1);
85  status=4;
86 }
87 
88 G4Quasmon::G4Quasmon(const G4Quasmon& right): totMass(0), bEn(0), mbEn(0)
89 {
90  q4Mom = right.q4Mom;
91  valQ = right.valQ;
92  //theEnvironment = right.theEnvironment;
93  status = right.status;
94  //theQHadrons (Vector)
95  G4int nQH = right.theQHadrons.size();
96  if(nQH) for(G4int ih=0; ih<nQH; ih++)
97  {
98  G4QHadron* curQH = new G4QHadron(right.theQHadrons[ih]);
99  theQHadrons.push_back(curQH);
100  }
101  theWorld = right.theWorld;
102  phot4M = right.phot4M;
103  nBarClust = right.nBarClust;
104  nOfQ = right.nOfQ;
105  //theQCandidates (Vector)
106  G4int nQC = right.theQCandidates.size();
107  if(nQC) for(G4int iq=0; iq<nQC; iq++)
108  {
109  G4QCandidate* curQC = new G4QCandidate(right.theQCandidates[iq]);
110  theQCandidates.push_back(curQC);
111  }
112  f2all = right.f2all;
113  rEP = right.rEP;
114  rMo = right.rMo;
115 }
116 
117 G4Quasmon::G4Quasmon(G4Quasmon* right): totMass(0), bEn(0), mbEn(0)
118 {
119 #ifdef sdebug
120  G4cout<<"G4Quasmon::Copy-Constructor: ***CALLED*** E="<<right->theEnvironment<<G4endl;
121 #endif
122  q4Mom = right->q4Mom;
123  valQ = right->valQ;
124  //theEnvironment = right->theEnvironment;
125  status = right->status;
126  //theQHadrons (Vector)
127  G4int nQH = right->theQHadrons.size();
128 #ifdef sdebug
129  G4cout<<"G4Quasmon::Copy-Constructor:nQH="<<nQH<<G4endl;
130 #endif
131  if(nQH) for(G4int ih=0; ih<nQH; ih++)
132  {
133 #ifdef debug
134  G4cout<<"G4Quasmon:Copy-Constructor:H#"<<ih<<",QH="<<right->theQHadrons[ih]<<G4endl;
135 #endif
136  G4QHadron* curQH = new G4QHadron(right->theQHadrons[ih]);
137  theQHadrons.push_back(curQH);
138  }
139  theWorld = right->theWorld;
140  phot4M = right->phot4M;
141  nBarClust = right->nBarClust;
142  nOfQ = right->nOfQ;
143  //theQCandidates (Vector)
144  G4int nQC = right->theQCandidates.size();
145 #ifdef sdebug
146  G4cout<<"G4Quasmon:Copy-Constructor: nCand="<<nQC<<G4endl;
147 #endif
148  if(nQC) for(G4int iq=0; iq<nQC; iq++)
149  {
150 #ifdef sdebug
151  G4cout<<"G4Quasmon:Copy-Constructor:C#"<<iq<<",QC="<<right->theQCandidates[iq]<<G4endl;
152 #endif
153  G4QCandidate* curQC = new G4QCandidate(right->theQCandidates[iq]);
154  theQCandidates.push_back(curQC);
155  }
156  f2all = right->f2all;
157  rEP = right->rEP;
158  rMo = right->rMo;
159 #ifdef sdebug
160  G4cout<<"G4Quasmon:Copy-Constructor: >->-> DONE <-<-<"<<G4endl;
161 #endif
162 }
163 
165 {
166 #ifdef sdebug
167  G4cout<<"G4Quasmon::Destructor before theQCandidates delete"<<G4endl;
168 #endif
169  for_each(theQCandidates.begin(), theQCandidates.end(), DeleteQCandidate());
170 #ifdef sdebug
171  G4cout<<"G4Quasmon::Destructor before theQHadrons"<<G4endl;
172 #endif
173  for_each(theQHadrons.begin(), theQHadrons.end(), DeleteQHadron());
174 #ifdef sdebug
175  G4cout<<"G4Quasmon::Destructor === DONE ==="<<G4endl;
176 #endif
177 }
178 
179 G4double G4Quasmon::Temperature=180.;
180 G4double G4Quasmon::SSin2Gluons=0.1;
181 G4double G4Quasmon::EtaEtaprime=0.3;
182 G4bool G4Quasmon::WeakDecays=false; // Flag for WeakDecays(notUsed hadwaredClosed)
183 G4bool G4Quasmon::ElMaDecays=true; // Flag for Electromagnetic decays of hadrons
184 
185 // Open decay of particles with possible electromagnetic channels of decay (gammas)
186 void G4Quasmon::OpenElectromagneticDecays(){ElMaDecays=true;}
187 
188 // Close decay of particles with possible electromagnetic channels of decay (gammas)
189 void G4Quasmon::CloseElectromagneticDecays(){ElMaDecays=false;}
190 
191 // Fill the private static parameters
192 void G4Quasmon::SetParameters(G4double temperature, G4double ssin2g, G4double etaetap)
193 {
194  Temperature=temperature;
195  SSin2Gluons=ssin2g;
196  EtaEtaprime=etaetap;
197 }
198 void G4Quasmon::SetTemper(G4double temperature) {Temperature=temperature;}
199 void G4Quasmon::SetSOverU(G4double ssin2g) {SSin2Gluons=ssin2g;}
200 void G4Quasmon::SetEtaSup(G4double etaetap) {EtaEtaprime=etaetap;}
201 
203 {
204  if(this != &right) // Beware of self assignment
205  {
206  q4Mom = right.q4Mom;
207  valQ = right.valQ;
208  //theEnvironment = right.theEnvironment;
209  status = right.status;
210  //theQHadrons (Vector)
211  G4int iQH = theQHadrons.size();
212  if(iQH) for(G4int jh=0; jh<iQH; jh++) delete theQHadrons[jh];
213  theQHadrons.clear();
214  G4int nQH = right.theQHadrons.size();
215  if(nQH) for(G4int ih=0; ih<nQH; ih++)
216  {
217  G4QHadron* curQH = new G4QHadron(right.theQHadrons[ih]);
218  theQHadrons.push_back(curQH);
219  }
220  theWorld = right.theWorld;
221  phot4M = right.phot4M;
222  nBarClust = right.nBarClust;
223  nOfQ = right.nOfQ;
224  //theQCandidates (Vector)
225  G4int iQC = theQCandidates.size();
226  if(iQC) for(G4int jq=0; jq<iQC; jq++) delete theQCandidates[jq];
227  theQCandidates.clear();
228  G4int nQC = right.theQCandidates.size();
229  if(nQC) for(G4int iq=0; iq<nQC; iq++)
230  {
231  G4QCandidate* curQC = new G4QCandidate(right.theQCandidates[iq]);
232  theQCandidates.push_back(curQC);
233  }
234  f2all = right.f2all;
235  rEP = right.rEP;
236  rMo = right.rMo;
237  }
238  return *this;
239 } // End of "="
240 
241 // Fragmentation of the Quasmon (the main member function)
242 G4QHadronVector G4Quasmon::HadronizeQuasmon(G4QNucleus& qEnv, G4int nQuasms)
243 {
245  static const G4int NUCPDG = 90000000;
246  static const G4int MINPDG = 80000000;
247  static const G4double np = 1877.9; //@@ temporary = a mass of np pair > m_n + m_p
248  static const G4double BIG = 1000000.;
249  static const G4double BIG2 = BIG*BIG;
250  static const G4QContent neutQC(2,1,0,0,0,0);
251  static const G4QContent protQC(1,2,0,0,0,0);
252  static const G4QContent lambQC(1,1,1,0,0,0);
253  static const G4QContent PiQC(0,1,0,1,0,0);
254  static const G4QContent PiMQC(1,0,0,0,1,0);
255  static const G4QContent Pi0QC(0,1,0,0,1,0);
256  static const G4QContent K0QC(1,0,0,0,0,1);
257  static const G4QContent KpQC(0,1,0,0,0,1);
258  static const G4QContent zeroQC(0,0,0,0,0,0);
259  //static const G4QContent AlphQC(6,6,0,0,0,0); // ** Temporary ** for Enhancement Attempt
260  static const G4LorentzVector zeroLV(0.,0.,0.,0.);
261  static const G4QNucleus vacuum= G4QNucleus(zeroLV,NUCPDG);
262  static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
263  static const G4double mTrit= G4QPDGCode(2112).GetNuclMass(1,2,0);
264  static const G4double mHel3= G4QPDGCode(2112).GetNuclMass(2,1,0);
265  static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
267  static const G4double mNeut= G4QPDGCode(2112).GetMass();
269  static const G4double mProt= G4QPDGCode(2212).GetMass();
270  static const G4double mLamb= G4QPDGCode(3122).GetMass();
271  static const G4double mPi = G4QPDGCode(211).GetMass();
272  static const G4double mPi0 = G4QPDGCode(111).GetMass();
273  static const G4double mK = G4QPDGCode(321).GetMass();
274  static const G4double mK0 = G4QPDGCode(311).GetMass();
275  static const G4double mEta = G4QPDGCode(221).GetMass();
276  static const G4double mEtaP= G4QPDGCode(331).GetMass();
277  static const G4double diPiM= mPi0 + mPi0;
278  static const G4double PiNM = mPi + mNeut;
280  static const G4double mPi02= mPi0* mPi0;
286  static const G4double mP2 = mProt*mProt;
292  static const G4double eps = 0.003; // 3keV cut to split instead of decay
293  G4double momPhoton=phot4M.rho();
294  G4double addPhoton=phot4M.e();
295 #ifdef debug
296  G4cout<<"G4Quasmon::HadrQ:*==>>START QUASMON HADRONIZATION<<==*, aP="<<addPhoton<<",Env="
297  <<qEnv<<qEnv.GetProbability()<<", #ofQuasms="<<nQuasms<<G4endl;
298 #endif
299  G4bool first=false;
300  if(nQuasms<0)
301  {
302  if(nQuasms==-1) first=true;
303  else G4cout<<"G4Quasmon::HadrQ: Negative #of Quasmons n="<<nQuasms<<G4endl;
304  nQuasms=-nQuasms;
305  }
306  G4bool piF = false; // FirstFragmentationFlag for PiCaptureAtRest
307  G4bool gaF = false; // FirstFragmentationFlag for GammaNucleus
308  if(addPhoton<0.) // "PionCapture at rest" case
309  {
310 #ifdef debug
311  G4cout<<"G4Q::HQ: PionAtRest, addP="<<addPhoton<<", momP="<<momPhoton<<G4endl;
312 #endif
313  addPhoton=0.;
314  momPhoton=0.;
315  piF=true;
316  }
317  else if(addPhoton>0.) gaF=true;
318  theEnvironment=qEnv; // NuclearEnvironment of Quasmon is defined
319 #ifdef debug
320  G4cout<<"G4Quasmon::HadrQ:Env="<<theEnvironment<<theEnvironment.GetProbability()<<G4endl;
321 #endif
322  // >> Now all possible candidates for hadronization are defined and initialized
323  theWorld= G4QCHIPSWorld::Get(); // Get a pointer to the CHIPS World
324  G4int nP= theWorld->GetQPEntries(); // A#of initialized particles in CHIPS World
325  //@@ Make special parametyer to cut high resonances for nuclear fragmentation !!
326  G4int nMesons = G4QNucleus().GetNDefMesonC();
327 #ifdef debug
328  G4cout<<"G4Quasmon::HadrQ:CHIPSWorld initialized with nP="<<nP<<",nM="<<nMesons<<G4endl;
329 #endif
330  if (nP<34) nMesons = 9; // @@ Only for hadronic, not nuclear reactions (?)
331  else if(nP<51) nMesons = 18; // @@ Only for hadronic, not nuclear reactions (?)
332  else if(nP<65) nMesons = 27; // @@ Only for hadronic, not nuclear reactions (?)
333  else if(nP<82) nMesons = 36; // @@ Only for hadronic, not nuclear reactions (?)
334  G4int nBaryons = G4QNucleus().GetNDefBaryonC();
335  if (nP<45) nBaryons = 16; // @@ Only for hadronic, not nuclear reactions (?)
336  else if(nP<59) nBaryons = 36; // @@ Only for hadronic, not nuclear reactions (?)
337  else if(nP<76) nBaryons = 52; // @@ Only for hadronic, not nuclear reactions (?)
338  G4int nClusters= nP-G4QPDGCode().GetNQHadr(); // "+Leptons/Isobars/Hyperons"
339 #ifdef debug
340  G4cout<<"G4Quasmon:HadrQ: Init Candidates:"<<theEnvironment<<",n="<<theQCandidates.size()
341  <<",nMesons="<<nMesons<<",nBaryons="<<nBaryons<<",nClusters="<<nClusters<<G4endl;
342 #endif
343  theEnvironment.InitCandidateVector(theQCandidates,nMesons,nBaryons,nClusters);
344 #ifdef debug
345  G4cout<<"G4Quasmon:HadrQ:CandidatesAreInitialized,n="<<theQCandidates.size()<<",nMesons="
346  <<nMesons<<", nBaryons="<<nBaryons<<", nClusters="<<nClusters<<G4endl;
347 #endif
348  if(!status||q4Mom==zeroLV) // This Quasmon is done (Sould not be here)
349  {
350 #ifdef debug
351  G4cout<<"G4Q::HQ:NOTHING-TO-DO: Q4M="<<q4Mom<<", QEnv="<<theEnvironment<<G4endl;
352 #endif
353  if(addPhoton)
354  {
356  ed << "OverheadPhoton for theZeroQuasmon: Q4M=" << q4Mom << ",status="
357  << status << ", phE=" << addPhoton << G4endl;
358  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0000", FatalException, ed);
359  }
360  KillQuasmon(); // This Quasmon is done
361  qEnv=theEnvironment; // Update QEnvironment
362  return theQHadrons;
363  }
364  status=2; // Default flag Nothing is done (yet)
365  G4int sPDG=0; // Prototype of PDG of a Selected Candidate
366  G4int pPDG=NUCPDG; // ProtTemporary PDG Code of the Parent Cluster
367  //G4bool fmh=false; // Flag of hadronization in nuclear matter
369  G4double npqp2=0; // A#of quark-partons -2 in a selected fragment
370  G4double sMass=0.; // Mass of selected candidate
371  G4double sM2=0.; // Squared mass of selected candidate
372  G4int pBaryn=0; // Parent cluster'c Baryon Num for sel.fragment
373  G4double dMass=0.; // E/N Mass difference for BoundedParentCluster
374  G4double pMass=0.; // EnvirBoundedParentCluster Mass for sel.fragm
375  G4double pNMass=0.; // NucleBoundedParentCluster Mass for sel.fragm
376  G4double delta=0.; // Binding energy
377  G4double deltaN=0.; // Binding energy in Total Nucleu
378  G4double minT=0.; // MinimalMass of FreeResidualQuasmon
379  G4double minSqT=0.; // MinimalSqMass of FreeResidualQuasmon
380  G4double minSqB=0.; // MinimalSqMass of BoundedResidualQuasmon
381  G4double minSqN=0.; // MinimalSqMass of ResidQuasm+ResidEnvironment
382  G4double hili=0.; // High limit of quark exchange randomization
383  G4double loli=0.; // Low limit of quark exchange randomization
384  G4double tmpTM2=BIG2; // GSMass of TotalResidualNucleus for Fragment
385  G4double reTNM2=0.; // Real mass of TotalResidNucleus for Fragment
386  G4QContent curQ=zeroQC; // ProtTemporary copy of valQ to estimate MinM2
387  G4QContent memQ=zeroQC; // ProtTemporary copy of valQ to remember state
388  G4QContent pQC=zeroQC; // ProtTemporary Quark Content of ParentCluster
389  G4QContent sQC=zeroQC; // ProtTemporary Quark Content of the fragment
390  G4QContent transQC=zeroQC; // ProtTemporary Quark Content of ExchangeMeson
391  G4LorentzVector m4Mom=zeroLV; // 4Momentum to memorize a Quasmon's 4-momentum
392  G4LorentzVector kp4Mom=zeroLV; // 4-mom prototype for kappa (recoil q)
393  G4LorentzVector check=-theEnvironment.Get4Momentum()-q4Mom;//4Mom sum to check
394  G4int ccheck=-theEnvironment.GetZ()-valQ.GetCharge();//To check charge conservation
395 #ifdef chdebug
396  G4int cSum=-ccheck; // To check charge conservation with print
397  G4QNucleus oldEnv(theEnvironment); // To compare on the fragmentation step
398  G4QContent oldCQC(valQ); // To compare on the fragmentation step
399  G4int oldNH=theQHadrons.size(); // To compare on the fragmentation step
400 #endif
401  G4bool start=true;
402 #ifdef debug
403  G4cout<<"G4Q::HQ: Before the loop EnvPDG="<<theEnvironment.GetPDG()<<G4endl;
404 #endif
405  while(theEnvironment.GetPDG()==NUCPDG || start)// **=TheMainLOOP(LOOP only forVacuum)=**
406  {
407 #ifdef chdebug
408  G4int ccSum=theEnvironment.GetZ()+valQ.GetCharge(); // To compare with initial charge
409  G4int nHd=theQHadrons.size();
410  if(nHd) for(int ih=0; ih<nHd; ih++) ccSum+=theQHadrons[ih]->GetCharge();
411  if(ccSum!=cSum)
412  {
413  G4cerr<<"*G4Q::HQ:C"<<cSum<<",c="<<ccSum<<",E="<<theEnvironment<<",Q="<<valQ<<G4endl;
414  G4cerr<<":G4Q::HQ:oldE="<<oldEnv<<"oldQ="<<oldCQC<<",oN="<<oldNH<<",N="<<nHd<<G4endl;
415  if(nHd) for(int h=0; h<nHd; h++)
416  {
417  G4QHadron* cH = theQHadrons[h];
418  G4cerr<<"::G4Q::HQ:#h"<<h<<",C="<<cH->GetCharge()<<",P="<<cH->GetPDGCode()<<G4endl;
419  }
420  }
421  oldEnv=G4QNucleus(theEnvironment); // To compare on the fragmentation step
422  oldCQC=G4QContent(valQ); // To compare on the fragmentation step
423  oldNH=nHd;
424 #endif
425  start=false;
426  //G4bool quexf=false; // Flag of successful quark exchange
427  G4double qM2 = q4Mom.m2(); // Current squared mass of Quasmon
428  G4double tmpEq=q4Mom.e(); // Energy of Quasmon
429  G4double tmpPq=q4Mom.rho(); // Momentum of Quasmon
430  if(fabs(qM2)<.0001 || tmpEq<=tmpPq)
431  {
432  qM2=0.;
433  if(!valQ.GetCharge() && !valQ.GetBaryonNumber() && !valQ.GetStrangeness())
434  {
435  if(fabs(qM2)<.001)
436  {
437  q4Mom.setE(tmpPq);
438 #ifdef debug
439  G4cout<<"G4Q::HQ:Quasmon is gamma, Q4M="<<q4Mom<<",E="<<theEnvironment<<G4endl;
440 #endif
441  G4QHadron* gamH = new G4QHadron(22,q4Mom);
442  FillHadronVector(gamH); // Fill Moving Environment (delete equivalent)
443  KillQuasmon(); // This Quasmon is done
444  qEnv=theEnvironment; // Update QEnvironment
445  return theQHadrons; // The last decay of the quasmon...
446  }
447  else if(tmpPq<.001) // @@ Unprobable...
448  {
449 #ifdef debug
450  G4cout<<"G4Q::HQ:Quasmon is nothing, Q4M="<<q4Mom<<",E="<<theEnvironment<<G4endl;
451 #endif
452  KillQuasmon(); // This Quasmon is done
453  qEnv=theEnvironment; // Update QEnvironment
454  return theQHadrons; // The last act of the quasmon...
455  }
456  }
457  else q4Mom.setE(tmpPq*1.00001); // @@ Can break E/p conservation
458  }
459  G4double quasM= sqrt(qM2); // Current mass of Quasmon
460  G4double qurF = quasM/(tmpEq-tmpPq); // Factor for k Lorentz Transformation to LS
461  G4ThreeVector qltb=q4Mom.boostVector();// Boost vector for backward Lor.Trans. to LS
463 #ifdef debug
464  G4cout<<"G4Q::HQ: Quasm="<<q4Mom<<",qM="<<quasM<<",qQC="<<valQ<<G4endl;
465 #endif
466  CalculateNumberOfQPartons(quasM); // Fills PrivateParameter nOfQ (a#OfQPartonsInQ)
467  //=-----------------------------=
468  G4int envPDG=theEnvironment.GetPDG(); // PDGCode of the current Nuclear Environment
469  G4int envN =theEnvironment.GetN(); // N of the current Nuclear Environment
470  G4int envZ =theEnvironment.GetZ(); // Z of the current Nuclear Environment
471  G4int envS =theEnvironment.GetS(); // S of the current Nuclear Environment
472  G4int envA =theEnvironment.GetA(); // A of the current Nuclear Environment
473  //G4int maxActEnv=4; // n-Dod + p-Dod // maxEnv.(in d) to compensate the Q recoilMom
474  G4int maxActEnv=256; // n-Dod + p-Dod // maxEnv.(in d) to compensate the Q recoilMom
475  G4int dmaxActEnv=maxActEnv+maxActEnv; // 2*maxEnv.(in d) to compensate the Q recoilMom
476  //G4double fAE=static_cast<double>(maxActEnv);
477  if(envA>dmaxActEnv)
478  //if(2>3) // Corresponds to envA>256
479  {
480  //G4int oEn=static_cast<int>(fAE/sqrt(static_cast<double>(envA)));
481  G4int zEn=maxActEnv; // Charge of the LimitActiveNuclearEnvironment
482  G4int nEn=zEn; // Charge of the LimitActiveNuclearEnvironment
483  bEn = zEn+nEn; // BaryoN of the LimitActiveNuclearEnvironment
484  mbEn = G4QPDGCode(2112).GetNuclMass(zEn,nEn,0); // Mass of the LimActNucEnv
485  bEn4M=G4LorentzVector(0.,0.,0.,mbEn);// 4-momentum of the LimitActiveNuclearEnviron
486  bEnQC=G4QContent(bEn+nEn,bEn+zEn,0,0,0,0); // QuarkContent of the LimitActiveNuclEnv
487  }
488  else // @@ Can be made STATIC CONSTANTS
489  {
490  bEn = 256; // BaryoN of the LimitActiveNuclearEnvironment
491  mbEn = G4QPDGCode(2112).GetNuclMass(128,128,0); // Mass of the LimActNucEnvironment
492  bEn4M = G4LorentzVector(0.,0.,0.,mbEn); // 4-mom of the LimitActiveNuclearEnviron
493  bEnQC = G4QContent(384,384,0,0,0,0); // QuarkContent of the LimitActiveNuclEnviron
494  }
495  G4double envM=theEnvironment.GetMass();// mass of the current Nuclear Environment
496  G4QContent envQC=theEnvironment.GetQCZNS(); // QuarkContent of theCurrentNuclearEnviron
497 #ifdef debug
498  G4cout<<"G4Q::HQ: ePDG="<<envPDG<<",eM="<<envM<<",eQC="<<envQC<<G4endl;
499 #endif
500  G4QContent totQC=valQ+envQC; // Total Quark Content
501  G4int totBN=totQC.GetBaryonNumber(); // Total Baryon Number of the Total System
502  G4int totS=totQC.GetStrangeness();// Total Strangeness of the Total System
503  G4int totZ=totQC.GetCharge(); // Total Charge of the Total System
504  G4QNucleus totN(totQC); // Pseudo nucleus for the Total System
505  G4int totNeut=totN.GetN(); // Total number of neutrons in the system
507  G4double totM =totN.GetMZNS(); // Minimum Mass of the Total System
508 #ifdef debug
509  G4cout<<"G4Q::HQ: tN="<<totN<<",tGSM="<<totM<<",tQC="<<totQC<<G4endl;
510 #endif
511 #ifdef debug
513  G4int resNPDG=0;
514  G4double resNM =10000000.; // Prototype of residual mass after n separated
515 #endif
516  if(totNeut>0)
517  {
518  G4QContent resNQC=totQC-G4QContent(2,1,0,0,0,0);
519  G4QNucleus resNN(resNQC);
520 #ifdef debug
521  resNM = resNN.GetMZNS();
522  resNPDG= resNN.GetPDG();
523 #endif
524  }
525  G4LorentzVector env4M =G4LorentzVector(0.,0.,0.,envM);
526  G4LorentzVector tot4M =q4Mom+env4M;
527  totMass=tot4M.m();
528  G4int totPDG=totN.GetPDG(); // Total PDG Code for the Current compound
529 #ifdef debug
530  G4cout<<"G4Q::HQ: totPDG="<<totPDG<<",totM="<<totMass<<",rPDG="<<resNPDG<<G4endl;
531 #endif
532  G4double totEn=tot4M.e();
533  G4double totMo=tot4M.rho();
534  if(totEn<totMo)
535  {
536  G4cerr<<"---Warning---G4Q::HQ: *Boost* tot4M="<<tot4M<<", E-p="<<totEn-totMo<<G4endl;
537  G4double accuracy=.000001*totMo;
538  G4double emodif=fabs(totEn-totMo);
539  //if(emodif<accuracy)
540  //{
541  G4cerr<<"G4Q::HQ: *Boost* E-p shift is corrected to "<<emodif<<G4endl;
542  tot4M.setE(totMo+emodif+.01*accuracy);
543  //}
544  }
545  G4ThreeVector totBoost = tot4M.boostVector(); // BoostVector for TotalSystem (backward)
546  G4ThreeVector totRBoost= -totBoost; // Boost vector for Total System (forward)
547  G4int iniPDG =valQ.GetSPDGCode();
548  G4int iniBN =valQ.GetBaryonNumber();
549  G4int iniQChg=valQ.GetCharge();
550  G4int iniN =valQ.GetN();
551  G4int iniP =valQ.GetP();
552  G4int iniS =valQ.GetL();
553 #ifdef debug
554  G4cout<<"G4Q::HQ: iniPDG="<<iniPDG<<", Z="<<iniP<<", N="<<iniN<<", S="<<iniS<<G4endl;
555 #endif
556  G4QNucleus iniRN(iniP,iniN-1,iniS);
557  G4double iniQM =G4QPDGCode(iniPDG).GetMass(); // Minimum mass of Quasmon
558 #ifdef debug
559  G4double iniRM = iniRN.GetMZNS(); // Mass of Residual Quasmon when neutron is rad
560  if(iniBN<2||envA>0) iniRM=0.;
561  G4cout<<"G4Q::HQ: iniRN="<<iniRN<<", iniRM="<<iniRM<<", iniQM="<<iniQM<<G4endl;
562 #endif
563  G4double excE = totMass-totM;
566 #ifdef debug
567  G4double bndQM = totM-envM;
568  if(envPDG==NUCPDG) bndQM=iniQM;
569  G4double bndQM2= bndQM*bndQM;
570  G4double quen = iniQM+envM;
571  G4cout<<"G4Q::HQ:mQ="<<quasM<<valQ<<bndQM2<<",nQ="<<nOfQ<<",Env="<<envM
572  <<envQC<<",Q+E="<<quen<<",tM="<<totPDG<<totQC<<totM<<"<"<<totMass<<G4endl;
573 #endif
574  G4int tQ = valQ.GetTot(); // Total number of quarks for current Quasmon
575  G4int bQ = abs(valQ.GetBaryonNumber()); // Baryon number of the current Quasmon
576  G4QContent cQ = valQ; // Temporary copy of Quasmon QC
577  G4int s_value = 4; // Mesonic
578  if (bQ) s_value = 3*bQ + 2; // Barionic
579  if (tQ> s_value) cQ.DecQAQ((tQ-s_value)/2); // Reduce QC to minimum QC
580 #ifdef debug
581  G4int rsPDG = cQ.GetSPDGCode(); // PDG for the lowest residual Quasmon state
582  G4cout<<"G4Q::HQ:eN="<<envN<<",eZ="<<envZ<<",Q="<<rsPDG<<cQ<<",piF="<<piF<<",gaF="<<gaF
583  <<G4endl;
584 #endif
585  theEnvironment.UpdateClusters(false); // New A-clusters are calculated
586  //theEnvironment.PrepareCandidates(theQCandidates,false,false);//Calc.PrePreprob's of C
587  //G4bool fF=piF||gaF;
588  // piF,piF or gaF,gaF is correct. Made to avoid theSpecificInteractionTimeClusterChoice
589  theEnvironment.PrepareCandidates(theQCandidates,piF,piF);// Calc.PrePreprob of Candid's
590  ModifyInMatterCandidates(); // Calculate InMediaMasses of Cand. & Possibil.
591  G4double kMom = 0.; // Energy of primary qParton in Q-CMS
592  G4double minK = 0.; // k_min for randomization
593  G4double maxK = quasM/2.; // k_max for randomization
594  G4double kLS = 0; // Energy of primary qParton in LS
595  G4double cost = 0.; // Cos(theta) of k in QS InRespecTo Q direction
596  G4bool kCond = true; // k choice condition
597  G4bool qCond = true; // q choice condition
598  G4bool pCond = true; // Not adoptable parent cluster choice condition
599  G4bool fskip=false; // Flag to skip when sucked
600  //G4bool fred =false; // Flag of Environment reduction
601  //G4bool ffdc =true; // Flag of not successful decay in fragment
602  G4LorentzVector k4Mom=zeroLV; // 4-momentum prototype for k
603  G4LorentzVector cr4Mom=zeroLV; // 4-momentum prototype for the ColResQuasmon
604  G4int kCount =0; // Counter of attempts of k for hadronization
605  //
606  //G4int qCountMax=27; // Try different q to come over CoulBar or SepE
607  //G4int qCountMax=12; // Try different q to come over CoulBar or SepE
608  //G4int qCountMax=9; // Try different q to come over CoulBar or SepE
609  //G4int qCountMax=3; // Try different q to come over CoulBar or SepE
610  G4int qCountMax=1; // Try different q to come over CoulBar or SepE
611  if(excE > diPiM) qCountMax=(G4int)(excE/mPi0); // Try more for big excess
612  //
613  //G4int kCountMax=27;
614  //G4int kCountMax=9;
615  //G4int kCountMax=3; // Try different k if they are below minK
616  G4int kCountMax=1; // "No reson to increase it"
617  //G4int kCountMax=qCountMax; // "No reson to increase it"
618  //G4int kCountMax=0; //@@ *** Close search for the minimum k ***
619  //
620  //G4int pCountMax=27; //Try differentHadrons(Parents) forBetterRecoil
621  //G4int pCountMax=9; //Try differentHadrons(Parents) forBetterRecoil
622  //G4int pCountMax=3; //Try differentHadrons(Parents) forBetterRecoil
623  G4int pCountMax=1; //Try differentHadrons(Parents) forBetterRecoil
624  //if(envA>0) pCountMax=3;
625  if(envA>0&&envA<19) pCountMax=36/envA;
626  //if(envA>0&&envA<31) pCountMax=60/envA;
627  //if(envA>0&&envA<61) pCountMax=120/envA;
628  G4bool gintFlag=false; // Flag of gamma interaction with one quark
629  while(kCount<kCountMax&&kCond)
630  {
631  kCond=true;
632  G4double miM2=0.;
633  if(envPDG==NUCPDG)
634  {
635  if(excE>mPi0) miM2=mPi02;
636  else miM2=mP2;
637  }
638  else // "Env. exists" case - find k_min & k_max
639  {
640  minK=100000.;
641  // @@ ??? May be for the light nuclei ???
642  //if(piF&&quasM>iniQM) maxK=mNeut/2.+(quasM-iniQM)*iniQM/(iniQM+mNeut);
643  //else if(quasM>iniQM)
644  //{
645  // G4double limK=envM/2.+(quasM-iniQM)*iniQM/(iniQM+envM);
646  // if(limK<maxK) maxK=limK;
647  //}
648  //@@*acceleration*: check only for P,N,d,& alpfa, can be done for all clusters(?)
649  //if(iniN>0&&iniBN>1) // "Neutron-hadron" estimate
650  //{
651  // G4double iK=1000000.;
652  // G4double dqm=quasM+quasM;
653  // if(envA>0)
654  // {
655  // G4QContent rtQC=valQ-neutQC+envQC; // Total Residual Quark Content
656  // G4QNucleus rtN(rtQC); // Create pseudo-nucleus for the TotalResidual
657  // G4double rtM =rtN.GetMZNS(); // Min Mass of total residual Nucleus
658  // G4double bnRQ=rtM-envM; // Bound mass of residual Quasmon
659  // G4double sm2=qM2+m2N-bnRQ*bnRQ;
660  // G4double fqm=dqm+dqm;
661  // G4double aK=sm2/fqm;
662 #ifdef debug
663  // G4double kts=.135; // Test value of k
664  // G4double dkts=kts+kts;
665  // G4double fu=dkts*(dkts*quasM-sm2)+quasM*m2N;
666  // G4cout<<"G4Q::HQ:M="<<quasM<<",R="<<bnRQ<<",f("<<kts<<")="<<fu<<"<0"<<G4endl;
667 #endif
668  // if(quasM>=mNeut+bnRQ)
669  // {
670  // G4double srm=sqrt(sm2*sm2-4.*qM2*m2N)/fqm;
671  // iK=aK-srm;
672  // aK+=srm;
673  // }
674  // else iK=aK;
675  // if(aK<maxK) maxK=aK;
676  // }
677  // else iK=mNeut*mNeut/(quasM+quasM);
678  // if(iK<minK) minK=iK;
679  //}
680  // =----------= From here the minK is calculated =----------------=
681  envA=envZ+envN;
682  G4int totN_value=totBN-totZ;
683  if(totN_value>0&&totBN>1) // "Neutron-cluster" estimate
684  {
685  G4QNucleus tmpNN(totZ,totN_value-1,0);
686  G4double delN=tmpNN.GetMZNS()+mNeut-totM;
687  if(envN>0&&envA>1)
688  {
689  G4QNucleus envNN(envZ,envN-1,0);
690  G4double delEN=envNN.GetMZNS()+mNeut-envM;
691  if(delEN>delN) delN=delEN;
692  }
693  delN*=qurF;
694  if(delN<minK) minK=delN;
695  }
696  if(totZ>0&&totBN>1) // "Proton-cluster" estimate
697  {
698  G4double proCB=theEnvironment.CoulombBarrier(1,1);
699  G4QNucleus tmpPN(totZ-1,totN_value,0);
700  G4double delP=tmpPN.GetMZNS()+mProt-totM+proCB;
701  if(envZ>0&&envA>1)
702  {
703  G4QNucleus envPN(envZ-1,envN,0);
704  G4double delEP=envPN.GetMZNS()+mProt-envM+proCB;
705  if(delEP>delP) delP=delEP;
706  }
707  delP*=qurF;
708  if(delP<minK) minK=delP;
709  }
710  if(totN_value>0&&totZ>0&&totBN>2) // "Deuteron-cluster" estimate
711  {
712  G4double proCB=theEnvironment.CoulombBarrier(1,2);
713  G4QNucleus tmpDN(totZ-1,totN_value-1,0);
714  G4double delD=tmpDN.GetMZNS()+mDeut-totM+proCB;
715  if(envN>0&&envZ>0&&envA>2)
716  {
717  G4QNucleus envDN(envZ-1,envN-1,0);
718  G4double delED=envDN.GetMZNS()+mDeut-envM+proCB;
719  if(delED>delD) delD=delED;
720  }
721  delD*=qurF;
722  if(delD<minK) minK=delD;
723  }
724  if(totN_value>1&&totZ>0&&totBN>3) // "Triton-cluster" estimate
725  {
726  G4double proCB=theEnvironment.CoulombBarrier(1,3);
727  G4QNucleus tmpTN(totZ-1,totN_value-2,0);
728  G4double delT=tmpTN.GetMZNS()+mTrit-totM+proCB;
729  if(envN>1&&envZ>0&&envA>3)
730  {
731  G4QNucleus envTN(envZ-1,envN-2,0);
732  G4double delET=envTN.GetMZNS()+mTrit-envM+proCB;
733  if(delET>delT) delT=delET;
734  }
735  delT*=qurF;
736  if(delT<minK) minK=delT;
737  }
738  if(totN_value>0&&totZ>1&&totBN>3) // "He3-cluster" estimate
739  {
740  G4double proCB=theEnvironment.CoulombBarrier(2,3);
741  G4QNucleus tmpRN(totZ-2,totN_value-1,0);
742  G4double delR=tmpRN.GetMZNS()+mHel3-totM+proCB;
743  if(envN>0&&envZ>1&&envA>3)
744  {
745  G4QNucleus envRN(envZ-2,envN-1,0);
746  G4double delER=envRN.GetMZNS()+mHel3-envM+proCB;
747  if(delER>delR) delR=delER;
748  }
749  delR*=qurF;
750  if(delR<minK) minK=delR;
751  }
752  if(totN_value>1&&totZ>1&&totBN>4) // "Alpha-cluster" estimate
753  {
754  G4double proCB=theEnvironment.CoulombBarrier(2,4);
755  G4QNucleus tmpAN(totZ-2,totN_value-2,0);
756  G4double delA=tmpAN.GetMZNS()+mAlph-totM+proCB;
757  if(envN>1&&envZ>1&&envA>4)
758  {
759  G4QNucleus envAN(envZ-2,envN-2,0);
760  G4double delEA=envAN.GetMZNS()+mAlph-envM+proCB;
761  if(delEA>delA) delA=delEA;
762  }
763  delA*=qurF;
764  if(delA*qurF<minK) minK=delA*qurF;
765  }
766  // @@ Limits from HigherClusters can be added for competition with ClustEvaporation
767  //if(totN_value>2&&totZ>2&&totBN>6) // "Li6-cluster" estimate ??????
768  //{
769  // G4double proCB=theEnvironment.CoulombBarrier(3,6);
770  // G4QNucleus tmpLN(totZ-3,totN_value-3,0);
771  // G4double delL=tmpLN.GetMZNS()+mLit6-totM+proCB;
772  // if(envN>2&&envZ>2&&envA>6)
773  // {
774  // G4QNucleus envLN(envZ-3,envN-3,0);
775  // G4double delEL=envLN.GetMZNS()+mLit6-envM+proCB;
776  // if(delEL>delL) delL=delEL;
777  // }
778  // delL*=qurF;
779  // if(delL<minK) minK=delL;
780  //}
781  if(minK<0. || minK+minK > quasM) minK=0.;
782  }
783  //if(addPhoton>0.&&quasM<1500.&&G4UniformRand()<f2all)
784  //if(addPhoton>0.&&iniBN<2)// PhotonAbsorbDiagramContrib(@@HiddenPar)
785  //if(addPhoton>0.&&(G4UniformRand()<.7||iniBN<2))//PhotoAbsorbDiagramContrib
786  //if(addPhoton>0.&&(G4UniformRand()<.5||iniBN<2))//PhotonAbsorbDiagramContrib
787  //if(addPhoton>0.&&(G4UniformRand()<.27||iniBN<2))// PhotonAbsorbDiagramContrib
788  //if(addPhoton>0.&&iniBN<2)// PhotonAbsorbDiagramContrib(@@HiddenPar)
789  //if(addPhoton>0.&&iniBN>1)// PhotonAbsorbDiagramContrib(@@HiddenPar)
790  //if(addPhoton>0.&&G4UniformRand()<0.5)// PhotonAbsorbDiagramContrib(@@HiddenPar)
791  //if(addPhoton>0.&&G4UniformRand()<0.75)// PhotonAbsorbDiagramContrib(@@HiddenPar)
793  //if(addPhoton>0.&&iniBN>1)//PhotonAbsorbDiagramContrib(Photon's captured by N quark)
794  if(addPhoton>0.)// PhotonAbsorbDiagramContrib(Photon is always captured by quarks)
795  //if(2>3) // Photon capture by quark is closed
796  {
797  //nOfQ=valQ.GetQ()-valQ.GetAQ(); // Recover nOfQ for the not excited cluster
798  // @@ 1/(p_g,p_q) interaction probability (? (p_g,p_q)=0 always)
799  gintFlag=true;
800  q4Mom-= phot4M; // recover Quasmon-Cluster without the Photon
801  qM2 = q4Mom.m2(); // Update the Current squared mass of Quasmon
802  quasM = sqrt(qM2); // Update the Current Mass of Quasmon
803  G4double kpow=static_cast<double>(nOfQ-2); // n-3+1 because of integration
804  if(kpow<1.) kpow=1.;
805  G4double xmi=(momPhoton-addPhoton)*quasM; // Minimum residual mass 2kM
806  if(xmi<0.) xmi=0.;
807  // While must be commented from here and down __________________________
808  //G4bool frat=true;//[k/(k+p) factor of QuarkExch]*[p/k factor of fixed ct]=p/(p+k)
809  //G4int cMax=27;//For m_gam=0:*[k/(k+p) factor 1/s{m<<k,s=m^2*(1+p/k)}]*[p/k(ct=0)]
810  //G4int pCount=0;//For m_gam=0 the suppression factor can be p*p/(p+k)/(p+k) @@ (?)
811  //while (frat && pCount<cMax)
812  //{
813  // ____ Keep this when closing while______________________________
814  G4double rn=G4UniformRand(); // k is changed by addPhoton
815  kMom=(1.-(1.-xmi)*pow(rn,1./kpow))*quasM/2; // 1/k from delta-funct integration
816  // ----------
818  G4double dkM=kMom+kMom;
819  // p2+k2+2pkcost=(k+e)2
820  //cost=(addPhoton*addPhoton-momPhoton*momPhoton+addPhoton*dkM)/momPhoton/dkM;
821  G4double cor=200./dkM/addPhoton;
822  G4double bas=std::log(2+cor);
823  cost=1.-std::exp(bas-(bas-std::log(cor))*G4UniformRand());
824  //cost=1.-2*G4UniformRand();
825  // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
826  // frat=G4UniformRand()>kMom/(addPhoton+kMom);
827  // //frat=G4UniformRand()>kMom*kMom/(addPhoton+kMom)/(addPhoton+kMom);
828  // //frat=G4UniformRand()>addPhoton/(addPhoton+kMom);
829  // //frat=G4UniformRand()>addPhoton*addPhoton/(addPhoton+kMom)/(addPhoton+kMom);
830  // pCount++;
831  //}
832  if(cost>1.) cost=1.;
833  if(cost<-1.) cost=-1.;
834 #ifdef debug
835  G4cout<<"G4Q::HQ:**PHOTON out of Q**k="<<kMom<<",ct="<<cost<<",QM="<<quasM<<G4endl;
836 #endif
837  // @@ (?) Pseudo Fermi-mom correction (use lib function for the 3d randomization -*
838  //G4double x = G4UniformRand(); // |
839  //G4double y = G4UniformRand(); // |
840  //G4double z = G4UniformRand(); // |
841  //G4double r2= x*x+y*y+z*z; // |
842  //while(r2>1.||r2<.0001) // |
843  //{
844  // x = G4UniformRand(); // |
845  // y = G4UniformRand(); // |
846  // z = G4UniformRand(); // |
847  // r2=x*x+y*y+z*z; // |
848  //}
849  //G4double r=140./sqrt(r2); // |
850  //G4double xs=x*r; // |
851  //G4double ys=y*r+kMom*sqrt(1.-cost*cost); // |
852  //G4double zs=z*r+kMom*cost; // |
853  //kMom=sqrt(xs*xs+ys*ys+zs*zs); // |
854  //cost=zs/kMom; // |
855  //if(kMom>=quasM/2.) kMom=quasM/2.-.001; // |
856  // --- End of the pseudo Fermi-motion corection-----------------------------------^
857  // --- Virtual gluoCompton correction starts here --------------------------------*
858  //G4double hms=32400.; // T_c^2 |
861  //G4double x=kMom*kMom/hms; // |
862  //G4double dc=(pow(x,G4UniformRand())-1.)/x; // smearing delta-function absorbtion|
863  //if(dc<0.)dc=0.; // only positive smearing |
864  //cost-=dc; // for virtPhotons smear in both dir.|
865  // --- Quark mass correction ends here (?) ---------------------------------------*
866  }
867  else
868  {
869  gaF=false; // GammaFirstAct flag is only for the gamma-q
870  gintFlag=false;
871  // =--= Probabiliti proportional to k (without 1/k factor of hadronization)
872  if(!miM2) miM2=(minK+minK)*quasM; // Make minimum mass for randomization
873  if(qM2<.0001) kMom=0.;
874  else kMom = GetQPartonMomentum(maxK,miM2); // Calculate value of primary qParton
875  // =--= Direct calculation of the quark spectrum
876  //G4double kpow=static_cast<double>(nOfQ-2);
877  //G4double kst=0.;
878  //if(maxK+maxK<quasM+.1) kst=pow((1.-(maxK+maxK)/quasM),kpow);
879  //if(maxK>minK)
880  //{
881  // G4double rn=(pow((1.-(minK+minK)/quasM),kpow)-kst)*G4UniformRand();
882  // kMom=(1.-pow(kst+rn,1./kpow))*quasM/2.;
883  //}
884  //else kMom=(minK+maxK);
885  //^^^ Direct calculation
886  G4double rnc=G4UniformRand();
887  cost = 1.-rnc-rnc;
888  }
889  G4double cQM2=qM2-(kMom+kMom)*quasM;
890  if(cQM2<0.)
891  {
892  //if(cQM2<-.0001)G4cerr<<"--Warning--G4Q::HQ:(PhBack) cQM2="<<cQM2<<" < 0"<<G4endl;
893  cQM2=0.;
894  }
895  G4double cQM=sqrt(cQM2); // Mass of the coloured residual Quasmom
896  k4Mom=zeroLV;
897  cr4Mom=G4LorentzVector(0.,0.,0.,cQM);
898  G4LorentzVector dir4M=q4Mom-G4LorentzVector(0.,0.,0.,q4Mom.e()*.01);
899  if(!G4QHadron(q4Mom).RelDecayIn2(k4Mom,cr4Mom,dir4M,cost,cost)) //Q->ColResQ+k_part
900  {
901 #ifdef debug
902  G4cerr<<"*G4Q::HQ:PB,M="<<quasM<<",cM="<<cQM<<",c="<<cost<<",F="<<gintFlag<<G4endl;
903 #endif
904  kCond=true;
905  if(addPhoton&&gintFlag)
906  {
907  q4Mom+= phot4M; // Recover Full Quasmon with Photon, if filed
908  qM2 = q4Mom.m2(); // Update the Current squared mass of Quasmon
909  if(qM2>0.) quasM = sqrt(qM2); // Update the Current Mass of Quasmon
910  else
911  {
912  if(qM2<-.0001)G4cerr<<"--Warning-- G4Q::HQ:Phot.M2="<<qM2<<" Cor to 0"<<G4endl;
913  quasM=0.;
914  }
915  gintFlag=false;
916  }
917  }
918  else // ***> The decay succeeded
919  {
920  if(addPhoton&&gintFlag) // Make it as if the phaton was a part of the Q
921  {
922  q4Mom+= phot4M; // Recover the Full Quasmon with the Photon
923  k4Mom+= phot4M; // add photon energy to a quark of the Cluster
924  qM2 = q4Mom.m2(); // Update the Current squared mass of Quasmon
925  quasM = sqrt(qM2); // Update the Current Mass of Quasmon
926  kMom=k4Mom.e(); // Update the k_parton momentum
927  gintFlag=false;
928  }
929 #ifdef debug
930  G4cout<<"G4Q::HQ:(PhBack) k="<<kMom<<",k4M="<<k4Mom<<",ct="<<cost<<",gF="<<gintFlag
931  <<G4endl;
932 #endif
933  kLS=k4Mom.e();
934  G4double rEn=cr4Mom.e();
935  rMo=cr4Mom.rho(); // p for the ResidualColouredQuasmon in LS
936  rEP=rEn+rMo; // E+p for the ResidualColouredQuasmon in LS
937  G4int totCand = theQCandidates.size(); // Total number of candidates
938 #ifdef sdebug
939  G4cout<<"G4Q::HQ: ****>>K-ITERATION #"<<kCount<<", k="<<kMom<<k4Mom<<G4endl;
940 #endif
941  for (G4int index=0; index<totCand; index++)
942  {
943  G4QCandidate* curCand=theQCandidates[index];
944  G4int cPDG = curCand->GetPDGCode();
945  if(cPDG==90000001||cPDG==90001000||cPDG==91000000||cPDG<MINPDG)//@@k-PreAtte(Acc)
946  {
947  G4bool poss= curCand->GetPossibility();
948 #ifdef debug
949  if(cPDG==90000001 || cPDG==90001000 || cPDG==90000002 || cPDG==90001001)
950  G4cout<<"G4Q::HQ:pos="<<poss<<",cPDG="<<cPDG<<",iQC="<<iniQChg<<G4endl;
951 #endif
952  if(poss)
953  {
954  G4double cMs=curCand->GetEBMass(); // EnvBound mass of the ParentCluster(?)
955  G4QContent cQC=curCand->GetQC(); // QuarkCont of the ParentCluster
956  G4double cfM=curCand->GetQPDG().GetMass(); // GS Mass of the ParentCluster
957  G4QContent rtQC=curQ+envQC-cQC; // TotResidualNucQuarkContent - OutFragm
958  G4QNucleus rtN(rtQC); // Create a pseudo-nucleus for residual
962 #ifdef debug
963  if(cPDG==90000001 || cPDG==90001000 || cPDG==90000002 || cPDG==90001001)
964  G4cout<<"G4Q::HQ:cfM="<<cfM<<",cMs="<<cMs<<",ind="<<index<<G4endl;
965 #endif
966  //G4double k = kMom; // * Temporary *
967  //if(cPDG>MINPDG&&cPDG!=NUCPDG) k=kLS; // ===> Nuclear case (Lab System)
968  G4double kMin=0.;
969  if(cMs) kMin=(cfM*cfM-cMs*cMs)/(cMs+cMs);
970  if(kMin<0.) kMin=0.;
971 #ifdef debug
972  G4double totr = rtN.GetMZNS();// Mass of the total Residual Nucleus
973  G4double bnM = totr-envM+cMs;// Bound mass of residual Quasmon
974  //G4double dR=(bnM*bnM-cQM2)/(rEP+rEP); // Cut for q-acceleration (physics?)
975  //if(b2<.000001) dR=((bnM*bnM-cQM2)/2.+pmk*(kLS-kMin))/(rEP+pmk);
976  //if (dR<0.) dR=0.;
977  G4double dR=0.; // @@ Temporary no q-acceleration cut is used
978  if(cPDG==90000001 || cPDG==90001000 || cPDG==90000002 || cPDG==90001001)
979  G4cout<<"G4Q::HQ:i="<<index<<",cPDG="<<cPDG<<",k="<<kMom<<","<<kLS<<">kMin="
980  <<kMin<<",bM="<<bnM<<",rEP="<<rEP<<",dR="<<dR<<",kCo="<<kCond<<G4endl;
981 #endif
982  if(kLS>kMin)
983  {
984  kCond=false;
985  break;
986  }
987  }
988  }
989  }
990  }
991  kCount++;
992  }
993  // End of search for "k": *** Here we forget about the initial photon forever ***???***
994 #ifdef debug
995  if(addPhoton)
996  G4cout<<"G4Q::HQ:***PHOTON OK***k="<<k4Mom<<",Q="<<q4Mom<<",PhE="<<addPhoton<<G4endl;
997 #endif
998  //if(gintFlag)kLS-=addPhoton; // @@ correct for the virtual (?) -*
999 #ifdef debug
1000  G4cout<<"G4Q::HQ:Select="<<kMom<<",ki="<<minK<<",ka="<<maxK<<",k="<<k4Mom<<kLS<<G4endl;
1001 #endif
1002  CalculateHadronizationProbabilities(excE,kMom,k4Mom,piF,gaF,first); // ProbIntegralCalc
1003  //CalculateHadronizationProbabilities(excE,kMom,kLS,piF,gaF); //ResMass is randomized
1004  //if(gintFlag)kLS+=addPhoton; // @@ correct for the virtual (?) -^
1005  addPhoton=0.; // the Photon is adopted: prepare to kill
1006  momPhoton=0.;
1007  //phot4M=zeroLV;
1008  G4double dk = kMom+kMom; // Double QCM k-value (only for hadr. in hadr.)
1009  G4int nCandid = theQCandidates.size();
1010  G4bool fprob = true; // Flag of existing decay probability
1012  G4bool fdul = false; // Prototype of flag of resonance decay
1013  int i=0; // "i" will point to the selected candidate
1014  G4double maxP = 0.;
1015  if(nCandid) maxP = theQCandidates[nCandid-1]->GetIntegProbability();
1016 #ifdef debug
1017  G4cout<<"G4Q::HQ:***RANDOMIZE CANDIDATEs***a#OfCand="<<nCandid<<",maxP="<<maxP<<G4endl;
1018 #endif
1019  if (maxP<=0.) // No possible channels for this k value
1020  {
1021 #ifdef debug
1022  if(status == 4) G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0001",
1023  FatalException, "HQ:*TMP EXCEPTION - NoChanalsOfFragmentation");
1024 #endif
1025 #ifdef debug
1026  G4cout<<"G4Q::HQ:Z="<<iniP<<",B="<<iniBN<<G4endl;
1027 #endif
1028  G4double qCB=theEnvironment.CoulombBarrier(iniP,iniBN);
1029 #ifdef debug
1030  G4cout<<"G4Q::HQ:qCB="<<qCB<<",Z="<<iniP<<",B="<<iniBN<<",eE="<<excE<<G4endl;
1031 #endif
1032  G4double pCB=theEnvironment.CoulBarPenProb(qCB,excE,iniP,iniBN);//@@ excE (?)
1033  G4bool qenv=envPDG!=90000000&&envPDG!=90000002&&envPDG!=90002000&&iniPDG!=90002000
1034  &&iniPDG!=90000002;// @@ Improved for nn & pp FinalStateInter
1035 #ifdef debug
1036  G4cout<<"G4Q::HQ: qCB="<<qCB<<",pCB="<<pCB<<",cond="<<qenv<<",N="<<nQuasms<<G4endl;
1037 #endif
1038  // @@ practically never is here
1039  if(!first&&excE>qCB&&envM+iniQM<totMass&&nQuasms==1&&qenv&&G4UniformRand()<pCB)
1040  //if(2>3) // Decay in GSQuasmon+GSEnviron **Is closed**
1041  {
1042  G4QHadron* resNuc = new G4QHadron(valQ,q4Mom);// Createa Hadron for Quasmon
1043  resNuc->CorMDecayIn2(iniQM,env4M); // Recalculate the fr4Mom for ResidualGSMass
1044  //@@CHECK CoulBar and may be evaporate instead
1045  FillHadronVector(resNuc); // Fill the OutgoingQuasmon (delete equivalent)
1046 #ifdef debug
1047  G4LorentzVector oQ4Mom=resNuc->Get4Momentum();
1048  G4cout<<"G4Q::HQ: outQM="<<oQ4Mom.m()<<oQ4Mom<<",GSQM="<<iniQM<<G4endl;
1049 #endif
1050  if(nQuasms==1) qEnv = G4QNucleus(env4M,envPDG);// Createa MovingEnvironmentNucleus
1051  else
1052  {
1053  G4QHadron* envH = new G4QHadron(envPDG,env4M); //@@ Moving Environment !
1054  FillHadronVector(envH); // Fill Moving Environment (delete equivalent)
1055  qEnv = vacuum;
1056  }
1057 #ifdef debug
1058  G4double eM=env4M.m();
1059  G4LorentzVector dif=tot4M-oQ4Mom-env4M;
1060  G4cout<<"G4Q::HQ: envM="<<envM<<"=="<<eM<<", envT="<<env4M.e()-eM<<dif<<G4endl;
1061 #endif
1062  ClearQuasmon(); // This Quasmon is done
1063  return theQHadrons; // The last decay of the quasmon...
1064  }
1065  else // May be evaporation is possible
1066  {
1067 #ifdef debug
1068  G4cout<<"G4Q::HQ:Q2E:E="<<theEnvironment<<",valQ="<<valQ<<",tot4M="<<tot4M<<G4endl;
1069 #endif
1070  //if(CheckGroundState()) ClearQuasmon(); // This Quasmon is done
1071  if(CheckGroundState(true)) ClearQuasmon(); // This Quasmon is done
1072  //if(CheckGroundState(true)) KillQuasmon(); // This Quasmon is done
1073  //else if(envPDG==NUCPDG && quasM>iniQM && iniBN>1) // Convert Quasmon to MovingEnv
1074  //{
1075 #ifdef debug
1076  // G4cerr<<"***G4Q::HQ:Q2E="<<theEnvironment<<",QC="<<valQ<<",4M="<<tot4M<<G4endl;
1077 #endif
1078  // theEnvironment=G4QNucleus(valQ,tot4M);
1079  // KillQuasmon();
1080  //}
1081  else if(envPDG==NUCPDG && quasM>iniQM) // Emergency decay in Gamma & GSQuasmon
1082  {
1083 #ifdef debug
1084  G4cout<<"***G4Q::HQ: Emergency Decay in Gamma/Pi0 + Residual GSQuasmon"<<G4endl;
1085  //throw G4QException("***G4Q::HadrQ:EmergencyDecay in Gamma+ResidualGSQuasmon");
1086 #endif
1087  G4int gamPDG=22;
1088  G4double gamM=0.;
1089  if(quasM>mPi0+iniQM)
1090  {
1091  gamPDG=111;
1092  gamM=mPi0;
1093  }
1094  G4LorentzVector r4Mom(0.,0.,0.,gamM); // mass of the photon/Pi0
1095  G4LorentzVector s4Mom(0.,0.,0.,iniQM); // mass of the GSQuasmon
1096  G4double sum=gamM+iniQM;
1097  if(sum>0. && fabs(quasM-sum)<eps)
1098  {
1099  r4Mom=q4Mom*(gamM/sum);
1100  s4Mom=q4Mom*(iniQM/sum);
1101  }
1102  else if(quasM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
1103  {
1104  // G4cerr<<"***G4Q::HQ:Q="<<q4Mom<<quasM<<"->g/pi0(M="<<gamM<<")+GSQ="<<iniPDG
1105  // <<"(M="<<iniQM<<")="<<sum<<", d="<<sum-quasM<<G4endl;
1106  // throw G4QException("G4Quasmon::HadronizeQ:(E=0)G/Pi0+GSQ decay error");
1108  ed << "(E=0)G/Pi0+GSQ decay error: Q=" << q4Mom << quasM
1109  << "->g/pi0(M=" << gamM << ")+GSQ=" << iniPDG << "(M="
1110  << iniQM << ")=" << sum << ", d=" << sum-quasM << G4endl;
1111  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0002",
1112  FatalException, ed);
1113  }
1114 #ifdef debug
1115  G4cout<<"G4Q::HQ:=== 0 ===>HadrVec, Q="<<q4Mom<<quasM<<"->g/pi0("<<gamPDG<<")="
1116  <<r4Mom<<gamM<<"+GSQ="<<iniPDG<<r4Mom<<iniQM<<G4endl;
1117 #endif
1118  G4QHadron* curHadr2 = new G4QHadron(gamPDG,r4Mom); // Creation Hadron for Gamma
1119  FillHadronVector(curHadr2); // Fill "new curHadr2" (delete equivalent)
1120  G4QHadron* curHadr1 = new G4QHadron(iniPDG,s4Mom);// Hadron for ResidualGSQuasmon
1121  FillHadronVector(curHadr1); // Fill "new curHadr1" (delete equivalent)
1122  ClearQuasmon(); // This Quasmon is done
1123  }
1124 #ifdef debug
1125  G4cout<<"***G4Q::HQ:dE="<<excE<<">minK="<<minK<<",Env="<<theEnvironment<<",k="<<kLS
1126  <<",Q="<<valQ<<quasM<<", nQ="<<nQuasms<<G4endl;
1127 #endif
1128  qEnv=theEnvironment;
1129  return theQHadrons;
1130  }
1131  }
1132  G4bool nucflag=false; // NuclearBinding Flag (can't reduce Environ)
1133  G4bool hsflag=false; // Prototype of H+S decay flag
1134  //G4bool fchipo=false; // Final decay of Quasmon-Chipolino
1135  G4LorentzVector rQ4Mom(0.,0.,0.,0.); // 4-momentum of residual Quasmon
1136  G4LorentzVector fQ4Mom(0.,0.,0.,0.); // 4-momentum of free Q-LV
1137  G4LorentzVector fr4Mom(0.,0.,0.,0.); // 4-momentum prototype for the fragment
1138  G4double rMass=0.; // Prototype of the residual Quasmon mass
1139  G4double kt=0.; // Squared Mass of the Residual Quasmon Proto
1140  // ***VQU*** (Comment for ***VBQ***VFQ***VTN***)
1141  G4double ku=0.; // Sq FreeMass of the Residual Quasmon Proto
1142  // -----------
1143  G4double kn=0.; // Squared Mass of ResidualQuasmon+ResidEnviron
1144  G4double sCBE=0.; // Coulomb Barier + mass of the fragment Proto
1145  G4int rPDG=0; // Prototype of the residual Quasmon PDG
1146  pCond=true;
1147  G4int pCount=0;
1148  G4LorentzVector PMEMfr4M(0.,0.,0.,0.); // 4Mom of the secondary fragment (the best)
1149  G4LorentzVector PMEMrQ4M(0.,0.,0.,0.); // 4Mom of the residual Quasmon (the best)
1150  G4QContent PMEMpQC(0,0,0,0,0,0); // QuarkContent of the ParentCluster (the best)
1151  G4QContent PMEMsQC(0,0,0,0,0,0); // QuarkContent of the ProducedFragm (the best)
1152  G4QContent PMEMtQC(0,0,0,0,0,0); // QuarkConteht of QEX meson (the best)
1153  G4QContent PMEMcQC(0,0,0,0,0,0); // currentQuarkConteht (residual)
1154  G4double PMEMktM2=0.; // H-MeasureOfTheSelection(**Which is better**)
1155  G4double PMEMknM2=0.; // H-MeasureOfTheSelection(**Which is better**)
1156  G4double PMEMreM2=0.; // SqMass of residQuasm+residEnviron (the best)
1157  G4double PMEMrMas=0.; // Mass of one of theProductsOfDecay (the best)
1158  G4double PMEMpMas=0.; // BoundByEnvironMass of ParentClust (the best)
1159  G4double PMEMsMas=0.; // Mass of outgoing hadron/nFragment (the best)
1160  G4double PMEMdMas=0.; // DifferenceBetween EnvBndPM & NuclBndPM(best)
1161  G4double PMEMmiSN=0.; // MinSquaredMass of ResidQ+ResidEnv (the best)
1162  G4double PMEMmiST=0.; // MinSquaredMass of ResidQuasm only (the best)
1163  G4double PMEMmiSB=0.; // MinSquaredMass of BoundResidQuasm (the best)
1164  G4int PMEMrPDG=0; // PDG of one of theProductsOfDecay (the best)
1165  G4int PMEMsPDG=0; // PDG of outgoing Hadron/nFragment (the best)
1166  G4int PMEMpPDG=0; // PDG code of the Parent Cluster (the best)
1167  G4bool PMEMhsfl=hsflag; // Flag of the Qusm->Hadr+Frag decay (the best)
1168  G4bool PMEMnucf=nucflag; // Flag of usage of nuclear binding (the best)
1169 #ifdef debug
1170  G4cout<<"G4Q::HQ: fp="<<fprob<<",QM="<<quasM<<",QQC="<<valQ<<",k="<<kMom<<G4endl;
1171 #endif
1172  while(pCount<pCountMax&&pCond) // @@ It is better to make it with theParentChange
1173  {
1174  hsflag=false;
1175 #ifdef debug
1176  G4cout<<"G4Q::HQ:***>New p-Attempt#"<<pCount<<",pMax="<<pCountMax<<",hsfl=0"<<G4endl;
1177 #endif
1178  G4double totP = maxP * G4UniformRand();
1179  while(theQCandidates[i]->GetIntegProbability() < totP) i++;
1180  if (i>=nCandid)
1181  {
1183  ed <<"Too big number of the candidate: Cand#"<< i <<" >= Tot#"<< nCandid << G4endl;
1184  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0003", FatalException, ed);
1185  }
1186  curQ = valQ; // Temporary copy of valQ to estimate MinM2
1187  if (!fprob) // At present is closed // Prepare final decay (nothing was selected)
1188  {
1189  memQ=curQ; // Remembe QC for the case of 2H decay
1190  sPDG=curQ.GetSPDGCode(); // PDG of current Quasmon as S-hadron
1191  if(!sPDG&&theEnvironment.GetPDG()!=NUCPDG&&totBN>1&&totMass>totM&&totS>=0)
1192  {
1193 #ifdef pdebug
1195  ed << "Why Fail? (1): NEED-EVAP-1:Q=" << q4Mom << valQ << ",En="
1196  << theEnvironment << G4endl;
1197  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0004", FatalException, ed);
1198 #endif
1199  qEnv=theEnvironment;
1200  return theQHadrons;
1201  }
1202  else if(!sPDG)
1203  {
1205  ed << "DecayPartSelection,Evaporation: sPDG=0,E=" << theEnvironment
1206  << ",B=" << totBN << ",S=" << totS << G4endl;
1207  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0005", FatalException, ed);
1208  }
1209  else if(sPDG==10) // ---> "Chipolino" case
1210  {
1211  //fchipo=true;
1212  G4QChipolino chipQ(valQ);
1213  G4QPDGCode QPDG1=chipQ.GetQPDG1();
1214  sPDG = QPDG1.GetPDGCode();
1215  sMass= QPDG1.GetMass();
1216  G4QPDGCode QPDG2=chipQ.GetQPDG2();
1217  rPDG = QPDG2.GetPDGCode();
1218  rMass= QPDG2.GetMass();
1219  if(sMass+rMass>quasM) //@@ Evaporate but try 3Pt decay with Environ
1220  {
1221  if(totBN>1&&totMass>totM&&totS>=0)
1222  {
1223 #ifdef pdebug
1225  ed << " Why Fail? (2): NEED-EVAP-2:Q=" << q4Mom << valQ << ",E="
1226  << theEnvironment << G4endl;
1227  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0006",
1228  FatalException, ed);
1229 #endif
1230  qEnv=theEnvironment;
1231  return theQHadrons;
1232  }
1233  else
1234  {
1236  ed << "VirtChipo Can't EvapNucleus: QM=" << quasM << "<S=" << sMass
1237  << "+R=" << rMass << "=" << sMass+rMass << ",tB=" << totBN
1238  << ",tS=" << totS << ",tM=" << totMass << ">minM=" << totM << G4endl;
1239  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0007",
1240  FatalException, ed);
1241  }
1242  }
1243  }
1244  else if(nQuasms>1)
1245  {
1246 #ifdef pdebug
1248  ed << "Why Fail ? (0): NEED-EVAP-0:Q=" << q4Mom << valQ << ",En="
1249  << theEnvironment << G4endl;
1250  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0008", FatalException, ed);
1251 #endif
1252  qEnv=theEnvironment;
1253  return theQHadrons;
1254  }
1255  else // --->@@ Final decay in MinHadr+(PI0 or GAM)??
1256  {
1257  sMass=G4QPDGCode(sPDG).GetMass();
1258  rPDG=envPDG;
1259  if (rPDG>MINPDG&&rPDG!=NUCPDG)
1260  {
1261  rMass=theEnvironment.GetMZNS();
1262  q4Mom+=G4LorentzVector(0.,0.,0.,rMass);
1263  valQ +=theEnvironment.GetQC();
1264  quasM=q4Mom.m();
1265  KillEnvironment();
1266  //fred=true; // Flag of environment reduction -Not used-
1267  }
1268  else if(rPDG!=NUCPDG&&totBN>1&&totMass>totM&&totS>=0) // ===> "Evaporation" case
1269  {
1270 #ifdef pdebug
1271  G4QContent nTotQC=totQC-neutQC;
1272  G4QNucleus nTotN(nTotQC); // PseudoNucleus for TotalResidual to neutron
1273  G4double nTotM =nTotN.GetMZNS(); // MinMass of the Total Residual to neutron
1274  G4double dMnT=totMass-nTotM-mNeut;// Energy excess for the neutron
1275  G4QContent pTotQC=totQC-protQC;
1276  G4QNucleus pTotN(pTotQC); // PseudoNucleus for TotalResidual to proton
1277  G4double pTotM =pTotN.GetMZNS(); // MinMass of the Total Residual to proton
1278  G4double dMpT=totMass-pTotM-mProt;// Energy excess for neutron
1279  if(dMpT>dMnT)dMnT=dMpT;
1281  ed << "Why Fail ? (3): NEED-EVAP3:s=" << sPDG << ",Q=" << q4Mom
1282  << valQ << ",r=" << rPDG << G4endl;
1283  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0009",FatalException,ed);
1284 #endif
1285  qEnv=theEnvironment;
1286  return theQHadrons;
1287  }
1288  else if(rPDG==NUCPDG)
1289  {
1290 #ifdef debug
1291  G4cout<<"G4Quasmon::HadronizeQuasm:SafatyDecayIn PI0/GAM, rPDG="<<rPDG<<G4endl;
1292 #endif
1293  if(totMass-totM>mPi0)
1294  {
1295  rMass=mPi0; // Safety decay in pi0
1296  rPDG=111;
1297  }
1298  else
1299  {
1300  rMass=0.; // Safety decay in gamma
1301  rPDG=22;
1302  }
1303  }
1304  }
1305  hsflag=true; // Two particle decay is forced ???
1306 #ifdef debug
1307  G4cout<<"G4Q::HQ:hsflagTRUE,s="<<sPDG<<","<<sMass<<",r="<<rPDG<<","<<rMass<<G4endl;
1308 #endif
1309  }
1310  else // ---> "Something was selected" case
1311  {
1312  G4QCandidate* curCand = theQCandidates[i];// Pointer toSelectedCandidate:hadr/fragm
1313  sPDG = curCand->GetPDGCode(); // PDG of the selected candidate
1315 #ifdef debug
1316  G4cout<<"G4Q::HQ:hsfl="<<hsflag<<", sPDG="<<sPDG<<", i="<<i<<G4endl;
1317 #endif
1318  //@@ For clusters use another randomization & a loop over possible parent clusters
1319  if(sPDG>MINPDG&&sPDG!=NUCPDG) // ===> "Fragment" case
1320  {
1321  G4int ip=0;
1322  G4int nParCandid = curCand->GetPClustEntries();
1323  G4double sppm = curCand->TakeParClust(nParCandid-1)->GetProbability();
1324  if (sppm<=0) // Impossible to find a parent cluster
1325  {
1326  G4cerr<<"***G4Quasmon::HadronizeQ:P="<<theQCandidates[i]->GetIntegProbability()
1327  <<",nC="<<nParCandid<<",pP="<<sppm<<",QM="<<quasM<<",QC="<<valQ;
1328  for(int ipp=0; ipp<nParCandid; ipp++)
1329  G4cerr<<", "<<ipp<<": "<<curCand->TakeParClust(ip)->GetProbability();
1330  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0010", FatalException,
1331  "NoParentClust forTheFragment");
1332  }
1333  else // ---> "Parent cluster was found" case
1334  {
1335  G4double totPP = sppm * G4UniformRand();
1336  while(curCand->TakeParClust(ip)->GetProbability() < totPP) ip++;
1337 #ifdef debug
1338  G4cout<<"G4Q::HQ:p#ip="<<ip<<",f#i="<<i<<",tP="<<totPP<<",sP="<<sppm<<G4endl;
1339 #endif
1340  }
1341  G4QParentCluster* parCluster=curCand->TakeParClust(ip);
1342  pPDG = parCluster->GetPDGCode();
1343  G4QPDGCode pQPDG(pPDG);
1344  pQC = pQPDG.GetQuarkContent();
1345  pBaryn= pQC.GetBaryonNumber();
1346  pMass = parCluster->GetEBMass(); // Environment Bounded Mass
1347  pNMass = parCluster->GetNBMass(); // NuclBoundedMass @@Env.Reduce dosn't work
1348  transQC = parCluster->GetTransQC();
1349  delta = parCluster->GetEBind(); // Environmental Binding
1350  deltaN = parCluster->GetNBind(); // Nuclear Binding
1351  loli = parCluster->GetLow();
1352  hili = parCluster->GetHigh();
1353  //G4double dhil=.0001*(hili-loli); // Safety factor
1354  //loli += dhil;
1355  //hili -= dhil;
1356  npqp2 = parCluster->GetNQPart2();
1357  // @@ One can get otherUsefulParameters of the parent cluster for hadronization
1358  G4QPDGCode sQPDG(curCand->GetPDGCode());
1359  sQC = sQPDG.GetQuarkContent();
1360  //if(sPDG==90001001 && G4UniformRand()>0.75) sMass=np; //@@ n-p pair
1361  if(sPDG==90001001 && G4UniformRand()>1.0) sMass=np; //@@ no n-p pair (close)
1362  else sMass = sQPDG.GetMass();
1363  sM2 = sMass*sMass; // Squared mass of the fragment
1364  curQ += transQC; // Subtract ExchangeMesonQC from QuasmonQC
1365 #ifdef debug
1366  G4cout<<"G4Q::HQ:valQ="<<valQ<<"+transQ="<<transQC<<"("<<pPDG<<" to "<<sPDG
1367  <<") = curQ="<<curQ<<",InvBinding="<<delta<<",pM="<<pMass<<pQC<<G4endl;
1368 #endif
1369  }
1370  else // ===> "Hadron" case
1371  {
1372  pBaryn=0; // @@ ?
1373  sQC=theQCandidates[i]->GetQC();
1374  sMass = theQCandidates[i]->GetNBMass();// Mass is randomized on probability level
1375  sM2=sMass*sMass; // SqMass is randomized on probability level
1376  curQ-= sQC; // Subtract outHadron QC from QC of Quasmon
1377 #ifdef debug
1378  G4cout<<"G4Q::HQ: hsfl="<<hsflag<<", valQ="<<valQ<<"-sQ="<<sQC<<",sM="<<sMass
1379  <<",C="<<theQCandidates[i]->GetPDGCode()<<",Q="<<curQ<<",M2="<<sM2<<G4endl;
1380 #endif
1381  }
1382  G4QContent resNQC=totQC-sQC; // Quark Content of the totNucleus-Fragment
1383  G4QNucleus resTN(resNQC);
1384  G4double resTNM=resTN.GetMZNS(); // Mass of totNucleus-Fragment
1385  G4double sCB=0;
1386  if(resTN.GetA()>0) sCB=totN.CoulombBarrier(sQC.GetCharge(),sQC.GetBaryonNumber());
1387  sCBE=sCB+sMass;
1388 #ifdef debug
1389  G4cout<<"G4Q::HQ:rQC="<<resNQC<<",rM="<<resTNM<<",sM="<<sMass<<",CB="<<sCB<<G4endl;
1390 #endif
1391  memQ=curQ; // Remembe QC for "DecayIn2 Hadrons" case
1392  G4double rtM=0.;
1393  G4double reM=0.; // Mass of the residual environment
1394  //-> Calculate the SquaredGroundStateMass of theResidualQuasmon+ResidualEnvironment
1395  //if(envPDG>pPDG)
1396  if(envA>=pBaryn)
1397  {
1398  // *** LIM ***
1399  G4QContent RNQC=curQ+envQC;
1400  if(sPDG>MINPDG&&sPDG!=NUCPDG) RNQC-=pQC; // ==> "Nuclear Fragment Radiation" case
1401  if(envA-pBaryn>bEn) RNQC=curQ+bEnQC; // Leave the minimum environment
1402  G4int RNPDG = RNQC.GetSPDGCode(); // Total kinematically involved nuclear mass
1403  if(RNPDG==10) minSqN=G4QChipolino(RNQC).GetMass2();// MinSqM of DiHadron of Chipo
1404  else if(!RNPDG) // It never should happen as curQ is real and env/bEn QC is > 0
1405  {
1406  //#ifdef debug
1407  G4cout<<"**G4Q::HQ:*KinematicTotal*, PDG="<<RNPDG<<curQ<<", QC="<<RNQC<<G4endl;
1408  //#endif
1409  minSqN=1000000.;
1410  }
1411  else
1412  {
1413  G4double minN=G4QPDGCode(RNPDG).GetMass();
1414  minSqN=minN*minN; // SquaredGSMass of ResidQuasmon+ResidEnviron
1415 #ifdef debug
1416  G4cout<<"G4Q::HQ:M="<<bEn<<",A="<<envA<<",B="<<pBaryn<<",N="<<minN<<G4endl;
1417 #endif
1418  }
1419  }
1420  else
1421  {
1422 #ifdef debug
1423  G4cout<<"*G4Q::HQ:EnvironmentA="<<envA<<" < SecondaryFragmentA="<<pBaryn<<G4endl;
1424 #endif
1425  }
1426  // ---> Calculate the Minimum Squared Mass of the Residual Quasmon
1427  G4int rqPDG = curQ.GetSPDGCode(); // PDG Code of the residual Quasmon
1428  if(rqPDG==111&&sPDG!=111&&G4UniformRand()>.5) rqPDG=221;
1429  //if(rqPDG==221&&sPDG!=221&&sPDG!=331&&G4UniformRand()<.5) rqPDG=111;
1430  G4int rQQ=G4QPDGCode(curQ).GetQCode();
1431  if(rqPDG==10) {
1432  minSqT=G4QChipolino(curQ).GetMass2();// MinSqMass of DoubleHadron of Chipolino
1433  minSqB=minSqT;
1434  minT=sqrt(minSqT);
1435 
1436  } else if(!rqPDG||rQQ<-1) {
1437 #ifdef debug
1438  G4cerr<<"*G4Q::HQ:*** ResidualQuasmon *** PDG="<<rqPDG<<curQ<<",Q="<<rQQ<<G4endl;
1439 #endif
1440  minT=100000.; // Mass of free Quasmon
1441  minSqT=10000000000.; // SqMass of free Quasmon
1442  minSqB=10000000000.; // SqMass of bound Quasmon
1443 
1444  } else {
1446  minT=G4QPDGCode(rqPDG).GetMass();
1447  if(sPDG<MINPDG&&envPDG>MINPDG&&envPDG!=NUCPDG)// Hadron with environment(not QEX)
1448  {
1449  G4int rqZ=curQ.GetCharge();
1450  G4int rqS=curQ.GetStrangeness();
1451  G4int rqN=curQ.GetBaryonNumber()-rqS-rqZ;
1452  G4double qpeM=G4QNucleus(envZ+rqZ,envN+rqN,envS+rqS).GetGSMass();
1453 #ifdef debug
1454  G4cout<<"G4Q::HadQ:Z="<<rqZ<<",N="<<rqN<<",S="<<rqS<<",eZ="<<envZ<<",eN="<<envN
1455  <<",eS="<<envS<<",ePDG="<<envPDG<<",eM="<<envM<<",tM="<<qpeM<<G4endl;
1456 #endif
1457  minT=qpeM-envM;
1458  }
1459  minSqT=minT*minT; // Squared minimum mass of residual quasmon
1460 #ifdef debug
1461  G4cout<<"G4Q::HQ:rPDG="<<rqPDG<<curQ<<",minT="<<minT<<",minSqT="<<minSqT
1462  <<",hsfl="<<hsflag<<G4endl;
1463 #endif
1464  G4double newT=0.; // Prototype of minimal TotBoundQuasmon mass
1465  // (Hadron with environment
1466  // (see above?) || QEX) && (Q==nucFrag || Q==n,p,Lambda)
1467 
1468  if ( ( (sPDG < MINPDG && envPDG > MINPDG && envPDG != NUCPDG) ||
1469  (sPDG > MINPDG && sPDG != NUCPDG && envPDG > pPDG)
1470  ) && ( (rqPDG > MINPDG && rqPDG != NUCPDG) ||
1471  rqPDG==2112 || rqPDG==2212 || rqPDG==3122
1472  )
1473  )
1474  {
1475  if(sPDG<MINPDG) // The radiatedBaryon is aVaquum(QF) particle
1476  {
1477  // *** LIM ***
1478  G4QContent rtQC=curQ; // Total Residual Quasmon Quark Content
1479  if (envA > bEn) // Nucl Env > than A_max
1480  {
1481  reM=mbEn;
1482  rtQC+=bEnQC;
1483  }
1484  else
1485  {
1486  reM=envM; // MinMassOfResidEnviron = MassOfEnviron
1487  rtQC+=envQC; // Nucl Env is below A_max=bEn
1488  }
1489  G4QNucleus rtN(rtQC); // Create a pseudo-nucleus for E+Q
1490  rtM=rtN.GetMZNS(); // MinMass of TotalResidualNucleus (+hadron)
1491  newT=rtM-reM; // The effective mass
1492 #ifdef debug
1493  G4cout<<"G4Q::HQ:***VacuumFragmentation** M="<<newT<<",rM="<<rtM<<rtQC
1494  <<",eM="<<envM<<",mM="<<minT<<G4endl;
1495 #endif
1496  }
1497  else // The RadiatedHadron is aQuarkExchange frag.
1498  {
1499 
1500  G4QContent reQC=envQC-pQC; // Total Residual Quark Content
1501  if(envA-pBaryn>bEn) reQC=bEnQC; // Nucl Env - fragment > than A_max
1502  G4QNucleus reN(reQC); // Create a pseudoNucleus for ResidualNucleus
1503  reM=reN.GetMZNS(); // Min Mass of the residual EnvironmentNucleus
1504  // *** LIM ***
1505  G4QContent rtQC=curQ; // Total Quasmon Quark Content
1506 #ifdef debug
1507  G4cout<<"G4Q::HQ:reQC="<<reQC<<",rtQC="<<rtQC<<",eA="<<envA<<",pB="<<pBaryn
1508  <<",bE="<<bEn<<bEnQC<<G4endl;
1509 #endif
1510  rtQC+=reQC; // Quasmon + (effective) nuclear environment
1511  G4QNucleus rtN(rtQC); // Create a pseudo-nucleus for residual ENE
1512  rtM=rtN.GetMZNS(); // MinMass of TotalResidualNucleus (fragment)
1513  // *** LIM ***
1514  if (envA-pBaryn > bEn) newT=rtM-mbEn;
1515  else newT=rtM-reM;
1516 #ifdef debug
1517  G4cout<<"G4Q::HQ:NuclFrM="<<newT<<",r="<<rtM<<rtQC<<",e="<<envM<<envQC<<",p="
1518  <<pMass<<pQC<<",re="<<reM<<reQC<<",exEn="<<totMass-rtM-sMass<<G4endl;
1519 #endif
1520  }
1521  if(minT<newT) newT=minT;
1522  }
1523  minSqB=newT*newT; // MinSquaredMass of BoundedResidualQuasmon
1524  }
1525 #ifdef debug
1526  G4cout<<"G4Q::HQ:rq="<<rqPDG<<",miT="<<minSqT<<",miB="<<minSqB<<",M="<<rtM<<G4endl;
1527 #endif
1528  if(!minSqT)
1529  {
1531  ed << "MinResMass can't be calculated: minSqT=0(!), curQ=" << curQ << G4endl;
1532  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0011", FatalException, ed);
1533  }
1534  G4double m2_value = BIG2; //@@ justBigNumber// Prototype/Squared Mass of Residual Quasmon
1535  //G4double kp=0.; // 3-Mpm/Mass for the residual Quasmon (?)
1536  if (sPDG > MINPDG && sPDG != NUCPDG) {// ==> NuclearFragmentCandidate hadronization
1537 #ifdef debug
1538  G4cout<<"G4Q::HQ: BoundM="<<pMass<<",FreeM="<<sMass<<",QM="<<quasM<<G4endl;
1539 #endif
1540  // = = = = P u r e k i n e m a t i c a l c a l c u l a t i o n s: = = = = =
1541  // Fusion of k + parentCluster => colouredCluster (cc)
1542  G4LorentzVector cl4Mom(0.,0.,0.,pMass);// 4-momentum prototype for parent cluster
1543  G4LorentzVector tot4Mom=q4Mom+cl4Mom; // @@ Just for checking
1544 #ifdef debug
1545  G4cout<<"G4Q::HQ:Q("<<quasM<<")->k("<<k4Mom<<")+CRQ("<<cr4Mom.m()<<")"<<G4endl;
1546 #endif
1547  G4LorentzVector cc4Mom=k4Mom+cl4Mom;// 4-mom of ColoredFragment (before kappa)
1548  G4double ccM2=cc4Mom.m2(); // SquaredMass of the ColoredFragment
1549  G4double frM2=sMass*sMass; // MinSuaredMass of the OutgoingFragment
1550  if (ccM2 <= frM2) // Decaying ColoredFragmM < FragmM
1551  {
1552 #ifdef debug
1553  G4cout<<"***G4Q::HQ:FailedToFind FragmM:"<<ccM2<<"<"<<frM2<<",M="<<pMass<<"+k="
1554  <<k4Mom<<"="<<sqrt(ccM2)<<cc4Mom<<" < fM="<<sMass<<",miK="<<minK<<G4endl;
1555 #endif
1556  dMass=pMass-pNMass; // Remember the difference
1557  pMass=pNMass;
1558  delta=deltaN;
1559  cl4Mom=G4LorentzVector(0.,0.,0.,pMass); // 4-momentum proto for parent cluster
1560  tot4Mom=q4Mom+cl4Mom; // @@ Just for checking
1561  cc4Mom=k4Mom+cl4Mom; // 4-mom of ColoredFragment (before kappa)
1562  ccM2=cc4Mom.m2();
1563  if (ccM2 <= frM2)
1564  {
1565 #ifdef debug
1566  G4cout<<"G4Q::HQ:hsflagTRUE*NuclBINDING,ccM2="<<ccM2<<"<frM2="<<frM2<<G4endl;
1567 #endif
1568  hsflag=true; // Flag of decay in Q+S
1569  }
1570  else
1571  {
1572 #ifdef debug
1573  G4cout<<"G4Q::HQ:***NUCLEAR BINDING***ccM2="<<ccM2<<" > frM2="<<frM2<<G4endl;
1574 #endif
1575  nucflag=true; // Nuclear binding was used
1576  }
1577  }
1578  else
1579  {
1580 #ifdef debug
1581  G4double crMass2 = cr4Mom.m2(); // SquredMass of ColouredResidualQuasmon
1582  G4cout<<"G4Q::HQ:cM2="<<crMass2<<"="<<rEP*(rEP-rMo-rMo)<<",h="<<hili<<",l="
1583  <<loli<<G4endl;
1584 #endif
1585  if(hili<loli) hili=loli;
1587  G4double fpqp2=static_cast<double>(npqp2);
1588  G4double pw=1./fpqp2;
1589  // ------>> Decay of the ColouredCluster in a Fragment + kappa (fixed ctc) <<--
1590  qCond=true;
1591  G4int qCount=0;
1592 #ifdef pdebug
1593  G4double dM=0.;
1594  if(sPDG==90001001) dM=2.25; // Binding energy of the deuteron ???
1595  G4cout<<"G4Q::HQ:Is xE="<<excE<<" > sM="<<sMass<<"-pM="<<pMass<<"-dM="<<dM
1596  <<" = "<<sMass-pMass-dM<<G4endl;
1597 #endif
1598 #ifdef debug
1599  G4cout<<"G4Q::HQ: must totM="<<totMass<<" > rTM="<<resTNM<<"+sM="<<sMass<<" = "
1600  <<sMass+resTNM<<G4endl;
1601 #endif
1602  if(resTNM && totMass<resTNM+sMass)// Probably it never takes place
1603  {
1604 #ifdef pdebug
1605  G4cout<<"***G4Quasmon::HadronizeQuasmon:***PANIC#1***TotalDE="<<excE<<"< bE="
1606  <<sMass-pMass-dM<<", dM="<<dM<<", sM="<<sMass<<", bM="<<pMass<<G4endl;
1607  //throw G4QException("G4Quasmon::HadronizeQuasmon: Why PANIC? (1)"); //@@ TMP
1608 #endif
1609  status =-1; // Panic exit
1610  qEnv=theEnvironment; // Update the QEnvironment ???
1611  return theQHadrons;
1612  }
1613  G4double ex=kLS-delta; // EnvironmentExcess of parton energy in LS
1614  G4double dex=ex+ex;
1615  G4QContent tmpEQ=envQC-pQC; // Quark content for Residual Environment
1616  if(envA-pBaryn>bEn) tmpEQ=bEnQC; // Leave the minimum environment
1617  G4QNucleus tmpN(tmpEQ); // Pseudo nucleus for Residual Environment
1618  G4double tmpNM=tmpN.GetMZNS(); // Mass of Residual Environment
1619 #ifdef debug
1620  G4cout<<"G4Q::HQ:eQC="<<envQC<<",pQC="<<pQC<<",rEnvM="<<tmpNM<<",hsfl="<<hsflag
1621  <<G4endl;
1622 #endif
1623  G4QContent tmpRQ=valQ+transQC; // QContent of Residual Quasmon
1624  G4QContent tmpTQ=tmpRQ+tmpEQ; // QC of TotalResidualNucleus for a Fragment
1625  G4QNucleus tmpT(tmpTQ); // Nucleus for TotalResidNucleus for Fragment
1626  G4double tmpTM=tmpT.GetMZNS(); // GSMass of TotalResidNucleus for Fragment
1627  tmpTM2=tmpTM*tmpTM; // SqGSMass of TotResNuc for Fragment (gam)
1628  G4LorentzVector ResEnv4Mom(0.,0.,0.,tmpNM);
1629  G4LorentzVector tCRN=cr4Mom+ResEnv4Mom;
1630  // ***VQU*** (Comment when using ***VBQ*** and ***VTN***)
1631  G4double tmpBE=minT+tmpNM-tmpTM; // Binding energy for the ResidualQuasmon
1632 #ifdef debug
1633  // *AllThis is just for checking & debugging messages. Don't add calculations!*
1634  G4double tcEP=tCRN.e()+tCRN.rho();
1635  // Test that the edge of the Phase Space is reachable
1636  G4double cta=1.-(dex/(1.-pow(loli,pw))-pMass)/kLS;//cos(theta_k,kappa_max) inLS
1637  if(cta>1.0001)G4cerr<<"Warn-G4Q::HQ: cost_max="<<cta<<">1.CorHadrProb"<<G4endl;
1638  G4double kap_a=ex/(1.+kLS*(1.-cta)/pMass);//MaxEnergy of theRecoilQuark (q_max)
1639  G4double cti=1.-(dex/(1.-pow(hili,pw))-pMass)/kLS;//cos(theta_k,kappa_max) inLS
1640  if(cti<-1.0001)G4cerr<<"Warn-G4Q::HQ: cost_i="<<cti<<"<-1.CorHadrProb"<<G4endl;
1641  G4double kap_i=ex/(1.+kLS*(1.-cti)/pMass);//MinEnergy of theRecoilQuark (q_min)
1642  G4double q_lim=(tmpTM2-tCRN.m2())/(tcEP+tcEP);
1643  if(cti>cta+.0001)G4cerr<<"**G4Q::HQ:ci="<<cti<<">ca="<<cta<<".CorHPro"<<G4endl;
1644  G4cout<<"G4Q::HQ:qi="<<kap_i<<",ci="<<cti<<",a="<<kap_a<<",ca="<<cta<<",e="<<ex
1645  <<",q="<<q_lim<<",S="<<tmpTM*tmpTM<<",R2="<<tCRN.m2()<<","<<tcEP<<G4endl;
1646 #endif
1647  // Try the maximumPossibleRange of theRecoilQuark (@@Temporary) --- Starts Here
1648 #ifdef debug
1649  //G4cout<<"G4Q::HQ: Befor TMP Cor: loli="<<loli<<",hili="<<hili<<G4endl;
1650 #endif
1651  //loli=pow((1.-dex/pMass),fpqp2); //@@ Should not be in the production
1652  //hili=pow((1.-dex/(pMass+kLS+kLS)),fpqp2);//@@ Should not be in the production
1653 #ifdef debug
1654  //G4cout<<"G4Q::HQ: After TMP Cor: loli="<<loli<<",hili="<<hili<<G4endl;
1655 #endif
1656  // @@ Temporary stops here ^^^^^^^^^^^^^^^^^^^^^!!! Comment it !!!
1657  G4LorentzVector MEMkp4M(0.,0.,0.,0.);
1658  G4LorentzVector MEMfr4M(0.,0.,0.,0.);
1659  G4LorentzVector MEMrQ4M(0.,0.,0.,0.);
1660  G4double MEMrQM2=0.;
1661  G4double MEMsCBE=0.;
1662  G4double MEMreM2=0.;
1663  // *** Very Temporary @@ cos(theta_k_q)<0 Gives "quasi-elastic"
1664  //G4double minz=1.-dex/(pMass+kLS);
1665  //G4double nlol=pow(minz,fpqp2);
1666  //if(loli<nlol) loli=nlol;
1667  // *** End of Temporary @@
1668  while(qCount<qCountMax&&qCond)// @@ It's better to make it with theParentChange
1669  {
1670  G4double z = pow(loli+(hili-loli)*G4UniformRand(),pw);//***q-RANDOMIZATION***
1671  //**PSLtest**//G4double z= pow(hili,pw); // ***TMP AtLimit q-RANDOMIZATION***
1672  //**PSLtest**//G4double z= pow(loli,pw); // ***TMP AtLimit q-RANDOMIZATION***
1673  //**PSLtest**//G4double z= pow((loli+hili)/2,pw);// ***TMP Mid q-RANDOMIZE***
1674  G4double ctkk=1.-(dex/(1.-z)-pMass)/kLS;// cos(theta_k,kappa) in LS
1675 #ifdef pdebug
1676  if(qCount) G4cout<<"G4Q::HQ:qC="<<qCount<<",ct="<<ctkk<<",M="<<pMass<<",z="
1677  <<z<<",zl="<<pow(loli,pw)<<",zh="<<pow(hili,pw)<<",dE="
1678  <<totMass-totM<<",bE="<<sMass-pMass<<G4endl;
1679 #endif
1680 #ifdef debug
1681  G4cout<<"G4Q::HQ:ct="<<ctkk<<",pM="<<pMass<<",z="<<z<<",zl="<<pow(loli,pw)
1682  <<",zh="<<pow(hili,pw)<<",ex="<<ex<<",li="<<loli<<",hi="<<hili<<G4endl;
1683 #endif
1684  if(abs(ctkk)>1.00001)
1685  {
1686 #ifdef debug
1687  G4cerr<<"***G4Q:HQ:ctkk="<<ctkk<<",ex="<<ex<<",z="<<z<<",pM="<<pMass
1688  <<",kLS="<<kLS<<",hi="<<hili<<",lo="<<loli<<",n="<<npqp2<<G4endl;
1689  //throw G4QException("***TemporaryException***G4Q::HQ:cos(theta) limits");
1690 #endif
1691  if(ctkk> 1.)ctkk= 1.;
1692  if(ctkk<-1.)ctkk=-1.;
1693  }
1694  G4double cen=kLS+pMass; // LS Energy of k+parentCluster CompSystem
1695  G4double ctc=(cen*ctkk-kLS)/(cen-kLS*ctkk);//cos(theta_k,kap) in k+pClastSyst
1696  if(abs(ctc)>1.)
1697  {
1698  //G4cout<<"***G4Quasm:HadrQ: e="<<cen<<", k="<<kLS<<", cost="<<ctc<<G4endl;
1699  if(ctc>1.) ctc=1.;
1700  else if(ctc<-1.) ctc=-1.;
1701  }
1702  kp4Mom=zeroLV; // 4-mom update for RecoilQuark (q)
1703  fr4Mom=G4LorentzVector(0.,0.,0.,sMass); // 4-mom update for the fragment
1704  if(!G4QHadron(cc4Mom).RelDecayIn2(kp4Mom, fr4Mom, k4Mom, ctc, ctc))
1705  {
1707  ed << "Can't dec ColClust(Fr+kap): c4M=" << cc4Mom << ",sM="
1708  << sMass << ",ct=" << ctc << G4endl;
1709  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0012",
1710  FatalException, ed);
1711  }
1712  // @@ How the LS cost=ctr can be compared with the CM ctc
1713  //G4ThreeVector cc3v=cc4Mom.vect();
1714  //G4ThreeVector kp3v=kp4Mom.vect();
1715  //G4double ctr=cc3v.dot(kp3v)/cc3v.mag()/kp3v.mag();
1716  //G4cout<<"G4Q::HQ:cost="<<ctc<<"="<<ctr<<", d="<<ctc-ctr<<G4endl;
1717 #ifdef debug
1718  G4double ccM=sqrt(ccM2);
1719  G4double kappa=ex/(1.+kLS*(1.-ctkk)/pMass);// Energy of the RecoilQuark in LS
1720  G4cout<<"G4Q::HQ:>>ColDec>>CF("<<ccM<<")->F("<<sMass<<")+q"<<kp4Mom<<"="
1721  <<kappa<<",hsfl="<<hsflag<<G4endl;
1722 #endif
1723  //fmh=true; // -Not used?-
1724  // Fusion of the ColouredResidQuasm + kappa (LS) -> get residual Quasmon mass
1725  rQ4Mom=cr4Mom+kp4Mom; // 4-momentum of residual Quasmon
1726  G4LorentzVector retN4Mom=rQ4Mom+ResEnv4Mom;
1727  reTNM2=retN4Mom.m2(); // RealMass of TotResidNuc forFragment
1728  // The following is a soft Q+q(kappa) check
1729  // ***VTN***
1730  //if(reTNM2>=tmpTM2 && fr4Mom.e()>=sCBE) // tmpTM2=SqGSMassOfTotResidNucleus
1731  // ***VBQ***
1732  //G4double rQM2=rQ4Mom.m2(); // TMP (Before the "kt" is defined)
1733  //if(rQM2>=minSqB && reTNM2>=tmpTM2 && fr4Mom.e()>=sCBE) // minSqB = BndResQ
1734  // ***VFQ***
1735  //G4double rQM2=rQ4Mom.m2(); // TMP (Before the "kt" is defined)
1736  //if(rQM2>=minSqT && fr4Mom.e()>=sCBE) // minSqB = SqGSMass of BoundResidQ
1737  // ***VQU***
1738  fQ4Mom=rQ4Mom+G4LorentzVector(0.,0.,0.,tmpBE); // Free Quasmon 4-mom
1739  G4double fQM2=fQ4Mom.m2(); // TMP (Before the "kt" is defined)
1740  if(fQM2>=minSqT && reTNM2>=tmpTM2 && fr4Mom.e()>=sCBE) // minSqT=SqGSMass
1741  {
1742  qCond=false; // Ok, the appropriate q is found
1743  //ffdc=false;
1744 #ifdef debug
1745  // ***VTN***
1746  //G4cout<<"G4Q::HQ:Attemp#"<<qCount<<".Yes.M2="<<reTNM2<<">"<<tmpTM2
1747  // <<" & E="<<fr4Mom.e()<<" > CB+M="<<sCBE<<G4endl;
1748  // ***VBQ***
1749  //G4cout<<"G4Q::HQ:Attemp#"<<qCount<<".Yes.M2="<<rQM2<<">"<<minSqB<<G4endl;
1750  // ***VQU***+***VFQ***
1751  G4cout<<"G4Q::HQ:Attemp#"<<qCount<<".Yes.M2="<<fQM2<<">"<<minSqT<<G4endl;
1752 #endif
1753  }
1754  else
1755  {
1756 #ifdef debug
1757  // ***VTN***
1758  //G4cout<<"G4Q::HQ:Attempt#"<<qCount<<",NO.M2="<<reTNM2<<"<"<<tmpTM2
1759  // <<" or E="<<fr4Mom.e()<<" < CB+M="<<sCBE<<G4endl;
1760  // ***VBQ***
1761  //G4cout<<"G4Q::HQ:Attempt#"<<qCount<<",NO.M2="<<rQM2<<"<"<<minSqB<<G4endl;
1762  // ***VQU***
1763  G4cout<<"G4Q::HQ:Attempt#"<<qCount<<",NO.M2="<<fQM2<<"<"<<minSqT<<G4endl;
1764  // ***VFQ***
1765  //G4cout<<"G4Q::HQ:Attempt#"<<qCount<<",NO.M2="<<rQM2<<"<"<<minSqT<<G4endl;
1766 #endif
1767  // ***VBQ***VFQ***
1768  //if(reTNM2<tmpTM2 && rQM2>MEMrQM2 && fr4Mom.e()>=sCBE)//tM>minTM,maxRQM,CB
1769  // ***VTN***
1770  //if(reTNM2<tmpTM2 && reTNM2>MEMrQM2 && fr4Mom.e()>=sCBE)
1771  // ***VQU***
1772  if(reTNM2<tmpTM2 && fQM2>MEMrQM2 && fr4Mom.e()>=sCBE)//tM>minTM,maxRQM,CB
1773  {
1774  // ***VQU***
1775  MEMrQM2=fQM2;
1776  // ***VBQ***VFQ***
1777  //MEMrQM2=rQM2;
1778  // ***VTN***
1779  //MEMrQM2=reTNM2;
1780  //------------
1781  MEMkp4M=kp4Mom;
1782  MEMfr4M=fr4Mom;
1783  MEMrQ4M=rQ4Mom;
1784  MEMreM2=reTNM2;
1785  }
1786  // ***VQU***
1787  else if(fr4Mom.e()<sCBE&&fr4Mom.e()>MEMsCBE&&reTNM2>=tmpTM2&&fQM2>MEMrQM2)
1788  // ***VBQ***VFQ***
1789  //else if(fr4Mom.e()<sCBE&&fr4Mom.e()>MEMsCBE&&reTNM2>tmpTM2&&rQM2>MEMrQM2)
1790  // ***VTN***
1791  //else if(fr4Mom.e()<sCBE && fr4Mom.e()>MEMsCBE && reTNM2>=tmpTM2)
1792  {
1793  MEMsCBE=fr4Mom.e(); // Remember the best choice
1794  MEMkp4M=kp4Mom;
1795  MEMfr4M=fr4Mom;
1796  MEMrQ4M=rQ4Mom;
1797  MEMreM2=reTNM2;
1798  }
1799  else if(!qCount) //@@ Should not be here
1800  {
1801  // ***VQU***
1802  MEMrQM2=fQM2;
1803  // ***VBQ***VFQ***
1804  //MEMrQM2=rQM2;
1805  // ***VTN***
1806  //MEMrQM2=reTNM2;
1807  //------------
1808  MEMsCBE=fr4Mom.e();
1809  MEMkp4M=kp4Mom;
1810  MEMfr4M=fr4Mom;
1811  MEMrQ4M=rQ4Mom;
1812  MEMreM2=reTNM2;
1813  }
1814  else
1815  {
1816  // ***VQU***
1817  fQM2=MEMrQM2;
1818  // ***VBQ***VFQ***
1819  //rQM2=MEMrQM2;
1820  // ***VTN***
1821  //reTNM2=MEMrQM2;
1822  //-----------
1823  kp4Mom=MEMkp4M; // Make the best choice actual instead of the last
1824  fr4Mom=MEMfr4M;
1825  rQ4Mom=MEMrQ4M;
1826  reTNM2=MEMreM2;
1827  }
1828  }
1829  qCount++;
1830  } // End of the WHILE of the q-choice for the fixed parent
1831  // If q-choice is exhosted, then get the best, not the last
1832  //quexf=true; // Quark Exchange is successfully done
1833 #ifdef debug
1834  G4cout<<"G4Q::HadQ:RQ("<<rQ4Mom.m()<<")=C("<<cr4Mom.m()<<")+q"<<kp4Mom<<G4endl;
1835 #endif
1836  //kt=rQ4Mom.m2();
1837  // ***VQU*** (Close for ***VBQ***VTN***VFQ***)
1838  ku=fQ4Mom.m2();
1839  //-----------
1840  //kp=rQ4Mom.rho()/sqrt(kt);
1841  // *** LIM ***
1842  G4LorentzVector totC4Mom=rQ4Mom; // TotatResidualNucleus prototype
1843  if(envA-pBaryn>bEn) totC4Mom+=G4LorentzVector(0.,0.,0.,mbEn);
1844  else totC4Mom+=G4LorentzVector(0.,0.,0.,envM-pMass);
1845  kn=totC4Mom.m2();
1846 #ifdef debug
1847  G4cout<<"G4Q::HQ:A="<<envA<<",B="<<pBaryn<<",Q="<<rQ4Mom.m()<<","<<piF<<G4endl;
1848 #endif
1849  m2_value=kt;
1850  tot4Mom-=rQ4Mom+fr4Mom;
1851 #ifdef debug
1852  G4cout<<"G4Q::HQ:t4M="<<tot4Mom<<",hsfl="<<hsflag<<".Is kt="<<kt<<">"<<minSqB
1853  <<" or kn="<<kn<<">"<<minSqN<<"? m2="<<m2_value<<", sPDG="<<sPDG<<G4endl;
1854 #endif
1855  // Final check to accept or reject the quark-exchange
1856  // ***VFQ***
1857  //if(kn<minSqN && kt<minSqT)
1858  // ***VQU***
1859  if(kn<minSqN && ku<minSqT)
1860  // ***VBQ***
1861  //if(kn<minSqN && kt<minSqB)
1862  //if(kt<minSqT&&ffdc)
1863  //if(kt<minSqT)
1864  // ***VTN*** (former default)
1865  //if(sPDG<MINPDG&&kt<minSqB||sPDG>MINPDG&&kn<minSqN)
1866  //if(sPDG<MINPDG&&kt<minSqB||sPDG>MINPDG&&kt<minSqB)
1867  //if(kn<minSqN)
1868  // ***VTN***
1869  //if(kt<minSqT&&sPDG!=90000001||kn<minSqN&&sPDG==90000001)//Nucleus for Neutron
1870  //if(kt<minSqT&&sMass>1200.||kn<minSqN&&sMass<1200.) //NuclEnreach for Nucleons
1871  // @@@@ Priveleged Nuteron !! ??? @@@@@
1872  //if(kn<minSqN&&sPDG==90000001||kt<minSqB&&sPDG!=90000001)//BindEnOnlyForNuter.
1873  {
1874  hsflag=true; // The quark exchange is REJECTED
1875 #ifdef debug
1876  G4cout<<"G4Q::HQ:**hsflag=1** No, sPDG="<<sPDG<<", kt="<<kt<<"<"<<minSqB
1877  <<" or kn="<<kn<<"<"<<minSqN<<G4endl;
1878 #endif
1879  }
1880 #ifdef debug
1881  else G4cout<<"G4Q::HQ:YES,t="<<kt<<">"<<minSqB<<",n="<<kn<<">"<<minSqN<<G4endl;
1882 #endif
1883  }
1884  }
1885  else // ==> "HadronicCandidate hadronization" case
1886  {
1887  kt = (quasM-dk)*(quasM-sM2/dk); // squared mass of the RecoilQuasmon
1888  G4double rQM=0.;
1889  if(kt>0.) rQM=sqrt(kt); // Mass of the residual quasmon
1890  fr4Mom=G4LorentzVector(0.,0.,0.,sMass); // 4-mom update for the fragment
1891  rQ4Mom=G4LorentzVector(0.,0.,0.,rQM); // 4-mom update for the RecoilQuasmon
1892  if(!G4QHadron(q4Mom).DecayIn2(fr4Mom, rQ4Mom))
1893  {
1895  ed << "Can't dec Quasmon in Fr+rQuas: q4M=" << q4Mom << ", sM="
1896  << sMass << ", rQM=" << rQM << G4endl;
1897  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0013",FatalException,ed);
1898  }
1899  //@@@@@@@@ rQ4Mom (4-momentum of residual Quasmon) must be defined?! How?
1900  if(envPDG>MINPDG&&envPDG!=NUCPDG)
1901  {
1902  // *** LIM ***
1903  G4LorentzVector TCRN=rQ4Mom;
1904  if(envA>bEn) TCRN+=bEn4M;
1905  else TCRN+=env4M;
1906  kn=TCRN.m2(); // tot4M - fr4Mom
1907  }
1908  else kn=kt;
1909  }
1910  // *** LIM ***
1911  G4LorentzVector tL=rQ4Mom; // @@ Is rQ4Mom calculated for hadrons??
1912  tL+=G4LorentzVector(0.,0.,0.,reM);
1913  G4double tM=tL.m(); // Real Residual Total Nucleus Mass (hadr/frag)
1914  // Residual S+S limit (absoluteLowLimit for corresponding P-res.) for R->S+S Decay
1915 #ifdef debug
1916  G4cout<<"G4Q::HQ:k="<<kMom<<".F:"<<kt<<">"<<minSqB<<",N:"<<kn<<">"<<minSqN<<" &tM="
1917  <<tM<<">rtM="<<rtM<<" & hsfl="<<hsflag<<" to avoid decay R+S="<<sPDG<<G4endl;
1918 #endif
1919  //@@@?@@@tM is not defined fpr hadrons as rQ4Mom is not defined (try define!)@@@?@@
1920  // In following minSqT is for notBoundedRecoilQuasmon, minSqB is for boundedQuasmon
1921  // ***VFQ***
1922  //if(kt>minSqT+.01 && tM>rtM && !hsflag)
1923  // ***VBQ*** && ***VQU***
1924  if(kt>minSqB+.01 && tM>rtM && !hsflag)
1925  //if((kt>minSqB+.01&&sPDG<MINPDG || sPDG>MINPDG&&kt>minSqB+.01&&tM>rtM) && !hsflag)
1926  // ***VTN***
1927  //if((kt>minSqB+.01&&sPDG<MINPDG || sPDG>MINPDG&&kn>minSqN+.01&&tM>rtM) && !hsflag)
1928  //if(tM>rtM&&!hsflag) // Mass(RNucleus)>M_min
1929  //if(tM>rtM&&kp<kpMax&&!hsflag) // Mass(RNucleus)>M_min
1930  //if(2>3) // *** Close k-correction ***
1931  {
1932  // ***VTN*** (?)
1933  //if(sPDG<MINPDG) // Hadronic candidate: finish calculations
1934  // ***VBQ***VFQ***VQU***
1935  //if(2>3) // Close crrection for hadrons @@?p-pbar?@@
1936  //{
1937  // G4double np = nOfQ - 3; // Power for an residual quasmon mass
1938  // G4double cM = pow(minSqB/kt,np); // Cut for PossibleQuasmon residual mass
1939  // G4double uR = G4UniformRand();
1940  // G4double rn = pow(cM +(1.-cM)*uR, 1./np);
1941 #ifdef debug
1942  // G4cout<<"G4Q::HQ: YES for the hadron it's big enough:t="<<kt<<" > T="<<minSqB
1943  // <<",np="<<np<<",cM="<<cM<<",uR="<<uR<<",rn="<<rn<<",kn="<<kn<<G4endl;
1944 #endif
1945  // m2_value = kt*rn; // SquaredMass of ResidualQuasmon (hadr)
1946  //}
1947  //else
1948  //{
1949 #ifdef debug
1950  G4cout<<"G4Q::HQ:YES forFragment it's big enough:kn="<<kn<<">"<<minSqN<<G4endl;
1951 #endif
1952  m2_value = kt; // SquaredMass of ResidualQuasmon (fragm)
1953  //}
1954  }
1955  else
1956  {
1957  hsflag=true; // Decay in ThisHadron/Fragment+(SHadron)
1958 #ifdef debug
1959  G4cout<<"G4Q::HQ:NO,hsfl=1,kt="<<kt<<"<"<<minSqB<<" or M="<<tM<<"<"<<rtM<<G4endl;
1960 #endif
1961  }
1962 #ifdef debug
1963  G4cout<<"G4Q::HQ:******>>rM="<<rMass<<",sqM2="<<sqrt(m2_value)<<",hsfl="<<hsflag<<G4endl;
1964 #endif
1965  rMass=sqrt(m2_value); // if(hsflag)(TwoPartDecay) it's fake 0.
1966  G4double m3_value=m2_value*rMass;
1967  G4int cB = abs(curQ.GetBaryonNumber());// Baryon Number of residual
1969  rPDG = curQ.GetSPDGCode(); // PDG of lowest ResiduaiQuasmon hadr state
1970  G4double rrn=G4UniformRand(); // The same procedure as for "rqPDG"
1971  if(rPDG==111&&sPDG!=111&&rrn>.5) rPDG=221;
1972  //if(rPDG==221&&sPDG!=221&&sPDG!=331&&rrn<.5) rPDG=111;
1973  G4int aPDG = abs(rPDG);
1974  G4int rb = abs(curQ.GetBaryonNumber()); // BaryNum of residual hadronic state
1975  G4double rcMass=-BIG; //@@ just BIG number // Prototype of minimalMass for residual
1976  if (!rPDG)
1977  {
1979  ed << "Unidentifiable residual Hadron: rQ =" << curQ << ", rPDG=" << rPDG
1980  << "(b=" << rb << ") + sPDG=" << sPDG << "(sM=" << sMass << ")" << G4endl;
1981  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0014",
1982  FatalException, ed);
1983  }
1984  G4double sB = 1473.; // @@ Mean of DELTA(3/2) & N(1680)(5/2)
1985  if(rPDG!=10) rcMass=G4QPDGCode(rPDG).GetMass();// residualMass forNotChipolino case
1986  else sB=0.; // Chipolino never decays in hadrons
1987  if(rPDG==221 || rPDG==331) rcMass=mPi0;
1988  G4double bs = rcMass+mPi0;
1989  G4bool rFl=false; // true: ResidualResonance,false: Quasmon
1990  //if(sPDG<MINPDG&&envPDG==NUCPDG&&bs>rMass)rFl=true;// @@ Kills Resonance+Resonance
1991  //if(sPDG<MINPDG&&envPDG==NUCPDG)rFl=G4UniformRand()<bs*bs/m2_value;//ProbFun:m_min^2/m^2
1992  if(sPDG<MINPDG&&envPDG==NUCPDG)rFl=G4UniformRand()<bs*bs*bs/m3_value;//ProbFun:minM^3/m^3
1993 #ifdef debug
1994  G4cout<<"G4Q::HQ: sPDG="<<sPDG<<", hsflag="<<hsflag<<", rPDG="<<rPDG<<curQ<<",rM="
1995  <<rMass<<",rb="<<rb<<",F="<<rFl<<",v="<<m2_value<<", bs="<<bs<<G4endl;
1996 #endif
1997  if(!hsflag&&rFl&&rPDG&& rPDG!=10 && rb<2 && aPDG!=1114 && aPDG!=2224 && aPDG!=3334)
1998  { // ------------------------------->>--------------->> Hadron-Parton Duality decay
1999  G4int regPDG = 0; // PDG prototype for G-meson
2000  G4int refPDG = 0; // PDG prototype for F-meson
2001  G4int redPDG = 0; // PDG prototype for D-meson
2002  G4int repPDG = 0; // PDG prototype for P-meson
2003  if(rPDG && rPDG!=10) // Can the residual be a Hadron ?
2004  {
2005  if (rPDG== 3122) rPDG= 3212; // LAMBDA* converted to SIGMA*
2006  else if(rPDG==-3122) rPDG=-3212;
2007  if(rPDG>0)repPDG=rPDG+2; // Make P-state out of S-state
2008  else repPDG=rPDG-2; // Subtract 2 for the negative PDG
2009  if(repPDG>0)redPDG=repPDG+2; // Make D-state out of P-state
2010  else redPDG=repPDG-2; // Subtract 2 for the negative PDG
2011  if(redPDG>0)refPDG=redPDG+2; // Make F-state out of D-state
2012  else refPDG=redPDG-2; // Subtract 2 for the negative PDG
2013  if(refPDG>0)regPDG=refPDG+2; // Make G-state out of F-state
2014  else regPDG=refPDG-2; // Subtract 2 for the negative PDG
2015  //if((rPDG==221||rPDG==331)&&sPDG==111) rPDG=111; // eta/eta'=>Pi0
2016 #ifdef debug
2017  G4cout<<"G4Q::HQ:QuasM="<<quasM<<valQ<<")->H("<<sPDG<<")+R("<<rPDG<<")"<<",rp="
2018  <<repPDG<<",rd="<<redPDG<<",rf="<<refPDG<<",rg="<<regPDG<<G4endl;
2019 #endif
2020  G4double resM2 = G4QPDGCode( rPDG).GetMass2(); // Mass^2 of the S-resonance
2021  G4double repM2 = G4QPDGCode(repPDG).GetMass2(); // Mass^2 of the P-resonance
2022  G4double redM2 = G4QPDGCode(redPDG).GetMass2(); // Mass^2 of the D-resonance
2023  G4double refM2 = G4QPDGCode(refPDG).GetMass2(); // Mass^2 of the F-resonance
2024  sB = sqrt((resM2+repM2)/2.); // Boundary between S&P resonances
2025  G4double pB = sqrt((repM2+redM2)/2.); // Boundary between P&D resonances
2026  G4double dB = sqrt((redM2+refM2)/2.); // Boundary between D&F resonances
2027  G4double fB = sqrt(refM2)+150.; // Boundary between F&G resonances
2028  if(!cB) fB= sqrt((refM2+G4QPDGCode(regPDG).GetMass2())/2.);
2029  G4double dif=quasM-sMass;
2030  G4double rM = GetRandomMass(repPDG,dif); // Randomize Mass of P-resonance
2031  G4double dM = GetRandomMass(redPDG,dif); // Randomize Mass of D-resonance
2032  G4double fM = GetRandomMass(refPDG,dif); // Randomize Mass of F-resonance
2033 #ifdef debug
2034  G4cout<<"G4Q::HQ: rM="<<rM<<",rMa="<<rMass<<",sB="<<sB<<"(bQ="<<bQ<<"),pB="<<pB
2035  <<",dM="<<dM<<",dB="<<dB<<",fM="<<fM<<",fB="<<fB<<G4endl;
2036 #endif
2037  if(((rM>0 && rMass<pB && rMass>sB) || (dM>0 && rMass>pB && rMass<dB) ||
2038  (fM>0 && rMass>dB && rMass<fB)) && theEnvironment.GetPDG()==NUCPDG)
2039  {// Final H+R decay of QUASMON in vacuum (should not exist if Environ exists)
2040  if (rMass>pB && rMass<dB && dM>0) // D-resonance case
2041  {
2042  repPDG=redPDG;
2043  rM=dM;
2044  }
2045  else if(rMass>dB && rMass<fB && dM>0) // F-resonance case
2046  {
2047  repPDG=refPDG;
2048  rM=fM;
2049  } // If not changed - P-resonance
2050 #ifdef debug
2051  G4cout<<"G4Q::HQ:s="<<sPDG<<",Q=>rM="<<rMass<<"(minQ="<<rPDG<<curQ<<")+sB="
2052  <<sB<<G4endl;
2053 #endif
2054  if(quasM<rM+sMass &&(sPDG==221||sPDG==331))// Change eta-Cand to pi-Cand
2055  {
2056  sPDG=111;
2057  sMass=mPi0;
2058  }
2059  G4LorentzVector r4Mom(0.,0.,0.,rM); // P/D/F-resonance with a random Mass
2060  G4LorentzVector s4Mom(0.,0.,0.,sMass); // Mass's random since ProbabilityTime
2061  G4double sum=rM+sMass;
2062  if(fabs(quasM-sum)<eps)
2063  {
2064  r4Mom=q4Mom*(rM/sum);
2065  s4Mom=q4Mom*(sMass/sum);
2066  }
2067  else if(quasM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
2068  {
2069  // G4cerr<<"**G4Quasmon::HadronizeQuasmon:rPD="<<repPDG<<"(rM="<<rMass
2070  // <<")+sPD="<<sPDG<<"(sM="<<sMass<<"), Env="<<theEnvironment<<G4endl;
2071  // throw G4QException("G4Quasmon::HadronizeQuasmon: H+Res Decay failed");
2073  ed << "H+Res Decay failed: rPD=" << repPDG << "(rM=" << rMass
2074  << ")+sPD=" << sPDG << "(sM=" << sMass << "), Env="
2075  << theEnvironment << G4endl;
2076  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0015",
2077  FatalException, ed);
2078  }
2079 #ifdef debug
2080  G4cout<<"G4Q::HQ:=== 1 ===> HadronVec, Q="<<q4Mom<<" -> s4M="<<s4Mom<<"("
2081  <<sPDG<<"), r4M="<<r4Mom<<"("<<repPDG<<")"<<G4endl;
2082 #endif
2083  //@@CHECK CoulBar and may be evaporate instead
2084  G4QHadron* curHadr1 = new G4QHadron(repPDG,r4Mom,curQ);// Create Resid+Hadron
2085  FillHadronVector(curHadr1); // Fill "new curHadr1" (del. equiv.)
2086  //@@@ Renaming correction to DistinguishFromEvaporation (for BF/FSI purposes)
2087  if (sPDG==2112) sPDG=90000001; // rename PDG of theNeutron@@HadrToNuc
2088  else if(sPDG==2212) sPDG=90001000; // rename PDG of the proton
2089  else if(sPDG==3122) sPDG=91000000; // rename PDG of the lambda
2090  // @@@ ^^^^^^^^^^^^^^^^^^^^
2091  G4QHadron* curHadr2 = new G4QHadron(sPDG,s4Mom);// CreateHadron for Candidate
2092  FillHadronVector(curHadr2); // Fill "new curHadr2"(del equivalent)
2093  ClearQuasmon(); // This Quasmon is done
2094  qEnv=theEnvironment; // Update the QEnvironment
2095  return theQHadrons; // The last decay of the quasmon...
2096  }
2097  }
2098  }
2099  curQ = memQ; // Recover original curQ=valQ-candQ
2100  //fdul = (rMass<sB&&rFl&&rPDG!=10);
2101  fdul = rFl && rPDG!=10;
2102  }
2103  // ***VFQ***
2104  //if(kn>minSqN && kt>minSqT)
2105  // ***VQU***
2106  if (kn > minSqN && ku > minSqT)
2107  // ***VBQ***
2108  //if(kn>minSqN && kt>minSqB)
2109  // ***VTN***
2110  //if(kt>minSqB&&sPDG<MINPDG || sPDG>MINPDG&&kn>minSqN)
2111  {
2112  pCond=false; // Ok, the appropriate parent cluster is found
2113 #ifdef debug
2114  // ***VTN***VBQ***
2115  //G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<" *Yes* sPDG="<<sPDG<<",kt="<<kt<<">"
2116  // <<minSqB<<" || kn="<<kn<<">"<<minSqN<<G4endl;
2117  // ***VQU***
2118  G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<" *Yes* sPDG="<<sPDG<<",ku="<<ku<<">"
2119  <<minSqT<<" || kn="<<kn<<">"<<minSqN<<G4endl;
2120  // ***VFQ***
2121  //G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<" *Yes* sPDG="<<sPDG<<",kt="<<kt<<">"
2122  // <<minSqT<<" || kn="<<kn<<">"<<minSqN<<G4endl;
2123 #endif
2124  }
2125  else
2126  {
2127 #ifdef debug
2128  // ***VBQ***VTN***
2129  //G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<",No. kt="<<kt<<"<"<<minSqB<<" or kn="<<kn
2130  // <<"<"<<minSqN<<" or E="<<fr4Mom.e()<<"<"<<sCBE<<G4endl;
2131  // ***VQU***
2132  G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<",No. ku="<<ku<<"<"<<minSqT<<" or kn="<<kn
2133  <<"<"<<minSqN<<" or E="<<fr4Mom.e()<<"<"<<sCBE<<G4endl;
2134  // ***VFQ***
2135  //G4cout<<"G4Q::HQ:P-Attempt#"<<pCount<<",No. kt="<<kt<<"<"<<minSqT<<" or kn="<<kn
2136  // <<"<"<<minSqN<<" or E="<<fr4Mom.e()<<"<"<<sCBE<<G4endl;
2137 #endif
2138  // ***VTN*** (former default)
2139  //if(kt>=minSqB || sPDG>MINPDG&&kn>minSqN)
2140  // ***VBQ***
2141  //if(kn<minSqN && kt>=minSqB)
2142  // ***VFQ***
2143  //if(kn<minSqN && kt>=minSqT)
2144  // ***VQU***
2145  if (kn < minSqN && ku < minSqT)
2146  {
2147  // ***VTN*** (former default)
2148  //if(kt<minSqB&&sPDG<MINPDG && kt>PMEMktM2 ||
2149  // kn<minSqN&&sPDG>MINPDG && kn>PMEMknM2)
2150  // ***VBQ***
2151  //if(kt<minSqB && kt>PMEMktM2)
2152  // ***VFQ***
2153  //if(kt<minSqT && kt>PMEMktM2)
2154  // ***VQU***
2155  if(ku < minSqT && ku > PMEMktM2)
2156  {
2157  // ***VQU***
2158  PMEMktM2=ku;
2159  // ***VFQ***VBQ***VTN***
2160  //PMEMktM2=kt;
2161  // ---------
2162  PMEMknM2=kn;
2163  PMEMfr4M=fr4Mom;
2164  PMEMrQ4M=rQ4Mom;
2165  PMEMreM2=reTNM2;
2166  PMEMrMas=rMass;
2167  PMEMpMas=pMass;
2168  PMEMsMas=sMass;
2169  PMEMdMas=dMass;
2170  PMEMmiSN=minSqN;
2171  PMEMmiST=minSqT;
2172  PMEMmiSB=minSqB;
2173  PMEMrPDG=rPDG;
2174  PMEMsPDG=sPDG;
2175  PMEMpPDG=pPDG;
2176  PMEMpQC =pQC;
2177  PMEMsQC =sQC;
2178  PMEMtQC =transQC;
2179  PMEMcQC =curQ;
2180  PMEMhsfl=hsflag;
2181  PMEMnucf=nucflag;
2182 #ifdef debug
2183  G4cout<<"G4Q::HQ:RemTheBest rPDG="<<rPDG<<",sPDG="<<sPDG<<",kt="<<kt<<G4endl;
2184 #endif
2185  }
2186  else if(!pCount)
2187  { // @@ Should not be here
2188  // ***VQU***
2189  PMEMktM2=ku;
2190  // ***VFQ***VBQ***VTN***
2191  //PMEMktM2=kt;
2192  // ---------
2193  PMEMknM2=kn;
2194  PMEMfr4M=fr4Mom;
2195  PMEMrQ4M=rQ4Mom;
2196  PMEMreM2=reTNM2;
2197  PMEMrMas=rMass;
2198  PMEMpMas=pMass;
2199  PMEMsMas=sMass;
2200  PMEMdMas=dMass;
2201  PMEMmiSN=minSqN;
2202  PMEMmiST=minSqT;
2203  PMEMmiSB=minSqB;
2204  PMEMrPDG=rPDG;
2205  PMEMsPDG=sPDG;
2206  PMEMpPDG=pPDG;
2207  PMEMpQC =pQC;
2208  PMEMsQC =sQC;
2209  PMEMtQC =transQC;
2210  PMEMcQC =curQ;
2211  PMEMhsfl=hsflag;
2212  PMEMnucf=nucflag;
2213 #ifdef debug
2214  G4cout<<"G4Q::HQ:RemTheFirst rPDG="<<rPDG<<",sPDG="<<sPDG<<",kt="<<kt<<G4endl;
2215 #endif
2216  }
2217  else
2218  {
2219  fr4Mom=PMEMfr4M; // OK -> Recover the best found values
2220  rQ4Mom=PMEMrQ4M; // OK
2221  reTNM2=PMEMreM2; // OK
2222  rMass =PMEMrMas; // OK
2223  pMass =PMEMpMas; // OK
2224  sMass =PMEMsMas; // OK
2225  dMass =PMEMdMas; // OK
2226  minSqN=PMEMmiSN; // ?
2227  minSqT=PMEMmiST; // OK
2228  minSqB=PMEMmiSB; // OK
2229  rPDG =PMEMrPDG; // OK
2230  sPDG =PMEMsPDG; // OK
2231  // ***VQU***
2232  ku=PMEMktM2;
2233  // ***VFQ***VBQ***VTN***
2234  //kt =PMEMktM2;
2235  //-------------------
2236  kn =PMEMknM2;
2237  pPDG=PMEMpPDG; // OK
2238  pQC=PMEMpQC; // OK
2239  sQC=PMEMsQC; // OK
2240  transQC=PMEMtQC; // OK
2241  curQ=PMEMcQC; // OK
2242  hsflag=PMEMhsfl; // OK
2243  nucflag=PMEMnucf;// OK
2244  }
2245  }
2246  }
2247  pCount++;
2248  } // End of the WHILE of the parent choice
2249 #ifdef debug
2250  G4cout<<"G4Q::HQ:>rPDG="<<rPDG<<curQ<<",sPDG="<<sPDG<<",kt="<<kt<<",F="<<fprob
2251  <<",totQC="<<totQC<<",sQC="<<sQC<<G4endl;
2252 #endif
2253  if(fprob) // Calc PDG of ResidQuasm as an S-hadr
2254  {
2255  rPDG=curQ.GetSPDGCode();
2256  G4double rrr=G4UniformRand(); // TheSameAs for "rqPDG" & prev. "rPDG"
2257  if(rPDG==111&&sPDG!=111&&rrr>.5) rPDG=221;
2258  if(rPDG==221&&sPDG!=221&&sPDG!=331&&rrr<.5) rPDG=111;
2259  }
2260  //G4double reMass=sqrt(minSqT); // Min ResidQuasmon Mass after decay
2261  G4double reMass=sqrt(minSqB); // Min ResidQuasmon Mass after decay
2262  if (!rPDG)
2263  {
2265  ed << "Unidentifiable residual Hadron: Q=" << curQ << ",r=" << rPDG
2266  << "+s=" << sPDG << "(sM=" << sMass << ")" << G4endl;
2267  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0016", FatalException, ed);
2268  }
2269  if(rPDG==221||rPDG==331) reMass=mPi0;
2270  G4double aMass=0.; // @@ get rid of the "aMass" it was necessary only for pap
2271  //G4double aMass=mPi0;
2272  //if(envPDG>MINPDG&&(sPDG<MINPDG||envPDG!=pPDG))aMass=0.;
2273 
2274  if ( ( ( (sPDG < MINPDG && envPDG > MINPDG && envPDG != NUCPDG) ||
2275  (sPDG > MINPDG && sPDG!=NUCPDG && envPDG > pPDG)
2276  ) && iniBN > 0
2277  ) || iniBN > 1 || rPDG == 10
2278  ) aMass=0.; // No Pi0 cond.(eg in NucE)
2279 
2280 #ifdef debug
2281  G4cout <<"G4Q::HQ:Is hsfl="<<hsflag<<" or fdul="<<fdul<<" or [rM="<<rMass<<"<"<<reMass
2282  <<" + "<<aMass<<" or rM2="<<reTNM2<<" < miM2="<<tmpTM2<<" and ePDG="<<envPDG
2283  <<">pPDG="<<pPDG<<"] to fail?"<<G4endl;
2284 #endif
2285  // *** This is a condition, when fragmentation can not be continued ***
2286  if ( hsflag ||
2287  (sPDG < MINPDG && rMass < reMass+aMass) ||
2288  (sPDG > MINPDG && envPDG > pPDG && reTNM2 < tmpTM2) ||
2289  fdul )
2290  {
2291  // -->> Decay Q->S+H or Q/C->H1+H2 or suck in or evaporate or slow down or decay etc.
2292  // =-------=> Decide what to do, if fragmentation in this Candidate is impossible ===
2293 #ifdef debug
2294  G4cout<<"G4Q::HQ: Yes(No), hsf="<<hsflag<<",sPDG="<<sPDG<<",pM="<<pMass<<",Env="
2295  <<envPDG<<",QM="<<quasM<<valQ<<", fpr="<<fprob<<G4endl;
2296 #endif
2297  G4QPDGCode rQPDG=G4QPDGCode(rPDG);
2298  if(hsflag) rMass=rQPDG.GetMass(); // Get Nuclear Cluster mass
2299  if(sPDG>MINPDG&&sPDG!=NUCPDG) // "Quark exchange hadronization" case
2300  {
2301  G4QContent tmpEQ=envQC-pQC; // Quark content for Residual Environment
2302  G4QNucleus tmpN(tmpEQ); // Pseudo nucleus for Residual Environment
2303  G4double tmpNM=tmpN.GetMZNS(); // GS Mass of Residual Environment
2304  G4QContent tmpRQ=valQ+transQC; // QContent of Residual Quasmon
2305  //G4QNucleus tmpR(tmpRQ); // Nucleus for Residual Quasmon
2306  //G4double tmpRM=tmpR.GetMZNS(); // GS Mass of Residual Quasmon
2307  G4LorentzVector ResEnv4Mom(0.,0.,0.,tmpNM);// 4-Mom for the Residual Environment
2308  if(rQ4Mom==zeroLV)
2309  {
2310 #ifdef pdebug
2312  ed << "Why Fail? (5): NEEDS-EVAP-5,Q=" << q4Mom << valQ << ",QEnv="
2313  << theEnvironment << G4endl;
2314  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0017", FatalException, ed);
2315 #endif
2316  qEnv=theEnvironment;
2317  return theQHadrons;
2318  }
2319  G4LorentzVector retN4Mom=rQ4Mom+ResEnv4Mom;// 4-Mom for the Total Residual Nucleus
2320  G4double retNM2=retN4Mom.m2(); // SqMass of the Total Residual Nucleus @@ double
2321  G4double retNM=sqrt(retNM2); // Mass of the Total Residual Nucleus @@ double ?
2322  G4QContent tmpTQ=tmpEQ+tmpRQ; // QC for TotalResidualNucleus to the Fragment
2323  G4QNucleus tmpT(tmpTQ); // Nucleus for the Total Residual Nucleus
2324  //G4QNucleus tmpT(tmpTQ,retN4Mom); // Nucleus for the Total Residual Nucleus
2325  G4double tmpTM=tmpT.GetMZNS(); // MinMass of the Total Residual Nucleus @@double
2326  if(tmpTM>retNM) tmpT=G4QNucleus(tmpTQ,retN4Mom);
2327  G4QPDGCode sQPDG(sPDG);
2328  // tmpNM - residualenvironmentm (M),retNM - mass of TotalNucl [MN=sqrt((E+M)^2-p^2]
2329  // tmpRM - ResidQuasmongsm (m_GS), rQ4Mom - 4-momentum of ResidQuasmon (E,p,m)
2331  // potE=[sqrt(E^2*M^2-m^2*M^2+m_GS^2*MN*2)-m^2-E*M]/MN=-U (bindEn should be cutOff)
2332  //G4double pEc=2*(tmpRM+tmpNM-retNM); // DoubledBindingEnergy (virial theorem)
2334  rMass=rQPDG.GetMass();
2335  // MKG -- beg
2336  G4int rB=rQPDG.GetBaryNum(); // Baryon number of residQ
2337  G4double rCB=theEnvironment.CoulombBarrier(rQPDG.GetCharge(),rB);// CB for residQ
2338  if(rCB < 0.) rCB=0.;
2339  G4int sB=sQPDG.GetBaryNum(); // Baryon number of residQ
2340  G4double sCB=theEnvironment.CoulombBarrier(sQPDG.GetCharge(),sB);// CB of Fragm.
2341  if(sCB < 0.) sCB=0.;
2342  // MKG -- end
2343 #ifdef debug
2344  //G4int bSplit=tmpT.SplitBaryon(); // Possibility to split baryon from TotResN
2345  //G4double EQ=rQ4Mom.e(); // EnergyOfResidualQuasmon (E)
2346  //G4double em=tmpNM*EQ; // ResEnvM * EnergyOfResidualQuasmon (M*E)
2347  //G4double mM=retNM*tmpRM; // TotResNuclM*GSMassResidQuasmon (m_GS*MN)
2348  //G4double pEn=(sqrt(em*em-m2_value*tmpNM*tmpNM+mM*mM)-m2_value-em)/retNM; //Real BindingEnergy
2349  //G4double pEt=tmpNM*(EQ+tmpNM-retNM)/retNM; // Energy Transfer to nucleus
2350  //G4double PQ=rQ4Mom.rho(); // mod3MomentumOfResidualQuasmon
2351  //G4double pPt=tmpNM*PQ/retNM; // mod3Momentum Transfer to nucleus
2352  //G4cout<<"G4Q::HQ:tM="<<totMass<<">RE="<<tmpNM<<"+RQ="<<rMass<<"+F="<<sMass
2353  // <<"+rCB="<<rCB<<"+sCB="<<sCB<<"="<<tmpNM+rMass+sMass+rCB+sCB<<G4endl;
2354  G4cout<<"G4Q::HQ:tM="<<totMass<<",totQC="<<totQC<<",rtQC="<<tmpTQ<<",pQC="<<pQC
2355  <<",sB="<<sB<<",resB="<<tmpT.GetA()<<G4endl;
2356 #endif
2357  // MKG
2358  if(nQuasms==1 && tmpNM+rMass+rCB+sMass+sCB < totMass &&
2359  (sB==1 || (sB==2 && G4UniformRand()<.2) || (sB==3 && G4UniformRand()<.1)) &&
2360  (rB==1 || (rB==2 && G4UniformRand()<.2) || (rB==3 && G4UniformRand()<.1)) )
2361  //if(2>3) //*** Attempt " Decay in resEnv+resQ+Fragment" is closed ***
2362  {
2363  G4LorentzVector fr4M = G4LorentzVector(0.,0.,0.,sMass);//GSM of Fragment
2364  G4LorentzVector re4M = G4LorentzVector(0.,0.,0.,tmpNM);//GSM of ResidualEnviron
2365  G4LorentzVector rq4M = G4LorentzVector(0.,0.,0.,rMass);//GSM of ResidualQuasmon
2366 #ifdef debug
2367  G4double cfM=fr4Mom.m(); // @@ ?
2368  G4double ctM=tot4M.m(); // @@ ?
2369  G4cout<<"G4Q::HQ: *YES*,tM="<<ctM<<"="<<totMass<<",fM="<<cfM<<"="<<sMass<<G4endl;
2370 #endif
2371  G4double sum=tmpNM+sMass+rMass;
2372  if(fabs(totMass-sum)<eps)
2373  {
2374  re4M=tot4M*(tmpNM/sum);
2375  rq4M=tot4M*(rMass/sum);
2376  fr4M=tot4M*(sMass/sum);
2377  }
2378  else if(totMass<sum || !G4QHadron(tot4M).DecayIn3(rq4M,re4M,fr4M))
2379  {
2381  ed << "DecayIn Frag+ResQ+ResE failed: Decay (" << totMass << ") in Fragm("
2382  << sMass <<")+ResQ("<< rMass <<")+ResEnv("<< tmpNM <<")="<< sum << G4endl;
2383  G4Exception("G4Quasmon::HadrQuasmon()", "HAD_CHPS_0018", FatalException, ed);
2384  }
2385  G4QHadron* resQH = new G4QHadron(tmpRQ,rq4M); // Create Hadron for ResidQuasm
2386  FillHadronVector(resQH); // Fill ResidQuasm Hadron (del.equiv.)
2387  if(nQuasms==1) // Environment as a fragment for nQ=1
2388  {
2389  G4QHadron* envH = new G4QHadron(tmpEQ,re4M);// Create Fragment for ResEnviron
2390  FillHadronVector(envH); // Fill MovingEnvironment (del.equiv)
2391  qEnv = vacuum; // Distruct Environment
2392  }
2393  else
2394  {
2395  qEnv=G4QNucleus(tmpEQ,re4M); // Create Nucleus for MovingResEnv
2396 #ifdef debug
2397  G4cout<<"**G4Q::HQ:(3)**KeepEnvironmentMoving**, nQ="<<nQuasms<<G4endl;
2398 #endif
2399  }
2400  G4QHadron* candH = new G4QHadron(sPDG,fr4M);// Create Hadron for Candidate
2401  FillHadronVector(candH); // Fill CandiFragm Hadron (del.equiv.)
2402  ClearQuasmon(); // This Quasmon is done
2403  return theQHadrons; // The last decay of the quasmon...
2404  }
2405  //else if(nQuasms==1&&tmpTM+sMass<totMass) //Lose p,go out,leave GSResNuc
2406  // MKG : @@ This does not conserv the baryon number...
2407  else if(nQuasms==1 && tmpTM+sMass+sCB < totMass) //Lose p,goOut,leaveGSResNuc
2408  //else if(2>3) // ********** Decay in Fragm + GSResidNucleus is Closed ************
2409  {
2410  qEnv = G4QNucleus(tmpTQ,retN4Mom); // Createa Nucleus for TotalResidNucl
2411 #ifdef debug
2412  G4cout<<"G4Q::HQ:(2)*KeepEnvironmentMoving*,nQ="<<nQuasms<<",Env="<<qEnv<<G4endl;
2413 #endif
2414  //G4QHadron* envH = new G4QHadron(tmpTQ,retN4Mom); //@@ Moving Environment !
2415  //FillHadronVector(envH); // Fill MovingEnvironment (del.equiv.)
2416  //qEnv = vacuum;
2417 #ifdef debug
2418  G4LorentzVector d4M=tot4M-retN4Mom-fr4Mom;
2419  G4QContent dQC=totQC-tmpTQ-sQC;
2420  G4cout<<"G4Q::HQ: rTotM="<<retN4Mom.m()<<" >? GSM="<<tmpTM<<",d4M="<<d4M<<",dQC="
2421  <<dQC<<G4endl;
2422 #endif
2423  G4QHadron* candHadr = new G4QHadron(sPDG,fr4Mom);// Createa Hadron for Candidate
2424  FillHadronVector(candHadr); // Fill the RadiatedHadron (del.eq.)
2425 #ifdef debug
2426  G4double frM=fr4Mom.m();
2427  G4LorentzVector dif2=tot4M-retN4Mom-fr4Mom;
2428  G4cout<<"G4Q::HQ:sM="<<sMass<<"="<<frM<<", fT="<<fr4Mom.e()-frM<<",dif24M="<<dif2
2429  <<G4endl;
2430 #endif
2431  ClearQuasmon(); // This Quasmon is done
2432  return theQHadrons; // The last decay of the quasmon...
2433  }
2434  else if(totBN>1 &&totMass>totM &&totS>=0&&envPDG>MINPDG&&envPDG!=NUCPDG)// EvaPanic
2435  //else if(2>3) // ********** EvaPanic is Closed ************
2436  {
2437 #ifdef ppdebug
2438  //@@ May be recalculate hadronization ??
2439  G4double fraM=fr4Mom.m();
2440  G4double kinE=fr4Mom.e()-fraM;
2441  G4double sumM=tmpTM+fraM;
2443  ed << "Why Fail?(6): ProductMasses>totalMass: EV-6: TotEVAPORATION:s=" << sPDG
2444  << ",T=" << kinE << ",RM=" << retN4Mom.m() << "<" << tmpTM << ",tQC="
2445  << transQC << ",E=" << excE << ",sM=" << sumM << ">tM=" << totMass << ",nQ="
2446  << nQuasms << G4endl;
2447  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0019", FatalException, ed);
2448 #endif
2449 #ifdef debug
2450  G4cout<<"G4Q::HQ:Q="<<q4Mom<<quasM<<",E="<<theEnvironment<<",P="<<phot4M<<G4endl;
2451 #endif
2452  qEnv=theEnvironment;
2453  return theQHadrons;
2454  }
2455  else if(totBN==1 && nQuasms==1) // Decay of the baryonic Total Nucleus state
2456  {
2457 #ifdef debug
2458  G4cout<<"G4Q::HQ:tB=1,nQ=1,Z="<<totZ<<",S="<<totS<<totQC<<",M="<<totMass<<G4endl;
2459 #endif
2460  G4double nucM= mProt;
2461  G4double piM = 0.;
2462  G4int nucPDG = 2212;
2463  G4int piPDG = 22;
2464  if(abs(totS)==1)
2465  {
2466  if(totS==1) // Decay of the strange hyperstate
2467  {
2468  if(!totZ&&totMass>mLamb+mPi0)
2469  {
2470  nucM = mLamb;
2471  nucPDG= 3122;
2472  piM = mPi0;
2473  piPDG = 111;
2474  }
2475  else if(abs(totZ)==1&&totMass>mLamb+mPi)
2476  {
2477  nucM = mLamb;
2478  nucPDG= 3122;
2479  piM = mPi;
2480  if(totZ>0) piPDG = 211;
2481  else piPDG =-211;
2482  }
2483  else
2484  {
2486  ed << "Pi + Lambda decay error:Z=" << totZ << ",S=" << totS
2487  << totQC << ",tM=" << totMass << G4endl;
2488  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0020",
2489  FatalException, ed);
2490  }
2491  }
2492  else // Decay of the anti-strange hyperstate
2493  {
2494  if(!totZ&&totMass>mNeut+mK0)
2495  {
2496  nucM = mNeut;
2497  nucPDG= 2112;
2498  piM = mK0;
2499  piPDG = 311;
2500  }
2501  else if(totZ==2&&totMass>mProt+mK)
2502  {
2503  piM = mK;
2504  piPDG = 321;
2505  }
2506  else if(totZ==1&&totMass>mProt+mK0&&G4UniformRand()>0.5)
2507  {
2508  piM = mK0;
2509  piPDG = 311;
2510  }
2511  else if(totZ==1&&totMass>=mNeut+mK)
2512  {
2513  nucM = mNeut;
2514  nucPDG= 2112;
2515  piM = mK;
2516  piPDG = 321;
2517  }
2518  else
2519  {
2521  ed << "K + Nucleon decay error: Z=" << totZ << ",S=" << totS
2522  << totQC << ",tM=" << totMass << G4endl;
2523  G4Exception("G4Quasmon::HadronizeQuasmon", "HAD_CHPS_0021",
2524  FatalException, ed);
2525  }
2526  }
2527  }
2528  else if(totMass>PiNM&&!totS) // Decay in nucleon & pion
2529  {
2530  if(!totZ&&totMass>mProt+mPi&&G4UniformRand()<0.5)
2531  {
2532  piM = mPi;
2533  piPDG = -211;
2534  }
2535  else if(!totZ&&totMass>mNeut+mPi0)
2536  {
2537  nucM = mNeut;
2538  nucPDG= 2112;
2539  piM = mPi0;
2540  piPDG = 111;
2541  }
2542  else if(totZ==1&&totMass>mNeut+mPi&&G4UniformRand()<0.5)
2543  {
2544  nucM = mNeut;
2545  nucPDG= 2112;
2546  piM = mPi;
2547  piPDG = 211;
2548  }
2549  else if(totZ==1&&totMass>mProt+mPi0)
2550  {
2551  piM = mPi0;
2552  piPDG = 111;
2553  }
2554  else if(totZ==-1)
2555  {
2556  nucM = mNeut;
2557  nucPDG= 2112;
2558  piM = mPi;
2559  piPDG = -211;
2560  }
2561  else if(totZ==2)
2562  {
2563  piM = mPi;
2564  piPDG = 211;
2565  }
2566  else
2567  {
2569  ed << "Pi + Nucleon decay error: Z=" << totZ << ",B=" << totBN
2570  << ",E=" << envQC << ",Q=" << valQ << G4endl;
2571  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0022",
2572  FatalException, ed);
2573  }
2574  }
2575  else if(!totS)
2576  {
2577  if(!totZ)
2578  {
2579  nucM=mNeut;
2580  nucPDG=2112;
2581  }
2582  else if(totZ<0||totZ>1)
2583  {
2585  ed << "Photon+Nucleon decay error: Z=" << totZ << ",B=" << totBN
2586  << ",E=" << envQC <<",Q=" << valQ << G4endl;
2587  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0023",
2588  FatalException, ed);
2589  }
2590  }
2591  G4LorentzVector pi4M(0.,0.,0.,piM); // mass of the kaon/pion/photon
2592  G4LorentzVector nuc4M(0.,0.,0.,nucM); // mass of the nucleon
2593  G4double sum=piM+nucM;
2594  if(fabs(totMass-sum)<eps)
2595  {
2596  pi4M=tot4M*(piM/sum);
2597  nuc4M=tot4M*(nucM/sum);
2598  }
2599  else if(totMass<sum || !G4QHadron(tot4M).DecayIn2(pi4M, nuc4M))
2600  {
2602  ed << "Gam/Pi/K+N decay error: T=" << tot4M << totMass
2603  << "->gam/pi/K(" << piM << ")+N=" << nucPDG << "(" << nucM
2604  << ")=" << sum << G4endl;
2605  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0024",
2606  FatalException, ed);
2607  }
2608 #ifdef debug
2609  G4cout<<"G4Q::HQ:T="<<tot4M<<totMass<<"->GPK="<<piPDG<<pi4M<<"+B="<<nucPDG<<nuc4M
2610  <<G4endl;
2611 #endif
2612  G4QHadron* piH = new G4QHadron(piPDG,pi4M);// Create Hadron for gamma/Pion
2613  FillHadronVector(piH); // Fill "new piH" (delete equivalent)
2614  G4QHadron* nucH = new G4QHadron(nucPDG,nuc4M); // Creation Hadron for the nucleon
2615  FillHadronVector(nucH); // Fill "new nucH" (delete equivalent)
2616  ClearQuasmon(); // This Quasmon is done
2617  qEnv=vacuum;
2618  return theQHadrons; // The last decay of the total nucleus
2619  }
2620 #ifdef debug
2621  else G4cout<<"***G4Q::HQ: B="<<totBN<<",tM="<<totMass<<" > M="<<totM<<",S="<<totS
2622  <<", envPDG="<<envPDG<<G4endl;
2623 #endif
2624  }
2625  G4double dm=quasM-sMass;
2626 #ifdef debug
2627  G4cout<<"G4Q::HQ:f="<<fprob<<",d="<<dm<<",rPDG="<<rPDG<<",rM="<<rMass<<",M="<<reMass
2628  <<",sM="<<sMass<<G4endl;
2629 #endif
2630  if(abs(dm)<.000001)
2631  {
2632  if(sPDG==iniPDG)
2633  {
2634  G4QHadron* quasH = new G4QHadron(iniPDG,q4Mom);//Create Hadron for Quasmon-Hadron
2635  FillHadronVector(quasH); // Fill "new quasH" (del. equivalent)
2636  ClearQuasmon(); // This Quasmon is done
2637  qEnv=theEnvironment; // Keep initial environment
2638  return theQHadrons; // The last decay of the total nucleus
2639  }
2640  else G4cerr<<"---Warning---G4Q::HQ:Q=H,q="<<iniPDG<<",s="<<sPDG<<",d="<<dm<<G4endl;
2641  }
2642  G4double rWi=0.;
2643  if(rPDG!=10) rWi=G4QPDGCode(rPDG).GetWidth();
2644  if(rPDG!=10&&rMass>dm&&!rWi) // Try to use the h-resonance width or reduce its spin
2645  {
2646  G4double sWi=G4QPDGCode(sPDG).GetWidth();
2647  G4double sMM=G4QPDGCode(sPDG).GetMass();
2648  if(sWi) // Hadron is a resonance
2649  {
2650  G4double mmm=theWorld->GetQParticle(G4QPDGCode(sPDG))->MinMassOfFragm();
2651  G4double ddm=quasM-rMass; // Minimum mass of the sHadron
2652  if(fabs(sMM-ddm)<1.5*sWi-.001 && ddm>mmm)
2653  {
2654 #ifdef debug
2655  G4double msm=sMass;
2656 #endif
2657  sMass=GetRandomMass(sPDG,ddm); // Randomize mass of the Reson-Hadron
2658  if(fabs(sMass)<.001)
2659  {
2660 #ifdef debug
2661  G4cerr<<"***G4Q::HQ:ChangeToM=0, "<<sPDG<<",new="<<ddm<<",old="<<msm<<G4endl;
2662 #endif
2663  sMass=ddm;
2664  }
2665  if(sMass<ddm) sMass=ddm;
2666 #ifdef debug
2667  G4cout<<"G4Q::HQ: sPDG="<<sPDG<<",sM="<<sMass<<",d="<<ddm<<",isM="<<msm<<",W="
2668  <<sWi<<G4endl;
2669 #endif
2670  }
2671  //else if(G4int ds1=abs(sPDG)%10>2) // @@ Make it C-style ?: operator ?
2672  //{
2673  // G4int oPDG=sPDG;
2674  // if (sPDG>0&&sPDG%2==0) sPDG-=ds1-2;
2675  // else if(sPDG>0) sPDG-=ds1-1;
2676  // else if(sPDG<0&&sPDG%2==0) sPDG+=ds1-2;
2677  // else if(sPDG<0) sPDG+=ds1-1;
2678  // sMass=G4QPDGCode(sPDG).GetMass();
2679  // G4cout<<"**G4Q::HQ:sPDG="<<oPDG<<" changed to "<<sPDG<<",sM="<<sMass<<G4endl;
2680  //}
2681  }
2682  }
2683  // First decay suppression for the final decay in 2 particles
2684  G4double rnd=G4UniformRand();
2685  // Final state pi0/eta/eta' sorting (wave functions)
2686 #ifdef debug
2687  G4cout<<"G4Q::HQ:BEFrPDGcor,d="<<dm<<",R="<<rnd<<",r="<<rPDG<<",rM="<<rMass<<G4endl;
2688 #endif
2689  //if(rPDG==111 && sPDG!=111 && dm>548. && rnd<.5 ) rPDG=221;
2690  //if(rPDG==111 && sPDG!=111 && dm>958. && rnd>.5 ) rPDG=331;
2691  if(rPDG==111 && sPDG!=111 && dm>548.)
2692  {
2693  //if(dm>958. && rnd>.5) rPDG=331;
2694  if(dm>958.) rPDG=331;
2695  else rPDG=221;
2696  }
2697  if(rPDG==221 && dm>958. && rnd>.5 ) rPDG=331;
2698  if(rPDG==331 &&(dm<958. || rnd<.5)) rPDG=221;
2699  //if(rPDG==221 && (sPDG!=221 && sPDG!=331 && rnd>.5 || dm<548.)) rPDG=111;
2700  if(rPDG==221 && dm<548.) rPDG=111;
2701  // Final state convertion of pi0/eta/eta' to vector mesons
2702 
2703  if ( ( (rPDG == 111 && sPDG!= 111) || rPDG == 221) &&
2704  rMass > 544. && dm > 544. && rnd > .5) rPDG=113; //0->rho0
2705 
2706  if ( ( (rPDG == 111 && sPDG != 111) || rPDG == 221) &&
2707  rMass > 782. && dm > 782. && rnd < .5) rPDG = 223; //0->omega
2708 
2709  if ( rPDG == 331 && rMass > 1020. && dm > 1020. && rnd < .5) rPDG=333;// eta' -> phi0
2710 
2711  if(rPDG== 211 && dm>544. && rnd>.5) rPDG= 213; // M-1.5*W conv. of pi+ to rho+
2712  if(rPDG==-211 && dm>544. && rnd>.5) rPDG=-213; // M-1.5*W conv. of pi- to rho-
2713 #ifdef debug
2714  G4cout<<"G4Q::HQ:rCor,Q="<<quasM<<",sM="<<sMass<<",r="<<rPDG<<",rM="<<rMass<<G4endl;
2715 #endif
2716  if (rPDG < MINPDG && rPDG != 2212 && rPDG != 2112 && rPDG != 3122 && rPDG != 10)
2717  { //=>ResidQ isn't NuclCl
2718  reMass=GetRandomMass(rPDG,dm); // Randomize mass of the RResidQuasmon-Hadron
2719 #ifdef debug
2720  G4cout<<"G4Q::HQ:dm="<<dm<<", ResQM="<<reMass<<" is changed to PDG="<<rPDG<<G4endl;
2721 #endif
2722  if(reMass==0.)
2723  {
2724  if(sPDG==221 || sPDG==331) // Change eta-Candidate to pi/gamma
2725  {
2726  if (sPDG==221) dm+=mEta-mPi0;
2727  else if(sPDG==331) dm+=mEtaP-mPi0;
2728  if(dm<0)
2729  {
2730  dm+=mPi0;
2731  sPDG=22;
2732  sMass=0.;
2733  }
2734  else
2735  {
2736  sPDG=111;
2737  sMass=mPi0;
2738  }
2739  if(dm<mPi0-.00001&&rPDG==111)
2740  {
2741  rPDG=22;
2742  reMass=0.;
2743  }
2744  else reMass=GetRandomMass(rPDG,dm);//Rerandomize mass of ResidQuasmon-Resonance
2745  if(reMass==0.)G4cerr<<"-W-G4Q::HQ:2,M="<<quasM<<",r="<<rPDG<<",d="<<dm<<G4endl;
2746  }
2747  else if(rPDG==111) // Make a photon out of the Resid Quasmon
2748  {
2749  rPDG=22;
2750  reMass=0.;
2751  }
2752  else
2753  {
2754  if(CheckGroundState()) ClearQuasmon();// This Quasmon is done
2755  //if(CheckGroundState(true)) KillQuasmon();// This Quasmon is done
2756 #ifdef pdebug
2758  ed << "Why Fail? (7): NeedsEvap7:s=" << sPDG << ",Q=" << q4Mom
2759  << valQ << ",r=" << rPDG << G4endl;
2760  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0025",FatalException,ed);
2761 #endif
2762  qEnv=theEnvironment;
2763  return theQHadrons;
2764  }
2765  }
2766  }
2767  else if(rPDG==NUCPDG)
2768  {
2769  if(dm>mPi0)
2770  {
2771  rPDG=111;
2772  reMass=mPi0;
2773  }
2774  else
2775  {
2776  rPDG=22;
2777  reMass=0.;
2778  }
2779  }
2780  G4double freeRQM=rQPDG.GetMass();
2781  G4int RQB = rQPDG.GetBaryNum();
2782  G4double fRQW= 3*rQPDG.GetWidth();
2783  if(fRQW<.001) fRQW=.001;
2784  G4QPDGCode sQPDG(sPDG);
2785  G4int sChg=sQPDG.GetCharge();
2786  G4int sBaryn=sQPDG.GetBaryNum();
2787  G4double sCB=theEnvironment.CoulombBarrier(sChg,sBaryn);
2788 #ifdef debug
2789  G4cout<<"G4Q::HQ:h="<<sCB<<",C="<<sChg<<",B="<<sBaryn<<",E="<<theEnvironment<<G4endl;
2790 #endif
2791  G4int rChg=rQPDG.GetCharge();
2792  G4int rBaryn=rQPDG.GetBaryNum();
2793  G4double rCB=theEnvironment.CoulombBarrier(rChg,rBaryn);
2794 #ifdef debug
2795  G4cout<<"G4Q::HQ:rqCB="<<rCB<<",rqC="<<rChg<<",rqB="<<sBaryn<<",rM="<<rQPDG<<",reM="
2796  <<reMass<<G4endl;
2797 #endif
2798  if ( totBN > 1 && totS >= 0 && envPDG > MINPDG && envPDG != NUCPDG &&
2799  (reMass+sMass > quasM || sCB+rCB+reMass+sMass+envM > totMass ||
2800  (!RQB && quasM < diPiM)
2801  )
2802  )
2803  //if(2>3) // This Evaporation channel is closed
2804  {
2805 #ifdef pdebug
2807  ed << "Why Fail? (8): RQM+SM=" << reMass+sMass << ">QM=" << quasM << ", sCB="
2808  << sCB << " + rCB=" << rCB << " + rM=" << reMass << " + sMass=" << sMass
2809  << " + eM=" << envM << " = " << sCB+rCB+reMass+sMass+envM << ">tM=" << totMass
2810  << "," << reMass+sMass+envM << G4endl;
2811  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0026", FatalException, ed);
2812 #endif
2813  qEnv=theEnvironment;
2814  return theQHadrons;
2815  }
2816  if(rPDG==NUCPDG)
2817  {
2819  ed << "Residual Particle is Vacuum: rPDG=90000000, MV=" << reMass << G4endl;
2820  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0027", FatalException, ed);
2821  }
2822  if(rPDG==2212&&sPDG==311&&reMass+sMass>quasM)
2823  {
2824  if(mNeut+mK<=quasM+.001)
2825  {
2826  reMass=mNeut;
2827  rPDG =2112;
2828  rQPDG=G4QPDGCode(rPDG);
2829  rChg=rQPDG.GetCharge();
2830  rBaryn=rQPDG.GetBaryNum();
2831  rCB=theEnvironment.CoulombBarrier(rChg,rBaryn);
2832 #ifdef debug
2833  G4cout<<"G4Q::HQ:NCB="<<rCB<<",NC="<<rChg<<",sB="<<sBaryn<<",r="<<rQPDG<<G4endl;
2834 #endif
2835  freeRQM=mNeut;
2836  RQB=1;
2837  fRQW=0.;
2838  sMass =mK;
2839  if(mNeut+mK<=quasM) sMass=quasM-mNeut;
2840  sPDG =321;
2841  sQPDG=G4QPDGCode(sPDG);
2842  sChg=sQPDG.GetCharge();
2843  sBaryn=sQPDG.GetBaryNum();
2844  sCB=theEnvironment.CoulombBarrier(sChg,sBaryn);
2845 #ifdef debug
2846  G4cout<<"G4Q::HQ:KCB="<<sCB<<",KC="<<sChg<<",frB="<<sBaryn<<",E="<<theEnvironment
2847  <<G4endl;
2848 #endif
2849  curQ=neutQC;
2850  }
2851  else
2852  {
2854  ed<<"Can't decay Q in N and K: (NK) QM="<< quasM<<",d="<< quasM-mNeut-mK<<G4endl;
2855  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0028", FatalException, ed);
2856  }
2857  }
2858 #ifdef debug
2859  G4cout<<"G4Q::HQ: ****** Before reM="<<reMass<<", rM="<<rMass<<G4endl;
2860 #endif
2861  G4QPDGCode tmpQPDG(rPDG);
2862  if(tmpQPDG.GetWidth()<.000001) reMass=tmpQPDG.GetMass(); // Recover const mass
2863  if(!reMass) reMass=rMass; // @@ ?
2864 #ifdef debug
2865  G4cout<<"G4Q::HQ: Decay in sM="<<sMass<<" + reM="<<reMass<<" (rM="<<rMass<<G4endl;
2866 #endif
2867  G4LorentzVector r4Mom(0.,0.,0.,reMass);
2868  G4LorentzVector s4Mom(0.,0.,0.,sMass);// Mass is random since probab. time
2869  if(sPDG>MINPDG) // @@ For the Quark-Exchange hadronization (?)
2870  {
2871 #ifdef debug
2872  G4cout<<"G4Q::HQ:Q->RQ+QEX s="<<sPDG<<",pM="<<pMass<<",E="<<theEnvironment<<G4endl;
2873 #endif
2874  q4Mom+=G4LorentzVector(0.,0.,0.,pMass);
2875  }
2876  G4double tmM=q4Mom.m()+.001;;
2877  G4double sum=reMass+sMass;
2878  if(fabs(tmM-sum)<eps)
2879  {
2880  r4Mom=q4Mom*(reMass/sum);
2881  s4Mom=q4Mom*(sMass/sum);
2882  }
2883  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
2884  {
2885  G4QContent resNQC=totQC-sQC; // Quark Content of the totNucleus-Fragment
2886 #ifdef debug
2887  G4cerr<<"---Warning---G4Q::HQ:M="<<tmM<<"=>rPDG="<<rPDG<<"(rM="<<reMass<<")+sPDG="
2888  <<sPDG<<"(sM="<<sMass<<")="<<sum<<",resNQC="<<resNQC<<G4endl;
2889 #endif
2890  G4QNucleus resTN(resNQC);
2891  G4double resTNM=resTN.GetMZNS(); // Mass of totNucleus-Fragment
2892  if(sPDG==311 && tmpQPDG.GetCharge()>0) // Can switch from K0 to K+
2893  {
2894  G4QContent crQC=tmpQPDG.GetQuarkContent()-KpQC+K0QC; // new hadrr's QC
2895  G4QNucleus nNuc(crQC); // New neucleus for the hadron/fragment
2896  G4double nreM=nNuc.GetGSMass(); // Mass of the new isotope
2897  if(tmM>mK+nreM)
2898  {
2899  sMass=mK;
2900  sPDG=321;
2901  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
2902  curQ+=K0QC-KpQC;
2903  reMass=nreM;
2904  rPDG=nNuc.GetPDG();
2905  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
2906  sum=reMass+sMass;
2907  if(fabs(tmM-sum)<eps)
2908  {
2909  r4Mom=q4Mom*(reMass/sum);
2910  s4Mom=q4Mom*(sMass/sum);
2911  }
2912  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
2913  {
2915  ed << "Hadron+K+ DecayIn2: (I) KCor M=" << tmM << "=>rPDG=" << rPDG << "(rM="
2916  << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum <<G4endl;
2917  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0029",
2918  FatalException, ed);
2919  }
2920  }
2921  else
2922  {
2924  ed << "Hadron+K+ DecayIn2:(O) KCor M=" << tmM << "=>rPDG=" << rPDG << "(rM="
2925  << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum << G4endl;
2926  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0030",FatalException,ed);
2927  }
2928  }
2929  else if(sPDG==321 && tmpQPDG.GetCharge()<=tmpQPDG.GetBaryNum())//SwitchFrom K+toK0
2930  {
2931  G4QContent crQC=tmpQPDG.GetQuarkContent()-K0QC+KpQC; // new hadrr's QC
2932  G4QNucleus nNuc(crQC); // New neucleus for the hadron/fragment
2933  G4double nreM=nNuc.GetGSMass(); // Mass of the new isotope
2934  if(tmM>mK0+nreM)
2935  {
2936  sMass=mK0;
2937  sPDG=311;
2938  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
2939  curQ+=KpQC-K0QC;
2940  reMass=nreM;
2941  rPDG=nNuc.GetPDG();
2942  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
2943  sum=reMass+sMass;
2944  if(fabs(tmM-sum)<eps)
2945  {
2946  r4Mom=q4Mom*(reMass/sum);
2947  s4Mom=q4Mom*(sMass/sum);
2948  }
2949  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
2950  {
2952  ed << "Hadron+K0 DecayIn2: (I) K0Cor M=" << tmM << "=>rPDG=" << rPDG
2953  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")="
2954  << sum << G4endl;
2955  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0031",
2956  FatalException, ed);
2957  }
2958  }
2959  else
2960  {
2962  ed << "Hadron+K0 DecayIn2: (O) K0Cor M=" << tmM << "=>rPDG=" << rPDG << "(rM="
2963  << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum << G4endl;
2964  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0032",FatalException,ed);
2965  }
2966  }
2967  else if(sPDG==211 && tmpQPDG.GetCharge()<tmpQPDG.GetBaryNum())//SwitchFrom pi+Topi0
2968  {
2969  G4QContent crQC=tmpQPDG.GetQuarkContent()-Pi0QC+PiQC; // new hadron's QC
2970  G4QNucleus nNuc(crQC); // New neucleus for the hadron/fragment
2971  G4double nreM=nNuc.GetGSMass(); // Mass of the new isotope
2972  if(tmM>mPi0+nreM)
2973  {
2974  sMass=mPi0;
2975  sPDG=111;
2976  curQ+=PiQC;
2977  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
2978  reMass=nreM;
2979  rPDG=nNuc.GetPDG();
2980  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
2981  sum=reMass+sMass;
2982  if(fabs(tmM-sum)<eps)
2983  {
2984  r4Mom=q4Mom*(reMass/sum);
2985  s4Mom=q4Mom*(sMass/sum);
2986  }
2987  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
2988  {
2990  ed << "Hadron+Pi0 DecayIn2: (I) Pi+/Pi0Cor M=" << tmM << "=>rPDG=" << rPDG
2991  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
2992  << G4endl;
2993  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0033",
2994  FatalException, ed);
2995  }
2996  }
2997  else if(tmM>nreM)
2998  {
2999  sMass=0.;
3000  sPDG=22;
3001  curQ+=PiQC;
3002  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3003  reMass=nreM;
3004  rPDG=nNuc.GetPDG();
3005  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3006  sum=reMass+sMass;
3007  if(fabs(tmM-sum)<eps)
3008  {
3009  r4Mom=q4Mom*(reMass/sum);
3010  s4Mom=q4Mom*(sMass/sum);
3011  }
3012  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3013  {
3015  ed << "Hadron+Gamma DecayIn2: (I) Pi+/GamCor M=" << tmM << "=>rPDG=" << rPDG
3016  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
3017  << G4endl;
3018  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0034",
3019  FatalException, ed);
3020  }
3021  }
3022  else
3023  {
3025  ed << "Hadron+Pi0/Gam DecayIn2: (O) Pi+/Pi0Cor M=" << tmM << "=>rPDG=" << rPDG
3026  <<"(rM="<< reMass <<")+sPDG="<< sPDG <<"(sM="<< sMass <<")="<< sum <<G4endl;
3027  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0035",FatalException,ed);
3028  }
3029  }
3030  else if(sPDG==-211 && tmpQPDG.GetCharge()>0) // Switch From pi- To pi0 (or gamma)
3031  {
3032  G4QContent crQC=tmpQPDG.GetQuarkContent()-Pi0QC+PiMQC; // new hadron's QC
3033  G4QNucleus nNuc(crQC); // New neucleus for the hadron/fragment
3034  G4double nreM=nNuc.GetGSMass(); // Mass of the new isotope
3035  if(tmM>mPi0+nreM)
3036  {
3037  sMass=mPi0;
3038  sPDG=111;
3039  curQ+=PiMQC;
3040  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3041  reMass=nreM;
3042  rPDG=nNuc.GetPDG();
3043  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3044  sum=reMass+sMass;
3045  if(fabs(tmM-sum)<eps)
3046  {
3047  r4Mom=q4Mom*(reMass/sum);
3048  s4Mom=q4Mom*(sMass/sum);
3049  }
3050  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3051  {
3053  ed << "Hadron+Pi0 DecayIn2: (I) Pi-/Pi0Cor M=" << tmM << "=>rPDG=" << rPDG
3054  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
3055  << G4endl;
3056  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0036",
3057  FatalException, ed);
3058  }
3059  }
3060  else if(tmM>nreM)
3061  {
3062  sMass=0.;
3063  sPDG=22;
3064  curQ+=PiMQC;
3065  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3066  reMass=nreM;
3067  rPDG=nNuc.GetPDG();
3068  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3069  sum=reMass+sMass;
3070  if(fabs(tmM-sum)<eps)
3071  {
3072  r4Mom=q4Mom*(reMass/sum);
3073  s4Mom=q4Mom*(sMass/sum);
3074  }
3075  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3076  {
3078  ed << "Hadron+Gamma DecayIn2: (I) Pi-/GamCor M=" << tmM << "=>rPDG=" << rPDG
3079  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
3080  << G4endl;
3081  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0037",
3082  FatalException, ed);
3083  }
3084  }
3085  }
3086  else if((sPDG==221 || sPDG==331) && tmM>mPi0+reMass)
3087  {
3088  sMass=mPi0;
3089  sPDG=111;
3090  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to pi0 mass
3091  sum=reMass+sMass;
3092  if(fabs(tmM-sum)<eps)
3093  {
3094  r4Mom=q4Mom*(reMass/sum);
3095  s4Mom=q4Mom*(sMass/sum);
3096  }
3097  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom)) // Gamma is below
3098  {
3100  ed <<"Hadron+Pi0 DecayIn2: Eta/Pi0Cor M="<< tmM <<"=>rPDG="<< rPDG << "(rM="
3101  << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum << G4endl;
3102  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0038",FatalException,ed);
3103  }
3104  }
3105  else if((sPDG==111 || sPDG==221 || sPDG==331) && tmM>reMass)
3106  {
3107  sMass=0.;
3108  sPDG=22;
3109  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to gamma
3110  sum=reMass+sMass;
3111  if(fabs(tmM-reMass)<eps)
3112  {
3113  r4Mom=q4Mom*(reMass/sum);
3114  s4Mom=q4Mom*(sMass/sum);
3115  }
3116  else if(!G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom)) // Kinematics is checked above
3117  {
3119  ed << "QHadron+Gamma DecayIn2: PiCor M=" << tmM << "=>rPDG=" << rPDG << "(rM="
3120  << reMass <<")+sPDG="<< sPDG << "(sM=" << sMass << ")=" << reMass << G4endl;
3121  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0039",FatalException,ed);
3122  }
3123  }
3124  else if(iniBN>0 && iniS>0) // Force Lamb->p+PiM (2/3) or Lamb->n+Pi0 decays @@ tot
3125  {
3126  G4QContent tmpSQC=G4QPDGCode(sPDG).GetQuarkContent();//QuarkContent of the hadron
3127  G4QContent lanQC=tmpQPDG.GetQuarkContent()+tmpSQC+K0QC;// switch from Lambda to n
3128  G4QNucleus nucM(lanQC-PiMQC); // New neucleus for the residual for Pi-
3129  G4double nreM=nucM.GetGSMass(); // Mass of the residual for Pi-
3130  G4QNucleus nucZ(lanQC-Pi0QC); // New neucleus for the residual for Pi-
3131  G4double nreZ=nucZ.GetGSMass(); // Mass of the residual for Pi-
3132 #ifdef debug
3133  G4cout<<"G4Q::HQ:LsPDG="<<sPDG<<",rPDG="<<rPDG<<",Z="<<nucZ<<",M="<<nucM<<G4endl;
3134 #endif
3135  if((G4UniformRand()<.33333 || mPi+nreM>tmM) && mPi0+nreZ<tmM) // ----> n+Pi0 case
3136  {
3137  sMass=mPi0;
3138  sPDG=111;
3139  curQ+=tmpSQC+K0QC; // LToN correction for curQC
3140  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3141  reMass=nreZ;
3142  rPDG=nucZ.GetPDG();
3143  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3144  sum=reMass+sMass;
3145  if(fabs(tmM-sum)<eps)
3146  {
3147  r4Mom=q4Mom*(reMass/sum);
3148  s4Mom=q4Mom*(sMass/sum);
3149  }
3150  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3151  {
3153  ed <<"(L->n)+Pi0 DecayIn2: LamPi0 Cor M="<< tmM <<"=>rPDG="<< rPDG << "(rM="
3154  << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum <<G4endl;
3155  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0040",
3156  FatalException, ed);
3157  }
3158  }
3159  else if(mPi+nreM<tmM) // ----> p+Pi- case
3160  {
3161  sMass=mPi;
3162  sPDG=-211;
3163  curQ+=tmpSQC+K0QC-PiMQC; // LToN correction for curQC (-QC_PIM)
3164  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3165  reMass=nreM;
3166  rPDG=nucM.GetPDG();
3167  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3168  sum=reMass+sMass;
3169  if(fabs(tmM-sum)<eps)
3170  {
3171  r4Mom=q4Mom*(reMass/sum);
3172  s4Mom=q4Mom*(sMass/sum);
3173  }
3174  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3175  {
3177  ed << "(L->n)+Pi- DecayIn2: LamPiM Cor M=" << tmM << "=>rPDG=" << rPDG
3178  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
3179  << G4endl;
3180  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0041",
3181  FatalException, ed);
3182  }
3183  }
3184  else if(nreM<tmM) // ----> N+gamma case
3185  {
3186  sMass=0.;
3187  sPDG=22;
3188  curQ+=tmpSQC+K0QC; // LToN correction for curQC
3189  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to new hadron mass
3190  reMass=nreZ;
3191  rPDG=nucZ.GetPDG();
3192  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3193  sum=reMass+sMass;
3194  if(fabs(tmM-sum)<eps)
3195  {
3196  r4Mom=q4Mom*(reMass/sum);
3197  s4Mom=q4Mom*(sMass/sum);
3198  }
3199  else if(tmM<sum || !G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom))
3200  {
3202  ed << "(L->n)+Gamma DecayIn2: LamNGam Cor M=" << tmM << "=>rPDG=" << rPDG
3203  << "(rM=" << reMass << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
3204  << G4endl;
3205  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0042",
3206  FatalException, ed);
3207  }
3208  }
3209  else
3210  {
3212  ed << "LamTo0N with Pi DecayIn2: LamToN M=" << tmM << totQC << "=>rM="
3213  << nucM.GetPDG() << "," << nucZ.GetPDG() << "(" << nreM << "," << nreZ
3214  << ")+PiM/PiZ=" << mPi+nreM << "," << mPi0+nreZ << G4endl;
3215  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0043",
3216  FatalException, ed);
3217  }
3218  }
3219  else if(tmM>iniQM)
3220  {
3221  G4QContent tmpSQC=G4QPDGCode(sPDG).GetQuarkContent();//QuarkContent of the hadron
3222  sMass=0.;
3223  sPDG=22;
3224  s4Mom=G4LorentzVector(0.,0.,0.,sMass); // Switch to gamma
3225  curQ+=tmpSQC; // totQC correction for curQC
3226  reMass=iniQM;
3227  rPDG=iniPDG;
3228  r4Mom=G4LorentzVector(0.,0.,0.,reMass);// Switch to other isotope mass
3229  sum=reMass+sMass;
3230  if(fabs(tmM-reMass)<eps)
3231  {
3232  r4Mom=q4Mom*(reMass/sum);
3233  s4Mom=q4Mom*(sMass/sum);
3234  }
3235  else if(!G4QHadron(q4Mom).DecayIn2(r4Mom, s4Mom)) // Kinematics is checked above
3236  {
3238  ed << "QHadron+Gamma DecayIn2: gam+TQ M=" << tmM << "=>rPDG=" << rPDG << "(rM="
3239  << reMass <<")+sPDG="<< sPDG << "(sM=" << sMass << ")=" << reMass << G4endl;
3240  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0044",
3241  FatalException, ed);
3242  }
3243  }
3244  else if(totMass>resTNM+sMass) // Just decay in sPDG and total residual nucleus
3245  {
3246  G4LorentzVector re4M = G4LorentzVector(0.,0.,0.,resTNM); //GSM of ResidTotEnvir
3247  G4LorentzVector rs4M = G4LorentzVector(0.,0.,0.,sMass); //GSM of a Hadron
3248 #ifdef debug
3249  G4cout<<"G4Q::HQ:EMERGENCY,rEM="<<resTN<<resTNM<<",fM="<<sMass<<",tM="<<totMass
3250  <<",d="<<totMass-resTNM-sMass<<G4endl;
3251 #endif
3252  sum=resTNM+sMass;
3253  if(fabs(totMass-sum)<eps)
3254  {
3255  re4M=tot4M*(resTNM/sum);
3256  rs4M=tot4M*(sMass/sum);
3257  }
3258  else if(totMass<sum || !G4QHadron(tot4M).DecayIn2(re4M,rs4M))
3259  {
3261  ed << "DecayIn2 Frag+ResE failed: HadrQ:Decay T=" << totMass
3262  << "->R=" << resTNM << "+S=" << sMass << ")=" << sum << G4endl;
3263  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0045",FatalException,ed);
3264  }
3265  else
3266  {
3267  //@@CHECK CoulBar (only for ResQuasmon in respect to ResEnv) & evaporate
3268  G4QHadron* fragH = new G4QHadron(sPDG,rs4M); // Create Hadron for the Fragment
3269  FillHadronVector(fragH); // Fill ResidQuasm Hadron (del.equiv.)
3270  if(nQuasms==1)
3271  {
3272  resTN.Set4Momentum(re4M);
3273  qEnv=resTN; // Create Nucleus for MovingResEnv
3274  }
3275  else
3276  {
3277  G4QHadron* envH = new G4QHadron(resNQC,re4M); //@@ Moving Environment !
3278  FillHadronVector(envH); // Fill MovingEnvironment (del.equiv)
3279  qEnv = vacuum;
3280  }
3281  ClearQuasmon(); // This Quasmon is done
3282  return theQHadrons; // The last decay of the quasmon...
3283  }
3284  }
3285  else if(totMass>totM) // Just decay in minimal total nucleus and gamma
3286  {
3287  G4LorentzVector re4M = G4LorentzVector(0.,0.,0.,totM); // GSM of ResidTotEnvir
3288  G4LorentzVector rs4M = G4LorentzVector(0.,0.,0.,0.); // GSM of a Photon
3289 #ifdef debug
3290  G4cout<<"G4Q::HQ:EMERGENSY,minM="<<totM<<" < totM="<<totMass<<G4endl;
3291 #endif
3292  if(fabs(totMass-totM)<eps) re4M=tot4M*(resTNM/sum);
3293  else if(!G4QHadron(tot4M).DecayIn2(re4M,rs4M))
3294  {
3296  ed<<"DecayIn2 gam+TotN failed:HadrQ:Decay,T="<<totMass<<"->g+M="<<totM<<G4endl;
3297  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0046",
3298  FatalException, ed);
3299 
3300  }
3301  else
3302  {
3303  G4QHadron* fragH = new G4QHadron(22,rs4M); // Create Hadron for the Gamma
3304  FillHadronVector(fragH); // Fill ResidQuasm Hadron (del.eq.)
3305  if(nQuasms==1)
3306  {
3307  totN.Set4Momentum(re4M);
3308  qEnv=totN;// Create Nucleus for MovingResEnv
3309  }
3310  else
3311  {
3312  G4QHadron* envH = new G4QHadron(totPDG,re4M); //@@ Moving Environment !
3313  FillHadronVector(envH); // Fill MovingEnvironment (del.equiv)
3314  qEnv = vacuum;
3315  }
3316  ClearQuasmon(); // This Quasmon is done
3317  return theQHadrons; // The last decay of the quasmon...
3318  }
3319  }
3320  else
3321  {
3322  G4cerr<<"***G4Q::HQ:M="<<tmM<<"=>rPDG="<<rPDG<<"(rM="<<reMass<<")+sPDG="
3323  <<sPDG<<"(sM="<<sMass<<")="<<sum<<",QM="<<iniQM<<G4endl;
3324  if(fabs(tmM-sum)<1.) // Just to avoid exception (Must be treated !)
3325  //if(2>3) // ------> Catch the under mass shell event
3326  {
3327  r4Mom=q4Mom*(reMass/sum);
3328  s4Mom=q4Mom*(sMass/sum);
3329  }
3330  // else throw G4QException("***G4Quasmon::HadronizeQuasmon:QHadr+SHadr DecayIn2");
3331  else G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0047",
3332  FatalException, "QHadr+SHadr DecayIn2");
3333  }
3334  }
3335  G4double sKE=s4Mom.e()-sMass;
3336 #ifdef rdebug
3337  G4cout<<"G4Q::HQ:=2.3=>QHVect s4M="<<s4Mom<<",sPDG="<<sPDG<<", r4M/M="<<r4Mom<<reMass
3338  <<",fR="<<freeRQM<<",fW="<<fRQW<<",PDG="<<rPDG<<",r="<<rCB<<",s="<<sCB<<G4endl;
3339 #endif
3340  //if(sKE<sCB||rKE<rCB) // => "KinEn is below CB, try once more" case
3342  if(sKE<sCB) // => "KinEn is below CB, try once more" case
3343  {
3344 #ifdef pdebug
3345  G4cout<<"****G4Q::HQ:E-9: sKE="<<sKE<<"<sCB="<<sCB<<G4endl;
3346  // throw G4QException("G4Quasmon::HadronizeQuasmon: Why Fail? (9)"); //@@ TMP
3347  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0048",
3348  FatalException, "Why Fail? (9)");
3349 #endif
3350  if(sPDG>MINPDG) q4Mom-=G4LorentzVector(0.,0.,0.,pMass);
3351  qEnv=theEnvironment;
3352  return theQHadrons;
3353  }
3354  else if(abs(reMass-freeRQM)<fRQW||envPDG==NUCPDG)//=>"ResidQ is a GSHadron/Frag" case
3355  {
3356  G4QHadron* curHadr1 = new G4QHadron(rPDG,r4Mom);// Create RealHadron for the ResidQ
3357  FillHadronVector(curHadr1); // Fill "new curHadr1" (del. eq.)
3358  G4QHadron* curHadr2 = new G4QHadron(sPDG,s4Mom);// Creation Hadron for theCandidate
3359  FillHadronVector(curHadr2); // Fill "new curHadr2" (del. eq.)
3360 #ifdef rdebug
3361  G4cout<<"G4Q::HQ:DecayQuasmon "<<q4Mom<<" in 4M="<<r4Mom+s4Mom<<" RQ="<<rPDG<<r4Mom
3362  <<" + Fragment="<<sPDG<<s4Mom<<", Env="<<theEnvironment<<G4endl;
3363 #endif
3364  if(sPDG>MINPDG) theEnvironment.Reduce(pPDG);// Update NuclearEnv after Q->RQ+QEXF
3365  ClearQuasmon(); // This Quasmon is done
3366  qEnv=theEnvironment; // Update the QEnvironment
3367  return theQHadrons; // This is theLastDecay of the quasmon
3368  }
3369  else // => "Virtual Residual Quasmon" case
3370  {
3371  G4LorentzVector resTotN4Mom=r4Mom+G4LorentzVector(0.,0.,0.,envM);
3372  G4QContent resTotNQC=envQC+curQ; // QCof possible residual nucleus
3373  G4QNucleus resTotN(resTotNQC); // Pseudo nucleus for TotResidualNucl
3375  G4double resTotNM=resTotN.GetMZNS(); // Mass of the Total Residual Nucleus
3376  if(resTotN4Mom.m()<resTotNM) // Needs total evaporation
3377  {
3378  //if(totBN>1&&totMass>totM&&totS>=0) //@@ ??
3379 #ifdef pdebug
3381  ed<<"Why Fail?(10):NEEDS-EVAP-10,M="<<resTotN4Mom.m()<<"<miM="<<resTotNM<<G4endl;
3382  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0049", FatalException, ed);
3383 #endif
3384  if(sPDG>MINPDG) q4Mom-=G4LorentzVector(0.,0.,0.,pMass);
3385  qEnv=theEnvironment;
3386  return theQHadrons;
3387  }
3388  else // Only theTotResidNucl can evaporate
3389  {
3390  G4QHadron* curHadr2 = new G4QHadron(sPDG,s4Mom);// Create Hadron for theOutHadron
3391  FillHadronVector(curHadr2); // Fill "new curHadr2" (del.equiv.)
3392  q4Mom = r4Mom;
3393  if(sPDG>MINPDG)
3394  {
3395  theEnvironment.Reduce(pPDG); // Update NuclEnviron after Q->RQ+QEXF
3396  valQ += transQC; // Update the Quark Content of Quasmon
3397  }
3398  else valQ = curQ; // Update the Quark Content of Quasmon
3399 #ifdef rdebug
3400  G4cout<<"OK***>G4Q::HQ:S="<<sPDG<<s4Mom<<",Env="<<theEnvironment<<",Q="<<q4Mom
3401  <<valQ<<curQ<<G4endl;
3402 #endif
3403  status=1; // Something was successfuly done
3404  phot4M=zeroLV;
3405  piF=false;
3406  gaF=false;
3407  if(CheckGroundState()) ClearQuasmon(); // This Quasmon is done
3408  //if(CheckGroundState(true)) KillQuasmon(); // This Quasmon is done
3409 #ifdef rdebug
3410  G4cout<<"***>G4Q::HQ:After,S="<<sPDG<<s4Mom<<",Env="<<theEnvironment<<",Q="
3411  <<q4Mom<<valQ<<curQ<<G4endl;
3412 #endif
3413  qEnv=theEnvironment;
3414  return theQHadrons;
3415  }
3416  }
3417  }
3418 #ifdef rdebug
3419  else G4cout<<"G4Q::HQ:NO-OK,h="<<hsflag<<",d="<<fdul<<",M="<<rMass<<"<"<<reMass<<",M2="
3420  <<reTNM2<<"<I="<<tmpTM2<<",sP="<<sPDG<<",eP="<<envPDG<<",pP="<<pPDG<<G4endl;
3421 #endif
3422  if(!fskip) // Continue search for fragmentation
3423  {
3424  // =--= From this point for nuclear fragments the procedure is just filling =--=
3425 #ifdef debug
3426  G4int ePDG=theEnvironment.GetPDG();
3427  G4double frKin=fr4Mom.e()-sMass;
3428  G4cout<<"G4Q::HQ:>>"<<sPDG<<fr4Mom<<fr4Mom.m()<<"="<<sMass<<",T="<<frKin<<",E="<<ePDG
3429  <<G4endl;
3430 #endif
3431  //if(sPDG<MINPDG&&(ePDG==NUCPDG||nQuasms==1)) //==>>"Hadron candidate in Vacuum" case
3432  //if(sPDG<MINPDG&&nQuasms==1) // ==>> "Hadron candidate with the only Quasmon" case
3433  if(sPDG<MINPDG) // Hadronic decay is always in vacuum @@??
3434  {
3435  G4int SQ=totQC.GetStrangeness();
3436 #ifdef debug
3437  G4cout<<"G4Q::HQ: sPDG="<<sPDG<<", sM="<<sMass<<", SQ="<<SQ<<G4endl;
3438 #endif
3439  if(!sPDG&&SQ<0&&nQuasms==1) // decay Of Tot(Q+Env) in K+/aK0 & residual
3440  //if(!sPDG&&SQ<0) // decay in K+/aK0 & residual
3441  {
3442  sPDG=321;
3443  sMass=mK;
3444  G4QContent resKPQC=totQC-G4QContent(0,1,0,0,0,1);// Residual Quark Content for K+
3445  G4QNucleus rKPN(resKPQC); // Pseudo nucleus for the Resid System
3446  G4double rKPM = rKPN.GetMZNS(); // min mass of the Residual System
3447  G4int rKPPDG = rKPN.GetPDG(); // PDG of Residual
3448  G4QContent resK0QC=totQC-G4QContent(1,0,0,0,0,1);// Residual Quark Content for K0
3449  G4QNucleus rK0N(resK0QC); // Pseudo nucleus for the Resid System
3450  G4int rK0PDG = rK0N.GetPDG(); // PDG of Residual
3451  G4double rK0M = rK0N.GetMZNS(); // min mass of the Residual System
3452  if ( (rKPM+mK > totMass && rK0M+mK0 > totMass) ||
3453  rKPPDG == NUCPDG ||
3454  rK0PDG == NUCPDG )
3455  {
3456 #ifdef pdebug
3458  ed << "Why PANIC? (2): ***PANIC#2***tM=" << totMass << "<KM=" << mK << ","
3459  << mK0 << ",rM=" << rKPM << "," << rK0M << ",d=" << mK+rKPM-totMass << ","
3460  << mK0+rK0M-totMass << G4endl;
3461  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0050",FatalException,ed);
3462 #endif
3463  status =-1; // Panic exit
3464  qEnv=theEnvironment; // Update the QEnvironment
3465  return theQHadrons;
3466  }
3467  if(rKPM + mK > rK0M + mK0)
3468  {
3469  rPDG = rK0PDG; // PDG of the Residual System to K0
3470  rMass = rK0M;
3471  sPDG = 311;
3472  sMass = mK0;
3473  }
3474  else
3475  {
3476  rPDG = rKPPDG; // PDG of the Residual System to K+
3477  rMass = rKPM;
3478  sPDG = 321;
3479  sMass = mK;
3480  }
3481  G4double ctM=tot4M.m();
3482  G4LorentzVector r4Mom(0.,0.,0.,rMass);
3483  G4LorentzVector s4Mom(0.,0.,0.,sMass); // Mass is random since probab. time
3484  G4double sum=rMass+sMass;
3485  if(fabs(ctM-sum)<eps)
3486  {
3487  r4Mom=tot4M*(rMass/sum);
3488  s4Mom=tot4M*(sMass/sum);
3489  }
3490  else if(ctM<sum || !G4QHadron(tot4M).DecayIn2(r4Mom, s4Mom))
3491  {
3493  ed << "HadrQuasm:K+ResNuc DecayIn2 didn't succeed: tM=" << ctM
3494  << totQC << " => rPDG=" << rPDG << "(rM=" << rMass << ") + sPDG="
3495  << sPDG << "(sM=" << sMass << ")=" << sum << G4endl;
3496  G4Exception("G4Quasmon::HadronizeQuasmon()","HAD_CHPS_0051",FatalException,ed);
3497  }
3498 #ifdef debug
3499  G4cout<<"G4Q::HQ:===2.4===>HadrVec s="<<sPDG<<s4Mom<<",r="<<rPDG<<r4Mom<<G4endl;
3500 #endif
3501  //@@CHECK CoulBar and may be evaporate instead
3502  G4QHadron* curHadr1 = new G4QHadron(rPDG,r4Mom);// Create RealHadron for ResidEnv
3503  FillHadronVector(curHadr1); // Fill "new curHadr1" (del.equiv.)
3504  G4QHadron* curHadr2 = new G4QHadron(sPDG,s4Mom);// Creation Hadron for Candidate
3505  FillHadronVector(curHadr2); // Fill "new curHadr2" (del.equiv.)
3506  ClearQuasmon(); // This Quasmon is done
3507  qEnv=vacuum;
3508  return theQHadrons; // This is theLastDecay of the Quasmon
3509  }
3510  G4bool ffin=false; // Flag of FinalDecayInGamma+Residual
3511  if(quasM<rMass+sMass&&(sPDG==221||sPDG==331))// Change eta-Candidate or any to pi
3512  {
3513  sPDG = 111;
3514  sMass=mPi0;
3515  }
3516  else if(!sPDG)
3517  {
3518  if (iniS<0&&iniQChg+iniQChg>=iniBN) // Try to decay in K+
3519  {
3520  sPDG = 321;
3521  sMass= mK;
3522  G4QNucleus totQN(valQ+KpQC); // Nucleus Residual after Kp sub.
3523  rPDG = totQN.GetPDG();
3524  rMass= totQN.GetMZNS();
3525  }
3526  else if(iniS<0) // Try to decay in K0
3527  {
3528  sPDG = 311;
3529  sMass= mK0;
3530  G4QNucleus totQN(valQ+K0QC); // Nucleus Residual after K0 sub.
3531  rPDG = totQN.GetPDG();
3532  rMass= totQN.GetMZNS();
3533  }
3534  else if(iniQChg>iniBN-iniS) // Try to decay in Pi+
3535  {
3536  sPDG = 211;
3537  sMass= mPi;
3538  G4QNucleus totQN(valQ-PiQC); // Nucleus Residual after Pi+ sub.
3539  rPDG = totQN.GetPDG();
3540  rMass= totQN.GetMZNS();
3541  }
3542  else if(iniQChg<0) // Try to decay in Pi-
3543  {
3544  sPDG = -211;
3545  sMass= mPi;
3546  G4QNucleus totQN(valQ+PiQC); // Nucleus Residual after Pi- sub.
3547  rPDG = totQN.GetPDG();
3548  rMass= totQN.GetMZNS();
3549  }
3550  else if(quasM>iniQM+mPi0) // Try to decay in Pi0
3551  {
3552  sPDG = 111;
3553  sMass= mPi0;
3554  rPDG = iniPDG;
3555  rMass= iniQM;
3556  }
3557  else // Decay in gamma as a final decision
3558  {
3559  sPDG = 22;
3560  sMass= 0.;
3561  rPDG = iniPDG;
3562  rMass= iniQM;
3563  }
3564  ffin = true;
3565  }
3566 #ifdef debug
3567  G4cout<<"G4Q::HQ:MQ="<<q4Mom.m()<<"->sPDG="<<sPDG<<"(M="<<sMass<<") + rPDG="<<rPDG
3568  <<"(M="<<rMass<<")"<<",S="<<rMass+sMass<<G4endl;
3569 #endif
3570  if(q4Mom.m()+.003<rMass+sMass)
3571  {
3572 #ifdef debug
3573  G4cerr<<"G4Q::HQ:***PANIC#3***tM="<<q4Mom.m()<<"<rM="<<rMass<<",sM="<<sMass
3574  <<",d="<<rMass+sMass-q4Mom.m()<<G4endl;
3575 #endif
3576 #ifdef pdebug
3577  // throw G4QException("G4Quasmon::HadronizeQuasmon: Why PANIC? (3)"); //@@ TMP
3578  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0052",
3579  FatalException, "Why PANIC? (3)");
3580 #endif
3581  status =-1; // Panic exit
3582  qEnv=theEnvironment; // Update the QEnvironment
3583  return theQHadrons;
3584  }
3585  G4double cqM=q4Mom.m();
3586  G4LorentzVector resQ4Mom(0.,0.,0.,rMass); // 4-mom of residual Quasmon in CMS
3587  G4LorentzVector s4Mom(0.,0.,0.,sMass); // Mass is random since probab. level
3588  G4double sum=rMass+sMass;
3589  if(fabs(cqM-sum)<eps)
3590  {
3591  resQ4Mom=q4Mom*(rMass/sum);
3592  s4Mom=q4Mom*(sMass/sum);
3593  }
3594  else if(cqM<sum || !G4QHadron(q4Mom).DecayIn2(resQ4Mom, s4Mom))
3595  {
3596  // G4cerr<<"***G4Quasmon::HadronizeQuasmon: MQ="<<cqM<<"-> rPDG="<<rPDG<<", (M="
3597  // <<rMass<<") + sPDG="<<sPDG<<"(M="<<sMass<<")="<<sum<<G4endl;
3598  // throw G4QException("G4Quasmon::HadronizeQuas:Quasm+Hadr DecayIn2 error");
3600  ed << "Quasm+Hadr DecayIn2 error: MQ=" << cqM << "-> rPDG=" << rPDG
3601  << ", (M=" << rMass << ") + sPDG=" << sPDG << "(M=" << sMass
3602  << ")=" << sum << G4endl;
3603  G4Exception("G4Quasmon::HadronizeQuasmon()", "HAD_CHPS_0053",
3604  FatalException, ed);
3605  }
3606 #ifdef debug
3607  G4cout<<"G4Q::HQ:Decay of Quasmon="<<q4Mom<<"->s="<<sPDG<<s4Mom<<"+R="<<resQ4Mom
3608  <<",f="<<ffin<<G4endl;
3609 #endif
3610  G4QHadron* candHadr = new G4QHadron(sPDG,s4Mom);// Creation Hadron for Candidate
3611  if(ffin)
3612  {
3613  //@@CHECK CoulBar and may be evaporate instead
3614  theQHadrons.push_back(candHadr); // Fill the emergency PHOTON (del.eq.)
3615  G4QHadron* candHRes = new G4QHadron(rPDG,resQ4Mom);// Creation Hadron for QResid
3616  FillHadronVector(candHRes); // Fill "new candHRes" (del.equiv.)
3617  ClearQuasmon(); // This Quasmon is done
3618  qEnv=theEnvironment;
3619  return theQHadrons;
3620  }
3621  else
3622  {
3623  G4QContent outQC = G4QPDGCode(sPDG).GetQuarkContent();
3624  G4int outChg = outQC.GetCharge();
3625  G4double outProb = 1.;
3626  if(theEnvironment.GetPDG()>NUCPDG)
3627  {
3628  G4int outBar = outQC.GetBaryonNumber();
3629  G4double outCB = theEnvironment.CoulombBarrier(outChg,outBar);//ChrgIsNeglected
3630  // Now the CoulBar reflection should be taken into account
3631  G4double outT = s4Mom.e()-s4Mom.m();
3632  outProb = theEnvironment.CoulBarPenProb(outCB,outT,outChg,outBar);
3633  }
3634  G4double rnd=G4UniformRand();
3635 #ifdef debug
3636  G4cout<<"G4Q::HQ: for "<<sPDG<<", rnd="<<rnd<<" < outP="<<outProb<<" ?"<<G4endl;
3637 #endif
3638  if(rnd<outProb)
3639  {
3640  FillHadronVector(candHadr); // Fill "new candHadr" (del.equiv.)
3641  check+= s4Mom; // @@ Just for checking
3642  ccheck+=outChg; // @@ Just for checking
3643  q4Mom = resQ4Mom; // Update ResidQuasmonLorentzVector
3644  valQ = curQ; // Update the Quark Content of Quasmon
3645  status= 1; // Something was successfuly done
3646  phot4M=zeroLV;
3647  piF=false;
3648  gaF=false;
3649  }
3650  else
3651  {
3652  status=3; // Stopped by CB (over barrier STOP)
3653  delete candHadr; // As a result DoNothing
3654  }
3655  }
3656  }
3657  else // ===>"HadronInNuclMedia or NuclCand"
3658  {
3659  // Now the CoulBar reflection should be taken into account
3660  G4QContent outQC = G4QPDGCode(sPDG).GetQuarkContent();
3661  G4int outBar = outQC.GetBaryonNumber();
3662  G4int outChg = outQC.GetCharge();
3663  G4double outCB = theEnvironment.CoulombBarrier(outChg,outBar);
3664  // Now theCoulombPotential should be taken into account //@@ How to do this ??
3665  if(nucflag) rQ4Mom+=G4LorentzVector(dMass); // Make a correction of ResidQuasmon4M
3666  G4QHadron tmpRQH(valQ+transQC,rQ4Mom); // Tmp Hadron for the Residual Quasmon
3667  // Now theCoulBar reflection should be taken into account
3668  G4double outT = fr4Mom.e()-fr4Mom.m();
3669  G4double outProb = theEnvironment.CoulBarPenProb(outCB,outT,outChg,outBar);
3670  if(G4UniformRand()<outProb)
3671  {
3672  theEnvironment.Reduce(pPDG); // Update NuclearEnviron after Q->RQ+F
3673  G4LorentzVector sumL=theEnvironment.Get4Momentum()+q4Mom; //@@ Check Print Only
3674  check += fr4Mom; //@@ Just for checking
3675  ccheck+=G4QPDGCode(sPDG).GetCharge(); //@@ Just for checking
3676  // --- @@ --- Potential recovery of the secondary --- Bad experience
3677  //G4double bindE=sMass-pMass;
3678  //G4double fE=fr4Mom.e();
3679  //G4double nfE=fE+bindE;
3680  //G4double frM2=sMass*sMass; // MinSuaredMass of OutgoingFragment
3681  //G4double rpf=sqrt((nfE*nfE-frM2)/(fE*fE-frM2))-1.;
3682  //G4LorentzVector bind4M(rpf*fr4Mom.vect(),bindE);
3683  //G4LorentzVector ren4M=tot4M-fr4Mom-bind4M;
3684  //G4double rnM2= ren4M.m2(); // ResidNucleusMass after separation
3685  //G4QContent renQC=theEnvironment.GetQCZNS()+valQ;
3686  //G4QNucleus renTot(renQC); // PseudoNucleus for TotResidualNucl
3687  //G4double renTotM=renTot.GetMZNS(); // GSMass of Total Residual Nucleus
3688  //if(rnM2>renTotM*renTotM)
3689  //{
3690  // fr4Mom+=bind4M;
3691  // rQ4Mom-=bind4M;
3692  //}
3693  // --- @@ --- End of Potential recovery of the secondary
3694  q4Mom = rQ4Mom; // Update the 4Mom of the Quasmon
3695  if(sPDG>MINPDG) valQ += transQC; // Update the Quark Content of Quasmon
3696  G4QHadron* candHadr = new G4QHadron(sPDG,fr4Mom);// Createa Hadron for Candidate
3697  FillHadronVector(candHadr); // Fill the RadiatedHadron(del.equiv.)
3698 #ifdef debug
3699  G4cout<<"G4Q::HQ:QuarkExchHadronizThroughCB Q="<<valQ<<",trQC="<<transQC<<G4endl;
3700 #endif
3701  sumL-=theEnvironment.Get4Momentum()+q4Mom+fr4Mom;
3702 #ifdef debug
3703  G4cout<<"G4Q::HQ:status=1, ------>> NuclearMatter SUBCHECK ---->>"<<sumL<<G4endl;
3704 #endif
3705  status=1; // Something was successfuly done
3706  phot4M=zeroLV;
3707  piF=false;
3708  gaF=false;
3709  }
3710  else
3711  {
3712 #ifdef debug
3713  G4cout<<"G4Q::HQ:CBIsn'tPEN,P="<<outProb<<",T="<<outT<<",M="<<fr4Mom.m()<<G4endl;
3714 #endif
3715  // @@ To enable fission one should put "suck in Q" here @@
3716  //if(envA<20&&G4UniformRand()>envA*envA/400) // ?? M.K. ??
3717  //{
3718  status=3;
3719  if(gaF)
3720  {
3721  phot4M=zeroLV;
3722  gaF=false;
3723  }
3724  //}
3725  }
3726  }
3727  } // End of skip
3728  // === Check of boundary to escape not existing state of residual nucleus ===
3729  if(CheckGroundState())
3730  //if(CheckGroundState(true))
3731  {
3732  ClearQuasmon(); // This Quasmon is done
3733  qEnv=theEnvironment;
3734  return theQHadrons;
3735  }
3736  G4LorentzVector sumLor=theEnvironment.Get4Momentum()+q4Mom+check;
3737 #ifdef debug
3738  G4int eZ = theEnvironment.GetZ();
3739  G4int sumC = eZ+valQ.GetCharge()+ccheck;
3740  G4int curPDG=valQ.GetSPDGCode();
3741  G4cout<<"G4Q::HQ:Z="<<eZ<<valQ<<"***>FinalCHECK***>>4M="<<sumLor<<",Ch="<<sumC<<G4endl;
3742  if(!curPDG) G4cout<<"***G4Q::HQ: Quasmon-Tripolino QC="<<valQ<<G4endl;
3743  G4cout<<"G4Q::HQ:=------=> ResidualQ 4M="<<q4Mom<<", QC="<<valQ<<G4endl;
3744 #endif
3745  } // End of the main while loop
3746 #ifdef chdebug
3747  G4int ecSum=theEnvironment.GetZ()+valQ.GetCharge(); // To compare with initial charge
3748  G4int nHe=theQHadrons.size();
3749  if(nHe) for(int ih=0; ih<nHe; ih++) ecSum+=theQHadrons[ih]->GetCharge();
3750  if(ecSum!=cSum)
3751  {
3752  G4cerr<<"***G4Q::HQ:C"<<cSum<<",c="<<ecSum<<",E="<<theEnvironment<<",Q="<<valQ<<G4endl;
3753  G4cerr<<":G4Q::HQ:*END*,oE="<<oldEnv<<"oQ="<<oldCQC<<",oN="<<oldNH<<",N="<<nHe<<G4endl;
3754  if(nHe) for(G4int h=0; h<nHe; h++)
3755  {
3756  G4QHadron* cH = theQHadrons[h];
3757  G4cerr<<"::G4Q::HQ:#h"<<h<<",C="<<cH->GetCharge()<<",P="<<cH->GetPDGCode()<<G4endl;
3758  }
3759  }
3760 #endif
3761 #ifdef debug
3762  G4cout<<"G4Q::HQ: Q="<<q4Mom<<valQ<<",E="<<theEnvironment<<", status="<<status<<G4endl;
3763 #endif
3764  qEnv=theEnvironment; // Update the QEnvironment
3765  return theQHadrons;
3766 } // End of "HadronizeQuasmon"
3767 
3768 // Decay the Quasmon if it is a Hadron or a Chipolino and fill theHadronVector (out & in!)
3769 G4QHadronVector* G4Quasmon::DecayQuasmon() // Public wrapper for FillHadronVector(this)
3770 {
3771  G4QHadron* thisQuasmon = new G4QHadron(valQ,q4Mom); // create a Hadron for this Quasmon
3772  FillHadronVector(thisQuasmon); // Fill it as a hadron
3773  G4QHadronVector* theFragments = new G4QHadronVector; // user is responsible to delete!
3774  G4int nHadrs=theQHadrons.size();
3775 #ifdef debug
3776  G4cout<<"G4Q::DecayQuasmon:After decay (FillHadronVector byItself) nH="<<nHadrs<<G4endl;
3777 #endif
3778  if(nHadrs) for (int hadron=0; hadron<nHadrs; hadron++)
3779  {
3780  G4QHadron* curHadr = new G4QHadron(theQHadrons[hadron]);
3781  theFragments->push_back(curHadr); // (user must delete)
3782  }
3783 #ifdef pdebug
3784  else G4cerr<<"*******G4Quasmon::DecayQuasmon: *** Nothing is in the output ***"<<G4endl;
3785 #endif
3786  valQ=G4QContent(0,0,0,0,0,0); // Wipe the Quasmon out
3787  q4Mom=G4LorentzVector(0.,0.,0.,0.); // ... with its 4-momentum
3788  return theFragments;
3789 } // End of "DecayQuasmon"
3790 
3791 // Test for Decay, Decay, Filling of hadron vector
3792 void G4Quasmon::FillHadronVector(G4QHadron* qH)
3793 {
3794  // SHORT-RANGE CORRELATIONS
3795  // =----------------------=
3796  // dN/kdk=C/(A+k^2)^2, where A=-1/2ar. {NN=pp,nn,np}
3797  // Randomization: p_NN^2=A_NN/(1/rndm-1), E_NN=sqrt(m_NN^2+p_NN^2)
3798  // A_pp=888.3
3799  // A_nn=410.1
3800  // A_pn=297.5
3801  // Breite-Wigner representation:
3802  // m_pp=-0.9450 MeV; G_pp=0
3803  // m_nn=-0.4336 MeV; G_nn=0
3804  // m_pn=-0.3139 MeV; G_pn=0
3805  // ----------------------------------------------------------------
3806  static const G4LorentzVector zeroLV(0.,0.,0.,0.);
3807  static const G4double mAlph = G4QPDGCode(2112).GetNuclMass(2,2,0);
3808  static const G4QContent neutQC(2,1,0,0,0,0);
3809  static const G4QContent protQC(1,2,0,0,0,0);
3810  static const G4QContent sigmQC(2,0,1,0,0,0);
3811  static const G4QContent lambQC(1,1,1,0,0,0);
3812  static const G4QContent sigpQC(0,2,1,0,0,0);
3813  static const G4QContent PiQC(0,1,0,1,0,0);
3814  static const G4QContent K0QC(1,0,0,0,0,1);
3815  static const G4QContent KpQC(0,1,0,0,0,1);
3816  static const G4double mNeut= G4QPDGCode(2112).GetMass();
3817  static const G4double mProt= G4QPDGCode(2212).GetMass();
3818  static const G4double mSigM= G4QPDGCode(3112).GetMass();
3819  static const G4double mLamb= G4QPDGCode(3122).GetMass();
3820  static const G4double mSigP= G4QPDGCode(3222).GetMass();
3821  static const G4double mPi = G4QPDGCode(211).GetMass();
3822  static const G4double mPi0 = G4QPDGCode(111).GetMass();
3823  static const G4double mK = G4QPDGCode(321).GetMass();
3824  static const G4double mK0 = G4QPDGCode(311).GetMass();
3825 
3826  status=1; // Something isGoingToBeFilled by Quasmon
3827  phot4M=zeroLV;
3828  G4int thePDG = qH->GetPDGCode(); // Get PDG code of the Hadron to switch
3829  G4LorentzVector t = qH->Get4Momentum(); // 4-Mom of Chipolino
3830 #ifdef psdebug
3831  if(thePDG==113 && fabs(t.m()-770.)<.001)
3832  {
3833  G4cerr<<"G4Q::FillHadronVector: PDG="<<thePDG<<",M="<<t.m()<<G4endl;
3834  // throw G4QException("G4Quasmon::FillHadronVector: Zero rho");
3835  G4Exception("G4Quasmon::FillHadronVector()", "HAD_CHPS_0000",
3836  FatalException, "Zero rho");
3837  }
3838 #endif
3839 #ifdef pdebug
3840  G4cout<<"G4Q::FillHadronVector:Hadron's PDG="<<thePDG<<",4Mom="<<t<<",m="<<t.m()<<G4endl;
3841 #endif
3842  if(thePDG>80000000 && (thePDG<90000000 || thePDG%1000>500 || thePDG%1000000>500000)
3843  && thePDG!=90002999 && thePDG!=89999003 && thePDG!=90003998 && thePDG!=89998004
3844  && thePDG!=90003999 && thePDG!=89999004 && thePDG!=90004998 && thePDG!=89998005)
3845  { // Translation from CHIPS encoding to PDG encoding @@ change to NuclToHadr
3846  if (thePDG==90999999) thePDG=-311; // anti-K0 === Meson OCTET
3847  else if(thePDG==90999000) thePDG=-321; // K-
3848  else if(thePDG==89000001) thePDG=311; // K0
3849  else if(thePDG==89001000) thePDG=321; // K+
3850  else if(thePDG==90000999) thePDG=211; // pi+
3851  else if(thePDG==89999001) thePDG=-211; // pi-
3852  else if(thePDG==89999999) thePDG=-2112; // anti-neutr=>ant-OCTET reduced to SEPTUM L/S0
3853  else if(thePDG==89999000) thePDG=-2212; // anti-proton
3854  else if(thePDG==89000000) thePDG=-3122; // anti-lambda
3855  else if(thePDG==88999002) thePDG=-3222; // anti-SIGMA+
3856  else if(thePDG==89000999) thePDG=-3222; // anti-SIGMA-
3857  else if(thePDG==88000001) thePDG=-3322; // anti-KSI0
3858  else if(thePDG==88001000) thePDG=-3312; // anti-KSI-
3859  else if(thePDG==89999002) thePDG=1114; // Delta-(resonance) === bary-DECUPLET/OCTET
3860  else if(thePDG==90001999) thePDG=2224; // Delta++(res)(Delta0&Delta+ a covered by n&p)
3861  else if(thePDG==91000000) thePDG=3122; // Lambda
3862  else if(thePDG==90999001) thePDG=3112; // Sigma-
3863  else if(thePDG==91000999) thePDG=3222; // Sigma+ (Sigma0 iz covered by Lambda)
3864  else if(thePDG==91999000) thePDG=3312; // Ksi-
3865  else if(thePDG==91999999) thePDG=3322; // Ksi0
3866  else if(thePDG==92998999) thePDG=3112; // Omega-(resonance)
3867 #ifdef pdebug
3868  else G4cerr<<"*G4Quasmon::FillQHV:PDG="<<thePDG<<",M="<<qH->Get4Momentum().m()<<G4endl;
3869 #endif
3870  qH->SetQPDG(G4QPDGCode(thePDG));
3871  }
3872  if (thePDG==10)// Chipolino decays (@@always - Chipolino is not kept in HadV (*Example*))
3873  {
3874  G4double rM = t.m(); // Mass of Chipolino
3875  G4QContent chipQC = qH->GetQC(); // QC of Chipolino
3876  G4QContent h1QC = chipQC.SplitChipo(rM); // Extract QC of oneOfTheHadrons of Chipolino
3877  G4QContent h2QC = chipQC - h1QC; // Define QC of the second Hadron
3878  G4int h1PDG = h1QC.GetSPDGCode(); // PDGCode of the First Hadron
3879  G4int h2PDG = h2QC.GetSPDGCode(); // PDGCode of the First Hadron
3880  if(!h1PDG || !h2PDG)
3881  {
3882  G4cerr<<"***FillHV:h1QC="<<h1QC<<"(PDG="<<h1PDG<<"),h2QC="<<h2QC<<"(PDG="<<h2PDG<<")"
3883  <<G4endl;
3884  G4Exception("G4Quasmon::FillHadronVector()", "HAD_CHPS_0001", FatalException,
3885  "Chipolino can't be defragmented");
3886  }
3887  G4QHadron* fHadr = new G4QHadron(h1PDG); // the First Hadron is created
3888  G4QHadron* sHadr = new G4QHadron(h2PDG); // the Second Hadron is created
3889  G4LorentzVector f4Mom = fHadr->Get4Momentum();
3890  G4LorentzVector s4Mom = sHadr->Get4Momentum();
3891  if(!qH->DecayIn2(f4Mom,s4Mom))
3892  {
3893  delete fHadr; // Delete "new fHadr"
3894  delete sHadr; // Delete "new sHadr"
3895  G4cerr<<"***G4Q::FillHadrV:ChipQC"<<chipQC<<":PDG1="<<h1PDG<<",PDG2="<<h2PDG<<G4endl;
3896  theQHadrons.push_back(qH); // No decay (delete equivalent)
3897  }
3898  else
3899  {
3900  delete qH;
3901  fHadr->Set4Momentum(f4Mom); // Put the randomized 4Mom to 1-st Hadron
3902  FillHadronVector(fHadr); // Fill 1st Hadron (delete equivalent)
3903  sHadr->Set4Momentum(s4Mom); // Put the randomized 4Mom to 2-nd Hadron
3904  FillHadronVector(sHadr); // Fill 2nd Hadron (delete equivalent)
3905  }
3906  }
3907  else if(thePDG>80000000&&thePDG!=90000000) //==Decay-Evaporation of theBarionicFragment==
3908  {
3909  G4double fragMas=t.m(); // Real Mass of the nuclear fragment
3910  //G4double fragMas=qH->GetMass(); // GrStMass of the nuclear fragment (wrong?)
3911  G4QNucleus qNuc(t,thePDG); // Make a Nucleus out of the Hadron
3912  // @@ Probably, when nucleus is initialized, the mass is not initialized ? Was OK! Why?
3913  //G4double GSMass =qNuc.GetGSMass(); // GrState Mass of the nuclear fragment (?)
3914  G4double GSMass = G4QPDGCode(thePDG).GetMass(); // More robust definition
3915  G4QContent totQC=qNuc.GetQCZNS(); // Total Quark Content of Residual Nucleus
3916  G4int nN =qNuc.GetN(); // A#of neutrons in the Nucleus
3917  G4int nZ =qNuc.GetZ(); // A#of protons in the Nucleus
3918  G4int nS =qNuc.GetS(); // A#of protons in the Nucleus
3919  G4int bA =qNuc.GetA(); // A#of baryons in the Nucleus
3920 #ifdef pdebug
3921  G4cout<<"G4Quasm::FillHadrVect:Nucl="<<qNuc<<",nPDG="<<thePDG<<",GSM="<<GSMass<<G4endl;
3922 #endif
3923  if((nN<0 || nZ<0 || nS<0) && bA>0) // => "Anti-strangeness or ISOBAR" case
3924  {
3925  G4double m1=mPi; // Prototypes for the nZ<0 case
3926  G4int PDG1=-211;
3927  G4QNucleus newNpm(totQC+PiQC);
3928  G4int newS=newNpm.GetStrangeness();
3929  if(newS>0) newNpm=G4QNucleus(totQC+PiQC+newS*K0QC);
3930  G4int PDG2=newNpm.GetPDG();
3931  G4double m2_value=newNpm.GetMZNS();
3932  if(nS<0)
3933  {
3934  m1 =mK;
3935  PDG1 =321;
3936  G4QNucleus newNp(totQC-KpQC);
3937  PDG2 =newNp.GetPDG();
3938  m2_value =newNp.GetMZNS();
3939  G4QNucleus newN0(totQC-K0QC);
3940  G4double m3_value=newN0.GetMZNS();
3941  if (m3_value+mK0<m2_value+mK) // => "aK0+ResA is better" case
3942  {
3943  m1 =mK0;
3944  PDG1=311;
3945  m2_value =m3_value;
3946  PDG2=newN0.GetPDG();
3947  }
3948  }
3949  else if(nS>0&&nZ+nN>0)
3950  {
3951  if(nN<0)
3952  {
3953  m1 =mSigP;
3954  PDG1 =3222;
3955  G4QNucleus newNp(totQC-sigpQC);
3956  PDG2 =newNp.GetPDG();
3957  m2_value =newNp.GetMZNS();
3958  }
3959  else
3960  {
3961  m1 =mSigM;
3962  PDG1 =3112;
3963  G4QNucleus newNp(totQC-sigmQC);
3964  PDG2 =newNp.GetPDG();
3965  m2_value =newNp.GetMZNS();
3966  }
3967  }
3968  else if(nN<0)
3969  {
3970  PDG1 =211;
3971  G4QNucleus newNpp(totQC-PiQC);
3972  PDG2 =newNpp.GetPDG();
3973  m2_value =newNpp.GetMZNS();
3974  }
3975  if(fragMas>m1+m2_value) // => "can decay" case
3976  {
3977  G4LorentzVector fq4M(0.,0.,0.,m1);
3978  G4LorentzVector qe4M(0.,0.,0.,m2_value);
3979  if(!qH->DecayIn2(fq4M,qe4M))
3980  {
3982  ed << "Mes+ResA DecayIn2 did not succeed: QM=" << t.m() << "-> Mes=" << PDG1
3983  << "(M=" << m1 << ") + ResA=" << PDG2 << "(M=" << m2_value << ")" << G4endl;
3984  G4Exception("G4Quasmon::FillHadronVector()","HAD_CHPS_0002", FatalException, ed);
3985  }
3986  delete qH;
3987  G4QHadron* H1 = new G4QHadron(PDG1,fq4M);
3988  theQHadrons.push_back(H1); // (delete equivalent)
3989  G4QHadron* H2 = new G4QHadron(PDG2,qe4M);
3990  FillHadronVector(H2); // (delete equivalent)
3991  }
3992  else if(fabs(m1+m2_value-fragMas)<0.01) // Split the 4-momentum
3993  {
3994  G4double r1=m1/fragMas;
3995  G4double r2=1.-r1;
3996  //qH->SetNFragments(2); // Put a#of Fragments=2
3997  //theQHadrons.push_back(qH);
3998  // Instead
3999  delete qH;
4000  //
4001  G4QHadron* H1 = new G4QHadron(PDG1,r1*t);
4002  theQHadrons.push_back(H1); // (delete equivalent)
4003  G4QHadron* H2 = new G4QHadron(PDG2,r2*t);
4004  FillHadronVector(H2); // (delete equivalent)
4005  }
4006  else
4007  {
4008 #ifdef debug
4009  G4cerr<<"-Warning-G4Q::FillHVec:PDG="<<thePDG<<"("<<t.m()<<","<<fragMas<<") < Mes="
4010  <<PDG1<<"("<<m1<<") + ResA="<<PDG2<<"("<<m2_value<<"), d="<<fragMas-m1-m2_value<<G4endl;
4011  //throw G4QException("G4Quasm::FillHadrVec: mass of decaying hadron is too small");
4012 #endif
4013  theQHadrons.push_back(qH); // FillAsIs to correct later in G4QEnvironment (Warning)
4014  }
4015  }
4016  else if(abs(fragMas-GSMass)<.1) // the Nucleus is too close the Ground State
4017  {
4018 #ifdef pdebug
4019  G4cout<<"G4Quasm::FillHadrVect: Ground state"<<G4endl;
4020 #endif
4021  G4double nResM =1000000.; // Prototype of residualMass for the neutron
4022  G4int nResPDG=0; // Prototype of PDGCode for the neutron
4023  if(nN>0&&bA>1) // It's nucleus and there is the neutron
4024  {
4025  G4QContent resQC=totQC-neutQC;
4026  G4QNucleus resN(resQC); // Pseudo nucleus for the Residual Nucleus
4027  nResPDG=resN.GetPDG(); // PDG of the Residual Nucleus
4028  if (nResPDG==90000001) nResM=mNeut;
4029  else if(nResPDG==90001000) nResM=mProt;
4030  else if(nResPDG==91000000) nResM=mLamb;
4031  else nResM=resN.GetMZNS(); // min mass of the Residual Nucleus
4032  }
4033  G4double pResM =1000000.; // Prototype of residualMass for the proton
4034  G4int pResPDG=0; // Prototype of PDGCode of the proton
4035  if(nZ>0&&bA>1) // It's nucleus and there is theroton
4036  {
4037  G4QContent resQC=totQC-protQC;
4038  G4QNucleus resN(resQC); // Pseudo nucleus for the Residual Nucleus
4039  pResPDG=resN.GetPDG(); // PDG of the Residual Nucleus
4040  if (pResPDG==90000001) pResM=mNeut;
4041  else if(pResPDG==90001000) pResM=mProt;
4042  else if(pResPDG==91000000) pResM=mLamb;
4043  else pResM =resN.GetMZNS(); // min mass of the Residual Nucleus
4044  }
4045  G4double lResM =1000000.; // Prototype of residualMass for the Lambda
4046  G4int lResPDG=0; // Prototype of PDGCode of the Lambda
4047  if(nS>0&&bA>1) // It's nucleus and there is the Lambda
4048  {
4049  G4QContent resQC=totQC-lambQC;
4050  G4QNucleus resN(resQC); // Pseudo nucleus for the Residual Nucleus
4051  lResPDG=resN.GetPDG(); // PDG of the Residual Nucleus
4052  if (lResPDG==90000001) lResM=mNeut;
4053  else if(lResPDG==90001000) lResM=mProt;
4054  else if(lResPDG==91000000) lResM=mLamb;
4055  else lResM =resN.GetMZNS(); // min mass of the Residual Nucleus
4056  }
4057 #ifdef debug
4058  G4cout<<"G4Quasm::FillHadrVec:rP="<<pResPDG<<",rN="<<nResPDG<<",rL="<<lResPDG<<",nN="
4059  <<nN<<",nZ="<<nZ<<",nL="<<nS<<",totM="<<fragMas<<",n="<<fragMas-nResM-mNeut
4060  <<",p="<<fragMas-pResM-mProt<<",l="<<fragMas-lResM-mLamb<<G4endl;
4061 #endif
4062  if ( thePDG == 90004004 ||
4063  (bA > 1 && ( (nN > 0 && fragMas > nResM+mNeut) ||
4064  (nZ > 0 && fragMas > pResM+mProt) ||
4065  (nS > 0 && fragMas > lResM+mLamb) ) ) )
4066  {
4067  G4int barPDG = 90002002;
4068  G4int resPDG = 90002002;
4069  G4double barM= mAlph;
4070  G4double resM= mAlph;
4071 
4072  if (fragMas > nResM+mNeut) { // Can radiate a neutron (priority 1)
4073  barPDG = 90000001;
4074  resPDG = nResPDG;
4075  barM= mNeut;
4076  resM= nResM;
4077  }
4078  else if(fragMas>pResM+mProt) // Can radiate a proton (priority 2)
4079  {
4080  barPDG=90001000;
4081  resPDG=pResPDG;
4082  barM =mProt;
4083  resM =pResM;
4084  }
4085  else if(fragMas>lResM+mLamb) // Can radiate a Lambda (priority 3)
4086  {
4087  barPDG=91000000;
4088  resPDG=lResPDG;
4089  barM =mLamb;
4090  resM =lResM;
4091  }
4092  else if(thePDG!=90004004 && fragMas>GSMass)// If it's not Be8 decay in gamma
4093  {
4094  barPDG=22;
4095  resPDG=thePDG;
4096  barM =0.;
4097  resM =pResM;
4098  }
4099  else if(thePDG!=90004004)
4100  {
4102  ed << "Below GSM but cann't decay: PDG=" << thePDG << ",M=" << fragMas
4103  << "<GSM=" << GSMass << G4endl;
4104  G4Exception("G4Quasmon::FillHadronVector()","HAD_CHPS_0003", FatalException, ed);
4105  }
4106  G4LorentzVector a4Mom(0.,0.,0.,barM);
4107  G4LorentzVector b4Mom(0.,0.,0.,resM);
4108  if(!qH->DecayIn2(a4Mom,b4Mom))
4109  {
4110  theQHadrons.push_back(qH); // No decay (delete equivalent)
4111  G4cerr<<"---Warning---G4Q::FillHadronVector: Be8 decay did not succeed"<<G4endl;
4112  }
4113  else
4114  {
4115  //qH->SetNFragments(2); // Fill a#of fragments to decaying Hadron
4116  //theQHadrons.push_back(qH); // Fill hadron with nf=2 (del. eq.)
4117  // Instead
4118  delete qH;
4119  //
4120  G4QHadron* HadrB = new G4QHadron(barPDG,a4Mom);
4121  FillHadronVector(HadrB); // Fill 1st Hadron (delete equivalent)
4122  G4QHadron* HadrR = new G4QHadron(resPDG,b4Mom);
4123  FillHadronVector(HadrR); // Fill 2nd Hadron (delete equivalent)
4124  }
4125  }
4126  else
4127  {
4128 #ifdef debug
4129  G4cout<<"G4Quasm::FillHadrVect: Leave as it is"<<G4endl;
4130 #endif
4131  theQHadrons.push_back(qH); // No decay (delete equivalent)
4132  }
4133  }
4134  else if (fragMas < GSMass) // Approximate equality was already checked
4135  {
4136  G4cerr<<"***G4Quasmon::FillHV:M="<<fragMas<<">GSM="<<GSMass<<"(PDG="<<thePDG<<"),d="
4137  <<fragMas-GSMass<<", NZS="<<nN<<","<<nZ<<","<<nS<<G4endl;
4138  //throw G4QException("*G4Quasmon::FillHadronVector:Mass is below theGroundStateVal");
4139  G4cout<<"****>>G4Quasm::FillHadrVect: Leave as it is Instead of Exception"<<G4endl;
4140  theQHadrons.push_back(qH); // Fill As Is (delete equivalent)
4141  }
4142  else if (bA==1 && fragMas>GSMass)
4143  {
4144  G4int gamPDG=22;
4145  G4double gamM=0.;
4146  if(fragMas>mPi0+GSMass)
4147  {
4148  gamPDG=111;
4149  gamM=mPi0;
4150  }
4151  G4LorentzVector a4Mom(0.,0.,0.,gamM);
4152  G4LorentzVector b4Mom(0.,0.,0.,GSMass);
4153  if(!qH->DecayIn2(a4Mom,b4Mom))
4154  {
4155  theQHadrons.push_back(qH); // No decay (delete equivalent)
4156  G4cerr<<"---Warning---G4Q::FillHadrVect:N*->gamma/pi0+N decay error"<<G4endl;
4157  }
4158  else
4159  {
4160  G4QHadron* HadrB = new G4QHadron(gamPDG,a4Mom);
4161  FillHadronVector(HadrB); // Fill gamma/Pi0 Hadron (delete equivalent)
4162  qH->Set4Momentum(b4Mom); // Put the new 4-mom in the residual GS fragment
4163  theQHadrons.push_back(qH); // Fill corrected baryon in the HadronVector
4164  }
4165  }
4166  else // ===> Evaporation of excited system
4167  {
4168 #ifdef ppdebug
4169  G4cout<<"G4Quasm::FillHadrVect:Evaporate "<<thePDG<<",tM="<<fragMas<<" > GS="<<GSMass
4170  <<qNuc.Get4Momentum()<<", m="<<qNuc.Get4Momentum().m()<<G4endl;
4171 #endif
4172  G4QHadron* bHadron = new G4QHadron;
4173  G4QHadron* rHadron = new G4QHadron;
4174  if(!qNuc.EvaporateBaryon(bHadron,rHadron))
4175  {
4176  G4cerr<<"---Warning---G4Q::FillHV:Evaporate PDG="<<thePDG<<",M="<<fragMas<<G4endl;
4177  delete bHadron;
4178  delete rHadron;
4179  theQHadrons.push_back(qH); // Fill hadron in the HadronVector as it is
4180  }
4181  else
4182  {
4183 #ifdef debug
4184  G4cout<<"G4Q::FlHV:Done,b="<<bHadron->GetQPDG()<<",r="<<rHadron->GetQPDG()<<G4endl;
4185 #endif
4186  delete qH;
4187  if(bHadron->GetPDGCode() < -1111)
4188  {
4189  G4QHadronVector* tmpQHadVec=DecayQHadron(bHadron); // (delete equivalent)
4190  G4int tmpS=tmpQHadVec->size();
4191  theQHadrons.resize(tmpS+theQHadrons.size()); // Resize theQHadrons length
4192  copy( tmpQHadVec->begin(), tmpQHadVec->end(), theQHadrons.end()-tmpS);
4193  tmpQHadVec->clear();
4194  delete tmpQHadVec; // Who calls DecayQHadron is responsible for clear & delete
4195  }
4196  else FillHadronVector(bHadron); // Fill Evapor. Baryon (delete equivalent)
4197  if(rHadron->GetPDGCode() < -1111)
4198  {
4199  G4QHadronVector* tmpQHadVec=DecayQHadron(rHadron); // (delete equivalent)
4200  G4int tmpS=tmpQHadVec->size();
4201  theQHadrons.resize(tmpS+theQHadrons.size()); // Resize theQHadrons length
4202  copy( tmpQHadVec->begin(), tmpQHadVec->end(), theQHadrons.end()-tmpS);
4203  tmpQHadVec->clear();
4204  delete tmpQHadVec; // Who calls DecayQHadron is responsible for clear & delete
4205  }
4206  else FillHadronVector(rHadron); // Fill Residual Nucl. (delete equivalent)
4207  }
4208  }
4209  }
4210  else // Try to decay the QHadron (delete equivalent)
4211  {
4212 #ifdef pdebug
4213  G4cout<<"G4Q::FillHV: ---DECAY--- QH="<<qH->GetPDGCode()<<qH->Get4Momentum()<<G4endl;
4214 #endif
4215  G4QHadronVector* tmpQHadVec=DecayQHadron(qH); // (delete equivalent for qH or Products)
4216 #ifdef pdebug
4217  G4cout<<"G4Q::FillHV: ---DECAY IS DONE--- with nH="<<tmpQHadVec->size()<<G4endl;
4218 #endif
4219  G4int tmpS=tmpQHadVec->size();
4220  theQHadrons.resize(tmpS+theQHadrons.size()); // Resize theQHadrons length
4221  copy( tmpQHadVec->begin(), tmpQHadVec->end(), theQHadrons.end()-tmpS);
4222 #ifdef pdebug
4223  G4cout<<"G4Q::FillHV: -->Products are added to QHV, nQHV="<<theQHadrons.size()<<G4endl;
4224 #endif
4225  tmpQHadVec->clear();
4226  delete tmpQHadVec; // That who calls DecayQHadron is responsible for clear & delete
4227 #ifdef pdebug
4228  G4cout<<"G4Q::FillHV: TemporaryQHV of DecayProducts is deleted"<<G4endl;
4229 #endif
4230  }
4231 } // End of "FillHadronVector"
4232 
4233 // Calculate a momentum of quark-parton greater then minimum value kMin
4234 // It is called once with mC2=2*minK*M_Q or =mPio2 or =mP2 (a minimum CouloredResidualMass)
4235 //G4double G4Quasmon::GetQPartonMomentum(G4double mR2, G4double mC2)
4236 G4double G4Quasmon::GetQPartonMomentum(G4double kMax, G4double mC2)
4237 {
4238  //gives k>kMin QParton Momentum for the current Quasmon
4239 #ifdef debug
4240  //G4cout<<"G4Quasmon::GetQPartonMom:**called**mR="<<sqrt(mR2)<<",mC="<<sqrt(mC2)<<G4endl;
4241  G4cout<<"G4Quas::GetQPartonMomentum:***called*** kMax="<<kMax<<",mC="<<sqrt(mC2)<<G4endl;
4242 #endif
4243  G4double qMass = q4Mom.m(); // Mass of the Quasmon (M_Q)
4244  G4double kLim = qMass/2.; // Kinematikal limit for "k"
4245  G4double twM = qMass+qMass; // two masses of Quasmon
4246  G4double kMin = mC2/twM; // mC2=2*kMin*M_Q
4247  //if(mR2) // (HYistorical) Previously the mR2 was an input parameter...
4248  //{
4249  // G4double qM2 = qMass*qMass; // Squared Mass of Quasmon
4250  // G4double frM = twM+twM; // Four Masses of Quasmon (4*M_Q)
4251  // G4double fM2m2 = frM*qMass*mC2; // 4*M_Q**2*mC2=0.
4252  // G4double Mmum = qM2+mC2-mR2; // QM**2-mR2
4253  // G4double Mmum2 = Mmum*Mmum; // (QM**2-mR2)**2
4254  // if(Mmum2<fM2m2)throw G4QException("G4Quasmon::QPartMom:mR&mC are bigger then mQ");
4255  // G4double sqM = sqrt(Mmum2-fM2m2); // QM**2-mR2
4256  // kMin = (Mmum-sqM)/frM; // kMin=0.
4257  // kMax = (Mmum+sqM)/frM; // kMax=2*(QM**2-mR2)/4QM
4258  //}
4259  if (kLim<kMax) kMax = kLim; // Limit the k-simulatiom by maxK=kMax
4260  if (kMin<0 || kMax<0 || qMass<=0. || nOfQ<2)
4261  {
4263  ed << "Can not generate quark-parton: kMax=" << kMax << ", kMin=" << kMin
4264  << ", kLim=" << kLim << ", MQ=" << qMass << ", n=" << nOfQ << G4endl;
4265  G4Exception("G4Quasmon::GetQPartonMomentum()", "HAD_CHPS_0000", FatalException, ed);
4266  }
4267 #ifdef debug
4268  G4cout<<"G4Q::GetQPM: kLim="<<kLim<<",kMin="<<kMin<<",kMax="<<kMax<<",nQ="<<nOfQ<<G4endl;
4269 #endif
4270  if(kMin>kMax||nOfQ==2) return kMax;
4271  G4int n=nOfQ-2; // At this point n>0
4272  G4double fn=n;
4273  G4int dn=n;
4274  G4double vRndm = G4UniformRand();
4275  // *** Equation to be solved is R=(1-x)**n*(1+n*x)=n*(n+1)*INT_x^1[z*(1-z)**(n-1)*dz]
4276  // This equation doesn't take into account the reduction of the hadronization probability
4277  if (kMin>0.) // ==> There is a minimum cut for the QuarkPartonMomentum
4278  {
4279  G4double xMin=kMin/kLim; // Minimal value for "x"
4280  if (kMax>=kLim) vRndm = vRndm*pow((1.-xMin),n)*(1.+n*xMin); // "xMin - 1." Range
4281  else
4282  {
4283  G4double xMax=kMax/kLim;
4284  G4double vRmin = pow((1.-xMin),n)*(1.+n*xMin);
4285  G4double vRmax = pow((1.-xMax),n)*(1.+n*xMax);
4286  vRndm = vRmax + vRndm*(vRmin-vRmax); // Randomization in the "xMin - xMax" Range
4287  }
4288  }
4289  else if (kMax<kLim)
4290  {
4291  G4double xMax=kMax/kLim; // Maximum value for "x"
4292  G4double vRmax = pow((1.-xMax),n)*(1.+n*xMax);
4293  vRndm = vRmax + vRndm*(1.-vRmax);
4294  }
4295  if (vRndm<=0. || vRndm>1.)
4296  {
4297  //G4cout<<"-Warning-G4Quasmon::GetQPM: R="<<vRndm<<",kMi="<<kMin<<",kMa="<<kMax
4298  // <<",kLi="<<kLim<<G4endl;
4299  if(vRndm<=0.) vRndm=1.e-9;
4300  else if(vRndm>1.) vRndm=1.;
4301  }
4302  if (n==1) return kLim*sqrt(1.-vRndm); // Direct solution for nOfQ==3
4303  else // Needs iterations
4304  {
4305  G4double x = 1.-pow(vRndm*(1+n*vRndm)/(fn+1.),1./fn);// First Guess for the Solution
4306  G4double ox = x; // The old (previous) guess is the same
4307  G4int it = 0; // The number of iteration made
4308  G4double d = 1.; // Prototype of the Residual Difference
4309  G4double df = 1./static_cast<double>(nOfQ); // 1/N for the reverse operations
4310  G4double f = df*(static_cast<int>(nOfQ*nOfQ*n*x/5.)+(nOfQ/2)); // OptimalStepFactor
4311  G4double xMin=.0001;
4312  G4double xMax=.9999;
4313  if(kLim>0)
4314  {
4315  xMin=kMin/kLim;
4316  xMax=kMax/kLim;
4317  }
4318  if(f>27.)
4319  {
4320 #ifdef debug
4321  G4cout<<"G4Q::GetQPMom: f="<<f<<" is changed to 99"<<G4endl;
4322 #endif
4323  f = 27.;
4324  }
4325  if(x<1.e-27) x=1.e-27;
4326  else if(x>.999999999) x=.999999999;
4327  G4double r = 1.-x;
4328  G4double p = r;
4329  if (n>2) p = pow(r,n-1); // (1-x)**(n-1)
4330  G4double nx = n*x;
4331  G4double c = p*r*(1.+nx); // vRndm=(1-x)**n*(1+n*x) is the equation too be solved
4332  G4double od = c - vRndm; // the old Residual Difference
4333 #ifdef debug
4334  G4cout<<"G4Q::GetQPMom:--->> First x="<<x<<", n="<<n<<", f="<<f<<", d/R(first)="
4335  <<od/vRndm<<G4endl;
4336 #endif
4337  G4int nitMax=dn+dn; // Maximum number of iterations is defined by the power (n)
4338  if(nitMax>100)nitMax=100; // But it is limited by 100
4339  while( abs(d/vRndm) > 0.001 && it <= nitMax) // Solve the equation by Newton method
4340  {
4341  x = x + f*od/(r*nx*(fn+1.)); // Calculate the new x value
4342  if(x<1.e-27) x=1.e-27;
4343  else if(x>.999999999) x=.999999999;
4344  r = 1.-x;
4345  if (n>2) p = pow(r,n-1);
4346  else p = r;
4347  nx = n*x;
4348  c = p*r*(1.+nx);
4349  d = c - vRndm;
4350  if ((od>0&&d<0)||(od<0&&d>0)) // ==> Overplay
4351  {
4352  if (f>1.0001) f=1.+(f-1.)/2.; // Modify the OptimalStepFactor for the overplay
4353  if (f<0.9999) f=1.+(1.-f)*2;
4354  x = (x + ox)/2.; // Make an intermediate change of "x"
4355  if(x<1.e-27) x=1.e-27;
4356  else if(x>.999999999) x=.999999999;
4357  r = 1.-x;
4358  if (n>2) p = pow(r,n-1);
4359  else p = r;
4360  nx = n*x;
4361  c = p*r*(1.+nx);
4362  d = c - vRndm;
4363  }
4364  else
4365  {
4366  if (f>1.0001&&f<27.) f=1.+(f-1.)*2; // Make a regular correction of OptStepFactor
4367  if (f<0.99999999999) f=1.+(1.-f)/2.;
4368  if (f>=27.) f=27.;
4369  }
4370 #ifdef debug
4371  G4cout<<"G4Q::GetQPMom: Iter#"<<it<<": (c="<<c<<" - R="<<vRndm<<")/R ="<<d/vRndm
4372  <<", x="<<x<<", f="<<f<<G4endl;
4373 #endif
4374  if(x>xMax) x=xMax;
4375  if(x<xMin) x=xMin;
4376  if(fabs(d)>fabs(od) && n>99 && x!=xMin && x!=xMax)
4377  {
4378  x=ox;
4379  break;
4380  }
4381  od = d;
4382  ox = x;
4383  it++;
4384  }
4385 #ifdef debug
4386  if(it>nitMax) G4cout<<"G4Q::GetQPMom: a#of iterations > nitMax="<<nitMax<<G4endl;
4387 #endif
4388  if(x>xMax) x=xMax;
4389  if(x<xMin) x=xMin;
4390  G4double kCand=kLim*x;
4391  if(kCand>=kMax)kCand=kMax-.001;
4392  if(kCand<=kMin)kCand=kMin+.001;
4393  return kCand;
4394  }
4395  // ********** Possible Performance Improvement (corrupt physics!) **********
4396  // This is a simplified algorithm, which takes an empirical reduction 1/k of HadrProbab
4397  // As a result the equation to be solved is just R=(1-x)**n=n*INT_x^1[(1-z)**(n-1)*dz]
4398  //if (kMin>0.) // ==> There is a minimum cut for the QuarkPartonMomentum
4399  //{
4400  // G4double xMin=kMin/kLim; // Minimal value for "x"
4401  // if (kMax>=kLim) vRndm = vRndm*pow((1.-xMin),n); // Shrink to the "xMin - 1." Range
4402  // else
4403  // {
4404  // G4double xMax=kMax/kLim; // Maximum value for "x"
4405  // G4double vRmin = pow((1.-xMin),n);
4406  // G4double vRmax = pow((1.-xMax),n);
4407  // vRndm = vRmax + vRndm*(vRmin-vRmax); // Randomization in the "xMin - xMax" Range
4408  // }
4409  //}
4410  //else if (kMax<kLim) // ==> at this point kMin<=0 -> kMin=0
4411  //{
4412  // G4double xMax=kMax/kLim; // Maximum value for "x"
4413  // G4double vRmax = pow((1.-xMax),n)*(1.+n*xMax);
4414  // vRndm = vRmax + vRndm*(1.-vRmax); // Shrink to the "0 - xMax" Range
4415  //}
4417  //if (n==1) return kLim*(1.-vRndm); // Direct solution for nOfQ==3
4418  //else if (n==2) return kLim*(1.-sqrt(vRndm)); // Direct solution for nOfQ==4
4419  //else return kLim*(1.-pow(vRndm,1./fn)); // Direct solution for nOfQ>4
4420 } // End of "GetQPartonMomentum"
4421 
4422 // For the given quasmon mass calculate a number of quark-partons in the system
4424 {
4425  static const G4double mK0 = G4QPDGCode(311).GetMass();
4426  // @@ Temporary here. To have 3 quarks in Nucleon Temperature should be < M_N/4 (234 MeV)
4427  // M^2=4*n*(n-1)*T^2 => n = M/2T + 1/2 + T/4M + o(T^3/16M^3)
4428  // @@ Genius (better than 10**(-3) even for n=2!) but useless
4429  //G4double qMOver2T = qMass/(Temperature+Temperature);
4430  //G4double est = qMOver2T+1.+0.125/qMOver2T;
4431  // @@ Longer but exact
4432  G4double qMOverT = qMass/Temperature;
4433  G4int valc = valQ.GetTot();
4434  // .................................
4435  // --- Exponent, Double Split, Poisson 1 ----------------
4441  // --- Uncomment up to here =-----------=^^^^^^^^^
4442  // Exponent ------
4443  //else nOfQ=mq-2*mean*log(G4UniformRand());
4444  // Poisson 1 ------
4446  // Double Split ------
4447  //else
4448  //{
4449  // G4int imean = static_cast<int>(mean);
4450  // G4double dm = mean - imean;
4451  // if(G4UniformRand()>dm) nOfQ=mq+imean+imean;
4452  // else nOfQ=mq+imean+imean+2;
4453  //}
4454  // .........
4455  // Poisson 2 =-----------=
4456  //if(valc%2==0)nOfQ = 2*RandomPoisson((1.+sqrt(1.+qMOverT*qMOverT))/4.);// abs(b) is even
4457  //else nOfQ = 1+2*RandomPoisson((1.+sqrt(1.+qMOverT*qMOverT))/4.-0.5);// abs(b) is odd
4458  // Poisson 3 =-----------=
4459  nOfQ = RandomPoisson((1.+sqrt(1.+qMOverT*qMOverT))/2.);
4460  G4int ev = valc%2;
4461  if (!ev && nOfQ<2) nOfQ=2; // #of valence quarks is even
4462  else if ( ev && nOfQ<3) nOfQ=3; // #of valence quarks is odd
4463  //
4464 #ifdef debug
4465  G4cout<<"G4Q::Calc#ofQP:QM="<<q4Mom<<qMass<<",T="<<Temperature<<",QC="<<valQ<<",n="<<nOfQ
4466  <<G4endl;
4467 #endif
4468  G4int absb = abs(valQ.GetBaryonNumber());
4469  G4int tabn = 0;
4470  if(absb)tabn=3*absb; // Minimal QC for baryonic system fragmentation
4471  else tabn=4; // Minimal QC for mesonic system fragmentation (@@ ?)
4472  if (nOfQ<tabn) nOfQ=tabn;
4473  G4int nSeaPairs = (nOfQ-valc)/2;
4474  G4int stran = abs(valQ.GetS());
4475  G4int astra = abs(valQ.GetAS());
4476  if(astra>stran) stran=astra;
4477  G4int nMaxStrangeSea=static_cast<int>((qMass-stran*mK0)/(mK0+mK0));//KK is min for s-sea
4478  if (absb) nMaxStrangeSea=static_cast<int>((qMass-absb)/672.); //LambdaK is min for s-sea
4479 #ifdef debug
4480  G4cout<<"G4Q::Calc#ofQP:"<<valQ<<",INtot="<<valc<<",nOfQ="<<nOfQ<<",SeaPairs="<<nSeaPairs
4481  <<G4endl;
4482 #endif
4483  if (nSeaPairs) // Add/subtract sea pairs to/from initial quark content
4484  {
4485 #ifdef debug
4486  G4int morDec=0;
4487 #endif
4488  if(nSeaPairs>0)valQ.IncQAQ(nSeaPairs,SSin2Gluons);
4489 #ifdef debug
4490  else morDec=valQ.DecQAQ(-nSeaPairs);
4491  if(morDec) G4cout<<"G4Q::Calc#ofQP: "<<morDec<<" pairs can be reduced more"<<G4endl;
4492 #endif
4493  G4int sSea=valQ.GetS(); // Content of strange quarks
4494  G4int asSea=valQ.GetAS();
4495  if(asSea<sSea) sSea=asSea;
4496  if(sSea>nMaxStrangeSea) // @@@@@@@ Too many strange sea ??????
4497  {
4498 #ifdef debug
4499  G4cout<<"G4Q::Calc#ofQP:**Reduce** S="<<sSea<<",aS="<<asSea<<",maxS="<<nMaxStrangeSea
4500  <<G4endl;
4501 #endif
4502  sSea-=nMaxStrangeSea; // Strange sea excess
4503  valQ.DecS(sSea); // Reduce strange sea to adoptable limit
4504  valQ.DecAS(sSea);
4505  valQ.IncQAQ(sSea,0.); // Add notstrange sea ????????
4506  }
4507  }
4508  // @@ Chocolate rule --- Temporary (?)
4509  //G4int nmin = valc+valc-2; // Chocolate
4510  //G4int nmin = valc+absb; // String Junction
4511  //if(nOfQ<nmin) nOfQ=nmin;
4512  // --- End of Temporary
4513 #ifdef debug
4514  G4cout<<"G4Quasmon::Calc#ofQP: *** RESULT IN*** nQ="<<nOfQ<<", FinalQC="<<valQ<<G4endl;
4515 #endif
4516  return nOfQ;
4517 } // End of "CalculateNumberOfQPartons"
4518 
4519 // Modify Candidate masses in nuclear matter and set possibilities
4520 void G4Quasmon::ModifyInMatterCandidates()
4521 {
4523  G4double envM = theEnvironment.GetMass(); // Mass of the Current Environment
4524  G4QContent envQC=theEnvironment.GetQCZNS(); // QuarkContent of theCurrentNuclearEnviron.
4525  G4int eP = theEnvironment.GetZ(); // A#of protons in the Current Environment
4526  G4int eN = theEnvironment.GetN(); // A#of neutrons in the Current Environment
4527  G4int eL = theEnvironment.GetS(); // A#of lambdas in the Current Environment
4528  G4QContent totQC=theEnvironment.GetQC()+valQ;// Total Quark Comtent of the system
4529  G4int tP = totQC.GetP(); // A#of protons in the Current Environment
4530  G4int tN = totQC.GetN(); // A#of neutrons in the Current Environment
4531  G4int tL = totQC.GetL(); // A#of lambdas in the Current Environment
4532  G4double totM=G4QNucleus(totQC).GetMZNS(); // Mass of total system
4533  for (unsigned ind=0; ind<theQCandidates.size(); ind++)
4534  {
4535  G4QCandidate* curCand=theQCandidates[ind]; // Pointer to the Candidate
4536  G4int cPDG = curCand->GetPDGCode(); // PDGC of the Candidate
4537  G4bool poss = curCand->GetPossibility(); // Possibility for the Candidate
4538  G4QContent tmpTQ=totQC-curCand->GetQC();
4539  G4QNucleus tmpT(tmpTQ); // Nucleus for TotResidNucleus for Fragment
4540  G4double tmpTM=tmpT.GetMZNS(); // GSMass of TotalResidNucleus for Fragment
4541  G4QPDGCode cQPDG(cPDG); // QPDG for the candidate
4542  G4double frM=cQPDG.GetMass(); // Vacuum mass of the candidate
4543  if(cPDG>80000000&&cPDG!=90000000) // Modify Fragments toTakeIntoAccount CurNuc
4544  {
4545  if(totMass<tmpTM+frM)
4546  {
4547 #ifdef sdebug
4548  G4cout<<"G4Q::ModInMatCand:C="<<cPDG<<tmpT<<tmpTM<<"+"<<frM<<"="<<tmpTM+frM<<">tM="
4549  <<totMass<<G4endl;
4550 #endif
4551  curCand->SetPossibility(false);
4552  }
4553  G4QNucleus cNuc(cPDG); // Fake nucleus for the Candidate
4554  G4int cP = cNuc.GetZ(); // A#of protons in the Current Environment
4555  G4int cN = cNuc.GetN(); // A#of neutrons in the Current Environment
4556  G4int cL = cNuc.GetS(); // A#of lambdas in the Current Environment
4557  //G4QPDGCode cQPDG(cPDG); // QPDG of the Current Cluster
4558 #ifdef debug
4559  if(cPDG==90001000) G4cout<<"G4Q::MIM:->>cPDG=90001000<<-,possibility="<<poss<<G4endl;
4560 #endif
4561  if(eP>=cP&&eN>=cN&&eL>=cL&&poss) // Cluster exists & possible
4562  {
4563  G4double clME = 0.; // Prototype of the BoundClMass in Environ
4564  G4double clMN = 0.; // Prototype of the BoundClMass in TotNucl
4565  G4double renvM = 0; // Prototype of the residual Environ mass
4566  if(cP==eP&&cN==eN&&cL==eL)clME=cQPDG.GetMass();// The only notBoundCluster of Envir
4567  else // Bound Cluster in the Environment
4568  {
4569  renvM = cQPDG.GetNuclMass(eP-cP,eN-cN,eL-cL); // Mass of residual for Environment
4570  clME = envM-renvM;
4571  }
4572  if(cP==tP&&cN==tN&&cL==tL)clMN=cQPDG.GetMass(); // The only NotBoundCluster of TotN
4573  else // Bound Cluster in Total Nucleus
4574  {
4575  renvM = cQPDG.GetNuclMass(tP-cP,tN-cN,tL-cL); // TotalResidualNucleus Mass
4576  clMN = totM-renvM;
4577  }
4578  curCand->SetParPossibility(true);
4579  curCand->SetEBMass(clME);
4580  curCand->SetNBMass(clMN);
4581 #ifdef sdebug
4582  G4int envPDGC = theEnvironment.GetPDGCode(); // PDG Code of Current Environment
4583  G4cout<<"G4Q:ModInMatCand:C="<<cPDG<<cNuc<<clME<<","<<clMN<<",E="<<envPDGC<<",M="
4584  <<renvM<<G4endl;
4585 #endif
4586  }
4587  else curCand->SetParPossibility(false);
4588  } // @@ Modification of hadron masses in nuclear matter are not implemented yet
4589  }
4590 } // End of "ModifyInMatterCandidates"
4591 
4592 // Randomize the Resonance masses and calculate probabilities of hadronization for them
4593 void G4Quasmon::CalculateHadronizationProbabilities
4594  (G4double E, G4double kVal, G4LorentzVector k4M,G4bool piF, G4bool gaF, G4bool )
4595  //(G4double E, G4double kVal, G4LorentzVector k4M,G4bool piF, G4bool gaF, G4bool first)
4596 { // ^
4597  static const G4double mPi0 = G4QPDGCode(111).GetMass(); // |
4599  G4double kLS=E; // |
4600  kLS=k4M.e(); // Temporary trick to avoid worning
4601  G4int vap = nOfQ-3; // Vacuum power
4602  //G4double kLSi= kLS; // Initial (without photon) kLS
4603  //if(addPhoton) kLSi=kLS-addPhoton; // @@ probabilities for k+gam can be wrong
4604  G4double mQ2 = q4Mom.m2(); // Squared Mass of the Quasmon
4605  G4double eQ = q4Mom.e(); // LS Energy of the Quasmon
4606  G4double mQ = sqrt(mQ2); // Mass of the decaying Quasmon
4607  G4double dk = kVal + kVal; // Double momentu of quark-parton in QCM
4608  G4double rQ2 = mQ2-dk*mQ; // Min Residual Colored Quasmon Squared Mass
4610  G4double mQk = mQ-dk; // For acceleration
4611  G4double var = theEnvironment.GetProbability();// Vacuum to medium ratio
4612  G4double vaf = 0; //@@ !! Vacuum factor
4613  if(vap>0)vaf = var*mQk/kVal/vap; //@@
4614  //if(vap>0)vaf = mQk/kVal/vap; //@@ VacuumFactor(instead of in G4QNucleus)
4615  G4double accumulatedProbability = 0.;
4616  G4double secondAccumProbability = 0.;
4617  G4int qBar =valQ.GetBaryonNumber(); // BaryNum of Quasmon
4618  G4int nofU = valQ.GetU()- valQ.GetAU(); // A#of u-quarks
4619  G4int dofU = nofU+nofU;
4620  G4int nofD = valQ.GetD()- valQ.GetAD(); // A#of d-quarks
4621  G4int dofD = nofD+nofD;
4622  G4int qChg = valQ.GetCharge();
4623  G4int qIso = qBar-qChg-qChg; // Charge of Quasmon
4626  G4int maxC = theQCandidates.size(); // A#of candidates
4627  G4double totZ = theEnvironment.GetZ() + valQ.GetCharge(); // Z of the Nucleus
4629  G4double envM = theEnvironment.GetMass(); // Mass of the Current Environment
4630  G4int envPDGC = theEnvironment.GetPDGCode();// PDG Code of Current Environment
4631  G4int envN = theEnvironment.GetN(); // N of current Nuclear Environment
4632  G4int envZ = theEnvironment.GetZ(); // Z of current Nuclear Environment
4634  G4int envA = theEnvironment.GetA(); // A of current Nuclear Environment
4635  G4QContent envQC=theEnvironment.GetQCZNS(); // QuarkContent of the CurrentNuclearEnviron.
4637 #ifdef debug
4638  G4int absb = abs(qBar); // Abs BaryNum of Quasmon
4639  G4int maxB = theEnvironment.GetMaxClust(); // Maximum BaryNum for clusters
4640  G4cout<<"G4Q::CalcHadronizationProbab:Q="<<mQ<<valQ<<",v="<<vaf<<",r="<<var<<",mC="<<maxB
4641  <<",vap="<<vap<<",k="<<kVal<<G4endl;
4642 #endif
4643  // =------------= Calculate probabilities for candidates
4644  unsigned nHC=theQCandidates.size();
4645 #ifdef debug
4646  G4cout<<"G4Q::CHP: *** nHC="<<nHC<<G4endl;
4647 #endif
4648  if(nHC) for (unsigned index=0; index<nHC; index++)
4649  {
4650  G4QCandidate* curCand=theQCandidates[index];
4651  G4int cPDG = curCand->GetPDGCode();
4652  G4int aPDG = abs(cPDG);
4653  curCand->ClearParClustVector(); // Clear ParentClusterVector for the Fragment
4654  G4double probability = 0.;
4655  G4double secondProbab = 0.;
4656  if ( (aPDG > 80000000 && envA > 0) || aPDG < 80000000)
4657  {
4658  G4int resPDG=0;
4659  G4double comb=0.; // Combinatorial factor for quark exchange
4660  G4QContent candQC = curCand->GetQC();
4661  G4QContent tmpTQ=envQC+valQ-candQC; // QC of TotalResidualNucleus for the Cluster
4662  G4QNucleus tmpT(tmpTQ); // Nucleus of TotalResidNucleus for Fragment
4663  G4double tmpTM=tmpT.GetMZNS(); // GSM of Total ResidualNucleus for Fragment
4664  G4QPDGCode cQPDG(cPDG); // QPDG for the candidate
4665  G4double frM=cQPDG.GetMass(); // Vacuum mass of the candidate
4666  G4int cU=candQC.GetU()-candQC.GetAU();
4668  G4int cD=candQC.GetD()-candQC.GetAD();
4670  G4int dUD=abs(cU-cD);
4672  G4bool pos=curCand->GetPossibility()&&totMass>tmpTM+frM;
4673  //G4bool pos=curCand->GetPossibility();
4674 #ifdef pdebug
4675  G4bool pPrint= (abs(cPDG)%10 <3 && cPDG <80000000) || (cPDG >80000000 && frM <5000.);
4676  //G4bool pPrint = abs(cPDG)%10<3 && cPDG<80000000 ||cPDG==90001000||cPDG==90000001||
4677  // cPDG==90000002||cPDG==90001001||cPDG==90001002||cPDG==90002001||cPDG==90002002;
4678  //G4bool pPrint = cPDG==2212 || cPDG==2112 ||cPDG==90001000||cPDG==90000001;
4679  //G4bool pPrint = false;
4680  //G4bool pPrint = true;
4681  if(pPrint) G4cout<<"G4Q::CHP:==****==>> c="<<cPDG<<",dUD="<<dUD<<",pos="<<pos<<",eA="
4682  <<envA<<",tM="<<totMass<<" > tmpTM+frM="<<tmpTM+frM<<G4endl;
4683 #endif
4684  //if(pos&&(cPDG<80000000||(cPDG>80000000&&cPDG!=90000000&&dUD<1)))// 1 ** never try
4685  if(pos&&(cPDG<80000000||(cPDG>80000000&&cPDG!=90000000&&dUD<2)))//2 ***The best***
4686  //if(pos&&(cPDG<80000000||(cPDG>80000000&&cPDG!=90000000&&dUD<3))) // 3 *** good ***
4687  //if(pos&&(cPDG<80000000||(cPDG>80000000&&cPDG!=90000000&&dUD<4)))//4 almost the same
4688  //if(pos&&(cPDG<80000000||(cPDG>80000000&&cPDG!=90000000))) // no restrictions
4689  {
4690  G4QContent curQ = valQ; // Make current copy of theQuasmonQuarkCont
4691  G4int baryn= candQC.GetBaryonNumber(); // Baryon number of the Candidate
4692  G4int cC = candQC.GetCharge(); // Charge of the Candidate
4693  G4double CB=0.;
4694  if(envA) CB=theEnvironment.CoulombBarrier(cC,baryn);
4696  //G4int cNQ= candQC.GetTot()-1-baryn; // A#of quarks/diquarksInTheCandidate - 2
4697  G4int cNQ= candQC.GetTot()-2; // #of quark-partonsInTheCandidate - 2 (OK)
4698  //G4int cNQ= candQC.GetTot()+baryn-2; // A#of q-partons+b_Sj-2 (string junction)
4699  //G4int cNQ= candQC.GetTot()+3*baryn-4; // A#of q-partons+b+2*(b-1)-2 (choc q-link)
4700  G4double resM=0.; // Prototype for minMass of residual hadron
4701 #ifdef debug
4702  if(pPrint)G4cout<<"G4Q::CHP:B="<<baryn<<",C="<<cC<<",CB="<<CB<<",#q="<<cNQ<<G4endl;
4703 #endif
4704  if(cPDG>80000000&&cPDG!=90000000&&baryn<=envA)//==>Nuclear Fragment (QUarkEXchange)
4705  {
4706  G4int parentCounter=0; // Parent counter counter
4707  G4double pcomb=0.; // Summed probability of parent clusters
4708  G4double frM2=frM*frM; // Squared mass of the nuclear fragment
4709  G4double qMax=frM+CB-kLS; // ParClustM-qmax value (k-q>frM-prM+CB)
4710  //G4double qMax=frM-kLS; // ParClustM-qmax value(k-q>frM-prM+<noCB>)
4712  G4int iQmin=0; // IncomingToCluster quarks are d=0,u=1,s=2
4713  G4int iQmax=3; // 3 is bigger than s-quark (2, iq<3)
4714  G4int oQmin=0; // Returning from cluster quarks: d=0,u=1
4715  G4int oQmax=2; // 2 is bigger than u-quark (1, oq<2) @@ 3?
4716  if (dofU<=nofD) iQmax=1; // Too many Dquarks (in-Uquark is forbiden)
4717  else if(dofD<=nofU) iQmin=1; // Too many Uquarks (in-Dquark is forbiden)
4718  // @@ This is how netrons are increased for the pion capture at rest case @@
4719  if(piF) // force Pi- transfer its charge to a quark
4720  {
4721  iQmin=0;
4722  iQmax=1;
4723  }
4724 #ifdef debug
4725  if(pPrint)G4cout<<"G4Q::CHP:***!!!***>>F="<<cPDG<<",mF="<<frM<<",iq:"<<iQmin<<","
4726  <<iQmax<<",kLS="<<kLS<<",kQCM="<<kVal<<",eA="<<envA<<G4endl;
4727 #endif
4728  if(iQmax>iQmin) for(int iq=iQmin; iq<iQmax; iq++) // Entering (fromQuasmon) quark
4729  {
4730  G4double qFact=1.;
4731  //if(iq==1&&addPhoton>0.) qFact=4.; // @@ taftology
4732  if(iq==1&&gaF)
4733  {
4734  qFact=4.;
4735 #ifdef debug
4736  if(pPrint) G4cout<<"G4Q::CHP:photon cap(gaF) is enhanced for Uquark"<<G4endl;
4737 #endif
4738  }
4739  G4double nqInQ=0.; // A#of quarks of this sort in a Quasmon
4740  if (!iq) nqInQ=valQ.GetD();
4741  else if(iq==1) nqInQ=valQ.GetU();
4742  else if(iq==2) nqInQ=valQ.GetS();
4743  comb=0.; // Local summ for the i-quark of the Quasmon
4744 #ifdef sdebug
4745  G4cout<<"G4Q::CHP:i="<<iq<<",cU="<<cU<<",cD="<<cD<<",omi="<<oQmin<<",oma="
4746  <<oQmax<<G4endl;
4747 #endif
4748  if(oQmax>oQmin) for(int oq=oQmin; oq<oQmax; oq++) // Exiting (to Quasmon) quark
4749  {
4750  G4int shift= cQPDG.GetRelCrossIndex(iq, oq);
4751  G4QContent ioQC=cQPDG.GetExQContent(iq, oq);
4752  G4QContent resQC=valQ+ioQC; // Quark Content of the residual Quasmon
4753 #ifdef sdebug
4754  G4cout<<"G4Q::CHP:iq="<<iq<<",oq="<<oq<<",QC="<<ioQC<<",rQC="<<resQC<<G4endl;
4755 #endif
4756  G4QPDGCode resQPDG(resQC); // QPDG of the residual Quasmon
4757  resPDG=resQPDG.GetPDGCode(); // PDG Code of the residual Quasmon
4758  G4int resQ=resQPDG.GetQCode(); // Q Code of the residual Quasmon
4759 #ifdef pdebug
4760  if(pPrint) G4cout<<"G4Q::CHP:i="<<iq<<",o="<<oq<<ioQC<<",s="<<shift
4761  <<",cQPDG="<<cQPDG<<", residQC="<<resQC<<resQPDG<<G4endl;
4762 #endif
4763  G4int resD=resQC.GetD()-resQC.GetAD();
4764  G4int resU=resQC.GetU()-resQC.GetAU();
4765  G4int resS=resQC.GetS()-resQC.GetAS();
4766  G4int resA=resQC.GetBaryonNumber();
4767  G4bool rI=resA>0 && resU>=0 && resD>=0 &&
4768  (resU+resS>resD+resD||resD+resS>resU+resU);
4769  //if(resQ>-2&&resPDG&&resPDG!=10&&!rI)// The Residual Quasmon is possible
4770  //if(resQ>-2&&resPDG&&resPDG!=10&&!rI&&!piF) // *** Never try this
4771  //if(resQ>-2&&resPDG&&resPDG!=10&&!rI&&(!piF||cPDG==90000001))
4772  //G4cout<<"G4Q::CHP:PiF="<<piF<<G4endl;
4773  // The best:
4774  //if(resQ>-2 &&resPDG && resPDG!=10 && !rI && (!piF||piF && cPDG!=90001000 ))
4775  if (resQ > -2 && resPDG && resPDG != 10 && !rI &&
4776  (!piF || ( piF && (cPDG != 90001000 || G4UniformRand() < .333333) &&
4777  cPDG != 90002001 && cPDG != 90002002
4778  )
4779  )
4780  )
4781  //cPDG!=90001000||G4UniformRand()<.333333))
4782  //(cPDG!=90001000||G4UniformRand()<.5)&&cPDG!=90002001&&cPDG!=90002002))
4783  //cPDG!=90001000&&cPDG!=90002001&&cPDG!=90002002))
4784  //-----------------------------------------------------------------
4785  //if(resQ>-2 && resPDG && resPDG!=10 && !rI && (!piF||piF&&baryn>1))
4786  //if(resQ>-2 && resPDG && resPDG!=10 && !rI) // baryons are too energetic
4787  //if(resQ>-2&&resPDG&&resPDG!=10&&!rI&&(!piF||baryn==1)) // bad
4788  {
4789  G4int is=index+shift;
4790  if(shift!=7&&is<maxC) // This quark exchange is possible
4791  {
4792  G4QCandidate* parCand=theQCandidates[is];//Pointer to ParentClusterOfCand
4793  G4QContent parQC = parCand->GetQC(); // QuarkCont of theParentCluster
4794  G4int barot = parQC.GetBaryonNumber(); // Bary Number of Parent Cluster
4795  G4int charge= parQC.GetCharge(); // Charge of the Parent Cluster
4796  G4int possib=parCand->GetParPossibility();
4797 #ifdef pdebug
4798  if(pPrint) G4cout<<"G4Q::CHP:parentPossibility="<<possib<<",pZ="<<charge
4799  <<" <= envZ="<<envZ<<", pN="<<barot-charge<<" <= envN="
4800  <<envN<<", cPDG="<<cPDG<<G4endl;
4801 #endif
4802  if(possib && charge<=envZ && barot-charge<=envN)
4803  {
4804  //G4QContent rQQC = valQ+ioQC; // Quark Content of Residual Quasmon
4807  G4int isos = barot-charge-charge; // Isospin of the Parent Cluster
4808  // MKG -- beg
4809  //#ifdef debug
4810  G4double pUD= 1.;
4811  if(barot>2) pUD= pow(2.,abs(isos)-1);
4812  //#endif
4813  // MKG -- end
4814  if(barot!=baryn) G4cerr<<"--Warning--G4Q::CHP:c="<<candQC<<",p="<<parQC
4815  <<",s="<<shift<<",i="<<index<<",s="<<is<<G4endl;
4816  G4int dI=qIso-isos; // IsotopicShiftDifference for ParC & Quasm
4817  G4int dC=cC-charge; // ChargeDifference for outFragm & ParentCl
4818  G4int dS=dI+dC; // Isotop Symmetry Compensation Parameter
4819 #ifdef pdebug
4820  if(pPrint)G4cout<<"G4Q::CHP: dS="<<dS<<", dI="<<dI<<", dC="<<dC<<", I="
4821  <<qIso<<",i="<<isos<<", C="<<cC<<",c="<<charge<<G4endl;
4822 #endif
4823  //********* ISOTOPIC FOCUSING *******************
4824  // =--= Old (First Publication) Complicated rule =--=
4825  //if(
4826  // //zZ<3 &&
4827  // //(
4828  // abs(dI)<1 ||
4829  // (barot==1 && (
4830  // abs(dI)<2&&abs(cC-charge)<2 ||
4831  // (dI>=2&&cC<charge) || (dI<=-2&&cC>charge)
4832  // //dI==2&&cC<=charge || dI==-2&&cC>=charge ||
4833  // //dI>2&&cC<charge || dI<-2&&cC>charge
4834  // )) ||
4835  // (barot>1&&barot<3
4836  // && (
4837  // abs(dI)<2&&abs(cC-charge)<2 ||
4838  // //dI>=2&&cC<charge || dI<=-2&&cC>charge
4839  // dI<=2&&cC<=charge || dI==-2&&cC>=charge ||
4840  // dI>2&&cC<charge || dI<-2&&cC>charge
4841  // )) ||
4842  // (barot>2&&barot<4
4843  // && (
4844  // abs(dI)<2&&abs(cC-charge)<2 ||
4845  // //dI>=2&&cC<charge || dI<=-2&&cC>charge
4846  // dI<=2&&cC<=charge || dI==-3&&cC>=charge ||
4847  // dI>2&&cC<charge || dI<-3&&cC>charge
4848  // )) ||
4849  // (barot>3
4850  // && (
4851  // abs(dI)<2&&abs(cC-charge)<2 ||
4852  // dI>=2&&cC<charge || dI<=-2&&cC>charge
4853  // //dI<=2&&cC<=charge || dI==-3&&cC>=charge ||
4854  // //dI>2&&cC<charge || dI<-3&&cC>charge
4855  // )
4856  // )
4857  // )
4858  // =--= Just a coridor =--=
4859  //if(abs(dS)<3||(qIso>0&&dC<0||qIso<0&&dC>0)&&baryn==1)//StrForB=1(old)
4860  //if(abs(dS)<4||(qIso>0&&dC<0||qIso<0&&dC>0)&&baryn==1)//StrongFor1(<4)
4861  //if(baryn>1||abs(dS)<4||(qIso>0&&dC<0||qIso<0&&dC>0)&&baryn==1)//SIFF1
4862  //if(!piF&&abs(dS)<4 || piF&&abs(dS)<3) // UniversalIsoFocusing
4863  //if(!piF&&first&&abs(dS)<4 || (!piF&&!first||piF)&&abs(dS)<3)//ExpIsoF
4864  // *** Recent correction (****
4865  //if ( (!piF && first && baryn < 3) ||
4866  // (!piF && !first) ||
4869  if ( (!piF && baryn < 5 ) ||
4870  ( piF && abs(dS) < 3) ) // Isotope Focusing for AtRest Reactions
4871  //if(!qIso&&!dC||qIso>0&&dC<0||qIso<0&&dC>0)//MediumIsoFocusingForAll
4872  //if(abs(dS)<3) // Universal IsotopeFocusing(<3) (Best for pi-capture)
4873  //if(abs(dS)<4) // Never try this (**)
4874  //if(3>2) //****>> ***NO*** Isotope Focusing ***
4875  {
4876  G4double pPP=parCand->GetPreProbability(); // Probab of ParentCluster
4877  //G4double pPP=parCand->GetDenseProbability();//Probab of ParentClust
4878  G4int parPDG=parCand->GetPDGCode(); // PDGCode of theParentClucter
4879  G4double boundM=parCand->GetEBMass();//EnvironBoundMass ofParentClust
4880  G4double nucBM =parCand->GetNBMass();//TotNuclBoundMass ofParentClust
4881 #ifdef debug
4882  if(pPrint) G4cout<<"G4Q::CHP:c="<<cPDG<<",p="<<parPDG<<",bM="<<boundM
4883  <<",i="<<is<<",adr="<<parCand<<",pPP="<<pPP<<G4endl;
4884 #endif
4885  // Kinematical analysis of decay possibility
4886  G4double minM =0.; // Prototype of minM of ResidQuasm
4887  if (resPDG==10)minM=G4QChipolino(resQC).GetMass();//ResidQuasmonChipo
4888  else if(resPDG)minM=G4QPDGCode(resPDG).GetMass();//ResidQuasmonHadron
4889  G4double bNM2=nucBM*nucBM;
4890  G4double nDelta=0.;
4891  if(nucBM)nDelta=(frM2-bNM2)/(nucBM+nucBM); // Safety check
4892 #ifdef pdebug
4893  G4int iniPDG =valQ.GetSPDGCode();
4894  G4double iniQM = G4QPDGCode(iniPDG).GetMass();//Not boundedQuasmonGSM
4895  G4double freeE = (mQ-iniQM)*iniQM;
4896  G4double kCut=boundM/2.+freeE/(iniQM+boundM);
4897  if(pPrint)G4cout<<"G4Q::CHP:r="<<resPDG<<",M="<<minM<<",k="<<kLS<<"<"
4898  <<kCut<<",E="<<E<<">"<<nDelta<<",p="<<parPDG<<G4endl;
4899 #endif
4900  if(resPDG && minM>0.) // Kinematical analysis of hadronization
4901  {
4902 #ifdef debug
4903  if(pPrint) G4cout<<"G4Q::CHP:fM="<<frM<<",bM="<<boundM<<",rM="
4904  <<tmpTM<<",tM="<<totMass<<G4endl;
4905 #endif
4906  G4double pmk=rMo*boundM/kLS;
4907  //G4double pmk=rMo*nucBM/kLS;
4908  G4double bM2=boundM*boundM;
4909  G4double eDelta=(frM2-bM2)/(boundM+boundM);
4910  G4double ked =kLS-eDelta;
4911  G4double dked=ked+ked;
4913  G4double kd =kLS-nDelta; //For TotalNucleus (includingQuasmon)
4914  G4double dkd=kd+kd;
4915  //G4double dkdC=dkd-CB-CB;
4916  G4double dkLS=kLS+kLS;
4917  //G4double Em=(E-eDelta)*(1.-frM/totMass);
4918  //G4double Em=(E-nDelta)*(1.-frM/totMass);
4919  G4double Em=(E-nDelta-CB)*(1.-frM/totMass);
4920  // *** START LIMITS ***
4921  G4double ne=1.-dked/(boundM+dkLS);// qmin=DEFOULT=bM*(k-de)/(bM+2k)
4922  G4double kf=1.;
4923  if(ne>0.&&ne<1.)kf=pow(ne,cNQ);
4924 #ifdef debug
4925  if(pPrint)G4cout<<"G4Q::CHP:<qi_DEF>="<<ne<<",k="<<kf<<",dk="<<dked
4926  <<",dkLS="<<dkLS<<",M="<<boundM<<",C="<<CB<<G4endl;
4927 #endif
4928  // == Prepare for the residual nucleus restriction ==
4929  // *** LIM ***
4930  G4QContent rtQC=valQ+ioQC; // Total Residual Quark Content
4931  if(envA-barot>bEn) rtQC+=bEnQC;
4932  else rtQC+=envQC-parQC; // Total Residual Quark Content
4933  G4QNucleus rtN(rtQC); // Create PseudoNucleus for totResid.
4934  G4double rtM=rtN.GetGSMass(); // MinMass of residQ+(Env-ParC) syst.
4935  G4double rtEP=rEP; // E+Mom of tRealTotColouredResidSyst
4936  // *** LIM ***
4937  if(envA-barot>bEn) rtEP+=mbEn;
4938  else rtEP+=envM-boundM;
4939  G4double rtE=rtEP-rMo; // Energy of RealTotColouredResidSyst
4941 #ifdef debug
4942  G4QContent tmpEQ=envQC-parQC;//QuarkContent for ResidualEnvironment
4943  if(pPrint) G4cout<<"G4Q::CHP:RN="<<tmpEQ<<"="<<envM-boundM<<"=eM="
4944  <<envM<<"-bM="<<boundM<<",E="<<rtE<<",eQC="<<envQC
4945  <<",pQC="<<parQC<<G4endl;
4946 #endif
4947  G4double mintM2=rtM*rtM+.1; //Mass of MinTotColouredResidualSyst.
4948  G4double rtQ2=rtE*rtE-rMo*rMo;//SquaredMinMass of ResidQ+(Env-ParC)
4949  // ***VBQ***
4950  G4double minBM=minM;
4951  //if(envM>boundM)
4952  if ( (envA-barot <= bEn && envM > boundM) || envA-barot > bEn)
4953  //if(2>3) // *** Recent correction ***
4954  {
4955  minBM=rtM;
4956  // *** LIM ***
4957  if(envA-barot > bEn) minBM-=mbEn;
4958  else minBM-=envM-boundM; // MinResidualBoundedQuasmonMass
4959  }
4960  G4double minBM2=minBM*minBM+.1;
4961  G4double minM2=minM*minM+.1;
4962 #ifdef debug
4963  G4double ph=kf; // Just for printing
4964  if(pPrint) G4cout<<"G4Q::CHP:M2="<<minM2<<",R="<<rQ2<<",m="<<mintM2
4965  <<",RN2="<<rtQ2<<",q="<<(minM2-rQ2)/rEP/2<<",qN="
4966  <<(mintM2-rtQ2)/rtEP/2<<G4endl;
4967 #endif
4968  G4double newh=1.;
4969  // == (@@) Historical additional cuts for q_min ===
4970  //G4double nc=1.-(dkLS-E-E)/boundM; // q_min=k-E
4971  G4double nc=1.-(dkLS-E-E+CB+CB)/boundM; // q_min=k-E+CB
4972  G4double newl=0.;
4973 #ifdef debug
4974  if(pPrint) G4cout<<"G4Q::CHP:qi_k-E="<<nc<<",k="<<kLS<<",E="<<E
4975  <<",M="<<boundM<<G4endl;
4976 #endif
4977  if(nc > 0. && nc < 1. && nc < ne)
4978  {
4979  ne=nc;
4980  newh=pow(nc,cNQ);
4981  if(newh < kf) kf=newh;
4982  }
4983  else if(nc <= 0.) kf=0.;
4984 
4985  G4double nk=1.-(dkd-Em-Em)/boundM; // q_min=(k-delta)-E*(M-m)/M
4986 #ifdef debug
4987  if(pPrint) G4cout<<"G4Q::CHP:qi_R="<<nk<<",kd="<<kd<<",E="<<Em
4988  <<",M="<<totMass<<G4endl;
4989 #endif
4990  if(nk > 0. && nk < 1. && nk < ne)
4991  {
4992  ne=nk;
4993  newh=pow(nk,cNQ);
4994  if(newh<kf) kf=newh;
4995  }
4996  else if(nk <= 0.) kf=0.;
4997 
4998  //G4double mex=frM+Em;
4999  //G4double sr=sqrt(mex*mex-frM2);//qmin=k-sqrt((m+E*(M-m)/M)^2-m^2)
5000  //G4double np=1.-(dkLS-sr-sr)/boundM;
5001 #ifdef debug
5002  //if(pPrint)G4cout<<"G4Q::CHP:qi_k-sr="<<np<<",sr="<<sr<<",m="<<mex
5003  // <<",M="<<frM<<G4endl;
5004 #endif
5005  //if(np > 0. && np < 1. && np < ne)
5006  //{
5007  // ne=np;
5008  // newh=pow(np,cNQ);
5009  // if(newh<kf) kf=newh;
5010  //}
5011  //else if(np <= 0.) kf=0.;
5012 
5013  //G4double mix=boundM+E;
5014  //G4double mix=nucBM+E;
5015  G4double mix=boundM+E-CB;
5017  G4double st=0.;
5018  if(mix > frM) st=sqrt(mix*mix-frM2);
5019  G4double nq=1.-(dkLS-st-st)/boundM;//qi=k-sq((m+E*(M-m)/M)^2-m^2)
5020 #ifdef debug
5021  if(pPrint) G4cout<<"G4Q::CHP:qi_k-st="<<nq<<",st="<<st<<",m="
5022  <<mix<<",M="<<frM<<G4endl;
5023 #endif
5024  if(nq > 0. && nq < 1. && nq < ne)
5025  //if(2>3) // Does not make any difference
5026  {
5027  ne=nq;
5028  newh=pow(nq,cNQ);
5029  if(newh < kf) kf=newh;
5030  }
5031  else if(nq<=0.)kf=0.;
5032  // == This is the Best for ResidualNucleus Cut (@@ can be improved)
5033  G4LorentzVector rq4M=q4Mom-k4M;
5034  G4ThreeVector k3V=k4M.vect().unit();
5035  G4ThreeVector rq3V=rq4M.vect().unit();
5036  G4bool atrest=(eQ-mQ)/mQ<.001||k3V.dot(rq3V)<-.999;//QAtRest(Pi/Ga)
5037  //G4bool atrest=(eQ-mQ)/mQ<.001; // Q at rest (only PiCap)
5038  // ***VTN*** CHECK IsNecessety toRecover theColTotRes to MinMassTot
5039  if(mintM2>rtQ2) //==> Check of ResidualTotalNucleus ** Always **
5040  //if(2>3) // Negligable difference
5041  {
5042  G4double nz=0.;
5043  if(atrest) nz=1.-(mintM2-rtQ2+pmk*dked)/(boundM*(rtEP+pmk));
5044  else nz=1.-(mintM2-rtQ2)/(boundM*rtEP);
5045  //if(atrest) nz=1.-(mintM2-rtQ2+pmk*dkd)/(nucBM*(rtEP+pmk));
5046  //else nz=1.-(mintM2-rtQ2)/(nucBM*rtEP);
5047 #ifdef debug
5048  if(pPrint) G4cout<<"G4Q::CHP:q="<<nz<<",a="<<atrest<<",M2="
5049  <<mintM2<<">"<<rtQ2<<G4endl;
5050 #endif
5051  if(nz > 0. && nz < 1. && nz < ne)
5052  {
5053  ne=nz;
5054  newh=pow(nz,cNQ);
5055  if(newh < kf) kf=newh;
5056  }
5057  else if(nz <= 0.) kf=0.;
5058  }
5059  // *** VBQ *** CHECK Residual Quazmon (Never use: reduces PS)
5060  //if(minBM2>rQ2&&!piF&&!gaF&&baryn>3) // ==>Check ResidVirtualQuasm
5061  //if(minBM2>rQ2&&!piF&&!gaF&&baryn>2) // ==>Check ResidVirtualQuasm
5062  //if(minBM2>rQ2&&!piF&&!gaF) // ==> Check of ResidualVirtualQuasmon
5063  //if(minBM2>rQ2&&baryn>2)//==>Check of ResidualVirtualQuasmon**OK**
5064  //if(minBM2>rQ2&&baryn>1)//==>Check ResidualVirtualQuasm **Better**
5065  //if(minBM2>rQ2&&piF&&(cPDG==90000001||cPDG==90002002))//CheckRVirQ
5066  //if(minBM2>rQ2&&piF&&(cPDG==90000001||baryn>3))//CheckResidVirtQua
5067  //if(minBM2>rQ2&&(piF&&cPDG==90000001||baryn>2))//CheckResidVirtQua
5068  //if(minBM2>rQ2&&baryn>2) // ==> Check of Residual Virtual Quasmon
5069  //if(minBM2>rQ2&&!piF&&baryn>2&&cPDG!=90001002)//ResidVirtQuasmon
5070  //if(minBM2>rQ2&&!piF&&baryn>2)//==>Check of ResidualVirtualQuasmon
5071  //if(minBM2>rQ2&&!piF&&baryn>3)//==>Check of ResidualVirtualQuasmon
5072  //if(minBM2>rQ2&&!piF&&baryn>1)//==>Check of ResidualVirtualQuasmon
5073  //if(minBM2>rQ2&&!piF&&!gaF)// ==> Check of ResidualVirtualQuasmon
5074  //if(minBM2>rQ2&&!piF)// ==> Check of ResidualVirtualQuasmon ALWAYS
5075  //if(minBM2>rQ2&&piF&&baryn>3)//==>Check of ResidualVirtualQuasmon
5076  //if(minBM2>rQ2&&piF&&(baryn==1||baryn>2))//==>Check ResidVirtQ
5077  //if(minBM2>rQ2&&(!piF||piF&&(cPDG!=90000001||G4UniformRand()<.5)))
5078  //if(minBM2>rQ2&&(!piF||piF&&(cPDG!=90000001)))
5079  //if(minBM2>rQ2&&(!piF&&baryn>4 || piF && cPDG!=90000001 &&
5080  if (minBM2 > rQ2 &&
5081  (!piF ||
5082  (piF && cPDG!=90000001 && cPDG!=90001001 && cPDG!=90001002)
5083  )
5084  )
5085  //if(minBM2>rQ2) // ==> Check of Residual (Virtual?) Quasmon
5086  //if(2>3)
5087  {
5088  G4double nz=0.;
5089  if(atrest) nz=1.-(minBM2-rQ2+pmk*dked)/(boundM*(rEP+pmk));
5090  else nz=1.-(minBM2-rQ2)/(boundM*rEP);
5091  //if(atrest) nz=1.-(minBM2-rQ2+pmk*dkd)/(nucBM*(rEP+pmk));
5092  //else nz=1.-(minBM2-rQ2)/(nucBM*rEP);
5093 #ifdef debug
5094  if(pPrint) G4cout<<"G4Q::CHP:q="<<nz<<",a="<<atrest<<",QM2="
5095  <<minM2<<">"<<rQ2<<G4endl;
5096 #endif
5097  if(nz>0.&&nz<1.&&nz<ne)
5098  {
5099  ne=nz;
5100  newh=pow(nz,cNQ);
5101  if(newh<kf) kf=newh;
5102  }
5103  else if(nz<=0.)kf=0.;
5104  }
5105  //if(minM2>rQ2&&baryn>3) // ==> Check of Residual Quasmon
5106  //if(minM2>rQ2&&!piF&&!gaF&&baryn>3)// ==> Check of ResidualQuasmon
5107  //if(minM2>rQ2&&!piF&&baryn>1) // ==> Check of ResidualQuasmon
5108  //if(minM2>rQ2&&!piF&&baryn>2) // ==> Check of ResidualQuasmon
5109  //if(minM2>rQ2&&!piF&&baryn>2&&cPDG!=90001002)//=>CheckResidQuasmon
5110  //if(minM2>rQ2&&!piF&&baryn>3) // ==> Check Residual Quasmon **OK**
5111  //if(minM2>rQ2&&!piF&&!gaF) // ==> Check of Residual Quasmon
5112  //if(minM2>rQ2&&!piF) // ==> Check of Residual Quasmon
5113  //if(minM2>rQ2&&piF) // ==> Check of Residual Quasmon
5114  //if(minM2>rQ2&&baryn>1) // ==> Check Residual Quasmon **Better**
5115  //if(minM2>rQ2&&(baryn>1||!piF))//==>CheckResidualQuasmon**Better**
5116  //if(minM2>rQ2&&baryn>1&&cPDG!=90002002) //==> CheckResidualQuasmon
5117  //if(minM2>rQ2&&!piF) // ==> Check of Residual Quasmon
5118  //if(minM2>rQ2&&baryn>3) //=>CheckResidQuasmon *** The Best ***
5119  //if(minM2>rQ2 && (!piF || piF &&
5120  //if(minM2>rQ2 && (!piF&&baryn>3 || piF &&
5121  if ( minM2 > rQ2 &&
5122  ( (!piF && baryn > 4) ||
5123  //MKG//(piF && (cPDG != 90000001 || G4UniformRand() > .3333)
5124  (piF && cPDG != 90000001
5125  && cPDG != 90001001)
5126  )
5127  )
5128  //cPDG!=90001001) )
5129  //if(minM2>rQ2) // ==> Check of Residual Quasmon
5130  //if(2>3)
5131  {
5132  G4double nz=0.;
5133  if(atrest) nz=1.-(minM2-rQ2+pmk*dked)/(boundM*(rEP+pmk));
5134  else nz=1.-(minM2-rQ2)/(boundM*rEP);
5135  //if(atrest) nz=1.-(minM2-rQ2+pmk*dkd)/(nucBM*(rEP+pmk));
5136  //else nz=1.-(minM2-rQ2)/(nucBM*rEP);
5137 #ifdef debug
5138  if(pPrint) G4cout<<"G4Q::CHP:q="<<nz<<",a="<<atrest<<",QM2="
5139  <<minM2<<">"<<rQ2<<G4endl;
5140 #endif
5141  if(nz>0.&&nz<1.&&nz<ne)
5142  {
5143  ne=nz;
5144  newh=pow(nz,cNQ);
5145  if(newh<kf) kf=newh;
5146  }
5147  else if(nz<=0.)kf=0.;
5148  }
5149  if(kf<0.)kf=0.;
5150  if(kf>1.)kf=1.;
5151  G4double high = kf; // after this kf can be changed
5152 #ifdef debug
5153  if(pPrint) G4cout<<"G4Q::CHP:"<<kf<<",minM2="<<minM2<<",rQ2="<<rQ2
5154  <<G4endl;
5155 #endif
5156  G4double lz=1.-dked/boundM; // q_max=DEFAULT=k-delta
5157  // Use 3 below carefully and together with "ne" above and "nucflag"
5158  //G4double lz=1.-dkd/nucBM; // q_max=DEFAULT=k-delta
5159  //G4double lz=1.-dkedC/boundM; // q_max=DEFAULT=k-delta+CB
5160  //G4double lz=1.-dkdC/nucBM; // q_max=DEFAULT=k-delta+CB
5161  G4double low=0.;
5162  if(lz>0.&&lz<1.)low=pow(lz,cNQ);
5163  else if(lz>=1.)low=1.;
5164 #ifdef debug
5165  G4double pl=low; // Just for printing
5166  if(pPrint) G4cout<<"G4Q::CHP:<qa_DEF>="<<lz<<", eDel="<<eDelta
5167  <<",nDel="<<nDelta<<G4endl;
5168 #endif
5169  // == (@@) Historical additional cuts for q_max ===
5170  //G4double tms=kLS+nDelta+Em;
5171  G4double tms=kLS+eDelta+Em; // The same don't change ***
5172  G4double le=1.-(tms+tms)/boundM; // q_max=k+delta+E*(M-m)/M
5173 #ifdef debug
5174  if(pPrint) G4cout<<"G4Q::CHP:qa_t="<<le<<",k="<<kLS<<",E="<<Em
5175  <<",bM="<<boundM<<G4endl;
5176 #endif
5177  if(le>0.&&le<1.&&le>lz)
5178  {
5179  lz=le;
5180  newl=pow(le,cNQ);
5181  if(newl>low) low=newl;
5182  }
5183  else if(le>=1.)low=1.;
5184  // === End of historical cuts
5185 
5186  //G4double lk=1.-(dkLS+E+E)/boundM; // q_max=k+E
5187  G4double lk=1.-(dkLS+E+E-CB-CB)/boundM;//qmax=k+E-CB(surfaceCond)
5188 #ifdef debug
5189  if(pPrint) G4cout<<"G4Q::CHP:qa_k+E="<<lk<<",k="<<kLS<<",E="<<E
5190  <<",M="<<boundM<<G4endl;
5191 #endif
5192  if(lk>0.&&lk<1.&&lk>lz)
5193  {
5194  lz=lk;
5195  newl=pow(lk,cNQ);
5196  if(newl>low) low=newl;
5197  }
5198  else if(lk>=1.)low=1.;
5199  // === End of the k+E cut
5200 
5201  // === Instead one can try this ===
5202  //G4double lq=1.-(dkLS+st+st)/boundM;//qm=k+sqrt((E*(M-m)/M)^2-m^2)
5203 #ifdef debug
5204  //if(pPrint)G4cout<<"G4Q::CHP:qa_k+st="<<lq<<",st="<<st<<",m="<<mix
5205  // <<",M="<<frM<<G4endl;
5206 #endif
5207  //if(lq>0.&&lq<1.&&lq>lz)
5208  //{
5209  // lz=lq;
5210  // newl=pow(lq,cNQ);
5211  // if(newl>low) low=newl;
5212  //}
5213  //else if(lq>=1.)low=1.;
5214 
5215  // === The same as previous but "sr" instead of "st" ===
5216  G4double lp=1.-(dkLS+sr+sr)/boundM;//qm=k+sqrt((E*(M-m)/M)^2-m^2)
5217 #ifdef debug
5218  if(pPrint) G4cout<<"G4Q::CHP:qa_k+sr="<<lp<<",sr="<<sr
5219  <<",M="<<frM<<G4endl;
5220 #endif
5221  if(lp>0.&&lp<1.&&lp>lz)
5222  {
5223  lz=lp;
5224  newl=pow(lp,cNQ);
5225  if(newl>low) low=newl;
5226  }
5227  else if(lp>=1.)low=1.;
5228  // ............................................................
5229  //It's SpecificCoulombBarrierLimit forChargedParticles(canBeSkiped)
5230  if(totZ > cC) // ==> Check CoulombBarrier
5231  //if(2>3)
5232  {
5233  G4double qmaCB=boundM-qMax;
5234  //G4double qmaCB=nucBM-qMax;
5235  G4double nz=1.-(qmaCB+qmaCB)/boundM;//q=Mb-Mf-CB+kLS,qM=Mf+CB-kLS
5236 #ifdef debug
5237  if(pPrint) G4cout<<"G4Q::CHP:<qa_CB>="<<nz<<",m="<<qmaCB<<",CB="
5238  <<CB<<G4endl;
5239 #endif
5240  if(nz>0.&&nz>lz)
5241  {
5242  newl=pow(nz,cNQ);
5243  if(newl>low) low=newl;
5244  }
5245  else if(nz>1.) low=10.;
5246  }
5247  // ***** End of restrictions *****
5248  kf-=low;
5249 #ifdef debug
5250  if(pPrint) G4cout<<"G4Q::CHP:>>"<<cPDG<<",l="<<low<<",h="<<high
5251  <<",ol="<<pl<<",oh="<<ph<<",nl="<<newl<<",nh="
5252  <<newh<<",kf="<<kf<<",d="<<eDelta<<G4endl;
5253 #endif
5254  G4double probab=0.;
5255  if(kf>0)
5256  {
5257  kf*=boundM/kLS/cNQ; // Final value of kinematical (i,o) factor
5258  G4int noc=cQPDG.GetNumOfComb(iq, oq);
5259  // MKG
5261  probab=qFact*kf*nqInQ*pPP*noc/pUD; // With wing suppresion
5262  //probab=baryn*qFact*kf*nqInQ*pPP*noc/pUD;//WingSuppresion&*BaryN
5263  // qFact - squared charge for photons & u-quark, for others =1
5264  // kf - the phase space integral
5265  // nqInQ - a#of i-quarks in the Quasmon
5266  // pPP - probability to find (a#of) the Parent Cluster
5267  // noc - a#of o-quarks in the Parent Cluster
5268  // pUD - suppression for NuclearClusters fare from Z=N Mirror
5269  G4QContent rQQC = valQ+ioQC;// Quark Content of Residual Quasmon
5270  G4int BarRQC=rQQC.GetBaryonNumber(); // Res Quasmon BaryonNumber
5271  G4int StrRQC=rQQC.GetStrangeness(); // Res Quasmon Strangeness
5272  if(BarRQC==2 && !StrRQC) // --> DiBaryon Correction
5273  {
5274  G4int ChgRQC=rQQC.GetCharge(); // Res Quasmon Charge
5275  if(ChgRQC==1) probab/=2; // Only one S
5276  else probab*=2; // One S + three P
5277  }
5278 #ifdef debug
5279  if(pPrint)G4cout<<"G4Q::CHP:prob="<<probab<<",qF="<<qFact<<",iq="
5280  <<iq<<",oq="<<oq<<",Pho4M="<<phot4M<<",pUD="<<pUD
5281  <<",pPP="<<pPP<<G4endl;
5282 #endif
5283  if(probab<0.) probab=0.;
5284  }
5285  pcomb += probab; // Update integratedProbab forParntClust
5286  G4QParentCluster* curParC = new G4QParentCluster(parPDG,pcomb);
5287  curParC->SetTransQC(ioQC); // Keep QuarkContent of theExchangeMeson
5288  curParC->SetLow(low); // Keep the Low limit of randomization
5289  curParC->SetHigh(high); // Keep the High limit of randomization
5290  curParC->SetEBMass(boundM);// Keep EnvironBoundedMass forFutureCalc
5291  curParC->SetNBMass(nucBM); // Keep totNuclBoundedMass forFutureCalc
5292  curParC->SetEBind(eDelta); // Keep EnvBindingEnerergy forFutureCalc
5293  curParC->SetNBind(nDelta); // Keep NucBindingEnerergy forFutureCalc
5294  curParC->SetNQPart2(cNQ); // Keep #of quark-partons in theFragment
5295 #ifdef sdebug
5296  G4cout<<"G4Q::CalcHP: FillParentClaster="<<*curParC<<G4endl;
5297 #endif
5298  curCand->FillPClustVec(curParC);//FillParentClust to ParClVec(d.e.)
5299  comb += probab;
5300 #ifdef pdebug
5301  if(pPrint) G4cout<<"G4Q::CHP:in="<<index<<",cPDG="<<cPDG<<",pc"<<parentCounter
5302  <<parQC<<",Env="<<theEnvironment<<",comb="<<comb
5303  <<",posib="<<parCand->GetParPossibility()<<G4endl;
5304 #endif
5305  parentCounter++;
5306  } // -->> End of the Minimum mass cut
5307  } // -->> End of the isotope focusing
5308 #ifdef sdebug
5309  else G4cout<<"***G4Q::CHP:dI="<<dI<<",cC="<<cC<<G4endl;
5310 #endif
5311  } // -->> End of tje final state possibility
5312  } // -->> End of if of QuarkExchangePossibility
5313  } // +++> End of if of existinr residual Q Code
5314  probability+=comb; // Collect the probability for the fragment
5315 #ifdef pdebug
5316  if(pPrint) G4cout<<"G4Q::CHPr: probab="<<probability<<"("<<comb<<"),iq="<<iq
5317  <<",oq="<<oq<<G4endl;
5318 #endif
5319  } // ...> End of Quark Exchange "oq" Test LOOP
5320  } // ...> End of Quark Exchange "iq" Test LOOP
5321  } // ---> End of Nuclear Case of fragmentation
5322  else if(cPDG<80000000) // ===> Hadron case (QUark FUsion mechanism)
5323  {
5324  // Calculation of the existing hadrons
5325  G4int curnh=theQHadrons.size();
5326  G4int npip=0;
5327  G4int npin=0;
5328  G4int npiz=0;
5329  for (G4int ind=0; ind<curnh; ind++)
5330  {
5331  G4int curhPDG=theQHadrons[ind]->GetPDGCode(); // PDG Code of the hadron
5332  if (curhPDG== 111) npiz++;
5333  if (curhPDG== 211) npip++;
5334  if (curhPDG==-211) npin++;
5335  }
5336  // End of the hadron counting
5337  comb = valQ.NOfCombinations(candQC);
5338  if(!comb)
5339  {
5340  if ( (aPDG==111)|(aPDG==211) ) comb=1.; // Permit pions @@ ?
5341  else if ( (aPDG==311)|(aPDG==321) ) comb=SSin2Gluons; // Permit kaons @@ ?
5342  }
5343  if(cPDG== 211&&npip>0) comb*=(npip+1); // Bose multyplication for pi+
5344  if(cPDG==-211&&npip>0) comb*=(npin+1); // Bose multyplication for pi-
5345  if(cPDG==111||cPDG==221||cPDG==331||cPDG==113||cPDG==223||cPDG==333||cPDG==115||
5346  cPDG==225||cPDG==335||cPDG==117||cPDG==227||cPDG==337||cPDG==110||cPDG==220||
5347  cPDG==330) // @@ Can it be shorter if?
5348  {
5349  G4QContent tQCd(1,0,0,1,0,0);
5350  G4QContent tQCu(0,1,0,0,1,0);
5351  G4QContent tQCs(0,0,1,0,0,1);
5352  G4double cmd=valQ.NOfCombinations(tQCd);
5353  G4double cmu=valQ.NOfCombinations(tQCu);
5354  G4double cms=valQ.NOfCombinations(tQCs);
5355  if(cPDG!=333&&cPDG!=335&&cPDG!=337) comb=(cmd+cmu)/2.;
5356  //if(cPDG==331||cPDG==221) comb =(comb + cms)/2.; //eta,eta'
5357  if(cPDG==331||cPDG==221) comb =(comb + cms)/4.; //eta,eta'(factor2 suppression)
5358  if(cPDG==113) comb*=4.; //@@
5359  if(cPDG==223) comb*=2.; //@@
5360  if(cPDG==111&&npiz>0) comb*=(npiz+1); // Bose multyplication
5361 #ifdef debug
5362  if(abs(cPDG)<3) G4cout<<"G4Q::CHP:comb="<<comb<<",cmd="<<cmd<<",cmuu="<<cmu
5363  <<",cms="<<cms<<G4endl;
5364 #endif
5365  }
5366  curQ -= candQC; // This is a quark content of residual quasmon
5367  resPDG = curQ.GetSPDGCode(); // PDG of theLowest residualQuas hadronicState
5368  G4QContent resTQC = curQ+envQC; // Total nuclear Residual Quark Content
5369  G4double resTM=G4QPDGCode(resTQC.GetSPDGCode()).GetMass();
5370 #ifdef debug
5371  G4bool priCon = aPDG < 10000 && aPDG%10 < 3;
5372  if(priCon) G4cout<<"G4Q::CHP:***>>cPDG="<<cPDG<<",cQC="<<candQC<<",comb="<<comb
5373  <<",curQC="<<curQ<<",mQ="<<mQ<<",ab="<<absb<<G4endl;
5374 #endif
5375  if(resPDG==221 || resPDG==331)
5376  {
5377  resPDG=111;// pi0 minimum residual instead of eta
5378  resTM=mPi0;
5379  }
5380 #ifdef debug
5381  if(priCon) G4cout<<"G4Q::CHP:cPDG="<<cPDG<<",c="<<comb<<",rPDG/QC="<<resPDG<<curQ
5382  <<",tM="<<totMass<<">"<<frM-CB+resTM<<"=fM="<<frM<<"+rM="<<resTM
5383  <<"-CB="<<CB<<G4endl;
5384 #endif
5385  if (comb && resPDG && totMass > frM-CB+resTM &&
5386  ((resPDG > 80000000 && resPDG != 90000000) || resPDG<10000) )
5387  {
5388 #ifdef debug
5389  if(priCon) G4cout<<"G4Q::CHP:ind="<<index<<",qQC="<<valQ<<mQ<<",cPDG="<<cPDG
5390  <<",rPDG="<<resPDG<<curQ<<G4endl;
5391 #endif
5392  if(resPDG!=10)resM=G4QPDGCode(resPDG).GetMass();// PDG mass for the residHadron
5393  else resM=G4QChipolino(curQ).GetMass(); // Chipolino mass for theResidualHadron
5394  G4int resQCode=G4QPDGCode(curQ).GetQCode();
5395 #ifdef debug
5396  if(priCon) G4cout<<"G4Q::CHP:rM/QC="<<resM<<curQ<<",E="<<envPDGC<<",rQC="
5397  <<resQCode<<G4endl;
5398 #endif
5399  //if(envPDGC>80000000 && envPDGC!=90000000 && resM>0. && aPDG>1000 && // @@??
5400  if(envPDGC>80000000 && envPDGC!=90000000 && resM>0. &&
5401  resPDG!=10 && resPDG!=1114 && resPDG!=2224)//=>Take Into Account Environment
5402  {
5403  G4QContent rtQC=curQ+envQC; // Total Residual Quark Content
5404  G4QNucleus rtN(rtQC); // Create a pseudo-nucleus for residual
5405  G4double rtM =rtN.GetMZNS(); // Min Mass of total residual Nucleus
5406  G4double bnRQ=rtM-envM; // Bound mass of residual Quasmon
5407 #ifdef debug
5408  if(priCon) G4cout<<"G4Q::CHP: **Rec**,RQMass="<<bnRQ<<",envM="<<envM<<",rtM="
5409  <<rtM<<G4endl;
5410 #endif
5411  // ***VBQ***
5412  if(bnRQ<resM) resM=bnRQ;
5413  }
5414 #ifdef debug
5415  if(aPDG<10000&&aPDG%10<3)
5416  //if(aPDG<10000&&aPDG%10<5)
5417  G4cout<<"G4Q::CHP: resM="<<resM<<", resQCode="<<resQCode<<G4endl;
5418 #endif
5419  if(resM>0. && resQCode>-2)
5420  {
5421  G4double limM=mQ-resM;
5422  G4double rndM=GetRandomMass(cPDG,limM);// Candidate's Mass randomization
5423 #ifdef debug
5424  G4double cMass=G4QPDGCode(cPDG).GetMass();
5425  if(aPDG<10000&&aPDG%10<3)
5426  //if(aPDG<10000&&aPDG%10<5)
5427  G4cout<<"G4Q::CHP:rndM="<<rndM<<",limM="<<limM<<" > cM="<<cMass<<" ,rM+fM="
5428  <<resM+rndM<<" < mQ="<<mQ<<G4endl;
5429 #endif
5430  // --- Kinematical Factors ---
5431  if(rndM>0. && resM+rndM<mQ)
5432  {
5433  curCand->SetEBMass(rndM); // Set RandomizedEnvBoundMass of the Candidate
5434  curCand->SetNBMass(rndM); // Set RandomizedNotBoundMass of the Candidate
5435  G4double mH2 = rndM*rndM; // Squared mass of the candidate (Mu2)
5436  G4double rHk = mH2/dk;
5437  G4double zMax = 1.-rHk/mQ; // z_max
5438  G4double mR2 = resM*resM; // SquaredBoundedMass of the ResidualQuasmon
5439  G4double zMin=0.;
5440  //@@ One can use zMin=0 and later return to residM, as it is for qBar==0
5441  //zMin= mR2/mQ/(mQ-dk); // z_min for Quasmon-Baryon @@ ?? @@
5442  if(qBar) zMin= mR2/mQ/(mQ-dk); // z_min for Quasmon-Baryon @@ ?? @@
5443  G4double possibility=zMax-zMin;
5444 #ifdef debug
5445  if(priCon) G4cout<<"G4Q::CHP:M="<<rndM<<",ps="<<possibility<<",zMax="<<zMax
5446  <<",rHk="<<rHk<<",mQ="<<mQ<<",dk="<<dk<<",zMin="<<zMin
5447  <<",mR2="<<mR2<<",rM="<<resM<<"; "<<mQ*(mQ-dk)<<G4endl;
5448 #endif
5449  if (resPDG==10) // Chipolino case - check minimum
5450  {
5451  G4double rM2 = mQk*(mQ-rHk);
5452  if(rM2<resM*resM) possibility = 0.;
5453  }
5454  if (possibility>0. && vap>0 && zMax>zMin)
5455  {
5456  probability = vaf*(pow(zMax, vap)-pow(zMin, vap));
5457 #ifdef debug
5458  if(priCon) G4cout<<"G4Q::CHP:#"<<index<<",mH2="<<mH2<<",nQ="<<nOfQ<<",p="
5459  <<probability<<",vf="<<vaf<<",vp="<<vap<<",zMax="<<zMax
5460  <<",zMin="<<zMin<<G4endl;
5461 #endif
5462 
5463  //if(qBar > 1 && baryn > 0) //---> HighBaryonNumber ("nuclear") case
5464  //{
5465  // //G4QContent rtQC=curQ+envQC; // Total Residual Quark Content @@ ??
5466  // //G4QNucleus rtN(rtQC); // Create pseudo-nucleus for residual
5467  // /////G4double rtM =rtN.GetMZNS();// MinMass of total residual Nucleus
5468  // /////////G4double bnRQ=rtM-envM; // Bound mass of residual Quasmon
5469  //}
5470  //else //---> LowBaryonNumber case (tuned on p-ap)
5471  //{
5472  if(cPDG==110||cPDG==220||cPDG==330) probability*=comb; // f0 has spin 0
5473  else probability*=comb*(abs(cPDG)%10); // Spin of resonance
5474  G4int BarRQC=curQ.GetBaryonNumber(); // Res Quasmon BaryonNumber
5475  G4int StrRQC=curQ.GetStrangeness(); // Res Quasmon Strangeness
5476  if(BarRQC==2 && !StrRQC) // --> DiBaryon Correction
5477  {
5478  G4int ChgRQC=curQ.GetCharge(); // Res Quasmon Charge
5479  if(ChgRQC==1) probability/=2; // Only one S
5480  else probability*=2; // One S + three P
5481  }
5482  //}
5483  }
5484  }
5485  else
5486  {
5487 #ifdef debug
5488  if(priCon) G4cout<<"G4Q::CHP:cM=0[cPDG"<<cPDG<<"],mQ/QC="<<mQ<<valQ<<",rM="
5489  <<resM<<curQ<<G4endl;
5490 #endif
5491  }
5492  }
5493  else
5494  {
5495 #ifdef debug
5496  if(priCon) G4cout<<"***G4Q::CHP: M=0, #"<<index<<valQ<<",cPDH="<<cPDG<<"+rP="
5497  <<resPDG<<curQ<<G4endl;
5498 #endif
5499  }
5500  }
5501  else
5502  {
5503  probability=0.;
5504 #ifdef debug
5505  if(priCon) G4cout<<"G4Q::CHP:"<<index<<valQ<<",PDG="<<cPDG<<"+r="<<resPDG<<curQ
5506  <<":c=0(!) || tM="<<totMass<<"<"<<frM-CB+resTM<<" = fM="<<frM
5507  <<"+rTM="<<resTM<<"-CB="<<CB<< G4endl;
5508 #endif
5509  } // ---> End of the possibility IF
5510  //if(cPDG==111) secondProbab = 1.;
5511  } // ---> End of Hadronic Case of fragmentation
5512  else probability=0.;
5513 #ifdef debug
5514  G4int aPDG = abs(cPDG);
5515  if((cPDG>90000000 && baryn<5) || (aPDG<10000 && aPDG%10<3))
5516  G4cout<<"G4Q::CHP:^^cPDG="<<cPDG<<",p="<<pos<<",rPDG="<<resPDG<<curQ<<resM<<",p="
5517  <<probability<<",a="<<accumulatedProbability<<",sp="<<secondProbab<<G4endl;
5518 #endif
5519  } // ===> End of possibility check
5520  } // ==> End of cluster skip for eA=0
5521  curCand->SetRelProbability(probability);
5522  accumulatedProbability += probability;
5523  curCand->SetIntegProbability(accumulatedProbability);
5524  curCand->SetSecondRelProb(secondProbab);
5525  secondAccumProbability += secondProbab;
5526  curCand->SetSecondIntProb(secondAccumProbability);
5527  } // ***> End of LOOP over candidates}
5528 } // End of "CalculateHadronizationProbabilities"
5529 
5530 // Check that it's possible to decay theTotalResidualNucleus in Quasmon+Environ & correct
5531 G4bool G4Quasmon::CheckGroundState(G4bool corFlag) // Correction is forbidden by default
5532 {
5533  static const G4QContent neutQC(2,1,0,0,0,0);
5534  static const G4QContent protQC(1,2,0,0,0,0);
5535  static const G4QContent lambQC(1,1,1,0,0,0);
5536  static const G4QContent deutQC(3,3,0,0,0,0);
5537  static const G4QContent alphQC(6,6,0,0,0,0);
5538  static const G4double mNeut= G4QPDGCode(2112).GetMass();
5539  static const G4double mProt= G4QPDGCode(2212).GetMass();
5540  static const G4double mLamb= G4QPDGCode(3122).GetMass();
5541  static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
5542  static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
5543  static const G4QNucleus vacuum= G4QNucleus(G4LorentzVector(0.,0.,0.,0.),90000000);
5547  G4int resQPDG=valQ.GetSPDGCode(); // Quasmon PDG reachable in a member function
5548  G4double resQMa=G4QPDGCode(resQPDG).GetMass(); // GS Mass of the Residual Quasmon
5549  G4double resEMa=0.; // GS Mass of the Empty Residual Environment
5550  G4int bsCond=0; // BaryonSeparetionCondition for Quasmon in vacuum
5551  G4LorentzVector enva4M=G4LorentzVector(0.,0.,0.,0.);
5552  G4LorentzVector reTLV=q4Mom; // Prototyoe of the 4-Mom of the Residual Nucleus
5553  G4double resSMa=resQMa; // Prototype of MinSplitMass of ResidualNucleus
5554 #ifdef debug
5555  G4cout<<"G4Q::CheckGS: EnvPDG="<<theEnvironment.GetPDG()<<",Quasmon="<<resQPDG<<G4endl;
5556 #endif
5557  if(theEnvironment.GetPDG()!=90000000) // "Existing Environment" case
5558  {
5559  resEMa=theEnvironment.GetMZNS(); // GSMass of the Residual Environment
5560 #ifdef debug
5561  G4cout<<"G4Q::CheckGS: Environment Mass="<<resEMa<<G4endl;
5562 #endif
5563  enva4M=G4LorentzVector(0.,0.,0.,resEMa); // 4-Mom of the Residual Environment
5564  reTLV+=enva4M; // 4-Mom of Residual Nucleus
5565  resSMa+=resEMa; // Minimal Split Mass of Residual Nucleus
5566  }
5567  else //Calculate BaryonSeparetionCondition for vacQuasm
5568  {
5569  G4QNucleus tmpQN(valQ,reTLV); // TemporaryNucleus for the VacuumQuasmon
5570  //G4QNucleus tmpQN(valQ); // TemporaryNucleus for the VacuumQuasmon
5571  bsCond = tmpQN.SplitBaryon(); // Possibility to split Fragment from the VacuumQ
5572 #ifdef debug
5573  G4cout<<"G4Q::CheckGS: No environment, theOnlyQ="<<tmpQN<<",bsCond="<<bsCond<<G4endl;
5574 #endif
5575  if(bsCond) // Decay rignht away in Fragment & residual
5576  {
5577  G4QContent fragmQC=protQC;
5578  G4double fragmM=mProt;
5579  if(bsCond==2112)
5580  {
5581  fragmQC=neutQC;
5582  fragmM=mNeut;
5583  }
5584  else if(bsCond==3122)
5585  {
5586  fragmQC=lambQC;
5587  fragmM=mLamb;
5588  }
5589  else if(bsCond==90001001)
5590  {
5591  fragmQC=deutQC;
5592  fragmM=mDeut;
5593  }
5594  else if(bsCond==90002002)
5595  {
5596  fragmQC=alphQC;
5597  fragmM=mAlph;
5598  }
5599  G4QContent rsQC=valQ-fragmQC;
5600  G4QNucleus rsQN(rsQC); // TemporaryNucleus for the ResidualVacuumQuasmon
5601  G4double rsMass=rsQN.GetGSMass(); // Mass of the residualVacuum Quasmon
5602  G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,rsMass); // GSMass of theResidQuasm
5603  G4QHadron* quasH = new G4QHadron(rsQC, quas4M);
5604  G4LorentzVector frag4M = G4LorentzVector(0.,0.,0.,fragmM); // GSMass of theSplitFragm
5605  G4QHadron* fragH = new G4QHadron(fragmQC, frag4M);
5606  if(G4QHadron(reTLV).DecayIn2(frag4M,quas4M))
5607  {
5608  quasH->Set4Momentum(quas4M);
5609  FillHadronVector(quasH); // Fill ResidQuasmHadron (delete equivalent)
5610  fragH->Set4Momentum(frag4M);
5611  FillHadronVector(fragH); // Fill ResidQuasmHadron (delete equivalent)
5612  return true;
5613  }
5614  else
5615  {
5616  delete quasH;
5617  delete fragH;
5618  }
5619  }
5620  }
5621  G4QContent envaQC = theEnvironment.GetQCZNS(); // Quark Content of the Environment
5622  G4double resTMa=reTLV.m(); // CM Mass of the ResidualNucleus (Quasm+Environ)
5623  //if(resTMa>resSMa && (resEMa || bsCond)) return true;// Why not ?? @@ (see G4E the same)
5624  G4int nOfOUT = theQHadrons.size(); // Total #of QHadrons at this point
5625 #ifdef debug
5626  G4cout<<"G4Q::CheckGS: (totM="<<resTMa<<" < rQM+rEM="<<resSMa<<" || rEM="<<resEMa
5627  <<"=0 && "<<bsCond<<"=0) && n="<<nOfOUT<<" >0"<<G4endl;
5628 #endif
5629  if ( (resTMa < resSMa || (!resEMa && !bsCond) ) && nOfOUT > 0 && corFlag)
5630  { // *** CORRECTION ***
5631 
5632  G4QHadron* theLast = theQHadrons[nOfOUT-1];
5633  if(!(theLast->GetNFragments()) && theLast->GetPDGCode()!=22)//NotDecayedHadron & NotGam
5634  {
5635  G4LorentzVector hadr4M=theLast->Get4Momentum();
5636  G4double hadrMa=hadr4M.m(); // Mass of the Last hadron (==GSMass)
5637  G4LorentzVector tmpTLV=reTLV+hadr4M;// Tot (ResidNucl+LastHadron) 4-Mom
5638 #ifdef debug
5639  G4cout<<"G4Q::CheckGS:YES,T="<<tmpTLV<<tmpTLV.m()<<">rM+hM="<<resSMa+hadrMa<<G4endl;
5640 #endif
5641  if(tmpTLV.m()>resSMa+hadrMa) // resMa contains 2 Hadrons: resQ and Environ
5642  {
5643  if(resEMa) // => "Non vacuum Environment exists" case
5644  {
5645  G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resQMa); // GS Mass of Quasmon
5646  if(!G4QHadron(tmpTLV).DecayIn3(hadr4M,quas4M,enva4M))
5647  {
5648  G4cerr<<"---Warning---G4Q::CheckGS:DecIn Fragm+ResQ+ResEnv Error"<<G4endl;
5649  return false;
5650  }
5651  else
5652  {
5653  //@@CHECK CoulBar (only for ResQuasm in respect to ResEnv) & evaporate instead?
5654  //theEnvironment = G4QNucleus(envaQC,enva4M);
5655  G4QHadron* envH = new G4QHadron(envaQC,enva4M); //@@ Moving Environment !
5656  FillHadronVector(envH); // Fill Moving Environment (del.equiv.)
5657  theEnvironment = vacuum;
5658  G4QHadron* quasH = new G4QHadron(valQ, quas4M);
5659  //quasH->Set4Momentum(quas4M); // @@
5660  FillHadronVector(quasH); // Fill ResidQuasm Hadron (del.equiv.)
5661  theLast->Set4Momentum(hadr4M);
5662  }
5663  }
5664  else //=>"The Env is vacuum" case (DecayIn2)
5665  {
5666  G4LorentzVector quas4M = G4LorentzVector(0.,0.,0.,resQMa); // GS Mass of Quasmon
5667  G4QHadron* quasH = new G4QHadron(valQ, quas4M);
5668  if(!G4QHadron(tmpTLV).DecayIn2(hadr4M,quas4M))
5669  {
5670  delete quasH; // Delete "new Quasmon Hadron"
5671  G4cerr<<"---Warning---G4Q::CheckGS: Decay in Fragm+ResQ Error"<<G4endl;
5672  return false;
5673  }
5674  else
5675  {
5676  //@@CHECK CoulBar (only for ResQuasm in respect to ResEnv) & evaporate instead
5677  theLast->Set4Momentum(hadr4M);
5678  quasH->Set4Momentum(quas4M);
5679  FillHadronVector(quasH); // Fill ResidQuasmHadron (del.equivalent)
5680  }
5681  }
5682  }
5683  else // "CORRECTION" !!!!
5684  {
5685  if(nOfOUT>1 && corFlag)
5686  {
5687  G4QHadron* thePrev = theQHadrons[nOfOUT-2];// Get pointer to prev-before-lastHad
5688  if(thePrev->GetNFragments()||thePrev->GetPDGCode()==22)return false;//DecH or Gam
5689  G4LorentzVector prev4M=thePrev->Get4Momentum(); // 4M of thePreviousButLastHadron
5690  G4double prevMa=prev4M.m(); // PreviousHadronMass (==HadrGSM)
5691  tmpTLV+=prev4M; // IncrementTotal4M of TotResNucl
5692  G4QContent totQC=valQ+envaQC; // QCont of theResidNucl=ResQ+Env
5693  G4int totPDG=totQC.GetSPDGCode(); // PDG Code of TotResidualNucleus
5694  G4double totQMa=G4QPDGCode(totPDG).GetMass(); // GS Mass of the ResidualNucleus
5695  G4double totNMa=tmpTLV.m(); // RealMass of TotResidualNucleus
5696 #ifdef debug
5697  G4cout<<"G4Q::CheckGS:NO, M="<<tmpTLV<<totNMa<<">"<<totQMa+hadrMa+prevMa<<G4endl;
5698 #endif
5699  if(totNMa>totQMa+hadrMa+prevMa)
5700  {
5701  G4LorentzVector nuc4M = G4LorentzVector(0.,0.,0.,totQMa); // ResNuclAtRest 4Mom
5702  if(!G4QHadron(tmpTLV).DecayIn3(hadr4M,prev4M,nuc4M))
5703  {
5704  G4cerr<<"---Warning---G4Q::CheckGS:DecIn3 ResN+Last+Prev Error"<<G4endl;
5705  return false;
5706  }
5707  else
5708  {
5709  //theEnvironment = G4QNucleus(totQC, nuc4M);
5710  G4QHadron* envH = new G4QHadron(totQC,nuc4M); //@@ Moving Environment !
5711  FillHadronVector(envH); // Fill Moving Environment (del.eq.)
5712  theEnvironment = vacuum; //@@ Instead of Moving Environment !
5713  theLast->Set4Momentum(hadr4M);
5714  thePrev->Set4Momentum(prev4M);
5715 #ifdef debug
5716  G4cout<<"G4Q::CheckGS: Yes, Check D4M="<<tmpTLV-hadr4M-prev4M-nuc4M<<G4endl;
5717 #endif
5718  }
5719  }
5720  else // Decay in one hadron, absorb other
5721  {
5722  G4QContent tmpLNQ=totQC+thePrev->GetQC();
5723  G4int resLPDG =tmpLNQ.GetSPDGCode();
5724  G4double resLastM=G4QPDGCode(resLPDG).GetMass();//GSM of ResidNucl for theLastH
5725  G4QContent tmpPNQ=totQC+theLast->GetQC();
5726  G4int resPPDG =tmpPNQ.GetSPDGCode();
5727  G4double resPrevM=G4QPDGCode(resPPDG).GetMass();//GSM of ResidNucl for thePrevH
5729 #ifdef debug
5730  G4cout<<"G4Quasm::CheckGS: NO, tM="<<totNMa<<" > rp+l="<<resLastM+hadrMa
5731  <<" || > rl+p="<<resPrevM+prevMa<<G4endl;
5732 #endif
5733  if (totNMa>resLastM+hadrMa) // "Just exclude the Prev" case
5734  {
5735  theQHadrons.pop_back(); // theLast* is excluded from OUTPUT HV
5736  theQHadrons.pop_back(); // thePrev* is excluded from OUTPUT HV
5737  theQHadrons.push_back(theLast); // theLast substitutes thePrev in OUTPUT
5738  delete thePrev; // thePrev QHadron is destructed
5739  thePrev=theLast;
5740  resPPDG=resLPDG;
5741  resPrevM=resLastM;
5742  prev4M = hadr4M;
5743  }
5744  else if (totNMa>resPrevM+prevMa) // "Just exclude the Last" case
5745  {
5746  theQHadrons.pop_back();
5747  delete theLast;
5748  }
5749  else return false;
5750  G4LorentzVector nuc4M = G4LorentzVector(0.,0.,0.,resPrevM);//ResNucl4m to PrevH
5751  if(!G4QHadron(tmpTLV).DecayIn2(prev4M,nuc4M))
5752  {
5753  G4cerr<<"---Warning---G4Q::CheckGS:DecIn2 (ResN+Last)+Prev Error"<<G4endl;
5754  return false;
5755  }
5756  else
5757  {
5758  //theEnvironment = G4QNucleus(nuc4M, resPPDG);
5759  G4QHadron* envH = new G4QHadron(resPPDG,nuc4M); //@@ Moving Environment !
5760  FillHadronVector(envH); // Fill Moving Environment (del.equiv.)
5761  theEnvironment = vacuum;
5762  thePrev->Set4Momentum(prev4M);
5763 #ifdef debug
5764  G4cout<<"G4Q::CheckGS:Yes, Check D4M="<<tmpTLV-prev4M-nuc4M<<G4endl;
5765 #endif
5766  }
5767  }
5768  }
5769  else return false;
5770  }
5771  }
5772  else return false;
5773  }
5774  else return false;
5775  return true;
5776 } // End of "CheckGroundState"
5777 
5778 // Decay the QHadron with the existing PDG Code (not Chipolino) for external & internal use
5779 G4QHadronVector* G4Quasmon::DecayQHadron(G4QHadron* qH) // Don't fill Internal QHadrons
5780 {
5781  G4QHadronVector* theFragments = new G4QHadronVector; // user is responsible to delete!
5782  G4QPDGCode theQPDG = qH->GetQPDG();
5783  G4int thePDG = theQPDG.GetPDGCode(); // Get the PDG code of decaying hadron
5784  G4int pap = 0; // --- particle
5785  if(thePDG<0) pap = 1; // --- anti-particle
5786  G4LorentzVector t = qH->Get4Momentum(); // Get 4-momentum of decaying hadron
5787  G4double m_value = t.m(); // Get the mass value of decaying Hadron
5788  // --- Randomize a channel of decay
5789  G4QDecayChanVector decV = theWorld->GetQParticle(theQPDG)->GetDecayVector();
5790  G4int nChan = decV.size();
5791 #ifdef debug
5792  G4cout<<"G4Quasm::DecQHadron: PDG="<<thePDG<<",m="<<m_value<<",("<<nChan<<" channels)"<<G4endl;
5793 #endif
5794  if(nChan)
5795  {
5796  G4int i=0;
5797  if(nChan>1)
5798  {
5799  G4double rnd = G4UniformRand(); // Random value to select a Decay Channel
5800  for(i=0; i<nChan; i++)
5801  {
5802  G4QDecayChan* dC = decV[i]; // The i-th Decay Channel
5803 #ifdef debug
5804  G4cout<<"G4Quasmon::DecaQHadr:i="<<i<<",r="<<rnd<<"<dl="<<dC->GetDecayChanLimit()
5805  <<", mm="<<dC->GetMinMass()<<G4endl;
5806 #endif
5807  if(rnd<dC->GetDecayChanLimit() && m_value>dC->GetMinMass()) break;
5808  }
5809  if(i>nChan-1) i=nChan-1;
5810  }
5811  G4QPDGCodeVector cV=decV[i]->GetVecOfSecHadrons();// PDGVector of theSelectedDecChannel
5812  G4int nPart=cV.size(); // A#of particles to decay in
5813 #ifdef debug
5814  G4cout<<"G4Quasmon::DecayQHadron: resi="<<i<<",nP="<<nPart<<":"<<cV[0]->GetPDGCode()
5815  <<","<<cV[1]->GetPDGCode();
5816  if(nPart>2) G4cout<<","<<cV[2]->GetPDGCode();
5817  G4cout<<G4endl;
5818 #endif
5819  if(nPart<2||nPart>3)
5820  {
5821  G4cerr<<"---Warning---G4Q::DecayQHadr:n="<<nPart<<",ch#"<<i<<",PDG="<<thePDG<<G4endl;
5822  theFragments->push_back(qH); // Fill as it is (del.equiv.)
5823  return theFragments;
5824  }
5825 #ifdef debug
5826  G4cout<<"G4Q::DecQH:Decay("<<ElMaDecays<<") PDG="<<thePDG<<t<<m_value<<",nP="<<nPart<<G4endl;
5827 #endif
5828  if(nPart==2)
5829  {
5830  G4QHadron* fHadr;
5831  G4QHadron* sHadr;
5832  G4int fPDG=cV[0]->GetPDGCode();
5833  G4int sPDG=cV[1]->GetPDGCode();
5834  // Radiative decays In2 (eta, eta', Sigma0) are closed if the ElMaDecays=false
5835  if ( (fPDG != 22 && sPDG != 22) || ElMaDecays) {
5836 #ifdef debug
5837  G4cout<<"G4Q::DecQH:Yes2,fPDG="<<fPDG<<",sPDG="<<sPDG<<",EMF="<<ElMaDecays<<G4endl;
5838 #endif
5839  if(cV[0]->GetWidth()==0.)
5840  { // Randomize only the second Hardon or none
5841  fHadr = new G4QHadron(cV[0]->GetPDGCode()); // the First Hadron is created *1*
5842  if(cV[1]->GetWidth()==0.)sHadr = new G4QHadron(sPDG);//theSecondHadron is created
5843  else
5844  {
5845  G4QParticle* sPart=theWorld->GetQParticle(cV[1]);// Pt for theSecondHadron
5846  G4double sdm = m_value - fHadr->GetMass(); // MaxMassLimit for the 2-nd Hadron
5847  sHadr = new G4QHadron(sPart,sdm); // the Second Hadron is created *2*
5848  if(sPDG<0) sHadr->MakeAntiHadron();
5849  }
5850  }
5851  else // Randomize masses ofBothHadrons
5852  {
5853  G4QParticle* sPart=theWorld->GetQParticle(cV[1]);// Pt for theSecondHadron
5854  G4double mim = sPart->MinMassOfFragm(); // MinMassLimit for theSecondHadr
5855  G4double fdm = m_value - mim; // MaxMassLimit for theFirstHadr
5856  G4QParticle* fPart=theWorld->GetQParticle(cV[0]);// Pt for the First Hadron
5857  fHadr = new G4QHadron(fPart,fdm); // the 1-st Hadron is initialized
5858  if(fPDG<0) fHadr->MakeAntiHadron();
5859  G4double fm=fHadr->GetMass(); // Mass of the first hadron
5860  G4double sdm = m_value - fm; // MaxMassLimit for theSecondHadr
5861  sHadr = new G4QHadron(sPart,sdm); // the 2-nd Hadron is initialized
5862  if(sPDG<0) sHadr->MakeAntiHadron();
5863 #ifdef debug
5864  G4cout<<"G4Q::DQH:M="<<m_value<<",mi="<<mim<<",fd="<<fdm<<",fm="<<fm<<",sd="<<sdm
5865  <<",sm="<<sHadr->GetMass()<<G4endl;
5866 #endif
5867  }
5868 #ifdef debug
5869  G4cout<<"G4Q::DQH:(DecayIn2)1="<<fHadr->GetMass()<<",2="<<sHadr->GetMass()<<G4endl;
5870 #endif
5871  if(pap)
5872  {
5873  fHadr->MakeAntiHadron();
5874  sHadr->MakeAntiHadron();
5875  }
5876  G4LorentzVector f4Mom = fHadr->Get4Momentum(); // Get First Hadron 4Mom (mass)
5877  G4LorentzVector s4Mom = sHadr->Get4Momentum(); // Get Second Hadron 4Mom (mass)
5878  if(!qH->DecayIn2(f4Mom,s4Mom)) // Error in DecayIn2
5879  {
5880  delete fHadr; // Delete "new fHadr"
5881  delete sHadr; // Delete "new sHadr"
5882 #ifdef debug
5883  G4cerr<<"---Warning---G4Q::DecayQHadron:in2,PDGC="<<thePDG<<", ch#"<<i<<": 4M="
5884  <<qH->Get4Momentum()<<"("<<qH->GetMass()<<")->"<<f4Mom<<"+"<<s4Mom<<G4endl;
5885  //throw G4QException("***Exception***G4Q::DecayQHadron: Failed to decay in 2");
5886 #endif
5887  theFragments->push_back(qH); // Fill as it is (del.equiv.)
5888  return theFragments;
5889  }
5890  else
5891  {
5892  //qH->SetNFragments(2);
5893  //theFragments.push_back(qH); // Fill with NFr=2 (del.equiv.)
5894  // Instead
5895  delete qH; // Delete it (without History)
5896  //
5897  fHadr->Set4Momentum(f4Mom); // Put the randomized 4Mom to 1-st Hadron
5898  G4QHadronVector* theTmpQHV=DecayQHadron(fHadr); // Try to decay
5899  G4int nProd=theTmpQHV->size();
5900 #ifdef debug
5901  G4cout<<"G4Q::DecayQHadr:(DecayIn2) nOfProdForQH1="<<nProd<<G4endl;
5902 #endif
5903  if(nProd==1) theFragments->push_back((*theTmpQHV)[0]);// Final = no Further Decay
5904  else for(G4int ip1=0; ip1<nProd; ip1++)
5905  {
5906  G4QHadronVector* intTmpQHV = DecayQHadron((*theTmpQHV)[ip1]);
5907  G4int tmpS=intTmpQHV->size();
5908  if(tmpS==1)theFragments->push_back((*intTmpQHV)[0]);// Final = no Further Decay
5909  else
5910  {
5911  theFragments->resize(tmpS+theFragments->size());// Resize theFragments length
5912  copy(intTmpQHV->begin(), intTmpQHV->end(), theFragments->end()-tmpS);
5913  }
5914 #ifdef debug
5915  G4cout<<"G4Q::DecayQHadr:(DecayIn2) Copy Sec11 nProd="<<tmpS<<G4endl;
5916 #endif
5917  intTmpQHV->clear();
5918  delete intTmpQHV;
5919  }
5920  theTmpQHV->clear();
5921  delete theTmpQHV;
5922  sHadr->Set4Momentum(s4Mom); // Put the randomized 4Mom to 2-nd Hadron
5923  theTmpQHV=DecayQHadron(sHadr); // Try to decay
5924  nProd=theTmpQHV->size();
5925 #ifdef debug
5926  G4cout<<"G4Q::DecayQHadr:(DecayIn2) nOfProdForQH2="<<nProd<<G4endl;
5927 #endif
5928  if(nProd==1) theFragments->push_back((*theTmpQHV)[0]);// Final = no Further Decay
5929  else for(G4int ip1=0; ip1<nProd; ip1++)
5930  {
5931  G4QHadronVector* intTmpQHV = DecayQHadron((*theTmpQHV)[ip1]);
5932  G4int tmpS=intTmpQHV->size();
5933  if(tmpS==1)theFragments->push_back((*intTmpQHV)[0]);// Final = no Further Decay
5934  else
5935  {
5936  theFragments->resize(tmpS+theFragments->size());// Resize theFragments length
5937  copy(intTmpQHV->begin(), intTmpQHV->end(), theFragments->end()-tmpS);
5938  }
5939 #ifdef debug
5940  G4cout<<"G4Q::DecayQHadr:(DecayIn2) Copy Sec12 nProd="<<tmpS<<G4endl;
5941 #endif
5942  intTmpQHV->clear();
5943  delete intTmpQHV;
5944  }
5945  theTmpQHV->clear();
5946  delete theTmpQHV;
5947  }
5948 #ifdef debug
5949  G4cout<<"G4Q::DecQHadr: DecayIn2 is made with nH="<<theFragments->size()<<G4endl;
5950 #endif
5951  }
5952  else
5953  {
5954 #ifdef debug
5955  if(thePDG==89999003||thePDG==90002999)G4cerr<<"*G4Q::DQH:8999003/90002999"<<G4endl;
5956 #endif
5957  theFragments->push_back(qH); // Fill hadron as it is (del.equivalent)
5958  }
5959  }
5960  else if(nPart==3)
5961  {
5962  G4QHadron* fHadr;
5963  G4QHadron* sHadr;
5964  G4QHadron* tHadr;
5965  G4int fPDG=cV[0]->GetPDGCode();
5966  G4int sPDG=cV[1]->GetPDGCode();
5967  G4int tPDG=cV[2]->GetPDGCode();
5968  //The radiative decays of the GS hadrons In3 are closed if ElMaDecays=false
5969  if ( (fPDG != 22 && sPDG != 22 && tPDG != 22) || ElMaDecays)
5970  {
5971 #ifdef debug
5972  G4cout<<"G4Q::DQH:Y,f="<<fPDG<<",s="<<sPDG<<",t="<<tPDG<<",F="<<ElMaDecays<<G4endl;
5973 #endif
5974  if(cV[0]->GetWidth()==0.) // Don't randomize theFirstHardon
5975  {
5976  fHadr = new G4QHadron(fPDG); // theFirst Hadron is created *1*
5977  if(cV[1]->GetWidth()==0.)
5978  {
5979  sHadr = new G4QHadron(sPDG); // theSecond Hadron is created *2*
5980  if(cV[2]->GetWidth()==0.)tHadr = new G4QHadron(tPDG);//theThirdHadron isCreated
5981  else
5982  {
5983  G4QParticle* tPart=theWorld->GetQParticle(cV[2]);// Pt for the3-rdH
5984  G4double tdm = m_value-fHadr->GetMass()-sHadr->GetMass();// MaxMass for the 2d Hadr
5985  tHadr = new G4QHadron(tPart,tdm); //the3rdHadron is created
5986  if(tPDG<0) tHadr->MakeAntiHadron();
5987  }
5988  }
5989  else // Randomize 2nd & 3rd Hadrons
5990  {
5991  m_value-=fHadr->GetMass(); // Reduce the residual MaxMass
5992  G4QParticle* tPart=theWorld->GetQParticle(cV[2]);// Pt for the 3-rd Hadron
5993  G4double mim = tPart->MinMassOfFragm(); // MinMassLimit for the 3rd Hd
5994  G4double sdm = m_value - mim; // MaxMassLimit for the 2nd Hd
5995  G4QParticle* sPart=theWorld->GetQParticle(cV[1]);// Pt for the 2-nd Hadron
5996  sHadr = new G4QHadron(sPart,sdm); // theSecondHadron is created
5997  if(sPDG<0) sHadr->MakeAntiHadron();
5998  G4double tdm = m_value - sHadr->GetMass(); // MaxMassLimit for the 3-rd H
5999  tHadr = new G4QHadron(tPart,tdm); // the Third Hadron is created
6000  if(tPDG<0) tHadr->MakeAntiHadron();
6001  }
6002  }
6003  else // Randomize masses of all three Hadrons
6004  {
6005  G4QParticle* sPart=theWorld->GetQParticle(cV[1]); // Pt for theSecondHadr
6006  G4double smim = sPart->MinMassOfFragm(); // MinMassLim for SecondHadron
6007  G4QParticle* tPart=theWorld->GetQParticle(cV[2]); // Pt for the Third Hadron
6008  G4double tmim = tPart->MinMassOfFragm(); // MinMassLimit for theThirdHd
6009  G4double fdm = m_value - smim - tmim; // MaxMassLimit for theFirstHd
6010  G4QParticle* fPart=theWorld->GetQParticle(cV[0]); // Pt for the First Hadron
6011  fHadr = new G4QHadron(fPart,fdm); // the First Hadron is created
6012  if(fPDG<0) fHadr->MakeAntiHadron();
6013  m_value-=fHadr->GetMass(); // Reduce the residual MaxMass
6014  G4double sdm = m_value - tmim; // MaxMassLimit for theSecondH
6015  sHadr = new G4QHadron(sPart,sdm); // theSecondHadron is created
6016  if(sPDG<0) sHadr->MakeAntiHadron();
6017  G4double tdm = m_value - sHadr->GetMass(); // MaxMassLimit for theThird H
6018  tHadr = new G4QHadron(tPart,tdm); // the Third Hadron is created
6019  if(tPDG<0) tHadr->MakeAntiHadron();
6020  }
6021 #ifdef debug
6022  G4cout<<"G4Quasmon::DecayQHadron:3Dec. m1="<<fHadr->GetMass()
6023  <<",m2="<<sHadr->GetMass()<<",m3="<<tHadr->GetMass()<<G4endl;
6024 #endif
6025  if(pap)
6026  {
6027  fHadr->MakeAntiHadron();
6028  sHadr->MakeAntiHadron();
6029  tHadr->MakeAntiHadron();
6030  }
6031  G4LorentzVector f4Mom = fHadr->Get4Momentum(); // Get 4M of the First Hadron (mass)
6032  G4LorentzVector s4Mom = sHadr->Get4Momentum(); // Get 4M of the SecondHadron (mass)
6033  G4LorentzVector t4Mom = tHadr->Get4Momentum(); // Get 4M of the Third Hadron (mass)
6034  if(!qH->DecayIn3(f4Mom,s4Mom,t4Mom))
6035  {
6036  delete fHadr; // Delete "new fHadr"
6037  delete sHadr; // Delete "new sHadr"
6038  delete tHadr; // Delete "new tHadr"
6039  G4cerr<<"---Warning---G4Q::DecayQHadron:in3,PDGC="<<thePDG<<", ch#"<<i<<G4endl;
6040  theFragments->push_back(qH); // Fill as it is (delete equivalent)
6041  return theFragments;
6042  }
6043  else
6044  {
6045  //qH->SetNFragments(3);
6046  //theFragments.push_back(q); // Fill with NFr=3 (del.equiv.)
6047  // Instead
6048  delete qH;
6049  //
6050  fHadr->Set4Momentum(f4Mom); // Put the randomized 4Mom to 1-st Hadron
6051  G4QHadronVector* theTmpQHV=DecayQHadron(fHadr); // Try to decay
6052  G4int nProd=theTmpQHV->size();
6053 #ifdef debug
6054  G4cout<<"G4Q::DecayQHadr:(DecayIn3) nOfProdForQH1="<<nProd<<G4endl;
6055 #endif
6056  if(nProd==1) theFragments->push_back((*theTmpQHV)[0]);// Final = no Further Decay
6057  else for(G4int ip1=0; ip1<nProd; ip1++)
6058  {
6059  G4QHadronVector* intTmpQHV = DecayQHadron((*theTmpQHV)[ip1]);
6060  G4int tmpS=intTmpQHV->size();
6061  if(tmpS==1)theFragments->push_back((*intTmpQHV)[0]);// Final = no Further Decay
6062  else
6063  {
6064  theFragments->resize(tmpS+theFragments->size());// Resize theFragments length
6065  copy(intTmpQHV->begin(), intTmpQHV->end(), theFragments->end()-tmpS);
6066  }
6067 #ifdef debug
6068  G4cout<<"G4Q::DecayQHadr:(DecayIn3) Copy Sec11 nProd="<<tmpS<<G4endl;
6069 #endif
6070  intTmpQHV->clear();
6071  delete intTmpQHV;
6072  }
6073  theTmpQHV->clear();
6074  delete theTmpQHV;
6075 
6076  sHadr->Set4Momentum(s4Mom); // Put the randomized 4Mom to 2-nd Hadron
6077  theTmpQHV=DecayQHadron(sHadr); // Try to decay
6078  nProd=theTmpQHV->size();
6079 #ifdef debug
6080  G4cout<<"G4Q::DecayQHadr:(DecayIn3) nOfProdForQH2="<<nProd<<G4endl;
6081 #endif
6082  if(nProd==1) theFragments->push_back((*theTmpQHV)[0]);// Final = no Further Decay
6083  else for(G4int ip1=0; ip1<nProd; ip1++)
6084  {
6085  G4QHadronVector* intTmpQHV = DecayQHadron((*theTmpQHV)[ip1]);
6086  G4int tmpS=intTmpQHV->size();
6087  if(tmpS==1)theFragments->push_back((*intTmpQHV)[0]);// Final = no Further Decay
6088  else
6089  {
6090  theFragments->resize(tmpS+theFragments->size());// Resize theFragments length
6091  copy(intTmpQHV->begin(), intTmpQHV->end(), theFragments->end()-tmpS);
6092  }
6093 #ifdef debug
6094  G4cout<<"G4Q::DecayQHadr:(DecayIn3) Copy Sec12 nProd="<<tmpS<<G4endl;
6095 #endif
6096  intTmpQHV->clear();
6097  delete intTmpQHV;
6098  }
6099  theTmpQHV->clear();
6100  delete theTmpQHV;
6101 
6102  tHadr->Set4Momentum(t4Mom); // Put the randomized 4Mom to 3-rd Hadron
6103  theTmpQHV=DecayQHadron(tHadr); // Try to decay
6104  nProd=theTmpQHV->size();
6105 #ifdef debug
6106  G4cout<<"G4Q::DecayQHadr:(DecayIn3) nOfProdForQH3="<<nProd<<G4endl;
6107 #endif
6108  if(nProd==1) theFragments->push_back((*theTmpQHV)[0]);// Final = no Further Decay
6109  else for(G4int ip1=0; ip1<nProd; ip1++)
6110  {
6111  G4QHadronVector* intTmpQHV = DecayQHadron((*theTmpQHV)[ip1]);
6112  G4int tmpS=intTmpQHV->size();
6113  if(tmpS==1)theFragments->push_back((*intTmpQHV)[0]);// Final = no Further Decay
6114  else
6115  {
6116  theFragments->resize(tmpS+theFragments->size());// Resize theFragments length
6117  copy(intTmpQHV->begin(), intTmpQHV->end(), theFragments->end()-tmpS);
6118  }
6119 #ifdef debug
6120  G4cout<<"G4Q::DecayQHadr:(DecayIn3) Copy Sec13 nProd="<<tmpS<<G4endl;
6121 #endif
6122  intTmpQHV->clear();
6123  delete intTmpQHV;
6124  }
6125  theTmpQHV->clear();
6126  delete theTmpQHV;
6127 
6128  }
6129 #ifdef debug
6130  G4cout<<"G4Q::DecQHadr: DecayIn3 is made with nH="<<theFragments->size()<<G4endl;
6131 #endif
6132  }
6133  else theFragments->push_back(qH); // Fill hadron as it is (del.equivalent)
6134  }
6135  }
6136  else
6137  {
6138 #ifdef debug
6139  G4cout<<"G4Quas::DecQHadr:Fill PDG= "<<thePDG<<t<<m_value<<" as it is ***0***>>"<<G4endl;
6140 #endif
6141  if(thePDG==89999003||thePDG==90002999)G4cerr<<"-War-G4Q::DQH:8999003/90002999"<<G4endl;
6142  theFragments->push_back(qH); // Fill as it is (delete equivalent)
6143  }
6144 #ifdef debug
6145  G4cout<<"G4Q::DecQHadr:=-= HADRON IS DECAYED =-= with nH="<<theFragments->size()<<G4endl;
6146 #endif
6147  return theFragments;
6148 } // End of "DecayOutHadron"
6149 
6150 // Random integer value for the Poiasson Distribution with meanValue
6151 G4int G4Quasmon::RandomPoisson(G4double meanValue)
6152 {
6153  if (meanValue<=0.)
6154  {
6155  G4cerr<<"---Warning---G4Q::RandomPoisson:Negative(zero) MeanValue="<<meanValue<<G4endl;
6156  //throw G4QException("***G4Quasmon::RandomPoisson: negative 0r zero Mean Value");
6157  return -1;
6158  }
6159  G4double r=G4UniformRand();
6160  G4double t=exp(-meanValue);
6161  G4double s_value=t;
6162  if (r<s_value) return 0;
6163  t*=meanValue; // To avoid /1
6164  s_value+=t;
6165  if (r<s_value) return 1;
6166  G4int i=1;
6167  while ( s_value<r && i<100 )
6168  {
6169  i++;
6170  t*=meanValue/i;
6171  s_value+=t;
6172  }
6173  return i;
6174 }
6175 // End of "RandomPoisson"
6176 
6177 //The public Hadronisation routine with delete responsibility of User (!)
6179 {
6180 #ifdef debug
6181  G4cout<<"G4Quasmon::Fragment called E="<<nucEnviron<<nucEnviron.GetProbability()<<G4endl;
6182 #endif
6183  G4int nQs=nQ;
6184  HadronizeQuasmon(nucEnviron,nQs);
6185  G4int nHadrs=theQHadrons.size();
6186 #ifdef debug
6187  G4cout<<"G4Quasm::Fragm:after HadronizeQuasmon nH="<<nHadrs<<",Env="<<nucEnviron<<G4endl;
6188 #endif
6189  G4QHadronVector* theFragments = new G4QHadronVector;// user is responsible for delition !
6190  if(nHadrs) for (int hadron=0; hadron<nHadrs; hadron++)
6191  {
6192  G4QHadron* curHadr = new G4QHadron(theQHadrons[hadron]);
6193  theFragments->push_back(curHadr); // (delete equivalent - user)
6194  }
6195 #ifdef pdebug
6196  else G4cerr<<"*******G4Quasmon::Fragment *** Nothing is in the output ***"<<G4endl;
6197 #endif
6198  return theFragments;
6199 } // End of "Fragment"
6200 
6201 // Boost Quasmon 4-momentum, using Boost Lorentz vector
6202 void G4Quasmon::Boost(const G4LorentzVector& boost4M)
6203 {
6204  // see CERNLIB short writeup U101 for the algorithm
6205  G4double bm=boost4M.mag();
6206  G4double factor = (q4Mom.vect()*boost4M.vect()/(boost4M.e()+bm) - q4Mom.e())/bm;
6207  q4Mom.setE(q4Mom.dot(boost4M)/bm);
6208  q4Mom.setVect(factor*boost4M.vect() + q4Mom.vect());
6209 } // End of Boost