G4QNucleus.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //      ---------------- G4QNucleus ----------------
00030 //             by Mikhail Kossov, Sept 1999.
00031 //      class for Nuclei/Nuclear Environment used by CHIPS Model
00032 // ---------------------------------------------------------------------
00033 // Short description: a class describing properties of nuclei, which
00034 // are necessary for the CHIPS Model.
00035 // ---------------------------------------------------------------------
00036 
00037 
00038 //#define debug
00039 //#define pdebug 
00040 //#define cldebug
00041 //#define qdebug
00042 //#define cldebug
00043 //#define pardeb
00044 //#define ppdebug
00045 
00046 #include <algorithm>
00047 #include <cmath>
00048 #include <vector>
00049 
00050 #include "G4QNucleus.hh"
00051 #include "Randomize.hh"
00052 #include "G4PhysicalConstants.hh"
00053 #include "G4SystemOfUnits.hh"
00054 
00055 using namespace std;
00056 
00057 // Static parameters definition
00058 G4double G4QNucleus::freeNuc=0.1;       // probability to find quasiFreeBaryon on Surface
00059 G4double G4QNucleus::freeDib=.05;       // probability to find quasiFreeDiBaryon on Surface
00060 G4double G4QNucleus::clustProb=4.;      // clusterization probability in dense region
00061 G4double G4QNucleus::mediRatio=1.;      // relative vacuum hadronization probability
00062 G4double G4QNucleus::nucleonDistance=.8*fermi; // Distance between nucleons (0.8 fm) (Body)
00063 G4double G4QNucleus::WoodSaxonSurf=.545*fermi; // WoodSaxon Surface Param (0.545 fm) (Body)
00064 
00065 G4QNucleus::G4QNucleus(): G4QHadron(), Z(0), N(0), S(0), dZ(0), dN(0), dS(0), maxClust(0),
00066                           theNucleons(),currentNucleon(-1),
00067                           rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
00068 {
00069   probVect[0]=mediRatio;
00070   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00071 #ifdef pardeb
00072   G4cout<<"G4QNucleus::Constructor:(1) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00073         <<", R="<<mediRatio<<G4endl;
00074 #endif
00075 }
00076 
00077 G4QNucleus::G4QNucleus(G4int z, G4int n, G4int s_value) :
00078   G4QHadron(90000000+s_value*1000000+z*1000+n), Z(z),N(n),S(s_value), dZ(0),dN(0),dS(0), maxClust(0),
00079   theNucleons(), currentNucleon(-1), rho0(1.), radius(1.),
00080   Tb(), TbActive(false), RhoActive(false)
00081 {
00082   probVect[0]=mediRatio;
00083   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00084 #ifdef debug
00085   G4cout<<"G4QNucleus::Construction By Z="<<z<<",N="<<n<<",S="<<s_value<<G4endl;
00086 #endif
00087   SetZNSQC(z,n,s_value);
00088   G4QPDGCode nQPDG(90000000+S*1000000+Z*1000+N); // Not necessary (? look above)
00089 #ifdef debug
00090   G4cout<<"G4QNucleus::ConstructionByZNS: nQPDG="<<nQPDG<<G4endl;
00091 #endif
00092   G4double mass=nQPDG.GetNuclMass(Z,N,S);
00093 #ifdef debug
00094   G4cout<<"G4QNucleus::ConstructionByZNS: mass="<<mass<<G4endl;
00095 #endif
00096   SetQPDG(nQPDG);                                // Not necessary (? look above)
00097 #ifdef debug
00098   G4cout<<"G4QNucleus::ConstructionByZNS: nQPDG set"<<G4endl;
00099 #endif
00100   G4LorentzVector p(0.,0.,0.,mass);
00101   Set4Momentum(p);
00102   SetNFragments(0);
00103 #ifdef debug
00104   G4cout<<"G4QNucleus::Constructor:(2) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00105         <<", R="<<mediRatio<<G4endl;
00106 #endif
00107 }
00108 
00109 G4QNucleus::G4QNucleus(G4int nucPDG):
00110   G4QHadron(nucPDG), maxClust(0), theNucleons(),
00111   currentNucleon(-1), rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
00112 {
00113   if(nucPDG==22) nucPDG=90000000;
00114   InitByPDG(nucPDG);
00115   G4LorentzVector p(0.,0.,0.,GetGSMass());
00116   Set4Momentum(p);
00117 #ifdef pardeb
00118   G4cout<<"G4QNucleus::Constructor:(3) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00119         <<", R="<<mediRatio<<", 4M="<<p<<G4endl;
00120 #endif
00121 }
00122 
00123 G4QNucleus::G4QNucleus(G4LorentzVector p, G4int nucPDG):
00124   G4QHadron(nucPDG, p), maxClust(0), theNucleons(),
00125   currentNucleon(-1), rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
00126 {
00127   InitByPDG(nucPDG);
00128   Set4Momentum(p);
00129 #ifdef pardeb
00130   G4cout<<"G4QNucleus::Constructor:(4) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00131         <<", R="<<mediRatio<<", 4M="<<p<<G4endl;
00132 #endif
00133 }
00134 
00135 G4QNucleus::G4QNucleus(G4int z, G4int n, G4int s_value, G4LorentzVector p) :
00136   G4QHadron(90000000+s_value*1000000+z*1000+n,p), Z(z),N(n),S(s_value), dZ(0),dN(0),dS(0), maxClust(0),
00137   theNucleons(), currentNucleon(-1), rho0(1.),radius(1.),
00138   Tb(), TbActive(false), RhoActive(false)
00139 {
00140   probVect[0]=mediRatio;
00141   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00142   Set4Momentum(p);
00143   SetNFragments(0);
00144   G4int ZNS=Z+N+S;
00145   G4QPDGCode nPDG(90000000+S*1000000+Z*1000+N);
00146   SetQPDG(nPDG);
00147   G4QContent nQC(N+ZNS,Z+ZNS,S,0,0,0);
00148   SetZNSQC(z,n,s_value);
00149 #ifdef pardeb
00150   G4cout<<"G4QNucleus::Constructor:(5) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00151         <<", R="<<mediRatio<<G4endl;
00152 #endif
00153 }
00154 
00155 G4QNucleus::G4QNucleus(G4QContent nucQC):
00156   G4QHadron(nucQC), dZ(0), dN(0), dS(0), maxClust(0), theNucleons(), currentNucleon(-1),
00157   rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
00158 {
00159   static const G4double mPi0 = G4QPDGCode(111).GetMass();
00160 #ifdef debug
00161   G4cout<<"G4QNucleus::Construction By QC="<<nucQC<<G4endl;
00162 #endif
00163   probVect[0]=mediRatio;
00164   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00165   G4int u=nucQC.GetU()-nucQC.GetAU();
00166   G4int d=nucQC.GetD()-nucQC.GetAD();
00167   S = nucQC.GetS()-nucQC.GetAS();     // a#of LAMBDA's in the nucleus
00168   G4int du= d-u;                      // isotopic shift
00169   G4int b =(d+u+S)/3;                 // baryon number
00170   Z = (b-S-du)/2;                     // protons
00171   N = Z+du;                           // neutrons
00172   SetQC(nucQC);
00173 #ifdef debug
00174   G4cout<<"G4QNucleus::ConstructionByQC: N="<<N<<",Z="<<Z<<",S="<<S<<G4endl;
00175 #endif
00176   G4int nucPDG=90000000+S*1000000+Z*1000+N;
00177   G4QPDGCode nQPDG(nucPDG);
00178 #ifdef debug
00179   G4cout<<"G4QNucleus::ConstructionByQC: nQPDG="<<nQPDG<<G4endl;
00180 #endif
00181   G4double mass=nQPDG.GetNuclMass(Z,N,S);
00182   if(nucPDG==90000000)
00183   {
00184     if(nucQC.GetTot()) mass=mPi0;
00185     else               mass=0.;
00186   }
00187 #ifdef debug
00188   G4cout<<"G4QNucleus::ConstructionByQC: mass="<<mass<<G4endl;
00189 #endif
00190   SetQPDG(nQPDG);
00191 #ifdef debug
00192   G4cout<<"G4QNucleus::ConstructionByQC: nQPDG set"<<G4endl;
00193 #endif
00194   G4LorentzVector p(0.,0.,0.,mass);
00195   Set4Momentum(p);
00196   SetNFragments(0);
00197 #ifdef pardeb
00198   G4cout<<"G4QNucleus::Constructor:(6) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00199         <<", R="<<mediRatio<<G4endl;
00200 #endif
00201 }
00202 
00203 G4QNucleus::G4QNucleus(G4QContent nucQC, G4LorentzVector p):
00204   G4QHadron(nucQC,p), dZ(0), dN(0), dS(0), maxClust(0), theNucleons(), currentNucleon(-1),
00205   rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
00206 {
00207 #ifdef debug
00208   G4cout<<"G4QNucleus::(LV)Construction By QC="<<nucQC<<G4endl;
00209 #endif
00210   probVect[0]=mediRatio;
00211   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00212   Set4Momentum(p);
00213   G4int u=nucQC.GetU()-nucQC.GetAU();
00214   G4int d=nucQC.GetD()-nucQC.GetAD();
00215   S = nucQC.GetS()-nucQC.GetAS();     // a#of LAMBDA's in the nucleus
00216   G4int du= d-u;                      // isotopic shift
00217   G4int b =(d+u+S)/3;                 // baryon number
00218   Z = (b-S-du)/2;                     // protons
00219   N = Z+du;                           // neutrons
00220   SetQC(nucQC);
00221 #ifdef debug
00222   G4cout<<"G4QNucleus::(LV)ConstructionByQC: N="<<N<<",Z="<<Z<<",S="<<S<<G4endl;
00223 #endif
00224   G4QPDGCode nPDG(90000000+S*1000000+Z*1000+N);
00225   SetQPDG(nPDG);
00226   SetNFragments(0);
00227 #ifdef pardeb
00228   G4cout<<"G4QNucleus::Constructor:(7) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00229         <<", R="<<mediRatio<<G4endl;
00230 #endif
00231 }
00232 
00233 G4QNucleus::G4QNucleus(G4QNucleus* right, G4bool cop3D) : currentNucleon(-1)
00234 {
00235   Z             = right->Z;
00236   N             = right->N;
00237   S             = right->S;
00238   dZ            = right->dZ;
00239   dN            = right->dN;
00240   dS            = right->dS;
00241   maxClust      = right->maxClust;
00242   for(G4int i=0; i<=maxClust; i++) probVect[i] = right->probVect[i];
00243   probVect[254] = right->probVect[254];
00244   probVect[255] = right->probVect[255];
00245   Tb            = right->Tb;
00246   TbActive      = right->TbActive;
00247   RhoActive     = right->RhoActive;
00248   Set4Momentum   (right->Get4Momentum());
00249   SetQPDG        (right->GetQPDG());
00250   SetQC          (right->GetQC());
00251   SetNFragments  (right->GetNFragments());
00252   rho0        = right->rho0;
00253   radius      = right->radius;
00254   if(cop3D)
00255   {
00256     G4int nn=right->theNucleons.size();
00257     for(G4int i=0; i<nn; ++i)
00258     {
00259       G4QHadron* nucleon = new G4QHadron(right->theNucleons[i]);
00260       theNucleons.push_back(nucleon);
00261     }
00262   }
00263 #ifdef pardeb
00264   G4cout<<"G4QNucleus::Constructor:(8) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00265         <<", R="<<mediRatio<<G4endl;
00266 #endif
00267 }
00268 
00269 G4QNucleus::G4QNucleus(const G4QNucleus &right, G4bool cop3D):
00270   G4QHadron(), currentNucleon(-1)
00271 {
00272   Z             = right.Z;
00273   N             = right.N;
00274   S             = right.S;
00275   dZ            = right.dZ;
00276   dN            = right.dN;
00277   dS            = right.dS;
00278   maxClust      = right.maxClust;
00279   for(G4int i=0; i<=maxClust; i++) probVect[i] = right.probVect[i];
00280   probVect[254] = right.probVect[254];
00281   probVect[255] = right.probVect[255];
00282   Tb            = right.Tb;
00283   TbActive      = right.TbActive;
00284   RhoActive     = right.RhoActive;
00285   Set4Momentum   (right.Get4Momentum());
00286   SetQPDG        (right.GetQPDG());
00287   SetQC          (right.GetQC());
00288   SetNFragments  (right.GetNFragments());
00289   rho0        = right.rho0;
00290   radius      = right.radius;
00291   if(cop3D)
00292   {
00293     G4int nn=right.theNucleons.size();
00294     for(G4int i=0; i<nn; ++i)
00295     {
00296       G4QHadron* nucleon = new G4QHadron(right.theNucleons[i]);
00297       theNucleons.push_back(nucleon);
00298     }
00299   }
00300 #ifdef pardeb
00301   G4cout<<"G4QNucleus::Constructor:(9) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
00302         <<", R="<<mediRatio<<G4endl;
00303 #endif
00304 }
00305 
00306 // Assignment operator
00307 const G4QNucleus& G4QNucleus::operator=(const G4QNucleus& right)
00308 {
00309   if(this != &right)                          // Beware of self assignment
00310   {
00311     currentNucleon= -1;
00312     TbActive      = right.TbActive;
00313     Tb            = right.Tb;
00314     RhoActive     = right.RhoActive;
00315     rho0          = right.rho0;
00316     radius        = right.radius;
00317     G4int nn      = right.theNucleons.size();
00318     for(G4int i=0; i < nn; ++i)
00319     {
00320       G4QHadron* nucleon = new G4QHadron(right.theNucleons[i]);
00321       theNucleons.push_back(nucleon);
00322     }
00323     Set4Momentum   (right.Get4Momentum());
00324     SetQPDG        (right.GetQPDG());
00325     SetQC          (right.GetQC());
00326     SetNFragments  (right.GetNFragments());
00327     Z             = right.Z;
00328     N             = right.N;
00329     S             = right.S;
00330     dZ            = right.dZ;
00331     dN            = right.dN;
00332     dS            = right.dS;
00333     maxClust      = right.maxClust;
00334     for(G4int i=0; i<=maxClust; i++) probVect[i] = right.probVect[i];
00335     probVect[254] = right.probVect[254];
00336     probVect[255] = right.probVect[255];
00337   }
00338   return *this;
00339 }
00340 
00341 G4QNucleus::~G4QNucleus()
00342 {
00343   for_each(theNucleons.begin(),theNucleons.end(),DeleteQHadron());
00344 }
00345 
00346 // Fill the private parameters
00347 void G4QNucleus::SetParameters(G4double a,G4double b, G4double c, G4double d, G4double e)
00348 {
00349   freeNuc=a; 
00350   freeDib=b; 
00351   clustProb=c;
00352   mediRatio=d;
00353   nucleonDistance=e;
00354 }
00355 
00356 // Standard output for QNucleus {Z - a#of protons, N - a#of neutrons, S - a#of lambdas}
00357 ostream& operator<<(ostream& lhs, G4QNucleus& rhs)
00358 {
00359  lhs<<"{Z="<<rhs.GetZ()<<",N="<<rhs.GetN()<<",S="<<rhs.GetS()<<",M="<<rhs.GetGSMass()<<"}";
00360  return lhs;
00361 }
00362 
00363 // Standard output for QNucleus {Z - a#of protons, N - a#of neutrons, S - a#of lambdas}
00364 ostream& operator<<(ostream& lhs, const G4QNucleus& rhs)
00365 {
00366   lhs<<"{Z="<<rhs.GetZ()<<",N="<<rhs.GetN()<<",S="<<rhs.GetS()<< "}";
00367   return lhs;
00368 }
00369 
00370 // Init existing nucleus by new PDG Code
00371 void G4QNucleus::InitByPDG(G4int nucPDG)
00372 {
00373   static const G4int NUCPDG  = 90000000;
00374 #ifdef debug
00375   G4cout<<"G4QNucleus::InitByPDG: >Called< PDG="<<nucPDG<<G4endl;
00376 #endif
00377   dZ=0;
00378   dN=0;
00379   dS=0;
00380   probVect[0]=mediRatio;                        // init Vacuum/Medium probability
00381   for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
00382   //std::uninitialized_fill( probVect+1, probVect+256, 0.0 ); // Worse in performance!
00383   if(nucPDG<80000000) nucPDG=HadrToNucPDG(nucPDG); // Convert HadrPDGCode to NucPDGCode
00384   G4int s_value=0;
00385   G4int z=0;
00386   G4int n=0;
00387   if(nucPDG>80000000 && nucPDG<100000000) // Try to convert the NUCCoding to PDGCoding
00388   {
00389     G4QPDGCode(22).ConvertPDGToZNS(nucPDG, z, n, s_value);
00390     Z  =z;
00391     N  =n;
00392     S  =s_value;
00393 #ifdef debug
00394     G4cout<<"G4QNucleus::InitByPDG:Z="<<Z<<",N="<<N<<",S="<<S<<G4endl;
00395 #endif
00396     SetZNSQC(Z,N,S);  // @@ ??
00397     G4QPDGCode nPDG(nucPDG);
00398     G4double PDGMass=0.;
00399     if(nucPDG!=NUCPDG) PDGMass=nPDG.GetMass();
00400     SetQPDG(nPDG);
00401     G4LorentzVector p(0.,0.,0.,PDGMass);
00402     Set4Momentum(p);
00403     SetNFragments(0);
00404 #ifdef debug
00405     G4cout<<"G4QNucleus::InitByPDG:->QPDG="<<nPDG<<": 4M="<<p<<G4endl;
00406 #endif
00407   }
00408   else
00409   {
00410     G4cerr<<"***G4QNucleus::InitByPDG:Initialized by not nuclear PDGCode="<<nucPDG<<G4endl;
00411     //throw G4QException("G4QNucleus::InitByPDG:PDGCode can't be converted to NucPDGCode");
00412   }
00413 }
00414 // End of "InitByPDG"
00415 
00416 // Calculate probabilities of clusters and return the maximum baryon number of clusters
00417 G4int G4QNucleus::UpdateClusters(G4bool din) // din true means use only dense nuclear part
00418 {
00419   //static const G4double r0 = 1.1;          // fm, for nuclear radius: r=r0*A^(1/3)
00420   //static const G4double del= .55;          // fm, for a difused surface of the nucleus
00421   //static const G4double rCl= 2.0;          // clusterization radius @@??
00422   //static const G4double freeibuc = 0.10;   // probab. of the quasi-free baryon on surface
00423   //static const G4double freeDib = 0.05;    // probab. of the quasi-free dibar. on surface
00424   //static const G4double clustProb = 4.0;   // clusterization probability in dense region
00425   //static const G4double prQ = 1.0;         // relative probability for a Quasmon
00426   //static const G4double prQ = 0.;          //@@for pi@@relative probability for Quasmon
00427   //G4double probSInt[254];                    // integratedStaticProbabilities @@ not used
00428   probVect[0]=mediRatio;
00429   for (G4int in=1; in<256; in++) probVect[in]=0.; // Make preinit to avoid the postinit
00430   //probSInt[0]=0;                             // integrated static probabilities
00431   dZ=0;
00432   dN=0;
00433   dS=0;
00434   G4int a = Z + N + S;                       // atomic number
00435 #ifdef debug
00436   G4cout<<"G4QN::UpdateCl:A="<<a<<"(Z="<<Z<<",N="<<N<<",S="<<S<<"),mR="<<mediRatio<<G4endl;
00437 #endif
00438   G4double A=a;
00439   if(A<=0.)
00440   {
00441 #ifdef debug
00442     G4cout<<"***G4QNucleus::UpdateClusters:No clusters can be calculated as A="<<A<<G4endl;
00443 #endif
00444     return 0;
00445   }
00446   G4double surf=freeNuc+freeDib;             // surface relative population
00447   G4double surA=A*surf;                      // surface absolute population
00448   G4int sA=static_cast<G4int>(surA);
00449   if(surf>0.||surf<1.)sA=RandomizeBinom(surf,a); // randomize SurfaceNucleons by Binomial
00450 #ifdef debug
00451   G4cout<<"G4QN::UpdateCl:surf="<<surf<<"= N="<<freeNuc<<"+D="<<freeDib<<",A="<<sA<<G4endl;
00452 #endif
00453   G4int dA=a-sA;                             // a#of nucleons in dense part of the nucleus
00454   if (din && dA<2 && a>2)
00455   {
00456     dA=2;
00457     sA=a-2;
00458   }
00459 #ifdef debug
00460   G4cout<<"G4QN::UpdtC:dA="<<dA<<",A="<<A<<",s="<<surf<<",S="<<sA<<",C="<<maxClust<<G4endl;
00461 #endif
00462   G4int maxi=1;                              // A#of elements filled by the progran
00463   G4double pA=0.;
00464   G4double uA=0.;
00465   if(surf>0.)
00466   {
00467     pA=0.5*freeDib*sA/surf; //@@Randomize(?)// a#of quasi-free Nucleon Pairs on the surface
00468     uA=sA-pA-pA;                             // a#of quasi-free nucleons on Nuclear Surface
00469   }
00470   uA=uA/A;                                   // Normalization of probability
00471   pA=pA/A;
00472   G4double sum =0.;
00473   if(dA<2)                                   // There is no dense phase at all
00474   {
00475     //probVect[1]= dA/A;                       // a#of quasi-free nucleons (only dense)
00476     //probVect[1]= (uA+dA)/A;                  // a#of quasi-free nucleons (different norm)
00477     probVect[1]= uA+dA/A;                    // a#of quasi-free nucleons (correct)
00478     sum = probVect[1];
00479     //probSInt[1]=sum;                         // integrated static probabilities
00480     maxi=2;
00481     probVect[254]= 0;                        // a#of dense nucleons (correct)
00482     if(A>1 && pA>0.)
00483     {
00484       //probVect[2]= (pA+pA)/A/(A-1);          // a#of quasi-free "dibaryons" (correct)
00485       probVect[2]= pA;                       // a#of quasi-free "dibaryons" (correct)
00486       //probVect[2]= 0;                        // a#of quasi-free "dibaryons" (only dense)
00487       sum+= probVect[2]+probVect[2];
00488       //probSInt[2]=sum;                       // integrated static probabilities
00489       maxi=3;
00490       probVect[255]= 0;                      // a#of dense "dibaryons" (correct)
00491     }
00492 #ifdef debug
00493     G4cout<<"G4QNucleus::UpdateClust:Only quasi-free nucleons pV[1]="<<probVect[1]<<G4endl;
00494 #endif
00495   }
00496   else
00497   {
00498     G4double wrd=clustProb/dA;               // relative volume of clusterization (omega)
00499     G4double sud=pow(1.+wrd,dA-1);           // normalization factor for the dense region
00500     // dA=C*Sum_k=1-A[n*C^A_k*wrd^(k-1)]=C*dA*(1+wrd)^(dA-1) => C=1/sud, sud=(1+wrd)^(dA-1)
00501     // =1
00502     G4double rd= dA/sud/A;
00503     //G4double comb=A;
00504     //G4double prb=rd;                              // (only dense)
00505     G4double prb=rd+uA;
00506     sum =prb;
00507 #ifdef debug
00508    G4cout<<"G4QNucl::UpdateCl:sud="<<sud<<",v[1]=s="<<sum<<",dA="<<dA<<",uA="<<uA<<G4endl;
00509 #endif
00510     //probVect[1]= prb/comb;                   // a#of quasi-free nucleons (correct)
00511     //probVect[254]= rd/comb;                  // a#of dense nucleons (correct)
00512     probVect[1]= prb;                        // a#of quasi-free nucleons (correct)
00513     probVect[254]= rd;                       // a#of dense nucleons (correct)
00514     //probSInt[1]=sum;                         // integrated static probabilities
00515     // =2
00516     rd*=wrd*(dA-1.)/2;
00517     //comb*=(A-1.)/2;
00518     //prb=rd;                                  // (only dense)
00519     prb=rd+pA;
00520     sum+=prb+prb;
00521 #ifdef debug
00522     G4cout<<"G4QNucl::UpdateCl:sud="<<sud<<",v[2]="<<prb<<",s="<<sum<<",pA="<<pA<<G4endl;
00523 #endif
00524     //probVect[2]= prb/comb;                   // a#of quasi-free "dibaryons" (correct)
00525     //probVect[255]= rd/comb;                  // a#of dense "dibaryons" (correct)
00526     probVect[2]= prb;                        // a#of quasi-free "dibaryons" (correct)
00527     probVect[255]= rd;                       // a#of dense "dibaryons" (correct)
00528     //probSInt[2]=sum;                         // integrated static probabilities
00529     // >2
00530     maxi=3;
00531 #ifdef debug
00532     G4cout<<"G4QNucleus::UpdateClusters:p1="<<probVect[1]<<", p2="<<probVect[2]<<",sA="<<sA
00533           <<",uA="<<uA<<",pA="<<pA<<",wrd="<<wrd<<",sud="<<sud<<G4endl;
00534 #endif
00535     if(dA>2)
00536     {
00538       G4double idA=dA+1.; 
00539       G4int dLim=dA;
00540       if(maxClust<dA) dLim=maxClust;
00541       for (int i=3; i<=dLim; i++)
00542       {
00543         rd*=wrd*(idA-i)/i;
00544         sum+=rd*i;
00545 #ifdef debug
00546      G4cout<<"G4QNucleus::UpdateCl:sud="<<sud<<", v["<<i<<"]="<<rd<<", s="<<sum<<G4endl;
00547 #endif
00548         //comb*=(itA-i)/i;
00549         //probVect[i]=rd/comb;                 // Divide by sum of combinations for N+Z+S
00550         probVect[i]=rd;                      // Comb's for N,Z,S are canceled later(G4QNuc)
00551         //probSInt[i]=sum;                     // integrated static probabilities
00552         maxi=i+1;
00553 #ifdef debug
00554         G4cout<<"G4QNucleus::UpdateCl:Cluster of "<<i<<" baryons,pV="<<probVect[i]<<G4endl;
00555 #endif
00556       }
00557     }
00558     dS = S;                                  // @@ Lambdas are always in the dense region
00559     dZ = static_cast<int>(static_cast<double>((dA-dS)*Z)/(Z+N) + 0.5);
00560     dN = dA - dZ;
00561   }
00562 #ifdef debug
00563   G4cout<<"G4QNucleus::UpdateClusters: Sum of weighted probabilities s="<<sum<<G4endl;
00564 #endif
00565   maxClust=maxi-1;
00566   //for (G4int j=maxi; j<255; j++) probVect[j]=0.;//Make the rest to be 0 [preinited above]
00567   // =----------------= From here probability randomization starts =---------------=
00568   //  G4int rA=a;                              // Residual number of nucleons
00569   //#ifdef debug
00570   //G4cout<<"G4QNuc::UpdateClust:A="<<A<<",M="<<k<<",P1="<<probVect[1]<<",P2="<<probVect[2]
00571   //      <<G4endl;
00572   //#endif
00573   //if (k>1) for (j=k; j>1; j--)               // nucleons are not randomized
00574   //{
00575   //  G4int jmax=rA/j;                         // Max number of this kind of clusters
00576   //  if (jmax)
00577   //  {
00578   //    G4double prob=probVect[j]/probSInt[j]; // Probab of the cluster in the dest nucleus
00579   //#ifdef debug
00580   //    G4cout<<"G4QNucl::UpdateClusters: j="<<j<<",sP="<<probVect[j]<<",iP="<<probSInt[j]
00581   //          <<G4endl;
00582   //#endif
00583   // G4int m=RandomizeBinom(prob,jmax);     // A#of clusters of this type
00584   //    if(m)
00585   //    {
00586   //      probVect[j]=m;
00587   //      rA-=m*j;
00588   //    }
00589   //    else
00590   //    {
00591   //      probVect[j]=0.;
00592   //      if(j==maxClust) maxClust--;
00593   //    }
00594   //#ifdef debug
00595   //    G4cout<<"G4QNucl::UpdateClust:p="<<prob<<",r="<<rA<<",m="<<jmax<<",P="<<probVect[j]
00596   //          <<G4endl;
00597   //#endif
00598   //  }
00599   //  else
00600   //  {
00601   //    probVect[j]=0.;
00602   //    if(j==maxClust) maxClust--;
00603   //  }
00604   //}
00605   //probVect[1]=rA;
00606   // =------------------= From here probability randomization starts =-------------------=
00607   return maxClust;
00608 }
00609 // End of "UpdateClusters"
00610 
00611 // Reduce the 3D Nucleus by the used nucleon + update nucleon's energies (in LS!)
00612 void G4QNucleus::SubtractNucleon(G4QHadron* uNuc)
00613 {
00614   G4int NotFound=true;                              // Not found flag
00615   G4QHadronVector::iterator u;                      // iterator of the used nucleon
00616   for(u=theNucleons.begin(); u!=theNucleons.end(); u++)
00617   {
00618 #ifdef debug
00619     G4cout<<"G4QNucleus::SubtractNucleon: LOOP 4M="<<(*u)->Get4Momentum()<<G4endl;
00620 #endif
00621     if (uNuc==*u)                                   // Find uNuceon-pointer
00622     {
00623       NotFound=false;
00624       break;
00625     }
00626   }
00627 //  if(NotFound) throw G4QException("G4QNucleus::SubtractNucleon: The nucleon isn't found");
00628   if (NotFound) G4Exception("G4QNucleus::SubtractNucleon()", "HAD_CHPS_0000",
00629                             FatalException, "The nucleon isn't found");
00630   else
00631   {
00632     G4int tPDG=GetPDGCode();                    // Nucleus PDG before the subtraction
00633     G4LorentzVector t4M=Get4Momentum();         // Nucleus 4-mom before the subtraction
00634 #ifdef debug
00635     G4cout<<"G4QNucleus::SubtractNucleon: InitialNucleus 4M="<<t4M<<", PDG="<<tPDG<<", nN="
00636           <<theNucleons.size()<<G4endl;
00637 #endif
00638     G4int uPDG=(*u)->GetPDGCode();              // PDG code of the subtracted nucleon
00639     G4LorentzVector u4M=(*u)->Get4Momentum();   // 4-momentum of the subtracted nucleon
00640 #ifdef debug
00641     G4cout<<"G4QNucleus::SubtractNucleon: subtractNucleon 4M="<<u4M<<",PDG="<<uPDG<<G4endl;
00642 #endif
00643     delete *u;                                  // Delete the nucleon as an object
00644     theNucleons.erase(u);                       // exclude the nucleon pointer from the HV
00645     --currentNucleon;                           // Continue selection from theSame position
00646     t4M-=u4M;                                   // Update the nucleus 4-momentum VALUE
00647     if     (uPDG==2212) tPDG-=1000;             // Reduce the nucleus PDG Code by a proton
00648     else if(uPDG==2112) tPDG--;                 // Reduce the nucleus PDG Code by a neutron
00649     else
00650     {
00651       // G4cerr<<"***G4QNucleus::SubtractNucleon: Unexpected Nucleon PDGCode ="<<uPDG<<G4endl;
00652       // throw G4QException("G4QNucleus::SubtractNucleon: Impossible nucleon PDG Code");
00653       G4ExceptionDescription ed;
00654       ed << "Impossible nucleon PDG Code: Unexpected Nucleon PDGCode ="
00655          << uPDG << G4endl;
00656       G4Exception("G4QNucleus::SubtractNucleon()", "HAD_CHPS_0001",
00657                   FatalException, ed);
00658     }
00659 #ifdef debug
00660     G4cout<<"G4QNucleus::SubtractNucleon: theResidualNucleus PDG="<<tPDG<<", 4M="<<t4M
00661           <<", nN="<<theNucleons.size()<<G4endl;
00662 #endif
00663     InitByPDG(tPDG);                            // Reinitialize the nucleus, not 3D nucleus
00664     theMomentum=t4M;                            // Fill the residual 4-momentum
00665     //#ifdef debug
00666     G4double mR2=sqr(GetGSMass());              // Real squared residual nucleus mass 
00667     G4double tM2=t4M.m2();                      // Squared residual nucleus mass from 4M 
00668 #ifdef debug
00669     G4cout<<"G4QNucleus::SubtractNucleon: rAm2="<<mR2<<" =? 4Mm2="<<tM2<<G4endl;
00670     G4int cnt=0;                                // Counter of nucleons for print
00671 #endif
00672     if(std::fabs(mR2-tM2)>.01)G4cout<<"*G4QNucleus::SubNucleon:rM="<<mR2<<"#"<<tM2<<G4endl;
00673     //#endif
00674     G4double tE=t4M.e();                        // Energy of the residual nucleus (in CM!)
00675     G4double m2p=sqr(G4QNucleus(tPDG-1000).GetGSMass()); // subResid. nuclearM2 for protons
00676     G4double m2n=sqr(G4QNucleus(tPDG-1).GetGSMass()); // subResidual nuclearM2 for neutrons
00677     for(u=theNucleons.begin(); u!=theNucleons.end(); u++) // Correct the nucleon's energies
00678     {
00679       G4LorentzVector n4M=(*u)->Get4Momentum(); // 4-mom of the current nucleon
00680       G4double srP2=(t4M-n4M).vect().mag2();    // p2 of the subResNucleus
00681       G4double m2_value=m2n;                    // default subResNucleusM2 (for neutrons) 
00682       if((*u)->GetPDGCode()==2212) m2_value=m2p;// change it to subResNucleusM2 for protons
00683       G4double srE=std::sqrt(srP2+m2_value);    // Energy of the subResNucleus
00684 #ifdef debug
00685       G4cout<<"G4QNucleus::SubtractNucleon:#"<<cnt++<<", correctedEnergy="<<tE-srE<<G4endl;
00686 #endif
00687       n4M.setE(tE-srE);                         // Update the energy of the nucleon
00688       (*u)->Set4Momentum(n4M);                  // Update the 4-momentum of the nucleon
00689     }
00690   }
00691 #ifdef debug
00692   G4cout<<"G4QNucleus::SubtractNucleon:ResNuc4M="<<theMomentum<<",Z="<<Z<<",N="<<N<<G4endl;
00693 #endif
00694 }
00695 
00696 // Delete all residual nucleons
00697 void G4QNucleus::DeleteNucleons()
00698 {
00699   G4QHadronVector::iterator u;                      // iterator for the nucleons
00700   for(u=theNucleons.begin(); u!=theNucleons.end(); u++) delete *u;
00701   theMomentum=G4LorentzVector(0.,0.,0.,0.);
00702 }
00703 
00704 // Reduce nucleus by emitted cluster with PDG Code cPDG
00705 void G4QNucleus::Reduce(G4int cPDG)
00706 {
00707   static const G4int NUCPDG=90000000;
00708   if(cPDG>80000000&&cPDG!=NUCPDG)
00709   {
00710     G4int curPDG=GetPDG();
00711     G4int newPDG=curPDG-cPDG+NUCPDG;             // PDG Code of Residual Nucleus
00712     if(newPDG==NUCPDG) InitByPDG(NUCPDG);        // Empty
00713     else
00714     {
00715       //if(abs(newPDG)<NUCPDG)
00716       //{
00717       //  G4cerr<<"***G4QNucleus::Reduce:iPDG="<<curPDG<<"=newPDG="<<newPDG<<"+cPDG="<<cPDG
00718       //        <<G4endl;
00719       //  throw G4QException("*E*:::G4QNucleus::Reduce: Abnormal Nuclear Reduction");
00720       //}
00721       InitByPDG(newPDG);                         // Reinit the Nucleus
00722     }
00723   }
00724   else if(cPDG!=NUCPDG) G4cerr<<"***G4QN::Reduce:Subtract not nuclear PDGC="<<cPDG<<G4endl;
00725   // in case of cPDG=90000000 - subtract nothing
00726 }
00727 
00728 // Increase nucleus by cluster with PDG Code cPDG (4-mom is optional)
00729 void G4QNucleus::Increase(G4int cPDG, G4LorentzVector c4M)
00730 {
00731   static const G4int NUCPDG=90000000;
00732   if(cPDG>80000000&&cPDG!=NUCPDG)
00733   {
00734     G4int newPDG=GetPDG()+cPDG-NUCPDG;        // PDG Code of the New Nucleus
00735     InitByPDG(newPDG);                        // Reinit the Nucleus
00736     if (c4M!=G4LorentzVector(0.,0.,0.,0.))
00737     {
00738       G4LorentzVector t4M = Get4Momentum();   // 4Mom of the nucleus
00739       t4M +=c4M;
00740       Set4Momentum(t4M);
00741     }
00742   }
00743   else G4cerr<<"***G4QNucleus::Increase: PDGCode="<<cPDG<<",4M="<<c4M<<G4endl;
00744 }
00745 
00746 // Increase nucleus by Quasmon with Quark Content qQC (4-mom is optional)
00747 void G4QNucleus::Increase(G4QContent qQC, G4LorentzVector q4M)
00748 {
00749     G4LorentzVector t4M = Get4Momentum();     // 4Mom of the old nucleus
00750     G4QContent  newQC   = GetQC()+qQC;        // Quark Content of the New Nucleus
00751     InitByQC(newQC);                          // Reinit the Nucleus
00752     t4M +=q4M;
00753     Set4Momentum(t4M);                        // 4Mom of the new nucleus
00754 }
00755 
00756 // Set Quark Content, using Z,N,S of nucleus
00757 void G4QNucleus::SetZNSQC(G4int z, G4int n, G4int s_value)
00758 {
00759   G4int zns=z+n+s_value;
00760   G4int Dq=n+zns;
00761   G4int Uq=z+zns;
00762   G4int Sq=s_value;
00763   if      (Dq<0&&Uq<0&&Sq<0)SetQC(G4QContent( 0, 0, 0,-Dq,-Uq,-Sq));
00764   else if (Uq<0&&Sq<0)      SetQC(G4QContent(Dq, 0, 0,  0,-Uq,-Sq));
00765   else if (Dq<0&&Sq<0)      SetQC(G4QContent( 0,Uq, 0,-Dq,  0,-Sq));
00766   else if (Dq<0&&Uq<0)      SetQC(G4QContent( 0, 0,Sq,-Dq,-Uq,  0));
00767   else if (Uq<0)            SetQC(G4QContent(Dq, 0,Sq,  0,-Uq,  0));
00768   else if (Sq<0)            SetQC(G4QContent(Dq,Uq, 0,  0,  0,-Sq));
00769   else if (Dq<0)            SetQC(G4QContent(0 ,Uq,Sq,-Dq,  0,  0));
00770   else                      SetQC(G4QContent(Dq,Uq,Sq,  0,  0,  0));
00771 }
00772   
00773 // Tests if it is possible to split one Baryon (n,p,Lambda) or alpha from the Nucleus
00774 G4int G4QNucleus::SplitBaryon()
00775 {
00776   static const G4QContent neutQC(2,1,0,0,0,0);
00777   static const G4QContent protQC(1,2,0,0,0,0);
00778   static const G4QContent lambQC(1,1,1,0,0,0);
00779   static const G4QContent deutQC(3,3,0,0,0,0);
00780   static const G4QContent alphQC(6,6,0,0,0,0);
00781   static const G4double mNeut= G4QPDGCode(2112).GetMass();
00782   static const G4double mProt= G4QPDGCode(2212).GetMass();
00783   static const G4double mLamb= G4QPDGCode(3122).GetMass();
00784   static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
00785   static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
00786   G4int     baryn=GetA();                         // Baryon Number of the Nucleus
00787   if(baryn<2) return 0;
00788   //G4double   totM=GetGSMass();                    // GS Mass value of the Nucleus
00789   G4double   totM=Get4Momentum().m();             // Real Mass value of the Nucleus
00790   G4QContent valQC=GetQCZNS();                    // Quark Content of the Nucleus
00791 #ifdef debug
00792   G4cout<<"G4QNucleus::SplitBaryon: B="<<baryn<<", M="<<totM<<valQC<<G4endl;
00793 #endif
00794   G4int NQ=valQC.GetN();
00795   if(NQ)                                          // ===> "Can try to split a neutron" case
00796   {
00797     G4QContent resQC=valQC-neutQC;                // QC of Residual for the Neutron
00798     G4int    resPDG=resQC.GetSPDGCode();          // PDG of Residual for the Neutron
00799     G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
00800     G4double sM=resMas+mNeut;
00801 #ifdef debug
00802     G4cout<<"G4QNucleus::SplitBaryon: (neutron),sM="<<sM<<",d="<<totM-sM<<G4endl;
00803 #endif
00804     if(sM<totM+.001) return 2112;
00805   }
00806   G4int PQ=valQC.GetP();
00807   if(PQ)                                          // ===> "Can try to split a proton" case
00808   {
00809     G4QContent resQC=valQC-protQC;                // QC of Residual for the Proton
00810     G4int    resPDG=resQC.GetSPDGCode();          // PDG of Residual for the Proton
00811     G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
00812     G4double CB=CoulombBarrier(1,1);              // Coulomb Barrier for the proton
00813     G4double sM=resMas+mProt+CB;
00815 #ifdef debug
00816     G4cout<<"G4QNucleus::SplitBaryon: (proton),sM="<<sM<<",d="<<totM-sM<<G4endl;
00817 #endif
00818     if(sM<totM+.001) return 2212;
00819   }
00820   G4int LQ=valQC.GetL();
00821   if(LQ)                                          // ===> "Can try to split a lambda" case
00822   {
00823     G4QContent resQC=valQC-lambQC;                // QC of Residual for the Lambda
00824     G4int    resPDG=resQC.GetSPDGCode();          // PDG of Residual for the Lambda
00825     G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
00826     G4double sM=resMas+mLamb;
00827 #ifdef debug
00828     G4cout<<"G4QNucleus::SplitBaryon: (lambda),sM="<<sM<<",d="<<totM-sM<<G4endl;
00829 #endif
00830     if(sM<totM+.001) return 3122;
00831   }
00832   G4int AQ=NQ+PQ+LQ;
00833   if(NQ>0&&PQ>0&&AQ>2)                            // ===> "Can try to split deuteron" case
00834   {
00835     G4QContent resQC=valQC-deutQC;                // QC of Residual for the Deuteron
00836     G4int    resPDG=resQC.GetSPDGCode();          // PDG of Residual for the Deuteron
00837     G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
00838     G4double CB=CoulombBarrier(1,2);              // Coulomb Barrier for the Deuteron
00839     G4double sM=resMas+mDeut+CB;
00840     //G4double sM=resMas+mDeut;
00841 #ifdef debug
00842     G4cout<<"G4QNucleus::SplitBaryon: (deuteron),sM="<<sM<<",d="<<totM-sM<<G4endl;
00843 #endif
00844     if(sM<totM+.001) return 90001001;
00845   }
00846   if(NQ>1&&PQ>1&&AQ>4)                            // ===> "Can try to split an alpha" case
00847   {
00848     G4QContent resQC=valQC-alphQC;                // QC of Residual for the Alpha
00849     G4int    resPDG=resQC.GetSPDGCode();          // PDG of Residual for the Alpha
00850     G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
00851     G4double CB=CoulombBarrier(2,4);              // Coulomb Barrier for the Alpha
00852     G4double sM=resMas+mAlph;
00853     if(NQ!=4||PQ!=4) sM+=CB;
00854 #ifdef debug
00855     G4cout<<"G4QNucleus::SplitBaryon: (alpha),sM="<<sM<<",d="<<totM-sM<<G4endl;
00856 #endif
00857     if(sM<totM+.001) return 90002002;
00858   }
00859   return 0;
00860 }
00861   
00862 // Tests if it is possible to split two Baryons (nn,np,pp,Ln,Lp,LL) from the Nucleus
00863 G4bool G4QNucleus::Split2Baryons()
00864 {
00865   static const G4QContent neutQC(2,1,0,0,0,0);
00866   static const G4QContent protQC(1,2,0,0,0,0);
00867   static const G4QContent lambQC(1,1,1,0,0,0);
00868   static const G4double mNeut= G4QPDGCode(2112).GetMass();
00869   static const G4double mProt= G4QPDGCode(2212).GetMass();
00870   static const G4double mLamb= G4QPDGCode(3122).GetMass();
00871   G4int     baryn=GetA();                        // Baryon Number of the Nucleus
00872   if(baryn<3) return false;
00873   G4double   totM=theMomentum.m();            // Real Mass value of the Nucleus
00874   G4QContent valQC=GetQCZNS();                   // Quark Content of the Nucleus
00875 #ifdef debug
00876   G4cout<<"G4QNucleus::Split2Baryons: B="<<baryn<<", M="<<totM<<valQC<<G4endl;
00877 #endif
00878   G4int NQ=valQC.GetN();
00879   if(NQ>1)                                       // ===> "Can try to split 2 neutrons" case
00880   {
00881     G4QContent resQC=valQC-neutQC-neutQC;        // QC of ResidNucleus for the Two Neutrons
00882     G4int    resPDG=resQC.GetSPDGCode();         // PDG of ResidNucleus for 2 Neutrons
00883     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00884     G4double sM=resMas+mNeut+mNeut;
00885 #ifdef debug
00886     G4cout<<"G4QNucleus::Split2Baryons: (2 neutrons), sM="<<sM<<", d="<<totM-sM<<G4endl;
00887 #endif
00888     if(sM<totM) return true;
00889   }
00890   G4int PQ=valQC.GetP();
00891   if(PQ>1)                                       // ===> "Can try to split 2 protons" case
00892   {
00893     G4QContent resQC=valQC-protQC-protQC;        // QC of ResidualNucleus for 2 Protons
00894     G4int    resPDG=resQC.GetSPDGCode();         // PDG of Residual Nucleus for 2 Proton
00895     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00896     G4double sM=resMas+mProt+mProt;
00897 #ifdef debug
00898     G4cout<<"G4QNucleus::Split2Baryons: (2 protons), sM="<<sM<<", d="<<totM-sM<<G4endl;
00899 #endif
00900     if(sM<totM) return true;
00901   }
00902   if(PQ&&NQ)                                     // ===> "Can try to split proton+neutron"
00903   {
00904     G4QContent resQC=valQC-protQC-neutQC;        // QC of ResidNucleus for Proton+Neutron
00905     G4int    resPDG=resQC.GetSPDGCode();         // PDG of ResidNucleus for Proton+Neutron
00906     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00907     G4double sM=resMas+mProt+mNeut;
00908 #ifdef debug
00909     G4cout<<"G4QNucleus::Split2Baryons:(proton+neutron), sM="<<sM<<", d="<<totM-sM<<G4endl;
00910 #endif
00911     if(sM<totM) return true;
00912   }
00913   G4int LQ=valQC.GetL();
00914   if(LQ&&NQ)                                     // ===> "Can try to split lambda+neutron"
00915   {
00916     G4QContent resQC=valQC-lambQC-neutQC;        // QC of ResidNucleus for Lambda+Neutron
00917     G4int    resPDG=resQC.GetSPDGCode();         // PDG of ResidNucleus for Lambda+Neutron
00918     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00919     G4double sM=resMas+mLamb+mNeut;
00920 #ifdef debug
00921     G4cout<<"G4QNucleus::Split2Baryons:(lambda+neutron), sM="<<sM<<", d="<<totM-sM<<G4endl;
00922 #endif
00923     if(sM<totM) return true;
00924   }
00925   if(LQ&&PQ)                                     // ===> "Can try to split lambda+proton"
00926   {
00927     G4QContent resQC=valQC-protQC-lambQC;        // QC of ResidNucleus for Proton+Lambda
00928     G4int    resPDG=resQC.GetSPDGCode();         // PDG of ResidNucleus for Proton+Lambda
00929     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00930     G4double sM=resMas+mProt+mLamb;
00931 #ifdef debug
00932     G4cout<<"G4QNucleus::Split2Baryons: (proton+lambda), sM="<<sM<<", d="<<totM-sM<<G4endl;
00933 #endif
00934     if(sM<totM) return true;
00935   }
00936   if(LQ>1)                                       // ===> "Can try to split 2 lambdas" case
00937   {
00938     G4QContent resQC=valQC-lambQC-lambQC;        // QC of ResidNucleus for the Two Lambdas
00939     G4int    resPDG=resQC.GetSPDGCode();         // PDG of ResidNucleus for the Two Lambdas
00940     G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
00941     G4double sM=resMas+mLamb+mLamb;
00942 #ifdef debug
00943     G4cout<<"G4QNucleus::Split2Baryons: (two lambdas), sM="<<sM<<", d="<<totM-sM<<G4endl;
00944 #endif
00945     if(sM<totM) return true;
00946   }
00947   return false;
00948 }
00949   
00950 // Evaporate one Baryon (n,p,Lambda) (h1) from the Nucleus & get Residual Nucleus (h2)
00951 G4bool G4QNucleus::EvaporateBaryon(G4QHadron* h1, G4QHadron* h2)
00952 {
00953   //static const G4double   uWell=2.7;              // EffectiveDepth of potential well B
00954   //static const G4double   uWell=7.;               // EffectiveDepth of potential well B
00955   static const G4double   uWell=1.7;              // EffectiveDepth of potential well B
00956   //static const G4double   uWell=0.0;              // EffectiveDepth of potential well B
00958   //static const G4double   gunB=exp(1)/gunA;
00964   static const G4int      gPDG =   22;            // PDGCode of gamma
00965   static const G4QPDGCode gQPDG(gPDG);            // QPDGCode of gamma
00966   static const G4int      nPDG = 2112;            // PDGCode of neutron
00967   static const G4QPDGCode nQPDG(nPDG);            // QPDGCode of neutron
00968   static const G4QPDGCode anQPDG(-nPDG);          // QPDGCode of anti-neutron
00969   static const G4int      pPDG = 2212;            // PDGCode of proton
00970   static const G4QPDGCode pQPDG(pPDG);            // QPDGCode of proton
00971   static const G4QPDGCode apQPDG(-pPDG);          // QPDGCode of anti-proton
00972   static const G4int      lPDG = 3122;            // PDGCode of Lambda
00973   static const G4QPDGCode lQPDG(lPDG);            // QPDGCode of Lambda
00974   static const G4QPDGCode aDppQPDG(-2224);        // QPDGCode of anti-Delta++
00975   static const G4QPDGCode aDmQPDG(-1114);         // QPDGCode of anti-Delta-
00976   static const G4QPDGCode alQPDG(-lPDG);          // QPDGCode of anti-Lambda
00977   static const G4int      dPDG = 90001001;        // PDGCode of deutron
00978   static const G4int      aPDG = 90002002;        // PDGCode of ALPHA
00979   static const G4QPDGCode aQPDG(aPDG);            // QPDGCode of ALPHA
00980   static const G4QPDGCode NPQPDG(dPDG);           // QPDGCode of deutron
00981   static const G4QPDGCode NNQPDG(90000002);       // QPDGCode of n+n
00982   static const G4QPDGCode PPQPDG(90002000);       // QPDGCode of p+p
00983   static const G4QPDGCode NLQPDG(91000001);       // QPDGCode of n+L
00984   static const G4QPDGCode PLQPDG(91001000);       // QPDGCode of p+L
00985   static const G4QPDGCode LLQPDG(92000000);       // QPDGCode of L+L
00986   static const G4QPDGCode NAQPDG(90002003);       // QPDGCode of N+ALPHA
00987   static const G4QPDGCode PAQPDG(90003002);       // QPDGCode of L+ALPHA
00988   static const G4QPDGCode LAQPDG(91002002);       // QPDGCode of L+ALPHA
00989   static const G4QPDGCode AAQPDG(90004004);       // QPDGCode of ALPHA+ALPHA
00990   static const G4QPDGCode PIPQPDG(211);           // QPDGCode of PI+
00991   static const G4QPDGCode PIMQPDG(-211);          // QPDGCode of PI+
00992   static const G4double   mNeut= G4QPDGCode(nPDG).GetMass(); // Mass of neutron
00993   static const G4double   mProt= G4QPDGCode(pPDG).GetMass(); // Mass of proton
00994   static const G4double   mLamb= G4QPDGCode(lPDG).GetMass(); // Mass of Lambda
00995   static const G4double   mDeut= G4QPDGCode(nPDG).GetNuclMass(1,1,0);// Mass of deutr
00996   static const G4double   mAlph= G4QPDGCode(nPDG).GetNuclMass(2,2,0);// Mass of alpha
00997   static const G4double   mPi  = G4QPDGCode(211).GetMass();  // Mass of charged pion
00998   static const G4double   mN2  = mNeut*mNeut;     // Mass^2 of neutron
00999   static const G4double   mP2  = mProt*mProt;     // Mass^2 of proton
01000   static const G4double   mL2  = mLamb*mLamb;     // Mass^2 of Lambda
01001   static const G4double   mA2  = mAlph*mAlph;     // Mass^2 of Alpha
01002   static const G4double   mNP  = mNeut+mProt;     // proton and neutron mass
01003   //static const G4double   mNN  = mNeut+mNeut;     // 2 neutrons mass
01004   //static const G4double   mPP  = mProt+mProt;     // 2 protons mass
01005   //static const G4double   mNL  = mNeut+mLamb;     // neutron and Lambda mass
01006   //static const G4double   mPL  = mProt+mLamb;     // proton and Lambda mass
01007   //static const G4double   mLL  = mLamb+mLamb;     // 2 Lambdas mass
01008   G4bool barf=true;                               // Take into account CB in limits
01009   G4double uW=uWell;
01010   G4int    a = GetA();
01011   G4double  evalph=0.1;                            // Probability for alpha to evaporate
01012   //if(a>4.5) evalph=2.7/sqrt(a-4.);                // Probability for alpha to evaporate
01013   //G4double evalph=clustProb*clustProb*clustProb;
01014 #ifdef debug
01015   G4cout<<"G4QNucleus::EvaporBaryon: *Called*, a="<<a<<GetThis()<<",alph="<<evalph<<G4endl;
01016 #endif
01017   G4double a1= a-1;
01020   G4double PBarr= CoulombBarrier(1,1);            // CoulombBarrier for proton
01021   G4double PPBarr= CoulombBarrier(1,1,1,1);       // CoulombBarrier for proton (after prot)
01022   G4double PABarr= CoulombBarrier(1,1,2,4);       // CoulombBarrier for proton (after alph)
01023   G4double APBarr= CoulombBarrier(2,4,1,1);       // CoulombBarrier for alpha (after prot)
01024   G4double ABarr= CoulombBarrier(2,4);            // CoulombBarrier for alpha
01025   G4double AABarr= CoulombBarrier(2,4,2,4);       // CoulombBarrier for alpha (after alpha)
01026   //G4double PPPBarr= CoulombBarrier(1,1,2,2);    // CoulombBarrier for proton (after 2 pr)
01027   //G4double AAABarr= CoulombBarrier(2,4,4,8);    // CoulombBarrier for alpha (after 2alph)
01029   //G4double PPABarr= CoulombBarrier(1,1,3,5);    // CoulombBarrier for proton (after p+al)
01030   G4double SPPBarr=PBarr+PPBarr;                  // SummedCoulombBarrier for p+p pair
01031   G4double SAABarr=ABarr+AABarr;                  // SummedCoulombBarrier for 2 alpha pair
01032   //G4double SPPPBarr=SPPBarr+PPPBarr;            // SummedCoulombBarrier for 3 protons
01033   //G4double SAAABarr=SAABarr+AAABarr;            // SummedCoulombBarrier for 3 alphas
01034   G4double SAPBarr=PABarr+ABarr;                  // SummedCoulombBarrier for alpha+p pair
01035   G4double DAPBarr=APBarr+PBarr;                  // Other SummedCoulombBarrier for alph+2p
01036   if(DAPBarr>SAPBarr)SAPBarr=DAPBarr;             // Get max to make possible BothSequences
01038   //G4double SPPABarr=PPABarr+SAPBarr;            // Summed Coulomb Barrier for p+p+alpha
01039   G4LorentzVector h1mom;
01040   G4LorentzVector h2mom;
01041   G4LorentzVector h3mom;
01042   G4double totMass= GetMass();                    // Total mass of the Nucleus
01043 #ifdef debug
01044   G4cout<<"G4QN::EB:pB="<<PBarr<<",aB="<<ABarr<<",ppB="<<PPBarr<<",paB="<<PABarr<<G4endl;
01045 #endif
01046   if(a==-2)
01047   {
01048     if(Z==1 || N==1)
01049     {
01050       G4int  nucPDG  = -2112;
01051       G4int  piPDG   =  211;
01052       G4double nucM  = mNeut;
01053       G4QPDGCode del = aDmQPDG;
01054       G4QPDGCode nuc = anQPDG;
01055       if(N>0)
01056       {
01057         nucPDG = -2212;
01058         piPDG  = -211;
01059         nucM   = mProt;
01060         del    = aDppQPDG;
01061         nuc    = apQPDG;
01062       }
01063       if(totMass > mPi+nucM+nucM)
01064       {
01065         G4LorentzVector n14M(0.,0.,0.,nucM);
01066         G4LorentzVector n24M(0.,0.,0.,nucM);
01067         G4LorentzVector pi4M(0.,0.,0.,mPi);
01068         if(!DecayIn3(n14M, n24M, pi4M))
01069         {
01070           G4cerr<<"***G4QNucl::EvapBary: (anti) tM="<<totMass<<"-> 2N="<<nucPDG<<"(M="
01071                 <<nucM<<") + pi="<<piPDG<<"(M="<<mPi<<")"<<G4endl;
01072           //throw G4QException("G4QNucl::EvapBary:ISO-dibaryon DecayIn3 did not succeed");
01073           return false;
01074         }
01075         n14M+=pi4M;
01076         h1->SetQPDG(del);
01077         h2->SetQPDG(nuc);
01078         h1->Set4Momentum(n14M);
01079         h2->Set4Momentum(n24M);
01080         return true;
01081       }
01082       else
01083       {
01084         G4cerr<<"***G4QNucleus::EvaporateBaryon: M="<<totMass
01085               <<", M="<<totMass<<" < M_2N+Pi, d="<<totMass-2*nucM-mPi<<G4endl;
01086         //throw G4QException("***G4QNucl::EvaporateBaryon: ISO-dibaryon under Mass Shell");
01087         return false;
01088       }      
01089     }
01090     else if(Z==2 || N==2)
01091     {
01092       G4int  nucPDG  = -2112;
01093       G4int  piPDG   =  211;
01094       G4double nucM  = mNeut;
01095       G4QPDGCode del = aDmQPDG;
01096       if(N==2)
01097       {
01098         nucPDG = -2212;
01099         piPDG  = -211;
01100         nucM   = mProt;
01101         del    = aDppQPDG;
01102       }
01103       if(totMass > mPi+mPi+nucM+nucM)
01104       {
01105         G4LorentzVector n14M(0.,0.,0.,nucM);
01106         G4LorentzVector n24M(0.,0.,0.,nucM);
01107         G4LorentzVector pi4M(0.,0.,0.,mPi+mPi);
01108         if(!DecayIn3(n14M, n24M, pi4M))
01109         {
01110           G4cerr<<"***G4QNucl::EvapBary: (anti) tM="<<totMass<<"-> 2N="<<nucPDG<<"(M="
01111                 <<nucM<<") + 2pi="<<piPDG<<"(M="<<mPi<<")"<<G4endl;
01112           //throw G4QException("G4QNucl::EvapBary:ISO-dibaryon DecayIn3 did not succeed");
01113           return false;
01114         }
01115         G4LorentzVector hpi4M=pi4M/2.;
01116         n14M+=hpi4M;
01117         n24M+=hpi4M;
01118         h1->SetQPDG(del);
01119         h2->SetQPDG(del);
01120         h1->Set4Momentum(n14M);
01121         h2->Set4Momentum(n24M);
01122         return true;
01123       }
01124       else
01125       {
01126         G4cerr<<"***G4QNucleus::EvaporateBaryon: M="<<totMass
01127               <<", M="<<totMass<<" < M_2N+Pi, d="<<totMass-2*nucM-mPi<<G4endl;
01128         //throw G4QException("***G4QNucl::EvaporateBaryon: ISO-dibaryon under Mass Shell");
01129         return false;
01130       }      
01131     }
01132     else if(Z==-2)
01133     {
01134       h1mom=G4LorentzVector(0.,0.,0.,mProt);
01135       h2mom=h1mom;
01136       h1->SetQPDG(apQPDG);
01137       h2->SetQPDG(apQPDG);
01138       if(!DecayIn2(h1mom,h2mom)) return false;
01139     }
01140     else if(N==-2)
01141     {
01142       h1mom=G4LorentzVector(0.,0.,0.,mNeut);
01143       h2mom=h1mom;
01144       h1->SetQPDG(anQPDG);
01145       h2->SetQPDG(anQPDG);
01146       if(!DecayIn2(h1mom,h2mom)) return false;
01147     }
01148     else if(N==-1 && Z==-1)
01149     {
01150       h1mom=G4LorentzVector(0.,0.,0.,mProt);
01151       h2mom=G4LorentzVector(0.,0.,0.,mNeut);
01152       h1->SetQPDG(apQPDG);
01153       h2->SetQPDG(anQPDG);
01154       if(!DecayIn2(h1mom,h2mom)) return false;
01155     }
01156     else if(Z==-1 && S==-1)
01157     {
01158       h1mom=G4LorentzVector(0.,0.,0.,mProt);
01159       h2mom=G4LorentzVector(0.,0.,0.,mLamb);
01160       h1->SetQPDG(apQPDG);
01161       h2->SetQPDG(alQPDG);
01162       if(!DecayIn2(h1mom,h2mom)) return false;
01163     }
01164     else
01165     {
01166       h1mom=G4LorentzVector(0.,0.,0.,mNeut);
01167       h2mom=G4LorentzVector(0.,0.,0.,mLamb);
01168       h1->SetQPDG(anQPDG);
01169       h2->SetQPDG(alQPDG);
01170       if(!DecayIn2(h1mom,h2mom)) return false;
01171     }
01172     h1->Set4Momentum(h1mom);
01173     h2->Set4Momentum(h2mom);
01174     return true;
01175   }
01176   else if(a==2)
01177   {
01178     if(Z<0||N<0)
01179     {
01180       G4int  nucPDG = 2112;
01181       G4double nucM = mNeut;
01182       G4int   piPDG = -211;
01183       G4QPDGCode db = NNQPDG;
01184       G4QPDGCode pi_value = PIMQPDG;
01185       if(N<0)
01186       {
01187         nucPDG = 2212;
01188         nucM   = mProt;
01189         piPDG  = 211;
01190         db     = PPQPDG;
01191         pi_value = PIPQPDG;
01192       }
01193       if(totMass>mPi+nucM+nucM)
01194       {
01195         G4LorentzVector n14M(0.,0.,0.,nucM);
01196         G4LorentzVector n24M(0.,0.,0.,nucM);
01197         G4LorentzVector pi4M(0.,0.,0.,mPi);
01198         if(!DecayIn3(n14M,n24M,pi4M))
01199         {
01200           G4cerr<<"***G4QNucl::EvapBary: tM="<<totMass<<"-> 2N="<<nucPDG<<"(M="
01201           <<nucM<<") + pi="<<piPDG<<"(M="<<mPi<<")"<<G4endl;
01202           //throw G4QException("G4QNucl::EvapBary:ISO-dibaryon DecayIn3 did not succeed");
01203           return false;
01204         }
01205         n14M+=n24M;
01206         h1->SetQPDG(db);
01207         h2->SetQPDG(pi_value);
01208         h1->Set4Momentum(n14M);
01209         h2->Set4Momentum(pi4M);
01210         return true;
01211       }
01212       else
01213       {
01214         G4cerr<<"***G4QNucleus::EvaporateBaryon: M="<<totMass
01215               <<", M="<<totMass<<" < M_2N+Pi, d="<<totMass-2*nucM-mPi<<G4endl;
01216         //throw G4QException("***G4QNucl::EvaporateBaryon: ISO-dibaryon under Mass Shell");
01217         return false;
01218       }      
01219     }
01220     else if(Z==2)
01221     {
01222       h1mom=G4LorentzVector(0.,0.,0.,mProt);
01223       h2mom=h1mom;
01224       h1->SetQPDG(pQPDG);
01225       h2->SetQPDG(pQPDG);
01226       if(!DecayIn2(h1mom,h2mom)) return false;
01227     }
01228     else if(N==2)
01229     {
01230       h1mom=G4LorentzVector(0.,0.,0.,mNeut);
01231       h2mom=h1mom;
01232       h1->SetQPDG(nQPDG);
01233       h2->SetQPDG(nQPDG);
01234       if(!DecayIn2(h1mom,h2mom)) return false;
01235     }
01236     else if(N==1&&Z==1)
01237     {
01238       if(totMass<=mNP)
01239       {
01240 #ifdef debug
01241         G4cout<<"G4QNucl::EvaporateBaryon: Photon ### d+g ###, dM="<<totMass-mNP<<G4endl;
01242 #endif
01243         h1mom=G4LorentzVector(0.,0.,0.,0.);
01244         h2mom=G4LorentzVector(0.,0.,0.,mDeut);
01245         h1->SetQPDG(gQPDG);
01246         h2->SetQPDG(NPQPDG);
01247       }
01248       else
01249       {
01250         h1mom=G4LorentzVector(0.,0.,0.,mProt);
01251         h2mom=G4LorentzVector(0.,0.,0.,mNeut);
01252         h1->SetQPDG(pQPDG);
01253         h2->SetQPDG(nQPDG);
01254       }
01255       if(!DecayIn2(h1mom,h2mom)) return false;
01256     }
01257     else if(Z==1&&S==1)
01258     {
01259       h1mom=G4LorentzVector(0.,0.,0.,mProt);
01260       h2mom=G4LorentzVector(0.,0.,0.,mLamb);
01261       h1->SetQPDG(pQPDG);
01262       h2->SetQPDG(lQPDG);
01263       if(!DecayIn2(h1mom,h2mom)) return false;
01264     }
01265     else
01266     {
01267       h1mom=G4LorentzVector(0.,0.,0.,mNeut);
01268       h2mom=G4LorentzVector(0.,0.,0.,mLamb);
01269       h1->SetQPDG(nQPDG);
01270       h2->SetQPDG(lQPDG);
01271       if(!DecayIn2(h1mom,h2mom)) return false;
01272     }
01273     h1->Set4Momentum(h1mom);
01274     h2->Set4Momentum(h2mom);
01275     return true;
01276   }
01277   else if(a>2)
01278   {
01279     G4bool nFlag    = false;               // Flag of possibility to radiate neutron
01280     G4bool pFlag    = false;               // Flag of possibility to radiate proton
01281     G4bool lFlag    = false;               // Flag of possibility to radiate lambda
01282     G4bool aFlag    = false;               // Flag of possibility to radiate alpha
01283     G4bool nnFlag   = false;               // Flag of possibility to radiate 2 neutrons
01284     G4bool npFlag   = false;               // Flag of possibility to radiate neutron+proton
01285     G4bool nlFlag   = false;               // Flag of possibility to radiate neutron+lambda
01286     G4bool ppFlag   = false;               // Flag of possibility to radiate 2 protons
01287     G4bool plFlag   = false;               // Flag of possibility to radiate proton+lambda
01288     G4bool llFlag   = false;               // Flag of possibility to radiate 2 lambdas
01289     G4bool paFlag   = false;               // Flag of possibility to radiate proton+alpha
01290     G4bool naFlag   = false;               // Flag of possibility to radiate neutron+alpha
01291     G4bool laFlag   = false;               // Flag of possibility to radiate lambda+alpha
01292     G4bool aaFlag   = false;               // Flag of possibility to radiate alpha+alpha
01293     //G4bool nnnF     = false;             // Evaporation brunch is closed
01294     //G4bool nnpF     = false;
01295     //G4bool nppF     = false;
01296     //G4bool pppF     = false;
01297     //G4bool nnlF     = false;
01298     //G4bool nplF     = false;
01299     //G4bool pplF     = false;
01300     //G4bool nllF     = false;
01301     //G4bool pllF     = false;
01302     //G4bool lllF     = false;
01303     //G4bool nnaF     = false;
01304     //G4bool npaF     = false;
01305     //G4bool ppaF     = false;
01306     //G4bool nlaF     = false;
01307     //G4bool plaF     = false;
01308     //G4bool llaF     = false;
01309     //G4bool paaF     = false;
01310     //G4bool naaF     = false;
01311     //G4bool laaF     = false;
01312     //G4bool aaaF     = false;
01313     G4double GSMass = GetGSMass(); // Ground State mass of the Nucleus
01314     G4double GSResNN= GSMass;      // Prototype of Residual Nuclear Mass for n+n
01315     G4double GSResNP= GSMass;      // Prototype of Residual Nuclear Mass for n+p
01316     G4double GSResNL= GSMass;      // Prototype of Residual Nuclear Mass for n+l
01317     G4double GSResPP= GSMass;      // Prototype of Residual Nuclear Mass for p+p
01318     G4double GSResPL= GSMass;      // Prototype of Residual Nuclear Mass for p+l
01319     G4double GSResLL= GSMass;      // Prototype of Residual Nuclear Mass for l+l
01320     G4double GSResNA= GSMass;      // Prototype of Residual Nuclear Mass for n+alpha
01321     G4double GSResPA= GSMass;      // Prototype of Residual Nuclear Mass for p+alpha
01322     G4double GSResLA= GSMass;      // Prototype of Residual Nuclear Mass for l+alpha
01323     G4double GSResAA= GSMass;      // Prototype of Residual Nuclear Mass for alpha+alpha
01324     G4double GSResNa= GSMass;      // Prototype of Residual Nuclear Mass for alpha
01325     /*
01326     // DHW 16 June 2011 : these variables set but not used.  Comment out to fix
01327     //                    compiler warnings 
01328     G4double GSReNNN= GSMass;      // Prototype of Residual Nuclear Mass for n+n+n
01329     G4double GSReNNP= GSMass;      // Prototype of Residual Nuclear Mass for n+n+p
01330     G4double GSReNPP= GSMass;      // Prototype of Residual Nuclear Mass for n+p+p
01331     G4double GSRePPP= GSMass;      // Prototype of Residual Nuclear Mass for p+p+p
01332     G4double GSReNNL= GSMass;      // Prototype of Residual Nuclear Mass for n+n+l
01333     G4double GSReNPL= GSMass;      // Prototype of Residual Nuclear Mass for n+p+l
01334     G4double GSRePPL= GSMass;      // Prototype of Residual Nuclear Mass for p+p+l
01335     G4double GSReNLL= GSMass;      // Prototype of Residual Nuclear Mass for n+l+l
01336     G4double GSRePLL= GSMass;      // Prototype of Residual Nuclear Mass for p+l+l
01337     G4double GSReLLL= GSMass;      // Prototype of Residual Nuclear Mass for l+l+l
01338     G4double GSReNNA= GSMass;      // Prototype of Residual Nuclear Mass for n+n+a
01339     G4double GSReNPA= GSMass;      // Prototype of Residual Nuclear Mass for n+p+a
01340     G4double GSRePPA= GSMass;      // Prototype of Residual Nuclear Mass for p+p+a
01341     G4double GSReNLA= GSMass;      // Prototype of Residual Nuclear Mass for n+l+a
01342     G4double GSRePLA= GSMass;      // Prototype of Residual Nuclear Mass for p+l+a
01343     G4double GSReLLA= GSMass;      // Prototype of Residual Nuclear Mass for l+l+a
01344     G4double GSRePAA= GSMass;      // Prototype of Residual Nuclear Mass for p+a+a
01345     G4double GSReNAA= GSMass;      // Prototype of Residual Nuclear Mass for n+a+a
01346     G4double GSReLAA= GSMass;      // Prototype of Residual Nuclear Mass for l+a+a
01347     G4double GSReAAA= GSMass;      // Prototype of Residual Nuclear Mass for a+a+a
01348     */
01349     G4QPDGCode PQPDG(22);          // Prototype of QPDG for ResidualNucleus to proton
01350     G4QPDGCode NQPDG(22);          // Prototype of QPDG for ResidualNucleus to neutron
01351     G4QPDGCode LQPDG(22);          // Prototype of QPDG for ResidualNucleus to lambda
01352     G4QPDGCode AQPDG(22);          // Prototype of QPDG for ResidualNucleus to alpha
01353     G4QPDGCode nnQPDG(22);         // Prototype of QPDG for ResidualNucleus to nn-dibar.
01354     G4QPDGCode npQPDG(22);         // Prototype of QPDG for ResidualNucleus to np-dibar.
01355     G4QPDGCode nlQPDG(22);         // Prototype of QPDG for ResidualNucleus to nl-dibar.
01356     G4QPDGCode ppQPDG(22);         // Prototype of QPDG for ResidualNucleus to pp-dibar.
01357     G4QPDGCode plQPDG(22);         // Prototype of QPDG for ResidualNucleus to pl-dibar.
01358     G4QPDGCode llQPDG(22);         // Prototype of QPDG for ResidualNucleus to ll-dibar.
01359     G4QPDGCode naQPDG(22);         // Prototype of QPDG for ResidualNucleus to n+alpha
01360     G4QPDGCode paQPDG(22);         // Prototype of QPDG for ResidualNucleus to p+alpha
01361     G4QPDGCode laQPDG(22);         // Prototype of QPDG for ResidualNucleus to l+alpha
01362     G4QPDGCode aaQPDG(22);         // Prototype of QPDG for ResidualNucleus to alph+alph
01363     G4QPDGCode dbQPDG(22);         // Prototype of chosen dibaryon QPDG
01364     G4QPDGCode fQPDG(22);          // Prototype of QPDG of the Second Baryon
01365     G4double rMass  = 0.;          // Prototype of mass of Residual Nucleus
01366     G4double eMass  = 0.;          // Prototype of mass of Evaporated Baryon
01367     G4double fMass  = 0.;          // Prototype of mass of the Second Baryon
01368 #ifdef debug
01369     G4cout<<"G4QNuc::EvaB:a>2, totM="<<totMass<<" > GSMass="<<GSMass<<",d="<<totMass-GSMass
01370           <<G4endl;
01371 #endif
01372     G4double tM2    = totMass*totMass;
01373     G4double qtM2   = 4*tM2;
01374     G4double GSResNp= GSMass;     // Prototype of Residual Nuclear Mass for proton
01375     G4double pExcess= 0.;         // Prototype of excess energy for proton
01376     G4double aExcess= 0.;         // Prototype of excess energy for alpha
01377     G4double pp2m   = 0.;         // Prototype of max square momentum for proton
01378     G4double ap2m   = 0.;         // Prototype of max square momentum for proton
01379     G4double pBnd   = 0.;         // Binding energy for proton
01380     G4double aBnd   = 0.;         // Binding energy for proton
01381     G4bool three=false;           // Prototype of the Flag of b+b+ResNuc decay
01382     if(Z>0)
01383     {
01384       PQPDG=G4QPDGCode(90000000+1000*(1000*S+Z-1)+N);
01385       GSResNp=PQPDG.GetMass();
01386       G4double mpls=GSResNp+mProt;
01387       G4double mmin=GSResNp-mProt;
01388       pp2m=(tM2-mpls*mpls)*(tM2-mmin*mmin)/qtM2;
01389       if(pp2m>=0.000001)
01390       {
01391         pFlag=true;
01392         pBnd=mProt-GSMass+GSResNp;             // Binding energy for proton
01393         G4double eMax=sqrt(mP2+pp2m);
01394 #ifdef debug
01395         G4cout<<"G4QNuc::EvapBaryon:pm="<<eMax+sqrt(pp2m+GSResNp*GSResNp)<<" = M="<<totMass
01396               <<", sm="<<GSResNp+mProt+PBarr<<",pp2="<<pp2m<<",pB="<<pBnd<<G4endl;
01397 #endif
01398         pExcess=eMax-mProt+pBnd;               // Max Kin Energy from bottom
01399       }
01400       else pExcess=pBnd;
01401       if(Z>1)
01402       {
01403         ppQPDG=G4QPDGCode(90000000+1000*(1000*S+Z-2)+N);
01404         GSResPP=ppQPDG.GetMass();
01405 #ifdef debug
01406         G4double sm=GSResPP+mProt+mProt+SPPBarr;
01407         G4cout<<"G4QNucl::EvapBaryon: ppM="<<GSResPP<<",T="<<sm-GSMass<<",E="<<totMass-sm
01408               <<",C="<<PBarr<<G4endl;
01409 #endif
01410         if(GSResPP+mProt+mProt+SPPBarr<totMass) ppFlag=true;
01411         if(Z>2&&a>3)
01412         {
01413           /*
01414           // DHW 16 June 2011: variable set but not used.  See note at line 1317.
01415           GSRePPP=G4QPDGCode().GetNuclMass(Z-3,N,S);
01416           */
01417           //if(GSRePPP+mProt+mProt+mProt+SPPPBarr<totMass) pppF=true;
01418           if(N>1&&a>5)
01419           {
01420             paQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-3)+N-2);
01421             GSResPA=paQPDG.GetMass();
01422 #ifdef debug
01423             G4double s_value=GSResPA+mAlph+mProt+SAPBarr;
01424             G4cout<<"G4QN::EB:paM="<<GSResPA<<",T="<<s_value-GSMass<<",E="<<totMass-s_value<<G4endl;
01425 #endif
01426             if(GSResPA+mProt+SAPBarr+mAlph<totMass) paFlag=true;
01427           }
01428         }
01429         if(N>0&&a>3)
01430         {
01431           /*
01432           // DHW  16 June 2011: variable set but not used.  See note at line 1317.
01433           GSReNPP=G4QPDGCode().GetNuclMass(Z-2,N-1,S);
01434           */
01435           //if(GSReNPP+mProt+mProt+SPPBarr+mNeut<totMass) nppF=true;
01436         }
01437         if(S>0&&a>3)
01438         {
01439           /*
01440           // DHW  16 June 2011: variable set but not used.  See note at line 1317.
01441           GSRePPL=G4QPDGCode().GetNuclMass(Z-2,N,S-1);
01442           */
01443           //if(GSRePPL+mProt+mProt+SPPBarr+mLamb<totMass) pplF=true;
01444         }
01445         if(N>1&&a>4)
01446         {
01447           if(a>6)
01448           {
01449             if(S>1)
01450             {
01451               /*
01452               // DHW  16 June 2011: variable set but not used.  See note at line 1317.
01453               GSReLLA=G4QPDGCode().GetNuclMass(Z-2,N-2,S-2);
01454               */
01455               //if(GSReLLA+mAlph+ABarr+mLamb+mLamb<totMass) llaF=true;
01456             }
01457             if(N>2&&S>0)
01458             {
01459               /*
01460               // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01461               GSReNLA=G4QPDGCode().GetNuclMass(Z-2,N-3,S-1);
01462               */
01463               //if(GSReNLA+mAlph+ABarr+mNeut+mLamb<totMass) nlaF=true;
01464             }
01465             if(Z>2&&S>0)
01466             {
01467               /*
01468               // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01469               GSRePLA=G4QPDGCode().GetNuclMass(Z-3,N-2,S-1);
01470               */
01471               //if(GSRePLA+mAlph+SAPBarr+mProt+mLamb<totMass) plaF=true;
01472             }
01473             if(N>3)
01474             {
01475               /*
01476               // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01477               GSReNNA=G4QPDGCode().GetNuclMass(Z-2,N-4,S);
01478               */
01479               //if(GSReNNA+mAlph+ABarr+mNeut+mNeut<totMass) nnaF=true;
01480             }
01481             if(Z>2&&N>2)
01482             {
01483               /*
01484               // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01485               GSReNPA=G4QPDGCode().GetNuclMass(Z-3,N-3,S);
01486               */
01487               //if(GSReNPA+mAlph+SAPBarr+mProt+mNeut<totMass) npaF=true;
01488             }
01489             if(N>3)
01490             {
01491               /*
01492               // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01493               GSRePPA=G4QPDGCode().GetNuclMass(Z-4,N-2,S);
01494               */
01495               //if(GSRePPA+mAlph+SPPABarr+mProt+mProt<totMass) ppaF=true;
01496             }
01497             if(a>9)
01498             {
01499               if(Z>3&&N>3&&S>0)
01500               {
01501                 /*
01502                 // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01503                 GSReLAA=G4QPDGCode().GetNuclMass(Z-4,N-4,S-1);
01504                 */
01505                 //if(GSReLAA+mLamb+mAlph+mAlph+SAABarr<totMass) laaF=true;
01506               }
01507               if(Z>3&&N>4)
01508               {
01509                 /*
01510                 // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01511                 GSReNAA=G4QPDGCode().GetNuclMass(Z-4,N-5,S);
01512                 */
01513                 //if(GSReNAA+mNeut+mAlph+mAlph+SAABarr<totMass) naaF=true;
01514               }
01515               if(Z>4&&N>3)
01516               {
01517                 /*
01518                 // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01519                 GSRePAA=G4QPDGCode().GetNuclMass(Z-5,N-4,S);
01520                 */
01521                 //if(GSRePAA+mProt+mAlph+mAlph+SAABarr<totMass) paaF=true;
01522               }
01523               if(a>12&&N>5&&Z>5)
01524               {
01525                 /*
01526                 // DHW 16 June 2011:  variable set but not used.  See note at line 1317.
01527                 GSReAAA=G4QPDGCode().GetNuclMass(Z-6,N-6,S);
01528                 */
01529                 //if(GSReAAA+mAlph+mAlph+mAlph+SAAABarr<totMass) aaaF=true;
01530               }
01531             }
01532           }
01533           if(N>3&&Z>3&&a>8)
01534           {
01535             aaQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-4)+N-4);
01536             GSResAA=aaQPDG.GetMass();
01537 #ifdef debug
01538             G4double s_value=GSResAA+mAlph+mAlph+SAABarr;
01539             G4cout<<"G4QNucl::EvapBaryon: a="<<GSResNP<<",T="<<s_value-GSMass<<",E="<<totMass-s_value
01540                   <<",A="<<SAABarr<<G4endl;
01541 #endif
01542             if(GSResAA+mAlph+mAlph+SAABarr<totMass) aaFlag=true;
01543           }
01544           if(N>2&&a>5)
01545           {
01546             naQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-2)+N-3);
01547             GSResNA=naQPDG.GetMass();
01548 #ifdef debug
01549             G4double s_value=GSResNA+mAlph+mNeut;
01550             G4cout<<"G4QNucl::EvapBary: M="<<GSResNA<<",T="<<s_value-GSMass<<",E="<<totMass-s_value
01551                   <<",C="<<ABarr<<G4endl;
01552 #endif
01553             if(GSResNA+mNeut+mAlph+ABarr<totMass) naFlag=true;
01554           }
01555           if(S>0&&a>5)
01556           {
01557             laQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-1002)+N-2);
01558             GSResLA=laQPDG.GetMass();
01559             if(GSResLA+mLamb+mAlph+ABarr<totMass) laFlag=true;
01560           }
01561           AQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-2)+N-2);
01562           GSResNa=AQPDG.GetMass();
01563           mpls=GSResNa+mAlph;
01564           mmin=GSResNa-mAlph;
01565           ap2m=(tM2-mpls*mpls)*(tM2-mmin*mmin)/qtM2;
01566           if(ap2m>=0.000001)
01567           {
01568             aFlag=true;
01569             aBnd=mAlph-GSMass+GSResNa;           // Binding energy for ALPHA
01570             G4double eMax=sqrt(mA2+ap2m);
01571 #ifdef debug
01572             G4cout<<"G4QNuc::EvapBar:m="<<eMax+sqrt(ap2m+GSResNa*GSResNa)<<" = M="<<totMass
01573                   <<", sm="<<GSResNp+mProt+PBarr<<",pp2="<<pp2m<<",pB="<<pBnd<<G4endl;
01574 #endif
01575             aExcess=eMax-mAlph+aBnd;             // Max Kin Energy from bottom
01576           }
01577           else aExcess=pBnd;
01578         }
01579       }
01580       if(N>0)
01581       {
01582         if(Z>0)
01583         {
01584           npQPDG=G4QPDGCode(90000000+1000*(1000*S+Z-1)+N-1);
01585           GSResNP=npQPDG.GetMass();
01586 #ifdef debug
01587           G4double s_value=GSResNP+mNeut+mProt;
01588           G4cout<<"G4QNucl::EvapBaryon: npM="<<GSResNP<<",T="<<s_value-GSMass<<",E="<<totMass-s_value
01589                 <<",C="<<PBarr<<G4endl;
01590 #endif
01591           if(GSResNP+mNeut+mProt+PBarr<totMass) npFlag=true;
01592         }
01593         if(N>1)
01594         {
01595           /* 
01596           // DHW 16 June 2011: variable set but not used.  See note at line 1317;
01597           GSReNNP=G4QPDGCode().GetNuclMass(Z-1,N-2,S);
01598           */
01599           //if(GSReNNP+mProt+PBarr+mNeut+mNeut<totMass) nnpF=true;
01600         }
01601         if(S>0)
01602         {
01603           /*
01604           // DHW 16 June 2011: variable set but not used.  See note at line 1317;
01605           GSReNPL=G4QPDGCode().GetNuclMass(Z-1,N-1,S-1);
01606           */
01607           //if(GSReNPL+mProt+PBarr+mNeut+mLamb<totMass) nplF=true;
01608         }
01609       }
01610       if(S>0)
01611       {
01612         if(Z>0)
01613         {
01614           plQPDG=G4QPDGCode(90000000+1000*(1000*(S-1)+Z-1)+N);
01615           GSResPL=plQPDG.GetMass();
01616           if(GSResPL+mProt+PBarr+mLamb<totMass) plFlag=true;
01617         }
01618         if(S>1)
01619         {
01620           /*
01621           // DHW 16 June 2011: variable set but not used.  See note at line 1317;
01622           GSRePLL=G4QPDGCode().GetNuclMass(Z-1,N,S-2);
01623           */
01624           //if(GSRePLL+mProt+PBarr+mLamb+mLamb<totMass) pllF=true;
01625         }
01626       }
01627     }
01628     G4double GSResNn= GSMass;         // Prototype of Residual Nuclear Mass for neutron
01629     G4double nExcess= 0.;             // Prototype of excess energy for neutron
01630     G4double np2m   = 0.;             // Prototype of max square momentum for neutron
01631     G4double nBnd   = 0.;             // Binding energy for neutron
01632     if(N>0)
01633     {
01634       NQPDG=G4QPDGCode(90000000+1000*(1000*S+Z)+N-1);
01635       GSResNn=NQPDG.GetMass();
01636 #ifdef debug
01637       G4cout<<"G4QNucleus::EvapBaryon: M(A-N)="<<GSResNn<<",Z="<<Z
01638             <<",N="<<N<<",S="<<S<<G4endl;
01639 #endif
01640       G4double mpls=GSResNn+mNeut;
01641       G4double mmin=GSResNn-mNeut;
01642       np2m=(tM2-mpls*mpls)*(tM2-mmin*mmin)/qtM2;
01643       if(np2m>=0.000001)
01644       {
01645         nFlag=true;
01646         nBnd=mNeut-GSMass+GSResNn;    // Binding energy for neutron
01647         G4double eMax=sqrt(mN2+np2m);
01648 #ifdef debug
01649         G4cout<<"G4QNuc::EvapBaryon:nm="<<eMax+sqrt(np2m+GSResNn*GSResNn)<<" = M="<<totMass
01650               <<", sm="<<GSResNn+mNeut<<",np2="<<np2m<<",nB="<<nBnd<<G4endl;
01651 #endif
01652         nExcess=eMax-mNeut+nBnd;
01653       }
01654       else nExcess=nBnd;
01655       if(N>1)
01656       {
01657         nnQPDG=G4QPDGCode(90000000+1000*(1000*S+Z)+N-2);
01658         GSResNN=nnQPDG.GetMass();
01659         if(GSResNN+mNeut+mNeut<totMass) nnFlag=true;
01660         if(N>2)
01661         {
01662           /*
01663           // DHW 16 June 2011: variable set but not used.  See note at line 1317.
01664           GSReNNN=G4QPDGCode().GetNuclMass(Z,N-3,S);
01665           */
01666           //if(GSReNNN+mNeut*3<totMass) nnnF=true;
01667         }
01668         if(S>0)
01669         {
01670           /*
01671           // DHW 16 June 2011: variable set but not used.  See note at line 1317.
01672           GSReNNL=G4QPDGCode().GetNuclMass(Z,N-2,S-1);
01673           */
01674           //if(GSReNNL+mNeut+mNeut+mLamb<totMass) nnlF=true;
01675         }
01676       }
01677       if(S>0)
01678       {
01679         nlQPDG=G4QPDGCode(90000000+1000*(1000*(S-1)+Z)+N-1);
01680         GSResNL=nlQPDG.GetMass();
01681         if(GSResNL+mNeut+mLamb<totMass) nlFlag=true;
01682         if(S>1)
01683         {
01684           /*
01685           // DHW 16 June 2011: variable set but not used.  See note at line 1317.
01686           GSReNLL=G4QPDGCode().GetNuclMass(Z,N-1,S-2);
01687           */
01688           //if(GSReNLL+mNeut+mLamb+mLamb<totMass) nllF=true;
01689         }
01690       }
01691     }
01692     G4double GSResNl= GSMass;         // Prototype of Residual Nuclear Mass for Lambda
01693     G4double lExcess= 0.;             // Prototype of excess energy for Lambda
01694     G4double lp2m   = 0.;             // Prototype of max square momentum for lambda
01695     G4double lBnd   = 0.;             // Binding energy for lambda
01696     if(S>0)
01697     {
01698       LQPDG=G4QPDGCode(90000000+1000*(1000*(S-1)+Z)+N);
01699       GSResNl=LQPDG.GetMass();
01700       G4double mpls=GSResNl+mLamb;
01701       G4double mmin=GSResNl-mLamb;
01702       lp2m=(tM2-mpls*mpls)*(tM2-mmin*mmin)/qtM2;
01703       if(lp2m>=0.000001)
01704       {
01705         lFlag=true;
01706         lBnd=mLamb-GSMass+GSResNl;    // Binding energy for lambda
01707         G4double eMax=sqrt(mL2+lp2m);
01708 #ifdef debug
01709         G4cout<<"G4QNuc::EvapBaryon:lm="<<eMax+sqrt(lp2m+GSResNl*GSResNl)<<" = M="<<totMass
01710               <<", sm="<<GSResNl+mLamb<<",lp2="<<lp2m<<",lB="<<lBnd<<G4endl;
01711 #endif
01712         lExcess=eMax-mLamb+lBnd;
01713       }
01714       else lExcess=lBnd;
01715       if(S>1)
01716       {
01717         llQPDG=G4QPDGCode(90000000+1000*(1000*(S-2)+Z)+N);
01718         GSResLL=llQPDG.GetMass();
01719         if(GSResLL+mLamb+mLamb<totMass) llFlag=true;
01720         if(S>2)
01721         {
01722           /*
01723           // DHW 16 June 2011: variable set but not used.  See note at line 1317.
01724           GSReLLL=G4QPDGCode().GetNuclMass(Z,N,S-3);
01725           */
01726           //if(GSReLLL+mLamb*3<totMass) lllF=true;
01727         }
01728       }
01729     }
01730     G4bool nSecF = nnFlag||npFlag||nlFlag||naFlag; // Pos of second radiation after neutron
01731     G4bool pSecF = npFlag||ppFlag||plFlag||paFlag; // Pos of second radiation after proton
01732     G4bool lSecF = nlFlag||plFlag||llFlag||laFlag; // Pos of second radiation after lambda
01733     G4bool aSecF = naFlag||paFlag||laFlag||aaFlag; // Pos of second radiation after alpha
01734     //G4bool nTrF=nnnF||nnpF||nppF||nnlF||nplF||nllF; //Pos of 3-d baryon radiation after n
01735     //G4bool pTrF=nnpF||nppF||pppF||nplF||pplF||pllF; //Pos of 3-d baryon radiation after p
01736     //G4bool lTrF=nnlF||nplF||pplF||nllF||pllF||lllF; //Pos of 3-d baryon radiation after l
01737     //G4bool aTrF=nnaF||npaF||ppaF||nlaF||plaF||llaF; //Pos of 3-d baryon radiation after a
01738     G4bool secB  = nSecF||pSecF||lSecF||aSecF; // Possibili to decay in TwoBaryons (Alphas)
01739     //G4bool thdB  = nTrF||pTrF||lTrF||aTrF||naaF||paaF||laaF||aaaF;// Pos to radiate three
01740 #ifdef debug
01741     G4cout<<"G4QNucl::EvapBary:n="<<nSecF<<",p="<<pSecF<<",l="<<lSecF<<",a="<<aSecF<<",nn="
01742           <<nnFlag<<", np="<<npFlag<<",pp="<<ppFlag<<",pa="<<paFlag<<",na="<<naFlag<<",aa="
01743           <<aaFlag<<G4endl;
01744 #endif
01745     G4QPDGCode bQPDG;
01746     G4QPDGCode rQPDG;
01747     if(secB)                            // Decay in two baryons is possible
01748     //if(thdB)                            //@@CHECK@@ Decay in three baryons is possible
01749     {
01750       if(!nSecF) nFlag=false;
01751       if(!pSecF) pFlag=false;
01752       if(!lSecF) lFlag=false;
01753       if(!aSecF) aFlag=false;
01754 #ifdef debug
01755       G4cout<<"G4QNuc::EB:nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
01756 #endif
01757       G4double maxE=0.;                          // Prototype for maximum energy
01758       if(nFlag&&nExcess>maxE) maxE=nExcess;
01759       if(pFlag&&pExcess>maxE) maxE=pExcess;
01760       if(lFlag&&lExcess>maxE) maxE=lExcess;
01761       if(lFlag&&aExcess>maxE) maxE=aExcess;
01762       G4double pMin=pBnd;                        // Binding energy for proton
01763       if(pFlag)pMin+= PBarr;                     // Add Coulomb Barrier for protons
01764       G4double nMin=nBnd;                        // Binding energy for neutron
01765       G4double lMin=lBnd;                        // Binding energy for Lambda
01766       G4double aMin=aBnd;                        // Binding energy for alpha
01767       if(aFlag)aMin+= ABarr;                     // Add Coulomb Barrier for alpha
01768       G4double minE=GSMass;                      // Prototype for mimimum energy
01769       if(nFlag&&nMin<minE) minE=nMin;
01770       if(pFlag&&pMin<minE) minE=pMin;
01771       if(lFlag&&lMin<minE) minE=lMin;
01772       if(evalph&&aFlag&&aMin<minE) minE=aMin;
01773 
01774 #ifdef debug
01775       G4cout<<"G4QNucleus::EvapBaryon: nE="<<nExcess<<">"<<nMin<<",pE="<<pExcess<<">"<<pMin
01776             <<",sE="<<lExcess<<">"<<lMin<<",E="<<aExcess<<">"<<aMin<<",miE="<<minE<<"<maE="
01777             <<maxE<<G4endl;
01778 #endif
01779       // @@ Here one can put a condition for the Baryon Gun
01780       G4int    cntr= 0;
01781       //G4int    cntm= 27;
01782       //G4int    cntm= 72;               // Important difference !!DOn't change
01783       //G4int    cntm= 80;               // Important difference !!DOn'tChange"IsoNuclei"
01784       //G4int    cntm= 90;               // Important difference !!DOn'tChange "Lept/Hyper"
01785       G4int    cntm= 53;       // @@ NonClusters in CHIPSWorld (cntm=nQHM in G4QPDGCode.hh)
01786       if( ( (pFlag && pExcess > pMin) || 
01787             (nFlag && nExcess > nMin) || 
01788             (lFlag && lExcess > lMin) ||
01789             (aFlag && aExcess > aMin) ) && minE<maxE )
01790       {
01791         G4double mi=uWell+minE;          // Minimum Kinetic Energy for minimal nucleon
01792         G4double mm_value=uWell+maxE;    // Personal maximum for Kinetic Energy
01793         G4double ma=uWell*a+maxE;        // Total Kinetic Energy of baryons (@@alphas?)
01794         if(mi<0.)
01795         {
01796           uW-=mi;
01797           mm_value-=mi;
01798           mi=0.;
01799         }
01800         //G4bool good=true;
01801         if(ma<mm_value)
01802         {
01803           ma=mm_value;
01804           //good=false;
01805         }
01806 #ifdef debug
01807         G4cout<<"G4QNuc::EvapBary:iE="<<minE<<",aE="<<maxE<<",mi="<<mi<<",mm="<<mm_value<<",ma="
01808               <<ma<<G4endl;
01809 #endif
01810         G4double xMi=mi/ma;                       // Minimal value of x
01811         G4double xMm=mm_value/ma;                 // Personal maximum x
01812         //G4double xCa=maSht-coSht*log(a);        // Maximal value of x (approximation)
01813         //G4double xMa=xCa;                       // Maximal value of x
01814         //if(xMm<xMa) xMa=xMm;
01815         G4double xMa=xMm;
01816         if(xMa>1.)xMa=1.;
01817         if(xMi<0.)xMi=0.;
01818         if(xMi>xMa)
01819         {
01820           G4cerr<<"***G4QNucleus::EvapBaryon: M="<<mm_value/ma<<",xi="<<xMi<<",xa="<<xMa<<G4endl;
01821           return false;
01822         }
01823         xMi=sqrt(xMi);                          // @@ ?
01824         xMa=sqrt(xMa);                          // @@ ?
01825 #ifdef debug
01826         G4cout<<"G4QNuc:EvapBaryon:mi="<<mi<<",ma="<<ma<<", xi="<<xMi<<",xa="<<xMa<<G4endl;
01827 #endif
01828         G4double powr=1.5*a1;                   // Power for low & up limits
01829         G4double revP=1./powr;                  // Reversed power for randomization
01830 #ifdef debug
01831         G4cout<<"G4QNucleus::EvaporateBaryon: Power="<<powr<<",RevPower="<<revP<<G4endl;
01832 #endif
01833         G4double minR=pow(1.-xMa*xMa,powr);    // Look on @@ ? (up)
01834         G4double maxR=pow(1.-xMi*xMi,powr);
01835 #ifdef debug
01836         G4cout<<"G4QNucleus::EvaporateBaryon: miR="<<minR<<", maR="<<maxR<<G4endl;
01837 #endif
01838         G4bool   cond=true;
01839         G4int    PDG = 0;
01840         G4double tk  = 0.;                      // Kinetic energy over the well
01841         while(cond&&cntr<cntm)
01842         {
01843           G4double R = minR+(maxR-minR)*G4UniformRand();
01844           //if(!good)R = maxR;
01845           G4double x2= 1.-pow(R,revP);
01846           G4double x = sqrt(x2);
01847           if(x<xMi||x>xMa)
01848           {
01849 #ifdef debug
01850             G4cerr<<"**G4QNucl::EvapB:R="<<R<<",xi="<<xMi<<" < "<<x<<" < xa="<<xMa<<G4endl;
01851 #endif
01852             if(x<xMi) x=xMi;
01853             else      x=xMa;
01854             x2 = x*x;
01855           }
01856           G4double rn=G4UniformRand();
01857           //if(rn<x/xMa||!good)
01858           if(rn<x/xMa)                                 // Randomization cut
01859           {
01860             tk= ma*x2-uW;                              // Kinetic energy of the fragment
01861             G4double psum =0.;
01862             G4double zCBPP=0.;                         // Probabylity for a proton
01863 #ifdef debug
01864             G4cout<<"G4QNuc::EvapB:t="<<tk<<",pM="<<pMin<<",pB="<<pBnd<<",n="<<nMin<<",a="
01865                   <<aMin<<G4endl;
01866 #endif
01867             if(pFlag&&tk>pMin)
01868             {
01869               G4double kin=tk-pBnd;
01870               //if(barf) kin-=PBarr; //@@ This is a mistake
01871 #ifdef debug
01872               G4cout<<"G4QN::EB:Proton="<<kin<<",CB="<<PBarr<<",B="<<pBnd<<",M="<<pMin
01873                     <<",p="<<CoulBarPenProb(PBarr,kin,1,1)<<G4endl;
01874 #endif
01875               zCBPP=Z*CoulBarPenProb(PBarr,kin,1,1)*sqrt(kin);
01876             }
01877             psum+=zCBPP;
01878             G4double nCBPP=0.;                       // Probability for a neutron (=> p+n)
01879             if(nFlag&&tk>nMin)
01880             {
01881               G4double kin=tk-nBnd;
01882 #ifdef debug
01883               G4cout<<"G4QN::EB:Neutron="<<kin<<",p="<<CoulBarPenProb(0.,kin,0,1)<<G4endl;
01884 #endif
01885               nCBPP=N*CoulBarPenProb(0.,kin,0,1)*sqrt(kin);
01886             }
01887             psum+=nCBPP;
01888             nCBPP+=zCBPP;
01889             G4double lCBPP=0.;                       // Probability for a lambda (=> p+n+l)
01890             if(lFlag&&tk>lMin)
01891             {
01892               G4double kin=tk-lBnd;
01893 #ifdef debug
01894               G4cout<<"G4QN::EB:Lambda="<<kin<<",p="<<CoulBarPenProb(0,kin,0,1)<<G4endl;
01895 #endif
01896               lCBPP=S*CoulBarPenProb(0.,kin,0,1)*sqrt(kin);
01897             }
01898             psum+=lCBPP;
01899             lCBPP+=nCBPP;
01900             if(evalph&&aFlag&&tk>aMin)
01901             {
01902               G4double kin=tk-aBnd;
01903               //if(barf) kin-=ABarr; //@@ This is a mistake
01904 #ifdef debug
01905               G4cout<<"G4QN::EB:Alpha="<<kin<<",CB="<<ABarr<<",p="
01906                     <<CoulBarPenProb(ABarr,kin,2,4)<<G4endl;
01907 #endif
01908               psum+=CoulBarPenProb(ABarr,kin,2,4)*sqrt(kin)*evalph*Z*(Z-1)*N*(N-1)
01909                                                  *6/a1/(a-2)/(a-3);
01910             }
01911             G4double r = psum*G4UniformRand();
01912 #ifdef debug
01913             G4cout<<"G4QNuc::EvapB:"<<r<<",p="<<zCBPP<<",pn="<<nCBPP<<",pnl="<<lCBPP<<",t="
01914                   <<psum<<G4endl;
01915 #endif
01916             cond = false;
01917             if     (r&&r>lCBPP)
01918             {
01919 #ifdef debug
01920               G4cout<<"G4QNuc::EvaB:ALPHA is selected for evap, r="<<r<<">"<<lCBPP<<G4endl;
01921 #endif
01922               PDG=aPDG;
01923             }
01924             else if(r&&r>nCBPP&&r<=lCBPP)
01925             {
01926 #ifdef debug
01927               G4cout<<"G4QNuc::EvaB:LAMBDA is selected for evap,r="<<r<<"<"<<lCBPP<<G4endl;
01928 #endif
01929               PDG=lPDG;
01930             }
01931             else if(r&&r>zCBPP&&r<=nCBPP)
01932             {
01933 #ifdef debug
01934               G4cout<<"G4QNuc::EvaBar: N is selected for evapor,r="<<r<<"<"<<nCBPP<<G4endl;
01935 #endif
01936               PDG=nPDG;
01937             }
01938             else if(r&&r<=zCBPP)
01939             {
01940 #ifdef debug
01941               G4cout<<"G4QNuc::EvaBar: P is selected for evapor,r="<<r<<"<"<<zCBPP<<G4endl;
01942 #endif
01943               PDG=pPDG;
01944             }
01945             else cond=true;
01946           }
01947 #ifdef debug
01948           G4cout<<"G4QNuc::EvapBar:c="<<cond<<",x="<<x<<",cnt="<<cntr<<",R="<<R<<",ma="<<ma
01949                 <<",rn="<<rn<<"<r="<<x/xMa<<",tk="<<tk<<",ni="<<nMin<<",pi="<<pMin<<G4endl;
01950 #endif
01951           cntr++;
01952         }
01953         if(cntr<cntm)                       // => Succeeded to find the evaporation channel
01954         {
01955           G4double p2=0.;
01956           if     (PDG==aPDG)
01957           {
01958             tk-=aBnd-mAlph;                 // Pays for binding and convert to total energy
01959             p2=tk*tk-mA2;
01960             if(p2>ap2m)
01961             {
01962               p2=ap2m;
01963               tk=sqrt(p2+mA2);
01964             }
01965             eMass=mAlph;
01966             bQPDG=aQPDG;
01967             rQPDG=AQPDG;
01968           }
01969           else if(PDG==pPDG)
01970           {
01971             tk-=pBnd-mProt;                 // Pays for binding and convert to total energy
01972             p2=tk*tk-mP2;
01973             if(p2>pp2m)
01974             {
01975               p2=pp2m;
01976               tk=sqrt(p2+mP2);
01977             }
01978             eMass=mProt;
01979             bQPDG=pQPDG;
01980             rQPDG=PQPDG;
01981           }
01982           else if(PDG==nPDG)
01983           {
01984             tk-=nBnd-mNeut;                 // Pays for binding and convert to total energy
01985             p2=tk*tk-mN2;
01986 #ifdef debug
01987             G4cout<<"G4QNucleus::EvaporateBaryon:np2="<<p2<<",np2m="<<np2m<<G4endl;
01988 #endif
01989             if(p2>np2m)
01990             {
01991               p2=np2m;
01992               tk=sqrt(p2+mN2);
01993             }
01994             eMass=mNeut;
01995             bQPDG=nQPDG;
01996             rQPDG=NQPDG;
01997           }
01998           else if(PDG==lPDG)
01999           {
02000             tk-=lBnd-mLamb;                 // Pays for binding and convert to total energy
02001             p2=tk*tk-mL2;
02002             if(p2>lp2m)
02003             {
02004               p2=lp2m;
02005               tk=sqrt(p2+mL2);
02006             }
02007             eMass=mLamb;
02008             bQPDG=lQPDG;
02009             rQPDG=LQPDG;
02010           }
02011           else G4cerr<<"***G4QNucleus::EvaporateBaryon: PDG="<<PDG<<G4endl;
02012           G4double rEn=totMass-tk;
02013           G4double rEn2=rEn*rEn;
02014           if (rEn2 > p2) rMass=sqrt(rEn2-p2);      // Mass of the Residual Nucleus
02015           else           rMass=0.0;
02016           // Find out if the ResidualNucleus is below of the SecondBaryonDecayLimit
02017           //@@ Calculate it depending on PDG !!!!!!!
02018           G4bool nnCond = !nnFlag || (nnFlag && GSResNN+mNeut > rMass);
02019           G4bool npCond = !npFlag || (npFlag && GSResNP+mProt+PBarr > rMass);
02020           G4bool nlCond = !nlFlag || (nlFlag && GSResNL+mLamb > rMass);
02021           G4bool naCond = !naFlag || (naFlag && GSResNA+mAlph+ABarr > rMass);
02022           G4bool pnCond = !npFlag || (npFlag && GSResNP+mNeut > rMass);
02023           if(barf) pnCond = !npFlag || (npFlag && GSResNP+mNeut+PBarr > rMass);
02024           G4bool ppCond = !ppFlag || (ppFlag && GSResPP+mProt+PPBarr > rMass);
02025           if(barf) ppCond = !ppFlag || (ppFlag && GSResPP+mProt+SPPBarr > rMass);
02026           G4bool plCond = !plFlag || (plFlag && GSResPL+mLamb > rMass);
02027           if(barf) plCond = !plFlag || (plFlag && GSResPL+mLamb+PBarr > rMass);
02028           G4bool paCond = !paFlag || (paFlag && GSResPA+mAlph+APBarr > rMass);
02029           if(barf) paCond = !paFlag || (paFlag && GSResPA+mAlph+SAPBarr > rMass);
02030           G4bool lnCond = !nlFlag || (nlFlag && GSResNL+mNeut > rMass);
02031           G4bool lpCond = !plFlag || (plFlag && GSResPL+mProt+PBarr > rMass);
02032           G4bool llCond = !llFlag || (llFlag && GSResLL+mLamb > rMass);
02033           G4bool laCond = !laFlag || (laFlag && GSResLA+mAlph+ABarr > rMass);
02034           G4bool anCond = !naFlag || (naFlag && GSResNA+mNeut > rMass);
02035           if(barf) anCond = !naFlag || (naFlag && GSResNA+mNeut+ABarr > rMass);
02036           G4bool apCond = !paFlag || (paFlag && GSResPA+mProt+PABarr > rMass);
02037           if(barf) apCond = !paFlag || (paFlag && GSResPA+mProt+SAPBarr > rMass);
02038           G4bool alCond = !laFlag || (laFlag && GSResLA+mLamb > rMass);
02039           if(barf) alCond = !laFlag || (laFlag && GSResLA+mLamb+ABarr > rMass);
02040           G4bool aaCond = !aaFlag || (aaFlag && GSResAA+mAlph+AABarr > rMass);
02041           if(barf) aaCond = !aaFlag || (aaFlag && GSResAA+mAlph+SAABarr > rMass);
02042 #ifdef debug
02043           G4cout<<"G4QNucl::EvaB:"<<PDG<<", E="<<tk<<", rM="<<rMass<<", ";
02044           if(PDG==pPDG)      G4cout<<"PN="<<GSResNP+mNeut<<"("<<pnCond<<"),PP="
02045                                    <<GSResPP+mProt+PPBarr<<"("<<ppCond<<"),PL="
02046                                    <<GSResPL+mLamb<<"("<<plCond<<"),PA="
02047                                    <<GSResPA+mAlph+APBarr<<"("<<paCond;
02048           else if(PDG==nPDG) G4cout<<"NN="<<GSResNN+mNeut<<"("<<nnCond<<"),NP="
02049                                    <<GSResNP+mProt+PBarr<<"("<<npCond<<"),NL="
02050                                    <<GSResNL+mLamb<<"("<<nlCond<<"),NA="
02051                                    <<GSResNA+mAlph+ABarr<<"("<<naCond;
02052           else if(PDG==lPDG) G4cout<<"LN="<<GSResNL+mNeut<<"("<<lnCond<<"),LP="
02053                                    <<GSResPL+mProt+PBarr<<"("<<lpCond<<"),LL="
02054                                    <<GSResLL+mLamb<<"("<<llCond<<"),LA="
02055                                    <<GSResLA+mAlph+ABarr<<"("<<laCond;
02056           else if(PDG==aPDG) G4cout<<"AN="<<GSResNA+mNeut<<"("<<anCond<<"),AP="
02057                                    <<GSResPA+mProt+PABarr<<"("<<apCond<<"),AL="
02058                                    <<GSResLA+mLamb<<"("<<alCond<<"),AA="
02059                                    <<GSResAA+mAlph+AABarr<<"("<<aaCond;
02060           G4cout<<")"<<G4endl;
02061 #endif
02062           three=false;                               // Flag of b+b+ResNuc decay
02063           //if(3>2)three=false;                        // @@@@@@@@@@@@@@@@@@
02064           //else if(PDG==pPDG&&(pnCond&&ppCond&&plCond&&paCond)) // @@@@@@@@@@@@@@@@@@@
02065           if(PDG==pPDG&&(pnCond&&ppCond&&plCond&&paCond))//p+RN decay, p+b+RN dec is closed
02066           {
02067 #ifdef debug
02068             G4cout<<"G4QN::EB:*p*: n="<<pnCond<<",p="<<ppCond<<",l="<<plCond<<",a="<<paCond
02069                   <<G4endl;
02070 #endif
02071             fMass=mProt;
02072             fQPDG=pQPDG;
02073             G4double nLim=0.;
02074             if(N&&GSResNP!=GSMass&&fMass+PBarr+mNeut+GSResNP<totMass)
02075             {
02076               if(barf) nLim+=(N+N)*pow(totMass-mNeut-mProt-PBarr-GSResNP,2);
02077               else     nLim+=(N+N)*pow(totMass-mNeut-mProt-GSResNP,2);
02078             }
02079             G4double zLim=nLim;
02080             if(Z>1&&GSResPP!=GSMass&&fMass+mProt+SPPBarr+GSResPP<totMass)
02081             {
02082               if(barf) zLim+=(Z-1)*pow(totMass-mProt-mProt-SPPBarr-GSResPP,2);
02083               else     zLim+=(Z-1)*pow(totMass-mProt-mProt-GSResPP,2);
02084             }
02085             G4double sLim=zLim;
02086             if(S&&GSResPL!=GSMass&&fMass+PBarr+mLamb+GSResPL<totMass)
02087             {
02088               if(barf) sLim+=(S+S)*pow(totMass-mProt-mLamb-PBarr-GSResPL,2);
02089               else     sLim+=(S+S)*pow(totMass-mProt-mLamb-GSResPL,2);
02090             }
02091             G4double aLim=sLim;
02092             if(evalph&&Z>2&&N>1&&a>4&&GSResPL!=GSMass&&fMass+SAPBarr+mAlph+GSResPA<totMass)
02093             {
02094               if(barf) aLim+=pow(totMass-mProt-mAlph-SAPBarr-GSResPA,2)*evalph*
02095                              (Z-1)*(Z-2)*N*(N-1)*12/(a-2)/(a-3)/(a-4);
02096               else     aLim+=pow(totMass-mProt-mAlph-GSResPA,2)*evalph*(Z-1)*(Z-2)*N*(N-1)
02097                              *12/(a-2)/(a-3)/(a-4);
02098             }
02099             G4double r = aLim*G4UniformRand();
02100 #ifdef debug
02101             G4cout<<"G4QNuc::EvaB:p, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="
02102                   <<aLim<<G4endl;
02103 #endif
02104             three=true;                               // Flag of b+b+ResNuc decay
02105             if(!aLim) three=false;
02106             else if(r>sLim)
02107             {
02108               eMass = mAlph;
02109               dbQPDG= PAQPDG;
02110               rMass = GSResPA;
02111               rQPDG = paQPDG;
02112 #ifdef debug
02113               G4cout<<"G4QNucleus::EvaporateBary: P+A"<<G4endl;
02114 #endif
02115             }
02116             else if(zLim<sLim&&r>zLim&&r<=sLim)
02117             {
02118               eMass = mLamb;
02119               dbQPDG= PLQPDG;
02120               rMass = GSResPL;
02121               rQPDG = plQPDG;
02122 #ifdef debug
02123               G4cout<<"G4QNucleus::EvaporateBary: P+L"<<G4endl;
02124 #endif
02125             }
02126             else if(nLim<zLim&&r>nLim&&r<=zLim)
02127             {
02128               eMass = mProt;
02129               dbQPDG= PPQPDG;
02130               rMass = GSResPP;
02131               rQPDG = ppQPDG;
02132 #ifdef debug
02133               G4cout<<"G4QNucleus::EvaporateBary: P+P"<<G4endl;
02134 #endif
02135             }
02136             else if(r<=nLim)
02137             {
02138               eMass = mNeut;
02139               dbQPDG= NPQPDG;
02140               rMass = GSResNP;
02141               rQPDG = npQPDG;
02142 #ifdef debug
02143               G4cout<<"G4QNucleus::EvaporateBary: P+N"<<G4endl;
02144 #endif
02145             }
02146             else three=false;
02147           }
02148           else if(PDG==nPDG&&(nnCond&&npCond&&nlCond&&naCond)) // n+b+RN decay can't happen
02149           { //@@ Take into account Coulomb Barier Penetration Probability
02150 #ifdef debug
02151             G4cout<<"G4QN::EB:*n*: n="<<nnCond<<",p="<<npCond<<",l="<<nlCond<<",a="<<naCond
02152                   <<G4endl;
02153 #endif
02154             fMass=mNeut;
02155             fQPDG=nQPDG;
02156             G4double nLim=0.;
02157             if(N>1&&GSResNN!=GSMass&&fMass+mNeut+GSResNN<totMass)
02158               nLim+=(N-1)*pow(totMass-mNeut-mNeut-GSResNN,2);
02159             G4double zLim=nLim;
02160             if(Z&&GSResNP!=GSMass&&fMass+mProt+PBarr+GSResNP<totMass)
02161             {
02162               if(barf) zLim+=(Z+Z)*pow(totMass-mNeut-mProt-PBarr-GSResNP,2);
02163               else     zLim+=(Z+Z)*pow(totMass-mNeut-mProt-GSResNP,2);
02164             }
02165             G4double sLim=zLim;
02166             if(S&&GSResNL!=GSMass&&fMass+mLamb+GSResNL<totMass)
02167               sLim+=(S+S)*pow(totMass-mNeut-mLamb-GSResNL,2);
02168             G4double aLim=sLim;
02169             if(evalph&&Z>1&&N>2&&a>4&&GSResNA!=GSMass&&fMass+mAlph+ABarr+GSResNA<totMass)
02170             {
02171               if(barf) aLim+=pow(totMass-mNeut-mAlph-ABarr-GSResNA,2)*
02172                              evalph*Z*(Z-1)*(N-1)*(N-2)*12/(a-2)/(a-3)/(a-4);
02173               else     aLim+=pow(totMass-mNeut-mAlph-GSResNA,2)*
02174                              evalph*Z*(Z-1)*(N-1)*(N-2)*12/(a-2)/(a-3)/(a-4);
02175             }
02176             G4double r = aLim*G4UniformRand();
02177 #ifdef debug
02178             G4cout<<"G4QN::EB:n, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
02179                   <<G4endl;
02180 #endif
02181             three=true;                               // Flag of b+b+ResNuc decay
02182             if(!aLim) three=false;
02183             else if(r>sLim)
02184             {
02185               eMass = mAlph;
02186               dbQPDG= NAQPDG;
02187               rMass = GSResNA;
02188               rQPDG = naQPDG;
02189 #ifdef debug
02190               G4cout<<"G4QNucleus::EvaporateBary: N+A"<<G4endl;
02191 #endif
02192             }
02193             else if(zLim<sLim&&r>zLim&&r<=sLim)
02194             {
02195               eMass = mLamb;
02196               dbQPDG= NLQPDG;
02197               rMass = GSResNL;
02198               rQPDG = nlQPDG;
02199 #ifdef debug
02200               G4cout<<"G4QNucleus::EvaporateBary: N+L"<<G4endl;
02201 #endif
02202             }
02203             else if(nLim<zLim&&r>nLim&&r<=zLim)
02204             {
02205               eMass = mProt;
02206               dbQPDG= NPQPDG;
02207               rMass = GSResNP;
02208               rQPDG = npQPDG;
02209 #ifdef debug
02210               G4cout<<"G4QNucleus::EvaporateBary: N+P"<<G4endl;
02211 #endif
02212             }
02213             else if(r<=nLim)
02214             {
02215               eMass = mNeut;
02216               dbQPDG= NNQPDG;
02217               rMass = GSResNN;
02218               rQPDG = nnQPDG;
02219 #ifdef debug
02220               G4cout<<"G4QNucleus::EvaporateBary: N+N"<<G4endl;
02221 #endif
02222             }     
02223             else three=false;
02224           }
02225           else if(PDG==lPDG&&(lnCond&&lpCond&&llCond&&laCond)) // l+b+RN decay can't happen
02226           { //@@ Take into account Coulomb Barier Penetration Probability
02227 #ifdef debug
02228             G4cout<<"G4QN::EB:*l*: n="<<lnCond<<",p="<<lpCond<<",l="<<llCond<<",a="<<laCond
02229                   <<G4endl;
02230 #endif
02231             fMass=mLamb;
02232             fQPDG=lQPDG;
02233             G4double nLim=0.;
02234             if(N&&GSResNL!=GSMass&&fMass+mNeut+GSResNL<totMass)
02235               nLim+=(N+N)*pow(totMass-mNeut-mLamb-GSResNL,2);
02236             G4double zLim=nLim;
02237             if(Z&&GSResPL!=GSMass&&fMass+mProt+PBarr+GSResPL<totMass)
02238             {
02239               if(barf) zLim+=(Z+Z)*pow(totMass-mProt-mLamb-PBarr-GSResPL,2);
02240               else zLim+=(Z+Z)*pow(totMass-mProt-mLamb-GSResPL,2);
02241             }
02242             G4double sLim=zLim;
02243             if(S>1&&GSResLL!=GSMass&&fMass+mLamb+GSResLL<totMass)
02244               sLim+=(S-1)*pow(totMass-mLamb-mLamb-GSResLL,2);
02245             G4double aLim=sLim;
02246             if(evalph&&Z>1&&N>1&&a>4&&GSResLA!=GSMass&&fMass+mAlph+ABarr+GSResLA<totMass)
02247             {
02248               if(barf) aLim+=pow(totMass-mLamb-mAlph-ABarr-GSResLA,2)*
02249                              evalph*Z*(Z-1)*N*(N-1)*12/(a-2)/(a-3)/(a-4);
02250               else     aLim+=pow(totMass-mLamb-mAlph-GSResLA,2)*
02251                              evalph*Z*(Z-1)*N*(N-1)*12/(a-2)/(a-3)/(a-4);
02252             }
02253             G4double r = aLim*G4UniformRand();
02254 #ifdef debug
02255             G4cout<<"G4QN::EB:l, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
02256                   <<G4endl;
02257 #endif
02258             three=true;                               // Flag of b+b+ResNuc decay
02259             if(!aLim) three=false;
02260             else if(r>sLim)
02261             {
02262               eMass = mAlph;
02263               dbQPDG= LAQPDG;
02264               rMass = GSResLA;
02265               rQPDG = laQPDG;
02266 #ifdef debug
02267               G4cout<<"G4QNucleus::EvaporateBary: L+A"<<G4endl;
02268 #endif
02269             }
02270             else if(zLim<sLim&&r>zLim&&r<=sLim)
02271             {
02272               eMass = mLamb;
02273               dbQPDG= LLQPDG;
02274               rMass = GSResLL;
02275               rQPDG = llQPDG;
02276 #ifdef debug
02277               G4cout<<"G4QNucleus::EvaporateBary: L+L"<<G4endl;
02278 #endif
02279             }
02280             else if(nLim<zLim&&r>nLim&&r<=zLim)
02281             {
02282               eMass = mProt;
02283               dbQPDG= PLQPDG;
02284               rMass = GSResPL;
02285               rQPDG = plQPDG;
02286 #ifdef debug
02287               G4cout<<"G4QNucleus::EvaporateBary: L+P"<<G4endl;
02288 #endif
02289             }
02290             else if(r<=nLim)
02291             {
02292               eMass = mNeut;
02293               dbQPDG= NLQPDG;
02294               rMass = GSResNL;
02295               rQPDG = nlQPDG;
02296 #ifdef debug
02297               G4cout<<"G4QNucleus::EvaporateBary: L+N"<<G4endl;
02298 #endif
02299             }
02300             else three=false;
02301           }
02302           else if(PDG==aPDG&&(anCond&&apCond&&alCond&&aaCond)) // a+b+RN decay can't happen
02303           { //@@ Take into account Coulomb Barier Penetration Probability
02304 #ifdef debug
02305             G4cout<<"G4QN::EB:*a*: n="<<anCond<<",p="<<apCond<<",l="<<alCond<<",a="<<aaCond
02306                   <<G4endl;
02307 #endif
02308             fMass=mAlph;
02309             fQPDG=aQPDG;
02310             G4double nLim=0.;
02311             if(N>2&&GSResNA!=GSMass&&fMass+mNeut+ABarr+GSResNA<totMass)
02312             {
02313               if(barf) nLim+=(N-2)*pow(totMass-mNeut-mAlph-ABarr-GSResNA,2);
02314               else     nLim+=(N-2)*pow(totMass-mNeut-mAlph-GSResNA,2);
02315             }
02316             G4double zLim=nLim;
02317             if(Z>2&&GSResPA!=GSMass&&fMass+mProt+SAPBarr+GSResPA<totMass)
02318             {
02319               if(barf) zLim+=(Z-2)*pow(totMass-mProt-mAlph-SAPBarr-GSResPA,2);
02320               else     zLim+=(Z-2)*pow(totMass-mProt-mAlph-GSResPA,2);
02321             }
02322             G4double sLim=zLim;
02323             if(S&&GSResLA!=GSMass&&fMass+mLamb+ABarr+GSResLA<totMass)
02324             {
02325               if(barf) sLim+=S*pow(totMass-mLamb-mAlph-ABarr-GSResLA,2);
02326               else     sLim+=S*pow(totMass-mLamb-mAlph-GSResLA,2);
02327             }
02328             G4double aLim=sLim;
02329             if(evalph&&Z>3&&N>3&&a>7&&GSResAA!=GSMass&&fMass+mAlph+SAABarr+GSResAA<totMass)
02330             {
02331               if(barf) aLim+=pow(totMass-mAlph-mAlph-SAABarr-GSResAA,2)*
02332                              evalph*(Z-2)*(Z-3)*(N-2)*(N-3)*12/(a-5)/(a-6)/(a-7);
02333               else     aLim+=pow(totMass-mAlph-mAlph-GSResAA,2)*
02334                              evalph*(Z-2)*(Z-3)*(N-2)*(N-3)*12/(a-5)/(a-6)/(a-7);
02335             }
02336             G4double r = aLim*G4UniformRand();
02337 #ifdef debug
02338             G4cout<<"G4QN::EB:a, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
02339                   <<G4endl;
02340 #endif
02341             three=true;                               // Flag of b+b+ResNuc decay
02342             if(!aLim) three=false;
02343             else if(r>sLim)
02344             {
02345               eMass = mAlph;
02346               dbQPDG= AAQPDG;
02347               rMass = GSResAA;
02348               rQPDG = aaQPDG;
02349 #ifdef debug
02350               G4cout<<"G4QNucleus::EvaporateBary: A+A"<<G4endl;
02351 #endif
02352             }
02353             else if(zLim<sLim&&r>zLim&&r<=sLim)
02354             {
02355               eMass = mLamb;
02356               dbQPDG= LAQPDG;
02357               rMass = GSResLA;
02358               rQPDG = laQPDG;
02359 #ifdef debug
02360               G4cout<<"G4QNucleus::EvaporateBary: A+L"<<G4endl;
02361 #endif
02362             }
02363             else if(nLim<zLim&&r>nLim&&r<=zLim)
02364             {
02365               eMass = mProt;
02366               dbQPDG= PAQPDG;
02367               rMass = GSResPA;
02368               rQPDG = paQPDG;
02369 #ifdef debug
02370               G4cout<<"G4QNucleus::EvaporateBary: A+P"<<G4endl;
02371 #endif
02372             }
02373             else if(r<=nLim)
02374             {
02375               eMass = mNeut;
02376               dbQPDG= NAQPDG;
02377               rMass = GSResNA;
02378               rQPDG = naQPDG;
02379 #ifdef debug
02380               G4cout<<"G4QNucleus::EvaporateBary: A+N"<<G4endl;
02381 #endif
02382             }
02383             else three=false;
02384           }
02385           else three=false;
02386           if(rMass<1600.)
02387           {
02388             if     (rQPDG==pQPDG)rMass=mProt;
02389             else if(rQPDG==nQPDG)rMass=mNeut;
02390             else if(rQPDG==lQPDG)rMass=mLamb;
02391           }
02392 #ifdef debug
02393           G4cout<<"G4QNucleus::EvaporateBary:evaBar="<<eMass<<bQPDG<<",resN="<<rMass<<rQPDG
02394                 <<",secB="<<fMass<<",three="<<three<<G4endl;
02395 #endif
02396         }
02397       }
02398       else // =-------------=> Just decay in a baryon and a residual (to avoid gamma-decay)
02399       { //@@ Take into account Coulomb Barier Penetration Probability (?? - Emergency)
02400         G4double nLim=0.;
02401         if(nFlag&&mNeut+GSResNn<totMass)
02402         {
02403           G4double ken=totMass-mNeut-GSResNn;
02404           nLim+=N*CoulBarPenProb(0.,ken,0,1)*sqrt(ken);
02405         }
02406         G4double zLim=nLim;
02407         if(pFlag&&mProt+PBarr+GSResNp<totMass)
02408         {
02409           G4double ken=totMass-mProt-GSResNp;
02410           if(barf) ken-=PBarr;
02411           zLim+=Z*CoulBarPenProb(PBarr,ken,1,1)*sqrt(ken);
02412         }
02413         G4double sLim=zLim;
02414         if(lFlag&&mLamb+GSResNl<totMass)
02415         {
02416           G4double ken=totMass-mLamb-GSResNl;
02417           sLim+=S*CoulBarPenProb(0.,ken,0,1)*sqrt(ken);
02418         }
02419         G4double aLim=sLim;
02420         if(evalph&&aFlag&&mAlph+GSResNa+ABarr<totMass)
02421         {
02422           G4double ken=totMass-mAlph-GSResNa;
02423           if(barf) ken-=ABarr;
02424           aLim+=CoulBarPenProb(ABarr,ken,2,4)*sqrt(ken)*evalph*Z*(Z-1)*N*(N-1)
02425                 *6/a1/(a-2)/(a-3);
02426         }
02427         G4double r = aLim*G4UniformRand();
02428 #ifdef debug
02429         G4cout<<"G4QNucl::EvapBar:2Decay r="<<r<<",nLim="<<nLim<<",zLim="<<zLim<<",sLim="
02430               <<sLim<<",nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
02431 #endif
02432         if     (aFlag&&r>sLim)
02433         {
02434           bQPDG=aQPDG;
02435           eMass=mAlph;
02436           rQPDG=AQPDG;
02437           rMass=GSResNa;
02438         }
02439         else if(lFlag&&r>=zLim&&r<=sLim&&zLim<sLim)
02440         {
02441           bQPDG=lQPDG;
02442           eMass=mLamb;
02443           rQPDG=LQPDG;
02444           rMass=GSResNl;
02445         }
02446         else if(nFlag&&r>=nLim&&r<=zLim&&nLim<zLim)
02447         {
02448           bQPDG=pQPDG;
02449           eMass=mProt;
02450           rQPDG=PQPDG;
02451           rMass=GSResNp;
02452         }
02453         else if(pFlag&&r<nLim)
02454         {
02455           bQPDG=nQPDG;
02456           eMass=mNeut;
02457           rQPDG=NQPDG;
02458           rMass=GSResNn;
02459         }
02460         else
02461         {
02462 #ifdef debug
02463           G4cout<<"G4QNucleus::EvaporateBaryon: Photon #2-B#, dM="<<totMass-GSMass<<G4endl;
02464 #endif
02465           bQPDG=gQPDG;
02466           rQPDG=GetQPDG();
02467           eMass=0.;
02468           rMass=GSMass;
02469         }
02470 #ifdef debug
02471         G4cout<<"G4QNucl::EvaporateBaryon: b="<<eMass<<bQPDG<<",r="<<rMass<<rQPDG<<G4endl;
02472 #endif
02473       }
02474       if(three)           // Decay in two baryons + Residual Nucleus
02475       {
02476 #ifdef debug
02477           G4cout<<"G4QNucl::EvaporateBaryon:Decay in 3 particles"<<G4endl;
02478 #endif
02479         h1mom=G4LorentzVector(0.,0.,0.,eMass);
02480         h2mom=G4LorentzVector(0.,0.,0.,rMass);
02481         h3mom=G4LorentzVector(0.,0.,0.,fMass);
02482         if(!DecayIn3(h1mom,h2mom,h3mom))
02483         {
02484 #ifdef debug
02485           G4cout<<"*G4QNucl::EvaporateBaryon:Decay M="<<totMass<<",b="<<eMass<<bQPDG
02486           <<",f="<<fMass<<fQPDG<<",r="<<rMass<<rQPDG<<G4endl;
02487 #endif
02488           return false;
02489         }
02490         h1mom+=h3mom;
02491         bQPDG=dbQPDG;
02492       }
02493       else
02494       {
02495         if(eMass+rMass<totMass&&cntr<cntm)
02496         {
02497 #ifdef debug
02498           G4cout<<"G4QN::EvaB:eM="<<eMass<<"+rM="<<rMass<<" ="<<eMass+rMass<<" < "<<totMass
02499                 <<",c="<<cntr<<" < cm="<<cntm<<", bPDG="<<bQPDG<<", rPDG="<<rQPDG<<G4endl;
02500 #endif
02501           if(rMass<1600.)
02502           {
02503             if     (rQPDG==pQPDG)rMass=mProt;
02504             else if(rQPDG==nQPDG)rMass=mNeut;
02505             else if(rQPDG==lQPDG)rMass=mLamb;
02506           }
02507           h1mom=G4LorentzVector(0.,0.,0.,eMass);
02508           h2mom=G4LorentzVector(0.,0.,0.,rMass);
02509         }
02510         else if(totMass>mNeut+GSResNn)               // Neutron if 2-Decay failed
02511         {
02512 #ifdef debug
02513           G4cout<<"G4QNucl::EvaporateBaryon: Neutron , dM="<<totMass-GSResNn-mNeut<<G4endl;
02514 #endif
02515           bQPDG=nQPDG;
02516           rQPDG=NQPDG;
02517           h1mom=G4LorentzVector(0.,0.,0.,mNeut);
02518           h2mom=G4LorentzVector(0.,0.,0.,GSResNn);      
02519         }
02520         else if(totMass>mProt+PBarr+GSResNp)               // Proton if 2-Decay failed
02521         {
02522 #ifdef debug
02523           G4cout<<"G4QNucl::EvaporateBaryon: Proton , dM="<<totMass-GSResNp-mProt<<G4endl;
02524 #endif
02525           bQPDG=pQPDG;
02526           rQPDG=PQPDG;
02527           h1mom=G4LorentzVector(0.,0.,0.,mProt);
02528           h2mom=G4LorentzVector(0.,0.,0.,GSResNp);      
02529         }
02530         else if(totMass>mAlph+ABarr+GSResNa)               // Alpha if 2-Decay failed
02531         {
02532 #ifdef debug
02533           G4cout<<"G4QNucl::EvaporateBaryon: Alpha , dM="<<totMass-GSResNa-mAlph<<G4endl;
02534 #endif
02535           bQPDG=aQPDG;
02536           rQPDG=AQPDG;
02537           h1mom=G4LorentzVector(0.,0.,0.,mAlph);
02538           h2mom=G4LorentzVector(0.,0.,0.,GSResNa);      
02539         }
02540         else if(totMass>GSMass)               // Photon if 2-Decay failed
02541         {
02542 #ifdef debug
02543           G4cout<<"G4QNucl::EvaporateBaryon:Photon ### 2 ###, dM="<<totMass-GSMass<<G4endl;
02544 #endif
02545           bQPDG=gQPDG;
02546           rQPDG=GetQPDG();
02547           h1mom=G4LorentzVector(0.,0.,0.,0.);
02548           h2mom=G4LorentzVector(0.,0.,0.,GSMass);      
02549         }
02550         else
02551         {
02552           G4cerr<<"***G4QNucl::EvaporateBaryon: Cann't evaporate even gamma (1)"<<G4endl;
02553           return false;
02554         }
02555       }
02556     }
02557     else // ==> Decay in 3 Baryons + Residual is impossible at this point
02558     {
02559       if(secB)                        // Decay in 2Baryons(2a,a+bary)+ResidN is possible
02560       //if(2>3)
02561       {
02562 #ifdef debug
02563         G4cout<<"G4QNucleus::EvaporateBaryon: Decay in 2 baryons"<<G4endl;
02564 #endif
02565         G4bool tpd=true;
02566         //@@ Coulomb Barrier penetration can be added
02567         G4double alp=0.;
02568         if(aSecF)alp=evalph*Z*(Z-1)*N*(N-1)*10/(a-2)/(a-3)/(a-4);
02569         G4double  nnLim=0.;
02570         if(nnFlag&&totMass>mNeut+mNeut+GSResNN)
02571           nnLim+=N*(N-1)*pow(totMass-mNeut-mNeut-GSResNN,2);
02572         G4double  nzLim=nnLim;
02573         if(npFlag&&totMass>mNeut+mProt+PBarr+GSResNP)
02574         {
02575           if(barf) nzLim+=2*N*Z*pow(totMass-mNeut-mProt-PBarr-GSResNP,2);
02576           else     nzLim+=2*N*Z*pow(totMass-mNeut-mProt-GSResNP,2);
02577         }
02578         G4double  zzLim=nzLim;
02579         if(ppFlag&&totMass>mProt+mProt+SPPBarr+GSResPP)
02580         {
02581           if(barf) zzLim+=Z*(Z-1)*pow(totMass-mProt-mProt-SPPBarr-GSResPP,2);
02582           else     zzLim+=Z*(Z-1)*pow(totMass-mProt-mProt-GSResPP,2);
02583         }
02584         G4double  nlLim=zzLim;
02585         if(nlFlag&&totMass>mNeut+mLamb+GSResNL)
02586           nlLim+=2*N*S*pow(totMass-mNeut-mLamb-GSResNL,2);
02587         G4double  zlLim=nlLim;
02588         if(plFlag&&totMass>mProt+PBarr+mLamb+GSResPL)
02589         {
02590           if(barf) zlLim+=2*Z*S*pow(totMass-mProt-mLamb-PBarr-GSResPL,2);
02591           else     zlLim+=2*Z*S*pow(totMass-mProt-mLamb-GSResPL,2);
02592         }
02593         G4double  llLim=zlLim;
02594         if(llFlag&&totMass>mLamb+mLamb+GSResLL)
02595           llLim+=S*(S-1)*pow(totMass-mLamb-mLamb-GSResLL,2);
02596         G4double  naLim=llLim;
02597         if(naFlag&&totMass>mNeut+mAlph+ABarr+GSResNA)
02598         {
02599           if(barf) naLim+=(N-3)*alp*pow(totMass-mNeut-mAlph-ABarr-GSResNA,2);
02600           else     naLim+=(N-3)*alp*pow(totMass-mNeut-mAlph-GSResNA,2);
02601         }
02602         G4double  zaLim=naLim;
02603         if(paFlag&&totMass>mProt+SAPBarr+mAlph+GSResPA)
02604         {
02605           if(barf) zaLim+=(Z-3)*alp*pow(totMass-mProt-mAlph-SAPBarr-GSResPA,2);
02606           else     zaLim+=(Z-3)*alp*pow(totMass-mProt-mAlph-GSResPA,2);
02607         }
02608         G4double  laLim=zaLim;
02609         if(laFlag&&totMass>mLamb+mAlph+ABarr+GSResLA)
02610         {
02611           if(barf) laLim+=S*alp*pow(totMass-mLamb-mAlph-ABarr-GSResLA,2);
02612           else     laLim+=S*alp*pow(totMass-mLamb-mAlph-GSResLA,2);
02613         }
02614         G4double  aaLim=laLim;
02615         if(evalph&&aaFlag&&totMass>mAlph+mAlph+SAABarr+GSResAA)
02616         {
02617           if(barf) aaLim+=alp*pow(totMass-mAlph-mAlph-SAABarr-GSResAA,2)*
02618                           evalph*(Z-2)*(Z-3)*(N-2)*(N-3)*7/(a-5)/(a-6)/(a-7);
02619           else     aaLim+=alp*pow(totMass-mAlph-mAlph-GSResAA,2)*
02620                           evalph*(Z-2)*(Z-3)*(N-2)*(N-3)*7/(a-5)/(a-6)/(a-7);
02621         }
02622         G4double r = aaLim*G4UniformRand();
02623         if     (aaLim&&laLim<r)
02624         {
02625           dbQPDG= AAQPDG;
02626           eMass=mAlph;
02627           fMass=mAlph;
02628           rQPDG=aaQPDG;
02629           rMass=GSResAA;
02630 #ifdef debug
02631           G4cout<<"G4QNuc::EvapBaryon: A+A, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02632 #endif
02633         }
02634         else if(aaLim&&zaLim<r&&r<laLim)
02635         {
02636           dbQPDG= LAQPDG;
02637           eMass=mAlph;
02638           fMass=mLamb;
02639           rQPDG=laQPDG;
02640           rMass=GSResLA;
02641 #ifdef debug
02642           G4cout<<"G4QNuc::EvapBaryon: A+L, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02643 #endif
02644         }
02645         else if(aaLim&&naLim<r&&r<zaLim)
02646         {
02647           dbQPDG= PAQPDG;
02648           eMass=mAlph;
02649           fMass=mProt;
02650           rQPDG=paQPDG;
02651           rMass=GSResPA;
02652 #ifdef debug
02653           G4cout<<"G4QNuc::EvapBaryon: A+P, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02654 #endif
02655         }
02656         else if(aaLim&&llLim<r&&r<naLim)
02657         {
02658           dbQPDG= NAQPDG;
02659           eMass=mAlph;
02660           fMass=mNeut;
02661           rQPDG=naQPDG;
02662           rMass=GSResNA;
02663 #ifdef debug
02664           G4cout<<"G4QNuc::EvapBaryon: A+N, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02665 #endif
02666         }
02667         else if(aaLim&&zlLim<r&&r<llLim)
02668         {
02669           dbQPDG= LLQPDG;
02670           eMass=mLamb;
02671           fMass=mLamb;
02672           rQPDG=llQPDG;
02673           rMass=GSResLL;
02674 #ifdef debug
02675           G4cout<<"G4QNuc::EvapBaryon: L+L, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02676 #endif
02677         }
02678         else if(aaLim&&nlLim<r&&r<zlLim)
02679         {
02680           dbQPDG= PLQPDG;
02681           eMass=mLamb;
02682           fMass=mProt;
02683           rQPDG=plQPDG;
02684           rMass=GSResPL;
02685 #ifdef debug
02686           G4cout<<"G4QNuc::EvapBaryon: L+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02687 #endif
02688         }
02689         else if(aaLim&&zzLim<r&&r<nlLim)
02690         {
02691           dbQPDG= NLQPDG;
02692           eMass=mLamb;
02693           fMass=mNeut;
02694           rQPDG=nlQPDG;
02695           rMass=GSResNL;
02696 #ifdef debug
02697           G4cout<<"G4QNuc::EvapBaryon: L+n, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02698 #endif
02699 
02700         }
02701         else if(aaLim&&nzLim<r&&r<zzLim)
02702         {
02703           dbQPDG= PPQPDG;
02704           eMass=mProt;
02705           fMass=mProt;
02706           rQPDG=ppQPDG;
02707           rMass=GSResPP;
02708 #ifdef debug
02709           G4cout<<"G4QNuc::EvapBaryon: p+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02710 #endif
02711         }
02712         else if(aaLim&&nnLim<r&&r<nzLim)
02713         {
02714           dbQPDG= NPQPDG;
02715           eMass=mNeut;
02716           fMass=mProt;
02717           rQPDG=npQPDG;
02718           rMass=GSResNP;
02719 #ifdef debug
02720           G4cout<<"G4QNuc::EvapBaryon: n+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02721 #endif
02722         }
02723         else if(aaLim&&r<nnLim)
02724         {
02725           dbQPDG= NNQPDG;
02726           eMass=mNeut;
02727           fMass=mNeut;
02728           rQPDG=nnQPDG;
02729           rMass=GSResNN;
02730 #ifdef debug
02731           G4cout<<"G4QNuc::EvapBaryon: n+n, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
02732 #endif
02733         }
02734         //Two particle decay only possible (not frequent event!)
02735         else if(nFlag)
02736         {
02737 #ifdef debug
02738           G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in neutron ###"<<G4endl;
02739 #endif
02740           tpd=false;
02741           bQPDG=nQPDG;
02742           rQPDG=NQPDG;
02743           eMass=mNeut;
02744           rMass=GSResNn;
02745         }
02746         else if(pFlag)
02747         {
02748 #ifdef debug
02749           G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in proton ###"<<G4endl;
02750 #endif
02751           tpd=false;
02752           bQPDG=pQPDG;
02753           rQPDG=PQPDG;
02754           eMass=mProt;
02755           rMass=GSResNp;
02756         }
02757         else if(aFlag)
02758         {
02759 #ifdef debug
02760           G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in alpha ###"<<G4endl;
02761 #endif
02762           tpd=false;
02763           bQPDG=aQPDG;
02764           rQPDG=AQPDG;
02765           eMass=mAlph;
02766           rMass=GSResNa;
02767         }
02768         else if(lFlag)
02769         {
02770 #ifdef debug
02771           G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in Lambda ###"<<G4endl;
02772 #endif
02773           tpd=false;
02774           bQPDG=lQPDG;
02775           rQPDG=LQPDG;
02776           eMass=mLamb;
02777           rMass=GSResNl;
02778         }
02779         else
02780         {
02781 #ifdef debug
02782           G4cout<<"G4QNuc::EvaporBaryon: Photon ### 3-Big ###,dM="<<totMass-GSMass<<G4endl;
02783 #endif
02784           tpd=false;
02785           bQPDG=gQPDG;
02786           rQPDG=GetQPDG();
02787           eMass=0.;
02788           rMass=GSMass;
02789         }
02790         if(tpd)
02791         {
02792           h1mom=G4LorentzVector(0.,0.,0.,eMass);
02793           h2mom=G4LorentzVector(0.,0.,0.,rMass);
02794           h3mom=G4LorentzVector(0.,0.,0.,fMass);
02795           if(!DecayIn3(h1mom,h2mom,h3mom))
02796           {
02797 #ifdef debug
02798             G4cout<<"*G4QNucl::EvaporateBaryon:Decay M="<<totMass<<",b="<<eMass<<bQPDG
02799             <<",f="<<fMass<<fQPDG<<",r="<<rMass<<rQPDG<<G4endl;
02800 #endif
02801             return false;
02802           }
02803           h1mom+=h3mom;
02804           bQPDG=dbQPDG;
02805 #ifdef debug
02806           G4double sma=h1mom.m();
02807           G4double dma=sma-eMass-fMass;
02808           G4cout<<"G4QNuc::EvapBar:s="<<sma<<",e="<<eMass<<",f="<<fMass<<",d="<<dma<<",rM="
02809                 <<rMass<<G4endl;
02810 #endif
02811         }
02812         else
02813         {
02814           if(rMass<1600.)
02815           {
02816             if     (rQPDG==pQPDG)rMass=mProt;
02817             else if(rQPDG==nQPDG)rMass=mNeut;
02818             else if(rQPDG==lQPDG)rMass=mLamb;
02819           }
02820           h1mom=G4LorentzVector(0.,0.,0.,eMass);
02821           h2mom=G4LorentzVector(0.,0.,0.,rMass);      
02822           if(!DecayIn2(h1mom,h2mom))
02823           {
02824 #ifdef debug
02825             G4cout<<"***G4QNucleus::EvaporateBaryon: Emergency Decay M="<<totMass<<",b="
02826                   <<bQPDG<<h1->GetQC()<<eMass<<",r="<<rQPDG<<h2->GetQC()<<rMass<<G4endl;
02827 #endif
02828             return false;
02829           }
02830           h1->SetQPDG(bQPDG);
02831           h2->SetQPDG(rQPDG);
02832           h1->Set4Momentum(h1mom);
02833           h2->Set4Momentum(h2mom);
02834 #ifdef debug
02835           G4cout<<"G4QNuc::EvapBaryon: Emergency decay is done for b="<<bQPDG<<h1->GetQC()
02836                 <<h1mom<<h1mom.m()<<", r="<<rQPDG<<h2->GetQC()<<h2mom<<h2mom.m()<<G4endl;
02837 #endif
02838           return true;
02839         }
02840       }
02841       else                                     // Only decay in Baryon+Residual is possible
02842       {
02843 #ifdef debug
02844         G4cout<<"G4QNucleus::EvaporateBaryon: Decay in Baryon+Resid"<<G4endl;
02845 #endif
02846         //@@ Take into account Coulomb Barier Penetration Probability
02847         G4double nLim=0.;
02848         if(nFlag&&mNeut+GSResNn<totMass)
02849         {
02850           G4double ken=totMass-mNeut-GSResNn;
02851           nLim+=N*CoulBarPenProb(0.,ken,0,1)*sqrt(ken);
02852         }
02853         G4double zLim=nLim;
02854         if(pFlag&&mProt+PBarr+GSResNp<totMass)
02855         {
02856           G4double ken=totMass-mProt-GSResNp;
02857           if(barf) ken-=PBarr;
02858           zLim+=Z*CoulBarPenProb(PBarr,ken,1,1)*sqrt(ken);
02859         }
02860         G4double sLim=zLim;
02861         if(lFlag&&mLamb+GSResNl<totMass)
02862         {
02863           G4double ken=totMass-mLamb-GSResNl;
02864           sLim+=S*CoulBarPenProb(0.,ken,0,1)*sqrt(ken);
02865         }
02866         G4double aLim=sLim;
02867         if(aFlag&&mAlph+GSResNa+ABarr<totMass)
02868         {
02869           G4double ken=totMass-mAlph-GSResNa;
02870           if(barf) ken-=ABarr;
02871           aLim+=CoulBarPenProb(ABarr,ken,2,4)*sqrt(ken)*evalph*Z*(Z-1)*N*(N-1)
02872                 *6/a1/(a-2)/(a-3);
02873 #ifdef debug
02874           G4cout<<"G4QNucleus::EvaporateBaryon:al="<<evalph<<",k="<<ken<<",P="
02875                 <<CoulBarPenProb(ABarr,ken,2,4)<<G4endl;
02876 #endif
02877         }
02878         G4double r = aLim*G4UniformRand();
02879 #ifdef debug
02880         G4cout<<"G4QN::EB:DecIn2#2#r="<<r<<",nL="<<nLim<<",zL="<<zLim<<",sL="<<sLim<<",aL="
02881               <<aLim<<",nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
02882 #endif
02883         if     (aFlag&&r>sLim)
02884         {
02885           bQPDG=aQPDG;
02886           eMass=mAlph;
02887           rQPDG=AQPDG;
02888           rMass=GSResNa;
02889 #ifdef debug
02890           G4cout<<"G4QNucleus::EvaporateBaryon: Decay in A + rA="<<GSResNa+mAlph<<G4endl;
02891 #endif
02892         }
02893         else if(lFlag&&r>zLim&&r<sLim)
02894         {
02895           bQPDG=lQPDG;
02896           eMass=mLamb;
02897           rQPDG=LQPDG;
02898           rMass=GSResNl;
02899 #ifdef debug
02900           G4cout<<"G4QNucleus::EvaporateBaryon: Decay in L + rA="<<GSResNl+mLamb<<G4endl;
02901 #endif
02902         }
02903         else if(pFlag&&r>nLim&&r<zLim)
02904         {
02905           bQPDG=pQPDG;
02906           eMass=mProt;
02907           rQPDG=PQPDG;
02908           rMass=GSResNp;
02909 #ifdef debug
02910           G4cout<<"G4QNucleus::EvaporateBaryon: Decay in P + rA="<<GSResNp+mProt<<G4endl;
02911 #endif
02912         }
02913         else if(nFlag&&r<nLim)
02914         {
02915           bQPDG=nQPDG;
02916           eMass=mNeut;
02917           rQPDG=NQPDG;
02918           rMass=GSResNn;
02919 #ifdef debug
02920           G4cout<<"G4QNucleus::EvaporateBaryon: Decay in N + rA="<<GSResNn+mNeut<<G4endl;
02921 #endif
02922         }
02923         else if(mProt+GSResNp<totMass)
02924         {
02925 #ifdef debug
02926           G4cout<<"G4QNucl::EvapBar: Emergency Proton, dM="<<totMass-GSResNp-mProt<<G4endl;
02927 #endif
02928           bQPDG=pQPDG;
02929           rQPDG=PQPDG;
02930           eMass=mProt;
02931           rMass=GSResNp;
02932         }
02933         else if(mAlph+GSResNa<totMass)
02934         {
02935 #ifdef debug
02936           G4cout<<"G4QNucl::EvapBar: Emergency Alpha, dM="<<totMass-GSResNa-mAlph<<G4endl;
02937 #endif
02938           bQPDG=aQPDG;
02939           rQPDG=AQPDG;
02940           eMass=mAlph;
02941           rMass=GSResNa;
02942         }
02943         else
02944         {
02945 #ifdef debug
02946           G4cout<<"G4QNuc::EvapBaryon: Photon ### 4-Big ###, dM="<<totMass-GSMass<<G4endl;
02947 #endif
02948           bQPDG=gQPDG;
02949           rQPDG=GetQPDG();
02950           eMass=0.;
02951           rMass=GSMass;
02952         }
02953         if(rMass<1600.)
02954         {
02955           if     (rQPDG==pQPDG)rMass=mProt;
02956           else if(rQPDG==nQPDG)rMass=mNeut;
02957           else if(rQPDG==lQPDG)rMass=mLamb;
02958         }
02959         h1mom=G4LorentzVector(0.,0.,0.,eMass);
02960         h2mom=G4LorentzVector(0.,0.,0.,rMass);      
02961       }
02962     }
02963     if(!DecayIn2(h1mom,h2mom))
02964     {
02965 #ifdef debug
02966       G4cout<<"*G4QNucleus::EvaporateBaryon: Decay M="<<totMass<<",b="<<bQPDG<<h1->GetQC()
02967       <<eMass<<",r="<<rQPDG<<h2->GetQC()<<rMass<<G4endl;
02968 #endif
02969       return false;
02970     }
02971 #ifdef debug
02972     G4cout<<"G4QN::EvaB: **RESULT** b="<<bQPDG<<h1mom<<", r="<<rQPDG<<h2mom<<G4endl;
02973 #endif
02974     h1->SetQPDG(bQPDG);
02975     h2->SetQPDG(rQPDG);
02976     h1->Set4Momentum(h1mom);
02977     h2->Set4Momentum(h2mom);
02978 #ifdef debug
02979     G4cout<<"G4QNucleus::EvaporateBaryon: Evaporation is done for b="<<bQPDG<<h1->GetQC()
02980        <<h1mom<<h1mom.m()<<", r="<<rQPDG<<h2->GetQC()<<h2mom<<h2mom.m()<<G4endl;
02981 #endif
02982     return true;
02983   }
02984   else if(a==1)
02985   {
02986 #ifdef debug
02987     G4cerr<<"***G4QNucleus::EvaporateBaryon: ??? A=1"<<G4endl;
02988 #endif
02989     h1->SetQPDG(gQPDG);
02990     h1->Set4Momentum(G4LorentzVector(0.,0.,0.,0.));
02991     if     (Z>0)
02992     {
02993       h2->SetQPDG(pQPDG);
02994       h2->Set4Momentum(G4LorentzVector(0.,0.,0.,mProt));
02995     }
02996     else if(N>0)
02997     {
02998       h2->SetQPDG(nQPDG);
02999       h2->Set4Momentum(G4LorentzVector(0.,0.,0.,mNeut));
03000     }
03001     else if(S>0)
03002     {
03003       h2->SetQPDG(lQPDG);
03004       h2->Set4Momentum(G4LorentzVector(0.,0.,0.,mLamb));
03005     }
03006     else return false;
03007     return true;
03008   }
03009   if(a<-2) G4cerr<<"***G4QNucleus::EvaporateBaryon: A="<<a<<G4endl;
03010   return false;
03011 }
03012 // End of "EvaporateBaryon"
03013 
03014 // Randomize bimomial low 
03015 G4int G4QNucleus::RandomizeBinom(G4double p,G4int aN)
03016 {
03017   G4double r = G4UniformRand();
03018   G4double d = 1.-p;
03019   if(d<=0.) return 0;
03020   G4double v = pow(d,aN);
03021   G4double s_value = v;
03022   if(r<s_value) return 0;
03023   G4int i=0;
03024   G4int j=aN+1;
03025   G4double f=p/d;
03026   while(r>s_value && i<aN)
03027   {
03028     j--;
03029     i++;
03030     v*=j*f/i;
03031     s_value+=v;
03032   }
03033   return i;
03034 }
03035 
03036 //Initialize a Candidate vector for the instance of a Quasmon
03037 void G4QNucleus::InitCandidateVector(G4QCandidateVector& theQCandidates,
03038                                     G4int maxMes, G4int maxBar, G4int maxClst)
03039 {
03040   static const G4int nOfMesons =45; //a#of S=0,1,2,3,4 Mesons, => candidates to hadrons
03041   static const G4int nOfBaryons=72; //a#of 1/2,3/2,5/2,7/2 Baryons => candidates to hadrons
03042   // Scalar resonances   (0):           Eta,Pi0,Pi+,APi-,Ka0,Ka+,AKa0,AKa-,Eta*
03043   static G4int mesonPDG[nOfMesons]  =  {221,111,211,-211,311,321,-311,-321,331,    //  0- 8
03044   // Vector resonances   (1):           omega,Rh0,Rh+,Rho-,K0*,K+*,AK0*,AK-*,Phi
03045                                         223,113,213,-213,313,323,-313,-323,333,    //  9-18
03046   // Tensor D-resonances (2):           f2 ,a20,a2+, a2-,K20,K2+,AK20,AK2-,f2'
03047                                         225,115,215,-215,315,325,-315,-325,335,    // 19-27
03048   // Tensor F-resonances (3):           om3,ro3,r3+,rh3-,K30,K3+,AK30,AK3-,Phi3
03049                                         227,117,217,-217,317,327,-317,-327,337,    // 28-35
03050   // Tensor G-resonances (4):           f4 ,a40,a4+, a4-,K40,K4+,AK40,AK4-,f4'
03051                                         229,119,219,-219,319,329,-319,-329,339};   // 36-44
03052   // Baryon octet      (1/2):          n  , an  , p  , ap  ,lamb,alamb, sig-,asig-
03053   static G4int baryonPDG[nOfBaryons]={2112,-2112,2212,-2212,3122,-3122,3112,-3112, // 45-52
03054   // Hyperon octet     (1/2):         sig0,asig0,sig+,asig+,ksi-,aksi-,ksi0,aksi0
03055                                       3212,-3212,3222,-3222,3312,-3312,3322,-3322, // 53-60
03056   // Baryon decuplet   (3/2):   del-,adel-,del0,adel0,del+,adel+,dl++,adl++,sis-,asis-
03057                                 1114,-1114,2114,-2114,2214,-2214,2224,-2224,3114,-3114,//70
03058   //                            sis0,asis0,sis+,asis+,kss-,akss-,kss0,akss0,omeg,aomeg
03059                                 3214,-3214,3224,-3224,3314,-3314,3324,-3324,3334,-3334,//80
03060   // Baryon octet      (5/2):         n5/2,an5/2,p5/2,ap5/2,l5/2,al5/2,si5-,asi5-
03061                                       2116,-2116,2216,-2216,3126,-3126,3116,-3116, // 81-88
03062   //                                  si50,asi50,si5+,asi5+,ks5-,aks5-,ks50,aks50
03063                                       3216,-3216,3226,-3226,3316,-3316,3326,-3326, // 89-96
03064   // Baryon decuplet   (7/2):  dl5-,adl5-,dl50,adl50,dl5+,adl5+,d5++,ad5++,si5-,asi5-
03065                               1118,-1118,2118,-2118,2218,-2218,2228,-2228,3118,-3118, //106
03066   //                          si50,asi50,si5+,asi5+,ks5-,aks5-,ks50,aks50,ome5,aome5
03067                               3218,-3218,3228,-3228,3318,-3318,3328,-3328,3338,-3338};//116
03068   G4int i=0;
03069 #ifdef debug
03070   G4int ind=0;
03071 #endif
03072   G4int iQC = theQCandidates.size();
03073   if(iQC) for(G4int jq=0; jq<iQC; jq++) delete theQCandidates[jq];
03074   theQCandidates.clear();
03075   if(maxMes>nOfMesons) maxMes=nOfMesons;
03076   if(maxMes>=0) for (i=0; i<maxMes; i++) 
03077   {
03078     theQCandidates.push_back(new G4QCandidate(mesonPDG[i]));
03079 #ifdef debug
03080     G4cout<<"G4QNucleus::InitCandidateVector: "<<ind++<<", Meson # "<<i<<" with code = "
03081           <<mesonPDG[i]<<", QC="<<theQCandidates[i]->GetQC()<<" is initialized"<<G4endl;
03082 #endif
03083   }
03084   if(maxBar>nOfBaryons) maxBar=nOfBaryons;
03085   if(maxBar>=0) for (i=0; i<maxBar; i++) 
03086   {
03087 #ifdef debug
03088     G4cout<<"G4QNucleus::InitCandidateVector: define PDG="<<baryonPDG[i]<<G4endl;
03089 #endif
03090     G4QCandidate* curBar=new G4QCandidate(baryonPDG[i]);
03091 #ifdef debug
03092     G4cout<<"G4QNucleus::InitCandidateVector: current baryon is defined"<<G4endl;
03093 #endif
03094     theQCandidates.push_back(curBar); // delete equivalent
03095 #ifdef debug
03096     G4cout<<"G4Nucleus::InitCandidateVector: "<<ind++<<", Baryon # "<<i<<" with code = "
03097           <<baryonPDG[i]<< ", QC="<<theQCandidates[i]->GetQC()<<" is initialized"<<G4endl;
03098 #endif
03099   }
03100   if(maxClst>=0) for (i=0; i<maxClst; i++) 
03101   {
03102     G4int clustQCode = i+G4QPDGCode().GetNQHadr(); //Q-codes of cluster in the CHIPS world
03103     G4QPDGCode clustQPDG;
03104     clustQPDG.InitByQCode(clustQCode);
03105     G4int clusterPDG=clustQPDG.GetPDGCode();
03106     theQCandidates.push_back(new G4QCandidate(clusterPDG)); // delete equivalent
03107 #ifdef debug
03108     G4cout<<"G4QNucleus::InitCandidateVector:"<<ind++<<", Cluster # "<<i<<" with code = "
03109           <<clusterPDG<<", QC="<<clustQPDG.GetQuarkContent()<<" is initialized"<<G4endl;
03110 #endif
03111   }
03112 } // End of "InitCandidateVector"
03113 
03114 // Calculate a#of Z,N,L-clusters in the nucleus and fill candidate's probabilities
03115 void G4QNucleus::PrepareCandidates(G4QCandidateVector& theQCandidates, G4bool piF,
03116                                    G4bool gaF, G4LorentzVector pLV)
03117 {
03118   static const G4LorentzVector zeroLV(0.,0.,0.,0.);
03119   G4double ze  = Z;
03120   G4double ne  = N;
03121   G4double se  = S;
03122   G4double ae  = Z+N+S;
03123   G4double aea = ae*(ae-1);
03124   G4double ae2 = aea/2.;
03125   G4double ze1 = dZ + 1;
03126   G4double ne1 = dN + 1;
03127   G4double se1 = dS + 1;
03128   G4double ae0 = dZ + dN + dS;
03129   G4double ae1 = ae0 + 1;
03130   G4double pos = probVect[0];           // Value of Pre-Probability for VacuumHadronization
03131 #ifdef cldebug
03132   G4int mac=6;                          // Maximum cluster # for fixed baryon number
03133 #endif
03134   G4int cca=0;                          // Counter of clusters for the same baryon number
03135   G4int acm=0;                          // Threshold ac value
03136   G4int mCand=theQCandidates.size();    // Full set of candidates made in UpdateClusters
03137   G4double s_value=0.;                  // Prototype of summ for constant A (=ac>2)
03138   G4double comb=ae0*(ae0-1)/2;          // Product up to ac=2
03139   if(comb<=0.) comb=1.;
03140 #ifdef cldebug
03141   G4double sZ=0.;                       // Percent of protons
03142   G4double sN=0.;                       // Percent of neutrons
03143   G4cout<<"G4QN::PC:C#"<<mCand<<",dZ="<<dZ<<",dN="<<dN<<",ZNS="<<Z<<","<<N<<","<<S<<G4endl;
03144 #endif
03145   for (G4int index=0; index<mCand; index++)
03146   {
03147     G4QCandidate* curCand=theQCandidates[index];
03148     G4int cPDG  = curCand->GetPDGCode();
03149     G4int cBN   = curCand->GetBaryonNumber();
03150     G4int cST   = curCand->GetStrangeness();
03151     // ***********************************************************************************
03152     // These are first 117 candidates which are defined in G4QNucleus::InitCandidateVector
03153     // ***!!!*** if they are changed there the corresponding change must be done here
03154     //static const G4int nOfMesons =45;//a#of S=0,1,2,3,4 Mesons, => candidates to hadrons
03155     //static const G4int nOfBaryons=72;//a#of 1/2,3/2,5/2,7/2 Baryons => cand's to hadrons
03156     // Scalar resonances   (0):           Eta,Pi0,Pi+,APi-,Ka0,Ka+,AKa0,AKa-,Eta*
03157     //static G4int mesonPDG[45]  =  {221,111,211,-211,311,321,-311,-321,331,       //  0- 8
03158     // Vector resonances   (1):    omega,Rh0,Rh+,Rho-,K0*,K+*,AK0*,AK-*,Phi
03159     //                              223,113,213,-213,313,323,-313,-323,333,        //  9-18
03160     // Tensor D-resonances (2):     f2 ,a20,a2+, a2-,K20,K2+,AK20,AK2-,f2'
03161     //                              225,115,215,-215,315,325,-315,-325,335,        // 19-27
03162     // Tensor F-resonances (3):     om3,ro3,r3+,rh3-,K30,K3+,AK30,AK3-,Phi3
03163     //                              227,117,217,-217,317,327,-317,-327,337,        // 28-35
03164     // Tensor G-resonances (4):     f4 ,a40,a4+, a4-,K40,K4+,AK40,AK4-,f4'
03165     //                              229,119,219,-219,319,329,-319,-329,339};       // 36-44
03166     // Baryon octet       (1/2):    n  , an  , p  , ap  ,lamb,alamb, sig-,asig-
03167     //static G4int baryonPDG[72]={2112,-2112,2212,-2212,3122,-3122,3112,-3112,     // 45-52
03168     // Hyperon octet     (1/2): sig0,asig0,sig+,asig+,ksi-,aksi-,ksi0,aksi0
03169     //                            3212,-3212,3222,-3222,3312,-3312,3322,-3322,     // 53-60
03170     // Baryon decuplet   (3/2): del-,adel-,del0,adel0,del+,adel+,dl++,adl++,sis-,asis-
03171     //                          1114,-1114,2114,-2114,2214,-2214,2224,-2224,3114,-3114,//70
03172     //                          sis0,asis0,sis+,asis+,kss-,akss-,kss0,akss0,omeg,aomeg
03173     //                          3214,-3214,3224,-3224,3314,-3314,3324,-3324,3334,-3334,//80
03174     // Baryon octet      (5/2): n5/2,an5/2,p5/2,ap5/2,l5/2,al5/2,si5-,asi5-
03175     //                          2116,-2116,2216,-2216,3126,-3126,3116,-3116,       // 81-88
03176     //                          si50,asi50,si5+,asi5+,ks5-,aks5-,ks50,aks50
03177     //                          3216,-3216,3226,-3226,3316,-3316,3326,-3326,       // 89-96
03178     // Baryon decuplet  (7/2): dl5-,adl5-,dl50,adl50,dl5+,adl5+,d5++,ad5++,si5-,asi5-
03179     //                        1118,-1118,2118,-2118,2218,-2218,2228,-2228,3118,-3118, //106
03180     //                        si50,asi50,si5+,asi5+,ks5-,aks5-,ks50,aks50,ome5,aome5
03181     //                        3218,-3218,3228,-3228,3318,-3318,3328,-3328,3338,-3338};//116
03182     // One should take into account, that #of mesons & baryons can be cut in G4Quas::HadrQE
03183     //G4int nP= theWorld->GetQPEntries(); // A#of initialized particles in CHIPS World
03185     //G4int          nMesons  = 45;
03186     //if     (nP<34) nMesons  =  9;
03187     //else if(nP<51) nMesons  = 18;
03188     //else if(nP<65) nMesons  = 27;
03189     //else if(nP<82) nMesons  = 36;
03190     //G4int          nBaryons = 72;
03191     //if     (nP<45) nBaryons = 16;
03192     //else if(nP<59) nBaryons = 36;
03193     //else if(nP<76) nBaryons = 52;
03194     // **********************************************************************************
03195     //G4int cS    = curCand->GetStrangeness();
03196     //if(piF&&gaF&&cPDG!=90000001&&cPDG!=90001000) // Both flags, in case of pi-first-int
03197     //if(piF&&gaF&&cBN!=1&&cBN!=3) // Both flags, which is in case of pi-first-int
03198     if(piF&&gaF&&cBN!=1)// @@ Should be both, which is in case of pi-first-interaction @@ ?
03199     //if(piF&&gaF&&cBN!=1&&cBN!=4) // Should be both, in case of pi-first-interaction
03200     {
03201       curCand->SetPreProbability(0.);  
03202       curCand->SetDenseProbability(0.); 
03203       curCand->SetPossibility(false);    
03204 #ifdef cldebug
03205       if(cPDG==90001001) G4cout<<"G4QNuc::PrepCand: piF/gaF fragments are blocked"<<G4endl;
03206 #endif
03207     }
03208     // @@ in case of the Ksi or Omega- capture it can disturb the simulation
03209     else if(cPDG<80000000&&(abs(cPDG)%10>4||cST>2))// @@ PreClosed HighSpin/HighStrange
03210     {
03211       curCand->SetPreProbability(0.);  
03212       curCand->SetDenseProbability(0.); 
03213       curCand->SetPossibility(false);    
03214     }
03215     else
03216     {
03217       G4double tnM=GetQPDG().GetMass();          // Total mass of this nucleus
03218       if(cPDG>80000000&&cPDG!=90000000)          // ===> Cluster case
03219       {
03220         G4int sc = cST;                          // "S" of the cluster
03221         G4int zc = curCand->GetCharge();         // "Z" of the cluster
03222         G4int ac = cBN;                          // "A" of the cluster
03223         G4int nc = ac-zc-sc;                     // "N" of the cluster
03224         G4double cM=tnM-G4QNucleus(Z-zc,N-nc,S-sc).GetGSMass(); // BoundMass of the cluster
03225         G4LorentzVector intLV=pLV+G4LorentzVector(0.,0.,0.,cM); // 4-mom of the proj+clust
03226         pos      = probVect[ac];                 // Cluster Probability NormalizationFactor
03227         if(ac<=maxClust&&pos>0.&&(pLV==zeroLV||intLV.m()>.00001+cM))
03228         {
03229 
03230 #ifdef cldebug
03231           G4cout<<"G4QNucleus::PrepareCand: ac="<<ac<<", pV="<<pos<<G4endl;
03232 #endif
03233           G4int dac=ac+ac;
03234           if(ac && (piF || gaF))                 // zc>=0
03235           {
03236             if     (piF&&!gaF&&zc+ac) pos*=(zc+ac)/ac;  // piF interaction (#of u-quarks)
03237             else if(gaF&&!piF&&zc+dac) pos*=(zc+dac)/ac; // gaF interaction (sum of Q_q^2)
03238           }
03239           G4double dense=1.;
03240           if     (ac==1&&pos>0.)dense=probVect[254]/pos;
03241           else if(ac==2&&pos>0.)dense=probVect[255]/pos;
03242 #ifdef cldebug
03243           G4cout<<"G4QNucleus::PrepC: cPDG="<<cPDG<<",norm="<<pos<<",zc="<<zc<<",nc="<<nc
03244                 <<",sc="<<sc<<",ac="<<ac<<",ze1="<<ze1<<",ne1="<<ne1<<",se1="<<se1<<G4endl;
03245           G4double mp=pos;
03246 #endif
03247           if     (ac==1 && ae)                   // ae=0 protection (since here no /pos)
03248           {
03249             if     (zc) pos*=ze/ae;
03250             else if(nc) pos*=ne/ae;
03251             else if(sc) pos*=se/ae;
03252             //if     (zc) pos*=ze;
03253             //else if(nc) pos*=ne;
03254             //else if(sc) pos*=se;
03255             acm=1;
03256 #ifdef cldebug
03257             if(pos)
03258             G4cout<<"G4QN::PrC:mp="<<mp<<",pos="<<pos<<",ae="<<ae
03259                   <<",Z="<<zc<<",N="<<nc<<",mac="<<mac<<G4endl;
03260             sZ+=pos*zc;
03261             sN+=pos*nc;
03262 #endif
03263           }
03264           else if(ac==2)
03265           {
03266             if(ze<zc||ne<nc||se<sc) pos=0.;
03267             else if(aea)                         // Protection against aea=0.
03268             {
03269               if     (zc==2) pos*=ze*(ze-1)/aea;
03270               else if(nc==2) pos*=ne*(ne-1)/aea;
03271               else if(sc==2) pos*=se*(se-1)/aea;
03272               else if(zc==1&&nc==1) pos*=ze*ne/ae2;
03273               else if(zc==1&&sc==1) pos*=ze*se/ae2;
03274               else if(sc==1&&nc==1) pos*=se*ne/ae2;
03275               //if     (zc==2) pos*=ze*(ze-1)/2.;
03276               //else if(nc==2) pos*=ne*(ne-1)/2.;
03277               //else if(sc==2) pos*=se*(se-1)/2.;
03278               //else if(zc==1&&nc==1) pos*=ze*ne;
03279               //else if(zc==1&&sc==1) pos*=ze*se;
03280               //else if(sc==1&&nc==1) pos*=se*ne;
03281               else G4cout<<"***G4QNucl::PrepCand: z="<<zc<<", n="<<nc<<", s="<<sc<<G4endl;
03282               // Normalization for only not strange matter
03283             }
03284             acm=2;
03285 #ifdef cldebug
03286             if(pos)
03287             G4cout<<"G4QN::PrC:mp="<<mp<<",p="<<pos<<",A=2,(Z="<<zc<<",N="<<nc<<"),m="
03288                   <<mac<<G4endl;
03289             sZ+=pos*zc;
03290             sN+=pos*nc;
03291 #endif
03292           }
03293           else                                     // ac>2
03294           {
03295             if(acm<ac)                             // first time that big cluster
03296             {
03297               if(ac<ae1 && ac>0) comb*=(ae1-ac)/ac;
03298               acm=ac;
03299               s_value=0.;
03300               cca=0;
03301 #ifdef cldebug
03302               if(ac%2) mac=7;                      // @@Change it if cluster set is changed
03303               else     mac=8;                      // @@ It is not yet automatic
03304               G4cout<<"G4QNuc::PrepCl:c="<<comb<<",ac="<<ac<<"("<<index<<"),m="<<mac<<",a="
03305                     <<ae0<<G4endl;
03306 #endif
03307             }
03308             G4double prod=1.;
03309             if(ze1<=zc||ne1<=nc||se1<=sc) prod=0.;
03310             else
03311             {
03312               if(zc>0) for(int iz=1; iz<=zc; iz++) prod*=(ze1-iz)/iz;
03313               if(nc>0) for(int in=1; in<=nc; in++) prod*=(ne1-in)/in;
03314               if(sc>0) for(int is=1; is<=sc; is++) prod*=(se1-is)/is;
03315             }
03316             s_value+=prod;
03317             pos*=prod;
03318             pos/=comb;
03319 #ifdef cldebug
03320             if(pos) G4cout<<"G4QN::PreC:c="<<cPDG<<",p="<<pos<<",i="<<index<<",m="<<mac
03321                           <<",pr="<<prod<<",c="<<cca<<G4endl;
03322             sZ+=pos*zc;
03323             sN+=pos*nc;
03324 #endif
03325             cca++;
03326           }
03327           curCand->SetPreProbability(pos);
03328           curCand->SetDenseProbability(pos*dense);
03329 #ifdef cldebug
03330           G4cout<<"G4QN::PrepC: ClusterPDG="<<cPDG<<",preProb="<<pos<<",d="<<dense<<G4endl;
03331 #endif
03332         }
03333         else                                       // => "Cluster is too big" case
03334         {
03335           curCand->SetPreProbability(0.);     
03336           curCand->SetDenseProbability(0.);
03337           curCand->SetPossibility(false);          // This candidate is not possible 
03338         }
03339       }
03340       else
03341       {
03342 #ifdef cldebug
03343         G4cout<<"G4QNucl::PrepCand:cPDG="<<cPDG<<",pos="<<pos<<G4endl;
03344 #endif
03345         curCand->SetPreProbability(pos);           // ===> Hadronic case in Vacuum     
03346         curCand->SetDenseProbability(0.);          // ===> Hadronic case in Vacuum
03347       }
03348       curCand->SetPossibility(true);           // All candidates are possible at this point
03349     }
03350   } // End of the LOOP over Candidates
03351 #ifdef cldebug
03352   G4cout<<"G4QNucl::PrepCand:covP="<<ae*sZ/ze<<",covN="<<ae*sN/ne<<",totP="<<sZ+sN<<G4endl;
03353   //throw G4QException("G4QNucleus::PrepareCandidate: Temporary stop");
03354 #endif
03355 }// End of PrepareCandidates
03356 
03357 //Coulomb Barrier Calculation - a general (external call) function, @@ to be moved
03358 G4double G4QNucleus::CoulombBarGen(const G4double& rZ, const G4double& rA,
03359                                    const G4double& cZ, const G4double& cA)
03360 {
03361   static const G4double third=1./3.;
03362   G4double ca=cA; // @@ can be integer
03363   if(cA < 0.) ca=-cA;
03364 #ifdef debug
03365   if(rA < 0.) G4cout<<"-Warning-G4QNucl::CoulombBarGen: NucleusA="<<rA<<", Z="<<rZ<<G4endl;
03366 #endif
03367   G4double ra=rA; // @@ can be integer
03368   if(rA < 0.) ra=-rA;
03369   G4double zz=rZ*cZ;
03370   // Naitive CHIPS radius: CB={1.46=200(MeV)/137}*z*Z/{R=1.13}*((a*z)**1/3+A**1/3) (?)
03371   //G4double cb=1.29*zz/(pow(rA,third)+pow(cA,third));
03372   //double cb=zz/(pow(rA,third)+pow(ca,third)+.1);
03373   G4double cb=1.29*zz/(pow(ra,third)+pow(ca,third)+.1); //CHIPS like potential
03374   // Geant4 solution for protons is practically the same:
03375   // G4double cb=1.263*Z/(1.0 + pow(rA,third));
03376   // @@ --- Temporary "Lambda/Delta barrier for mesons"
03377   //if(!cA) cb+=40.;
03378   // --- End of Temporary ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
03379 #ifdef debug
03380   G4cout<<"G4QNucl::CoulBG:rA="<<cA<<",rZ="<<cZ<<",cA="<<cA<<",cZ="<<cZ<<",C="<<cb<<G4endl;
03381 #endif
03382   return cb;
03383 } // End of "CoulombBarier"
03384 
03385 //Coulomb Barrier Calculation: (cZ,cA)= fragment from the nucleus (delZ,dA)= second pt red
03386 G4double G4QNucleus::CoulombBarrier(const G4double& cZ, const G4double& cA, G4double delZ,
03387                                     G4double dA) // (delZ,dA) are 0 by default
03388 {
03389   G4double rA=GetA()-cA;
03390   if (dA != 0.)  rA-=dA;
03391 #ifdef debug
03392   if(rA<0.) G4cout<<"-Warning-G4QNucl::CoulombBarrier: NucleusA="<<rA<<", rZ="<<cZ<<G4endl;
03393 #endif
03394   G4double rZ=Z-cZ;
03395   if(delZ != 0.) rZ-=delZ;
03396 #ifdef debug
03397   if(rA<0.) G4cout<<"-Warning-G4QNucl::CoulombBarrier: NucleusA="<<rA<<", rZ="<<cZ<<G4endl;
03398 #endif
03399   return CoulombBarGen(rZ, rA, cZ, cA);
03400 } // End of "CoulombBarier"
03401 
03402 // Fission Coulomb Barrier Calculation
03403 G4double G4QNucleus::FissionCoulombBarrier(const G4double& cZ, const G4double& cA,
03404                                            G4double delZ, G4double dA)
03405 {
03406   static const G4double third=1./3.;
03407   if(cZ<=0.) return 0.;
03408   G4double rA=GetA()-cA;
03409   if(dA) rA-=dA;                        // Reduce rA f CB is calculated for wounded nucleus
03410   G4double rZ=Z-cZ;
03411   if(delZ) rZ-=delZ;                    // Reduce rZ f CB is calculated for wounded nucleus
03412   G4double zz=rZ*cZ;                    // Product of charges
03413   G4double r=(pow(rA,third)+pow(cA,third))*(1.51+.00921*zz)/(1.+.009443*zz);
03414   return 1.44*zz/r;
03415 } // End of "FissionCoulombBarier"
03416 
03417 //Coulomb Binding Energy for the cluster
03418 G4double G4QNucleus::BindingEnergy(const G4double& cZ, const G4double& cA, G4double delZ,
03419                                    G4double dA)
03420 {
03421   static const G4double mNeut= G4QPDGCode(2112).GetMass(); // Mass of neutron
03422   static const G4double mProt= G4QPDGCode(2212).GetMass(); // Mass of proton
03423   if(!cZ && !cA) return Z*mProt+N*mNeut-GetGSMass();       // Total binding energy far all
03424   G4double GSM=GetGSMass();
03425   G4int iZ=static_cast<int>(cZ);
03426   G4int cN=static_cast<int>(cA-cZ);
03427   G4int sZ=iZ;
03428   G4int sN=cN;
03429   if(delZ||dA)
03430   {
03431     G4int dz=static_cast<int>(delZ);
03432     G4int dn=static_cast<int>(dA-delZ);
03433     GSM=G4QNucleus(Z-dz,N-dn,S).GetGSMass();
03434     sZ-=dz;
03435     sN-=dn;
03436   }
03437   return G4QNucleus(Z-sZ,N-sN,S).GetGSMass()+G4QNucleus(iZ,cN,0).GetGSMass()-GSM;
03438 } // End of "BindingEnergy"
03439 
03440 //Coulomb Barrier Reflection Probability (CB - Coulomb Barrier, E - Kinetic Energy) 
03441 G4double G4QNucleus::CoulBarPenProb(const G4double& CB, const G4double& E,
03442                                     const G4int& C, const G4int& B)
03443 {//                 = A.Lepretre et al, Nucl.Phys., A390 (1982) 221-239 =
03444   static const G4double mNeut= G4QPDGCode(2112).GetMass();          // Mass of neutron
03445   static const G4double dNeut= mNeut+mNeut;                         // DiMass of neutron
03446   static const G4double mProt= G4QPDGCode(2212).GetMass();          // Mass of proton
03447   static const G4double dProt= mProt+mProt;                         // DiMass of proton
03448   static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0); // Mass of deuteron
03449   //static const G4double mTrit= G4QPDGCode(2112).GetNuclMass(1,2,0); // Mass of tritium
03450   //static const G4double mHel3= G4QPDGCode(2112).GetNuclMass(2,1,0); // Mass of Helium 3
03451   //static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0); // Mass of alpha
03452   static const G4double wellDebth=40.;          //@@ Should be jus binding energy @@ done
03453   // @@ --- Temporary 1 ---> close the OverBarrierReflection for all
03454   //return 1.;
03455   // ^^^^^^^---> End of Themporary 1
03456   // @@ --- Temporary 2 ---> close the OverBarrierReflection for fragments and mesons
03457   //if(E<CB) return 0.;
03458   //if(B!=1) return 1.;
03459   if(B<1 || B>2) return 1.;
03460   if(C>B+1)
03461   {
03462 #ifdef debug
03463     G4cout<<"-Warning-G4QN::CBPP:SubtractedChrg="<<C<<" >SubtractedBaryonNmbr="<<B<<G4endl;
03464 #endif
03465     return 1.;
03466   }
03467   // ^^^^^^^---> End of Themporary 2
03468   //G4double nA=GetA();
03469   //G4double nA=GetA()-B;
03470   //if(nA==40) G4cout<<"G4QN::CBPP:Z="<<GetZ()<<",C="<<C<<",B="<<B<<G4endl;
03471   //else     return 1.;           // @@@@@ Over barrier reflection is closed @@@ !!! @@@
03472   //      Li6      C12           Al27
03473   //else if(nA<7||nA>8&&nA<12||nA>16&&nA<40) return 1.;// "OverBarrierReflection is closed"
03474   //else if(nA>8&&nA<12||nA>16&&nA<40) return 1.; // "OverBarrierReflection is closed" Cond
03475   //else if(nA<12||nA>16&&nA<40) return 1.; // "OverBarrierReflection is closed" Condition
03476   //else if(nA<12||nA>16) return 1.; // "OverBarrierReflection is closed" Condition
03477   //else if(nA<12) return 1.;    // @@@@@ Over barrier reflection is closed @@@ !!! @@@
03478   //if(B+B>Z+N+S) return 1.;
03479   //G4double wD=wellDebth*B;
03480   G4double wD=wellDebth;
03481   //G4double wD=0.;
03482   // @@ --- Temporary 3 ---> close the OverBarrierReflection for mesons
03483   //if(!B) wD=0.;
03484   // ^^^^^^^---> End of Themporary 3
03485   G4double GSM=GetGSMass();
03486 #ifdef debug
03487   G4cout<<"G4QNucl::CBPenProb:GSM="<<GSM<<",Z="<<Z<<",N="<<N<<",C="<<C<<",B="<<B<<G4endl;
03488 #endif
03489   if(2>3);
03490   // @@ Temporary "Mass Barrier for mesons" @@ __________________
03491   //else if(!B) wD=40.;
03492   // @@ End of Temporary^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
03499   else if(B==1&&C==1) wD=G4QNucleus(Z-1,N,S).GetGSMass()+mProt-GSM;
03500   else if(B==1&&C==0) wD=G4QNucleus(Z,N-1,S).GetGSMass()+mNeut-GSM;
03505   else if(B==2)
03506   {
03507     if       (!C) wD=G4QNucleus(Z,N-2,S).GetGSMass()+dNeut-GSM;
03508     else if(C==1) wD=G4QNucleus(Z-1,N-1,S).GetGSMass()+mDeut-GSM;
03509     else if(C==2) wD=G4QNucleus(Z-2,N,S).GetGSMass()+dProt-GSM;
03510     // @@ Temporary "Local B=2 Anti Virial factor" @@ __________________
03511     wD=80.; // 40 MeV per each nucleon
03512     //wD=wD/2;
03513     // @@ End of Temporary^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
03514   }
03518   //else if(B==3&&C==1) wD=G4QNucleus(Z-1,N-2,S).GetGSMass()+mTrit-GSM;
03520   //else if(B==3&&C==2) wD=G4QNucleus(Z-2,N-1,S).GetGSMass()+mHel3-GSM;
03523   //else if(B==4&&C==2) wD=G4QNucleus(Z-2,N-2,S).GetGSMass()+mAlph-GSM;
03526   //else if(B>4)wD=G4QNucleus(Z-C,N-B+C,S).GetGSMass()+G4QNucleus(C,B-C,S).GetGSMass()-GSM;
03527   if(wD<0.) wD=0.;
03528 #ifdef debug
03529   G4cout<<"G4QNucl::CBPenProb: wD="<<wD<<",E="<<E<<",CB="<<CB<<G4endl;
03530 #endif
03531   // @@ Temporary "Virial factor" @@ __________________
03532   wD=wD+wD;
03533   // @@ End of Temporary^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
03534   G4double sR=0.;
03535   G4double CBD=CB+wD;
03536   G4double ED=E+wD;
03537   if(CBD<0.) return 1.;
03538   if(ED<=0.)  return 0.;
03539   //if(nA<27) sR=sqrt(wD/ED);
03540   //else      sR=sqrt(CBD/ED);
03541   sR=sqrt(CBD/ED);
03542   //sR=sqrt(wD/ED);
03543 #ifdef debug
03544   G4cout<<"G4QN::CBPP:s="<<sR<<",E="<<E<<",w="<<wD<<",CB="<<CB<<",B="<<B<<",C="<<C<<G4endl;
03545 #endif
03546   if(sR>=1.) return 0.;
03547   return   1.-sR*sR*sR;
03548 } // End of "CoulBarPenProb"
03549 
03550 // Randomize 2D-vector b = 2D impact parameter
03551 pair<G4double, G4double> G4QNucleus::ChooseImpactXandY(G4double maxImpact)
03552 {
03553   G4double x=1.;
03554   G4double y=1.;
03555   do
03556   {
03557     x = G4UniformRand();
03558     x = x+x-1.;
03559     y = G4UniformRand();
03560     y = y+y-1.;
03561   }
03562   while(x*x+y*y > 1.);
03563   std::pair<G4double, G4double> theImpactParameter;
03564   theImpactParameter.first  = x*maxImpact;
03565   theImpactParameter.second = y*maxImpact;
03566   return theImpactParameter;
03567 } // End of "ChooseImpactXandY"
03568 
03569 // Initializes 3D Nucleons in the nucleus using random sequence
03570 void G4QNucleus::ChooseNucleons()
03571 {
03572 #ifdef debug
03573   G4cout<<"G4QNucleus::ChooseNucleons: Nucleons search is started"<<rho0<<G4endl;
03574 #endif
03575   G4int protons =0;
03576   G4int nucleons=0;
03577   G4int theA=GetA();
03578   while (nucleons < theA)
03579   {
03580     if(protons<Z && G4UniformRand() < G4double(Z-protons)/G4double(theA-nucleons) )
03581     {
03582       protons++;
03583       nucleons++;
03584       G4QHadron* proton = new G4QHadron(2212);
03585       theNucleons.push_back(proton);
03586     }
03587     else if ( (nucleons-protons) < N )
03588     {
03589       nucleons++;
03590       G4QHadron* neutron = new G4QHadron(2112);
03591       theNucleons.push_back(neutron);
03592     }
03593     else G4cout<<"G4QNucleus::ChooseNucleons not efficient"<<G4endl;
03594   }
03595   return;
03596 } // End of ChooseNucleons
03597 
03598 // Initializes positions of 3D nucleons (@@ in QGS only 2D impact par positions are needed)
03599 void G4QNucleus::ChoosePositions()
03600 {
03601   static const G4double mProt= G4QPDGCode(2212).GetMass();
03602   static const G4double mProt2= mProt*mProt;
03603   static const G4double third= 1./3.;
03604 #ifdef debug
03605   G4cout<<"G4QNucl::ChoosePositions: is called"<<G4endl;
03606 #endif
03607   G4int          i=0;                         // nucleon index
03608   G4int          theA=GetA();                 // cashed value of A
03609   G4int          lastN=theA-1;                // cashed value of A-1 (theLastNucleon index)
03610   G4ThreeVector  aPos(0.,0.,0.);              // Prototype of the nucleon position
03611   G4double       rPos=0.;                     // Radius of the nucleon position
03612   G4ThreeVector  delta(0.,0.,0.);             // Prototype of the distance between nucleons
03613   G4ThreeVector* places= new G4ThreeVector[theA]; // Vector of 3D positions
03614   G4bool         freeplace= false;            // flag of free space available
03615   G4double nucDist2= nucleonDistance*nucleonDistance; // @@ can be a common static
03616   G4double maxR= GetRadius(0.01);             // there are cond no nucleons at this density
03617   G4ThreeVector  sumPos(0.,0.,0.);            // Vector of the current 3D sum
03618   G4ThreeVector  minPos(0.,0.,0.);            // Minimum nucleon 3D position
03619   G4double       mirPos=maxR;                 // Proto MinimumRadius of the nucleonPosition
03620   G4int failCNT=0;                            // Counter of bad attempts
03621   G4int maxCNT=27;                            // Limit for the bad attempts
03622   while( i < theA && maxR > 0.)               // LOOP over all nucleons
03623   {
03624     rPos = maxR*pow(G4UniformRand(),third);   // Get random radius of the nucleon position
03625     G4double density=rPos*rPos;               // Density at R (temporary squared radius)
03626     if(theA<17) density=GetRelOMDensity(density); // Oscilator model (M.K.?)
03627     else        density=GetRelWSDensity(rPos);    // Wood-Saxon model
03628 #ifdef debug
03629     G4cout<<"G4QNucl::ChoosePositions: i="<<i<<", pos="<<aPos<<", dens="<<density<<G4endl;
03630 #endif
03631     if(G4UniformRand()<density)               // Try this position with frequency ~Density
03632     {
03633       // @@ Gaussian oscilator distribution is good only up to He4 (s-wave). Above: p-wave
03634       // (1+k*(r^2/R^2)]*exp[-r^2/R^2]. A=s+p=4+3*4=16 (M.K.) So Li,Be,C,N,O are wrong
03635       if(i==lastN) aPos=-rPos*sumPos.unit();  // TheLast tries toCompensate CenterOfGravity
03636       else     aPos=rPos*G4RandomDirection(); // It uses the standard G4 function
03637       freeplace = true;                       // Imply that there is a free space
03638       for(G4int j=0; j<i && freeplace; j++)   // Check that there is no overlap with others
03639       {
03640         delta = places[j] - aPos;             // Distance to nucleon j
03641         freeplace= delta.mag2()>nucDist2;     // If false break the LOOP
03642       }
03643       //  protons must at least have binding energy of CoulombBarrier (@@ ? M.K.), so
03644       //  assuming Fermi Energy corresponds to Potential, we must place protons such
03645       //  that the Fermi Energy > CoulombBarrier (?)
03646       //  @@ M.K.: 1. CoulBar depends on aPos; 2. Makes Isotopic assymetry (!); 3. Perform.
03647       G4int nucPDG= theNucleons[i]->GetPDGCode();
03648 #ifdef debug
03649       G4cout<<"G4QNucl::ChoosePositions: frpl="<<freeplace<<", nucPDG="<<nucPDG<<G4endl;
03650 #endif      
03651       if(freeplace && nucPDG == 2212) // Free Space Protons
03652       {
03653         G4double pFermi=GetFermiMomentum(GetDensity(aPos));
03654         G4double eFermi= sqrt(pFermi*pFermi+mProt2)-mProt;  // Kinetic energy
03655         if (eFermi <= CoulombBarrier()) freeplace=false;
03656       }
03657       if(rPos<mirPos)
03658       {
03659         mirPos=rPos;
03660         minPos=aPos;
03661       }
03662       if( freeplace || failCNT > maxCNT )
03663       {
03664         if( failCNT > maxCNT ) aPos=minPos;
03665 #ifdef debug
03666         G4cout<<"G4QNuc::ChoosePos:->> fill N["<<i<<"], R="<<aPos<<", f="<<failCNT<<G4endl;
03667 #endif      
03668         places[i]=aPos;
03669         sumPos+=aPos;
03670         ++i;
03671         failCNT=0;
03672         mirPos=maxR;
03673       }
03674       else ++failCNT;
03675     }
03676   }
03677 #ifdef debug
03678   G4cout<<"G4QNucl::ChoosePositions: Out of the positioning LOOP"<<G4endl;
03679 #endif
03680   if(theA > 2) ReduceSum(places,sumPos);              // Reduce the CM shift (equal weights)
03681 #ifdef debug
03682   G4cout<<"G4QNucl::ChoosePositions: The reduced summ is made"<<G4endl;
03683 #endif
03684   for(i=0; i<theA; i++) theNucleons[i]->SetPosition(places[i]);
03685   delete [] places;
03686 #ifdef debug
03687   G4cout << "G4QNucleus::ChoosePositions: The positions are defined for A="<<theA<<G4endl;
03688 #endif
03689 } // End of ChoosePositions
03690 
03691 // Initializes density of 3D nucleons in the 3D nucleus
03692 void G4QNucleus::InitDensity()
03693 {
03694   static const G4double r0sq=0.8133*fermi*fermi;      // Base for A-dep of rel.mean.radius
03695   static const G4double third=1./3.;
03696   G4int    iA = GetA();
03697   G4double rA = iA;
03698   G4double At = pow(rA,third);
03699   G4double At2= At*At;
03700 #ifdef debug
03701   G4cout<<"G4QNucleus::InitDensity: rA=iA=A="<<iA<<", A^1/3="<<At<<", A^2/3="<<At2<<G4endl;
03702 #endif
03703   if(iA<17)                                           // Gaussian density distribution
03704   {
03705     radius = r0sq*At2;                                // R2 Mean Squared Radius (fm^2)
03706     if(radius<=0.)
03707     {
03708       G4cout<<"-Warning-G4QNucl::ChoosePositions:L,iA="<<iA<<",Radius(?)="<<radius<<G4endl;
03709       radius=1.;
03710     }
03711     rho0   = pow(2*pi*radius, -1.5);                  // Central Density (M.K. 2 is added)
03712     // V=4pi*R2*sqrt(pi*R2/2)=(sqrt(2*pi*R2))^3
03713   }
03714   else                                                // Wood-Saxon density distribution
03715   {
03716     G4double r0=1.16*(1.-1.16/At2)*fermi;             // Base for A-dependent radius
03717     radius = r0*At;                                   // Half Density Radius (fm)
03718     if(radius<=0.)
03719     {
03720       G4cout<<"-Warning-G4QNucl::ChoosePositions:H,iA="<<iA<<",Radius(?)="<<radius<<G4endl;
03721       radius=1.;
03722     }
03723     G4double rd=WoodSaxonSurf/radius;                 // Relative thickness of the surface
03724     if(!(rd<=0.1) && !(rd>-0.1))                      // NAN for rd
03725     {
03726       G4cout<<"-Warning-G4QNucl::ChoosePositions:H,NAN,iA="<<iA<<", rd="<<rd<<G4endl;
03727       rd=1.;
03728     }
03729     rho0=0.75/(pi*pow(radius,3)*(1.+rd*rd*pi2));      // Central Density
03730   }
03731   RhoActive=true;
03732 } // End of InitDensity
03733 
03734 // Calculates Derivity of the nuclear density
03735 G4double G4QNucleus::GetDeriv(const G4ThreeVector& aPosition)
03736 {
03737   if(radius==0.) InitDensity();
03738   G4double rPos=aPosition.mag();
03739   if(GetA()<17) return -GetDensity(aPosition)*(rPos+rPos)/radius; // Gaussian density
03740   // Wood-Saxon density distribution
03741   G4double dens=GetRelativeDensity(aPosition);
03742   return -exp((rPos-radius)/WoodSaxonSurf)*dens*dens*rho0/WoodSaxonSurf;
03743 } // End of GetDeriv
03744 
03745 // Radius of the deffinit % of nuclear density (very strange solution ?? @@ M.K.)
03746 G4double G4QNucleus::GetRadius(const G4double maxRelDens)
03747 {
03748   if(radius==0.) InitDensity();
03749   if(GetA()<17)                                     // Gaussian density distribution
03750     return (maxRelDens>0 && maxRelDens <= 1. ) ? sqrt(-radius*log(maxRelDens) ) : DBL_MAX;
03751   // Wood-Saxon density distribution
03752   return (maxRelDens>0 && maxRelDens <= 1. ) ? (radius + WoodSaxonSurf*
03753          log((1.-maxRelDens+exp(-radius/WoodSaxonSurf))/maxRelDens) ) : DBL_MAX;
03754 } // End of GetRadius (check @@ radius=sqr0 (fm^2) for A<17,  r0 (fm) for A>16 (units)
03755 
03756 // Calculates Densyty/rho0
03757 G4double G4QNucleus::GetRelativeDensity(const G4ThreeVector& aPosition)
03758 {
03759   if(radius==0.) InitDensity();
03760   if(GetA()<17) return GetRelOMDensity(aPosition.mag2());// Gaussian distribution (OscMod?)
03761   return GetRelWSDensity(aPosition.mag());               // Wood-Saxon density distribution
03762 } // End of GetRelativeDensity
03763 
03764 // Calculates modul of Fermy Momentum  depending on density
03765 G4double G4QNucleus::GetFermiMomentum(G4double density)
03766 {
03767   static const G4double third=1./3.;
03768   static const G4double constofpmax=hbarc*pow(3.*pi2,third);
03769   return constofpmax * pow(density*GetA(),third);
03770 } // End of GetFermiMomentum
03771 
03772 // Calculates 3D Fermy Momentuma for 3D nucleons in 3D nucleus
03773 void G4QNucleus::ChooseFermiMomenta()
03774 {
03775   static const G4double mProt= G4QPDGCode(2212).GetMass(); // Mass of proton
03776   static const G4double mProt2= mProt*mProt;
03777   //static const G4double mNeut= G4QPDGCode(2112).GetMass(); // Mass of neutron
03778   static const G4double third= 1./3.;
03779   G4int i=0;
03780   G4double density=0.;                                // Prototype of density for Loop calc
03781   G4int theA=GetA();                                  // Atomic weight of the nucleus
03782   G4int am1=theA-1;                                   // The last index in the Loop
03783   G4ThreeVector* momentum = new G4ThreeVector[theA];  // Temporary array for nucleon's moms
03784   G4ThreeVector  sumMom(0.,0.,0.);                    // Sum of all momenta for mom-conserv
03785 #ifdef debug
03786   G4cout<<"G4QNucleus::ChooseFermiMomentum is called for Z="<<Z<<", N="<<N<<G4endl;
03787 #endif
03788   for(i=0; i<theA; i++) // momenta for all, including the last, in case we swap nucleons
03789   {
03790     density=GetDensity(theNucleons[i]->GetPosition());// density around nucleon i
03791     G4double ferm = GetFermiMomentum(density);        // module of momentum for nucleon i
03792     G4ThreeVector mom(0.,0.,0.);                      // proto 3vector for nucleon momentum
03793     G4double rn3=pow(G4UniformRand(),third);          // Spherical randomization
03794     G4ThreeVector dir(0.,0.,0.);                      // proto 3vector for the momDirection
03795     if( i == am1) dir=-sumMom.unit();                 // try to compensate the mom noncons.
03796     else          dir=G4RandomDirection();            // free randomization for i < A-1
03797     if(theNucleons[i]->GetPDGCode() == 2212)          // the nucleon is a proton
03798     {
03799       G4double eMax = sqrt(ferm*ferm+mProt2)-CoulombBarrier();
03800       if(eMax>mProt) mom=sqrt(eMax*eMax - mProt2)*rn3*dir; // 3D proton momentum
03801 #ifdef debug
03802       else G4cerr<<"-Warning-G4QNucleus::ChooseFermM: FailToGetProtonMomentum,p=0"<<G4endl;
03803 #endif
03804     }
03805     else mom=ferm*rn3*dir;                            // 3-vector for the neutron momentum
03806     momentum[i]= mom;
03807     sumMom+= mom;
03808 #ifdef debug
03809     G4cout<<"G4QNucleus::ChooseFermiMomentum: for i="<<i<<", candidate mom="<<mom<<G4endl;
03810 #endif
03811   }
03812   if(theA > 2) SimpleSumReduction(momentum, sumMom);  // Reduse momentum nonconservation
03813   //G4double bindEn=BindingEnergy()/theA;
03814   G4int thisPDG=GetPDG();
03815   G4double rMp=G4QPDGCode(thisPDG-1000).GetMass();    // Residual for the proton
03816   G4double rMn=G4QPDGCode(thisPDG-1).GetMass();       // Residual for the neutron
03817   G4double rMp2=rMp*rMp;
03818   G4double rMn2=rMn*rMn;
03819   //G4double rM=rMn;
03820   G4double rM2=rMn2;
03821   G4double thisM=GetGSMass();
03822 #ifdef debug
03823   G4LorentzVector sum(0.,0.,0.,0.);
03824 #endif
03825   for(i=0; i< theA ; i++ )
03826   {
03827     if(theNucleons[i]->GetPDGCode() == 2212)
03828     {
03829       //rM=rMp;
03830       rM2=rMp2;
03831     }
03832     else
03833     {
03834       //rM=rMn;
03835       rM2=rMn2;
03836     }
03837     G4ThreeVector curMom = momentum[i];
03838     G4double energy = thisM-std::sqrt(rM2+curMom.mag2()); // @@ update after splitting
03839     G4LorentzVector tempV(curMom,energy);
03840 #ifdef debug
03841     G4cout<<"G4QNucleus::ChooseFermiMomentum: FINALLY for i="<<i<<", 4mom="<<tempV<<G4endl;
03842     sum+=tempV;
03843 #endif
03844     theNucleons[i]->Set4Momentum(tempV);
03845   }
03846 #ifdef debug
03847     G4cout<<"G4QNucleus::ChooseFermiMomentum: FINALLY sum4M="<<sum<<G4endl;
03848 #endif
03849   delete [] momentum;
03850 } // End of ChooseFermiMomenta
03851 
03852 // Reduce momentum nonconservation or center of mass shift (Changes the momena!)
03853 void G4QNucleus::SimpleSumReduction(G4ThreeVector* vect, G4ThreeVector sum)
03854 {
03855   G4int theA=GetA();                                // A#of nucleons
03856   sum/=theA;
03857   for(G4int i=0; i<theA; i++) vect[i]-=sum;        // Simple reduction
03858 }
03859 
03860 // Reduce momentum nonconservation or center of mass shift (Keep values of momena) @@Bug!@@
03861 G4bool G4QNucleus::ReduceSum(G4ThreeVector* vect, G4ThreeVector sum)
03862 {
03863   G4int theA=GetA();                                // A#of nucleons
03864   if(theA<3)                                        // Can not reduce for 1 or 2 nucleons
03865   {
03866     G4cout<<"-Warning-G4QNucleus::ReduceSum: *Failed* A="<<theA<<" < 3"<<G4endl;
03867     return false;
03868   }
03869   // The last vector must have the same direction as the SUM (do not take into account
03870   G4int am1=theA-1;                                 // A-1 elements, which canBeCorrected
03871   G4double  sum2=sum.mag2();                        // Initial squared sum
03872   G4double  hsum2=sum2/2;                           // Half squared sum
03873   G4double*  dp= new G4double[am1];                 // Displacements
03874   G4int     m_value=am1;                            // #0fVectors used for correction
03875   G4double  minS=DBL_MAX;                           // Min value of Fermi Momentum
03876   G4int     minI=0;                                 // Index of maximum Fermi Momentum
03877   for(G4int i=0; i<am1; i++) dp[i]=sum.dot(vect[i]);// Calculation of dot-products
03878   while(m_value)
03879   {
03880     m_value=0;
03881     for(G4int i=0; i<am1; i++) if(dp[i]>0 && dp[i]<sum2) // can be used for the reduction
03882     {
03883       m_value++;
03884       G4double shift=fabs(dp[i]-hsum2);
03885       if(shift < minS)
03886       {
03887         minS=shift;
03888         minI=i;
03889       }
03890     }
03891     if(m_value)                                      // There is a vector reducing the sum
03892     {
03893       G4ThreeVector x=(dp[minI]/hsum2)*sum;          // turn-reduction of the sum-vector
03894       vect[minI]-=x;                                 // turn the minI-th vector
03895       sum-=x;                                        // reduce the sum
03896       sum2=sum.mag2();                               // Current squared sum
03897       hsum2=sum2/2;                                  // Current half squared sum
03898     }
03899   }
03900   if(sum2 > 0.)
03901   {
03902     sum/=theA;
03903     for(G4int i=0; i<theA; i++) vect[i]-=sum;        // Final reduction
03904   }
03905   delete[] dp;
03906   return true;
03907 } // End of ReduceSum
03908 
03909 // Initializes 3D nucleus with (Pos,4M)-Nucleons. It automatically starts the LOOP
03910 void G4QNucleus::Init3D()
03911 {
03912 #ifdef debug
03913   G4cout<<"G4QNucleus::Init3D: is called currentNucleon="<<currentNucleon<<G4endl;
03914 #endif
03915   for_each(theNucleons.begin(),theNucleons.end(),DeleteQHadron());
03916   theNucleons.clear();
03917   G4int theA = GetA();
03918   ChooseNucleons();
03919 #ifdef debug
03920   G4cout<<"G4QNucleus::Init3D: Nucleons are initialized, nN="<<theNucleons.size()<<G4endl;
03921 #endif
03922   InitDensity();
03923 #ifdef debug
03924   G4cout<<"G4QNucl::Init3D: DensityPars for A="<<theA<<":R="<<radius <<",r0="<<rho0<<G4endl;
03925 #endif
03926   ChoosePositions(); // CMS positions! No Lorentz boost! Use properely!
03927 #ifdef debug
03928   G4cout<<"G4QNucleus::Init3D: Nucleons are positioned in the coordinate space"<<G4endl;
03929 #endif
03930   ChooseFermiMomenta(); // CMS Fermi Momenta! Must be transfered to the LS if not at rest!
03931   G4ThreeVector n3M=Get3Momentum();                   // Velocity of the nucleus in LS
03932   if(n3M.x() || n3M.y() || n3M.z())                   // Boost the nucleons to LS
03933   {
03934     n3M/=GetEnergy();                                 // Now this is the boost velocity
03935     DoLorentzBoost(n3M);                              // Now nucleons are in LS
03936   }
03937 #ifdef debug
03938   G4cout<<"G4QNucleus::Init3D: Nucleons are positioned in the momentum space"<<G4endl;
03939 #endif
03940   G4double Ebind= BindingEnergy()/theA;
03941   for (G4int i=0; i<theA; i++) theNucleons[i]->SetBindingEnergy(Ebind); // @@ ? M.K.
03942   currentNucleon=0;                                   // Automatically starts the LOOP
03943   return;
03944 } // End of Init3D
03945 
03946 // Get radius of the most far nucleon (+ nucleon radius)
03947 G4double G4QNucleus::GetOuterRadius()
03948 {
03949   G4double maxradius2=0;
03950   G4int theA=theNucleons.size();
03951   if(theA) for(G4int i=0; i<theA; i++)
03952   {
03953     G4double nucr2=theNucleons[i]->GetPosition().mag2();
03954     if(nucr2 > maxradius2) maxradius2=nucr2;
03955   }
03956   return sqrt(maxradius2)+nucleonDistance;
03957 } // End of GetOuterRadius
03958 
03959 //
03960 void G4QNucleus::DoLorentzContraction(const G4ThreeVector& theBeta)
03961 {
03962   G4double bet2=theBeta.mag2();
03963   G4double factor=(1.-sqrt(1.-bet2))/bet2;         // 1./(beta2*gamma2)
03964   G4int theA=theNucleons.size();
03965   if(theA) for (G4int i=0; i< theA; i++)
03966   {
03967     G4ThreeVector pos=theNucleons[i]->GetPosition(); 
03968     pos -= factor*(theBeta*pos)*theBeta;  
03969     theNucleons[i]->SetPosition(pos);
03970   }    
03971 } // End of DoLorentzContraction(G4ThreeVector)
03972 
03973 // Shift all nucleons of the 3D Nucleus (Used in GHAD-TFT)
03974 void G4QNucleus::DoTranslation(const G4ThreeVector& theShift)
03975 {
03976   G4int theA=theNucleons.size();
03977   if(theA) for(G4int i=0; i<theA; i++)
03978     theNucleons[i]->SetPosition(theNucleons[i]->GetPosition() + theShift);
03979 } // End of DoTranslation
03980 
03981 // Initializes currentNucleon=0 returns size of theNucleons vector
03982 G4bool G4QNucleus::StartLoop()
03983 {
03984   G4int theA=theNucleons.size();
03985   if(theA) currentNucleon=0;
03986   else G4cout<<"-Warning-G4QNucleus::StartLoop: LOOP starts for uninited nucleons"<<G4endl;
03987   return theA;
03988 } // End of StartLoop
03989 
03990 //Calculate T(b) with step .1 fm
03991 void G4QNucleus::ActivateBThickness()
03992 {
03993   static const G4double aT= .0008;          // pred exponent parameter
03994   static const G4double sT= .42;            // slope parameter
03995   static const G4double pT=-.26;            // power parameter
03996   static const G4double db= .1;             // step in b (fm)
03997   // @@ make better approximation for light nuclei
03998   G4double A = GetA();                      // atomic weight
03999   G4double B = aT*A*A;                      // predexponent (no units)
04000   G4double D = sT*std::pow(A,pT);           // b^2 slope (fm^-2)
04001   G4double C = A*D/pi/std::log(1.+B);       // Norm for plane density (fm^-2)
04002   G4double mT= C*B/(1+B);                   // Max (b=0) b-thickness
04003   G4double T = mT;                          // Current b-thickness
04004   mT/=1000.;                                // Min b-thickness (@@ make 1000 a parameter)
04005   G4double b = 0.;
04006   while(T>mT)
04007   {
04008     //Tb->push_back(T);                      // Fill the thickness vector starting with b=0
04009     Tb.push_back(T);                        // Fill the thickness vector starting with b=0
04010     b+=db;                                  // increment impact parameter
04011     G4double E=B*std::exp(-D*b*b);          // b-dependent factor
04012     T=C*E/(1.+E);                           // T(b) in fm^-2
04013   }
04014   TbActive=true;                            // Flag of activation
04015 } // End of "ActivateBThickness"
04016 
04017 // Calculate the integral of T(b)
04018 G4double G4QNucleus::GetTbIntegral() // Calculate the integral of T(b)
04019 {
04020   if(!TbActive) ActivateBThickness();
04021   G4int nt = Tb.size();
04022   G4double sum=0.;
04023   for(G4int i=0; i<nt; ++i) sum+=i*Tb[i];
04024   sum*=.02*pi;
04025 #ifdef debug
04026   G4cout<<"G4QNucleus::GetTbIntegral:TI="<<sum<<", RI="<<4*pi*rho0*pow(radius,3)/3<<G4endl;
04027 #endif
04028   return sum;
04029 }
04030 
04031 // Calculates T(b)
04032 G4double G4QNucleus::GetBThickness(G4double b)
04033 {
04034   static const G4double dfermi=fermi/10.;
04035   static const G4double sfermi=fermi*fermi;
04036   if(!TbActive) ActivateBThickness();
04037   G4double bf = b/dfermi;
04038   G4int nb = static_cast<int>(bf);
04039   G4int eb = nb+1;
04040   G4int nt = Tb.size();
04041   if(eb>=nt) return 0.;
04042   G4double nT=Tb[nb];
04043   G4double eT=Tb[eb];
04044   return (nT-(bf-nb)*(nT-eT))/sfermi; // Independent units
04045 }
04046 
04047 // Calculates T(b)/rho0
04048 G4double G4QNucleus::GetThickness(G4double b)
04049 {
04050   G4int tA=GetA();
04051   if(tA<1)
04052   {
04053     G4cout<<"-Warning-G4QNucleus::GetThickness: for A="<<tA<<", => return 0"<<G4endl;
04054     return 0.;
04055   }
04056   else if(tA==1) return 0.;
04057   if(!TbActive) ActivateBThickness();
04058   if(!RhoActive) InitDensity();
04059   return GetBThickness(b)/rho0/tA;
04060 }
04061 
04062 // Add Cluster
04063 G4QNucleus G4QNucleus::operator+=(const G4QNucleus& rhs)
04064 {
04065   Z+=rhs.Z;
04066   N+=rhs.N;
04067   S+=rhs.S;
04068   dZ+=rhs.dZ;
04069   dN+=rhs.dN;
04070   dS+=rhs.dS;
04071   // Atributes of aHadron
04072   G4int           newPDG= GetPDGCode() + rhs.GetPDGCode() - 90000000;
04073   SetQPDG        (newPDG);
04074   G4QContent      newQC = GetQC()      + rhs.GetQC();
04075   SetQC          (newQC);
04076   theMomentum += rhs.Get4Momentum();
04077   return *this;
04078 } 
04079 
04080 // Subtract Cluster
04081 G4QNucleus G4QNucleus::operator-=(const G4QNucleus& rhs)
04082 {
04083   Z-=rhs.Z;
04084   N-=rhs.N;
04085   S-=rhs.S;
04086   dZ-=rhs.dZ;
04087   dN-=rhs.dN;
04088   dS-=rhs.dS;
04089   // Atributes of aHadron
04090   G4int           newPDG= GetPDGCode()   - rhs.GetPDGCode() + 90000000;
04091   SetQPDG        (newPDG);
04092   G4QContent      newQC = GetQC()        - rhs.GetQC();
04093   SetQC          (newQC);
04094   theMomentum -= rhs.Get4Momentum();
04095   return *this;
04096 } 
04097 
04098 // Multiply Nucleus by integer value
04099 G4QNucleus G4QNucleus::operator*=(const G4int& rhs)
04100 {
04101   Z*=rhs;
04102   N*=rhs;
04103   S*=rhs;
04104   dZ*=rhs;
04105   dN*=rhs;
04106   dS*=rhs;
04107   // Atributes of aHadron
04108   G4int           newPDG= rhs*(GetPDGCode() - 90000000) + 90000000;
04109   SetQPDG        (newPDG);
04110   G4QContent      newQC = rhs*GetQC();
04111   SetQC          (newQC);
04112   theMomentum *= rhs;
04113   return *this;
04114 } 
04115 
04116 // Converts hadronic PDG Code to nuclear PDG Code
04117 G4int G4QNucleus::HadrToNucPDG(G4int hPDG)
04118 {
04119   G4int  nPDG=hPDG;
04120   if     (hPDG==2212) nPDG=90001000; // p
04121   else if(hPDG==2112) nPDG=90000001; // n
04122   else if(hPDG==3122||hPDG==3212) nPDG=91000000; // Lambda
04123   else if(hPDG== 211) nPDG=90000999; // pi+
04124   else if(hPDG==-211) nPDG=89999001; // pi-
04125   else if(hPDG== 311) nPDG=89000001; // K0 (anti-strange)
04126   else if(hPDG== 321) nPDG=89001000; // K+ (anti-strange)
04127   else if(hPDG==-311) nPDG=90999999; // anti-K0 (strange)
04128   else if(hPDG==-321) nPDG=90999000; // K-      (strange)
04129   else if(hPDG==1114) nPDG=89999002; // Delta-
04130   else if(hPDG==2224) nPDG=90001999; // Delta++
04131   else if(hPDG==3112) nPDG=90999000; // Sigma-
04132   else if(hPDG==3222) nPDG=91000999; // Sigma+
04133   else if(hPDG==3312) nPDG=91999000; // Ksi-
04134   else if(hPDG==3322) nPDG=91999999; // Ksi0
04135   else if(hPDG==3334) nPDG=92998999; // Omega-
04136   else if(hPDG==-2212) nPDG=8999000; // anti-p
04137   else if(hPDG==-2112) nPDG=8999999; // anti-n
04138   else if(hPDG==-3122||hPDG==3212) nPDG=89000000; //anti- Lambda
04139   else if(hPDG==-3112) nPDG=89000999; // anti-Sigma-
04140   else if(hPDG==-3222) nPDG=88999001; // anti-Sigma+
04141   else if(hPDG==-3312) nPDG=88001000; // anti-Ksi-
04142   else if(hPDG==-3322) nPDG=88000001; // anti-Ksi0
04143   else if(hPDG==-3334) nPDG=87001001; // anti-Omega-
04144   return nPDG;
04145 } 
04146 
04147 // Converts nuclear PDG Code to hadronic PDG Code
04148 G4int G4QNucleus::NucToHadrPDG(G4int nPDG)
04149 {
04150   G4int  hPDG=nPDG;
04151   if     (nPDG==90001000) hPDG=2212; // p
04152   else if(nPDG==90000001) hPDG=2112; // n
04153   else if(nPDG==91000000) hPDG=3122; // Lambda
04154   else if(nPDG==90000999) hPDG= 211; // pi+
04155   else if(nPDG==89999001) hPDG=-211; // pi-
04156   else if(nPDG==89001000) hPDG= 213; // K0 (anti-strange)
04157   else if(nPDG==89000001) hPDG= 213; // K+ (anti-strange)
04158   else if(nPDG==90999000) hPDG=-213; // anti-K0 (strange)
04159   else if(nPDG==90999999) hPDG=-213; // K-      (strange)
04160   else if(nPDG==90001999) hPDG=1114; // Delta-
04161   else if(nPDG==89999002) hPDG=2224; // Delta++
04162   else if(nPDG==91000999) hPDG=3112; // Sigma-
04163   else if(nPDG==90999001) hPDG=3222; // Sigma+
04164   else if(nPDG==91999999) hPDG=3312; // Ksi-
04165   else if(nPDG==91999000) hPDG=3322; // Ksi0
04166   else if(nPDG==92998999) hPDG=3334; // Omega-
04167   return hPDG;
04168 } 
04169 
04170 //Evaporate Residual Nucleus
04171 void G4QNucleus::EvaporateNucleus(G4QHadron* qH, G4QHadronVector* evaHV)
04172 {
04173   static const G4double mHel6 = G4QPDGCode(2112).GetNuclMass(2,4,0);
04174   static const G4double mAlph = G4QPDGCode(2112).GetNuclMass(2,2,0);
04175   static const G4double mDeut = G4QPDGCode(2112).GetNuclMass(1,1,0);
04176   static const G4double mNeut = G4QPDGCode(2112).GetMass();
04177   static const G4double mProt = G4QPDGCode(2212).GetMass();
04178   static const G4double mLamb = G4QPDGCode(3122).GetMass();
04179   static const G4double mPi   = G4QPDGCode(211).GetMass();
04180   static const G4double mPi0  = G4QPDGCode(111).GetMass();
04181   static const G4double mK    = G4QPDGCode(321).GetMass();
04182   static const G4double mK0   = G4QPDGCode(311).GetMass();
04183   static const G4QContent neutQC(2,1,0,0,0,0);
04184   static const G4QContent protQC(1,2,0,0,0,0);
04185   static const G4QContent lambQC(1,1,1,0,0,0);
04186   static const G4QContent deutQC(3,3,0,0,0,0);
04187   static const G4QContent alphQC(6,6,0,0,0,0);
04188   G4int      thePDG = qH->GetPDGCode();     // Get PDG code of the Residual Nucleus
04189   G4QContent theQC  = qH->GetQC();          // Quark Content of the hadron
04190 #ifdef pdebug
04191   G4cout<<"G4QNucleus::EvaporateNucleus:-Called-PDG="<<thePDG<<",QC="<<theQC<<G4endl;
04192 #endif
04193   G4int      theBN  = qH->GetBaryonNumber();// Baryon number of the nucleus
04194 #ifdef pdebug
04195   G4cout<<"G4QNucleus::EvaporateNucleus: theBN="<<theBN<<G4endl;
04196 #endif
04197   if((thePDG || thePDG==10) && theQC.GetBaryonNumber()>0) thePDG=theQC.GetZNSPDGCode();
04198   G4LorentzVector q4M = qH->Get4Momentum(); // Get 4-momentum of theTotalNucleus
04199   if(!theBN || thePDG<80000000 || thePDG==90000000) // Hadron, anti-nucleous, or vacuum
04200   {
04201 #ifdef debug
04202     G4cout<<"G4QNucleus::EvaporateNucleus: Nucleus="<<thePDG<<qH->Get4Momentum()<<G4endl;
04203 #endif
04204     if(thePDG==90000000)
04205     {
04206 #ifdef qdebug
04207       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (1) qH=0"<<G4endl;
04208 #endif
04209       delete qH;
04210       G4cout<<"-Warning-G4QNucleus::EvapNuc:vacuum,4Mom="<<q4M<<G4endl;
04211     }
04212     else   // Put input to the output (delete equivalent)
04213     {
04214       G4cout<<"-Warning-G4QNucleus::EvapNuc:vacuum, Called for Meson PDG="<<thePDG<<G4endl;
04215       evaHV->push_back(qH);
04216     }
04217     return;
04218   }
04220   if(thePDG>91000000) //@@MadeForGeant4@@: If there is a Lambda, substitute it by A neutron
04221   {
04222     G4int SSS=(thePDG-90000000)/1000000;      // A # of Lambdas
04223     thePDG-=SSS*999999;                       // S Neutrons instead of S Lambdas
04224     qH->SetQPDG(G4QPDGCode(thePDG));
04225     theQC  = qH->GetQC();          // Quark Content of the hadron
04226 #ifdef debug
04227     G4cout<<"=>Hyper Change=>G4QNucleus::EvaporateNuceus: NewNucPDG="<<thePDG<<G4endl;
04228 #endif
04229   }
04231   if(thePDG<80000000)
04232   {
04233 #ifdef debug
04234     G4cout<<"G4QN::EvaporateNuc: FundamentalParticle="<<thePDG<<qH->Get4Momentum()<<G4endl;
04235 #endif
04236     evaHV->push_back(qH);     // TheFundamentalParticles must be FilledAsTheyAre (del.eq)
04237     return;
04238   }
04239   G4int    theC=theQC.GetCharge();         // P
04240   G4int    theS=theQC.GetStrangeness();    // S
04241   G4int    theN=theBN-theC-theS;           // N
04242   G4double totGSM = G4QNucleus(thePDG).GetGSMass();// TheGroundStateMass of theTotalNucleus
04243   G4double totMass = q4M.m();              // Get the Real(Excited?)Mass of theTotalNucleus
04244 #ifdef debug
04245   G4cout<<"G4QNucleus::EvaporateNucleus(EVA):===IN==> PDG="<<thePDG<<",4Mom="<<q4M<<", B="
04246         <<theBN<<", Z="<<theC<<", N="<<theN<<", S="<<theS<<G4endl;
04247 #endif
04248   if(theBN<-2)
04249   {
04250     G4cout<<"-Warning-G4QNuc::EvapNuc: Evapor of anti-nuclei is not implemented yet PDG="
04251           <<thePDG<<G4endl;
04252     evaHV->push_back(qH);
04253     return;
04254   }
04255   else if(thePDG==91000000||thePDG==90001000||thePDG==90000001) // Excited Lambda* or N*
04256   //else if(2>3)// One can easily close this decay as it will be done later (time of calc?)
04257   {
04258     G4double gsM=mNeut;
04259     if(thePDG==90001000)      gsM=mProt;
04260     else if(thePDG==91000000) gsM=mLamb;
04261     if(fabs(totMass-gsM)<.001)
04262     {
04263 #ifdef debug
04264       G4cout<<"G4QNu::EvaporateNucl:GSM="<<gsM<<", H="<<thePDG<<qH->Get4Momentum()<<G4endl;
04265 #endif
04266       evaHV->push_back(qH); // (delete equivalent)
04267       return;
04268     }
04269     else if(totMass<gsM)
04270     {
04271 #ifdef qdebug
04272       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (2) qH=0"<<G4endl;
04273 #endif
04274       delete qH;
04275       // G4cerr<<"***G4QN::EvaNuc:Baryon "<<thePDG<<" is belowMassShell, M="<<totMass<<G4endl;
04276       // throw G4QException("G4QNucleus::EvaporateNucleus: Baryon is below Mass Shell");
04277       G4ExceptionDescription ed;
04278       ed << "Baryon is below Mass Shell: Baryon " << thePDG
04279          << " is belowMassShell, M=" << totMass << G4endl;
04280       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0000",
04281                   FatalException, ed);
04282     }
04283     else                                 // Decay in gamma or charged pion (@@ neutral)
04284     {
04285       G4double d=totMass-gsM;
04286 #ifdef debug
04287       G4cout<<"G4QN::EvaporNucl: PDG="<<thePDG<<",M="<<totMass<<">"<<gsM<<",d="<<d<<G4endl;
04288 #endif
04289       G4int decPDG=22;
04290       G4double decM=0.;
04291       if(d>142.)                           // @@ to avoid more precise calculations
04292       {
04293         if(thePDG==90001000)               // p* -> n + pi+
04294         {
04295           gsM=mNeut;
04296           thePDG=90000001;
04297           decPDG=211;
04298           decM=mPi;
04299         }
04300         else if(thePDG==90000001)          // n* -> p + pi-
04301         {
04302           gsM=mProt;
04303           thePDG=90001000;
04304           decPDG=-211;
04305           decM=mPi;
04306         }
04307         else                               // decay in Pi0
04308         {
04309           decPDG=111;
04310           decM=mPi0;
04311         }
04312       }
04313       G4LorentzVector h4Mom(0.,0.,0.,gsM); // GSMass must be updated in previous while-LOOP
04314       G4LorentzVector g4Mom(0.,0.,0.,decM);
04315       if(!G4QHadron(q4M).DecayIn2(h4Mom, g4Mom))
04316       {
04317 #ifdef qdebug
04318         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (3) qH=0"<<G4endl;
04319 #endif
04320         delete qH;
04321         // G4cerr<<"***G4QNuc::EvaNuc:h="<<thePDG<<"(GSM="<<gsM<<")+gam>tM="<<totMass<<G4endl;
04322         // throw G4QException("G4QNucleus::EvaporateNucleus:BaryonDecay In Baryon+Gam Error");
04323         G4ExceptionDescription ed;
04324         ed << "BaryonDecay In Baryon+Gam Error: h=" << thePDG << "(GSM="
04325            << gsM << ")+gam>tM=" << totMass << G4endl;
04326         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0001",
04327                     FatalException, ed);
04328       }
04329 #ifdef debug
04330       G4cout<<"G4QNucl::EvaNuc:"<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<"+g="<<g4Mom<<",n="
04331             <<evaHV->size()<<G4endl;
04332 #endif
04333       G4QHadron* curH = new G4QHadron(thePDG,h4Mom);
04334 #ifdef debug
04335       G4cout<<"G4QNucleus::EvaporateNucleus: Hadr="<<thePDG<<h4Mom<<G4endl;
04336 #endif
04337       evaHV->push_back(curH);         // Fill Baryon (delete equiv.)
04338       G4QHadron* curG = new G4QHadron(decPDG,g4Mom);
04339 #ifdef debug
04340       G4cout<<"G4QNucleus::EvaporateNucleus: Gamma(pion)4M="<<g4Mom<<G4endl;
04341 #endif
04342       evaHV->push_back(curG);         // Fill gamma/pion (delete equivalent)
04343 #ifdef qdebug
04344       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (4) qH=0"<<G4endl;
04345 #endif
04346       delete qH;
04347     }
04348   }
04349   else if(thePDG==89000000||thePDG==89999000||thePDG==89999999) // anti-Lambda* or anti-N*
04350   //else if(2>3)// One can easily close this decay as it will be done later (time of calc?)
04351   {
04352     G4double gsM=mNeut;
04353     if(thePDG==89999000)      gsM=mProt;
04354     else if(thePDG==89000000) gsM=mLamb;
04355     if(fabs(totMass-gsM)<.001)
04356     {
04357 #ifdef debug
04358       G4cout<<"G4QNu::EvaNucl:(aB*),GSM="<<gsM<<", H="<<thePDG<<qH->Get4Momentum()<<G4endl;
04359 #endif
04360       evaHV->push_back(qH); // (delete equivalent)
04361       return;
04362     }
04363     else if(totMass<gsM)
04364     {
04365 #ifdef qdebug
04366       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (2a) qH=0"<<G4endl;
04367 #endif
04368       delete qH;
04369       // G4cerr<<"*G4QN::EvaNuc:antiBaryon="<<thePDG<<" below MassShell, M="<<totMass<<G4endl;
04370       // throw G4QException("G4QNucleus::EvaporateNucleus: anti-Baryon is below Mass Shell");
04371       G4ExceptionDescription ed;
04372       ed << "anti-Baryon is below Mass Shell: antiBaryon=" << thePDG
04373          << " below MassShell, M=" << totMass << G4endl;
04374       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0002",
04375                   FatalException, ed);
04376     }
04377     else                                 // Decay in gamma or charged pion (@@ neutral)
04378     {
04379       G4double d=totMass-gsM;
04380 #ifdef debug
04381       G4cout<<"G4QN::EvaporNucl: PDG="<<thePDG<<",M="<<totMass<<">"<<gsM<<",d="<<d<<G4endl;
04382 #endif
04383       G4int decPDG=22;
04384       G4double decM=0.;
04385       if(d>142.)                           // @@ to avoid more precise calculations
04386       {
04387         if(thePDG==89999000)               // anti (p* -> n + pi+)
04388         {
04389           gsM=mNeut;
04390           thePDG=89999999;
04391           decPDG=-211;
04392           decM=mPi;
04393         }
04394         else if(thePDG==89999999)          // anti (n* -> p + pi-)
04395         {
04396           gsM=mProt;
04397           thePDG=89999000;
04398           decPDG=211;
04399           decM=mPi;
04400         }
04401         else                               // decay in Pi0
04402         {
04403           decPDG=111;
04404           decM=mPi0;
04405         }
04406       }
04407       G4LorentzVector h4Mom(0.,0.,0.,gsM); // GSMass must be updated in previous while-LOOP
04408       G4LorentzVector g4Mom(0.,0.,0.,decM);
04409       if(!G4QHadron(q4M).DecayIn2(h4Mom, g4Mom))
04410       {
04411 #ifdef qdebug
04412         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (3a) qH=0"<<G4endl;
04413 #endif
04414         delete qH;
04415         // G4cerr<<"**G4QNuc::EvaNuc:ah="<<thePDG<<"(GSM="<<gsM<<")+gam>tM="<<totMass<<G4endl;
04416         // throw G4QException("G4QNucleus::EvaporateNucleus:BaryonDecay In Baryon+Gam Error");
04417         G4ExceptionDescription ed;
04418         ed << "BaryonDecay In Baryon+Gam Error: ah=" << thePDG << "(GSM="
04419            << gsM << ")+gam>tM=" << totMass << G4endl;
04420         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0003",
04421                     FatalException, ed);
04422       }
04423 #ifdef debug
04424       G4cout<<"G4QNucl::EvaNuc:aM="<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<"+g="<<g4Mom<<",n="
04425             <<evaHV->size()<<G4endl;
04426 #endif
04427       G4QHadron* curH = new G4QHadron(thePDG, h4Mom);
04428 #ifdef debug
04429       G4cout<<"G4QNucleus::EvaporateNucleus: antiHadr="<<thePDG<<h4Mom<<G4endl;
04430 #endif
04431       evaHV->push_back(curH);         // Fill Baryon (delete equiv.)
04432       G4QHadron* curMes = new G4QHadron(decPDG, g4Mom);
04433 #ifdef debug
04434       G4cout<<"G4QNucleus::EvaporateNucleus: (anti) Gamma(pion)4M="<<g4Mom<<G4endl;
04435 #endif
04436       evaHV->push_back(curMes);         // Fill gamma/pion (delete equivalent)
04437 #ifdef qdebug
04438       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (4a) qH=0"<<G4endl;
04439 #endif
04440       delete qH;
04441     }
04442   }
04443   else if((thePDG==90001999||thePDG==89999002) && totMass>1080.) // @@ to avoid threshold
04444   //else if(2>3)// One can easily close this decay as it will be done later (time of calc?)
04445   {
04446     G4double gsM=mNeut;
04447     G4int barPDG=2112;
04448     G4int mesPDG=-211;
04449     if(thePDG==90001999)
04450     {
04451       gsM=mProt;
04452       barPDG=2212;
04453       mesPDG=211;
04454     }
04455     if(fabs(totMass-gsM-mPi)<.001)
04456     {
04457 #ifdef debug
04458       G4cout<<"G4QN::EvaporateNuc:(D)GSM="<<gsM<<",H="<<thePDG<<qH->Get4Momentum()<<G4endl;
04459 #endif
04460       G4LorentzVector h4Mom=q4M*(gsM/totMass);           // At rest in CM
04461       G4QHadron* curB = new G4QHadron(barPDG,h4Mom);
04462       evaHV->push_back(curB); // (delete equivalent)
04463       G4LorentzVector g4Mom=q4M*(mPi/totMass);
04464       G4QHadron* curM = new G4QHadron(mesPDG,g4Mom);
04465       evaHV->push_back(curM); // (delete equivalent)
04466 #ifdef qdebug
04467       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (5) qH=0"<<G4endl;
04468 #endif
04469       delete qH;
04470       return;
04471     }
04472     else if(totMass<gsM+mPi)
04473     {
04474 #ifdef qdebug
04475       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (6) qH=0"<<G4endl;
04476 #endif
04477       delete qH;
04478       // G4cerr<<"***G4QN::EvaNuc:Delta "<<thePDG<<" is belowMassShell, M="<<totMass<<G4endl;
04479       // throw G4QException("G4QNucleus::EvaporateNucleus: Delta is below Mass Shell");
04480       G4ExceptionDescription ed;
04481       ed << "Delta is below Mass Shell: Delta " << thePDG
04482          << " is belowMassShell, M=" << totMass << G4endl;
04483       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0004",
04484                   FatalException, ed);
04485     }
04486     else                                 // Decay in gamma or charged pion (@@ neutral)
04487     {
04488       G4LorentzVector h4Mom(0.,0.,0.,gsM); // GSMass must be updated in previous while-LOOP
04489       G4LorentzVector g4Mom(0.,0.,0.,mPi);
04490       if(!G4QHadron(q4M).DecayIn2(h4Mom, g4Mom))
04491       {
04492 #ifdef qdebug
04493         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (7) qH=0"<<G4endl;
04494 #endif
04495         delete qH;
04496         // G4cerr<<"***G4QNuc::EvaNuc:Dh="<<thePDG<<"N+pi="<<gsM+mPi<<">tM="<<totMass<<G4endl;
04497         // throw G4QException("G4QNucleus::EvaporateNucleus: DeltaDecInBaryon+Pi Error");
04498         G4ExceptionDescription ed;
04499         ed << "DeltaDecInBaryon+Pi Error: Dh=" << thePDG << "N+pi=" << gsM+mPi
04500            << ">tM=" << totMass << G4endl;
04501         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0005",
04502                   FatalException, ed);
04503       }
04504 #ifdef debug
04505       G4cout<<"G4QNuc::EvaNuc:"<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<"+pi="<<g4Mom<<", nH="
04506             <<evaHV->size()<<G4endl;
04507 #endif
04508       G4QHadron* curH = new G4QHadron(barPDG,h4Mom);
04509 #ifdef debug
04510       G4cout<<"G4QNucleus::EvaporateNucl: Nucleon="<<thePDG<<h4Mom<<G4endl;
04511 #endif
04512       evaHV->push_back(curH);         // Fill the nucleon (delete equiv.)
04513       G4QHadron* curG = new G4QHadron(mesPDG,g4Mom);
04514 #ifdef debug
04515       G4cout<<"G4QE::EvaporateR: Pion="<<g4Mom<<G4endl;
04516 #endif
04517       evaHV->push_back(curG);         // Fill the pion (delete equivalent)
04518 #ifdef qdebug
04519       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (8) qH=0"<<G4endl;
04520 #endif
04521       delete qH;
04522     }
04523   }
04524   else if((thePDG==89998001||thePDG==90000998) && totMass>1080.) // @@ to avoid threshold
04525   //else if(2>3)// One can easily close this decay as it will be done later (time of calc?)
04526   {
04527     G4double gsM=mNeut;
04528     G4int barPDG=-2112;
04529     G4int mesPDG=211;
04530     if(thePDG==89998001)
04531     {
04532       gsM=mProt;
04533       barPDG=-2212;
04534       mesPDG=-211;
04535     }
04536     if(fabs(totMass-gsM-mPi)<.001)
04537     {
04538 #ifdef debug
04539       G4cout<<"G4QN::EvaporateNuc:(A)GSM="<<gsM<<",H="<<thePDG<<qH->Get4Momentum()<<G4endl;
04540 #endif
04541       G4LorentzVector h4Mom=q4M*(gsM/totMass);           // At rest in CM
04542       G4QHadron* curB = new G4QHadron(barPDG,h4Mom);
04543       evaHV->push_back(curB); // (delete equivalent)
04544       G4LorentzVector g4Mom=q4M*(mPi/totMass);
04545       G4QHadron* curM = new G4QHadron(mesPDG,g4Mom);
04546       evaHV->push_back(curM); // (delete equivalent)
04547 #ifdef qdebug
04548       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (5a) qH=0"<<G4endl;
04549 #endif
04550       delete qH;
04551       return;
04552     }
04553     else if(totMass<gsM+mPi)
04554     {
04555 #ifdef qdebug
04556       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (6a) qH=0"<<G4endl;
04557 #endif
04558       delete qH;
04559       // G4cerr<<"***G4QN::EvaNuc:aDelta "<<thePDG<<" is belowMassShell, M="<<totMass<<G4endl;
04560       // throw G4QException("G4QNucleus::EvaporateNucleus: anti-Delta is below Mass Shell");
04561       G4ExceptionDescription ed;
04562       ed << "anti-Delta is below Mass Shell: aDelta " << thePDG
04563          << " is belowMassShell, M=" << totMass << G4endl;
04564       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0006",
04565                   FatalException, ed);
04566     }
04567     else                                 // Decay in gamma or charged pion (@@ neutral)
04568     {
04569       G4LorentzVector h4Mom(0.,0.,0.,gsM); // GSMass must be updated in previous while-LOOP
04570       G4LorentzVector g4Mom(0.,0.,0.,mPi);
04571       if(!G4QHadron(q4M).DecayIn2(h4Mom, g4Mom))
04572       {
04573 #ifdef qdebug
04574         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (7a) qH=0"<<G4endl;
04575 #endif
04576         delete qH;
04577         // G4cerr<<"***G4QNuc::EvaNuc:aD="<<thePDG<<"N+pi="<<gsM+mPi<<">tM="<<totMass<<G4endl;
04578         // throw G4QException("G4QNucleus::EvaporateNucleus:AntiDeltaDecayInBaryon+Pi Error");
04579         G4ExceptionDescription ed;
04580         ed << "AntiDeltaDecayInBaryon+Pi Error: aD=" << thePDG << "N+pi="
04581            << gsM+mPi << ">tM=" << totMass << G4endl;
04582         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0007",
04583                     FatalException, ed);
04584       }
04585 #ifdef debug
04586       G4cout<<"G4QNuc::EvaNuc:(aD) "<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<" + pi="<<g4Mom
04587             <<", nH="<<evaHV->size()<<G4endl;
04588 #endif
04589       G4QHadron* curH = new G4QHadron(barPDG,h4Mom);
04590 #ifdef debug
04591       G4cout<<"G4QNucleus::EvaporateNucl: Nucleon="<<thePDG<<h4Mom<<G4endl;
04592 #endif
04593       evaHV->push_back(curH);         // Fill the nucleon (delete equiv.)
04594       G4QHadron* curMes = new G4QHadron(mesPDG,g4Mom);
04595 #ifdef debug
04596       G4cout<<"G4QE::EvaporateR: Pion="<<g4Mom<<G4endl;
04597 #endif
04598       evaHV->push_back(curMes);         // Fill the pion (delete equivalent)
04599 #ifdef qdebug
04600       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (8a) qH=0"<<G4endl;
04601 #endif
04602       delete qH;
04603     }
04604   }
04605   else if(theBN>0&&theS<0) DecayAntiStrange(qH,evaHV); // "AntyStrangeNucleus" (del.eq.)
04606   else if(theBN>0&&(theC<0||theC>theBN-theS))DecayIsonucleus(qH,evaHV);//"Isonucleus"(d.e.)
04607   else if((thePDG==89999003 || thePDG==90002999) && totMass>2020.) //=> "ISO-dibarion"
04608   {
04609     // @@ Check that it never comes here !!
04610     G4int  nucPDG = 2112;
04611     G4double nucM = mNeut;
04612     G4int   piPDG = -211;
04613     if(thePDG==90002999)
04614     {
04615       nucPDG = 2212;
04616       nucM   = mProt;
04617       piPDG  = 211;
04618     }
04619     if(totMass>mPi+nucM+nucM)
04620     {
04621       G4LorentzVector n14M(0.,0.,0.,nucM);
04622       G4LorentzVector n24M(0.,0.,0.,nucM);
04623       G4LorentzVector pi4M(0.,0.,0.,mPi);
04624       if(!G4QHadron(q4M).DecayIn3(n14M,n24M,pi4M))
04625       {
04626 #ifdef qdebug
04627         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (9) qH=0"<<G4endl;
04628 #endif
04629         delete qH;
04630         // G4cerr<<"***G4QNucleus::EvaporateNucleus: tM="<<totMass<<"-> 2N="<<nucPDG<<"(M="
04631         //       <<nucM<<") + pi="<<piPDG<<"(M="<<mPi<<")"<<G4endl;
04632         // throw G4QException("G4QNucleus::EvaporateNucleus: ISO-Dibaryon DecayIn3 error");
04633         G4ExceptionDescription ed;
04634         ed << " ISO-Dibaryon DecayIn3 error: tM=" << totMass << "-> 2N="
04635            << nucPDG << "(M=" << nucM << ") + pi=" << piPDG << "(M="
04636            << mPi << ")" << G4endl;
04637         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0008",
04638                     FatalException, ed);
04639       }
04640 #ifdef qdebug
04641       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (10) qH=0"<<G4endl;
04642 #endif
04643       delete qH;
04644       G4QHadron* h1H = new G4QHadron(nucPDG,n14M);
04645 #ifdef debug
04646       G4cout<<"G4QNucleus::EvaporateNucleus: Bar1="<<nucPDG<<n14M<<G4endl;
04647 #endif
04648       evaHV->push_back(h1H);                // (delete equivalent)
04649       G4QHadron* h2H = new G4QHadron(nucPDG,n24M);
04650 #ifdef debug
04651       G4cout<<"G4QNucleus::EvaporateNucleus: Bar2="<<nucPDG<<n24M<<G4endl;
04652 #endif
04653       evaHV->push_back(h2H);                // (delete equivalent)
04654       G4QHadron* piH = new G4QHadron(piPDG,pi4M);
04655 #ifdef debug
04656       G4cout<<"G4QNucleus::EvaporateNucleus: Pi="<<piPDG<<pi4M<<G4endl;
04657 #endif
04658       evaHV->push_back(piH);                // (delete equivalent)
04659     }
04660     else
04661     {
04662 #ifdef qdebug
04663       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (11) qH=0"<<G4endl;
04664 #endif
04665       delete qH;
04666       // G4cerr<<"***G4QNucleus::EvapNucleus: IdPDG="<<thePDG<<", q4M="<<q4M<<", M="<<totMass
04667       //       <<" < M_2N+Pi, d="<<totMass-2*nucM-mPi<<G4endl;
04668       // throw G4QException("G4QNucleus::EvaporateNucleus:ISO-DiBaryon is under MassShell");
04669       G4ExceptionDescription ed;
04670       ed << "ISO-DiBaryon is under MassShell: IdPDG=" << thePDG << ", q4M="
04671          << q4M << ", M=" << totMass << " < M_2N+Pi, d=" << totMass-2*nucM-mPi
04672          << G4endl;
04673       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0009",
04674                   FatalException, ed);
04675     }
04676   }
04677   else if((thePDG==90000002||thePDG==90001001||thePDG==90002000)&&totMass>2020.) //=> IsoBP
04678   {
04679     // @@ Pi0 can be taken into account !
04680     G4int  n1PDG = 2212;
04681     G4int  n2PDG = 2112;
04682     G4int  piPDG = -211;
04683     G4double n1M = mProt;
04684     G4double n2M = mNeut;
04685     if     (thePDG==90002000) piPDG  =  211;      // pp -> np + pi-
04686     else if(thePDG==90000002) piPDG  = -211;      // nn -> np + pi-
04687     else                                          // np -> 50%(nnpi+) 50%(pppi-)
04688     {
04689       if(G4UniformRand()>.5)
04690       {
04691         n1PDG=2112;
04692         n1M=mNeut;
04693         piPDG  =  211;
04694       }
04695       else
04696       {
04697         n2PDG=2212;
04698         n2M=mProt;
04699         piPDG  = -211;
04700       }
04701     }
04702     if(totMass>mPi+n1M+n2M)
04703     {
04704       G4LorentzVector n14M(0.,0.,0.,n1M);
04705       G4LorentzVector n24M(0.,0.,0.,n2M);
04706       G4LorentzVector pi4M(0.,0.,0.,mPi);
04707       if(!G4QHadron(q4M).DecayIn3(n14M,n24M,pi4M))
04708       {
04709         // G4cerr<<"***G4QNucl::EvapNucleus:IsoDN, tM="<<totMass<<"-> N1="<<n1PDG<<"(M="<<n1M
04710         //       <<") + N2="<<n2PDG<<"(M="<<n2M<<") + pi="<<piPDG<<" (Mpi="<<mPi<<")"<<G4endl;
04711         // throw G4QException("G4QNucl::EvaporateNucleus:ISO-dibaryon excit. DecayIn3 error");
04712         G4ExceptionDescription ed;
04713         ed << "ISO-dibaryon excit. DecayIn3 error: IsoDN, tM=" << totMass
04714            << "-> N1=" << n1PDG << "(M=" << n1M << ") + N2=" << n2PDG
04715            << "(M=" << n2M << ") + pi=" << piPDG << " (Mpi=" << mPi << ")"
04716            << G4endl;
04717         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0010",
04718                     FatalException, ed);
04719       }
04720 #ifdef qdebug
04721       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (12) qH=0"<<G4endl;
04722 #endif
04723       delete qH;
04724       G4QHadron* h1H = new G4QHadron(n1PDG,n14M);
04725 #ifdef debug
04726       G4cout<<"G4QNucleus::EvaporateNucleus: Bar1="<<n1PDG<<n14M<<G4endl;
04727 #endif
04728       evaHV->push_back(h1H);                // (delete equivalent)
04729       G4QHadron* h2H = new G4QHadron(n2PDG,n24M);
04730 #ifdef debug
04731       G4cout<<"G4QNucleus::EvaporateNucleus: Bar2="<<n2PDG<<n24M<<G4endl;
04732 #endif
04733       evaHV->push_back(h2H);                // (delete equivalent)
04734       G4QHadron* piH = new G4QHadron(piPDG,pi4M);
04735 #ifdef debug
04736       G4cout<<"G4QNucleus::EvaporateNucleus: Pi="<<piPDG<<pi4M<<G4endl;
04737 #endif
04738       evaHV->push_back(piH);                // (delete equivalent)
04739     }
04740     else
04741     {
04742 #ifdef qdebug
04743       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (13) qH=0"<<G4endl;
04744 #endif
04745       delete qH;
04746       // G4cerr<<"***G4QNuc::EvaporateNucleus: IdPDG="<<thePDG<<", q4M="<<q4M<<", M="<<totMass
04747       //       <<" < M1+M2+Pi, d="<<totMass-n1M-n2M-mPi<<G4endl;
04748       // throw G4QException("G4QNucleus::EvaporateNucleus:IsoDiBarState is under MassShell");
04749       G4ExceptionDescription ed;
04750       ed << "IsoDiBarState is under MassShell:  IdPDG=" << thePDG << ", q4M="
04751          << q4M << ", M=" << totMass << " < M1+M2+Pi, d="
04752          << totMass-n1M-n2M-mPi << G4endl;
04753         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0011",
04754                     FatalException, ed);
04755     }
04756   }
04757   else if(theBN==2) DecayDibaryon(qH, evaHV);       //=> "Dibaryon" case (del eq.)
04758   else if((thePDG==90000997 || thePDG==89997001) && totMass>2020.) //=> "anti-ISO-dibarion"
04759   {
04760     // @@ Check that it never comes here !!
04761     G4int  nucPDG = -2112;
04762     G4double nucM = mNeut;
04763     G4int   piPDG = 211;
04764     if(thePDG==90002999)
04765     {
04766       nucPDG = -2212;
04767       nucM   = mProt;
04768       piPDG  = -211;
04769     }
04770     if(totMass>mPi+nucM+nucM)
04771     {
04772       G4LorentzVector n14M(0.,0.,0.,nucM);
04773       G4LorentzVector n24M(0.,0.,0.,nucM);
04774       G4LorentzVector pi4M(0.,0.,0.,mPi);
04775       if(!G4QHadron(q4M).DecayIn3(n14M,n24M,pi4M))
04776       {
04777 #ifdef qdebug
04778         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (9a) qH=0"<<G4endl;
04779 #endif
04780         delete qH;
04781         // G4cerr<<"***G4QNucleus::EvaporateNucleus:antiM="<<totMass<<"-> 2aN="<<nucPDG<<"(M="
04782         //       <<nucM<<") + pi="<<piPDG<<"(M="<<mPi<<")"<<G4endl;
04783         // throw G4QException("G4QNucleus::EvaporateNucleus:Anti-ISO-DibaryonDecayIn3 error");
04784         G4ExceptionDescription ed;
04785         ed << "Anti-ISO-DibaryonDecayIn3 error: antiM=" << totMass
04786            << "-> 2aN=" << nucPDG << "(M=" << nucM << ") + pi=" << piPDG
04787            << "(M=" << mPi << ")" << G4endl;
04788         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0012",
04789                     FatalException, ed);
04790       }
04791 #ifdef qdebug
04792       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (10a) qH=0"<<G4endl;
04793 #endif
04794       delete qH;
04795       G4QHadron* h1H = new G4QHadron(nucPDG,n14M);
04796 #ifdef debug
04797       G4cout<<"G4QNucleus::EvaporateNucleus:(I) antiBar1="<<nucPDG<<n14M<<G4endl;
04798 #endif
04799       evaHV->push_back(h1H);                // (delete equivalent)
04800       G4QHadron* h2H = new G4QHadron(nucPDG,n24M);
04801 #ifdef debug
04802       G4cout<<"G4QNucleus::EvaporateNucleus:(I) antiBar2="<<nucPDG<<n24M<<G4endl;
04803 #endif
04804       evaHV->push_back(h2H);                // (delete equivalent)
04805       G4QHadron* piH = new G4QHadron(piPDG,pi4M);
04806 #ifdef debug
04807       G4cout<<"G4QNucleus::EvaporateNucleus:(I) (anti) Pi="<<piPDG<<pi4M<<G4endl;
04808 #endif
04809       evaHV->push_back(piH);                // (delete equivalent)
04810     }
04811     else
04812     {
04813 #ifdef qdebug
04814       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (11a) qH=0"<<G4endl;
04815 #endif
04816       delete qH;
04817       // G4cerr<<"***G4QNucleus::EvapNucleus: aIdPDG="<<thePDG<<", q4M="<<q4M<<", M="<<totMass
04818       //       <<" < M_2N+Pi, d="<<totMass-2*nucM-mPi<<G4endl;
04819       // throw G4QException("G4QNucleus::EvaporateNucleus:AntiISODiBaryon is underMassShell");
04820       G4ExceptionDescription ed;
04821       ed << "AntiISODiBaryon is underMassShell: aIdPDG=" << thePDG << ", q4M="
04822          << q4M << ", M=" << totMass << " < M_2N+Pi, d=" << totMass-2*nucM-mPi
04823          << G4endl;
04824        G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0013",
04825                    FatalException, ed);
04826     }
04827   }
04828   else if((thePDG==89999998||thePDG==89998999||thePDG==89998000)&&totMass>2020.)//=>AnIsoBP
04829   {
04830     // @@ Pi0 can be taken into account !
04831     G4int  n1PDG = -2212;
04832     G4int  n2PDG = -2112;
04833     G4int  piPDG = 211;                           // dummy initialization
04834     G4double n1M = mProt;
04835     G4double n2M = mNeut;
04836     if     (thePDG==89998000) piPDG  = -211;      // anti ( pp -> np + pi- )
04837     else if(thePDG==89999998) piPDG  =  211;      // anti ( nn -> np + pi- )
04838     else                                          // anti ( np -> 50%(nnpi+) 50%(pppi-) )
04839     {
04840       if(G4UniformRand()>.5)
04841       {
04842         n1PDG=-2112;
04843         n1M=mNeut;
04844         piPDG  = -211;
04845       }
04846       else
04847       {
04848         n2PDG=-2212;
04849         n2M=mProt;
04850         piPDG  =  211;
04851       }
04852     }
04853     if(totMass>mPi+n1M+n2M)
04854     {
04855       G4LorentzVector n14M(0.,0.,0.,n1M);
04856       G4LorentzVector n24M(0.,0.,0.,n2M);
04857       G4LorentzVector pi4M(0.,0.,0.,mPi);
04858       if(!G4QHadron(q4M).DecayIn3(n14M,n24M,pi4M))
04859       {
04860         // G4cerr<<"**G4QNucl::EvapNucleus:IsoDN,antiM="<<totMass<<"-> N1="<<n1PDG<<"(M="<<n1M
04861         //       <<") + N2="<<n2PDG<<"(M="<<n2M<<") + pi="<<piPDG<<" (Mpi="<<mPi<<")"<<G4endl;
04862         // throw G4QException("G4QNucl::EvaporateNucleus:AntiExcitedDibaryon DecayIn3 error");
04863         G4ExceptionDescription ed;
04864         ed << "AntiExcitedDibaryon DecayIn3 error: IsoDN,antiM=" << totMass
04865            << "-> N1=" << n1PDG << "(M=" << n1M << ") + N2=" << n2PDG << "(M="
04866            << n2M << ") + pi=" << piPDG << " (Mpi=" << mPi << ")" << G4endl;
04867         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0014",
04868                     FatalException, ed);
04869       }
04870 #ifdef qdebug
04871       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (12a) qH=0"<<G4endl;
04872 #endif
04873       delete qH;
04874       G4QHadron* h1H = new G4QHadron(n1PDG,n14M);
04875 #ifdef debug
04876       G4cout<<"G4QNucleus::EvaporateNucleus: antiBar1="<<n1PDG<<n14M<<G4endl;
04877 #endif
04878       evaHV->push_back(h1H);                // (delete equivalent)
04879       G4QHadron* h2H = new G4QHadron(n2PDG,n24M);
04880 #ifdef debug
04881       G4cout<<"G4QNucleus::EvaporateNucleus: antiBar2="<<n2PDG<<n24M<<G4endl;
04882 #endif
04883       evaHV->push_back(h2H);                // (delete equivalent)
04884       G4QHadron* piH = new G4QHadron(piPDG,pi4M);
04885 #ifdef debug
04886       G4cout<<"G4QNucleus::EvaporateNucleus: (anti)Pi="<<piPDG<<pi4M<<G4endl;
04887 #endif
04888       evaHV->push_back(piH);                // (delete equivalent)
04889     }
04890     else
04891     {
04892 #ifdef qdebug
04893       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (13a) qH=0"<<G4endl;
04894 #endif
04895       delete qH;
04896       // G4cerr<<"***G4QNuc::EvaporateNucleus:andPDG="<<thePDG<<", q4M="<<q4M<<", M="<<totMass
04897       //       <<" < M1+M2+Pi, d="<<totMass-n1M-n2M-mPi<<G4endl;
04898       // throw G4QException("G4QNucleus::EvaporateNucleus:AntiDiBarState is under MassShell");
04899       G4ExceptionDescription ed;
04900       ed << "AntiDiBarState is under MassShell: andPDG=" << thePDG << ", q4M="
04901          << q4M << ", M=" << totMass << " < M1+M2+Pi, d="
04902          << totMass-n1M-n2M-mPi << G4endl;
04903       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0015",
04904                   FatalException, ed);
04905     }
04906   }
04907   else if(theBN==-2) DecayAntiDibaryon(qH,evaHV);       //=> "Anti-Dibaryon" case (del eq.)
04908   else if(fabs(totMass-totGSM)<.001)  // Fill as it is or decay Be8, He5, Li5 (@@ add more)
04909   {
04910 #ifdef debug
04911     G4cout<<"G4QNucleus::EvaNuc:GS "<<qH->GetQC()<<qH->Get4Momentum()<<" FillAsIs"<<G4endl;
04912 #endif
04913     if(thePDG==90004004)
04914     {
04915       DecayAlphaAlpha(qH,evaHV);
04916     } // "Alpha+Alpha Decay" case (del eq.)
04917     else if(thePDG==90004002)
04918     {
04919       DecayAlphaDiN(qH,evaHV);
04920     } // Decay alpha+2p(alpha+2n is stable)
04921     else if((theC==theBN||theN==theBN||theS==theBN)&&theBN>1)
04922     {
04923       DecayMultyBaryon(qH,evaHV);
04924     }
04925     else if(theBN==5)
04926     {
04927       DecayAlphaBar(qH,evaHV);
04928     }   // Decay unstable A5 system (del eq.)
04929     else
04930     {
04931       evaHV->push_back(qH);
04932     }      // Fill as it is (del eq.)
04933   }
04934   else if(theBN>1 && thePDG>88000000 && thePDG<89000000) //==> 2antiK in the nucleus
04935   {
04936     G4cout<<"---Warning---G4QNucl::EvaNuc:MustNotBeHere.PDG="<<thePDG<<",S="<<theS<<G4endl;
04937     G4int bZ=theQC.GetCharge();
04938     G4int bN=theBN-bZ;
04939     G4int k1PDG = 321;
04940     G4double mK1= mK;
04941     G4int k2PDG = 321;
04942     G4double mK2= mK;
04943     G4int  nucPDG = thePDG;
04944     if(bZ>=bN) nucPDG+=999000;
04945     else
04946     {
04947       nucPDG+=999999;
04948       k1PDG = 311;
04949       mK1= mK0;
04950     }
04951     if(bZ>bN) nucPDG+=999000;
04952     else
04953     {
04954       nucPDG+=999999;
04955       k2PDG = 311;
04956       mK2= mK0;
04957     }
04958     G4double nucM = G4QNucleus(nucPDG).GetGSMass();
04959     G4cout<<"-Warning-G4QN::EvN:M="<<nucM<<","<<nucPDG<<",1="<<k1PDG<<",2="<<k2PDG<<G4endl;
04960     G4LorentzVector n4M(0.,0.,0.,nucM);
04961     G4LorentzVector k14M(0.,0.,0.,mK1);
04962     G4LorentzVector k24M(0.,0.,0.,mK2);
04963     if(!G4QHadron(q4M).DecayIn3(n4M,k14M,k24M))
04964     {
04965 #ifdef qdebug
04966       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (14) qH=0"<<G4endl;
04967 #endif
04968       delete qH;
04969       // G4cout<<"***G4QNucleus::EvaNuc:tM="<<totMass<<"-> N="<<nucPDG<<"(M="<<nucM<<") + k1="
04970       //       <<k1PDG<<"(M="<<mK1<<") + k2="<<k2PDG<<"(M="<<mK2<<")"<<G4endl;
04971       // throw G4QException("G4QNucleus::EvaporateNucleus: Nucleus+2antiK DecayIn3 error");
04972       G4ExceptionDescription ed;
04973       ed << " Nucleus+2antiK DecayIn3 error: tM=" << totMass << "-> N="
04974          << nucPDG << "(M=" << nucM << ") + k1=" << k1PDG << "(M=" << mK1
04975          << ") + k2=" << k2PDG << "(M=" << mK2 << ")" << G4endl;
04976       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0016",
04977                   FatalException, ed);
04978     }
04979 #ifdef qdebug
04980     if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (15) qH=0"<<G4endl;
04981 #endif
04982     delete qH;
04983     G4QHadron* k1H = new G4QHadron(k1PDG,k14M);
04984 #ifdef debug
04985     G4cout<<"G4QNucleus::EvaporateNucleus: k1="<<k1PDG<<k14M<<G4endl;
04986 #endif
04987     evaHV->push_back(k1H);                // (delete equivalent)
04988     G4QHadron* k2H = new G4QHadron(k2PDG,k24M);
04989 #ifdef debug
04990     G4cout<<"G4QNucleus::EvaporateNucleus: k2="<<k2PDG<<k24M<<G4endl;
04991 #endif
04992     evaHV->push_back(k2H);                // (delete equivalent)
04993     G4QHadron* nH = new G4QHadron(nucPDG,n4M);
04994 #ifdef debug
04995     G4cout<<"G4QNucleus::EvaporateNucleus: Nuc="<<nucPDG<<n4M<<G4endl;
04996 #endif
04997     evaHV->push_back(nH);                 // (delete equivalent)
04998   }
04999   // ***>> From here the EVA code starts (baryons/hyperons can be excited) <<***
05000   else if ( (thePDG > 80000000 && thePDG != 90000000) || 
05001      thePDG == 2112 || thePDG == 2212 || thePDG == 3122)
05002   { // @@ Improve for Sigma+, Sigma-, Ksi0 & Ksi- content in the Total Np/Nn Nuclei
05003     if(thePDG<80000000)                        // Switch from QHadronCode to QNuclearCode
05004     {
05005       if     (thePDG==2112) thePDG=90000001;   // n
05006       else if(thePDG==2212) thePDG=90001000;   // p
05007       else if(thePDG==3122) thePDG=91000000;   // lambda
05008     }
05009     G4QNucleus qNuc(q4M,thePDG);               // Make a Nucleus for theTotalResidNucleus
05010     G4double GSMass =qNuc.GetGSMass();         // GSMass of the Total Residual Nucleus
05011     G4QContent totQC=qNuc.GetQCZNS();          // QuarkCont of theTotalResidNucleus (theQC)
05012     G4int    bA     =qNuc.GetA();              // A#of baryons in Total Residual Nucleus
05013     G4int    bZ     =qNuc.GetZ();              // A#of protons in the Total ResidualNucleus
05014     G4int    bN     =qNuc.GetN();              // A#of neutrons in the TotalResidualNucleus
05015 #ifdef ppdebug
05016     G4cout<<"G4QN::EvaNuc: theBN="<<theBN<<", bA="<<bA<<", bZ="<<bZ<<", bN="<<bN<<G4endl;
05017 #endif
05018     G4int    bS     =qNuc.GetS();              // A#of lambdas in the Total ResidualNucleus
05019 #ifdef debug
05020     if(bZ==2&&bN==5)G4cout<<"G4QNucleus::EvaNucl: (2,5) GSM="<<GSMass<<" > "
05021                           <<G4QPDGCode(2112).GetNuclMass(2,4,0)+mNeut<<G4endl;
05022     if(bZ==1&&bN==3)G4cout<<"G4QNucl::EvaNucl: (1,3) GSM="<<GSMass<<" > "
05023                           <<G4QPDGCode(2112).GetNuclMass(1,2,0)+mNeut<<G4endl;
05024     G4double dM=totMass-GSMass;
05025     G4cout<<"G4QNucl::EvaNuc:"<<qNuc<<",PDG="<<thePDG<<",M="<<totMass<<",dM="<<dM<<G4endl;
05027 #endif
05028     G4int   bsCond =qNuc.SplitBaryon();        // (Bary/Deut/Alph)SeparCond for TotResNucl
05029     G4bool  dbsCond=qNuc.Split2Baryons();      // (Two Baryons)SeparCond for TotResidNucl
05030 #ifdef debug
05031     G4cout<<"G4QNucleus::EvaporateNuc: bs="<<bsCond<<", dbs="<<dbsCond<<", A="<<bA<<G4endl;
05032 #endif
05033     if(fabs(totMass-GSMass)<.003&&!bsCond&&!dbsCond) // GS or can't split 1(2)B FillAsItIs
05034     {
05035 #ifdef debug
05036       G4cout<<"G4QN::EvaNuc: GS direct "<<qH->GetQC()<<qH->Get4Momentum()<<" AsIs"<<G4endl;
05037 #endif
05038       evaHV->push_back(qH);
05039       return;
05040     }
05041     else if ( ( bA == 1 || (!bsCond && !dbsCond) ) && totMass > GSMass+.003 )//=>Fuse&Decay
05042     //else if(2>3)                                // Close "Fuse&Decay Technology"***@@@***
05043     {
05044 #ifdef debug
05045       G4cout<<"G4QN::EvaN:SplitBar, s="<<bsCond<<",M="<<totMass<<" > GSM="<<GSMass<<G4endl;
05046 #endif
05047       G4int nOfOUT = evaHV->size();            // Total#of QHadrons in Vector at this point
05048       G4bool bnfound=true;                     // Cure "back fusion fragment not found"
05049       while(nOfOUT)                            // Try BackFusionDecays till something is in
05050       {
05051         G4QHadron*     theLast = (*evaHV)[nOfOUT-1];
05052         G4int          lastBN = theLast->GetBaryonNumber();
05053         G4int          nFrag  = theLast->GetNFragments();
05055 #ifdef debug
05056         G4cout<<"G4QN::EvaNuc:*BackFus*,BN="<<lastBN<<",nF="<<nFrag<<",n="<<nOfOUT<<G4endl;
05057 #endif
05058         while(nFrag)                       // => "Delete Last Decayed Hadron" case
05059         {
05060           G4QHadron* thePrev = (*evaHV)[nOfOUT-2];
05061           nFrag  = thePrev->GetNFragments();
05062           G4int      prevBN = thePrev->GetBaryonNumber();
05063 #ifdef debug
05064           G4int     prevPDG = thePrev->GetPDGCode();
05065           G4cout<<"G4QNucl::EvaNucl: DelTheLast, nFr="<<nFrag<<", pPDG="<<prevPDG<<G4endl;
05066 #endif
05067           evaHV->pop_back();               // the prev QHadron is excluded from OUTPUT
05068           delete theLast;
05069           theLast = thePrev;               // Update theLastPntr(Prev instead of Last)
05070           lastBN=prevBN;
05071           nOfOUT--;                        // Reduce the stack for the Last decayed hadron
05072         }
05073         if(nOfOUT)
05074         {
05075           if(lastBN<1&&nOfOUT>1)           // Try Once To Skip Mesons/Gammas & Antibaryons
05076           {
05077             G4QHadron* thePrev = (*evaHV)[nOfOUT-2];//***Exchange between Last & Prev***
05078             evaHV->pop_back();             // the last QHadron is excluded from OUTPUT
05079             evaHV->pop_back();             // the prev QHadron is excluded from OUTPUT
05080             evaHV->push_back(theLast);     // the Last becomes the Prev (1st part of exch)
05081             evaHV->push_back(thePrev);     // the Prev becomes the Last (2nd part of exch)
05082             theLast = thePrev;             // Update theLastPointer (Prev instead of Last)
05083           }
05084           G4LorentzVector last4M = theLast->Get4Momentum(); // Selected the last 4-Mom
05085           G4QContent  lastQC = theLast->GetQC();
05086           G4double lastM  = last4M.m();    // Mass of the Probable Last BackFused Fragment
05087           totQC+=lastQC;                   // Update (increase) the total QC (prototype)
05088           q4M+=last4M;                     // Update (increase) the total 4-momentum
05089           totMass=q4M.m();                 // Calculate new real total mass of the fused
05090           G4int totPDG=totQC.GetSPDGCode();// The updated PDG for the TotalResidualNucleus
05091           if(totPDG==10&&totQC.GetBaryonNumber()>0) totPDG=totQC.GetZNSPDGCode();
05092           G4int totBN=totQC.GetBaryonNumber();// BaryonNumber of the Total Residual Nucleus
05093           G4double dM=totMass-GSMass-lastM;
05094 #ifdef debug
05095           G4cout<<"G4QN::EvaNuc: tM="<<totMass<<"-LM="<<lastM<<lastQC<<"-GSM="<<GSMass<<"="
05096                 <<dM<<G4endl;
05097 #endif
05098           if(dM>-0.001)                    // Decay in the qH and the last is impossible
05099           {
05100             G4QHadron* evH = new G4QHadron(totPDG,q4M); // Create QHadron for CompResidNuc
05101             if(dM<=0.)
05102             {
05103               evaHV->pop_back();    // lastQHadron is excluded from QHadrV asIs in TRN
05104               delete theLast; //When kill, DON'T forget to delete lastQHadron asAnInstance!
05105 #ifdef qdebug
05106               if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (16) qH=0"<<G4endl;
05107 #endif
05108               delete qH;
05109 #ifdef debug
05110               G4cout<<"G4QNucleus::EvaporateNucl: EVH "<<totPDG<<q4M<<" fill AsIs"<<G4endl;
05111 #endif
05112               if(totBN==2)DecayDibaryon(evH,evaHV); // Fill dibaryon (with decay products)
05113               else evaHV->push_back(evH);// Fill TRN to HVect asIs (delete equivalent)
05114             }
05115             else                        // Decay TotalResidualNucleus in GSM+Last
05116             {
05117               G4LorentzVector r4Mom(0.,0.,0.,GSMass);
05118               if(!G4QHadron(q4M).DecayIn2(last4M,r4Mom)) // Decay failed
05119               {
05120                 evaHV->pop_back(); // lastQHadron is excluded from QHadrV as is in TRN
05121                 delete theLast; //When kill,DON'T forget to delete lastQHadron asAnInstance
05122 #ifdef qdebug
05123                 if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (17) qH=0"<<G4endl;
05124 #endif
05125                 delete qH;
05126 #ifdef debug
05127                 G4cout<<"***G4QNucleus::EvaNucl: EVH "<<totPDG<<q4M<<" fill AsIs"<<G4endl;
05128 #endif
05129                 evaHV->push_back(evH);// Fill TRN to Vect as it is (delete equivalent)
05130 #ifdef debug
05131                 G4cout<<"***G4QN::EvaN:DecayIn L"<<lastQC<<"+RN"<<totQC<<" failed"<<G4endl;
05132 #endif
05133               }
05134               else                        // Decay in GSM+theLast succeeded
05135               {
05136                 delete evH;
05137 #ifdef qdebug
05138                 if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (18) qH=0"<<G4endl;
05139 #endif
05140                 delete qH;
05141                 theLast->Set4Momentum(last4M);// Already exists:don't create&fill,->set4Mom
05142                 G4QHadron* nucH = new G4QHadron(thePDG,r4Mom); // Create QHadron for qH-nuc
05143 #ifdef debug
05144                 G4cout<<"G4QNucleus::EvaNuc:fill NH "<<totPDG<<r4Mom<<G4endl;
05145 #endif
05146                 // @@ What about others, not DB possibilities?
05147                 if(thePDG==92000000||thePDG==90002000||thePDG==90000002)
05148                                                 DecayDibaryon(nucH,evaHV);//DekayDibarions
05149                 else evaHV->push_back(nucH);// Fill the Residual Nucleus (del.eq.)
05150               }
05151             }
05152             bnfound=false;
05153             break;
05154           }
05155           thePDG=totPDG;                   // Make ResidualNucleus outOf theTotResidualNucl
05156           GSMass=G4QPDGCode(thePDG).GetMass();// Update the Total Residual Nucleus mass
05157           evaHV->pop_back();               // the last QHadron is excluded from OUTPUT
05158           delete theLast;
05159           nOfOUT--;                        // Update the value of OUTPUT entries
05160         }
05161       }
05162       if(bnfound)
05163       {
05164         G4LorentzVector h4Mom(0.,0.,0.,GSMass);//GSMass must be updated inPreviousWhileLOOP
05165         G4LorentzVector g4Mom(0.,0.,0.,0.);
05166         if(!G4QHadron(q4M).DecayIn2(h4Mom, g4Mom))
05167         {
05168 #ifdef qdebug
05169           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (19) qH=0"<<G4endl;
05170 #endif
05171           delete qH;
05172           // G4cerr<<"**G4QN::EvaNuc:h="<<thePDG<<"(GSM="<<GSMass<<")+g>tM="<<totMass<<G4endl;
05173           // throw G4QException("G4QNucleus::EvaporateNucleus: Decay in Gamma failed");
05174           G4ExceptionDescription ed;
05175           ed << " Decay in Gamma failed: h=" << thePDG << "(GSM=" << GSMass
05176              << ")+g>tM=" << totMass << G4endl;
05177           G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0017",
05178                       FatalException, ed);
05179         }
05180 #ifdef debug
05181         G4cout<<"G4QNuc::EvaNuc: "<<q4M<<"->totResN="<<thePDG<<h4Mom<<"+g="<<g4Mom<<G4endl;
05182 #endif
05183         G4QHadron* curH = new G4QHadron(thePDG,h4Mom);
05184 #ifdef debug
05185         G4cout<<"G4QNucleus::EvaporateNucleus: Fill a Fragment="<<thePDG<<h4Mom<<G4endl;
05186 #endif
05187         if(thePDG==92000000||thePDG==90002000||thePDG==90000002) DecayDibaryon(curH,evaHV);
05188         else evaHV->push_back(curH);  // Fill the TotalResidualNucleus (del.equiv.)
05189         G4QHadron* curG = new G4QHadron(22,g4Mom);
05190 #ifdef debug
05191         G4cout<<"G4QNucleus::EvaporateNucleus: Fill  a Gamma="<<g4Mom<<G4endl;
05192 #endif
05193         evaHV->push_back(curG);       // Fill the gamma (delete equivalent)
05194 #ifdef qdebug
05195         if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (20) qH=0"<<G4endl;
05196 #endif
05197         delete qH;
05198       }
05199     }
05200     else if(bA>0&&bS<0) DecayAntiStrange(qH,evaHV);// Decay nucleus with antistrangeness
05201     else if(bA==2) DecayDibaryon(qH,evaHV); // Decay the residual dibaryon (del.equivalent)
05202     else if(bA==-2) DecayAntiDibaryon(qH,evaHV);   // Decay residual anti-dibaryon (del.eq)
05203     else if(totMass<GSMass+.003&&(bsCond||dbsCond))//==>" M<GSM but decay is possible" case
05204     {
05205 #ifdef pdebug
05206       G4cout<<"G4QN::EvN:2B="<<dbsCond<<",B="<<bsCond<<",M="<<totMass<<"<"<<GSMass<<G4endl;
05207 #endif
05208       //G4double gResM  =1000000.;           // Prototype of mass of residual for a gamma
05209       G4int    gResPDG=0;                  // Prototype of residualPDGCode for a gamma
05210       if(bN==4&&bZ==2&&!bS)                // It's He6 nucleus
05211       {
05212         gResPDG= thePDG;                   // PDG of the Residual Nucleus
05213         //gResM  = mHel6;                    // min mass of the Residual Nucleus
05214       }
05215       G4double nResM  =1000000.;           // Prototype of mass of residual for a neutron
05216       G4int    nResPDG=0;                  // Prototype of ResidualPDGCode for a neutron
05217       if(bsCond==2112&&bN>0&&bA>1)         // There's aNeutr in theNucl, which can be split
05218       {
05219         G4QContent resQC=totQC-neutQC;
05220         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05221         nResPDG=resN.GetPDG();             // PDG of the Residual Nucleus
05222         if     (nResPDG==90000001) nResM=mNeut;
05223         else if(nResPDG==90001000) nResM=mProt;
05224         else if(nResPDG==91000000) nResM=mLamb;
05225         else nResM=resN.GetMZNS();         // min mass of the Residual Nucleus
05226       }
05227       G4double pResM  =1000000.;           // Prototype of mass of residual for a proton
05228       G4int    pResPDG=0;                  // Prototype of PDGCode of residual for a proton
05229       if(bsCond==2212&&bZ>0&&bA>1)         // There's aProton in Nucl, which can be split
05230       {
05231         G4QContent resQC=totQC-protQC;
05232         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05233         pResPDG=resN.GetPDG();             // PDG of the Residual Nucleus
05234         if     (pResPDG==90000001) pResM=mNeut;
05235         else if(pResPDG==90001000) pResM=mProt;
05236         else if(pResPDG==91000000) pResM=mLamb;
05237         else pResM  =resN.GetMZNS();       // min mass of the Residual Nucleus
05238       }
05239       G4double lResM  =1000000.;           // Prototype of mass of residual for a Lambda
05240       G4int    lResPDG=0;                  // Prototype of PDGCode of residual for a Lambda
05241       if(bsCond==3122&&bS>0&&bA>1)         // There's aLambd in theNucl, which can be split
05242       {
05243         G4QContent resQC=totQC-lambQC;
05244         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05245         lResPDG=resN.GetPDG();             // PDG of the Residual Nucleus
05246         if     (lResPDG==90000001) lResM=mNeut;
05247         else if(lResPDG==90001000) lResM=mProt;
05248         else if(lResPDG==91000000) lResM=mLamb;
05249         else lResM  =resN.GetMZNS();       // min mass of the Residual Nucleus
05250       }
05251       G4double dResM  =1000000.;           // Prototype of mass of residual for a Alpha
05252       G4int    dResPDG=0;                  // Prototype of PDGCode of residual for a Alpha
05253       if(bsCond==90001001&&bN>0&&bZ>0&&bA>2)// There's aDeuter in Nucl, which canBeRadiated
05254       {
05255         G4QContent resQC=totQC-deutQC;
05256         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05257         dResPDG=resN.GetPDG();             // PDG of the Residual Nucleus
05258         if     (dResPDG==90000001) dResM=mNeut;
05259         else if(dResPDG==90001000) dResM=mProt;
05260         else if(dResPDG==91000000) dResM=mLamb;
05261         else dResM  =resN.GetMZNS();       // minMass of the Residual Nucleus
05262       }
05263       G4double aResM  =1000000.;           // Prototype of mass of residual for a Alpha
05264       G4int    aResPDG=0;                  // Prototype of PDGCode of residual for a Alpha
05265       if(bsCond==90002002&&bN>1&&bZ>1&&bA>4)// There's Alpha in theNucl, which can be split
05266       {
05267         G4QContent resQC=totQC-alphQC;
05268         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05269         aResPDG=resN.GetPDG();             // PDG of the Residual Nucleus
05270         if     (aResPDG==90000001) aResM=mNeut;
05271         else if(aResPDG==90001000) aResM=mProt;
05272         else if(aResPDG==91000000) aResM=mLamb;
05273         else aResM  =resN.GetMZNS();       // minMass of the Residual Nucleus
05274       }
05275       G4double nnResM  =1000000.;          // Prototype of mass of residual for a dineutron
05276       G4int    nnResPDG=0;                 // Prototype of ResidualPDGCode for a dineutron
05277       if(dbsCond&&bN>1&&bA>2)              // It's nucleus and there is a dineutron
05278       {
05279         G4QContent resQC=totQC-neutQC-neutQC;
05280         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05281         nnResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05282         if     (nnResPDG==90000001) nnResM=mNeut;
05283         else if(nnResPDG==90001000) nnResM=mProt;
05284         else if(nnResPDG==91000000) nnResM=mLamb;
05285         else nnResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
05286       }
05287       G4double ppResM  =1000000.;          // Prototype of mass of residual for a diproton
05288       G4int    ppResPDG=0;                 // Prototype of ResidualPDGCode for a diproton
05289       if(dbsCond&&bZ>1&&bA>2)              // It's nucleus and there is a diproton
05290       {
05291         G4QContent resQC=totQC-protQC-protQC;
05292         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05293         ppResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05294         if     (ppResPDG==90000001) ppResM=mNeut;
05295         else if(ppResPDG==90001000) ppResM=mProt;
05296         else if(ppResPDG==91000000) ppResM=mLamb;
05297         else ppResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
05298       }
05299       G4double npResM  =1000000.;          // Prototype of ResidualMass for proton+neutron
05300       G4int    npResPDG=0;                 // Prototype of ResidualPDGCode for a prot+neut
05301       if(dbsCond&&bN>0&&bZ>0&&bA>2)        // It's nucleus and there is aProton & aNeutron
05302       {
05303         G4QContent resQC=totQC-neutQC-protQC;
05304         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05305         npResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05306         if     (npResPDG==90000001) npResM=mNeut;
05307         else if(npResPDG==90001000) npResM=mProt;
05308         else if(npResPDG==91000000) npResM=mLamb;
05309         else npResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
05310       }
05311       G4double lnResM  =1000000.;          // Prototype of residualMass for lambda+neutron
05312       G4int    lnResPDG=0;                 // Prototype of ResidualPDGCode for aLambda+Neut
05313       if(dbsCond&&bN>0&&bS>0&&bA>2)        // It's nucleus and there is aLambda & aNeutron
05314       {
05315         G4QContent resQC=totQC-lambQC-protQC;
05316         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05317         lnResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05318         if     (lnResPDG==90000001) lnResM=mNeut;
05319         else if(lnResPDG==90001000) lnResM=mProt;
05320         else if(lnResPDG==91000000) lnResM=mLamb;
05321         else lnResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
05322       }
05323       G4double lpResM  =1000000.;          // Prototype of residualMass for a proton+lambda
05324       G4int    lpResPDG=0;                 // Prototype of ResidualPDGCode for theProt+lamb
05325       if(dbsCond&&bS>0&&bZ>0&&bA>2)        // It's nucleus and there is aProton and aLambda
05326       {
05327         G4QContent resQC=totQC-neutQC-protQC;
05328         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05329         lpResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05330         if     (lpResPDG==90000001) lpResM=mNeut;
05331         else if(lpResPDG==90001000) lpResM=mProt;
05332         else if(lpResPDG==91000000) lpResM=mLamb;
05333         else lpResM  =resN.GetMZNS();      // minMass of the Residual Nucleus
05334       }
05335       G4double llResM  =1000000.;          // Prototype of mass of residual for a di-lambda
05336       G4int    llResPDG=0;                 // Prototype of ResidPDGCode for the di-lambda
05337       if(dbsCond&&bS>1&&bA>2)              // It's nucleus and there is a di-lambda
05338       {
05339         G4QContent resQC=totQC-neutQC-protQC;
05340         G4QNucleus resN(resQC);            // Pseudo nucleus for the Residual Nucleus
05341         llResPDG=resN.GetPDG();            // PDG of the Residual Nucleus
05342         if     (llResPDG==90000001) llResM=mNeut;
05343         else if(llResPDG==90001000) llResM=mProt;
05344         else if(llResPDG==91000000) llResM=mLamb;
05345         else llResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
05346       }
05347 #ifdef debug
05348       G4cout<<"G4QNucleus::EvaNucl: rP="<<pResPDG<<",rN="<<nResPDG<<",rL="<<lResPDG<<",N="
05349             <<bN<<",Z="<<bZ<<",nL="<<bS<<",totM="<<totMass<<",n="<<totMass-nResM-mNeut
05350             <<",p="<<totMass-pResM-mProt<<",l="<<totMass-lResM-mLamb<<G4endl;
05351 #endif
05352       if ( thePDG == 90004004                                                 || 
05353           (thePDG == 90002004 && totMass > mHel6+.003)                        ||
05354           (bA > 4 && bsCond && bN > 1 && bZ > 1 && totMass > aResM+mAlph)     ||
05355           (bA > 1 && bsCond && ( (bN > 0 && totMass > nResM+mNeut) || 
05356                                  (bZ > 0 && totMass > pResM+mProt) || 
05357                                  (bS > 0 && totMass > lResM+mLamb) ) )        ||
05358           (bA > 2 && 
05359            (( bN > 0 && bZ > 0 && 
05360               ( (bsCond && totMass > dResM+mDeut) || (dbsCond && totMass > dResM+mDeut) )
05361             ) || ( dbsCond && ( (bN > 1   && totMass > nnResM+mNeut+mNeut) ||
05362                                 (bZ > 1   && totMass > ppResM+mProt+mProt) ||
05363                                 (bS > 1   && totMass > llResM+mLamb+mLamb) ||
05364                                 (bN && bS && totMass > lnResM+mLamb+mNeut) ||
05365                                 (bZ && bS && totMass > lpResM+mLamb+mProt)
05366                               )
05367                  )
05368            )
05369           )
05370          )
05371       {
05372         G4int barPDG = 90002002;           // Just for the default case of Be8->alpha+alpha
05373         G4int resPDG = 90002002;
05374         G4int thdPDG = 0;
05375         G4double barM= mAlph;
05376         G4double resM= mAlph;
05377         G4double thdM= mNeut;              // This default value is used in the IF
05378         G4double tMC=totMass+.0002;
05379         if(gResPDG&&tMC>mHel6+.003)        // Can make radiative decay of He6 (priority 0)
05380         {
05381           barPDG=90002004;
05382           resPDG=22;
05383           barM  =mHel6;
05384           resM  =0.;
05385         }
05386         else if(nResPDG&&tMC>nResM+mNeut)  // Can radiate a neutron (priority 1)
05387         {
05388           barPDG=90000001;
05389           resPDG=nResPDG;
05390           barM  =mNeut;
05391           resM  =nResM;
05392         }
05393         else if(pResPDG&&totMass+.001>pResM+mProt)   // Can radiate a proton (priority 2)
05394         {
05395           barPDG=90001000;
05396           resPDG=pResPDG;
05397           barM  =mProt;
05398           resM  =pResM;
05399         }
05400         else if(lResPDG&&tMC>lResM+mLamb)  // Can radiate a Lambda (priority 3) @@ Sigma0
05401         {
05402           barPDG=91000000;
05403           resPDG=lResPDG;
05404           barM  =mLamb;
05405           resM  =lResM;
05406         }
05407         else if(thePDG!=90004004&&bN>1&&bZ>1&&bA>4&&tMC>aResM+mAlph)// Decay in alpha (p4)
05408         {
05409           barPDG=90002002;
05410           resPDG=aResPDG;
05411           barM  =mAlph;
05412           resM  =aResM;
05413         }
05414         else if(dResPDG&&tMC>dResM+mDeut)  // Can radiate a Deuteron (priority 5)
05415         {
05416           barPDG=90001001;
05417           resPDG=dResPDG;
05418           barM  =mDeut;
05419           resM  =dResM;
05420         }
05421         else if(ppResPDG&&tMC>ppResM+mProt+mProt)// Can radiate a DiProton (priority 6)
05422         {
05423           barPDG=90001000;
05424           resPDG=ppResPDG;
05425           thdPDG=90001000;
05426           barM  =mProt;
05427           resM  =ppResM;
05428           thdM  =mProt;
05429         }
05430         else if(nnResPDG&&tMC>nnResM+mNeut+mNeut)// Can radiate a DiNeutron (priority 7)
05431         {
05432           barPDG=90000001;
05433           resPDG=nnResPDG;
05434           thdPDG=90000001;
05435           barM  =mNeut;
05436           resM  =nnResM;
05437         }
05438         else if(npResPDG&&tMC>npResM+mProt+mNeut)// Can radiate a neutron+proton (prior 8)
05439         {
05440           barPDG=90001000;
05441           resPDG=npResPDG;
05442           thdPDG=90000001;
05443           barM  =mProt;
05444           resM  =npResM;
05445         }
05446         else if(lnResPDG&&tMC>lnResM+mLamb+mNeut)// Can radiate a Lambda+neutron (prior 9)
05447         {
05448           barPDG=91000000; // @@ Sigma0
05449           resPDG=lnResPDG;
05450           thdPDG=90000001;
05451           barM  =mLamb;
05452           resM  =lnResM;
05453         }
05454         else if(lpResPDG&&tMC>lpResM+mLamb+mProt)// Can radiate a Lambda+proton (prior 10)
05455         {
05456           barPDG=91000000; // @@ Sigma0
05457           resPDG=lpResPDG;
05458           thdPDG=90001000;
05459           barM  =mLamb;
05460           resM  =lpResM;
05461           thdM  =mProt;
05462         }
05463         else if(llResPDG&&tMC>llResM+mLamb+mLamb)// Can radiate a DiLambda (priority 11)
05464         {
05465           barPDG=91000000; // @@ Sigma0
05466           resPDG=llResPDG;
05467           thdPDG=91000000; // @@ Sigma0
05468           barM  =mLamb;
05469           resM  =llResM;
05470           thdM  =mLamb;
05471         }
05472         else if(thePDG!=90004004&&tMC>GSMass)// If it's not Be8 decay in gamma & GSM
05473         {
05474           barPDG=thePDG;
05475           resPDG=22;
05476           barM  =GSMass;
05477           resM  =0.;
05478         }
05479         else if(thePDG!=90004004)
05480         {
05481           // G4cerr<<"***G4QNuc::EvaN:PDG="<<thePDG<<",M="<<totMass<<"< GSM="<<GSMass<<G4endl;
05482           // throw G4QException("G4QNucleus::EvaporateNucleus: M<GSM & can't decayInPNL");
05483           G4ExceptionDescription ed;
05484           ed << "M<GSM & can't decayInPNL: PDG=" << thePDG << ",M=" << totMass
05485              << "< GSM=" << GSMass << G4endl;
05486           G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0018",
05487                       FatalException, ed);
05488         }
05489         G4LorentzVector a4Mom(0.,0.,0.,barM);
05490         G4LorentzVector b4Mom(0.,0.,0.,resM);
05491         if(!thdPDG)
05492         {
05493           if(!qH->DecayIn2(a4Mom,b4Mom))
05494           {
05495             evaHV->push_back(qH);     // Fill as it is (delete equivalent)
05496             G4cout<<"---Warning---G4QNucleus::EvaNuc:rP="<<pResPDG<<",rN="<<nResPDG<<",rL="
05497                   <<lResPDG<<",N="<<bN<<",Z="<<bZ<<",L="<<bS<<",totM="<<totMass<<",n="
05498                   <<totMass-nResM-mNeut<<",p="<<totMass-pResM-mProt<<",l="
05499                   <<totMass-lResM-mLamb<<G4endl;
05500             G4cout<<"---Warning---G4QN::EvN:DecIn2Error b="<<barPDG<<",r="<<resPDG<<G4endl;
05501             return;
05502           }
05503           else
05504           {
05505 #ifdef qdebug
05506             if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (21) qH=0"<<G4endl;
05507 #endif
05508             delete qH;
05509             G4QHadron* HadrB = new G4QHadron(barPDG,a4Mom);
05510 #ifdef debug
05511             G4cout<<"G4QNucleus::EvaNucleus:(1) Baryon="<<barPDG<<a4Mom<<G4endl;
05512 #endif
05513             evaHV->push_back(HadrB);       // Fill the baryon (delete equivalent)
05514             G4QHadron* HadrR = new G4QHadron(resPDG,b4Mom);
05515 #ifdef debug
05516             G4cout<<"G4QNucleus::EvaNucleus:(1) Residual="<<resPDG<<b4Mom<<G4endl;
05517 #endif
05518             // @@ Self-call !!
05519             if(HadrR->GetBaryonNumber()>1) EvaporateNucleus(HadrR,evaHV);//ContinueDecay
05520             else evaHV->push_back(HadrR);  // Fill ResidNucl=Baryon to OutHadronVector
05521           }
05522         }
05523         else
05524         {
05525           G4LorentzVector c4Mom(0.,0.,0.,thdM);
05526           if(!qH->DecayIn3(a4Mom,b4Mom,c4Mom))
05527           {
05528             evaHV->push_back(qH);    // Fill as it is (delete equivalent)
05529             G4cout<<"---Warning---G4QN::EvN:rNN="<<nnResPDG<<",rNP="<<npResPDG<<",rPP="
05530                   <<ppResPDG<<",N="<<bN<<",Z="<<bZ<<",L="<<bS<<",tM="<<totMass<<",nn="
05531                   <<totMass-nnResM-mNeut-mNeut<<",np="<<totMass-npResM-mProt-mNeut<<",pp="
05532                   <<totMass-ppResM-mProt-mProt<<G4endl;
05533             G4cout<<"---Warning---G4QN::EvN:DecIn2Error,b="<<barPDG<<",r="<<resPDG<<G4endl;
05534             return;
05535           }
05536           else
05537           {
05538 #ifdef qdebug
05539             if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (22) qH=0"<<G4endl;
05540 #endif
05541             delete qH;
05542             G4QHadron* HadrB = new G4QHadron(barPDG,a4Mom);
05543 #ifdef debug
05544             G4cout<<"G4QNucleus::EvaporateNucleus:(2) Baryon1="<<barPDG<<a4Mom<<G4endl;
05545 #endif
05546             evaHV->push_back(HadrB);       // Fill the first baryon (del.equiv.)
05547             G4QHadron* HadrC = new G4QHadron(thdPDG,c4Mom);
05548 #ifdef debug
05549             G4cout<<"G4QNucleus::EvaporateNucleus:(2) Baryon2="<<thdPDG<<c4Mom<<G4endl;
05550 #endif
05551             evaHV->push_back(HadrC);       // Fill the second baryon (del.equiv.)
05552             G4QHadron* HadrR = new G4QHadron(resPDG,b4Mom);
05553 #ifdef debug
05554             G4cout<<"G4QNucleus::EvaporateNucleus:(2) Residual="<<resPDG<<b4Mom<<G4endl;
05555 #endif
05556             // @@ Self-call !!
05557             if(HadrR->GetBaryonNumber()>1) EvaporateNucleus(HadrR,evaHV); // Continue decay
05558             else evaHV->push_back(HadrR); // Fill ResidNucl=Baryon to OutputHadrVector
05559           }
05560         }
05561       }
05562       else if (fabs(totMass-GSMass)<.003) // @@ Looks like a duplication of the prev. check
05563       {
05564 #ifdef debug
05565         G4cout<<"*|*|*|*G4QNucleus::EvaporateNuc: fill AsIs. Should never be here"<<G4endl;
05566 #endif
05567         evaHV->push_back(qH);  // FillAsItIs (del.eq.)
05568         return;
05569       }
05570       else                             // "System is below mass shell and can't decay" case
05571       {
05572 #ifdef debug
05573         G4cout<<"***G4QNucl::EvaNuc: tM="<<totMass<<"("<<thePDG<<") < GSM="<<GSMass<<", d="
05574               <<totMass-GSMass<<", QC="<<qH->GetQC()<<qH->Get4Momentum()<<"*AsIs*"<<G4endl;
05575 #endif
05576         evaHV->push_back(qH);                   // Correct or fill as it is
05577         return;
05578       }
05579     }
05580     else                                        // ===> Evaporation of the excited system
05581     {
05582 #ifdef pdebug
05583       G4cout<<"G4QN::EvaNuc:***EVA***tPDG="<<thePDG<<",M="<<totMass<<">GSM="<<GSMass<<",d="
05584             <<totMass-GSMass<<", N="<<qNuc.Get4Momentum()<<qNuc.Get4Momentum().m()<<G4endl;
05585 #endif
05586       G4LorentzVector b4M;
05587       G4LorentzVector r4M;
05588       G4bool evC=true;                  // @@ It makes only one attempt to be possible
05589       G4int bPDG=0;
05590       G4int rPDG=0;
05591       //G4double bM = 0.;               // Prototype of Real Mass of the EvaporatedDibaryon
05592       G4double rM = 0.;                 // Prototype of Real Mass of the residual nucleus
05593       G4int bB=0;                       // Proto of Baryon Number of the evaporated baryon
05594       G4int rB=0;                       // Proto of Baryon Number of the residual nucleus
05595       G4QHadron* bHadron = new G4QHadron;// Proto of the evaporated baryon @@where deleted?
05596       G4QHadron* rHadron = new G4QHadron;// Proto of the residual nucleus @@where deleted?
05597       G4int evcn=0;
05598       //G4int evcm=27;
05599       G4int evcm=9;                     // Max numder of attempts to evaporate
05600       // @@ Does not look like it can make two attempts @@ Improve, Simplify @@
05601       while(evC&&evcn<evcm)
05602       {
05603         evC=true;
05604         evcn++;
05605         if(!qNuc.EvaporateBaryon(bHadron,rHadron)) // Evaporation did not succeed
05606         {
05607 #ifdef debug
05608           G4cout<<"***G4QNuc::EvaNuc:***EVA Failed***PDG="<<thePDG<<",M="<<totMass<<G4endl;
05609 #endif
05610           delete bHadron;
05611           delete rHadron;
05612 #ifdef debug
05613           G4cout<<"***G4QNucl::EvaNuc: Residual="<<qH->GetQC()<<qH->Get4Momentum()<<G4endl;
05614 #endif
05615           evaHV->push_back(qH);               // fill AsItIs
05616           return;
05617         }
05618         evC=false;
05619         b4M=bHadron->Get4Momentum();
05620         r4M=rHadron->Get4Momentum();
05621         //bM   = b4M.m();                       // Real mass of the evaporated dibaryon
05622         rM   = r4M.m();                       // Real mass of the residual nucleus
05623         bB=bHadron->GetBaryonNumber();        // Baryon number of the evaporated baryon
05624         rB=rHadron->GetBaryonNumber();        // Baryon number of the residual nucleus
05625         bPDG=bHadron->GetPDGCode();
05626         rPDG=rHadron->GetPDGCode();
05627 #ifdef debug
05628         G4int bC=bHadron->GetCharge();        // Baryon number of the evaporated baryon
05629         //G4int rC=rHadron->GetCharge();       // Baryon number of the residual nucleus
05630         G4double bCB=qNuc.CoulombBarrier(bC,bB);
05631         //G4double rCB=qNuc.CoulombBarrier(rC,rB);
05632         G4cout<<"G4QNucl::EvaNuc:Attempt #"<<evcn<<" > "<<evcm<<", rPDG="<<rPDG<<", bPDG="
05633               <<bPDG<<", bE="<<b4M.e()-b4M.m()<<" > bCB="<<bCB<<G4endl;
05634 #endif
05635         //if(b4M.e()-b4M.m()<bCB&&evcn<evcm) evC=true;
05636       }  // End of while
05637 #ifdef debug
05638       G4cout<<"G4QNucl::EvaNuc:*** EVA IS DONE *** F="<<bPDG<<b4M<<",bB="<<bB<<", ResNuc="
05639             <<rPDG<<r4M<<",rB="<<rB<<G4endl;
05640 #endif
05641 #ifdef qdebug
05642       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (23) qH=0"<<G4endl;
05643 #endif
05644       delete qH;
05645       if(bB<2) evaHV->push_back(bHadron);         // Fill EvaporatedBaryon (del.equivalent)
05646       else if(bB==2) DecayDibaryon(bHadron,evaHV);// => "Dibaryon" case needs decay
05647       else if(bB==4) evaHV->push_back(bHadron);   // "Alpha radiation" case (del.eq.)
05648       else if(bB==5) DecayAlphaBar(bHadron,evaHV);// "Alpha+Baryon Decay" case (del.equiv.)
05649       else if(bPDG==90004002) DecayAlphaDiN(bHadron,evaHV); // alph+2p(alph+2n is stable)
05650       else if(bPDG==90004004) DecayAlphaAlpha(bHadron,evaHV);// Alph+Alph Decay (del.eq.)
05651       else
05652       {
05653         delete bHadron;
05654         // G4cerr<<"***G4QNuc::EvaNuc:bB="<<bB<<">2 - unexpected evaporated fragment"<<G4endl;
05655         // throw G4QException("G4QNucleus::EvaporateNucleus: Wrong evaporation act");
05656         G4ExceptionDescription ed;
05657         ed << "Wrong evaporation act: EvaNuc:bB=" << bB
05658            << ">2 - unexpected evaporated fragment" << G4endl;
05659         G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0019",
05660                     FatalException, ed);
05661       }
05662       if(rB>2) EvaporateNucleus(rHadron,evaHV);    // Continue evaporation (@@ Self-call)
05663       else if(rB==2)                   // => "Dibaryon" case needs decay @@ DecayDibaryon
05664       {
05665         G4double rGSM = rHadron->GetQPDG().GetMass(); // Ground State mass of the dibaryon
05666 #ifdef debug
05667         G4cout<<"G4QNuc::EvaNuc:ResidDibM="<<rM<<",GSM="<<rGSM<<",M-GSM="<<rM-rGSM<<G4endl;
05668 #endif
05669         if(rM<=rGSM-0.01)
05670         {
05671           delete rHadron;
05672           // G4cerr<<"***G4QNucleus::EvaporNucl: <residual> M="<<rM<<" < GSM="<<rGSM<<G4endl;
05673           // throw G4QException("G4QNucleus::EvaporateNucleus: Evaporation below MassShell");
05674           G4ExceptionDescription ed;
05675           ed << "Evaporation below MassShell: <residual> M=" << rM << " < GSM="
05676              << rGSM << G4endl;
05677           G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0020",
05678                       FatalException, ed);
05679         }
05680         else if(fabs(rM-rGSM)<0.01&&rPDG==90001001) evaHV->push_back(rHadron); // (DE)
05681         else DecayDibaryon(rHadron,evaHV);   // => "Dibaryon Decay" case (del.equivalent)
05682       }
05683       else if(rB==5) DecayAlphaBar(rHadron,evaHV);// "Alpha+Baryon Decay" case (del.equiv.)
05684       else if(rPDG==90004002) DecayAlphaDiN(rHadron,evaHV);//alph+2p (alph+2n is stable)
05685       else if(rPDG==90004004) DecayAlphaAlpha(rHadron,evaHV);//Alpha+Alpha Decay (delEq)
05686       else evaHV->push_back(rHadron);        // Fill ResidNucl=Baryon to OutputHadronVector
05687     } // End of Evaporation of excited system
05688 #ifdef debug
05689     G4cout<<"G4QNucleus::EvaporateNucleus: === End of the evaporation attempt"<<G4endl;
05690 #endif
05691   }
05692   else                                          // => "Decay if impossible evaporate" case
05693   {
05694 #ifdef debug
05695     G4cout<<"*G4QNucleus::EvaporateNucleus: InputHadron4M="<<q4M<<", PDG="<<thePDG<<G4endl;
05696 #endif
05697     if(thePDG)
05698     {
05699       if(thePDG==10)                            // "Chipolino decay" case 
05700       {
05701         G4QContent totQC = qH->GetQC();         // Quark content of the hadron
05702         G4QChipolino resChip(totQC);            // define the Residual as a Chipolino
05703         G4QPDGCode h1=resChip.GetQPDG1();
05704         G4double m1  =h1.GetMass();             // Mass of the first hadron
05705         G4QPDGCode h2=resChip.GetQPDG2();
05706         G4double m2_value  =h2.GetMass();       // Mass of the second hadron
05707         if(totMass+.0001>m1+m2_value)
05708         {
05709 #ifdef qdebug
05710           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (24) qH=0"<<G4endl;
05711 #endif
05712           delete qH;                            // Chipolino should not be in a sequence
05713           G4LorentzVector fq4M(0.,0.,0.,m1);
05714           G4LorentzVector qe4M(0.,0.,0.,m2_value);
05715           if(!G4QHadron(q4M).DecayIn2(fq4M,qe4M))
05716           {
05717             // G4cerr<<"***G4QNuc::EvaNuc:tM="<<totMass<<"-> h1M="<<m1<<" + h2M="<<m2_value<<G4endl;
05718             // throw G4QException("G4QNucleus::EvaporateNucleus: Chipol->h1+h2 DecIn2 error");
05719             G4ExceptionDescription ed;
05720             ed << "Chipol->h1+h2 DecIn2 error: tM=" << totMass << "-> h1M="
05721                << m1 <<" + h2M=" << m2_value << G4endl;
05722             G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0021",
05723                         FatalException, ed);
05724           }
05725           G4QHadron* H2 = new G4QHadron(h2.GetPDGCode(),qe4M);
05726 #ifdef debug
05727           G4cout<<"G4QNucleus::EvaporateNucleus:(2) h2="<<h2.GetPDGCode()<<qe4M<<G4endl;
05728 #endif
05729           evaHV->push_back(H2);            // (delete equivalent)
05730           G4QHadron* H1 = new G4QHadron(h1.GetPDGCode(),fq4M);
05731 #ifdef debug
05732           G4cout<<"G4QNucleus::EvaporateNucleus:(2) h1="<<h1.GetPDGCode()<<fq4M<<G4endl;
05733 #endif
05734           evaHV->push_back(H1);            // (delete equivalent)
05735         }
05736         else
05737         {
05738 #ifdef qdebug
05739           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (25) qH=0"<<G4endl;
05740 #endif
05741           delete qH;
05742           // G4cerr<<"**G4QN::EN:M="<<totMass<<"<"<<m1<<"+"<<m2_value<<",d="<<m1+m2_value-totMass<<G4endl;
05743           // throw G4QException("G4QNucleus::EvaporateNucleus: Chipolino is under MassShell");
05744           G4ExceptionDescription ed;
05745           ed << "Chipolino is under MassShell: M=" << totMass << "<" << m1
05746              << "+" << m2_value << ",d=" << m1+m2_value-totMass << G4endl;
05747           G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0022",
05748                       FatalException, ed);
05749         }
05750       }
05751       else                                      // "Hadron" case
05752       {
05753         G4double totM=G4QPDGCode(thePDG).GetMass();
05754         if(fabs(totMass-totM)<0.001||abs(thePDG)-10*(abs(thePDG)/10)>2)
05755         {
05756 #ifdef debug
05757           G4cout<<"**G4QNuc::EvaNuc:EmerFill(2) "<<qH->GetQC()<<qH->Get4Momentum()<<G4endl;
05758 #endif
05759           evaHV->push_back(qH);
05760         }
05761         else if ((thePDG==221||thePDG==331)&&totMass>mPi+mPi) // "Decay in pipi" case
05762         {
05763 #ifdef qdebug
05764           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (26) qH=0"<<G4endl;
05765 #endif
05766           delete qH;
05767           G4LorentzVector fq4M(0.,0.,0.,mPi);
05768           G4LorentzVector qe4M(0.,0.,0.,mPi);
05769           if(!G4QHadron(q4M).DecayIn2(fq4M,qe4M))
05770           {
05771             // G4cerr<<"***G4QNucleus::EvaporateNucleus:tM="<<totMass<<"-> pi+ + pi-"<<G4endl;
05772             // throw G4QException("G4QNucleus::EvaporateNucleus: H->Pi+Pi DecayIn2 error");
05773             G4ExceptionDescription ed;
05774             ed << "H->Pi+Pi DecayIn2 error: tM=" << totMass << "-> pi+ + pi-"
05775                << G4endl;
05776             G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0023",
05777                         FatalException, ed);
05778           }
05779           G4QHadron* H1 = new G4QHadron(211,fq4M);
05780 #ifdef debug
05781           G4cout<<"G4QNucleus::EvaporateNucleus:(3) PiPlus="<<fq4M<<G4endl;
05782 #endif
05783           evaHV->push_back(H1);            // (delete equivalent)
05784           G4QHadron* H2 = new G4QHadron(-211,qe4M);
05785 #ifdef debug
05786           G4cout<<"G4QNucleus::EvaporateNucleus:(3) PiMinus="<<qe4M<<G4endl;
05787 #endif
05788           evaHV->push_back(H2);            // (delete equivalent)
05789         }
05790         else if ((thePDG==221||thePDG==331)&&totMass>mPi0+mPi0) // "Decay in 2pi0" case
05791         {
05792 #ifdef qdebug
05793           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (27) qH=0"<<G4endl;
05794 #endif
05795           delete qH;
05796           G4LorentzVector fq4M(0.,0.,0.,mPi0);
05797           G4LorentzVector qe4M(0.,0.,0.,mPi0);
05798           if(!G4QHadron(q4M).DecayIn2(fq4M,qe4M))
05799           {
05800             // G4cerr<<"***G4QNucleus::EvaporateNucleus:tM="<<totMass<<"-> pi0 + pi0"<<G4endl;
05801             // throw G4QException("G4QNucleus::EvaporateNucleus: H->Pi+Pi DecayIn2 error");
05802             G4ExceptionDescription ed;
05803             ed << "H->Pi+Pi DecayIn2 error: tM=" << totMass << "-> pi0 + pi0"
05804                << G4endl;
05805             G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0024",
05806                         FatalException, ed);
05807           }
05808           G4QHadron* H1 = new G4QHadron(111,fq4M);
05809 #ifdef debug
05810           G4cout<<"G4QNucleus::EvaporateNucleus:(4) Pi01="<<fq4M<<G4endl;
05811 #endif
05812           evaHV->push_back(H1);            // (delete equivalent)
05813           G4QHadron* H2 = new G4QHadron(111,qe4M);
05814 #ifdef debug
05815           G4cout<<"G4QNucleus::EvaporateNucleus:(4) Pi02="<<qe4M<<G4endl;
05816 #endif
05817           evaHV->push_back(H2);            // (delete equivalent)
05818         }
05819         else if (totMass>totM)                  // "Radiative Hadron decay" case
05820         {
05821 #ifdef qdebug
05822           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (28) qH=0"<<G4endl;
05823 #endif
05824           delete qH;
05825           G4LorentzVector fq4M(0.,0.,0.,0.);
05826           G4LorentzVector qe4M(0.,0.,0.,totM);
05827           if(!G4QHadron(q4M).DecayIn2(fq4M,qe4M))
05828           {
05829             // G4cerr<<"***G4QNuc::EvaporateNuc:tM="<<totMass<<"->h1M="<<totM<<"+gam"<<G4endl;
05830             // throw G4QException("G4QNucleus::EvaporateNucleus: H*->H+gamma DecIn2 error");
05831             G4ExceptionDescription ed;
05832             ed << "H*->H+gamma DecIn2 error: tM=" << totMass << "->h1M="
05833                << totM << "+gam" << G4endl;
05834             G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0025",
05835                         FatalException, ed);
05836           }
05837           G4QHadron* H2 = new G4QHadron(thePDG,qe4M);
05838 #ifdef debug
05839           G4cout<<"G4QNucleus::EvaporateNucleus:(5) tot="<<thePDG<<qe4M<<G4endl;
05840 #endif
05841           evaHV->push_back(H2);            // (delete equivalent)
05842           G4QHadron* H1 = new G4QHadron(22,fq4M);
05843 #ifdef debug
05844           G4cout<<"G4QNucleus::EvaporateNucleus:(5) GamFortot="<<fq4M<<G4endl;
05845 #endif
05846           evaHV->push_back(H1);            // (delete equivalent)
05847         }
05848         else if (thePDG==111||thePDG==221||thePDG==331) // "Gamma+Gamma decay" case
05849         {
05850 #ifdef qdebug
05851           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (29) qH=0"<<G4endl;
05852 #endif
05853           delete qH;
05854           G4LorentzVector fq4M(0.,0.,0.,0.);
05855           G4LorentzVector qe4M(0.,0.,0.,0.);
05856           if(!G4QHadron(q4M).DecayIn2(fq4M,qe4M))
05857           {
05858             // G4cerr<<"***G4QNucl::EvaporateNucleus:tM="<<totMass<<"->gamma + gamma"<<G4endl;
05859             // throw G4QException("G4QNucleus::EvaporateNucleus: pi/eta->g+g DecIn2 error");
05860             G4ExceptionDescription ed;
05861             ed << "pi/eta->g+g DecIn2 error: tM=" << totMass
05862                << "->gamma + gamma" << G4endl;
05863             G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0026",
05864                         FatalException, ed);
05865           }
05866           G4QHadron* H2 = new G4QHadron(22,qe4M);
05867 #ifdef debug
05868           G4cout<<"G4QNucleus::EvaporateNucleus:(6) gam1="<<qe4M<<G4endl;
05869 #endif
05870           evaHV->push_back(H2);            // (delete equivalent)
05871           G4QHadron* H1 = new G4QHadron(22,fq4M);
05872 #ifdef debug
05873           G4cout<<"G4QNucleus::EvaporateNucleus:(6) gam2="<<fq4M<<G4endl;
05874 #endif
05875           evaHV->push_back(H1);            // (delete equivalent)
05876         }
05877         else
05878         {
05879 #ifdef qdebug
05880           if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (30) qH=0"<<G4endl;
05881 #endif
05882           delete qH;
05883           // G4cerr<<"***G4QNucl::EvaNuc: Nuc="<<thePDG<<theQC<<", q4M="<<q4M<<", M="<<totMass
05884           //       <<" < GSM="<<totM<<", 2Pi="<<mPi+mPi<<", 2Pi0="<<mPi0+mPi0<<G4endl;
05885           // throw G4QException("G4QNucleus::EvaporateNucleus: Hadron is under MassShell");
05886           G4ExceptionDescription ed;
05887           ed << "Hadron is under MassShell: Nuc=" << thePDG << theQC
05888              << ", q4M=" << q4M << ", M=" << totMass <<" < GSM=" << totM
05889              <<", 2Pi=" << mPi+mPi << ", 2Pi0=" << mPi0+mPi0 << G4endl;
05890           G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0027",
05891                       FatalException, ed);
05892         }
05893       }
05894     }
05895     else
05896     {
05897 #ifdef qdebug
05898       if(!qH) G4cout<<"-Warning-G4QNucleus::EvaporateNucleus: (31) qH=0"<<G4endl;
05899 #endif
05900       delete qH;
05901       // G4cerr<<"**G4QNuc::EvaNuc:RN="<<thePDG<<theQC<<",q4M="<<q4M<<",qM="<<totMass<<G4endl;
05902       // throw G4QException("G4QNucleus::EvaporateNucleus: This is not aNucleus nor aHadron");
05903       G4ExceptionDescription ed;
05904       ed << "This is not aNucleus nor aHadron: RN=" << thePDG << theQC
05905          << ",q4M=" << q4M <<",qM=" << totMass << G4endl;
05906       G4Exception("G4QNucleus::EvaporateNucleus()", "HAD_CHPS_0028",
05907                   FatalException, ed);
05908     }
05909   }
05910 #ifdef qdebug
05911   if (qH)
05912   {
05913     G4cout<<"G4QNucleus::EvaporateNucleus: deletedAtEnd, PDG="<<qH->GetPDGCode()<<G4endl;
05914     if(!qH) G4cout<<"G4QNucleus::EvaporateNucleus: (20) qH="<<G4endl;
05915     else delete qH;
05916   }
05917 #endif
05918 #ifdef debug
05919   G4cout<<"G4QNucleus::EvaporateNucleus: =---=>> End. "<<G4endl;
05920 #endif
05921   return;
05922 } // End of EvaporateNucleus
05923 
05924 //Unavoidable decay of the Isonucleus in nP+(Pi+) or nN+(Pi-)
05925 void G4QNucleus::DecayIsonucleus(G4QHadron* qH, G4QHadronVector* evaHV)
05926 {
05927   static const G4double mPi  = G4QPDGCode(211).GetMass();
05928   static const G4double mNeut= G4QPDGCode(2112).GetMass();
05929   static const G4double mProt= G4QPDGCode(2212).GetMass();
05930   static const G4double mLamb= G4QPDGCode(3122).GetMass();
05931   //static const G4double mSigZ= G4QPDGCode(3212).GetMass();
05932   static const G4double mSigP= G4QPDGCode(3222).GetMass();
05933   static const G4double mSigM= G4QPDGCode(3112).GetMass();
05934   static const G4double eps  = 0.003;
05935   G4LorentzVector q4M = qH->Get4Momentum();      // Get 4-momentum of the Isonucleus
05936   G4double qM=q4M.m();                           // Real mass of the Isonucleus
05937   G4QContent qQC = qH->GetQC();                  // Get QuarcContent of the Isonucleus
05938   G4int qBN=qQC.GetBaryonNumber();               // Baryon number of the IsoNucleus
05939   G4int qC=qQC.GetCharge();                      // Charge of the IsoNucleus
05940   G4int qS=qQC.GetStrangeness();                 // Strangness of the IsoNucleus
05941 #ifdef debug
05942   G4cout<<"G4QNuc:DecayIson:QC="<<qQC<<",M="<<qM<<",B="<<qBN<<",S="<<qS<<",C="<<qC<<G4endl;
05943 #endif
05944   if(qS<0||qS>qBN)                               // *** Should not be here ***
05945   {
05946     G4cout<<"--Warning(Upgrade)--G4QNuc::DecIsonuc:FillAsIs,4M="<<q4M<<",QC="<<qQC<<G4endl;
05947     evaHV->push_back(qH);                        // fill as it is (delete equivalent)
05948     return;
05949   }
05950   G4int          qPN=qC-qBN;                     // Number of pions in the Isonucleus
05951   G4int          fPDG = 2212;                    // Prototype for nP+(Pi+) case
05952   G4int          sPDG = 211;
05953   G4int          tPDG = 3122;                    // @@ Sigma0 (?)
05954   G4double       fMass= mProt;
05955   G4double       sMass= mPi;
05956   G4double       tMass= mLamb;                   // @@ Sigma0 (?)
05957   // =---------= Negative state =-----------=
05958   if(qC<0)                                       // =-------= Only Pi- can help
05959   {
05960     if(qS&&qBN==qS)                              // --- n*Lamb + k*(Pi-) State ---
05961     {
05962       sPDG = -211;
05963       if(-qC==qS && qS==1)                       // Only one Sigma- like (qBN=1)
05964       {
05965         if(fabs(qM-mSigM)<eps)
05966         {
05967           evaHV->push_back(qH);                  // Fill Sigma- as it is
05968           return;
05969         }
05970         else if(qM>mLamb+mPi)                    //(2) Sigma- => Lambda + Pi- decay
05971         {
05972           fPDG = 3122;
05973           fMass= mLamb;
05974         }
05975         else if(qM>mSigM)                        //(2) Sigma+ => Sigma+ + gamma decay
05976         {
05977           fPDG = 3112;
05978           fMass= mSigM;
05979           sPDG = 22;
05980           sMass= 0.;
05981         }
05982         else                                      //(2) Sigma- => Neutron + Pi- decay
05983         {
05984           fPDG = 2112;
05985           fMass= mNeut;
05986         }
05987         qPN  = 1;                                 // #of (Pi+ or gamma)'s = 1
05988       }
05989       else if(-qC==qS)                            //(2) a few Sigma- like
05990       {
05991         qPN  = 1;                                 // One separated Sigma-
05992         fPDG = 3112;
05993         sPDG = 3112;
05994         sMass= mSigM;
05995         qBN--;
05996         fMass= mSigM;
05997       }
05998       else if(-qC>qS)                             //(2) n*(Sigma-)+m*(Pi-)
05999       {
06000         qPN  = -qC-qS;                            // #of Pi-'s
06001         fPDG = 3112;
06002         fMass= mSigM;
06003       }
06004       else                                        //(2) n*(Sigma-)+m*Lambda (-qC<qS)
06005       {
06006         qBN += qC;                                // #of Lambda's
06007         fPDG = 3122;
06008         fMass= mLamb;
06009         qPN  = -qC;                               // #of Sigma+'s
06010         sPDG = 3112;
06011         sMass= mSigM;
06012       }
06013       qS   = 0;                                   // Only decays in two are above
06014     }
06015     else if(qS)                                   // ->n*Lamb+m*Neut+k*(Pi-) State (qS<qBN)
06016     {
06017       qBN -= qS;                                  // #of neutrons
06018       fPDG = 2112;
06019       fMass= mNeut;
06020       G4int nPin = -qC;                           // #of Pi-'s                    
06021       if(qS==nPin)                                //(2) m*Neut+n*Sigma-
06022       {
06023         qPN  = qS;                                // #of Sigma-
06024         sPDG = 3112;
06025         sMass= mSigM;
06026         qS   = 0;
06027       }
06028       else if(qS>nPin)                            //(3) m*P+n*(Sigma+)+k*Lambda
06029       {
06030         qS-=nPin;                                 // #of Lambdas
06031         qPN  = nPin;                              // #of Sigma+
06032         sPDG = 3112;
06033         sMass= mSigM;
06034       }
06035       else                                        //(3) m*N+n*(Sigma-)+k*(Pi-) (qS<nPin)
06036       {
06037         qPN  = nPin-qS;                           // #of Pi-
06038         sPDG = -211;
06039         tPDG = 3112;
06040         tMass= mSigM;
06041       }
06042     }
06043     else                                          //(2) n*N+m*(Pi-)   (qS=0)
06044     {
06045       sPDG = -211;
06046       qPN  = -qC;
06047       fPDG = 2112;
06048       fMass= mNeut;
06049     }
06050   }
06051   else if(!qC)                                   // *** Should not be here ***
06052   {
06053     if(qS && qS<qBN)                             //(2) n*Lamb+m*N ***Should not be here***
06054     {
06055       qPN  = qS;
06056       fPDG = 2112;                               // mN+nL case
06057       sPDG = 3122;
06058       sMass= mLamb;
06059       qBN -= qS;
06060       fMass= mNeut;
06061       qS   = 0;
06062     }
06063     else if(qS>1 && qBN==qS)                     //(2) m*Lamb(m>1) ***Should not be here***
06064     {
06065       qPN  = 1;
06066       fPDG = 3122;
06067       sPDG = 3122;
06068       sMass= mLamb;
06069       qBN--;
06070       fMass= mLamb;
06071     }
06072     else if(!qS && qBN>1)                        //(2) n*Neut(n>1) ***Should not be here***
06073     {
06074       qPN  = 1;
06075       fPDG = 2112;
06076       sPDG = 2112;
06077       sMass= mNeut;
06078       qBN--;
06079       fMass= mNeut;
06080     }
06081     else G4cout<<"*?*G4QNuc::DecayIsonucleus: (1) QC="<<qQC<<G4endl;
06082   }
06083   else if(qC>0)                                  // n*Lamb+(m*P)+(k*Pi+)
06084   {
06085     if(qS && qS+qC==qBN)                         //(2) n*Lamb+m*P ***Should not be here***
06086     {
06087       qPN  = qS;
06088       qS   = 0;
06089       fPDG = 2212;
06090       sPDG = 3122;
06091       sMass= mLamb;
06092       qBN  = qC;
06093       fMass= mProt;
06094     }
06095     else if(qS  && qC<qBN-qS)                     //(3)n*L+m*P+k*N ***Should not be here***
06096     {
06097       qPN  = qC;                                  // #of protons
06098       fPDG = 2112;                                // mP+nL case
06099       sPDG = 2212;
06100       sMass= mProt;
06101       qBN -= qS+qC;                               // #of neutrons
06102       fMass= mNeut;
06103     }
06104     else if(qS  && qBN==qS)                       // ---> n*L+m*Pi+ State
06105     {
06106       if(qC==qS && qS==1)                         // Only one Sigma+ like State
06107       {
06108         if(fabs(qM-mSigP)<eps)                    // Fill Sigma+ as it is
06109         {
06110           evaHV->push_back(qH);
06111           return;
06112         }
06113         else if(qM>mLamb+mPi)                     //(2) Sigma+ => Lambda + Pi+ decay
06114         {
06115           fPDG = 3122;
06116           fMass= mLamb;
06117         }
06118         else if(qM>mNeut+mPi)                     //(2) Sigma+ => Neutron + Pi+ decay
06119         {
06120           fPDG = 2112;
06121           fMass= mNeut;
06122         }
06123         else if(qM>mSigP)                         //(2) Sigma+ => Sigma+ + gamma decay
06124         {
06125           fPDG = 3222;
06126           fMass= mSigP;
06127           sPDG = 22;
06128           sMass= 0.;
06129         }
06130         else                                      //(2) Sigma+ => Proton + gamma decay
06131         {
06132           fPDG = 2212;
06133           fMass= mProt;
06134           sPDG = 22;
06135           sMass= 0.;
06136         }
06137         qPN  = 1;                                 // #of (Pi+ or gamma)'s = 1
06138       }
06139       else if(qC==qS)                             //(2) a few Sigma+ like hyperons
06140       {
06141         qPN  = 1;
06142         fPDG = 3222;
06143         sPDG = 3222;
06144         sMass= mSigP;
06145         qBN--;
06146         fMass= mSigP;
06147       }
06148       else if(qC>qS)                              //(2) n*(Sigma+)+m*(Pi+)
06149       {
06150         qPN  = qC-qS;                             // #of Pi+'s
06151         fPDG = 3222;
06152         qBN  = qS;                                // #of Sigma+'s
06153         fMass= mSigP;
06154       }
06155       else                                        //(2) n*(Sigma+)+m*Lambda
06156       {
06157         qBN -= qC;                                // #of Lambda's
06158         fPDG = 3122;
06159         fMass= mLamb;
06160         qPN  = qC;                                // #of Sigma+'s
06161         sPDG = 3222;
06162         sMass= mSigP;
06163       }
06164       qS   = 0;                                   // All above are decays in 2
06165     }
06166     else if(qS && qC>qBN-qS)                      // n*Lamb+m*P+k*Pi+
06167     {
06168       qBN -= qS;                                  // #of protons
06169       G4int nPip = qC-qBN;                        // #of Pi+'s                    
06170       if(qS==nPip)                                //(2) m*P+n*Sigma+
06171       {
06172         qPN  = qS;                                // #of Sigma+
06173         sPDG = 3222;
06174         sMass= mSigP;
06175         qS   = 0;
06176       }
06177       else if(qS>nPip)                            //(3) m*P+n*(Sigma+)+k*Lambda
06178       {
06179         qS  -= nPip;                              // #of Lambdas
06180         qPN  = nPip;                              // #of Sigma+
06181         sPDG = 3222;
06182         sMass= mSigP;
06183       }
06184       else                                        //(3) m*P+n*(Sigma+)+k*(Pi+)
06185       {
06186         qPN  = nPip-qS;                           // #of Pi+
06187         tPDG = 3222;
06188         tMass= mSigP;
06189       }
06190     }
06191     if(qC<qBN)                                    //(2) n*P+m*N ***Should not be here***
06192     {
06193       fPDG = 2112;
06194       fMass= mNeut;
06195       qPN  = qC;
06196       sPDG = 2212;
06197       sMass= mProt;
06198     }
06199     else if(qBN==qC && qC>1)                     //(2) m*Prot(m>1) ***Should not be here***
06200     {
06201       qPN  = 1;
06202       fPDG = 2212;
06203       sPDG = 2212;
06204       sMass= mProt;
06205       qBN--;
06206       fMass= mProt;
06207     }
06208     else if(qC<=qBN||!qBN) G4cout<<"*?*G4QNuc::DecayIsonucleus: (2) QC="<<qQC<<G4endl;
06209     // !qS && qC>qBN                             //(2) Default condition n*P+m*(Pi+)
06210   }
06211   G4double tfM=qBN*fMass;
06212   G4double tsM=qPN*sMass;
06213   G4double ttM=0.;
06214   if(qS) ttM=qS*tMass;
06215   G4LorentzVector f4Mom(0.,0.,0.,tfM);
06216   G4LorentzVector s4Mom(0.,0.,0.,tsM);
06217   G4LorentzVector t4Mom(0.,0.,0.,ttM);
06218   G4double sum=tfM+tsM+ttM;
06219   if(fabs(qM-sum)<eps)
06220   {
06221     f4Mom=q4M*(tfM/sum);
06222     s4Mom=q4M*(tsM/sum);
06223     if(qS) t4Mom=q4M*(ttM/sum);
06224   }
06225   else if(!qS && (qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom)))
06226   {
06227 #ifdef debug
06228     G4cout<<"***G4QNuc::DecIsonuc:fPDG="<<fPDG<<"*"<<qBN<<"(fM="<<fMass<<")+sPDG="<<sPDG
06229           <<"*"<<qPN<<"(sM="<<sMass<<")"<<"="<<sum<<" > TotM="<<qM<<q4M<<qQC<<qS<<G4endl;
06230 #endif
06231     evaHV->push_back(qH);                  // fill as it is (delete equivalent)
06232     return;
06233   }
06234   else if(qS && (qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom)))
06235   {
06236 #ifdef debug
06237     G4cout<<"***G4QNuc::DecIsonuc: "<<fPDG<<"*"<<qBN<<"("<<fMass<<")+"<<sPDG<<"*"<<qPN<<"("
06238           <<sMass<<")+Lamb*"<<qS<<"="<<sum<<" > TotM="<<qM<<q4M<<qQC<<G4endl;
06239 #endif
06240     evaHV->push_back(qH);                  // fill as it is (delete equivalent)
06241     return;
06242   }
06243 #ifdef debug
06244   G4cout<<"G4QNuc::DecayIsonucleus: *DONE* n="<<qPN<<f4Mom<<fPDG<<", m="<<qPN<<s4Mom<<sPDG
06245         <<", l="<<qS<<t4Mom<<G4endl;
06246 #endif
06247   delete qH;
06248   if(qBN)
06249   {
06250     f4Mom/=qBN;
06251     for(G4int ih=0; ih<qBN; ih++)
06252     {
06253       G4QHadron* Hi = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the hyperon
06254       evaHV->push_back(Hi);                 // Fill "Hi" (delete equivalent)
06255     }
06256   }
06257   if(qPN)
06258   {
06259     s4Mom/=qPN;
06260     for(G4int ip=0; ip<qPN; ip++)
06261     {
06262       G4QHadron* Hj = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the meson
06263       evaHV->push_back(Hj);                 // Fill "Hj" (delete equivalent)
06264     }
06265   }
06266   if(qS)
06267   {
06268     t4Mom/=qS;
06269     for(G4int il=0; il<qS; il++)
06270     {
06271       G4QHadron* Hk = new G4QHadron(tPDG,t4Mom); // Create a Hadron for the lambda
06272       evaHV->push_back(Hk);                 // Fill "Hk" (delete equivalent)
06273     }
06274   }
06275 #ifdef qdebug
06276   if (qH)
06277   {
06278     G4cout << "G4QNucleus::DecayIsonucleus: deleted at end - PDG: "
06279            << qH->GetPDGCode() << G4endl;
06280     delete qH;
06281   }
06282 #endif
06283 } // End of DecayIsonucleus
06284 
06285 //Decay of the excited dibaryon in two baryons
06286 void G4QNucleus::DecayDibaryon(G4QHadron* qH, G4QHadronVector* evaHV)
06287 {
06288   static const G4double mPi  = G4QPDGCode(211).GetMass();
06289   static const G4double mNeut= G4QPDGCode(2112).GetMass();
06290   static const G4double mProt= G4QPDGCode(2212).GetMass();
06291   static const G4double mSigM= G4QPDGCode(3112).GetMass();
06292   static const G4double mLamb= G4QPDGCode(3122).GetMass();
06293   static const G4double mSigP= G4QPDGCode(3222).GetMass();
06294   static const G4double mKsiM= G4QPDGCode(3312).GetMass();
06295   static const G4double mKsiZ= G4QPDGCode(3322).GetMass();
06296   static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
06297   static const G4double mPiN = mPi+mNeut;
06298   static const G4double mPiP = mPi+mProt;
06299   static const G4double dmPiN= mPiN+mPiN;
06300   static const G4double dmPiP= mPiP+mPiP;
06301   static const G4double nnPi = mNeut+mPiN;
06302   static const G4double ppPi = mProt+mPiP;
06303   static const G4double lnPi = mLamb+mPiN;
06304   static const G4double lpPi = mLamb+mPiP;
06305   static const G4double dNeut= mNeut+mNeut;
06306   static const G4double dProt= mProt+mProt;
06307   static const G4double dLamb= mLamb+mLamb;
06308   static const G4double dLaNe= mLamb+mNeut;
06309   static const G4double dLaPr= mLamb+mProt;
06310   static const G4double dSiPr= mSigP+mProt;
06311   static const G4double dSiNe= mSigM+mNeut;
06312   static const G4double dKsPr= mKsiZ+mProt;
06313   static const G4double dKsNe= mKsiM+mNeut;
06314   static const G4double eps  = 0.003;
06315   static const G4QNucleus vacuum(90000000);
06316   G4bool four=false;                           // defFALSE for 4-particle decay of diDelta
06317   G4LorentzVector q4M = qH->Get4Momentum();    // Get 4-momentum of the Dibaryon
06318   G4int          qPDG = qH->GetPDGCode();      // PDG Code of the decaying dybaryon
06319   G4double         qM = q4M.m();
06320   G4double         rM = qM+eps;                // Just to avoid the computer accuracy
06321 #ifdef debug
06322   G4cout<<"G4QNucl::DecayDibaryon: *Called* PDG="<<qPDG<<",4Mom="<<q4M<<", M="<<qM<<G4endl;
06323 #endif
06324   // Select a chanel of the dibaryon decay (including Delta+Delta-> 4 particle decay
06325   G4int          fPDG = 2212;                  // Prototype for pp case
06326   G4int          sPDG = 2212;
06327   G4int          tPDG = 0;                     // Zero prototype to separate 3 from 2 
06328   G4double       fMass= mProt;
06329   G4double       sMass= mProt;
06330   G4double       tMass= mPi;
06331   if     (qPDG==90003998 && rM>=dmPiP)         // "diDelta++" case
06332   {
06333     sPDG = 211;
06334     sMass= mPi;
06335     four = true;
06336   }
06337   else if(qPDG==89998004 && rM>=dmPiN)         // "diDelta--" case
06338   {
06339     sPDG = -211;
06340     fPDG = 2112;
06341     sMass= mPi;
06342     fMass= mNeut;
06343     four = true;
06344   }
06345   else if(qPDG==90000002 && rM>=dNeut)         // "dineutron" case
06346   {
06347     fPDG = 2112;
06348     sPDG = 2112;
06349     fMass= mNeut;
06350     sMass= mNeut;    
06351   }
06352   else if(qPDG==90001001 && rM>=mDeut)         // "exited deutron" case
06353   {
06354     if(fabs(qM-mDeut)<eps)
06355     {
06356       evaHV->push_back(qH);               // Fill as it is (delete equivalent)
06357       return;
06358     }
06359     else if(mProt+mNeut<rM)
06360     {
06361       fPDG = 2112;
06362       fMass= mNeut;    
06363     }
06364     else
06365     {
06366       fPDG = 22;
06367       sPDG = 90001001;
06368       fMass= 0.;
06369       sMass= mDeut;    
06370     }
06371   }
06372   else if(qPDG==91000001 && rM>=dLaNe)         // "Lambda-neutron" case
06373   {
06374     fPDG = 2112;
06375     sPDG = 3122;
06376     fMass= mNeut;
06377     sMass= mLamb;    
06378   }
06379   else if(qPDG==91001000 && rM>=dLaPr)         // "Lambda-proton" case
06380   {
06381     sPDG = 3122;
06382     sMass= mLamb;    
06383   }
06384   else if(qPDG==89999003 && rM>=nnPi)         // "neutron/Delta-" case
06385   {
06386     fPDG = 2112;
06387     sPDG = 2112;
06388     tPDG = -211;
06389     fMass= mNeut;
06390     sMass= mNeut;    
06391   }
06392   else if(qPDG==90002999 && rM>=ppPi)         // "proton/Delta++" case
06393   {
06394     tPDG = 211;
06395   }
06396   else if(qPDG==90999002 && rM>=lnPi)         // "lambda/Delta-" case
06397   {
06398     fPDG = 2112;
06399     sPDG = 3122;
06400     tPDG = -211;
06401     fMass= mNeut;
06402     sMass= mLamb;    
06403   }
06404   else if(qPDG==91001999 && rM>=lpPi)         // "lambda/Delta+" case
06405   {
06406     sPDG = 3122;
06407     tPDG = 211;
06408     sMass= mLamb;    
06409   }
06410   else if(qPDG==90999002 && rM>=dSiNe)         // "Sigma-/neutron" case
06411   {
06412     fPDG = 2112;
06413     sPDG = 3112;
06414     fMass= mNeut;
06415     sMass= mSigM;    
06416   }
06417   else if(qPDG==91001999 && rM>=dSiPr)         // "Sigma+/proton" case
06418   {
06419     sPDG = 3222;
06420     sMass= mSigP;    
06421   }
06422   else if(qPDG==92000000 && rM>=dLamb)         // "diLambda" case
06423   {
06424     fPDG = 3122;
06425     sPDG = 3122;
06426     fMass= mLamb;
06427     sMass= mLamb;    
06428   }
06429   else if(qPDG==91999001 && rM>=dKsNe)         // "Ksi-/neutron" case
06430   {
06431     fPDG = 2112;
06432     sPDG = 3312;
06433     fMass= mNeut;
06434     sMass= mKsiM;    
06435   }
06436   else if(qPDG==92000999 && rM>=dKsPr)         // "Ksi0/proton" case
06437   {
06438     sPDG = 3322;
06439     sMass= mKsiZ;    
06440   }
06441   else if(qPDG!=90002000|| rM<dProt)           // Other possibilities (if not a default)
06442   {
06443     G4int qS = qH->GetStrangeness();
06444     G4int qB = qH->GetBaryonNumber();
06445     if(qB>0&&qS<0)                             // Antistrange diBarion
06446     {
06447       DecayAntiStrange(qH,evaHV);
06448       return;
06449     }
06450     else
06451     {
06452       delete qH;
06453       G4cerr<<"***G4QN::DecDiBar: badPDG="<<qPDG<<" or smallM="<<qM<<",2mP="<<dProt
06454             <<",2mN="<<dNeut<<G4endl;
06455       // @@ Nothing to do. Just 2 GeV disappears... Very rare! Just to avoid the exception.
06456       //throw G4QException("G4QNucleus::DecayDibar: Unknown PDG code or small Mass of DB");
06457     }
06458   }
06459   G4LorentzVector f4Mom(0.,0.,0.,fMass);
06460   G4LorentzVector s4Mom(0.,0.,0.,sMass);
06461   G4LorentzVector t4Mom(0.,0.,0.,tMass);
06462   if(!tPDG&&!four)
06463   {
06464     G4double sum=fMass+sMass;
06465     if(fabs(qM-sum)<eps)
06466     {
06467       f4Mom=q4M*(fMass/sum);
06468       s4Mom=q4M*(sMass/sum);
06469     }
06470     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06471     {
06472       G4cout<<"---Warning---G4QN::DecDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG<<"(M="
06473             <<sMass<<")="<<sum<<" >? TotM="<<q4M.m()<<q4M<<G4endl;
06474       //G4cerr<<"***G4QNucl::DecayDiBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06475       //throw G4QException("***G4QNucleus::DecayDibaryon: DiBaryon DecayIn2 error");
06476       evaHV->push_back(qH);
06477       return;
06478     }
06479 #ifdef debug
06480     G4cout<<"G4QNucleus::DecayDibaryon:(2) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06481           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06482 #endif
06483     delete qH;
06484     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06485     evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
06486     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06487     evaHV->push_back(H2);                 // Fill "H2" (delete equivalent)
06488   }
06489   else if(four)
06490   {
06491     q4M=q4M/2.;                                // Divided in 2 !!!
06492     qM/=2.;                                    // Divide the mass in 2 !
06493     G4double sum=fMass+sMass;
06494     if(fabs(qM-sum)<eps)
06495     {
06496       f4Mom=q4M*(fMass/sum);
06497       s4Mom=q4M*(sMass/sum);
06498     }
06499     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06500     {
06501       G4cout<<"---Warning---G4QN::DecDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG<<"(M="
06502             <<sMass<<")"<<"="<<sum<<">tM="<<q4M.m()<<q4M<<G4endl;
06503       //G4cerr<<"***G4QN::DecayDibaryon: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06504       //throw G4QException("***G4QNucleus::DecDibaryon: Dibaryon DecayIn2 error");
06505       evaHV->push_back(qH);
06506       return;
06507     }
06508 #ifdef debug
06509     G4cout<<"G4QNucleus::DecayDibaryon:(3) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06510           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06511 #endif
06512     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06513     evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
06514     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06515     evaHV->push_back(H2);                 // Fill "H2" (delete equivalent)
06516     // Now the second pair mus be decayed
06517     if(fabs(qM-sum)<eps)
06518     {
06519       f4Mom=q4M*(fMass/sum);
06520       s4Mom=q4M*(sMass/sum);
06521     }
06522     else if(!G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06523     {
06524       // Should not be here as sum was already compared with qM above for the first delta
06525       delete qH;
06526       // G4cerr<<"***G4QNucl::DecDibar:fPDG="<<fPDG<<"(fM="<<fMass<<") + sPDG="<<sPDG<<"(sM="
06527       //       <<sMass<<")="<<sum<<" >? (DD2,Can't be here) TotM="<<q4M.m()<<q4M<<G4endl;
06528       // throw G4QException("G4QNucleus::DecayDibaryon: General DecayIn2 error");
06529       G4ExceptionDescription ed;
06530       ed << "General DecayIn2 error: fPDG=" << fPDG << "(fM=" << fMass
06531          << ") + sPDG=" << sPDG <<"(sM=" << sMass << ")=" << sum
06532          << " >? (DD2,Can't be here) TotM=" << q4M.m() << q4M << G4endl;
06533       G4Exception("G4QNucleus::DecayDibaryon()", "HAD_CHPS_0000",
06534                   FatalException, ed);
06535     }
06536 #ifdef debug
06537     G4cout<<"G4QNucl::DecayDibaryon:(4) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06538           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06539 #endif
06540     G4QHadron* H3 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06541     evaHV->push_back(H3);                 // Fill "H1" (delete equivalent)
06542     G4QHadron* H4 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06543     evaHV->push_back(H4);                 // Fill "H2" (delete equivalent)
06544     delete qH;
06545   }
06546   else
06547   {
06548     G4double sum=fMass+sMass+tMass;
06549     if(fabs(qM-sum)<eps)
06550     {
06551       f4Mom=q4M*(fMass/sum);
06552       s4Mom=q4M*(sMass/sum);
06553       t4Mom=q4M*(tMass/sum);
06554     }
06555     else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
06556     {
06557       G4cout<<"---Warning---G4QN::DecDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG<<"(M="
06558             <<sMass<<")+tPDG="<<tPDG<<"(tM="<<tMass<<")="<<sum<<">TotM="<<q4M.m()<<G4endl;
06559       //G4cerr<<"***G4QNuc::DecayDibaryon:qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06560       //throw G4QException("G4QNucleus::DecayDibaryon: diBar DecayIn3 error");
06561       evaHV->push_back(qH);
06562       return;
06563     }
06564 #ifdef debug
06565     G4cout<<"G4QNuc::DecayDibaryon:(5) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG<<", s4M="<<s4Mom
06566           <<",sPDG="<<sPDG<<", t4M="<<t4Mom<<",tPDG="<<tPDG<<G4endl;
06567 #endif
06568     //qH->SetNFragments(2);                    // Fill a#of fragments to decaying Dibaryon
06569     //evaHV->push_back(qH);               // Fill hadron with nf=2 (delete equivalent)
06570     // Instead
06571     delete qH;
06572     //
06573     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06574     evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
06575     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06576     evaHV->push_back(H2);                 // Fill "H2" (delete equivalent)
06577     G4QHadron* H3 = new G4QHadron(tPDG,t4Mom); // Create a Hadron for the meson
06578     evaHV->push_back(H3);                 // Fill "H3" (delete equivalent)
06579   }
06580 #ifdef qdebug
06581   if (qH)
06582   {
06583     G4cout << "G4QNucleus::DecayDiBaryon: deleted at end - PDG: "
06584            << qH->GetPDGCode() << G4endl;
06585     delete qH;
06586   }
06587 #endif
06588 } // End of DecayDibaryon
06589 
06590 //Decay of the excited anti-dibaryon in two anti-baryons
06591 void G4QNucleus::DecayAntiDibaryon(G4QHadron* qH, G4QHadronVector* evaHV)
06592 {
06593   static const G4double mPi  = G4QPDGCode(211).GetMass();
06594   static const G4double mNeut= G4QPDGCode(2112).GetMass();
06595   static const G4double mProt= G4QPDGCode(2212).GetMass();
06596   static const G4double mSigM= G4QPDGCode(3112).GetMass();
06597   static const G4double mLamb= G4QPDGCode(3122).GetMass();
06598   static const G4double mSigP= G4QPDGCode(3222).GetMass();
06599   static const G4double mKsiM= G4QPDGCode(3312).GetMass();
06600   static const G4double mKsiZ= G4QPDGCode(3322).GetMass();
06601   static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
06602   static const G4double mPiN = mPi+mNeut;
06603   static const G4double mPiP = mPi+mProt;
06604   static const G4double dmPiN= mPiN+mPiN;
06605   static const G4double dmPiP= mPiP+mPiP;
06606   static const G4double nnPi = mNeut+mPiN;
06607   static const G4double ppPi = mProt+mPiP;
06608   static const G4double lnPi = mLamb+mPiN;
06609   static const G4double lpPi = mLamb+mPiP;
06610   static const G4double dNeut= mNeut+mNeut;
06611   static const G4double dProt= mProt+mProt;
06612   static const G4double dLamb= mLamb+mLamb;
06613   static const G4double dLaNe= mLamb+mNeut;
06614   static const G4double dLaPr= mLamb+mProt;
06615   static const G4double dSiPr= mSigP+mProt;
06616   static const G4double dSiNe= mSigM+mNeut;
06617   static const G4double dKsPr= mKsiZ+mProt;
06618   static const G4double dKsNe= mKsiM+mNeut;
06619   static const G4double eps  = 0.003;
06620   static const G4QNucleus vacuum(90000000);
06621   G4bool four=false;                           // defFALSE for 4-particle decay of diDelta
06622   G4LorentzVector q4M = qH->Get4Momentum();    // Get 4-momentum of the Dibaryon
06623   G4int          qPDG = qH->GetPDGCode();      // PDG Code of the decaying dybaryon
06624   G4double         qM = q4M.m();               // Mass of the decaying anti-di-baryon
06625   G4double         rM = qM+eps;                // Just to avoid the computer accuracy
06626 #ifdef debug
06627   G4cout<<"G4QNucl::DecayAntiDibar:*Called* PDG="<<qPDG<<",4Mom="<<q4M<<", M="<<qM<<G4endl;
06628 #endif
06629   // Select a chanel of the dibaryon decay (including Delta+Delta-> 4 particle decay
06630   G4int          fPDG = -2212;                 // Prototype for anti-pp case
06631   G4int          sPDG = -2212;
06632   G4int          tPDG = 0;                     // Zero prototype to separate 3 from 2 
06633   G4double       fMass= mProt;
06634   G4double       sMass= mProt;
06635   G4double       tMass= mPi;
06636   if     (qPDG==89996002 && rM>=dmPiP)         // "anti-diDelta++" case
06637   {
06638     sPDG = -211;
06639     sMass= mPi;
06640     four = true;
06641   }
06642   else if(qPDG==90001996 && rM>=dmPiN)         // "diDelta--" case
06643   {
06644     sPDG = 211;
06645     fPDG = -2112;
06646     sMass= mPi;
06647     fMass= mNeut;
06648     four = true;
06649   }
06650   else if(qPDG==89999998 && rM>=dNeut)         // "dineutron" case
06651   {
06652     fPDG = -2112;
06653     sPDG = -2112;
06654     fMass= mNeut;
06655     sMass= mNeut;    
06656   }
06657   else if(qPDG==89998999 && rM>=mDeut)         // "exited deutron" case
06658   {
06659     if(fabs(qM-mDeut)<eps)
06660     {
06661       evaHV->push_back(qH);                    // Fill as it is (delete equivalent)
06662       return;
06663     }
06664     else if(mProt+mNeut<rM)
06665     {
06666       fPDG = -2112;
06667       fMass= mNeut;    
06668     }
06669     else
06670     {
06671       fPDG = 22;
06672       sPDG = 89998999;                         // Anti-deuteron
06673       fMass= 0.;
06674       sMass= mDeut;    
06675       G4cout<<"--Warning--G4QNucl::DecayAntiDibar:ANTI-DEUTERON is created M="<<rM<<G4endl;
06676     }
06677   }
06678   else if(qPDG==88999999 && rM>=dLaNe)         // "Lambda-neutron" case
06679   {
06680     fPDG = -2112;
06681     sPDG = -3122;
06682     fMass= mNeut;
06683     sMass= mLamb;    
06684   }
06685   else if(qPDG==88999999 && rM>=dLaPr)         // "Lambda-proton" case
06686   {
06687     sPDG = -3122;
06688     sMass= mLamb;    
06689   }
06690   else if(qPDG==90000997 && rM>=nnPi)         // "neutron/Delta-" case
06691   {
06692     fPDG = -2112;
06693     sPDG = -2112;
06694     tPDG = 211;
06695     fMass= mNeut;
06696     sMass= mNeut;    
06697   }
06698   else if(qPDG==89997001 && rM>=ppPi)         // "proton/Delta++" case
06699   {
06700     tPDG = -211;
06701   }
06702   else if(qPDG==89000998 && rM>=lnPi)         // "lambda/Delta-" case
06703   {
06704     fPDG = -2112;
06705     sPDG = -3122;
06706     tPDG = 211;
06707     fMass= mNeut;
06708     sMass= mLamb;    
06709   }
06710   else if(qPDG==889998001 && rM>=lpPi)         // "lambda/Delta+" case
06711   {
06712     sPDG = -3122;
06713     tPDG = -211;
06714     sMass= mLamb;    
06715   }
06716   else if(qPDG==89000998 && rM>=dSiNe)         // "Sigma-/neutron" case
06717   {
06718     fPDG = -2112;
06719     sPDG = -3112;
06720     fMass= mNeut;
06721     sMass= mSigM;    
06722   }
06723   else if(qPDG==88998001 && rM>=dSiPr)         // "Sigma+/proton" case
06724   {
06725     sPDG = -3222;
06726     sMass= mSigP;    
06727   }
06728   else if(qPDG==88000000 && rM>=dLamb)         // "diLambda" case
06729   {
06730     fPDG = -3122;
06731     sPDG = -3122;
06732     fMass= mLamb;
06733     sMass= mLamb;    
06734   }
06735   else if(qPDG==88000999 && rM>=dKsNe)         // "Ksi-/neutron" case
06736   {
06737     fPDG = -2112;
06738     sPDG = -3312;
06739     fMass= mNeut;
06740     sMass= mKsiM;    
06741   }
06742   else if(qPDG==87999001 && rM>=dKsPr)         // "Ksi0/proton" case
06743   {
06744     sPDG = -3322;
06745     sMass= mKsiZ;    
06746   }
06747   else if(qPDG!=89998000|| rM<dProt)           // Other possibilities (if not a default)
06748   {
06749     G4int qS = qH->GetStrangeness();
06750     G4int qB = qH->GetBaryonNumber();
06751     if(qB>0&&qS<0)                             // Antistrange diBarion
06752     {
06753       DecayAntiStrange(qH,evaHV);
06754       return;
06755     }
06756     else
06757     {
06758       delete qH;
06759       G4cerr<<"**G4QNuc::DecayAntiDiBar: badPDG="<<qPDG<<" or smallM="<<qM<<", 2mP="<<dProt
06760             <<", 2mN="<<dNeut<<G4endl;
06761       // @@ Nothing to do. Just 2 GeV disappears... Very rare! Just to avoid the exception.
06762       //throw G4QException("G4QNucleus::DecayDibar: Unknown PDG code or small Mass of DB");
06763     }
06764   }
06765   G4LorentzVector f4Mom(0.,0.,0.,fMass);
06766   G4LorentzVector s4Mom(0.,0.,0.,sMass);
06767   G4LorentzVector t4Mom(0.,0.,0.,tMass);
06768   if(!tPDG&&!four)
06769   {
06770     G4double sum=fMass+sMass;
06771     if(fabs(qM-sum)<eps)
06772     {
06773       f4Mom=q4M*(fMass/sum);
06774       s4Mom=q4M*(sMass/sum);
06775     }
06776     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06777     {
06778       G4cout<<"---Warning---G4QN::DecAntiDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG
06779             <<"(M="<<sMass<<")="<<sum<<" >? TotM="<<q4M.m()<<q4M<<G4endl;
06780       //G4cerr<<"***G4QNucl::DecayDiBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06781       //throw G4QException("***G4QNucleus::DecayDibaryon: DiBaryon DecayIn2 error");
06782       evaHV->push_back(qH);
06783       return;
06784     }
06785 #ifdef debug
06786     G4cout<<"G4QNucleus::DecayAntiDibaryon:(2) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06787           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06788 #endif
06789     delete qH;
06790     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06791     evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
06792     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06793     evaHV->push_back(H2);                 // Fill "H2" (delete equivalent)
06794   }
06795   else if(four)
06796   {
06797     q4M=q4M/2.;                                // Divided in 2 !!!
06798     qM/=2.;                                    // Divide the mass in 2 !
06799     G4double sum=fMass+sMass;
06800     if(fabs(qM-sum)<eps)
06801     {
06802       f4Mom=q4M*(fMass/sum);
06803       s4Mom=q4M*(sMass/sum);
06804     }
06805     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06806     {
06807       G4cout<<"---Warning---G4QN::DecAntiDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG
06808             <<"(M="<<sMass<<")"<<"="<<sum<<">tM="<<q4M.m()<<q4M<<G4endl;
06809       //G4cerr<<"***G4QN::DecayDibaryon: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06810       //throw G4QException("***G4QNucleus::DecDibaryon: Dibaryon DecayIn2 error");
06811       evaHV->push_back(qH);
06812       return;
06813     }
06814 #ifdef debug
06815     G4cout<<"G4QNucleus::DecayAntiDibaryon:(3) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06816           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06817 #endif
06818     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06819     evaHV->push_back(H1);                      // Fill "H1" (delete equivalent)
06820     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06821     evaHV->push_back(H2);                      // Fill "H2" (delete equivalent)
06822     // Now the second pair mus be decayed
06823     if(fabs(qM-sum)<eps)
06824     {
06825       f4Mom=q4M*(fMass/sum);
06826       s4Mom=q4M*(sMass/sum);
06827     }
06828     else if(!G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
06829     {
06830       // Should not be here as sum was already compared with qM above for the first delta
06831       delete qH;
06832       // G4cerr<<"**G4QNucl::DecAntiDibar:fPDG="<<fPDG<<"(fM="<<fMass<<")+sPDG="<<sPDG<<"(sM="
06833       //       <<sMass<<")="<<sum<<" >? (DD2,Can't be here) TotM="<<q4M.m()<<q4M<<G4endl;
06834       // throw G4QException("G4QNucleus::DecayAntiDibaryon: General DecayIn2 error");
06835       G4ExceptionDescription ed;
06836       ed << " General DecayIn2 error: fPDG=" << fPDG << "(fM=" << fMass
06837          << ")+sPDG=" << sPDG << "(sM=" << sMass << ")=" << sum
06838          << " >? (DD2,Can't be here) TotM=" << q4M.m() << q4M << G4endl;
06839       G4Exception("G4QNucleus::DecayAntiDibaryon()", "HAD_CHPS_0000",
06840                   FatalException, ed);
06841     }
06842 #ifdef debug
06843     G4cout<<"G4QNucl::DecayAntiDibaryon:(4) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
06844           <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
06845 #endif
06846     G4QHadron* H3 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06847     evaHV->push_back(H3);                      // Fill "H1" (delete equivalent)
06848     G4QHadron* H4 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06849     evaHV->push_back(H4);                      // Fill "H2" (delete equivalent)
06850     delete qH;
06851   }
06852   else
06853   {
06854     G4double sum=fMass+sMass+tMass;
06855     if(fabs(qM-sum)<eps)
06856     {
06857       f4Mom=q4M*(fMass/sum);
06858       s4Mom=q4M*(sMass/sum);
06859       t4Mom=q4M*(tMass/sum);
06860     }
06861     else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
06862     {
06863       G4cout<<"-Warning-G4QN::DecAntiDib:fPDG="<<fPDG<<"(M="<<fMass<<")+sPDG="<<sPDG<<"(M="
06864             <<sMass<<")+tPDG="<<tPDG<<"(tM="<<tMass<<")="<<sum<<">TotM="<<q4M.m()<<G4endl;
06865       //G4cerr<<"***G4QNuc::DecayDibaryon:qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
06866       //throw G4QException("G4QNucleus::DecayDibaryon: diBar DecayIn3 error");
06867       evaHV->push_back(qH);
06868       return;
06869     }
06870 #ifdef debug
06871     G4cout<<"G4QNuc::DecayAbtiDibaryon:(5) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG<<", s4M="
06872           <<s4Mom<<",sPDG="<<sPDG<<", t4M="<<t4Mom<<",tPDG="<<tPDG<<G4endl;
06873 #endif
06874     //qH->SetNFragments(2);                    // Fill a#of fragments to decaying Dibaryon
06875     //evaHV->push_back(qH);               // Fill hadron with nf=2 (delete equivalent)
06876     // Instead
06877     delete qH;
06878     //
06879     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the 1-st baryon
06880     evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
06881     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom); // Create a Hadron for the 2-nd baryon
06882     evaHV->push_back(H2);                 // Fill "H2" (delete equivalent)
06883     G4QHadron* H3 = new G4QHadron(tPDG,t4Mom); // Create a Hadron for the meson
06884     evaHV->push_back(H3);                 // Fill "H3" (delete equivalent)
06885   }
06886 #ifdef qdebug
06887   if (qH)
06888   {
06889     G4cout<<"G4QNucleus::DecayDiBaryon: deleted at end - PDG="<<qH->GetPDGCode()<<G4endl;
06890     delete qH;
06891   }
06892 #endif
06893 } // End of DecayAntiDibaryon
06894 
06895 //Decay of the nuclear states with antistrangeness (K:/K0)
06896 void G4QNucleus::DecayAntiStrange(G4QHadron* qH, G4QHadronVector* evaHV)
06897 {
06898   static const G4double mK    = G4QPDGCode(321).GetMass();
06899   static const G4double mK0   = G4QPDGCode(311).GetMass();
06900   static const G4double eps   = 0.003;
06901   G4LorentzVector q4M = qH->Get4Momentum();    // Get 4-mom of the AntiStrangeNuclearState
06902   G4double         qM = q4M.m();               // Real mass of the AntiStrangeNuclearState
06903   G4QContent       qQC= qH->GetQC();           // PDGCode of theDecayingAntiStrangeNuclSt.
06904   G4int            qS = qH->GetStrangeness();  // Strangness of the AntiStrangeNuclearState
06905   G4int            qB = qH->GetBaryonNumber(); // BaryonNumber of the AntiStrangeNuclearSt.
06906   G4int            qP = qH->GetCharge();       // Charge of the AntiStranNuclState (a#of p)
06907 #ifdef debug
06908   G4cout<<"G4QNuc::DecAntS:QC="<<qQC<<",S="<<qS<<",B="<<qB<<",C="<<qP<<",4M="<<q4M<<G4endl;
06909 #endif
06910   G4int            qN = qB-qP-qS;              // a#of neuterons
06911   if(qS>=0 || qB<1)
06912   {
06913     delete qH;
06914     // G4cerr<<"G4QNuc::DecayAntiStrange:QC="<<qQC<<",S="<<qS<<",B="<<qB<<",4M="<<q4M<<G4endl;
06915     // throw G4QException("G4QNucleus::DecayAntiStrange: not an Anti Strange Nucleus");
06916     G4ExceptionDescription ed;
06917     ed << "not an Anti Strange Nucleus: QC=" << qQC << ",S=" << qS << ",B="
06918        << qB << ",4M=" << q4M << G4endl;
06919     G4Exception("G4QNucleus::DecayAntiStrange()", "HAD_CHPS_0000",
06920                 FatalException, ed);
06921   }
06922   G4int n1=1;         // prototype of a#of K0's
06923   G4double k1M=mK0;
06924   G4int k1PDG=311;    // K0 (as a prototype)
06925   G4int n2=0;         // prototype of a#of K+'s
06926   G4double k2M=mK;
06927   G4int k2PDG=321;    // K+
06928   G4int aS=-qS;       // -Strangness = antistrangeness
06929   G4int sH=aS/2;     // a small half of the antistrangeness
06930   G4int bH=aS-sH;    // a big half to take into account all the antistrangeness
06931   if(qP>0 && qP>qN)  // a#of protons > a#of neutrons
06932   {
06933     if(qP>=bH)                       // => "Enough protons in nucleus" case
06934     {
06935       if(qN>=sH)
06936       {
06937         n1=sH;
06938         n2=bH;
06939       }
06940       else
06941       {
06942         G4int dPN=qP-qN;
06943         if(dPN>=aS)
06944         {
06945           n1=0;
06946           n2=aS;
06947         }
06948         else
06949         {
06950           G4int sS=(aS-dPN)/2;
06951           G4int bS=aS-dPN-sS;
06952           sS+=dPN;
06953           if(qP>=sS && qN>=bS)
06954           {
06955             n1=bS;
06956             n2=sS;
06957           }
06958           else if(qP<sS)
06959           {
06960             n1=aS-qP;
06961             n2=qP;
06962           }
06963           else
06964           {
06965             n1=qN;
06966             n2=aS-qN;
06967           }
06968         }
06969       }
06970     }
06971   }
06972   else if(qN>=bH)
06973   {
06974     if(qP>=sH)
06975     {
06976       n2=sH;
06977       n1=bH;
06978     }
06979     else
06980     {
06981       G4int dNP=qN-qP;
06982       if(dNP>=aS)
06983       {
06984         n1=aS;
06985         n2=0;
06986       }
06987       else
06988       {
06989         G4int sS=(aS-dNP)/2;
06990         G4int bS=aS-sS;
06991         if(qN>=bS && qP>=sS)
06992         {
06993           n1=bS;
06994           n2=sS;
06995         }
06996         else if(qN<bS)
06997         {
06998           n1=qN;
06999           n2=aS-qN;
07000         }
07001         else
07002         {
07003           n1=aS-qP;
07004           n2=qP;
07005         }
07006       }
07007     }
07008   }
07009   G4int qPDG=90000000+(qP-n2)*1000+(qN-n1);     // PDG of the Residual Nucleus
07010   G4double nucM = G4QNucleus(qPDG).GetGSMass(); // Mass of the Residual Nucleus
07011 #ifdef debug
07012   G4cout<<"G4QNucleus::DecayAnStran:nK0="<<n1<<",nK+="<<n2<<", nucM="<<nucM<<G4endl;
07013 #endif
07014   G4int m1=0;                        // prototype of a#of K0's
07015   G4int m2_value=qP;                 // prototype of a#of K+'s
07016   if(qP>=-qS)   m2_value=-qS;        // Enough charge for K+'s
07017   else if(qP>0) m1=-qS-qP;           // Anti-Lambdas are partially compensated by neutrons
07018   G4int sPDG=90000000+(qP-m2_value)*1000+(qN-m1); // PDG of the Residual Nucleus
07019   G4double mucM = G4QNucleus(sPDG).GetGSMass(); // Mass of the Residual Nucleus
07020   if(mucM+m1*mK+m2_value*mK0<nucM+n1*mK+n2*mK0) // New is smaller
07021   {
07022     qPDG=sPDG;
07023     nucM=mucM;
07024     n1=m1;
07025     n2=m2_value;
07026   }
07027 #ifdef debug
07028   G4cout<<"G4QNucleus::DecayAnStran: n1="<<n1<<", n2="<<n2<<", nM="<<nucM<<G4endl;
07029 #endif
07030   if(!n1||!n2)                            // AntiKaons of only one sort are found
07031   {
07032     if(!n1)                               // No K0's only K+'s
07033     {
07034       if(n2==1 && mK+nucM>qM+.0001)  // Mass limit: switch to K0
07035       {
07036         k1M=mK0;
07037         n1=1;
07038         qPDG=90000000+qP*1000+qN-1;       // PDG of the Residual Nucleus
07039         nucM = G4QNucleus(qPDG).GetGSMass(); // Mass of the Residual Nucleus
07040       }
07041       else
07042       {
07043         k1M=mK;
07044         k1PDG=321;                        // Only K+'s (default K0's)
07045         n1=n2;                            // only n1 is used
07046       }
07047     }
07048     else                                  // No K+'s only K0's
07049     {
07050       if(n1==1 && mK0+nucM>qM+.0001) // Mass limit: switch to K+
07051       {
07052         k1M=mK;
07053         k1PDG=321;                        // K+ instead of K0
07054         qPDG=90000000+(qP-1)*1000+qN;     // PDG of the Residual Nucleus
07055         nucM = G4QNucleus(qPDG).GetGSMass(); // Mass of the Residual Nucleus
07056       }
07057       else k1M=mK0;                      // Only anti-K0's (default k1PDG)
07058     }
07059 #ifdef debug
07060     G4int naPDG=90000000+(qP-1)*1000+qN; // Prot PDG of the Alternative Residual Nucleus
07061     G4double naM=G4QNucleus(naPDG).GetGSMass(); // Prot Mass of the Alt. Residual Nucleus
07062     G4double kaM=mK;                     // Prot Mass of the Alternative kaon (K+)
07063     if(k1PDG==321)                       // Calculate alternative to K+
07064     {
07065       naPDG=90000000+qP*1000+qN-1;       // PDG of the Alternative Residual Nucleus
07066       naM=G4QNucleus(naPDG).GetGSMass(); // Mass of the Alt. Residual Nucleus
07067       kaM=mK0;                           // Prot Mass of the Alternative kaon (K0)
07068     }
07069     G4cout<<"G4QNucleus::DecayAnStran:M="<<qM<<",kM="<<k1M<<"+nM="<<nucM<<"="<<k1M+nucM
07070           <<",m="<<kaM<<"+n="<<naM<<"="<<kaM+naM<<G4endl;
07071 #endif
07072     G4double n1M=n1*k1M;
07073     G4LorentzVector f4Mom(0.,0.,0.,n1M);
07074     G4LorentzVector s4Mom(0.,0.,0.,nucM);
07075     G4double sum=nucM+n1M;
07076     if(sum>qM+eps && n1==1)              // Try to use another K if this is the only kaon
07077     {
07078       G4int naPDG=90000000+(qP-1)*1000+qN; // Prot PDG of the Alternative Residual Nucleus
07079       G4double naM=G4QNucleus(naPDG).GetGSMass(); // Prot Mass of the Alt. Residual Nucleus
07080       G4int akPDG=321;                   // Prototype PDGCode of the AlternativeKaon (K+)
07081       G4double kaM=mK;                   // Prototype Mass of the AlternativeKaon (K+)
07082       if(k1PDG==321)                     // Calculate alternative to the K+ meson
07083       {
07084         naPDG=90000000+qP*1000+qN-1;     // PDG of the Alternative Residual Nucleus
07085         naM=G4QNucleus(naPDG).GetGSMass(); // Mass of the Alt. Residual Nucleus
07086         akPDG=311;                       // PDG Code of the Alternative kaon (K0)
07087         kaM=mK0;                         // Mass of the Alternative kaon (K0)
07088       }
07089       G4double asum=naM+kaM;
07090       if(asum<sum)                       // Make a KSwap correction
07091       {
07092         nucM=naM;
07093         n1M=kaM;
07094         k1M=kaM;
07095         k1PDG=akPDG;
07096         qPDG=naPDG;
07097         f4Mom=G4LorentzVector(0.,0.,0.,n1M);
07098         s4Mom=G4LorentzVector(0.,0.,0.,nucM);
07099       }
07100     }
07101     if(fabs(qM-sum)<eps)
07102     {
07103       f4Mom=q4M*(n1M/sum);
07104       s4Mom=q4M*(nucM/sum);
07105     }
07106     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07107     {
07108 #ifdef debug
07109       G4cout<<"--Warning--G4QNuc::DASt:AsItIs, H="<<qQC<<q4M<<qM<<" < sum="<<sum<<"=(F)"
07110             <<nucM<<"+(kK)"<<n1M<<G4endl;
07111 #endif
07112       evaHV->push_back(qH);  // @@ Can cause problems with particle conversion in G4
07113       return;
07114     }
07115 #ifdef debug
07116     G4cout<<"G4QNuc::DecAntiS: nK+N "<<n1<<"*K="<<k1PDG<<f4Mom<<",N="<<qPDG<<s4Mom<<G4endl;
07117 #endif
07118     delete qH;
07119     //
07120     f4Mom/=n1;
07121     for(G4int i1=0; i1<n1; i1++)
07122     {
07123       G4QHadron* H1 = new G4QHadron(k1PDG,f4Mom); // Create a Hadron for the Kaon
07124       evaHV->push_back(H1);                       // Fill "H1" (delete equivalent)
07125     }
07126     G4QHadron* H2 = new G4QHadron(qPDG,s4Mom);    // Create a Hadron for the Nucleus
07127     //evaHV->push_back(H2);                       // Fill "H2" (delete equivalent)
07128     EvaporateNucleus(H2,evaHV);                   // Fill "H2" (delete equivalent)
07129 #ifdef debug
07130     G4cout<<"G4QNucleus::DecAntiStr:*** After EvaporateNucleus nH="<<evaHV->size()<<G4endl;
07131 #endif
07132   }
07133   else
07134   {
07135     G4double n1M=n1*k1M;
07136     G4double n2M=n2*k2M;
07137     G4LorentzVector f4Mom(0.,0.,0.,n1M);
07138     G4LorentzVector s4Mom(0.,0.,0.,n2M);
07139     G4LorentzVector t4Mom(0.,0.,0.,nucM);
07140     G4double sum=nucM+n1M+n2M;
07141     if(fabs(qM-sum)<eps)
07142     {
07143       f4Mom=q4M*(n1M/sum);
07144       s4Mom=q4M*(n2M/sum);
07145       t4Mom=q4M*(nucM/sum);
07146     }
07147     else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
07148     {
07149       G4cout<<"---Warning---G4QN::DASt:nPDG="<<qPDG<<"(M="<<nucM<<")+1="<<k1PDG<<"(M="<<k1M
07150             <<")+2="<<k2PDG<<"(M="<<k2M<<")="<<nucM+n1*k1M+n2*k2M<<">tM="<<qM<<q4M<<G4endl;
07151       evaHV->push_back(qH); // @@ Can cause problems with particle conversion in G4
07152       return;
07153     }
07154 #ifdef debug
07155     G4cout<<"G4QNuc::DecAntiS:*DONE* nPDG="<<qPDG<<",1="<<f4Mom<<",2="<<s4Mom<<",n="<<t4Mom
07156           <<G4endl;
07157 #endif
07158     delete qH;
07159     //
07160     f4Mom/=n1;
07161     for(G4int i1=0; i1<n1; i1++)
07162     {
07163       G4QHadron* H1 = new G4QHadron(k1PDG,f4Mom); // Create a Hadron for the K0
07164       evaHV->push_back(H1);                       // Fill "H1" (delete equivalent)
07165     }
07166     s4Mom/=n2;
07167     for(G4int i2=0; i2<n2; i2++)
07168     {
07169       G4QHadron* H2 = new G4QHadron(k2PDG,s4Mom); // Create a Hadron for the K+
07170       evaHV->push_back(H2);                       // Fill "H2" (delete equivalent)
07171     }
07172     G4QHadron* H3 = new G4QHadron(qPDG,t4Mom);    // Create a Hadron for the nucleus
07173     //evaHV->push_back(H3);                       // Fill "H3" (delete equivalent)
07174     EvaporateNucleus(H3,evaHV);                   // Fill "H3" (delete equivalent)
07175   }
07176 #ifdef qdebug
07177   if (qH)
07178   {
07179     G4cout << "G4QNucleus::DecayAntiStrange: deleted at end - PDG: "
07180            << qH->GetPDGCode() << G4endl;
07181     delete qH;
07182   }
07183 #endif
07184 #ifdef debug
07185   G4cout<<"G4QNucleus::DecayAntiStrange: ===> End of DecayAntiStrangness"<<G4endl;
07186 #endif
07187 } // End of DecayAntiStrange
07188 
07189 //Decay of the excited 3p or 3n systems in three baryons
07190 void G4QNucleus::DecayMultyBaryon(G4QHadron* qH, G4QHadronVector* evaHV)
07191 {
07192   static const G4double mNeut= G4QPDGCode(2112).GetMass();
07193   static const G4double mProt= G4QPDGCode(2212).GetMass();
07194   static const G4double mLamb= G4QPDGCode(3122).GetMass();
07195   static const G4double eps=0.003;
07196   G4LorentzVector q4M = qH->Get4Momentum();       // Get 4-momentum of the MultyBaryon
07197   G4double         qM = q4M.m();                  // Mass of the Multybaryon
07198   G4int          qPDG = qH->GetPDGCode();         // PDG Code of the decaying multybar
07199   G4QContent      qQC = qH->GetQC();              // PDG Code of the decaying multibar
07200 #ifdef debug
07201   G4cout<<"G4QNuc::DecayMultyBaryon: *Called* PDG="<<qPDG<<",4M="<<q4M<<qQC<<G4endl;
07202 #endif
07203   G4int totS=qQC.GetStrangeness();  //  Total Strangeness       (L)                ^
07204   G4int totC=qQC.GetCharge();       //  Total Charge            (p)                ^
07205   G4int totBN=qQC.GetBaryonNumber();// Total Baryon Number      (A)                ^
07206   G4int totN=totBN-totS-totC;       // Total Number of Neutrons (n)                ^
07207   G4int          fPDG = 3122;       // Prototype for A lambdas case
07208   G4double       fMass= mLamb;
07209   if     (totN==totBN)              // "A-neutron" case
07210   {
07211     fPDG = 2112;
07212     fMass= mNeut;
07213   }
07214   else if(totC==totBN)              // "A-protons" case
07215   {
07216     fPDG = 2212;
07217     fMass= mProt;
07218   }
07219   else if(totS!=totBN)            // "Bad call" case
07220   {
07221     delete qH;
07222     // G4cerr<<"***G4QNuc::DecayMultyBaryon: PDG="<<qPDG<<G4endl;
07223     // throw G4QException("***G4QNuc::DecayMultyBaryon: Can not decay this PDG Code");
07224     G4ExceptionDescription ed;
07225     ed << "Can not decay this PDG Code: PDG=" << qPDG << G4endl;
07226     G4Exception("G4QNucleus::DecayMultyBaryon()", "HAD_CHPS_0000",
07227                 FatalException, ed);
07228   }
07229 #ifdef debug
07230   else
07231   {
07232     delete qH;
07233     // G4cerr<<"**G4QNucleus::DecayMultyBaryon: PDG="<<qPDG<<G4endl;
07234     // throw G4QException("***G4QNuc::DecayMultyBaryon: Unknown PDG code of the MultiBaryon");
07235     G4ExceptionDescription ed;
07236     ed << "Unknown PDG code of the MultiBaryon: PDG=" << qPDG << G4endl;
07237     G4Exception("G4QNucleus::DecayMultyBaryon()", "HAD_CHPS_0001",
07238                 FatalException, ed);
07239   }
07240 #endif
07241   if(totBN==1) evaHV->push_back(qH);
07242   else if(totBN==2)
07243   {
07244     G4LorentzVector f4Mom(0.,0.,0.,fMass);
07245     G4LorentzVector s4Mom(0.,0.,0.,fMass);
07246     G4double sum=fMass+fMass;
07247     if(fabs(qM-sum)<eps)
07248     {
07249       f4Mom=q4M/2.;
07250       s4Mom=f4Mom;
07251     }
07252     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07253     {
07254       G4cout<<"---Warning---G4QNucl::DecayMultyBar:fPDG="<<fPDG<<"(fM="<<fMass<<")*2="<<sum
07255             <<" > TotM="<<q4M.m()<<q4M<<G4endl;
07256       //G4cerr<<"***G4QNuc::DecayMultyBaryon:qM="<<qM<<"<sum="<<sum<<",d="<<sum-qM<<G4endl;
07257       //throw G4QException("G4QNuc::DecayMultyBaryon:diBaryon DecayIn2 didn't succeed");
07258       evaHV->push_back(qH);
07259       return;
07260     }
07261 #ifdef debug
07262     G4cout<<"G4QNucleus::DecMulBar:*DONE* fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<G4endl;
07263 #endif
07264     delete qH;
07265     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);   // Create a Hadron for the 1-st baryon
07266     evaHV->push_back(H1);                   // Fill "H1" (delete equivalent)
07267     G4QHadron* H2 = new G4QHadron(fPDG,s4Mom);   // Create a Hadron for the 2-nd baryon
07268     evaHV->push_back(H2);                   // Fill "H2" (delete equivalent)
07269   }
07270   else if(totBN==3)
07271   {
07272     G4LorentzVector f4Mom(0.,0.,0.,fMass);
07273     G4LorentzVector s4Mom(0.,0.,0.,fMass);
07274     G4LorentzVector t4Mom(0.,0.,0.,fMass);
07275     G4double sum=fMass+fMass+fMass;
07276     if(fabs(qM-sum)<eps)
07277     {
07278       f4Mom=q4M/3.;
07279       s4Mom=f4Mom;
07280       t4Mom=f4Mom;
07281     }
07282     else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
07283     {
07284       G4cout<<"---Warning---G4QNuc::DecayMultyBaryon: fPDG="<<fPDG<<"(fM="<<fMass<<")*3 = "
07285             <<3*fMass<<" >? TotM="<<q4M.m()<<q4M<<G4endl;
07286       //G4cerr<<"***G4QN::DecayMultyBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07287       //throw G4QException("G4QNucleus::DecayMultyBar:ThreeBaryonDecayIn3 didn't succeed");
07288       evaHV->push_back(qH);
07289       return;
07290     }
07291 #ifdef debug
07292     G4cout<<"G4QNuc::DecMBar:*DONE*, fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<",t="
07293           <<t4Mom<<G4endl;
07294 #endif
07295     delete qH;
07296     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);   // Create a Hadron for the 1-st baryon
07297     evaHV->push_back(H1);                   // Fill "H1" (delete equivalent)
07298     G4QHadron* H2 = new G4QHadron(fPDG,s4Mom);   // Create a Hadron for the 2-nd baryon
07299     evaHV->push_back(H2);                   // Fill "H2" (delete equivalent)
07300     G4QHadron* H3 = new G4QHadron(fPDG,t4Mom);   // Create a Hadron for the 3-d baryon
07301     evaHV->push_back(H3);                   // Fill "H3" (delete equivalent)
07302   }
07303   else
07304   {
07305     // @@It must be checked, that they are not under the mass shell
07306     // !! OK !! Checked by the warning print that they are mostly in the Ground State !!
07307     G4LorentzVector f4Mom=q4M/totBN; // @@ Too simple solution (split in two parts!)
07308 #ifdef debug
07309     // Warning for the future development
07310     G4cout<<"*G4QNul::DecMulBar:SplitMultiBar inEqParts M="<<totBN<<"*"<<f4Mom.m()<<G4endl;
07311     G4cout<<"G4QNucleus::DecMultyBaryon: *DONE* fPDG="<<fPDG<<", f="<<f4Mom<<G4endl;
07312 #endif
07313     delete qH;
07314     for(G4int h=0; h<totBN; h++)
07315     {
07316       G4QHadron* H1 = new G4QHadron(fPDG,f4Mom); // Create a Hadron for the baryon
07317       evaHV->push_back(H1);                 // Fill "H1" (delete equivalent)
07318     }
07319   }
07320 #ifdef qdebug
07321   if (qH)
07322   {
07323     G4cout << "G4QNucleus::DecayMultyBaryon: deleted at end - PDG: "
07324            << qH->GetPDGCode() << G4endl;
07325     delete qH;
07326   }
07327 #endif
07328 } // End of DecayMultyBaryon
07329 
07330 //Decay of the excited alpha+2p or alpha+2n systems
07331 void G4QNucleus::DecayAlphaDiN(G4QHadron* qH, G4QHadronVector* evaHV)
07332 {
07333   static const G4double mNeut= G4QPDGCode(2112).GetMass();
07334   static const G4double mProt= G4QPDGCode(2212).GetMass();
07335   static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
07336   static const G4double mHel6= G4QPDGCode(2112).GetNuclMass(2,4,0);
07337   static const G4double eps=0.003;
07338   G4LorentzVector q4M = qH->Get4Momentum();      // Get 4-momentum of the AlphaDibaryon
07339   G4double         qM = q4M.m();                 // Real mass of the AlphaDibaryon
07340   G4int          qPDG = qH->GetPDGCode();        // PDG Code of the decayin AlphaDybaryon
07341 #ifdef debug
07342   G4cout<<"G4QNuc::DecayAlphaDiN: *Called* PDG="<<qPDG<<",4M="<<q4M<<G4endl;
07343 #endif
07344   G4int          fPDG = 2212;                    // Prototype for alpha+pp case
07345   G4double       fMass= mProt;
07346   G4int          sPDG = 90002002;
07347   G4double       sMass= mAlph;
07348   if     (qPDG==90002004)                        // "alpha+2neutrons" case
07349   {
07350     if(fabs(qM-mHel6)<eps)
07351     {
07352       evaHV->push_back(qH);                 // Fill as it is (delete equivalent)
07353       return;
07354     }
07355     else if(mNeut+mNeut+mAlph<qM)
07356     {
07357       fPDG = 2112;
07358       fMass= mNeut;
07359     }
07360     else
07361     {
07362       delete qH;
07363       // G4cerr<<"***G4QNu::DecAlDiN:M(He6="<<mHel6<<")="<<qM<<"<"<<mNeut+mNeut+mAlph<<G4endl;
07364       // throw G4QException("G4QNuc::DecayAlphaDiN: Cannot decay excited He6 with this mass");
07365       G4ExceptionDescription ed;
07366       ed << "Cannot decay excited He6 with this mass: M(He6=" << mHel6 << ")="
07367          << qM << "<" << mNeut+mNeut+mAlph << G4endl;
07368       G4Exception("G4QNucleus::DecayAlphaDiN()", "HAD_CHPS_0000",
07369                   FatalException, ed);
07370     }
07371   }
07372   else if(qPDG!=90004002)                         // "Bad call" case
07373   {
07374     delete qH;
07375     // G4cerr<<"***G4QNuc::DecayAlphaDiN: PDG="<<qPDG<<G4endl;
07376     // throw G4QException("G4QNuc::DecayAlphaDiN: Can not decay this PDG Code");
07377     G4ExceptionDescription ed;
07378     ed << "Can not decay this PDG Code: PDG=" << qPDG << G4endl;
07379     G4Exception("G4QNucleus::DecayAlphaDiN()", "HAD_CHPS_0001",
07380                 FatalException, ed);
07381   }
07382   G4LorentzVector f4Mom(0.,0.,0.,fMass);
07383   G4LorentzVector s4Mom(0.,0.,0.,fMass);
07384   G4LorentzVector t4Mom(0.,0.,0.,sMass);
07385   G4double sum=fMass+fMass+sMass;
07386   if(fabs(qM-sum)<eps)
07387   {
07388     f4Mom=q4M*(fMass/sum);
07389     s4Mom=f4Mom;
07390     t4Mom=q4M*(sMass/sum);
07391   }
07392   else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
07393   {
07394     G4cout<<"---Warning---G4QNuc::DecayAlphaDiN:fPDG="<<fPDG<<"(M="<<fMass<<")*2+mAlpha = "
07395           <<sum<<" >? TotM="<<qM<<q4M<<", d="<<sum-qM<<G4endl;
07396     //G4cerr<<"***G4QNuc::DecayAlphaDiN: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07397     //throw G4QException("G4QNuc::DecayAlphaDiN: Alpha+N+N DecayIn3 error");
07398     evaHV->push_back(qH);
07399     return;
07400   }
07401 #ifdef debug
07402   G4cout<<"G4QNuc::DecAl2N: fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<",t="<<t4Mom<<G4endl;
07403 #endif
07404   delete qH;
07405   G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);    // Create a Hadron for the 1-st baryon
07406   evaHV->push_back(H1);                    // Fill "H1" (delete equivalent)
07407   G4QHadron* H2 = new G4QHadron(fPDG,s4Mom);    // Create a Hadron for the 2-nd baryon
07408   evaHV->push_back(H2);                    // Fill "H2" (delete equivalent)
07409   G4QHadron* H3 = new G4QHadron(sPDG,t4Mom);    // Create a Hadron for the alpha
07410   evaHV->push_back(H3);                    // Fill "H3" (delete equivalent)
07411 } // End of DecayAlphaDiN
07412 
07413 //Decay of the excited alpha+bayon state in alpha and baryons
07414 void G4QNucleus::DecayAlphaBar(G4QHadron* qH, G4QHadronVector* evaHV)
07415 {
07416   static const G4double mNeut= G4QPDGCode(2112).GetMass();
07417   static const G4double mProt= G4QPDGCode(2212).GetMass();
07418   static const G4double mLamb= G4QPDGCode(3122).GetMass();
07419   static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
07420   static const G4double mTrit= G4QPDGCode(2112).GetNuclMass(1,2,0);
07421   static const G4double mHe3 = G4QPDGCode(2112).GetNuclMass(2,1,0);
07422   static const G4double eps=0.003;
07423   G4LorentzVector q4M = qH->Get4Momentum();     // Get 4-momentum of the Alpha-Baryon
07424   G4double         qM = q4M.m();                // Mass of Alpha-Baryon
07425   G4int          qPDG = qH->GetPDGCode();       // PDG Code of the decayin Alpha-Baryon
07426   G4QContent      qQC = qH->GetQC();            // PDG Code of the decaying Alpha-Bar
07427 #ifdef debug
07428   G4cout<<"G4QNucleus::DecayAlphaBar: *Called* PDG="<<qPDG<<",4M="<<q4M<<qQC<<G4endl;
07429 #endif
07430   G4int totS=qQC.GetStrangeness();              //  Total Strangeness       (L)
07431   G4int totC=qQC.GetCharge();                   //  Total Charge            (p)
07432   G4int totBN=qQC.GetBaryonNumber();            // Total Baryon Number      (A)
07433 
07434   if ( ( (!totS && !totC) || totC == totBN || totS == totBN) 
07435        && totBN > 1) DecayMultyBaryon(qH,evaHV);
07436   else if(qPDG==92001002||qPDG==92002001||qPDG==91003001||qPDG==91001003||qPDG==93001001)
07437     evaHV->push_back(qH);
07438   else if(qPDG==92000003||qPDG==92003000||qPDG==93000002||qPDG==93002000)
07439   {
07440     G4int          fPDG = 3122;                 // 1st Prototype for 2L+3n case
07441     G4double       fMass= mLamb;
07442     G4int          sPDG = 2112;
07443     G4double       sMass= mNeut;
07444     if     (qPDG==92003000)                     // "2L+3p" case
07445     {
07446       sPDG = 2212;
07447       sMass= mProt;
07448     }
07449     else if(qPDG==93000002)                     // "2n+3L" case
07450     {
07451       fPDG = 2112;
07452       fMass= mNeut;
07453       sPDG = 3122;
07454       sMass= mLamb;
07455     }
07456     else if(qPDG==93002000)                     // "2p+3L" case
07457     {
07458       fPDG = 2212;
07459       fMass= mProt;
07460       sPDG = 3122;
07461       sMass= mLamb;
07462     }
07463     G4double tfM=fMass+fMass;
07464     G4double tsM=sMass+sMass+sMass;
07465     G4LorentzVector f4Mom(0.,0.,0.,tfM);
07466     G4LorentzVector s4Mom(0.,0.,0.,tsM);
07467     G4double sum=tfM+tsM;
07468     if(fabs(qM-sum)<eps)
07469     {
07470       f4Mom=q4M*(tfM/sum);
07471       s4Mom=q4M*(tsM/sum);
07472     }
07473     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07474     {
07475       G4cout<<"--Warning--G4QNuc::DecAlB:fPDG="<<fPDG<<"(M="<<fMass<<")*2="<<2*fMass<<",s="
07476             <<sPDG<<"(sM="<<sMass<<")*3="<<3*sMass<<"="<<sum<<">M="<<q4M.m()<<q4M<<G4endl;
07477       //G4cerr<<"***G4QN::DecayAlphaBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07478       //throw G4QException("G4QNucleus::DecayAlphaBar: DecayIn2 didn't succeed for 3/2");
07479       evaHV->push_back(qH);
07480       return;
07481     }
07482 #ifdef debug
07483     G4cout<<"G4QNucleus::DecAlB:*DONE*, fPDG="<<fPDG<<f4Mom<<",sPDG="<<sPDG<<s4Mom<<G4endl;
07484 #endif
07485     delete qH;
07486     G4LorentzVector rf4Mom=f4Mom/2;
07487     G4QHadron* H1 = new G4QHadron(fPDG,rf4Mom); // Create a Hadron for the 1-st baryon
07488     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07489     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07490     G4LorentzVector rs4Mom=s4Mom/3;
07491     G4QHadron* H2 = new G4QHadron(sPDG,rs4Mom); // Create a Hadron for the 2-nd baryon
07492     evaHV->push_back(H2);                  // Fill "H2" (delete equivalent)
07493     evaHV->push_back(H2);                  // Fill "H2" (delete equivalent)
07494     evaHV->push_back(H2);                  // Fill "H2" (delete equivalent)
07495   }
07496   else if(qPDG==90004001||qPDG==90001004)
07497   {
07498     G4int          fPDG = 90002001;             // Prototype for "He3+2p" case
07499     G4double       fMass= mHe3;
07500     G4int          sPDG = 2212;
07501     G4double       sMass= mProt;
07502     if     (qPDG==90001004)                     // "t+2n" case
07503     {
07504       fPDG = 90001002;
07505       fMass= mTrit;
07506       sPDG = 2112;
07507       sMass= mNeut;
07508     }
07509     G4LorentzVector f4Mom(0.,0.,0.,fMass);
07510     G4LorentzVector s4Mom(0.,0.,0.,sMass);
07511     G4LorentzVector t4Mom(0.,0.,0.,sMass);
07512     G4double sum=fMass+sMass+sMass;
07513     if(fabs(qM-sum)<eps)
07514     {
07515       f4Mom=q4M*(fMass/sum);
07516       s4Mom=q4M*(sMass/sum);
07517       t4Mom=s4Mom;
07518     }
07519     else if(qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom))
07520     {
07521       G4cout<<"--Warning--G4QNuc::DecAlB:fPDG="<<fPDG<<",M="<<fMass<<",sPDG="<<sPDG<<",sM="
07522             <<sMass<<",2sM+fM="<<2*sMass+fMass<<" > TotM="<<q4M.m()<<q4M<<G4endl;
07523       //G4cerr<<"*G4QNuc::DecayAlphaBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07524       //throw G4QException("G4QNucleus::DecayAlphaBar: t/nn,He3/pp DecayIn3 didn't");
07525       evaHV->push_back(qH);
07526       return;
07527     }
07528 #ifdef debug
07529     G4cout<<"G4QNucl::DecAlB: *DONE*, f="<<fPDG<<f4Mom<<", s="<<sPDG<<s4Mom<<t4Mom<<G4endl;
07530 #endif
07531     delete qH;
07532     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);   // Create a Hadron for the 1-st baryon
07533     evaHV->push_back(H1);                   // Fill "H1" (delete equivalent)
07534     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom);   // Create a Hadron for the 2-nd baryon
07535     evaHV->push_back(H2);                   // Fill "H2" (delete equivalent)
07536     G4QHadron* H3 = new G4QHadron(sPDG,t4Mom);   // Create a Hadron for the 3-d baryon
07537     evaHV->push_back(H3);                   // Fill "H3" (delete equivalent)
07538   }
07539   else if(qPDG==94000001||qPDG==94001000||qPDG==91000004||qPDG==91004000)
07540   {
07541     G4int          fPDG = 3122;                 // Prototype for "4L+n" case
07542     G4double       fMass= mLamb+mLamb;
07543     G4int          sPDG = 2112;
07544     G4double       sMass= mNeut;
07545     if     (qPDG==94001000)                     // "4L+p" case
07546     {
07547       sPDG = 2212;
07548       sMass= mProt;
07549     }
07550     else if(qPDG==91000004)                     // "4n+L" case
07551     {
07552       fPDG = 2112;
07553       fMass= mNeut+mNeut;
07554       sPDG = 3122;
07555       sMass= mLamb;
07556     }
07557     else if(qPDG==91004000)                     // "4p+L" case
07558     {
07559       fPDG = 2212;
07560       fMass= mProt+mProt;
07561       sPDG = 3122;
07562       sMass= mLamb;
07563     }
07564     G4LorentzVector f4Mom(0.,0.,0.,fMass+fMass);
07565     G4LorentzVector s4Mom(0.,0.,0.,sMass);
07566     G4double sum=fMass+fMass+sMass;
07567     if(fabs(qM-sum)<eps)
07568     {
07569       f4Mom=q4M*((fMass+fMass)/sum);
07570       s4Mom=q4M*(sMass/sum);
07571     }
07572     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07573     {
07574       G4cout<<"--Warning--G4QNucl::DecAlphBar:fPDG="<<fPDG<<"(2*fM="<<fMass<<")*2="
07575             <<2*fMass<<",sPDG="<<sPDG<<"(sM="<<sMass<<" > TotM="<<q4M.m()<<q4M<<G4endl;
07576       //G4cerr<<"*G4QNuc::DecayAlphaBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07577       //throw G4QException("G4QNucl::DecayAlphaBar:QuintBaryon DecayIn2 didn't succeed");
07578       evaHV->push_back(qH);
07579       return;
07580     }
07581 #ifdef debug
07582     G4cout<<"G4QNuc::DecAlphaB: *DONE*, fPDG="<<fPDG<<f4Mom<<",sPDG="<<sPDG<<s4Mom<<G4endl;
07583 #endif
07584     delete qH;
07585     G4LorentzVector rf4Mom=f4Mom/4;
07586     G4QHadron* H1 = new G4QHadron(fPDG,rf4Mom); // Create a Hadron for the 1-st baryon
07587     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07588     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07589     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07590     evaHV->push_back(H1);                  // Fill "H1" (delete equivalent)
07591     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom);  // Create a Hadron for the 2-nd baryon
07592     evaHV->push_back(H2);                  // Fill "H2" (delete equivalent)
07593   }
07594   else if(qPDG==90003002||qPDG==90002003||qPDG==91002002)
07595   {
07596     G4int          fPDG = 90002002;             // Prototype for "alpha+n" case
07597     G4int          sPDG = 2112;
07598     G4double       fMass= mAlph;
07599     G4double       sMass= mNeut;
07600     if(qPDG==90003002)                          // "alpha+p" case
07601     {
07602       sPDG = 2212;
07603       sMass= mProt;    
07604     }
07605     else if(qPDG==9100202)                      // "alpha+l" case
07606     {
07607       sPDG = 3122;
07608       sMass= mLamb;    
07609     }
07610     else if(qPDG!=90002003)
07611     {
07612       evaHV->push_back(qH);                     // Fill hadron as it is (delete equivalent)
07613       //EvaporateNucleus(qH, evaHV);            // Evaporate Nucleus (delete equivivalent)
07614       return;
07615     }
07616     G4double dM=fMass+sMass-qM;
07617     if(dM>0.&&dM<1.)
07618     {
07619 #ifdef debug
07620       G4cout<<"***Corrected***G4QNuc::DecayAlphaBar:fPDG="<<fPDG<<"(fM="<<fMass<<")+ sPDG="
07621             <<sPDG<<"(sM="<<sMass<<")="<<fMass+sMass<<" > TotM="<<qM<<q4M<<G4endl;
07622 #endif
07623       G4double hdM=dM/2;
07624       fMass-=hdM;
07625       sMass-=hdM;
07626     }
07627     G4LorentzVector f4Mom(0.,0.,0.,fMass);
07628     G4LorentzVector s4Mom(0.,0.,0.,sMass);      // Mass is random since probab. time
07629     G4double sum=fMass+sMass;
07630     if(fabs(qM-sum)<eps)
07631     {
07632       f4Mom=q4M*(fMass/sum);
07633       s4Mom=q4M*(sMass/sum);
07634     }
07635     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07636     {
07637       G4cout<<"--Warning--G4QNuc::DecAlphaBar:fPDG="<<fPDG<<"(fM="<<fMass<<")+sPDG="<<sPDG
07638             <<"(sM="<<sMass<<")="<<fMass+sMass<<"="<<sum<<" > TotM="<<q4M.m()<<q4M<<G4endl;
07639       //G4cout<<"*G4QNuc::DecayAlphaBar: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07640       //throw G4QException("***G4QNucl::DecayAlphaBar:Alpha+Baryon DecIn2 didn't succeed");
07641       evaHV->push_back(qH);
07642       return;
07643     }
07644 #ifdef debug
07645     G4cout<<"G4QNucl::DecAlBar:*DONE*a4M="<<f4Mom<<",s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
07646 #endif
07647     delete qH;
07648     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);      // Create a Hadron for the alpha
07649     evaHV->push_back(H1);                      // Fill "H1" (delete equivalent)
07650     G4QHadron* H2 = new G4QHadron(sPDG,s4Mom);      // Create a Hadron for the baryon
07651     evaHV->push_back(H2);                      // Fill "H2" (delete equivalent)
07652   }
07653   else G4cout<<"---Warning---G4QNucleus::DecayAlphaBar: Unknown PDG="<<qPDG<<G4endl;
07654 #ifdef qdebug
07655   if (qH)
07656   {
07657     G4cout << "G4QNucleus::DecayAlphaBar: deleted at end - PDG: "
07658            << qH->GetPDGCode() << G4endl;
07659     delete qH;
07660   }
07661 #endif
07662 } // End of DecayAlphaBar
07663 
07664 //Decay of the excited alpha+alpha state in 2 alphas
07665 void G4QNucleus::DecayAlphaAlpha(G4QHadron* qH, G4QHadronVector* evaHV)
07666 {
07667   static const G4double mAlph= G4QPDGCode(2112).GetNuclMass(2,2,0);
07668   static const G4double aaGSM= G4QPDGCode(2112).GetNuclMass(4,4,0);
07669   static const G4double eps=0.003;
07670   G4int          qPDG = qH->GetPDGCode();         // PDG Code of the decayin dialpha
07671   if(qPDG!=90004004)
07672   {
07673     delete qH;
07674     // G4cerr<<"***G4QNucleus::DecayAlphaAlpha: qPDG="<<qPDG<<G4endl;
07675     // throw G4QException("***G4QNucleus::DecayAlphaAlpha: Not Be8 state decais in 2 alphas");
07676     G4ExceptionDescription ed;
07677     ed << "Not Be8 state decais in 2 alphas: qPDG=" << qPDG << G4endl;
07678     G4Exception("G4QNucleus::DecayAlphaAlpha()", "HAD_CHPS_0000",
07679                 FatalException, ed);
07680   }
07681   G4LorentzVector q4M = qH->Get4Momentum();       // Get 4-momentum of the Dibaryon
07682   G4double qM=q4M.m();
07683 #ifdef debug
07684   G4cout<<"G4QNucleus::DecayAlAl: *Called* PDG="<<qPDG<<",M="<<qM<<q4M<<">"<<aaGSM<<G4endl;
07685 #endif
07686   //if(qM>aaGSM+.01)  // @@ Be8*->gamma+Be8 (as in evaporation) @@ gamma cooling
07687   if(2>3)
07688   {
07689     G4int          fPDG = 22;
07690     G4int          sPDG = 90004004;
07691     G4double       fMass= 0.;
07692     G4double       sMass= aaGSM;
07693     G4LorentzVector f4Mom(0.,0.,0.,fMass);
07694     G4LorentzVector s4Mom(0.,0.,0.,sMass);          // Mass is random since probab. time
07695     G4double sum=fMass+sMass;
07696     if(fabs(qM-sum)<eps)
07697     {
07698       f4Mom=q4M*(fMass/sum);
07699       s4Mom=q4M*(sMass/sum);
07700     }
07701     else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07702     {
07703       G4cout<<"---Warning---G4QNuc::DecayAlphaAlpha:gPDG="<<fPDG<<"(gM="<<fMass<<")+PDG="
07704             <<sPDG<<"(sM="<<sMass<<")="<<sum<<" > TotM="<<q4M.m()<<q4M<<G4endl;
07705       //G4cerr<<"***G4QNuc::DecayAlphAlph: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07706       //throw G4QException("G4QNucleus::DecayAlphaAlpha:g+diAlph DecayIn2 didn't succeed");
07707       evaHV->push_back(qH);
07708       return;
07709     }
07710 #ifdef debug
07711     G4cout<<"G4QNucleus::DecayAlphaAlpha: *DONE* gam4M="<<f4Mom<<", aa4M="<<s4Mom<<G4endl;
07712 #endif
07713     G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);      // Create a Hadron for the 1-st alpha
07714     evaHV->push_back(H1);                      // Fill "H1" (delete equivalent)
07715     qH->Set4Momentum(s4Mom);
07716     q4M=s4Mom;
07717   }
07718   G4int          fPDG = 90002002;
07719   G4int          sPDG = 90002002;
07720   G4double       fMass= mAlph;
07721   G4LorentzVector f4Mom(0.,0.,0.,fMass);
07722   G4LorentzVector s4Mom(0.,0.,0.,fMass);
07723   G4double sum=fMass+fMass;
07724   if(fabs(qM-sum)<eps)
07725   {
07726     f4Mom=q4M*(fMass/sum);
07727     s4Mom=f4Mom;
07728   }
07729   else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
07730   {
07731     G4cout<<"---Warning---G4QNucl::DecayAlphaAlpha:fPDG="<<fPDG<<"(fM="<<fMass<<")*2="<<sum
07732           <<" > TotM="<<q4M.m()<<q4M<<G4endl;
07733     //G4cerr<<"***G4QNuc::DecayAlphAlph: qM="<<qM<<" < sum="<<sum<<",d="<<sum-qM<<G4endl;
07734     //throw G4QException("G4QNucleus::DecayAlphaAlpha: diAlpha DecayIn2 didn't succeed");
07735     evaHV->push_back(qH);
07736     return;
07737   }
07738 #ifdef debug
07739   G4cout<<"G4QNucleus::DecayAlphaAlpha: *DONE* fal4M="<<f4Mom<<", sal4M="<<s4Mom<<G4endl;
07740 #endif
07741   delete qH;
07742   G4QHadron* H1 = new G4QHadron(fPDG,f4Mom);      // Create a Hadron for the 1-st alpha
07743   evaHV->push_back(H1);                      // Fill "H1" (delete equivalent)
07744   G4QHadron* H2 = new G4QHadron(sPDG,s4Mom);      // Create a Hadron for the 2-nd alpha
07745   evaHV->push_back(H2);                      // Fill "H2" (delete equivalent)
07746 } // End of DecayAlphaAlpha

Generated on Mon May 27 17:49:38 2013 for Geant4 by  doxygen 1.4.7