Ignore:
Timestamp:
Nov 25, 2009, 5:13:58 PM (15 years ago)
Author:
garnier
Message:

update CVS release candidate geant4.9.3.01

Location:
trunk/source/processes/hadronic/models/chiral_inv_phase_space/body
Files:
52 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/GNUmakefile

    r819 r1196  
    1414            -I$(G4BASE)/global/HEPRandom/include \
    1515            -I$(G4BASE)/global/HEPGeometry/include \
    16             -I$(G4BASE)/track/include \
    17             -I$(G4BASE)/geometry/volumes/include \
    18             -I$(G4BASE)/geometry/management/include \
    19             -I$(G4BASE)/processes/management/include \
    20             -I$(G4BASE)/processes/hadronic/management/include/ \
    21             -I$(G4BASE)/processes/hadronic/util/include \
    22             -I$(G4BASE)/processes/hadronic/cross_sections/include/ \
    23             -I$(G4BASE)/processes/hadronic/models/generator/util/include \
    2416            -I$(G4BASE)/particles/management/include \
    2517            -I$(G4BASE)/particles/leptons/include \
     
    2921            -I$(G4BASE)/particles/hadrons/barions/include \
    3022            -I$(G4BASE)/particles/hadrons/ions/include \
    31             -I$(G4BASE)/materials/include
    3223           
    3324include $(G4INSTALL)/config/common.gmk
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/History

    r1055 r1196  
    1717     -----------------------------------------------------------------
    1818
     1917-Nov-2009 M.Kosov                            (hadr-chips-V09-02-24)
     20-----------------------------------------------------------------------
     21Mutual tag: Migration of CHIPS-cross_section depenent files to CHIPS-xs_dep
     22
     2316-Nov-2009 M.Kosov                            (hadr-chips-V09-02-23)
     24-----------------------------------------------------------------------
     25Mutual tag: Split up of CHIPS-body in three directories -> this
     26
     2713-Nov-2009 M.Kosov                            (hadr-chips-V09-02-21)
     28-----------------------------------------------------------------------
     29Mutual tag: G4QDiffractionRatio lost dependence on G4QElasticCrossSection
     30
     3112-Nov-2009 M.Kosov                            (hadr-chips-V09-02-20)
     32-----------------------------------------------------------------------
     33Mutual tag: bug fix in G4QDiffractionRatio (tested by Valgrind)
     34
     3510-Nov-2009 M.Kosov                            (hadr-chips-V09-02-18)
     36-----------------------------------------------------------------------
     37Mutual tag: Diffraction is added to CHIPS inelastic
     38
     395-Nov-2009 M.Kosov                             (hadr-chips-V09-02-17)
     40-----------------------------------------------------------------------
     41Mutual tag: Bug fix in XS's & migration of G4QNeutronCaptureRatio from
     42            body to interface
     43
     444-Nov-2009 M.Kosov                             (hadr-chips-V09-02-16)
     45-----------------------------------------------------------------------
     46Mutual tag: Thanks to Andrea bug fix (skip for Z=0,A=0 residual nucleus)
     47            in G4QCollision class
     48
     494-Nov-2009 M.Kosov                             (hadr-chips-V09-02-15)
     50-----------------------------------------------------------------------
     51Mutual tag: Reduction of the CHIPS-body dependency + G4QNucleus bug fix
     52
     5330-Oct-2009 M.Kosov                             (hadr-chips-V09-02-13)
     54-----------------------------------------------------------------------
     55Mutual CHIPS tag for new CHIPS hA cross-sections
     56- 8 new CHIPS cross-sectopn classes are added + bug is fixed in the CHIPS
     57  pA cross_sections + pimA XS class is not fake now, but real
     58
     5923-Oct-2009 M.Kosov                             (hadr-chips-V09-02-12)
     60-----------------------------------------------------------------------
     61Mutual CHIPS tag for the bug fix + G4QuasiFreeRatio change (needs make clean)
     62
     6323-Oct-2009 M.Kosov                         (hadr-chips-body-V09-02-15)
     64----------------------------------------------------------------------
     65In the G4QuasiFreeRatio class a poblic method GetElTotXS is made for
     66the G4GGNuclNuclCrossSection, G4GlauberGribovCrossSection, and
     67G4HadronNucleonXsc classes of the hadronic/cross_sections directory
     68to calculate the CHIPS hN parameterization without tripled duplication.
     69But there exist a similar FetchElTot method, which is automatically cashing
     70the cross-sections and works faster.
     71
     7212-Oct-2009 M.Kosov                             (hadr-chips-V09-02-11)
     73-----------------------------------------------------------------------
     74Mutual CHIPS tag for the bug fixes (mostly body)
     75
     7625-Sep-2009 M.Kosov                         (hadr-chips-body-V09-02-14)
     77----------------------------------------------------------------------
     78A few more bug fixes for E/M conservation
     79
     8018-Sep-2009 M.Kosov                             (hadr-chips-V09-02-10)
     81-----------------------------------------------------------------------
     82Mutual CHIPS tag for the heavy fragments in LowEnergy (mostly body)
     83
     848-Sep-2009 M.Kosov                              (hadr-chips-V09-02-09)
     85-----------------------------------------------------------------------
     86Mutual CHIPS tag for the hadron+proton improvement (mostly body)
     87
     882-Sep-2009 M.Kosov                              (hadr-chips-V09-02-08)
     89-----------------------------------------------------------------------
     90Mutual CHIPS tag for the first prototype of the CHIPS Ion-Ion Inelastic
     91
     9228-Aug-2009 M.Kosov                              (hadr-chips-V09-02-07)
     93-----------------------------------------------------------------------
     94Mutual CHIPS tag for the Valgrind induced improvement
     95
     9621-Aug-2009 M.Kosov                              (hadr-chips-V09-02-06)
     97-----------------------------------------------------------------------
     98Mutual CHIPS tag for added photon- and lepton-nuclear CHIPS inelastic
     99
     10010-Aug-2009 M.Kosov                         (hadr-chips-body-V09-02-13)
     101----------------------------------------------------------------------
     102Improved to work for all targets, including Hydrogen
     103
     1047-Aug-2009 M.Kosov                               (hadr-chips-V09-02-05)
     105-----------------------------------------------------------------------
     106Mutual CHIPS tag for All-Energies-All-Hadrons pilot tag
     107
     1085-Aug-2009 M.Kosov                          (hadr-chips-body-V09-02-12)
     109----------------------------------------------------------------------
     110Bug fix: quasielastic is closed for photons and leptons
     111
     1125-Aug-2009 M.Kosov                          (hadr-chips-body-V09-02-11)
     113-----------------------------------------------------------------------
     114Bug fix: noninitialized variabkles in G4QContent class
     115
     1165-Aug-2009 M.Kosov                               (hadr-chips-V09-02-04)
     117-----------------------------------------------------------------------
     118Mutual CHIPS tag for All-Energies-Nucleons and -Mesons (only pi+/- & K-)
     119
     1205-Aug-2009 M.Kosov                               (hadr-chips-V09-02-03)
     121-----------------------------------------------------------------------
     122Migration of the rest of the XS from interface to body and exclusion of the
     123dependency of the G4NucleiPropertiesTable class (absolete by Hisaya)
     124
     1255-Aug-2009 M.Kosov                              (hadr-chips-body-V09-02-10)
     126-----------------------------------------------------------------------
     127Necesary line was closed by the debug flag in G4QFragmentation.
     128Warning of "leave ASIS" for the Resonance decay is closed in G4Quasmon
     129Charge of the electron is corrected in G4QPDGCode.
     130
     1314-Aug-2009 M.Kosov                              (hadr-chips-body-V09-02-09)
     132-----------------------------------------------------------------------
     133Fast fix of brackets around && to avoid warnings
     134
     13531-Jul-2009 M.Kosov                              (hadr-chips-V09-02-02)
     136-----------------------------------------------------------------------
     137Creation of the beta-version of CHIPS, covering all energies (mutual CHIPS tag)
     138
     1392-Jul-2009 M.Kosov                              (hadr-chips-body-V09-02-08)
     140----------------------------------------------------------------------------
     141Everywhere in the CHIPS the internal RndmDir() is replaced by the general
     142G4RandomDirection().
     143
     14430-Jun-2009 M.Kosov                              (hadr-chips-body-V09-02-07)
     145----------------------------------------------------------------------------
     146Safety correction of the sqrt(neg.val.) in G4QNucleus + internal development
     147of the pion production in CHIPS (preliminary, do not influence the other
     148applications).
    19149
    2015026-May-2009 M.Kosov                              (hadr-chips-body-V09-02-06)
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Chips.hh

    r1007 r1196  
    2626//
    2727// $Id: G4Chips.hh,v 1.19 2006/06/29 20:05:53 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4Chips ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QBesIKJY.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QBesIKJY.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QBesIKJY ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCHIPSWorld.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QCHIPSWorld.hh,v 1.26 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCHIPSWorld ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidate.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QCandidate.hh,v 1.29 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidate ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidateVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QCandidateVector.hh,v 1.22 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QChipolino.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QChipolino.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QChipolino ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QContent.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QContent.hh,v 1.29 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QContent.hh,v 1.31 2009/07/24 16:37:03 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QContent ----------------
     
    5555public:
    5656  G4QContent(G4int d=0, G4int u=0, G4int s=0, G4int ad=0, G4int au=0, G4int as=0);
     57  G4QContent(std::pair<G4int,G4int> PP); // Create HadronQC from two partons
    5758  G4QContent(const G4QContent& rhs);     // Copy constructor by value
    5859  G4QContent(G4QContent* rhs);           // Copy constructor by pointer
     
    116117  G4int GetADAS() const;    // A#of anti-ds-di-quarks
    117118  G4int GetAUAS() const;    // A#of anti-us-di-quarks
     119
     120  std::pair<G4int,G4int> MakePartonPair() const;// Make PDG's of PartonPairs for Mes&Baryon
     121  G4int AddParton(G4int pPDG) const; // Add parton with pPDG to the hadron with this QC
    118122
    119123  // Modifiers
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChan.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QDecayChan.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QDecayChan ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChanVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QDecayChanVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QEnvironment.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QEnvironment.hh,v 1.33 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QEnvironment.hh,v 1.36 2009/11/16 18:15:01 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QEnvironment ----------------
     
    4444#define G4QEnvironment_h 1
    4545
     46#include "G4RandomDirection.hh"
    4647#include "G4QuasmonVector.hh"
    4748
     
    122123
    123124//General function makes Random Unit 3D-Vector
    124 G4ThreeVector RndmDir();
     125//G4ThreeVector RndmDir();
    125126
    126127// Inline functions
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QException.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QException.hh,v 1.11 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QException ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QHadron.hh,v 1.37 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QHadron.hh,v 1.46 2009/09/08 14:04:14 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QHadron ----------------
     
    4747#include "G4QParticle.hh"
    4848#include "G4QPartonVector.hh"
     49#include "G4QPartonPair.hh"
     50#include "G4LorentzRotation.hh"
    4951#include <list>
    5052
     
    7678  G4QPDGCode            GetQPDG()         const;    // Get QPDG of the Hadron
    7779  G4double              GetSpin()         const{return .5*(GetPDGCode()%10-1);}
    78   G4LorentzVector       Get4Momentum()    const;    // Get 4-mom of the Hadron
     80  G4LorentzVector       Get4Momentum()    const{return theMomentum;} // Get 4-mom of Hadron
     81  G4ThreeVector         Get3Momentum()    const{return theMomentum.vect();}// Get 3-mom ofH
     82  G4double              GetEnergy()       const{return theMomentum.e();} // Get E of Hadron
    7983  G4QContent            GetQC()           const;    // Get private quark content
    8084  G4double              GetMass()         const;    // Get a mass of the Hadron
     
    8690  G4int                 GetBaryonNumber() const;    // Get Baryon Number of the Hadron
    8791  const G4ThreeVector&  GetPosition()     const;    // Get hadron coordinates
    88   G4int                 GetSoftCollisionCount();    // Get QGS Counter of collisions
    89   G4bool                IsSplit() {return isSplit;} // Check that hadron has been split
    9092  G4double              GetBindingEnergy() {return bindE;}// Returns binding E in NucMatter
    9193  G4double              GetFormationTime() {return formTime;} // Returns formation time
    92 
     94  std::list<G4QParton*> GetColor() {return Color;}  // pointer to quarks/anti-diquarks
     95  std::list<G4QParton*> GetAntiColor() {return AntiColor;}//pointer to anti-quarks/diquarks
    9396  // Modifiers
    9497  void SetQPDG(const G4QPDGCode& QPDG);             // Set QPDG of the Hadron
     98  void SetPDGCode(const G4QPDGCode& PDG){SetQPDG(G4QPDGCode(PDG));}// Set PDGCode of Hadron
    9599  void Set4Momentum(const G4LorentzVector& aMom);   // Set 4-mom of the Hadron
    96100  void SetQC(const G4QContent& newQC);              // Set new private quark content
     
    99103  void MakeAntiHadron();                            // Make AntiHadron of this Hadron
    100104  void SetPosition(const G4ThreeVector& aPosition); // Set coordinates of hadron position
    101   void IncrementCollisionCount(G4int aCount);       // Increnment counter of collisions
    102   void SetCollisionCount(G4int aCount);             // Set counter of QGSM collisions
    103   void Splitting() {isSplit = true;}                // Put Up a flag that splitting is done
     105  void IncrementCollisionCount(G4int aCount) {theCollisionCount+=aCount;}// IncrTheCCounter
    104106  void SplitUp();                                   // Make QGSM String Splitting of Hadron
     107  G4QPartonPair* SplitInTwoPartons();               // RandomSplit ofTheHadron in 2 partons
    105108  G4QParton* GetNextParton();                       // Next Parton in a string
    106109  G4QParton* GetNextAntiParton();                   // Next Anti-Parton in a string
     
    108111  void Boost(const G4LorentzVector& theBoost);      // Boosts hadron's 4-Momentum using 4M
    109112  void Boost(const G4ThreeVector& B){theMomentum.boost(B);} // Boosts 4-Momentum using v/c
     113  void LorentzRotate(const G4LorentzRotation& rotation){theMomentum=rotation*theMomentum;}
    110114  void SetFormationTime(G4double fT){formTime=fT;}  // Defines formationTime for the Hadron
    111115
     
    126130                     G4LorentzVector& dir, G4double cosp);
    127131  void   Init3D();                         // Initializes 3D nucleus with (Pos,4M)nucleons
    128 
    129132private:
    130133  // Private methods
    131134  void DefineQC(G4int PDGCode);
    132135  G4QParton* BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCode);
    133   G4double SampleX(G4double anXmin, G4int nSea, G4int theTotalSea, G4double aBeta);
     136  G4double SampleCHIPSX(G4double anXtot, G4int nSea);
     137  G4double* RandomX(G4int nPart);
    134138  void GetValenceQuarkFlavors(G4QParton* &Part1,G4QParton* &Part2);
    135139  G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare);
     
    137141  G4bool SplitBaryon(G4int PDGcode, G4int* aEnd, G4int* bEnd);
    138142
     143protected:
     144  G4LorentzVector        theMomentum;       // The 4-mom of Hadron
     145
    139146private:
    140147  // Static Parameters of QGSM Splitting
    141   static G4double alpha;            // changing rapidity distribution for all
    142   static G4double beta;             // changing rapidity distribution for projectile region
    143   static G4double theMinPz;         // Can be from 14 to 140 MeV
    144148  static G4double StrangeSuppress;  // ? M.K.
    145   static G4double sigmaPt;          // Can be 0
     149  static G4double sigmaPt;          // Can be 0 ?
    146150  static G4double widthOfPtSquare;  // ? M.K.
    147   static G4double minTransverseMass;// ? M.K.
    148151  // Body
    149152  G4QPDGCode             theQPDG;           // Instance of QPDG for the Hadron
    150   G4LorentzVector        theMomentum;       // The 4-mom of Hadron
    151153  G4QContent             valQ;              // QC (@@ for Quasmon and Chipolino?)
    152154  G4int                  nFragm;            // 0 - stable, N - decayed in N part's
     
    156158  G4bool                 isSplit;           // Flag, that splitting was done
    157159  G4bool                 Direction;         // FALSE=target, TRUE=projectile
    158   std::list<G4QParton*> Color;              // container for quarks & anti-diquarks
    159   std::list<G4QParton*> AntiColor;          // container for anti-quarks & diquarks
     160  std::list<G4QParton*>  Color;             // container for quarks & anti-diquarks
     161  std::list<G4QParton*>  AntiColor;         // container for anti-quarks & diquarks
    160162  G4double               bindE;             // Binding energy in nuclear matter
    161163  G4double               formTime;          // Formation time for the hadron
     
    171173inline G4QPDGCode      G4QHadron::GetQPDG()         const  {return theQPDG;}
    172174inline G4QContent      G4QHadron::GetQC()           const  {return valQ;}
    173 inline G4LorentzVector G4QHadron::Get4Momentum()    const  {return theMomentum;}
    174175inline G4int           G4QHadron::GetNFragments()   const  {return nFragm;}
    175176//@@ This is an example how to make other inline selectors for the 4-Momentum of the Hadron
     
    181182inline G4int           G4QHadron::GetBaryonNumber() const  {return valQ.GetBaryonNumber();}
    182183inline const G4ThreeVector& G4QHadron::GetPosition() const {return thePosition;}
    183 inline G4int           G4QHadron::GetSoftCollisionCount()  {return theCollisionCount;}
     184//inline G4int           G4QHadron::GetSoftCollisionCount()  {return theCollisionCount;}
    184185
    185186inline void            G4QHadron::MakeAntiHadron()    {if(TestRealNeutral()) NegPDGCode();}
     
    188189inline void   G4QHadron::SetNFragments(const G4int& nf)             {nFragm=nf;}
    189190inline void   G4QHadron::SetPosition(const G4ThreeVector& position) {thePosition=position;}
    190 inline void   G4QHadron::IncrementCollisionCount(G4int aCount) {theCollisionCount+=aCount;}
    191 inline void   G4QHadron::SetCollisionCount(G4int aCount)       {theCollisionCount =aCount;}
    192191
    193192inline void   G4QHadron::NegPDGCode()                  {theQPDG.NegPDGCode(); valQ.Anti();}
    194193inline G4bool G4QHadron::TestRealNeutral()             { return theQPDG.TestRealNeutral();}
    195194
    196 inline G4QParton* G4QHadron::GetNextParton()
    197 {
    198    if(Color.size()==0) return 0;
    199    G4QParton* result = Color.back();
    200    Color.pop_back();
    201    return result;
    202 }
    203 
    204 inline G4QParton* G4QHadron::GetNextAntiParton()
    205 {
    206    if(AntiColor.size() == 0) return 0;
    207    G4QParton* result = AntiColor.front();
    208    AntiColor.pop_front();
    209    return result;
    210 }
    211195#endif
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadronVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QHadronVector.hh,v 1.23 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
     
    4343//
    4444// $Id: G4QHadronVector.hh,v 1.23 2009/02/23 09:49:24 mkossov Exp $
    45 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     45// GEANT4 tag $Name: geant4-09-03-cand-01 $
    4646//
    4747// ------------------------------------------------------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteraction.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QInteraction.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QInteraction.hh,v 1.7 2009/08/28 14:49:10 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030
     
    4242// -------------------------------------------------------------------
    4343//  Short description: Classify the interaction in soft/hard/diffractive
    44 //  parts for firther treatment by the QGS algorithm.
     44//  parts for firther treatment by the QGS algorithm. Pure data class...
     45//  Except for the SplitHadrons, which can be done elsewhere (@@ M.K.)
    4546// ---------------------------------------------------------------------
    4647
     
    5859  G4QHadron* GetTarget() const                          {return theTarget;}
    5960  G4int GetNumberOfSoftCollisions()                     {return theNumberOfSoft;}
     61  G4int GetNumberOfDINRCollisions()                     {return theNumberOfDINR;}
    6062  G4int GetNumberOfHardCollisions()                     {return theNumberOfHard;}
    6163  G4int GetNumberOfDiffractiveCollisions()              {return theNumberOfDiffractive;}
    62   void  SetTarget(G4QHadron *aTarget)                   {theTarget = aTarget;}
    63   void  SetProjectile(G4QHadron *aProjectile)           {theProjectile = aProjectile;}
     64  void  SetTarget(G4QHadron* aTarget)                   {theTarget = aTarget;}
     65  void  SetProjectile(G4QHadron* aProjectile)           {theProjectile = aProjectile;}
    6466  void  SetNumberOfSoftCollisions(G4int nofSoft)        {theNumberOfSoft = nofSoft;}
     67  void  SetNumberOfDINRCollisions(G4int nofDINR)        {theNumberOfDINR = nofDINR;}
    6568  void  SetNumberOfHardCollisions(G4int nofHard)        {theNumberOfHard = nofHard;}
    6669  void  SetNumberOfDiffractiveCollisions(G4int nofDiff) {theNumberOfDiffractive = nofDiff;}
     
    7578  G4QHadron* theProjectile;
    7679  G4QHadron* theTarget;
     80  G4int theNumberOfDINR;
    7781  G4int theNumberOfHard;
    7882  G4int theNumberOfSoft;
     
    8185
    8286#endif
    83 
    84 
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteractionVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QInteractionVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
     
    3838//
    3939// $Id: G4QInteractionVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    40 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     40// GEANT4 tag $Name: geant4-09-03-cand-01 $
    4141//
    4242// ------------------------------------------------------------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QIsotope.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QIsotope.hh,v 1.6 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QNucleus.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QNucleus.hh,v 1.34 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QNucleus.hh,v 1.45 2009/08/31 11:21:48 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QNucleus ----------------
     
    4141#include "G4QCandidateVector.hh"
    4242#include "G4QHadronVector.hh"
     43#include "G4LorentzRotation.hh"
    4344#include "G4QChipolino.hh"
    4445#include <utility>
    4546#include <vector>
    4647#include "globals.hh"
     48#include "G4RandomDirection.hh"
    4749
    4850class G4QNucleus : public G4QHadron
     
    5658  G4QNucleus(G4int z, G4int n, G4int s=0);                 // At Rest ZNS-Constructor
    5759  G4QNucleus(G4int z, G4int n, G4int s, G4LorentzVector p);// Full ZNS-Constructor
    58   //G4QNucleus(const G4QNucleus& right);                     // Copy Constructor by value
    59   G4QNucleus(G4QNucleus* right);                           // Copy Constructor by pointer
     60  G4QNucleus(G4QNucleus* right, G4bool cop3D = false);     // Copy Constructor by pointer
     61  G4QNucleus(const G4QNucleus &right, G4bool cop3D=false); // Copy Constructor by value
    6062  ~G4QNucleus();                                           // Public Destructor
    6163  // Overloaded Operators
     
    7678  G4double   GetProbability(G4int bn=0) const {return probVect[bn];} // clust(BarN)probabil
    7779  G4double   GetMZNS()     const {return GetQPDG().GetNuclMass(Z,N,S);} // not H or Q
     80  G4double   GetTbIntegral(); // Calculate the integral of T(b)
    7881  G4double   GetGSMass()   const {return GetQPDG().GetMass();}//Nucleus GSMass (not Hadron)
    79   G4QContent GetQCZNS()    const                   // Get ZNS quark content of Nucleus
     82  G4QContent GetQCZNS()    const                    // Get ZNS quark content of Nucleus
    8083  {
    8184    if(S>=0) return G4QContent(Z+N+N+S,Z+Z+N+S,S,0,0,0);
     
    8487  G4int      GetNDefMesonC() const{return nDefMesonC;}; // max#of predefed mesonCandidates
    8588  G4int      GetNDefBaryonC()const{return nDefBaryonC;};// max#of predefed baryonCandidates
    86   std::pair<G4double, G4double> RefetchImpactXandY() const {return theImpactParameter;}
    8789  G4double GetDensity(const G4ThreeVector&aPos) {return rho0*GetRelativeDensity(aPos);}
     90  G4double GetRho0()                 {return rho0;} // One nucleon prob-density
    8891  G4double GetRelativeDensity(const G4ThreeVector& aPosition); // Densyty/rho0
     92  G4double GetRelWSDensity(const G4double& r)       // Wood-Saxon rho/rho0(r)
     93                                        {return 1./(1.+exp((r-radius)/WoodSaxonSurf));}   
     94  G4double GetRelOMDensity(const G4double& r2){return exp(-r2/radius);} // OscModelRelDens
    8995  G4double GetRadius(const G4double maxRelativeDenisty=0.5); // Radius of %ofDensity
    9096  G4double GetOuterRadius();                        // Get radius of the most far nucleon
    9197  G4double GetDeriv(const G4ThreeVector& point);    // Derivitive of density
    9298  G4double GetFermiMomentum(G4double density);      // Returns modul of FermyMomentum(dens)
    93   G4ThreeVector Get3DFermiMomentum(G4double density, G4double maxMom=-1.)
    94   {
    95     if(maxMom<0) maxMom=GetFermiMomentum(density);
    96     return maxMom*RandomUnitSphere();
    97   }
    9899  G4QHadron* GetNextNucleon()
    99     {return (currentNucleon>=0&&currentNucleon<GetA()) ? theNucleons[currentNucleon++] :0;}
    100   //std::vector<G4double>* GetBThickness() const {return Tb;} // T(b) function, step .1 fm
     100  {
     101    //G4cout<<"G4QNucleus::GetNextNucleon: cN="<<currentNucleon<<", A="<<GetA()<<G4endl;
     102    return (currentNucleon>=0&&currentNucleon<GetA()) ? theNucleons[currentNucleon++] : 0;
     103  }
     104  void SubtractNucleon(G4QHadron* pNucleon); // Subtract the nucleon from the 3D Nucleus
     105  void DeleteNucleons();                     // Deletes all residual nucleons
     106  G4LorentzVector GetNucleons4Momentum()
     107  {
     108    G4LorentzVector sum(0.,0.,0.,0.);
     109    for(unsigned i=0; i<theNucleons.size(); i++) sum += theNucleons[i]->Get4Momentum();
     110    sum.setE(std::sqrt(sqr(GetGSMass())+sum.v().mag2())); // Energy is corrected !
     111    return sum;
     112  }
    101113  std::vector<G4double> const* GetBThickness() {return &Tb;} // T(b) function, step .1 fm
    102114
     
    117129  G4bool     Split2Baryons();                       // Is it possible to split two baryons?
    118130  void       ActivateBThickness();                  // Calculate T(b) for nucleus (db=.1fm)
     131  G4double   GetBThickness(G4double b);             // Calculates T(b)
     132  G4double   GetThickness(G4double b);              // Calculates T(b)/rho(0)
    119133  void       InitByPDG(G4int newPDG);               // Init existing nucleus by new PDG
    120134  void       InitByQC(G4QContent newQC)             // Init existing nucleus by new QCont
     
    135149  G4QNucleus operator*=(const G4int& rhs);          // Multiplication of the Nucleus
    136150  G4bool StartLoop();                               // returns size of theNucleons (cN=0)
    137   G4bool ReduceSum(G4ThreeVector* momentum, G4double*); // Reduce momentum nonconservation
    138   void DoLorentzBoost(const G4LorentzVector& theBoost); // Boost nucleons by 4-vector
    139   void DoLorentzBoost(const G4ThreeVector& theBeta);// Boost nucleons by v/c
     151  G4bool ReduceSum(G4ThreeVector* vectors, G4ThreeVector sum);// Reduce zero-sum of vectors
     152  void SimpleSumReduction(G4ThreeVector* vectors, G4ThreeVector sum); // Reduce zero-V-sum
     153  void DoLorentzBoost(const G4LorentzVector& theBoost) // Boost nucleons by 4-vector
     154  {
     155    theMomentum.boost(theBoost);
     156    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->Boost(theBoost);
     157  }
     158  void DoLorentzRotation(const G4LorentzRotation& theLoRot) // Lorentz Rotate nucleons
     159  {
     160    theMomentum=theLoRot*theMomentum;
     161    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->LorentzRotate(theLoRot);
     162  }
     163  void DoLorentzBoost(const G4ThreeVector& theBeta)// Boost nucleons by v/c
     164  {
     165    theMomentum.boost(theBeta);
     166    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->Boost(theBeta);
     167  }
    140168  void DoLorentzContraction(const G4LorentzVector&B){DoLorentzContraction(B.vect()/B.e());}
    141169  void DoLorentzContraction(const G4ThreeVector& theBeta); // Lorentz Contraction by v/c
    142   void DoTranslation(const G4ThreeVector& theShift); // Used only in GHAD-TFT
     170  void DoTranslation(const G4ThreeVector& theShift); // Used only in G4QFragmentation
    143171
    144172  // Static functions
     
    147175
    148176  // Specific General Functions
    149   G4ThreeVector RandomUnitSphere();                 // Randomize position inside UnitSphere
    150177  G4int RandomizeBinom(G4double p,G4int N);         // Randomize according to Binomial Law
    151178  G4double CoulombBarrier(const G4double& cZ=1, const G4double& cA=1, G4double dZ=0.,
     
    179206  static G4double mediRatio;      // relative vacuum hadronization probability
    180207  static G4double nucleonDistance;// Distance between nucleons (0.8 fm)
     208  static G4double WoodSaxonSurf;  // Surface parameter of Wood-Saxon density (0.545 fm)
    181209  // The basic 
    182210  G4int Z;                        // Z of the Nucleus
     
    190218  G4double probVect[256];         // Cluster probability ("a#of issues" can be real) Vector
    191219  // 3D
    192   std::pair<G4double, G4double> theImpactParameter; // 2D impact parameter vector bbar
    193   G4QHadronVector theNucleons;  // Vector of nucleons of which Nucleus consists of
    194   G4int currentNucleon;         // Current nucleon for the NextNucleon (? M.K.)
    195   G4double rho0;                // Normalazation density
    196   G4double radius;              // Nuclear radius
    197   //std::vector<G4double>* Tb;    // T(b) function with step .1 fm (@@ make .1 a parameter)
    198   std::vector<G4double> Tb;    // T(b) function with step .1 fm (@@ make .1 a parameter)
     220  G4QHadronVector theNucleons;    // Vector of nucleons of which the Nucleus consists of
     221  G4int currentNucleon;           // Current nucleon for the NextNucleon (? M.K.)
     222  G4double rho0;                  // Normalazation density
     223  G4double radius;                // Nuclear radius
     224  std::vector<G4double> Tb;       // T(b) function with step .1 fm (@@ make .1 a parameter)
     225  G4bool TbActive;                // Flag that the T(b) is activated
     226  G4bool RhoActive;               // Flag that the Density is activated
    199227};
    200228
     
    202230std::ostream& operator<<(std::ostream& lhs, const G4QNucleus& rhs);
    203231
    204 
    205232#endif
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCode.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QPDGCode.hh,v 1.27 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QPDGCode.hh,v 1.30 2009/11/04 11:01:59 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QPDGCode ----------------
     
    4545#include <iostream>
    4646#include "globals.hh"
    47 #include "G4ParticleTable.hh"
     47// Geant4 particles for consistency of masses only
     48// Leptons
     49#include "G4MuonPlus.hh"
     50#include "G4MuonMinus.hh"
     51#include "G4TauMinus.hh"
     52#include "G4TauPlus.hh"
     53#include "G4Electron.hh"
     54#include "G4Positron.hh"
     55#include "G4NeutrinoTau.hh"
     56#include "G4AntiNeutrinoTau.hh"
     57#include "G4NeutrinoMu.hh"
     58#include "G4AntiNeutrinoMu.hh"
     59#include "G4NeutrinoE.hh"
     60#include "G4AntiNeutrinoE.hh"
     61// Mesons
     62#include "G4PionPlus.hh"
     63#include "G4PionMinus.hh"
     64#include "G4PionZero.hh"
     65#include "G4Eta.hh"
     66#include "G4EtaPrime.hh"
     67
     68#include "G4KaonPlus.hh"
     69#include "G4KaonMinus.hh"
     70#include "G4KaonZero.hh"
     71#include "G4AntiKaonZero.hh"
     72#include "G4KaonZeroLong.hh"
     73#include "G4KaonZeroShort.hh"
     74
     75#include "G4DMesonPlus.hh"
     76#include "G4DMesonMinus.hh"
     77#include "G4DMesonZero.hh"
     78#include "G4AntiDMesonZero.hh"
     79#include "G4DsMesonPlus.hh"
     80#include "G4DsMesonMinus.hh"
     81#include "G4JPsi.hh"
     82
     83#include "G4BMesonPlus.hh"
     84#include "G4BMesonMinus.hh"
     85#include "G4BMesonZero.hh"
     86#include "G4AntiBMesonZero.hh"
     87#include "G4BsMesonZero.hh"
     88#include "G4AntiBsMesonZero.hh"
     89
     90
     91// Barions
     92#include "G4Proton.hh"
     93#include "G4AntiProton.hh"
     94#include "G4Neutron.hh"
     95#include "G4AntiNeutron.hh"
     96
     97#include "G4Lambda.hh"
     98#include "G4SigmaPlus.hh"
     99#include "G4SigmaZero.hh"
     100#include "G4SigmaMinus.hh"
     101#include "G4XiMinus.hh"
     102#include "G4XiZero.hh"
     103#include "G4OmegaMinus.hh"
     104
     105#include "G4AntiLambda.hh"
     106#include "G4AntiSigmaPlus.hh"
     107#include "G4AntiSigmaZero.hh"
     108#include "G4AntiSigmaMinus.hh"
     109#include "G4AntiXiMinus.hh"
     110#include "G4AntiXiZero.hh"
     111#include "G4AntiOmegaMinus.hh"
     112
     113#include "G4LambdacPlus.hh"
     114#include "G4SigmacPlusPlus.hh"
     115#include "G4SigmacPlus.hh"
     116#include "G4SigmacZero.hh"
     117#include "G4XicPlus.hh"
     118#include "G4XicZero.hh"
     119#include "G4OmegacZero.hh"
     120
     121#include "G4AntiLambdacPlus.hh"
     122#include "G4AntiSigmacPlusPlus.hh"
     123#include "G4AntiSigmacPlus.hh"
     124#include "G4AntiSigmacZero.hh"
     125#include "G4AntiXicPlus.hh"
     126#include "G4AntiXicZero.hh"
     127#include "G4AntiOmegacZero.hh"
     128
     129// Nuclei
     130#include "G4Alpha.hh"
     131#include "G4Deuteron.hh"
     132#include "G4He3.hh"
     133#include "G4Triton.hh"
     134
     135//ions
     136#include "G4GenericIon.hh"
    48137#include "G4NucleiProperties.hh"
    49 #include "G4NucleiPropertiesTable.hh"
    50 #include "G4ParticleTypes.hh"
     138// --- End of consistency headers ---
    51139
    52140#include "G4QContent.hh"
     
    102190  // General
    103191  G4bool     TestRealNeutral();
     192
    104193  void       NegPDGCode();
    105194  void       ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s);
     195  std::pair<G4int,G4int> MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2);
    106196
    107197private:
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCodeVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QPDGCodeVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentCluster.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QParentCluster.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QParentCluster ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentClusterVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QParentClusterVector.hh,v 1.19 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticle.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QParticle.hh,v 1.25 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QParticle ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticleVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QParticleVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParton.hh

    r1055 r1196  
    2828#define G4QParton_h 1
    2929
    30 // $Id: G4QParton.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    31 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     30// $Id: G4QParton.hh,v 1.8 2009/07/17 16:54:57 mkossov Exp $
     31// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3232//
    3333// ------------------------------------------------------------
     
    4545
    4646#include "globals.hh"
     47#include "G4QContent.hh"
     48#include "G4LorentzVector.hh"
    4749#include "G4ThreeVector.hh"
    48 #include "G4LorentzVector.hh"
    4950#include <iostream>
    50 #include "G4ParticleTable.hh"
    5151#include "Randomize.hh"
    5252
     
    5555 public:
    5656  // Constructors
    57   G4QParton()
    58   {
    59     // CHIPS is working only with u, d, and s quarks (SU(3)xSU(3)) (no gluons! M.K.)
    60     // Random Flavor/Colour/Spin definition for default constructor (with .3 s-suppresion)
    61     PDGencoding=(G4int)(2.3*G4UniformRand())+1; //@@ What about antiquarks? (M.K.)
    62     theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding);
    63     // random colour (1,2,3)=(R,G,B) for quarks and (-1,-2,-3)=(aR,aG,aB) for anti-quarks
    64     theColour = (G4int)(3*G4UniformRand())+1;
    65     if(theColour>3) theColour = 3;
    66     theIsoSpinZ = theDefinition->GetPDGIsospin3();
    67     theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
    68   }
    69   G4QParton(G4int PDGencoding);                            // Collor/Spin are still random
     57  G4QParton();                                            // Default fullRandom constructor
     58  G4QParton(G4int aPGG);                                  // Collor/Spin are still random
    7059  G4QParton(const G4QParton &right);
    7160  G4QParton(const G4QParton* right);
     
    8069
    8170  // Modifiers
     71  void DefineEPz(G4LorentzVector hadr4Mom){theMomentum+=hadr4Mom*theX;} // CHIPS solution
    8272  void DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection);
     73  void SetPDGCode(G4int aPDG);
    8374  void SetColour(G4int aColour)                       {theColour = aColour;}
    8475  void SetX(G4double anX)                             {theX = anX;}
    8576  void Set4Momentum(const G4LorentzVector& aMomentum) {theMomentum=aMomentum;}
    8677  void SetPosition(const G4ThreeVector& aPosition)    {thePosition=aPosition;}
    87   void SetIsoSpinZ(G4double anIsoSpinZ)               {theIsoSpinZ = anIsoSpinZ;}
    8878  void SetSpinZ(G4double aSpinZ)                      {theSpinZ = aSpinZ;}
     79  G4bool ReduceDiQADiQ(G4QParton* d1, G4QParton* d2); // Reduce DiQ-aDiQ to Q-aQ (general)
    8980
    9081  // Selectors
    91   G4int GetPDGCode() const                            {return PDGencoding;}
    92   G4ParticleDefinition* GetDefinition()               {return theDefinition;}   
    93   const G4ThreeVector& GetPosition()const             {return thePosition;}
     82  G4int GetPDGCode() const                            {return PGGCode;}
     83  G4QContent GetQC() const                            {return QCont;}
     84  const G4ThreeVector& GetPosition() const            {return thePosition;}
    9485  const G4LorentzVector& Get4Momentum() const         {return theMomentum;}
    9586  G4double GetX()                                     {return theX;}   
    9687  G4int GetColour()                                   {return theColour;}   
    9788  G4double GetSpinZ()                                 {return theSpinZ;}
    98   G4double GetIsoSpinZ()                              {return theIsoSpinZ;}
    99   G4double GetMass()                                  {return theDefinition->GetPDGMass();}
    100   G4String GetParticleSubType()               {return theDefinition->GetParticleSubType();}
     89  const G4int& GetType() const                        {return theType;}
    10190 private:
    10291  // Body
    103   G4int                 PDGencoding;
    104   G4ParticleDefinition* theDefinition;
     92  G4int                 PGGCode;
     93  G4QContent            QCont;   // Quark Content of the parton
     94  G4int                 theType; // 0 = gluon, 1 = quark-antiquark, 2 = diquark/antidiquark
     95  G4int                 theColour;
     96  G4double              theSpinZ;
     97  G4double              theX;
     98  G4ThreeVector         thePosition;
    10599  G4LorentzVector       theMomentum;
    106   G4ThreeVector         thePosition;
    107   G4int                 theColour;
    108   G4double              theIsoSpinZ;
    109   G4double              theSpinZ;
    110   G4double              theX;   
    111100};
    112101
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPair.hh

    r1055 r1196  
    2828//
    2929// $Id: G4QPartonPair.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    30 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     30// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3131//
    3232// ------------------------------------------------------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPairVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QPartonPairVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QPartonVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidateVector ----------------
     
    4040//
    4141// $Id: G4QPartonVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    42 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     42// GEANT4 tag $Name: geant4-09-03-cand-01 $
    4343//
    4444// ------------------------------------------------------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QString.hh

    r1055 r1196  
    2626//
    2727//
    28 // $Id: G4QString.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    29 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// $Id: G4QString.hh,v 1.11 2009/08/24 14:41:49 mkossov Exp $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030
    3131#ifndef G4QString_h
     
    6060#include "G4LorentzRotation.hh"
    6161#include "G4QHadronVector.hh"
    62 #include "G4QHadronBuilder.hh"
    6362#include "G4QPartonPair.hh"
    6463#include "G4QPartonVector.hh"
     
    7372  G4QString(); // formal creation of the string with future excitation
    7473  G4QString(G4QParton* Color,G4QParton* Gluon, G4QParton* AntiColor, G4int Dir=PROJECTILE);
    75   G4QString(G4QParton* Col,G4QParton* AntiCol, G4int Dir=PROJECTILE);
     74  G4QString(G4QParton* Col, G4QParton* AntiCol, G4int Dir=PROJECTILE);
     75  G4QString(G4QPartonPair* ColAntiCol);
    7676  G4QString(const G4QString &right);
     77  G4QString(const G4QString &old, G4QParton* newdecay, const G4LorentzVector *momentum);
     78  G4QString(const G4QString &old, G4QParton* newdecay);
     79  G4QString(G4QParton* newdecay, const G4LorentzVector* momentum);
    7780
    7881  ~G4QString();
     
    8386  const G4ThreeVector& GetPosition() const       {return thePosition;}
    8487  const G4QPartonVector* GetPartonList() const   {return &thePartons;}
    85   G4QParton* GetGluon() const                    {return thePartons[1];}
    86   G4QParton* GetGluon(G4int GluonPos) const      {return thePartons[1 + GluonPos];}
    8788  G4QParton* GetLeftParton() const               {return *thePartons.begin();}
    8889  G4QParton* GetRightParton() const              {return *(thePartons.end()-1);}
    89   G4bool     IsItKinkyString() const             {return (thePartons.size() > 2);}
    9090  G4int      GetDirection() const                {return theDirection;}
    91   G4bool     IsExcited() const                   {return true;} // Can be absolete? @@ M.K.
    9291  G4LorentzVector Get4Momentum() const;
    93   //G4QHadron* GetAsQHadron(); //@@ Create a QHadron, corresponding to not excited string
    94   G4QParton* GetColorParton() const;
    95   G4QParton* GetAntiColorParton() const;
    96   G4QParton* GetStableParton() const{ return theStableParton;} // stable at the moment
    97   G4QParton* GetDecayParton() const{return theDecayParton;}// now involved in fragmentation
     92  G4QContent GetQC() const {return GetLeftParton()->GetQC()+GetRightParton()->GetQC();}
     93  G4int      GetCharge() const {return GetQC().GetCharge();}
     94  G4int      GetBaryonNumber() const {return GetQC().GetBaryonNumber();}
     95  G4int      GetStrangeness() const {return GetQC().GetStrangeness();}
    9896  G4int GetDecayDirection() const;
    99   G4bool FourQuarkString() const; // Checks that the string is qq-(qq)bar string
    100   G4bool DecayIsQuark() const {return theDecayParton->GetParticleSubType()=="quark";}
    101   G4bool StableIsQuark() const {return theStableParton->GetParticleSubType()=="quark";}
    102   G4ThreeVector StablePt(); // Get Pt of the stable quark
    103   G4ThreeVector DecayPt();  // Get Pt of the decaying quark
    104   G4double LightConePlus(){return Pplus;}
    105   G4double LightConeMinus() {return Pminus;}
    106   G4double LightConeDecay();
    107   G4LorentzVector GetFragmentation4Mom() const; //!! Instead of Get$Momentum in FragmString
    108   G4double Mass2() const {return Pplus*Pminus-(Ptleft+Ptright).mag2();}
    109   G4double Mass() const{return std::sqrt(Mass2());}
    110   G4bool StopFragmentation() {return FragmentationMass(&G4QHadronBuilder::BuildHighSpin)
    111                                                  + MassCut > GetFragmentation4Mom().mag();}
    112   G4bool IsFragmentable() {return FragmentationMass() + MassCut < Mass();}
    113   G4ThreeVector SampleQuarkPt();
    114   G4bool SplitLast(G4QString* string, G4QHadronVector* LeftHV, G4QHadronVector* RightHV);
     97  G4bool DecayIsQuark() const {return theDecayParton->GetType()==1;}
     98  G4bool StableIsQuark() const {return theStableParton->GetType()==1;}
     99  G4ThreeVector DecayPt();  // Get Pt of the decaying quark @@ Called once
     100  G4double Mass2() const { return Pplus*Pminus-(Ptleft+Ptright).mag2();}
     101  G4double Mass() const  // @@ Very dangerous! USE ONLY FORE THE LIGHT CONE ALGORITHM !!
     102  {
     103    G4double  m2=Mass2();
     104    if(m2>0) return std::sqrt(Mass2());
     105    else     return 0.; // @@ Make Warning
     106  }
     107  G4bool StopFragmentation()
     108  {
     109    G4LorentzVector mom(Ptleft+Ptright, 0.5*(Pplus+Pminus));
     110    mom.setPz(0.5*(Pplus-Pminus));
     111    return FragmentationMass(1) + MassCut > mom.mag();
     112  }
     113  G4bool IsFragmentable() {return FragmentationMass() + MassCut < Mass();} // @@ Mass() ?
     114  G4ThreeVector SampleQuarkPt(); // @@ Called once
     115  G4QHadron* CreateHadron(G4QParton* black, G4QParton* white);
     116  G4QHadron* CreateLowSpinHadron(G4QParton* black, G4QParton* white);
     117  G4QHadron* CreateHighSpinHadron(G4QParton* black, G4QParton* white);
    115118
    116   void Sample4Momentum(G4LorentzVector* Mom, G4double M, G4LorentzVector* aMom,
    117                        G4double aM, G4double InitialMass);
    118119  // Modifiers
    119   void SetPosition(const G4ThreeVector& aPosition) {thePosition= aPosition;}
    120   void SetDirection(G4int dir)                     {theDirection=dir;}
     120  void SetPosition(const G4ThreeVector& aPosition){thePosition= aPosition;}
     121  void SetDirection(G4int dir)       {if(dir==1 || dir==-1) theDirection=dir;}
     122  void SetLeftParton(G4QParton* LP)  {thePartons[0]=LP;} // !! Not deleting the substituty
     123  void SetRightParton(G4QParton* RP) {thePartons.pop_back(); thePartons.push_back(RP);}
     124  void KillString()                  {theDirection=0;} // @@ Can be absolete
    121125  void LorentzRotate(const G4LorentzRotation& rotation);
    122   void InsertParton(G4QParton* aParton, const G4QParton* addafter = NULL);
     126  //void InsertParton(G4QParton* aParton, const G4QParton* addafter = NULL);
    123127  void Boost(G4ThreeVector& Velocity);
    124   G4LorentzRotation TransformToCenterOfMass();
    125   G4LorentzRotation TransformToAlignedCms();
    126   void DiffString(G4QHadron* aHadron, G4bool isProjectile);
     128  G4LorentzRotation TransformToAlignedCms(); // @@ caled once
     129  //void DiffString(G4QHadron* aHadron, G4bool isProjectile); @@ Mast be used!!
    127130  void ExciteString(G4QParton* Col,G4QParton* AntiCol, G4int Dir);
    128131  G4QHadronVector* FragmentString(G4bool QL); // Fragment String using QGSM=true/LUND=false
    129   G4QString* CPExcited(); // Creates a string, using only CMS end-partons of the string
    130132  G4QHadronVector* LightFragmentationTest();
    131   G4double FragmentationMass(G4QHcreate build=0, G4QHadronPair* pdefs=0);
    132   void CalculateHadronTimePosition(G4double theInitialStringMass, G4QHadronVector*);
     133  G4double FragmentationMass(G4int HighSpin = 0, G4QHadronPair* pdefs = 0);
    133134  void SetLeftPartonStable();
    134135  void SetRightPartonStable();
    135   void UpdateString(G4QParton* decay, const G4LorentzVector* mom);
    136   G4QString(G4QParton* newdecay, const G4LorentzVector* momentum);
    137   G4QHadron* Splitup(G4bool QL);  // Split Hadron & update the string, QGSM:true,Lund:false
     136  G4QHadron* Splitup(G4bool QL);
    138137  G4LorentzVector* SplitEandP(G4QHadron* pHadron, G4bool QL); // QGSM:QL=true,Lund:QL=false
    139   G4QParton* CreateParton(G4int PDGcode)                   {return new G4QParton(PDGcode);}
    140138  G4QPartonPair CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks=true);
    141139  G4QHadron* QuarkSplitup(G4QParton* decay, G4QParton* &created);
     
    144142
    145143  // Static functions
    146   static void SetParameters(G4double mCut, G4double clustM, G4double sigQT, G4double DQSup,
    147    G4double DQBU, G4double smPar, G4double SSup, G4double SigPt, G4int SLmax, G4int CLmax);
     144  static void SetParameters(G4double mCut, G4double sigQT, G4double DQSup, G4double DQBU,
     145                            G4double smPar, G4double SSup, G4double SigPt);
    148146
    149147 private:
     148  enum Spin {SpinZero=1, SpinHalf=2, SpinOne=3, SpinThreeHalf=4};
    150149  // Private functions
     150  G4QHadron* CreateMeson(G4QParton* black, G4QParton* white, Spin spin);
     151  G4QHadron* CreateBaryon(G4QParton* black,G4QParton* white, Spin spin);
    151152  G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare) const;
    152153  G4double GetLundLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding,
     
    158159  // Parameters of Longitudinal String Fragmentation
    159160  static G4double MassCut;           // minimum mass cut for the string
    160   static G4double ClusterMass;       // minimum cluster mass for the fragmentation
    161161  static G4double SigmaQT;           // quark transverse momentum distribution parameter
    162162  static G4double DiquarkSuppress;   // is Diquark suppression parameter 
     
    165165  static G4double StrangeSuppress;   // Strangeness suppression parameter
    166166  static G4double widthOfPtSquare;   // width^2 of pt for string excitation
    167   static G4int StringLoopInterrupt;  // String fragmentation LOOP limit
    168   static G4int ClusterLoopInterrupt; // Cluster fragmentation LOOP limit
    169167
    170168  // Body
    171   G4int         theDirection;        // must be 1 or -1 (PROJECTILE or TARGET)
     169  G4int         theDirection;        // must be 1 (PROJECTILE) or -1 (TARGET), 0 - DEAD
    172170  G4ThreeVector thePosition;         // Defined by the first quark position
    173   G4QPartonVector thePartons;        // would like initial capacity for 3 Partons (? M.K.)
    174   G4QHadronBuilder* hadronizer;      // Hadronizer of hodrons out of partons
     171  G4QPartonVector thePartons;        // Partons on the ends of the string @@ Use PartonPair
    175172  G4ThreeVector Ptleft,Ptright;      // Pt (px,py) for partons (pz ignored!)
    176173  G4double Pplus, Pminus;            // p-, p+ of string, Plus is assigned to Left!
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QStringVector.hh

    r1055 r1196  
    2626//
    2727// $Id: G4QStringVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QStringVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Quasmon.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4Quasmon.hh,v 1.41 2009/03/23 14:14:35 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4Quasmon.hh,v 1.46 2009/11/16 18:15:01 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4Quasmon ----------------
     
    9595
    9696  //Modifiers
     97  void Set4Momentum(G4LorentzVector Q4M) {q4Mom=Q4M;} // Set new value for the Quasmon 4mom
     98  void SetQC(G4QContent QQC)             {valQ=QQC;}  // Set new Quark Cont for the Quasmon
     99  void Boost(const G4LorentzVector& theBoost);        // Boosts hadron's 4Momentum using 4M
     100  void Boost(const G4ThreeVector& B){q4Mom.boost(B);} // Boosts 4-Momentum using v/c
    97101  // Public wrapper for HadronizeQuasmon(,)
    98102  G4QHadronVector*  Fragment(G4QNucleus& nucEnviron, G4int nQ = 1);
    99103  G4QHadronVector*  DecayQuasmon();                   // Decay Quasmon if it's Res or Chipo
    100   G4QHadronVector*  DecayQHadron(G4QHadron* hadron);  // Decay Quasmon if it's Res or Chipo
     104  G4QHadronVector*  DecayQHadron(G4QHadron* hadron);  // Decay QHadron if it's Res or Chipo
    101105  void              ClearOutput();                    // Clear but not destroy the output
    102106  void              InitQuasmon(const G4QContent& qQCont, const G4LorentzVector& q4M);
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QuasmonVector.hh

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QuasmonVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QuasmonVector.hh,v 1.22 2009/11/16 18:15:01 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QuasmonVector ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QBesIKJY.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QBesIKJY.cc,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QBesIKJY.cc,v 1.4 2009/11/10 17:13:46 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QBesIKJY ----------------
     
    3434// Short description: Bessel functions class (can be substituted)
    3535// -------------------------------------------------------------------
     36
    3637//#define debug
    3738//#define pdebug
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QCHIPSWorld.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QCHIPSWorld.cc,v 1.33 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCHIPSWorld ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QCandidate.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QCandidate.cc,v 1.35 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QCandidate ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QChipolino.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QChipolino.cc,v 1.35 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QChipolino.cc,v 1.36 2009/08/10 16:36:53 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QChipolino ----------------
     
    222222          <<G4endl;
    223223#endif
    224  if((fl&&kS>1)||(!fl&&mS>1))
    225     {
     224    if( (fl && kS>1) || (!fl && mS>1))
     225    {
     226#ifdef debug
    226227      G4cerr<<"***G4QChipolino: ***Overfowed by strange quarks*** rQC="<<rQC<<G4endl;
    227228      //throw G4QException("G4QChipolino: NuclearFragment is overflowed by strangeQuarks");
     229#endif
    228230    }
    229231    else if(fl)                // ===> Anti-fragment
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QContent.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QContent.cc,v 1.45 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QContent.cc,v 1.49 2009/08/07 14:20:57 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QContent ----------------
     
    5353
    5454// Constructors
     55
     56// Initialize by  the full quark content
    5557G4QContent::G4QContent(G4int d, G4int u, G4int s, G4int ad, G4int au, G4int as):
    5658  nD(d),nU(u),nS(s),nAD(ad),nAU(au),nAS(as)
     
    6062#ifdef erdebug
    6163    G4cerr<<"***G4QContent:"<<d<<","<<u<<","<<s<<","<<ad<<","<<au<<","<<as<<G4endl;
    62     //throw G4QException("***G4QContent::Constructor: Negative Quark Content");
    6364#endif
    6465    if(d<0) ad-=d;
     
    6970    if(as<0) s-=as;
    7071  }
     72}
     73
     74// Initialize by a pair of partons
     75G4QContent::G4QContent(std::pair<G4int,G4int> PP): nD(0),nU(0),nS(0),nAD(0),nAU(0),nAS(0)
     76{
     77  G4int P1=PP.first;
     78  G4int P2=PP.second;
     79  if(!P1 || !P2)
     80  {
     81    G4cerr<<"***G4QContent::Constr(pair): Zero parton P1="<<P1<<", P2="<<P2<<G4endl;
     82    G4Exception("G4QContent::Constructor(pair):","72",FatalException,"WrongPartonPair");
     83  }
     84#ifdef pdebug
     85  G4cout<<"G4QContent::PairConstr: P1="<<P1<<", P2="<<P2<<G4endl;
     86#endif
     87  G4bool suc=true;
     88  G4int A1=P1;
     89  if     (P1 > 7) A1=  P1/100;
     90  else if(P1 <-7) A1=(-P1)/100;
     91  else if(P1 < 0) A1= -P1;
     92  G4int P11=0;
     93  G4int P12=0;
     94  if(A1>7)
     95  {
     96    P11=A1/10;
     97    P12=A1%10;
     98  }
     99  if(P1>0)
     100  {
     101    if(!P11)
     102    {
     103      if     (A1==1) ++nD;
     104      else if(A1==2) ++nU;
     105      else if(A1==3) ++nS;
     106      else           suc=false;
     107    }
     108    else
     109    {
     110      if     (P11==1) ++nD;
     111      else if(P11==2) ++nU;
     112      else if(P11==3) ++nS;
     113      else            suc=false;
     114      if     (P12==1) ++nD;
     115      else if(P12==2) ++nU;
     116      else if(P12==3) ++nS;
     117      else            suc=false;
     118    }
     119  }
     120  else // negative parton
     121  {
     122    if(!P11)
     123    {
     124      if     (A1==1) ++nAD;
     125      else if(A1==2) ++nAU;
     126      else if(A1==3) ++nAS;
     127      else           suc=false;
     128    }
     129    else
     130    {
     131      if     (P11==1) ++nAD;
     132      else if(P11==2) ++nAU;
     133      else if(P11==3) ++nAS;
     134      else            suc=false;
     135      if     (P12==1) ++nAD;
     136      else if(P12==2) ++nAU;
     137      else if(P12==3) ++nAS;
     138      else            suc=false;
     139    }
     140  }
     141#ifdef pdebug
     142  G4cout<<"G4QContent::PCo:1:"<<nD<<","<<nU<<","<<nS<<","<<nAD<<","<<nAU<<","<<nAS<<G4endl;
     143#endif
     144  G4int A2=P2;
     145  if     (P2 > 7) A2=  P2/100;
     146  else if(P2 <-7) A2=(-P2)/100;
     147  else if(P2 < 0) A2= -P2;
     148  G4int P21=0;
     149  G4int P22=0;
     150  if(A2>7)
     151  {
     152    P21=A2/10;
     153    P22=A2%10;
     154  }
     155  if(P2>0)
     156  {
     157    if(!P21)
     158    {
     159      if     (A2==1) ++nD;
     160      else if(A2==2) ++nU;
     161      else if(A2==3) ++nS;
     162      else           suc=false;
     163    }
     164    else
     165    {
     166      if     (P21==1) ++nD;
     167      else if(P21==2) ++nU;
     168      else if(P21==3) ++nS;
     169      else            suc=false;
     170      if     (P22==1) ++nD;
     171      else if(P22==2) ++nU;
     172      else if(P22==3) ++nS;
     173      else            suc=false;
     174    }
     175  }
     176  else // negative parton
     177  {
     178    if(!P21)
     179    {
     180      if     (A2==1) ++nAD;
     181      else if(A2==2) ++nAU;
     182      else if(A2==3) ++nAS;
     183      else           suc=false;
     184    }
     185    else
     186    {
     187      if     (P21==1) ++nAD;
     188      else if(P21==2) ++nAU;
     189      else if(P21==3) ++nAS;
     190      else            suc=false;
     191      if     (P22==1) ++nAD;
     192      else if(P22==2) ++nAU;
     193      else if(P22==3) ++nAS;
     194      else            suc=false;
     195    }
     196  }
     197  if(!suc)
     198  {
     199    G4cerr<<"***G4QContent::Constr(pair): Impossible partons, P1="<<P1<<",P2="<<P2<<G4endl;
     200    G4Exception("G4QContent::Constructor(pair):","72",FatalException,"ImpossibPartonPair");
     201  }
     202#ifdef pdebug
     203  G4cout<<"G4QContent::PCo:2:"<<nD<<","<<nU<<","<<nS<<","<<nAD<<","<<nAU<<","<<nAS<<G4endl;
     204#endif
    71205}
    72206
     
    762896G4int G4QContent::DecQAQ(const G4int& nQAQ)
    763897{//   =====================================
    764 #ifdef pdebug
     898#ifdef debug
    765899  G4cout<<"G4QCont::DecQC: n="<<nQAQ<<","<<GetThis()<<G4endl;
    766900#endif
     
    787921  {
    788922    G4int res=tot+nQAQ;
    789 #ifdef pdebug
     923#ifdef debug
    790924 G4cout<<"G4QC::DecQC: tot="<<tot<<", nTP="<<nTotP<<", res="<<res<<G4endl;
    791925#endif
     
    809943  if (!nReal) return nRet; // Now nothing to be done
    810944  // ---------- Decrimenting by nReal pairs
    811 #ifdef pdebug
     945#ifdef debug
    812946  G4cout<<"G4QC::DecQC: demanded "<<nQAQ<<" pairs, executed "<<nReal<<" pairs"<<G4endl;
    813947#endif
     
    820954    if (nUP && j<nUP && (nRet>2 || nUP>1 || (nD<2 && nS<2)))// --- U-Ubar pair
    821955    {
    822 #ifdef pdebug
     956#ifdef debug
    823957      G4cout<<"G4QC::DecQC: decrementing UAU pair UP="<<nUP<<", QC="<<GetThis()<<G4endl;
    824958#endif
     
    831965    else if (nDP && j<nLP && (nRet>2 || nDP>1 || (nU<2 && nS<2)))// --- D-Ubar pair
    832966    {
    833 #ifdef pdebug
     967#ifdef debug
    834968      G4cout<<"G4QC::DecQC: decrementing DAD pair DP="<<nDP<<", QC="<<GetThis()<<G4endl;
    835969#endif
     
    842976    else if (nSP&& (nRet>2 || nSP>1 || (nU<2 && nD<2)))          // --- S-Sbar pair
    843977    {
    844 #ifdef pdebug
     978#ifdef debug
    845979      G4cout<<"G4QC::DecQC: decrementing SAS pair SP="<<nSP<<", QC="<<GetThis()<<G4endl;
    846980#endif
     
    852986    else if (nUP)                                  // --- U-Ubar pair cancelation (final)
    853987    {
    854 #ifdef pdebug
     988#ifdef debug
    855989      G4cout<<"G4QC::DecQC:Decrement UAU pair (final) UP="<<nUP<<",QC="<<GetThis()<<G4endl;
    856990#endif
     
    863997    else if (nDP)                                 // --- D-Ubar pair cancelation (final)
    864998    {
    865 #ifdef pdebug
     999#ifdef debug
    8661000      G4cout<<"G4QC::DecQC:Decrement DAD pair (final) DP="<<nDP<<",QC="<<GetThis()<<G4endl;
    8671001#endif
     
    8741008    else if (nSP)                                 // --- S-Sbar pair cancelation (final)
    8751009    {
    876 #ifdef pdebug
     1010#ifdef debug
    8771011      G4cout<<"G4QC::DecQC: decrementing SAS pair SP="<<nSP<<", QC="<<GetThis()<<G4endl;
    8781012#endif
     
    8851019               <<",T="<<nTotP<<",nRet="<<nRet<<", QC="<<GetThis()<<G4endl;
    8861020  }
    887 #ifdef pdebug
     1021#ifdef debug
    8881022  G4cout<<"G4QC::DecQC: >>>OUT<<< nRet="<<nRet<<", QC="<<GetThis()<<G4endl;
    8891023#endif
     
    10421176  G4int b=nU+nD+nS-nAU-nAD-nAS;
    10431177  //#ifdef erdebug
    1044   if(b%3) G4cerr<<"-Warn-G4QContent:BaryonNumber="<<b<<"/3 isn't an integer value"<<G4endl;
     1178  if(b%3)
     1179  {
     1180     G4cerr<<"-Warning-G4QContent::GetBaryonNumber="<<b<<"/3 isn't anIntegerValue"<<G4endl;
     1181     G4Exception("G4QContent::GetBaryonNumber:","72",FatalException,"Wrong Baryon Number");
     1182  }
    10451183  //#endif
    10461184  return b/3;
     
    11061244    else
    11071245    {
    1108 #ifdef pdebug
     1246#ifdef debug
    11091247      G4cout<<"***G4QC::SPDG:CanD U="<<mU<<",D="<<mD<<",S="<<mS<<",QC="<<GetThis()<<G4endl;
    11101248#endif
     
    11271265    else
    11281266    {
    1129 #ifdef pdebug
     1267#ifdef debug
    11301268      G4cout<<"***G4QC::SPDG:CanU U="<<mU<<",D="<<mD<<",S="<<mS<<",QC="<<GetThis()<<G4endl;
    11311269#endif
     
    11481286    else
    11491287    {
    1150 #ifdef pdebug
     1288#ifdef debug
    11511289      G4cout<<"***G4QC::SPDG:CanS U="<<mU<<",D="<<mD<<",S="<<mS<<",QC="<<GetThis()<<G4endl;
    11521290#endif
     
    11581296  G4int c=GetCharge();
    11591297  G4int s=GetStrangeness();
    1160 #ifdef pdebug
     1298#ifdef debug
    11611299  G4cout<<"G4QC::SPDGC:bef. b="<<b<<",n="<<n<<",c="<<c<<",s="<<s<<",Q="<<GetThis()<<G4endl;
    11621300#endif
    11631301  if (b)                                         // ==================== Baryon case
    11641302  {
     1303   
    11651304    G4int ab=abs(b);
    11661305    if(ab>=2 && n>=6)                            // Multi-Baryonium (NuclearFragment)
     
    11691308      //if     (abs(mI)>3||mS>3||(b>0&&s<-1)||(b<0&&s>1)) return  0;
    11701309      //else if(abs(mI)>2||mS>2||(b>0&&s< 0)||(b<0&&s>0)) return 10;
    1171       if ( (b > 0 && s == -1) || (b < 0 && s == 1) ) return 10;
     1310      if ( (b > 0 && s < -1) || (b < 0 && s > 1) ) return 10;
    11721311      else if (abs(mI) > 2 || mS > 2
    11731312                           || (b > 0 && s < 0)
     
    14021541  return c;
    14031542}
     1543
     1544// Make PDG's of PartonPairs for Mesons & Baryons (only)
     1545std::pair<G4int,G4int> G4QContent::MakePartonPair() const
     1546{
     1547  G4double S=0.;
     1548  S+=nD;
     1549  G4double dP=S;
     1550  S+=nU;
     1551  G4double uP=S;
     1552  S+=nS;
     1553  G4double sP=S;
     1554  S+=nAD;
     1555  G4double dA=S;
     1556  S+=nAU;
     1557  G4double uA=S;
     1558  S+=nAS;
     1559  if(!S)
     1560  {
     1561    G4int f= static_cast<int>(1.+2.3*G4UniformRand()); // Random flavor @@ a Parameter
     1562    return std::make_pair(f,-f);
     1563  }
     1564  G4int f=0;
     1565  G4double R=S*G4UniformRand();
     1566  if     (R<dP) f=1;
     1567  else if(R<uP) f=2;
     1568  else if(R<sP) f=3;
     1569  else if(R<dA) f=-1;
     1570  else if(R<uA) f=-2;
     1571  else          f=-3;
     1572  if(f<0) // anti-quark
     1573  {
     1574    if(nD || nU || nS) // a Meson
     1575    {
     1576      if     (nD) return std::make_pair(1,f);
     1577      else if(nU) return std::make_pair(2,f);
     1578      else        return std::make_pair(3,f);
     1579    }
     1580    else               // Anti-Baryon
     1581    {
     1582      // @@ Can be improved, taking into acount weights (i,i): w=3, (i,j#i): w=4(s=0 + s=1)
     1583      G4int AD=nAD;
     1584      if(f==-1) AD--;
     1585      G4int AU=nAU;
     1586      if(f==-1) AU--;
     1587      G4int AS=nAS;
     1588      if(f==-1) AS--;
     1589      if       (AS)
     1590      {
     1591        if     (AS==2) return std::make_pair(-3303,f); // 3301 does not exist
     1592        else if(AU)    return std::make_pair(-3201,f); // @@ only lightest
     1593        else           return std::make_pair(-3101,f); // @@ only lightest
     1594      }
     1595      else if(AU)
     1596      {
     1597        if     (AU==2) return std::make_pair(-2203,f); // 2201 does not exist
     1598        else           return std::make_pair(-2101,f); // @@ only lightest
     1599      }
     1600      else return std::make_pair(-1103,f); // 1101 does not exist
     1601    }
     1602  }
     1603  else   // quark (f is a PDG code of the quark)
     1604  {
     1605    if(nAD || nAU || nAS) // a Meson
     1606    {
     1607      if     (nAD) return std::make_pair(f,-1);
     1608      else if(nAU) return std::make_pair(f,-2);
     1609      else         return std::make_pair(f,-3);
     1610    }
     1611    else               // Anti-Baryon
     1612    {
     1613      // @@ Can be improved, taking into acount weights (i,i): w=3, (i,j#i): w=4(s=0 + s=1)
     1614      G4int AD=nD;
     1615      if(f==-1) AD--;
     1616      G4int AU=nU;
     1617      if(f==-1) AU--;
     1618      G4int AS=nS;
     1619      if(f==-1) AS--;
     1620      if     (AS)
     1621      {
     1622        if     (AS==2) return std::make_pair(f,3303); // 3301 does not exist
     1623        else if(AU)    return std::make_pair(f,3201); // @@ only lightest
     1624        else           return std::make_pair(f,3101); // @@ only lightest
     1625      }
     1626      else if(AU)
     1627      {
     1628        if     (AU==2) return std::make_pair(f,2203); // 2201 does not exist
     1629        else           return std::make_pair(f,2101); // @@ only lightest
     1630      }
     1631      else return std::make_pair(f,1103); // 1101 does not exist
     1632    }
     1633  }
     1634}
     1635
     1636// Add parton (pPDG) to the hadron (this QC) & get parton PDG (Baryons,Mesons,Anti-Baryons)
     1637G4int G4QContent::AddParton(G4int pPDG) const
     1638{
     1639#ifdef debug
     1640  G4cout<<"G4QContent::AddParton: This="<<GetThis()<<", pPDG="<<pPDG<<G4endl;
     1641#endif
     1642  if(!pPDG || pPDG==9 || pPDG==21)
     1643  {
     1644#ifdef debug
     1645    G4cout<<"-Warning-G4QContent::AddParton: ImpossibleToAdd PartonWithPDG="<<pPDG<<G4endl;
     1646#endif
     1647    return 0;
     1648  }
     1649  G4int aPDG = std::abs(pPDG);
     1650  if( (aPDG>3 && aPDG<1101) || pPDG>3303) // @@ 1101 does not exist
     1651  {
     1652#ifdef debug
     1653    G4cout<<"-Warning-G4QContent::AddParton: Impossible Parton with PDG="<<pPDG<<G4endl;
     1654#endif
     1655    return 0;
     1656  }
     1657  G4int HBN = GetBaryonNumber();
     1658  if( HBN > 1 || HBN <-1)
     1659  {
     1660#ifdef debug
     1661    G4cout<<"-Warning-G4QContent::AddParton: Impossible Hadron with BaryonN="<<HBN<<G4endl;
     1662#endif
     1663    return 0;
     1664  }
     1665  G4int AD=nAD;
     1666  G4int AU=nAU;
     1667  G4int AS=nAS;
     1668  G4int QD=nD;
     1669  G4int QU=nU;
     1670  G4int QS=nS;
     1671  if(aPDG>99)                             // Parton is DiQuark/antiDiQuark
     1672  {
     1673    G4int rPDG=aPDG/100;
     1674    G4int P1=rPDG/10;                     // First quark
     1675    G4int P2=rPDG%10;                     // Second quark
     1676#ifdef debug
     1677    G4cout<<"G4QContent::AddParton: DiQuark/AntiDiQuark, P1="<<P1<<", P2="<<P2<<G4endl;
     1678#endif
     1679    if(pPDG>0)                            // -- DiQuark
     1680    {
     1681#ifdef debug
     1682      G4cout<<"G4QContent::AddParton: DiQuark, P1="<<P1<<", P2="<<P2<<",HBN="<<HBN<<G4endl;
     1683#endif
     1684      if     (P1==3 && P2==3)             // ----> ss DiQuark
     1685      {
     1686        if(HBN<0 && AS>1) AS-=2;          // >> Annihilation of ss-DiQuark with anti-Baryon
     1687        else if(!HBN && AS==1)
     1688        {
     1689          AS=0;
     1690          ++QS;
     1691        }
     1692        else if(HBN || (!HBN && !AS)) return 0;
     1693      }
     1694      else if(P1==3 && P2==2)             // ----> su DiQuark
     1695      {
     1696        if(HBN<0 && AS && AU)             // >> Annihilation of su-DiQuark with anti-Baryon
     1697        {
     1698          --AS;
     1699          --AU;
     1700        }
     1701        else if(!HBN && (AS || AU))
     1702        {
     1703          if(AS)
     1704          {
     1705            --AS;
     1706            ++QU;
     1707          }
     1708          else
     1709          {
     1710            --AU;
     1711            ++QS;
     1712          }
     1713        }
     1714        else if(HBN || (!HBN && !AS && !AU)) return 0;
     1715      }
     1716      else if(P1==3 && P2==1)             // ----> sd DiQuark
     1717      {
     1718        if(HBN<0 && AS && AD)             // >> Annihilation of sd-DiQuark with anti-Baryon
     1719        {
     1720          --AS;
     1721          --AD;
     1722        }
     1723        else if(!HBN && (AS || AD))
     1724        {
     1725          if(AS)
     1726          {
     1727            --AS;
     1728            ++QD;
     1729          }
     1730          else
     1731          {
     1732            --AD;
     1733            ++QS;
     1734          }
     1735        }
     1736        else if(HBN || (!HBN && !AS && !AD)) return 0;
     1737      }
     1738      else if(P1==2 && P2==2)             // ----> uu DiQuark
     1739      {
     1740        if(HBN<0 && AU>1) AU-=2;          // >> Annihilation of uu-DiQuark with anti-Baryon
     1741        else if(!HBN && AU==1)
     1742        {
     1743          AU=0;
     1744          ++QU;
     1745        }
     1746        else if(HBN || (!HBN && !AU)) return 0;
     1747      }
     1748      else if(P1==2 && P2==1)             // ----> ud DiQuark
     1749      {
     1750        if(HBN<0 && AD && AU)             // >> Annihilation of ud-DiQuark with anti-Baryon
     1751        {
     1752          --AD;
     1753          --AU;
     1754        }
     1755        else if(!HBN && (AD || AU))
     1756        {
     1757          if(AD)
     1758          {
     1759            --AD;
     1760            ++QU;
     1761          }
     1762          else
     1763          {
     1764            --AU;
     1765            ++QD;
     1766          }
     1767        }
     1768        else if(HBN || (!HBN && !AU && !AD)) return 0;
     1769      }
     1770      else                                // ----> dd DiQuark
     1771      {
     1772        if(HBN<0 && AD>1) AD-=2;          // >> Annihilation of dd-DiQuark with anti-Baryon
     1773        else if(!HBN && AD==1)
     1774        {
     1775          AD=0;
     1776          ++QD;
     1777        }
     1778        else if(HBN || (!HBN && !AD)) return 0;
     1779      }
     1780#ifdef debug
     1781      G4cout<<"G4QContent::AddParton: DQ, QC="<<QD<<","<<QU<<","<<QS<<","<<AD<<","<<AU<<","
     1782            <<AS<<G4endl;
     1783#endif
     1784      if     (HBN<0)                      // ....... Hadron is an Anti-Baryon
     1785      {
     1786        if     (AD) return -1;            // >>>>>>> Answer is anti-d
     1787        else if(AU) return -2;            // >>>>>>> Answer is anti-u
     1788        else        return -3;            // >>>>>>> Answer is anti-s
     1789      }
     1790      else                                // ... Hadron is aMeson with annihilatedAntiQuark
     1791      {                                       
     1792        if    (QS)                       // --------- There is an s-quark
     1793        {                                             
     1794          if  (QS==2) return 3303;       // >>>>>>> Answer is ss (3301 does not exist)
     1795          else if(QU) return 3201;       // >>>>>>> Answer is su (@@ only lightest)
     1796          else        return 3101;       // >>>>>>> Answer is sd (@@ only lightest)
     1797        }
     1798        else if(QU)                      // --------- There is an u quark
     1799        {                                             
     1800          if  (QU==2) return 2203;       // >>>>>>> Answer is uu (2201 does not exist)
     1801          else        return 2101;       // >>>>>>> Answer is ud (@@ only lightest)
     1802        }
     1803        else          return 1103;       // >>>>>>> Answer is dd (1101 does not exist)
     1804      }
     1805    }
     1806    else                                  // -- antiDiQuark
     1807    {
     1808#ifdef debug
     1809      G4cout<<"G4QContent::AddParton: AntiDiQuark,P1="<<P1<<",P2="<<P2<<",B="<<HBN<<G4endl;
     1810#endif
     1811      if     (P1==3 && P2==3)             // ----> anti-s-anti-s DiQuark
     1812      {
     1813        if(HBN>0 && QS>1) QS-=2;          // >> Annihilation of anti-ss-DiQuark with Baryon
     1814        else if(!HBN && QS==1)
     1815        {
     1816          QS=0;
     1817          ++AS;
     1818        }
     1819        else if(HBN || (!HBN && !QS)) return 0;
     1820      }
     1821      else if(P1==3 && P2==2)             // ----> anti-s-anti-u DiQuark
     1822      {
     1823        if(HBN>0 && QS && QU)             // >> Annihilation of anti-su-DiQuark with Baryon
     1824        {
     1825          --QS;
     1826          --QU;
     1827        }
     1828        else if(!HBN && (QS || QU))
     1829        {
     1830          if(QS)
     1831          {
     1832            --QS;
     1833            ++AU;
     1834          }
     1835          else
     1836          {
     1837            --QU;
     1838            ++AS;
     1839          }
     1840        }
     1841        else if(HBN || (!HBN && !QS && !QU)) return 0;
     1842      }
     1843      else if(P1==3 && P2==1)             // ----> anti-s-anti-d DiQuark
     1844      {
     1845        if(HBN>0 && QS && QD)             // >> Annihilation of anti-sd-DiQuark with Baryon
     1846        {
     1847          --QS;
     1848          --QD;
     1849        }
     1850        else if(!HBN && (QS || QD))
     1851        {
     1852          if(QS)
     1853          {
     1854            --QS;
     1855            ++AD;
     1856          }
     1857          else
     1858          {
     1859            --QD;
     1860            ++AS;
     1861          }
     1862        }
     1863        else if(HBN || (!HBN && !QS && !QD)) return 0;
     1864      }
     1865      else if(P1==2 && P2==2)             // ----> anti-u-anti-u DiQuark
     1866      {
     1867        if(HBN>0 && QU>1) QU-=2;          // >> Annihilation of anti-uu-DiQuark with Baryon
     1868        else if(!HBN && QU==1)
     1869        {
     1870          QU=0;
     1871          ++AU;
     1872        }
     1873        else if(HBN || (!HBN && !QU)) return 0;
     1874      }
     1875      else if(P1==2 && P2==1)             // ----> anti-u-anti-d DiQuark
     1876      {
     1877        if(HBN>0 && QU && QD)             // >> Annihilation of anti-ud-DiQuark with Baryon
     1878        {
     1879          --QU;
     1880          --QD;
     1881        }
     1882        else if(!HBN && (QU || QD))
     1883        {
     1884          if(QU)
     1885          {
     1886            --QU;
     1887            ++AD;
     1888          }
     1889          else
     1890          {
     1891            --QD;
     1892            ++AU;
     1893          }
     1894        }
     1895        else if(HBN || (!HBN && !QU && !QD)) return 0;
     1896      }
     1897      else                                // ----> anti-d=anti-d DiQuark
     1898      {
     1899        if(HBN>0 && QD>1) QD-=2;          // >> Annihilation of anti-dd-DiQuark with Baryon
     1900        else if(!HBN && QD==1)
     1901        {
     1902          QD=0;
     1903          ++AD;
     1904        }
     1905        else if(HBN || (!HBN && !QD)) return 0;
     1906      }
     1907#ifdef debug
     1908      G4cout<<"G4QContent::AddParton:ADQ, QC="<<QD<<","<<QU<<","<<QS<<","<<AD<<","<<AU<<","
     1909            <<AS<<G4endl;
     1910#endif
     1911      if     (HBN>0)                      // ....... Hadron is an Baryon
     1912      {
     1913        if     (QD) return 1;             // >>>>>>> Answer is d
     1914        else if(QU) return 2;             // >>>>>>> Answer is u
     1915        else        return 3;             // >>>>>>> Answer is s
     1916      }
     1917      else                                // ....... Meson with annihilated Anti-Quark
     1918      {                                       
     1919        if    (AS)                       // --------- There is an anti-s quark
     1920        {                                             
     1921          if  (AS==2) return -3303;      // >>>>>>> Answer is anti-ss (3301 does not exist)
     1922          else if(AU) return -3201;      // >>>>>>> Answer is anti-su (@@ only lightest)
     1923          else        return -3101;      // >>>>>>> Answer is anti-sd (@@ only lightest)
     1924        }
     1925        else if(AU)                      // --------- There is an anti-u quark
     1926        {                                             
     1927          if  (AU==2) return -2203;      // >>>>>>> Answer is anti-uu (2201 does not exist)
     1928          else        return -2101;      // >>>>>>> Answer is anti-ud (@@ only lightest)
     1929        }
     1930        else          return -1103;      // >>>>>>> Answer is anti-dd (1101 does not exist)
     1931      }
     1932    }
     1933  }
     1934  else                                    // Parton is Quark/antiQuark
     1935  {
     1936    if(pPDG>0)                            // -- Quark
     1937    {
     1938#ifdef debug
     1939      G4cout<<"G4QContent::AddParton: Quark, A="<<AD<<","<<AU<<","<<AS<<",B="<<HBN<<G4endl;
     1940#endif
     1941      if     (aPDG==1)                    // ----> d quark
     1942      {
     1943        if(HBN<0 && AD) AD--;             // ====> Annihilation of d-quark with anti-Baryon
     1944        else if(HBN || (!HBN && !AD)) return 0;
     1945      }
     1946      else if(aPDG==2)                    // ----> u quark
     1947      {
     1948        if(HBN<0 && AU) AU--;             // ====> Annihilation of u-quark with anti-Baryon
     1949        else if(HBN || (!HBN && !AU)) return 0;
     1950      }
     1951      else                                // ----> s quark
     1952      {
     1953        if(HBN<0 && AS) AS--;             // ====> Annihilation of s-quark with anti-Baryon
     1954        else if(HBN || (!HBN && !AS)) return 0;
     1955      }
     1956#ifdef debug
     1957      G4cout<<"G4QContent::AddParton: Q, QC="<<QD<<","<<QU<<","<<QS<<","<<AD<<","<<AU<<","
     1958            <<AS<<G4endl;
     1959#endif
     1960      if     (!HBN)                       // ....... Hadron is a Meson (passingThrougAbove)
     1961      {                                       
     1962        if     (QD) return 1;             // >>>>>>> Answer is d
     1963        else if(QU) return 2;             // >>>>>>> Answer is u
     1964        else        return 3;             // >>>>>>> Answer is s
     1965      }                                       
     1966      else                                // ....... AntiBaryon with annihilated AntiQuark
     1967      {                                       
     1968        if    (AS)                        // --------- There is an anti-s quark
     1969        {                                             
     1970          if  (AS==2) return -3303;       // >>>>>>> Answer is ss (3301 does not exist)
     1971          else if(AU) return -3201;       // >>>>>>> Answer is su (@@ only lightest)
     1972          else        return -3101;       // >>>>>>> Answer is sd (@@ only lightest)
     1973        }                                             
     1974        else if(AU)                           
     1975        {                                             
     1976          if  (AU==2) return -2203;       // >>>>>>> Answer is uu (2201 does not exist)
     1977          else        return -2101;       // >>>>>>> Answer is ud (@@ only lightest)
     1978        }                                             
     1979        else          return -1103;       // >>>>>>> Answer is dd (1101 does not exist)
     1980      }                                       
     1981    }
     1982    else                                  // -- antiQuark
     1983    {
     1984#ifdef debug
     1985      G4cout<<"G4QContent::AddParton: antiQ, Q="<<QD<<","<<QU<<","<<QS<<",B="<<HBN<<G4endl;
     1986#endif
     1987      if     (aPDG==1)                    // ----> anti-d quark
     1988      {
     1989        if(HBN>0 && QD) QD--;             // ====> Annihilation of anti-d-quark with Baryon
     1990        else if(HBN || (!HBN && !QD)) return 0;
     1991      }
     1992      else if(aPDG==2)                    // ----> anti-u quark
     1993      {
     1994        if(HBN>0 && QU) QU--;             // ====> Annihilation of anti-u-quark with Baryon
     1995        else if(HBN || (!HBN && !QU)) return 0;
     1996      }
     1997      else                                // ----> anti-s quark
     1998      {
     1999        if(HBN>0 && QS) QS--;             // ====> Annihilation of anti-s-quark with Baryon
     2000        else if(HBN || (!HBN && !QS)) return 0;
     2001      }
     2002#ifdef debug
     2003      G4cout<<"G4QContent::AddParton: AQ, QC="<<QD<<","<<QU<<","<<QS<<","<<AD<<","<<AU<<","
     2004            <<AS<<G4endl;
     2005#endif
     2006      if     (!HBN)                       // ....... Hadron is a Meson (passingThrougAbove)
     2007      {                                       
     2008        if     (AD) return -1;            // >>>>>>> Answer is anti-d
     2009        else if(AU) return -2;            // >>>>>>> Answer is anti-u
     2010        else        return -3;            // >>>>>>> Answer is anti-s
     2011      }                                       
     2012      else                                // ....... Baryon with annihilated Quark
     2013      {                                       
     2014        if    (QS)                        // --------- There is an anti-s quark
     2015        {                                             
     2016          if  (QS==2) return 3303;        // >>>>>>> Answer is ss (3301 does not exist)
     2017          else if(QU) return 3201;        // >>>>>>> Answer is su (@@ only lightest)
     2018          else        return 3101;        // >>>>>>> Answer is sd (@@ only lightest)
     2019        }                                             
     2020        else if(QU)                           
     2021        {                                             
     2022          if  (QU==2) return 2203;        // >>>>>>> Answer is uu (2201 does not exist)
     2023          else        return 2101;        // >>>>>>> Answer is ud (@@ only lightest)
     2024        }                                             
     2025        else          return 1103;        // >>>>>>> Answer is dd (1101 does not exist)
     2026      }                                       
     2027    }
     2028  }
     2029}
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QDecayChan.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QDecayChan.cc,v 1.28 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QDecayChan ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QEnvironment.cc

    r1055 r1196  
    2828//
    2929//
    30 // $Id: G4QEnvironment.cc,v 1.144 2009/05/26 14:40:20 mkossov Exp $
    31 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     30// $Id: G4QEnvironment.cc,v 1.157 2009/11/16 18:15:01 mkossov Exp $
     31// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3232//
    3333//      ---------------- G4QEnvironment ----------------
     
    5353//#define cldebug
    5454//#define edebug
     55//#define rdebug
    5556//#define fdebug
    56 //#define rdebug
    5757//#define ffdebug
    5858//#define pcdebug
     
    100100      {
    101101        G4QHadron* curQH    = new G4QHadron(projHadrons[ih]);
    102 #ifdef pdebug
     102#ifdef debug
    103103        G4cout<<"*G4QE::Const:iH#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
    104104#endif
     
    111111    {
    112112      G4QHadron* curQH    = new G4QHadron(targPDG);
    113 #ifdef pdebug
     113#ifdef debug
    114114      G4cout<<"**G4QE::Const:No iHad,eH="<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
    115115#endif
     
    120120  }
    121121  G4QPDGCode targQPDG(targPDG);
    122 #ifdef pdebug
     122#ifdef debug
    123123  G4cout<<"G4QE::C:targQPDG="<<targQPDG<<G4endl;
    124124#endif
     
    129129  tot4Mom=G4LorentzVector(0.,0.,0.,targM);
    130130  // === Print out of the input information at Creation time & tot 4-mom Calculation ======
    131 #ifdef pdebug
     131#ifdef debug
    132132  G4cout<<"G4QE::C:PDG="<<targPDG<<",C="<<totCharge<<",M="<<targM<<",n="<<nHadrons<<G4endl;
    133133#endif
     
    141141    totCharge    += prHadr->GetCharge();
    142142    totBaryoN    += prHadr->GetBaryonNumber();
    143 #ifdef pdebug
     143#ifdef debug
    144144    G4int           hPDG  = prHadr->GetPDGCode();
    145145    G4int           hNFrag= prHadr->GetNFragments();
     
    148148#endif
    149149  }
    150 #ifdef pdebug
     150#ifdef debug
    151151  G4cout<<"G4QEnv::Const:tC="<<totCharge<<",tB="<<totBaryoN<<",tot4M="<<tot4Mom<<G4endl;
    152152#endif
    153 #ifdef pdebug
     153#ifdef debug
    154154  G4cout<<"G4QEnv::Const: ----> tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
    155155#endif
    156156  G4int nP=theWorld->GetQPEntries();         // A#of init'ed particles in CHIPS World
    157157  G4int nCl=nP-90;                           // A#of init'ed clusters in CHIPS World
    158 #ifdef pdebug
     158#ifdef debug
    159159  G4cout<<"G4QEnv:Const:Before NCI:n="<<nP<<",F="<<projHadrons[0]->GetNFragments()<<",tC="
    160160        <<totCharge<<",tB="<<totBaryoN<<G4endl;
    161161#endif
    162162  InitClustersVector(nCl,targA);             // Init Clusters as Particles (to interact)
    163 #ifdef pdebug
     163#ifdef debug
    164164  G4cout<<"G4QEnv::Const:NucClust,n="<<nCl<<",F="<<projHadrons[0]->GetNFragments()<<",tC="
    165165        <<totCharge<<",tB="<<totBaryoN<<G4endl;
     
    168168  {
    169169    theEnvironment.InitByPDG(targPDG);        // Create nuclear environment
    170 #ifdef pdebug
     170#ifdef debug
    171171    G4cout<<"G4QEnv::Const:nH="<<nHadrons<<",PDG="<<projHadrons[0]->GetPDGCode()<<",tC="
    172172          <<totCharge<<",tB="<<totBaryoN<<G4endl;
     
    176176      G4QHadron* opHad=projHadrons[0];
    177177      G4int opPDG=opHad->GetPDGCode();
    178 #ifdef pdebug
     178#ifdef debug
    179179      G4cout<<"G4QEnviron::Constructor: *** Only one input hadron*** PDG="<<opPDG<<G4endl;
    180180#endif
     
    182182      {
    183183        G4double exMass=tot4Mom.m();
    184 #ifdef pdebug
     184#ifdef debug
    185185        G4cout<<"G4QEnvironment::Const: exM="<<exMass-targM<<" > mPi0 ?"<<G4endl;
    186186#endif     
     
    191191          if(targM>999.&&!exEnviron.SplitBaryon())//Nucleus is below SplitFragmentThreshold
    192192          {
    193 #ifdef pdebug
     193#ifdef debug
    194194            G4cout<<"G4QEnv::Const:Photon's added to Output, Env="<<theEnvironment<<G4endl;
    195195#endif     
    196196            G4QHadron* photon = new G4QHadron(opHad); // Fill projPhoton to Output
    197 #ifdef pdebug
     197#ifdef debug
    198198            G4cout<<"**G4QE::Const:Phot="<<photon->GetQC()<<photon->Get4Momentum()<<G4endl;
    199199#endif
     
    207207            if(!G4QHadron(tot4Mom).DecayIn2(prot4m,gam4m))
    208208            {
    209 #ifdef pdebug
     209#ifdef debug
    210210              G4cout<<"*War*G4QEnv::Const:(P)Photon->Output, Env="<<theEnvironment<<G4endl;
    211211#endif     
    212212              G4QHadron* photon = new G4QHadron(opHad); // Fill projPhoton to Output
    213 #ifdef pdebug
     213#ifdef debug
    214214              G4cout<<"**G4QE::Const:Ph="<<photon->GetQC()<<photon->Get4Momentum()<<G4endl;
    215215#endif
     
    222222            theQHadrons.push_back(photon);      // (delete equivalent)
    223223            theEnvironment.InitByPDG(90000000); // Create nuclear environment
    224 #ifdef pdebug
     224#ifdef debug
    225225            G4cout<<"G4QEnv::Const:Fill gamma and N from gam+N"<<targPDG<<prot4m<<G4endl;
    226226#endif     
     
    255255        G4LorentzVector tg4m=G4LorentzVector(0.,0.,0.,targM); // 4mom of all target nucleus
    256256        G4LorentzVector fd4m=tg4m-qi4m;       // 4mom of the residual coloured nuclear sys.
    257 #ifdef pdebug
     257#ifdef debug
    258258        //G4cout<<">>>G4QEnv::Const:rM="<<rsm<<",fM="<<fnm<<",tM="<<targM<<G4endl;
    259259        G4cout<<"G4QEnvironment::Const:mu4M="<<mu4m<<",t4M="<<qt4m<<",tgQP="<<qi4m<<G4endl;
     
    299299          neutrino = new G4QHadron(nuPDG,nu4m);// Fill Neutrino to Output
    300300          theEnvironment.InitByPDG(90000000); // Create nuclear environment
    301 #ifdef pdebug
     301#ifdef debug
    302302          G4cout<<"G4QEnv::Const:Fill neutrino (1) "<<nuPDG<<nu4m<<G4endl;
    303303#endif     
     
    306306        }
    307307        neutrino = new G4QHadron(nuPDG,nu4m); // Fill Neutrino to Output
    308 #ifdef pdebug
     308#ifdef debug
    309309        G4cout<<"G4QEnv::Const:Fill neutrino (2) "<<nuPDG<<nu4m<<G4endl;
    310310#endif     
     
    328328            }
    329329            G4QHadron* photon = new G4QHadron(22,ga4m); // Fill projPhoton to Output
    330 #ifdef pdebug
     330#ifdef debug
    331331            G4cout<<"G4QEnv::Const:Fill photon "<<ga4m<<G4endl;
    332332#endif     
    333333            theQHadrons.push_back(photon);    // (delete equivalent)
    334334            G4QHadron* fnuc = new G4QHadron(targQC,qf4m); // Fill Final Nucleus to Output
    335 #ifdef pdebug
     335#ifdef debug
    336336            G4cout<<"G4QEnv::Const:Fill target "<<targQC<<qf4m<<" in any form"<<G4endl;
    337337#endif     
     
    355355      G4int hNFrag = curHadr->GetNFragments();// #0 means intermediate (skip)
    356356      G4LorentzVector ch4M=curHadr->Get4Momentum(); // 4-momenyum of the current projectile
    357 #ifdef pdebug
     357#ifdef debug
    358358      G4cout<<"G4QE:C:"<<ih<<",F="<<hNFrag<<",0="<<projHadrons[0]->GetNFragments()<<G4endl;
    359359#endif
     
    382382            {
    383383              G4QHadron* newHadr = new G4QHadron(curHadr);
    384 #ifdef pdebug
     384#ifdef debug
    385385              G4cout<<"*G4QE::Const:H="<<newHadr->GetQC()<<newHadr->Get4Momentum()<<G4endl;
    386386#endif
    387387              theQHadrons.push_back(newHadr); // Fill existing hadron (delete equivalent)
    388 #ifdef pdebug
     388#ifdef debug
    389389              G4cout<<"G4QEnviron::Constructor: Fill h="<<hPDG<<ch4M<<G4endl;
    390390              for(unsigned ipo=0; ipo<theQHadrons.size(); ipo++) // LOOP just for printing
     
    403403        {
    404404          G4QContent      hQC   = curHadr->GetQC();
    405 #ifdef pdebug
     405#ifdef debug
    406406          G4cout<<"G4QE::Const:CreateQuasm, 4M="<<ch4M<<",QC="<<hQC<<",E="<<envPDG<<",tC="
    407407                <<totCharge<<",tB="<<totBaryoN<<G4endl;
     
    447447          h4Mom+=G4LorentzVector(0.,0.,0.,tQPDG.GetMass()); //Projectile + TargetHadron
    448448          hQC+=tQPDG.GetQuarkContent();
    449 #ifdef pdebug
     449#ifdef debug
    450450          G4cout<<"G4QEnv::Const:VacHadrTarg="<<h4Mom<<hQC<<",E="<<theEnvironment<<G4endl;
    451451#endif
     
    458458    {
    459459      G4QHadron* newHadr = new G4QHadron(curHadr);
    460 #ifdef pdebug
     460#ifdef debug
    461461      G4cout<<"*G4QE::Const:#"<<ih<<","<<curHadr->GetQC()<<curHadr->Get4Momentum()<<G4endl;
    462462#endif
     
    504504  {
    505505    G4QHadron* curQH    = new G4QHadron(right.theQHadrons[ih]);
    506 #ifdef pdebug
     506#ifdef debug
    507507    G4cout<<"G4QE::CopyByVal:cH#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
    508508#endif
     
    550550  {
    551551    G4QHadron* curQH    = new G4QHadron(right->theQHadrons[ih]);
    552 #ifdef pdebug
     552#ifdef debug
    553553    G4cout<<"G4QE::CopyByPtr:cH#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
    554554#endif
     
    650650    {
    651651      G4QHadron* curQH    = new G4QHadron(right.theQHadrons[ih]);
    652 #ifdef pdebug
     652#ifdef debug
    653653      G4cout<<"G4QE::Operator=:c#"<<ih<<","<<curQH->GetQC()<<curQH->Get4Momentum()<<G4endl;
    654654#endif
     
    728728  {
    729729    G4double  tgMass=theEnvironment.GetMass();// mass of the target (QEnvironment) nucleus
    730 #ifdef pdebug
     730#ifdef debug
    731731    G4cout<<"G4QEnvironment::CreateQ:Interact "<<projQC<<proj4M<<"(m2="<<projM2<<") + A="
    732732          <<targPDG<<",M="<<tgMass<<",tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
     
    749749      else    nBarClust=4+d+d;
    750750    }
    751 #ifdef pdebug
     751#ifdef debug
    752752    G4cout<<"G4QE::CrQ:TNuc:Z="<<envZ<<",N="<<envN<<",nC="<<nBarClust<<",tC="
    753753          <<totCharge<<", tB="<<totBaryoN<<G4endl;
     
    762762    theEnvironment.SetMaxClust(nBarClust);
    763763    nBarClust=theEnvironment.UpdateClusters(din); // Cluster Probabilities upto maxClust
    764 #ifdef pdebug
     764#ifdef debug
    765765    G4cout<<"G4QEnv::CreateQ: Nucleus("<<targPDG<<") is created ("<<nBarClust<<" clast's)";
    766766    for(G4int ic=0;ic<nBarClust;ic++)
     
    770770    theEnvironment.PrepareCandidates(theQCandidates,piF,gaF,proj4M);//Calc.Clust's probab's
    771771    G4QNucleus memEnviron=theEnvironment;
    772 #ifdef pdebug
     772#ifdef debug
    773773    G4cout<<"G4QE::CrQ:ClusterProbabCalculation tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;
    774774#endif
     
    785785    {
    786786      // @@ Annihilation on one baryon is implemented (no annihilation on clusters! @@?) @@
    787 #ifdef pdebug
     787#ifdef debug
    788788      G4cout<<"G4QE::CreQ:Annihilation on a perif. nucleon, Z="<<envZ<<",N="<<envN<<G4endl;
    789789#endif
     
    817817      //}
    818818      theEnvironment.Reduce(targNPDG);      // Subtract periferal baryon from Nucleus
    819 #ifdef pdebug
     819#ifdef debug
    820820      G4cout<<"G4QEnvironment::CQ:"<<targNPDG<<" is selected Env="<<theEnvironment<<G4endl;
    821821#endif
     
    834834      G4Quasmon* pan = new G4Quasmon(valQ,q4Mom);// N-Nbar Quasm creation (del.at 9th line)
    835835      G4QNucleus vE(90000000);                 // Annihilation in vacuum (in NuclMatter?)
    836 #ifdef pdebug
     836#ifdef debug
    837837      G4cout<<"G4QE::CreQ: before Fragment, vE="<<vE<<",vP="<<vE.GetProbability()<<",QQC="
    838838            <<valQ<<",Q4M="<<q4Mom<<G4endl;
    839839#endif
    840840      G4QHadronVector* output=pan->Fragment(vE,1);//Output of inVacAnnihilation*DESTROY*<-+
    841 #ifdef pdebug
     841#ifdef debug
    842842      G4cout<<"G4QE::CrQ:NucleonAntinucleonAnnihilation's done,N="<<output->size()<<G4endl;
    843843#endif
    844844      G4Quasmon::OpenElectromagneticDecays();  // Parameter for multihadronFragmentatation^
    845 #ifdef pdebug
     845#ifdef debug
    846846      G4cout<<"G4QE::CrQ:>>AnnihilationIsDone,C="<<totCharge<<",B="<<totBaryoN<<G4endl;// ^
    847847#endif
     
    851851      G4LorentzVector trg4M(0.,0.,0.,resMass); // New 4-momentum for the ResidualNucleus^ ^
    852852      G4int tNH = output->size();              // For the selection LOOP                ^ ^
    853       G4ThreeVector dir = RndmDir();          // For the selection in LOOP (@@ at rest)^ ^
     853      G4ThreeVector dir = G4RandomDirection(); // For the selection in LOOP (@@ at rest)^ ^
    854854      G4double ra=std::pow(G4double(totBaryoN),third);  //                              ^ ^
    855 #ifdef pdebug
     855#ifdef debug
    856856      G4cout<<"G4QE::CQ:N="<<tNH<<",T="<<totCharge<<","<<totBaryoN<<",A="<<ra<<G4endl;//^ ^
    857857#endif
     
    866866        G4int           shCHG= curHadr->GetCharge();    // Charge of the projectile     ^ ^
    867867        G4double        shMOM= sh4m.rho();              // Momentum of the projectile   ^ ^
    868 #ifdef pdebug
     868#ifdef debug
    869869        G4cout<<"G4QE::CrQ:"<<ind<<","<<shDFL<<",PDG="<<shPDG<<",4M="<<sh4m<<G4endl; // ^ ^
    870870#endif
     
    878878        else     solAnCut+=1000*shCHG/shMOM/ra;         // ChargeDepSolAngle(Normal)    ^ ^
    879879        //G4double solAnCut=SolidAngle+20*shCHG*sqrt(1.*envZ)/shMOM;//ChargeDepSolAngle ^ ^
    880 #ifdef pdebug
     880#ifdef debug
    881881        G4cout<<"G4QE::CrQ: PDG="<<shPDG<<", p="<<shMOM<<", r="<<ra<<G4endl; //         ^ ^
    882882#endif
    883883        if(!shDFL)                                      // Final(notDecayed) hadrons    ^ ^
    884884        {
    885 #ifdef pdebug
     885#ifdef debug
    886886          G4cout<<"G4QE::CQ:>H="<<shPDG<<":"<<dir.dot(shDIR)<<">"<<solAnCut<<G4endl; // ^ ^
    887887#endif
     
    889889          if(dir.dot(shDIR)>solAnCut && abs(shPDG)>99) // Absorb mesons                 ^ ^
    890890          {
    891 #ifdef pdebug
     891#ifdef debug
    892892            G4cout<<"G4QE::CQ:>H="<<shPDG<<":"<<dir.dot(shDIR)<<">"<<solAnCut<<", P="// ^ ^
    893893                  <<shMOM<<" < 120"<<G4endl;                           //               ^ ^
     
    899899              EnFlQC+=shQC;
    900900              efCounter++;
    901 #ifdef pdebug
     901#ifdef debug
    902902              G4int hPDG=curHadr->GetPDGCode();    // Only for gebug printing           ^ ^
    903903              G4LorentzVector h4M = curHadr->Get4Momentum();  // Only for gebug printing^ ^
     
    909909              G4QHadron* mqHadron = new G4QHadron(curHadr);
    910910              input.push_back(mqHadron);           // Fill hadron-copy (del equiv)  <...^ ^
    911 #ifdef pdebug
     911#ifdef debug
    912912              G4int hPDG=curHadr->GetPDGCode();    // Only for debug printing           ^ ^
    913913              G4LorentzVector h4M = curHadr->Get4Momentum(); // Only for gebug printing ^ ^
     
    918918          else                                     // DirectFilling of the output vector^ ^
    919919          {                                        //                                   ^ ^
    920 #ifdef pdebug
     920#ifdef debug
    921921            G4int hPDG=curHadr->GetPDGCode();      // Only for gebug printing           ^ ^
    922922            G4LorentzVector h4M = curHadr->Get4Momentum(); // Only for gebug printing   ^ ^
     
    937937        if(noh) for(G4int kh=0; kh<noh; kh++)      // One can escape it but...          ^
    938938        {                                          //                                   ^
    939 #ifdef pdebug
     939#ifdef debug
    940940          G4cout<<"G4QE::CreateQ:H#"<<kh<<", QC="<<theQHadrons[kh]->GetQC() //          ^
    941941                <<", 4M="<<theQHadrons[kh]->Get4Momentum()<<G4endl;         //          ^
     
    949949        }                                          //                                 ^ ^
    950950        theQHadrons.clear(); // deletedWhenDecayed // Now theQHadrons is EmptyVector->^ ^
    951 #ifdef pdebug
     951#ifdef debug
    952952        G4int nInH=intQHadrons.size();             // Resulting #of hadrons after decay ^
    953953        G4cout<<"G4QE::CrQ:nH="<<nInH<<",C="<<totCharge<<",B="<<totBaryoN<<G4endl;//    ^
     
    955955        if(!(input.size()))                        // *RETURN* Without Quasmon creation-^
    956956        {                                          //                                   ^
    957 #ifdef pdebug
     957#ifdef debug
    958958          G4cout<<"*G4QEnv::CrQ:AnnihStack tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;//^
    959959#endif
    960960          return;                                  // Do not clear and delete objects --^
    961961        }                                          //                                   ^
    962 #ifdef pdebug
     962#ifdef debug
    963963        G4cout<<"G4QE::CrQ:fakeQ, restPars tC="<<totCharge<<",tB="<<totBaryoN<<G4endl;//^
    964964#endif
     
    967967        // From this point the new temporary environment is created (multiQuasmon)      ^
    968968        G4QEnvironment* muq = new G4QEnvironment(input,theEnvironment.GetPDG());//<--+  ^
    969 #ifdef pdebug
     969#ifdef debug
    970970        G4cout<<"G4QE::CrQ:befCl&Dest tC="<<totCharge<<", tB="<<totBaryoN<<G4endl; //^  ^
    971971#endif
     
    977977        delete muq;                                //=====>===========>==============^  ^ ^
    978978        noh = outH->size();                        // a#of Not Interacting(Q) Hadrons   ^ ^
    979 #ifdef pdebug
     979#ifdef debug
    980980        G4cout<<"G4QEnv::CreateQ:*** #ofNotInterQH="<<noh<<" is found ***"<<G4endl; //  ^ ^
    981981#endif
    982982        if(noh) for(G4int nh=0; nh<noh; nh++)      // One can escape it but...          ^ ^
    983983        {                                          //                                   ^ ^
    984 #ifdef pdebug
     984#ifdef debug
    985985          G4cout<<"G4QE::CreateQ: NotIntQH#"<<nh<<", QC="<<(*outH)[nh]->GetQC()  //     ^ ^
    986986                <<", 4M="<<(*outH)[nh]->Get4Momentum()<<G4endl;                  //     ^ ^
     
    996996        delete outH;                               // >---->---->---->---->---->---->---^-+
    997997        G4int nMQ = outQ->size();                  // A#ofQuasmons in MultyQuasmonOutput^
    998 #ifdef pdebug
     998#ifdef debug
    999999        G4LorentzVector eLorV=theEnvironment.Get4Momentum(); //                         ^
    10001000        G4cout<<"G4QE::CrQ:nMQ="<<nMQ<<",tC="<<totCharge<<", tB="<<totBaryoN<<G4endl;// ^
     
    10051005        {                                          //                                   ^
    10061006          G4Quasmon* curQ = new G4Quasmon((*outQ)[mh]);// Copy to destroy TMP(?)        ^
    1007 #ifdef pdebug
     1007#ifdef debug
    10081008          G4LorentzVector qLorV=curQ->Get4Momentum(); //                                ^
    10091009          G4cout<<"G4QE::CrQ:Q#"<<mh<<",4M="<<qLorV<<curQ->GetQC()<<G4endl; //          ^
     
    10151015        outQ->clear();                             //                                   ^
    10161016        delete outQ;                               // >=================================+
    1017 #ifdef pdebug
     1017#ifdef debug
    10181018        G4int nsHadr  = theQHadrons.size();      // Update the value of OUTPUT entries
    10191019        G4cout<<"G4QEnvironment::CreateQ: before return nH="<<nsHadr<<G4endl;
     
    10441044    PrepareInteractionProbabilities(EnFlQC,EnFlP); // InteractionProbabilities for clusters
    10451045    G4int nCandid = theQCandidates.size();
    1046 #ifdef pdebug
     1046#ifdef debug
    10471047    G4cout<<"G4QEnvironment::CrQ: InteractionProbabilities are done, nC="<<nCandid<<G4endl;
    10481048#endif
     
    10581058    if(nCandid==1||maxP==0.)
    10591059    {
    1060 #ifdef pdebug
     1060#ifdef debug
    10611061      G4cout<<"***G4QEnv::CrQ:MaxP=0||nCand=1: Use all Env., Env="<<theEnvironment<<G4endl;
    10621062#endif
     
    10671067    {
    10681068      G4double totP = maxP * G4UniformRand();
    1069 #ifdef pdebug
     1069#ifdef debug
    10701070      G4cout<<"G4QEnvironment::CrQ:nC="<<nCandid<<", maxP="<<maxP<<", totP="<<totP<<G4endl;
    10711071#endif
     
    10811081      if(pq4M.m()>=clMass)
    10821082      {
    1083 #ifdef pdebug
     1083#ifdef debug
    10841084        G4cout<<"G4QEnv::CQ:#"<<i<<"("<<targClust<<curQC<<") Env="<<theEnvironment<<G4endl;
    10851085#endif
     
    10921092        if(te4M.m()>=teMass)
    10931093        {
    1094 #ifdef pdebug
     1094#ifdef debug
    10951095          G4cout<<"***G4QEnv::CrQ: Deep virtual, use all Env,Env="<<theEnvironment<<G4endl;
    10961096#endif
     
    11141114      q4Mom=G4LorentzVector(0.,0.,0.,tgMass-envMass);// PhotoInteracts with BoundedCluster
    11151115      valQ=curQC;
    1116 #ifdef pdebug
     1116#ifdef debug
    11171117      G4cout<<"G4QE::CrQ:Q="<<q4Mom<<valQ<<"+vg="<<proj4M<<",Env="<<theEnvironment<<G4endl;
    11181118#endif
     
    11251125      q4Mom=proj4M+G4LorentzVector(0.,0.,0.,tgMass-envMass);// PION + BoundCluster
    11261126      valQ=EnFlQC+curQC;
    1127 #ifdef pdebug
     1127#ifdef debug
    11281128      if(projE<mPi)G4cout<<"*VirtualPiM*G4QE::CrQ:Ener(pi-)="<<projE<<"<mPi="<<mPi<<G4endl;
    11291129      G4cout<<"G4QEnv::CrQ:Q="<<q4Mom<<valQ<<"+pi="<<proj4M<<",E="<<theEnvironment<<G4endl;
     
    11381138      valQ=EnFlQC;                        // qc: QUASMON=Projectile
    11391139      theEnvironment=memEnviron;
    1140 #ifdef pdebug
     1140#ifdef debug
    11411141      G4cout<<"G4QEnv::CreQAll: Q="<<q4Mom<<valQ<<", QEnv="<<theEnvironment<<G4endl;
    11421142#endif
     
    11881188        om=(tnM2+rmu2+rt)/dtnM;           // Energy of the excited cluster
    11891189        ep=prE+tnM-om;                    // Energy of the scattered projectile (epsilon)
    1190 #ifdef pdebug
     1190#ifdef debug
    11911191        G4cout<<"G4QEnv::CreQAll: m2="<<tnM2<<" < mu2="<<rmu2<<" < "<<mu2<<"=Max2"<<G4endl;
    11921192        G4cout<<"G4QEnv::CreQAll: -t="<<rt<<" < "<<tmax<<"=tmax"<<G4endl;
     
    11991199      G4double om2=om*om;
    12001200      if(om2<rmu2)G4cout<<"-Warn-G4QEnv::CreQA:(scat w ex)e2="<<om<<" < mu2="<<tnM<<G4endl;
    1201 #ifdef pdebug
     1201#ifdef debug
    12021202      G4cout<<"G4QEnv::CreQAll: ct="<<cost<<",pio="<<Pi*po<<",()="<<cost*Pi*po<<G4endl;
    12031203      G4double ps=std::sqrt(om2-rmu2);    // Momentum of the excited cluster (p)
     
    12211221      G4ThreeVector fp=pfc*vx+pfs*(std::sin(phi)*vy+std::cos(phi)*vz);
    12221222      G4LorentzVector s4M(fp,ep);
    1223 #ifdef pdebug
     1223#ifdef debug
    12241224      G4cout<<"G4QEnv::CreQA:ps="<<po<<"="<<fp.mag()<<",sM="<<prM<<"="<<s4M.m()<<G4endl;
    12251225      G4cout<<"G4QEnv::CreQA:Ee="<<prE*ep<<" =? "<<(prM2+rt/2-Pi*po*cost)<<G4endl;
     
    12271227      if(std::fabs(s4M.m()-scM)>.001)G4cout<<"-W-G4QE::CQA:M="<<prM<<"#"<<s4M.m()<<G4endl;
    12281228      G4LorentzVector c4M=proj4M+G4LorentzVector(0.,0.,0.,tnM)-s4M;
    1229 #ifdef pdebug
     1229#ifdef debug
    12301230      G4cout<<"G4QEnv::CreQA: ec="<<om<<" = "<<c4M.e()<<", pc="<<ps<<" = "
    12311231            <<c4M.rho()<<", mc2="<<rmu2<<" = "<<c4M.m2()<<G4endl;
     
    12431243      q4Mom=proj4M+G4LorentzVector(0.,0.,0.,tgMass-envMass); // Projectile + BoundCluster
    12441244      valQ=EnFlQC+curQC;
    1245 #ifdef pdebug
     1245#ifdef debug
    12461246      G4cout<<"G4QEnv::CreQAll: Q="<<q4Mom<<valQ<<", QEnv="<<theEnvironment<<G4endl;
    12471247#endif
     
    13441344//   ==============================================================
    13451345{
    1346 #ifdef pdebug
     1346#ifdef debug
    13471347  G4cout<<"G4QEnvironment::InitClustersVector called with nC="<<maxClust<<G4endl;
    13481348#endif
     
    13751375  static const G4int  NUCPDG = 90000000;
    13761376  static const G4QNucleus vacuum(NUCPDG);
     1377  static const G4LorentzVector zeroLV(0.,0.,0.,0.);
     1378  //static const G4QContent zeroQC(0,0,0,0,0,0);
    13771379  static const G4QContent PiQC(0,1,0,1,0,0);
    13781380  static const G4QContent K0QC(1,0,0,0,0,1);
     
    14311433  }
    14321434#endif
    1433 #ifdef pdebug
     1435#ifdef debug
    14341436  G4cout<<"G4QE::HQE:*HADRONIZE Q-ENVIRONMENT="<<theEnvironment<<",nQ="<<nQuasmons<<G4endl;
    14351437#endif
     
    14371439  {
    14381440    G4int nPDG = theEnvironment.GetPDG();    // PDG code of the residual Nucl.Environ.
    1439 #ifdef pdebug
     1441#ifdef debug
    14401442    G4cout<<"G4QE::HQE:***NO QUASMONS***Env="<<nPDG<<theEnvironment.Get4Momentum()<<G4endl;
    14411443#endif
     
    15191521        if(!ast) nlq--;                          // Reduce nlq if Quasmon decayed         ^
    15201522        G4int nHadrons = output->size();         // A#of output Hadrons in the Quasmon    ^
    1521 #ifdef pdebug
     1523#ifdef debug
    15221524        G4cout<<"G4QEnv::HadrQE: ***Vacuum*** Q#"<<iq<<", nHadr="<<nHadrons<<G4endl; //   ^
    15231525#endif
     
    15281530            //G4QHadron* curH=new G4QHadron(output->operator[](ih));// (Del 7 lines below)^
    15291531            G4QHadron* curH = new G4QHadron((*output)[ih]); // (Deleted 7 lines below)    ^
    1530 #ifdef pdebug
     1532#ifdef debug
    15311533            G4cout<<"G4QEnv::HadrQE:Vacuum, H#"<<ih<<", QPDG="<<curH->GetQPDG() //        ^
    15321534                  <<",4M="<<curH->Get4Momentum()<<G4endl; //                              ^
     
    15691571          else                                   // "Have a chance to recover" case       ^
    15701572          {                                      //                                       ^
    1571 #ifdef pdebug
     1573#ifdef debug
    15721574            G4cout<<"***G4QE::HQE:"<<iq<<",n="<<nHadrons<<",Tot="<<totQC<<totQM<<G4endl;//^
    15731575            for (G4int kq=0; kq<nQuasmons; kq++) // LOOP over Quasmons for DEBUG PRINTING ^
     
    16161618                if(!ast) nlq--;                  // Reduce nlq if Quasmon decayed       ^ ^
    16171619                G4int nHadrons=curout->size();   // A#of outputQHadrons in theDecayedQ  ^ ^
    1618 #ifdef pdebug
     1620#ifdef debug
    16191621                G4cout<<"G4QEnv::HadrQE:VacuumRecoverQ#"<<iq<<",n="<<nHadrons<<G4endl;//^ ^
    16201622#endif
     
    16251627                    //G4QHadron* curH = new G4QHadron(curout->operator[](ih)); //       ^ ^
    16261628                    G4QHadron* curH = new G4QHadron((*curout)[ih]); //                  ^ ^
    1627 #ifdef pdebug
     1629#ifdef debug
    16281630                    G4cout<<"G4QEnv::HadrQE:Recovered, H#"<<ih<<", QPDG=" //            ^ ^
    16291631                          <<curH->GetQPDG()<<",4M="<<curH->Get4Momentum()<<G4endl;  //  ^ ^
     
    18231825        G4int           Qst= pQ->GetStatus();
    18241826        sumstat           += Qst;
    1825 #ifdef pdebug
     1827#ifdef debug
    18261828        G4cout<<"G4QEnv::HadrQE:#"<<iq<<", Qst="<<Qst<<", Q="<<Q4M<<Q4M.m()<<QQC<<", Env="
    1827               <<theEnvironment<<G4endl;
    1828 #endif
     1829              <<theEnvironment<<",nQ="<<nQuasmons<<G4endl;
     1830#endif
     1831        if(nQuasmons>1 && iq+1==nQuasmons && !Qst && Q4M==zeroLV)
     1832        {
     1833          theQuasmons.pop_back();                // Exclude the zero-Quasmon
     1834          delete pQ;                             // and delet it
     1835          nQuasmons--;
     1836        }
    18291837        if(Qst==1||Qst==3||Qst==4)
    18301838        {
     
    18621870      // === Now we should be prepared for evaporation ===
    18631871      G4int      totChg=totQC.GetCharge();    // Total Electric Charge of the Total System
    1864 #ifdef pdebug
     1872#ifdef debug
    18651873      if(totPDG==90999999||totPDG==90999000||totPDG==90000999||totPDG==89999001)
    18661874      G4cout<<"***G4QEnv::HadrQEnv: Meson (1) PDG="<<totPDG<<", M="<<tot4M.m()<<G4endl;
     
    18991907          G4Quasmon* pQ     = theQuasmons[jq];// Pointer to the CurrentQuasmon <--<--<--+
    19001908          G4int      status = pQ->GetStatus();// Old status of the Quasmon              ^
    1901 #ifdef pdebug
     1909#ifdef debug
    19021910          G4cout<<"G4QE::HQE:Status of Q#"<<jq<<" (before Fragment)="<<status<<G4endl;//^
    19031911#endif
     
    19071915            if(nQuas==1&&first) nQuas=-nQuas;
    19081916            G4QHadronVector* output=pQ->Fragment(theEnvironment,nQuas);//<DESTRUCT<--<--^-+
    1909 #ifdef pdebug
     1917#ifdef debug
    19101918            G4cout<<"G4QE::HQE:Q#"<<jq<<",*afterFragm* Env="<<theEnvironment<<G4endl;// ^ ^
    19111919#endif
     
    19791987                  G4double hKE=0.;            // Kinetic Energy of the Hadron           ^ ^
    19801988                  G4LorentzVector hLV=inpH->Get4Momentum(); //                          ^ ^
    1981 #ifdef pdebug
     1989#ifdef debug
    19821990                  G4cout<<"G4QEnv::HadrQE:H#"<<ih<<", hC="<<hC<<",hF="<<hF<<",4M=" //   ^ ^
    19831991                        <<hLV<<inpH->GetPDGCode()<<G4endl;  //                          ^ ^
     
    19972005                      G4LorentzVector tLV=hLV+pQ->Get4Momentum();//                     ^ ^
    19982006                      pQ->InitQuasmon(tQC,tLV); // Reinitialize the current Quasmon     ^ ^
    1999 #ifdef pdebug
     2007#ifdef debug
    20002008                      G4cout<<"G4QE::HQE:Medium, H#"<<ih<<", QPDG="<<inpH->GetQPDG() // ^ ^
    20012009                            <<",4M="<<inpH->Get4Momentum()<<" is suckedInQ"<<G4endl; // ^ ^
     
    20072015                      G4LorentzVector tLV=hLV+theEnvironment.Get4Momentum(); //         ^ ^
    20082016                      theEnvironment=G4QNucleus(tQC,tLV); // Reinit currentEnvironment  ^ ^
    2009 #ifdef pdebug
     2017#ifdef debug
    20102018                      G4cout<<"G4QE::HQE:Med,H#"<<ih<<",PDG="<<inpH->GetQPDG()<<",4M="//^ ^
    20112019                            <<inpH->Get4Momentum()<<" is suckedInEnvironment"<<G4endl;//^ ^
     
    20162024                  {                           //                                        ^ ^
    20172025                    G4QHadron* curH = new G4QHadron(inpH); //                           ^ ^
    2018 #ifdef pdebug
     2026#ifdef debug
    20192027                    G4LorentzVector ph4M=curH->Get4Momentum(); // 4-mom of the hadron   ^ ^
    20202028                    G4double phX=ph4M.x();    // p_x of the hadron                      ^ ^
     
    20392047            else if(status<0||status==2)      // => "PANIC or NOTHING was done" case      ^
    20402048            {                                 //                                          ^
    2041 #ifdef pdebug
     2049#ifdef debug
    20422050              G4cout<<"G4QE::HQE:***PANIC***,status="<<status<<",nC="<<nCount<<G4endl; // ^
    20432051#endif
     
    20632071              else if(status==2 && eCount==1 && cAN<mcAN && envM>500.)// Add N from E to Q^
    20642072              {                               //                                          ^
    2065 #ifdef pdebug
     2073#ifdef debug
    20662074                    G4cout<<"G4QE::HQE:E="<<theEnvironment<<",M="<<envM<<",c="<<cAN<<G4endl;//^
    20672075#endif
     
    20782086                  nucQC=protQC;               // proton QContent                          ^
    20792087                }                             //                                          ^
    2080 #ifdef pdebug
     2088#ifdef debug
    20812089                    G4cout<<"G4QE::HQE:P,eZ="<<envZ<<",eN="<<envN<<",rPDG="<<resPDG<<G4endl;//^
    20822090#endif
     
    20942102                theEnvironment=G4QNucleus(res4M,resPDG);// Update the Environment         ^
    20952103                theQuasmons[0]->IncreaseBy(nucQC,nuc4M);// Update the Only Quasmon        ^
    2096 #ifdef pdebug
     2104#ifdef debug
    20972105                    G4cout<<"G4QE::HQE:P,Q="<<nucQC<<nuc4M<<",env="<<theEnvironment<<G4endl;//^
    20982106#endif
     
    21002108              else if(status==2&&nCount>nCnMax)// Treat PANIC for stat=2 (NothingWasDone) ^
    21012109              {                               //                                          ^
    2102 #ifdef pdebug
     2110#ifdef debug
    21032111                    G4cout<<"G4QE::HQE:PANIC,nC="<<nCount<<">"<<nCnMax<<G4endl; //            ^
    21042112#endif
     
    22572265                          G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M); //    ^
    22582266                          theQHadrons.push_back(h1H);        // (delete equivalent)       ^
    2259 #ifdef pdebug
     2267#ifdef debug
    22602268                          G4cout<<"G4QE::HQE:(1) H1="<<h1QPDG<<h14M<<G4endl;        //    ^
    22612269#endif
    22622270                          G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M); //    ^
    22632271                          theQHadrons.push_back(h2H);        // (delete equivalent)       ^
    2264 #ifdef pdebug
     2272#ifdef debug
    22652273                          G4cout<<"G4QE::HQE:(1) H2="<<h2QPDG<<h24M<<G4endl;        //    ^
    22662274#endif
    22672275                          G4QHadron* qeH = new G4QHadron(envPDG,e4M);               //    ^
    22682276                          theQHadrons.push_back(qeH);        // (delete equivalent)       ^
    2269 #ifdef pdebug
     2277#ifdef debug
    22702278                          G4cout<<"G4QE::HQE:(1) QEnv="<<envPDG<<e4M<<G4endl;       //    ^
    22712279#endif
     
    23132321                        G4QHadron* qH = new G4QHadron(qPDG,fq4M);// the out going Quasmon ^
    23142322                        theQHadrons.push_back(qH); // (delete equivalent)                 ^
    2315 #ifdef pdebug
     2323#ifdef debug
    23162324                        G4cout<<"G4QE::HQE:QuasmH="<<qPDG<<fq4M<<G4endl;         //       ^
    23172325#endif
    23182326                        G4QHadron* qeH = new G4QHadron(envPDG,qe4M);//theRecoilEnvironment^
    2319 #ifdef pdebug
     2327#ifdef debug
    23202328                        G4cout<<"G4QE::HQE:EnvironH="<<envPDG<<qe4M<<G4endl;     //       ^
    23212329#endif
     
    23812389                        G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);    //   ^
    23822390                        theQHadrons.push_back(h1H);               // (delete equivalent)  ^
    2383 #ifdef pdebug
     2391#ifdef debug
    23842392                        G4cout<<"G4QE::HQE: QCip-> H1="<<h1QPDG<<h14M<<G4endl;       //   ^
    23852393#endif
    23862394                        G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M);    //   ^
    23872395                        theQHadrons.push_back(h2H);               // (delete equivalent)  ^
    2388 #ifdef pdebug
     2396#ifdef debug
    23892397                        G4cout<<"G4QE::HQE: QChip->H2="<<h2QPDG<<h24M<<G4endl;       //   ^
    23902398#endif
     
    24972505                        G4QHadron* hadr = new G4QHadron(totQC,tot4M); //                  ^
    24982506                        theQHadrons.push_back(hadr);    // Cor or fill as It Is           ^
    2499 #ifdef pdebug
     2507#ifdef debug
    25002508                        G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;//^
    25012509#endif
     
    25052513                      return theQHadrons;    //                                           ^
    25062514                    } //                                                                  ^
    2507 #ifdef pdebug
     2515#ifdef debug
    25082516                    G4cout<<"G4QEnv::HadronizeQEnv: Sigma="<<PDGQ<<cq4M<<" -> Hyperon="// ^
    25092517                          <<hyPDG<<b4Mom<<" + Gamma/Pi="<<pigPDG<<m4Mom<<G4endl; //       ^
     
    25652573                        G4QHadron* hadr = new G4QHadron(totQC,tot4M); //                  ^
    25662574                        theQHadrons.push_back(hadr);    // Cor or fill as It Is           ^
    2567 #ifdef pdebug
     2575#ifdef debug
    25682576                        G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;//^
    25692577#endif
     
    25732581                      return theQHadrons;    //                                           ^
    25742582                    } //                                                                  ^
    2575 #ifdef pdebug
     2583#ifdef debug
    25762584                    G4cout<<"G4QEnv::HadronizeQEnv: NSigma="<<PDGQ<<cq4M<<"-> Sigma/dN="//^
    25772585                          <<hyPDG<<b4Mom<<" + N/Pi="<<pigPDG<<m4Mom<<G4endl; //           ^
     
    26402648                        G4QHadron* hadr = new G4QHadron(totQC,tot4M); //                  ^
    26412649                        theQHadrons.push_back(hadr);    // Cor or fill as It Is           ^
    2642 #ifdef pdebug
     2650#ifdef debug
    26432651                        G4cout<<"-Warn-G4QE::HQE:Sig,QC="<<totQC<<",4M="<<tot4M<<G4endl;//^
    26442652#endif
     
    26482656                      return theQHadrons;    //                                           ^
    26492657                    } //                                                                  ^
    2650 #ifdef pdebug
     2658#ifdef debug
    26512659                    G4cout<<"G4QEnv::HadronizeQEnv:2NSigma="<<PDGQ<<cq4M<<"-> Sigma/Pi="//^
    26522660                          <<hyPDG<<b4Mom<<" + 2N/3N="<<pigPDG<<m4Mom<<dinFlag<<G4endl; // ^
     
    26802688                    {                         //                                          ^
    26812689                      G4QHadron* resQ = new G4QHadron(PDGQ,cq4M); // GSM hadron for CurQ  ^
    2682 #ifdef pdebug
     2690#ifdef debug
    26832691                      G4cout<<"G4QEnv::HadrQEnv:ResQ="<<PDGQ<<cq4M<<G4endl;         //    ^
    26842692#endif
     
    28242832            delete output;                      // >================================|=====^
    28252833          } // End of skip of the dead Quasmons                                     |
    2826 #ifdef pdebug
     2834#ifdef debug
    28272835          G4cout<<"G4QE::HQE:QStat("<<jq<<"="<<status<<pQ->Get4Momentum()<<G4endl;//|
    28282836#endif
     
    29042912                G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    29052913                theQHadrons.push_back(hadr);   // Cor or fill as It Is
    2906 #ifdef pdebug
     2914#ifdef debug
    29072915                G4cout<<"***G4QE::HQE:FillAsIs(-4),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    29082916#endif
     
    29322940                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    29332941                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    2934 #ifdef pdebug
     2942#ifdef debug
    29352943                  G4cout<<"***G4QE::HQE:FillAsIs(-3),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    29362944#endif
     
    29402948                return theQHadrons;
    29412949              }
    2942 #ifdef pdebug
     2950#ifdef debug
    29432951              G4cout<<"G4QEnv::HadronizeQEnv: DELTA="<<totPDG<<tot4M<<" -> Bar="
    29442952                    <<bPDG<<b4Mom<<" + Mes="<<mPDG<<m4Mom<<G4endl;
     
    29782986                G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    29792987                theQHadrons.push_back(hadr);   // Cor or fill as It Is
    2980 #ifdef pdebug
     2988#ifdef debug
    29812989                G4cout<<"***G4QE::HQE:FillAsIs(-2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    29822990#endif
     
    29862994              return theQHadrons;
    29872995            }
    2988 #ifdef pdebug
     2996#ifdef debug
    29892997            G4cout<<"G4QEnv::HadronizeQEnv: Chipo="<<tot4M<<" -> h1="
    29902998                  <<h1PDG<<h14Mom<<" + Mes="<<h2PDG<<h24Mom<<G4endl;
     
    30163024                G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    30173025                theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3018 #ifdef pdebug
     3026#ifdef debug
    30193027                G4cout<<"***G4QE::HQE:FillAsIs(-1),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    30203028#endif
     
    30243032              return theQHadrons;
    30253033            }
    3026 #ifdef pdebug
     3034#ifdef debug
    30273035            G4cout<<"G4QE::HQE:"<<tot4M<<"->h="<<totPDG<<h4Mom<<" + gamma="<<g4Mom<<G4endl;
    30283036#endif
     
    30803088                G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    30813089                theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3082 #ifdef pdebug
     3090#ifdef debug
    30833091                G4cout<<"***G4QE::HQE:FillAsIs(0),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    30843092#endif
     
    30883096              return theQHadrons;
    30893097            }
    3090 #ifdef pdebug
     3098#ifdef debug
    30913099            G4cout<<"G4QE::HQE:"<<tot4M<<"->h="<<mbPDG<<h4Mom<<"+p="<<piPDG<<g4Mom<<G4endl;
    30923100#endif
     
    31153123              for (G4int ih=0; ih<nHadrons; ih++)// LOOP over output QHadrons       ^
    31163124              {                                  //                                 ^
    3117 #ifdef pdebug
     3125#ifdef debug
    31183126                G4cout<<"G4QEnv::HadrQE:NewB<2, H#"<<ih //                          ^
    31193127                      <<", QPDG="<<(*curout)[ih]->GetQPDG() //                      ^
     
    32783286                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    32793287                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3280 #ifdef pdebug
     3288#ifdef debug
    32813289                  G4cout<<"***G4QEnv::HQE:FillAsItIs(1),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    32823290#endif
     
    32863294                return theQHadrons;
    32873295              }
    3288 #ifdef pdebug
     3296#ifdef debug
    32893297              G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> M="
    32903298                    <<aKPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<totQC<<G4endl;
     
    33153323                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    33163324                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3317 #ifdef pdebug
     3325#ifdef debug
    33183326                  G4cout<<"***G4QEnv::HQE:FillAsItIs(2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    33193327#endif
     
    33323340              {
    33333341                G4QHadron* curP = new G4QHadron(PiPDG,onePi);
    3334 #ifdef pdebug
     3342#ifdef debug
    33353343                G4cout<<"G4QEnv::HadrQEnv:SPion#"<<ip<<",H="<<PiPDG<<onePi<<G4endl;
    33363344#endif
     
    33423350              {
    33433351                G4QHadron* curP = new G4QHadron(aKPDG,oneK);
    3344 #ifdef pdebug
     3352#ifdef debug
    33453353                G4cout<<"G4QEnv::HadrQEnv:Kaon#"<<jp<<",H="<<aKPDG<<oneK<<G4endl;
    33463354#endif
     
    33763384                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    33773385                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3378 #ifdef pdebug
     3386#ifdef debug
    33793387                  G4cout<<"***G4QEnv::HQE:FillAsItIs(2),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    33803388#endif
     
    33843392                return theQHadrons;
    33853393              }
    3386 #ifdef pdebug
     3394#ifdef debug
    33873395              G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> Sig="
    33883396                    <<SiPDG<<m4Mom<<" + N="<<totPDG<<n4Mom<<totQC<<G4endl;
     
    34133421                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    34143422                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3415 #ifdef pdebug
     3423#ifdef debug
    34163424                  G4cout<<"***G4QEnv::HQE:FillAsItIs(3),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    34173425#endif
     
    34303438              {
    34313439                G4QHadron* curP = new G4QHadron(PiPDG,onePi);
    3432 #ifdef pdebug
     3440#ifdef debug
    34333441                G4cout<<"G4QEnv::HadrQEnv:SPion#"<<ip<<",H="<<PiPDG<<onePi<<G4endl;
    34343442#endif
     
    34403448              {
    34413449                G4QHadron* curP = new G4QHadron(SiPDG,oneS);
    3442 #ifdef pdebug
     3450#ifdef debug
    34433451                G4cout<<"G4QEnv::HadrQEnv:Sigma#"<<jp<<",H="<<SiPDG<<oneS<<G4endl;
    34443452#endif
     
    34663474                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    34673475                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3468 #ifdef pdebug
     3476#ifdef debug
    34693477                  G4cout<<"***G4QEnv::HQE:FillAsItIs(5),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    34703478#endif
     
    34743482                return theQHadrons;
    34753483              }
    3476 #ifdef pdebug
     3484#ifdef debug
    34773485              G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> M="<<PiPDG<<m4Mom<<" + N="
    34783486                    <<totPDG<<n4Mom<<totQC<<G4endl;
     
    35033511                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    35043512                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3505 #ifdef pdebug
     3513#ifdef debug
    35063514                  G4cout<<"***G4QEnv::HQE:FillAsItIs(5),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    35073515#endif
     
    35113519                return theQHadrons;
    35123520              }
    3513 #ifdef pdebug
     3521#ifdef debug
    35143522              G4cout<<"G4QEnv::HadronizeQEnv: SN="<<tot4M<<" -> N*PI="<<PiPDG
    35153523                    <<" (4M1="<<m4Mom<<" + 4M2="<<k4Mom<<") + N="<<totPDG<<n4Mom<<G4endl;
     
    35433551        return theQHadrons;
    35443552      }
    3545       else                                       // ==> "Only GSEnvironment exists" case
     3553      else                                       // ==> "Only with GSEnvironment" case
    35463554      {
    35473555        if(totPDG==90000000 || fabs(totMass)<0.000001)
     
    35513559        }
    35523560        G4double dM=totMass-totM;
    3553 #ifdef pdebug
     3561#ifdef debug
    35543562        G4cout<<"G4QEnv::HadrQEnv:GroundState tM-GSM="<<dM<<",GSM="<<totM<<",tPDG="<<totPDG
    35553563              <<",nQ="<<nQuasmons<<G4endl;
    35563564#endif
    35573565        G4Quasmon*       pQ = theQuasmons[0];    // Pointer to the first Quasmon         
    3558         G4QPDGCode    QQPDG = pQ->GetQPDG();     // QPDG of the Quasmon
     3566        G4QPDGCode    QQPDG = pQ->GetQPDG();     // QPDG of the first Quasmon
    35593567        G4int          QPDG = QQPDG.GetPDGCode();
    35603568        G4QNucleus    totRN(totQC,tot4M);        // Nucleus for theTotalResidualNuclearComp
     
    35723580        {
    35733581          G4int envPDG = theEnvironment.GetPDG();// PDGCode of the NuclQEnvironment
    3574 #ifdef pdebug
     3582#ifdef debug
    35753583          G4cout<<"G4QEnv::HadrQEnv: nQ=1, QPDG=="<<QPDG<<G4endl;
    35763584#endif
     
    36693677                  G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    36703678                  theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3671 #ifdef pdebug
     3679#ifdef debug
    36723680                  G4cout<<"***G4QEnv::HQE:FillAsItIs(6),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    36733681#endif
     
    36803688              G4QHadron* h1H = new G4QHadron(h1QPDG.GetPDGCode(),h14M);
    36813689              theQHadrons.push_back(h1H);        // (delete equivalent)
    3682 #ifdef pdebug
     3690#ifdef debug
    36833691              G4cout<<"G4QE::HQE:(2) H1="<<h1QPDG<<h14M<<G4endl;
    36843692#endif
    36853693              G4QHadron* h2H = new G4QHadron(h2QPDG.GetPDGCode(),h24M);
    36863694              theQHadrons.push_back(h2H);        // (delete equivalent)
    3687 #ifdef pdebug
     3695#ifdef debug
    36883696              G4cout<<"G4QE::HQE:(2) H2-"<<h2QPDG<<h24M<<G4endl;
    36893697#endif
    36903698              G4QHadron* qeH = new G4QHadron(envPDG,e4M);
    36913699              theQHadrons.push_back(qeH);        // (delete equivalent)
    3692 #ifdef pdebug
     3700#ifdef debug
    36933701              G4cout<<"G4QE::HQE:(2) QEenv="<<envPDG<<e4M<<G4endl;
    36943702#endif
     
    37013709            CleanUp();
    37023710            G4QHadron* evH = new G4QHadron(totQC,tot4M);// Create a Hadron for ResidualNucl
    3703             EvaporateResidual(evH);            // Try to evaporate residual (del. equiv.)
     3711            EvaporateResidual(evH);              // Try to evaporate residual (del. equiv.)
    37043712            return theQHadrons;
     3713          }
     3714          else                                   // No environment
     3715          {
     3716            G4int nHadrs=theQHadrons.size();     // #of available hadrons
     3717            for(G4int ih=0; ih<nHadrs; ++ih)
     3718            {
     3719              G4QHadron* ch=theQHadrons[ih];
     3720              G4LorentzVector ch4M=ch->Get4Momentum();
     3721              G4double chM=ch4M.m();
     3722              G4LorentzVector tch4M=ch4M+tot4M;
     3723              if(tch4M.m() > chM + totM)         // Can be corrected
     3724              {
     3725                G4LorentzVector h14M(0.,0.,0.,chM);
     3726                G4LorentzVector h24M(0.,0.,0.,totM);
     3727                if(!G4QHadron(tch4M).DecayIn2(h14M,h24M))
     3728                {
     3729                  G4cout<<"-Warning->G4QE::HQE:M="<<tch4M.m()<<"->"<<chM<<"+"<<totM<<"="
     3730                        <<chM+totM<<G4endl;
     3731                }
     3732                else
     3733                {
     3734                  tot4M=h24M;                    // Change the residual 4M
     3735                  ch->Set4Momentum(h14M);        // Change 4M of the current hadron
     3736                  break;                         // Quit the loop
     3737                }
     3738              }
     3739            }
     3740            G4QHadron* rH = new G4QHadron(totQC,tot4M);// Create a Hadron for ResidualNucl
     3741            theQHadrons.push_back(rH);
    37053742          }
    37063743        }
     
    37183755        else if(2>3)  // "Try to correct" case (change condition)
    37193756        {
    3720 #ifdef pdebug
     3757#ifdef debug
    37213758          G4cout<<"***G4QEnv::HadrQE: M="<<totMass<<",dM="<<dM<<",nQ="<<nQuasmons<<G4endl;
    37223759#endif
     
    37923829                      G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    37933830                      theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3794 #ifdef pdebug
     3831#ifdef debug
    37953832                      G4cout<<"***G4QE::HQE:FillAsIs(7),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    37963833#endif
     
    38013838                  }
    38023839                  G4QHadron* H1 = new G4QHadron(PDG1,fq4M);
    3803 #ifdef pdebug
     3840#ifdef debug
    38043841                  G4cout<<"G4QE::HQE:Kaon(Env)="<<PDG1<<fq4M<<G4endl;
    38053842#endif
    38063843                  theQHadrons.push_back(H1);     // (delete equivalent)
    38073844                  G4QHadron* H2 = new G4QHadron(PDG2,qe4M);
    3808 #ifdef pdebug
     3845#ifdef debug
    38093846                  G4cout<<"G4QE::HQE:ResidEnv="<<PDG2<<qe4M<<G4endl;
    38103847#endif
     
    38563893                      G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    38573894                      theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3858 #ifdef pdebug
     3895#ifdef debug
    38593896                      G4cout<<"***G4QE::HQE:FillAsIs(8),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    38603897#endif
     
    38663903                  G4QHadron* H1 = new G4QHadron(PDG1,k14M);
    38673904                  theQHadrons.push_back(H1);     // (delete equivalent)
    3868 #ifdef pdebug
     3905#ifdef debug
    38693906                  G4cout<<"G4QE::HQE:K1(Env)="<<PDG1<<k14M<<G4endl;
    38703907#endif
    38713908                  G4QHadron* H2 = new G4QHadron(PDG2,k24M);
    38723909                  theQHadrons.push_back(H2);     // (delete equivalent)
    3873 #ifdef pdebug
     3910#ifdef debug
    38743911                  G4cout<<"G4QE::HQE:K2(Env)="<<PDG2<<k24M<<G4endl;
    38753912#endif
    38763913                  G4QHadron* H3 = new G4QHadron(PDG3,ra4M);
    38773914                  theQHadrons.push_back(H3);     // (delete equivalent)
    3878 #ifdef pdebug
     3915#ifdef debug
    38793916                  G4cout<<"G4QE::HQE:ResKKEnv="<<PDG3<<ra4M<<G4endl;
    38803917#endif
     
    39243961                      G4QHadron* hadr = new G4QHadron(totQC,tot4M); // totQC not tQC!
    39253962                      theQHadrons.push_back(hadr);   // Cor or fill as It Is
    3926 #ifdef pdebug
     3963#ifdef debug
    39273964                      G4cout<<"***G4QE::HQE:FillAsIs(9),QC="<<totQC<<",4M="<<tot4M<<G4endl;
    39283965#endif
     
    39343971                  G4QHadron* H1 = new G4QHadron(PDG1,fq4M);
    39353972                  theQHadrons.push_back(H1);     // (delete equivalent)
    3936 #ifdef pdebug
     3973#ifdef debug
    39373974                  G4cout<<"G4QE::HQE:h1="<<PDG1<<fq4M<<G4endl;
    39383975#endif
    39393976                  G4QHadron* H2 = new G4QHadron(PDG2,qe4M);
    3940 #ifdef pdebug
     3977#ifdef debug
    39413978                  G4cout<<"G4QE::HQE:h2="<<PDG2<<qe4M<<G4endl;
    39423979#endif
     
    39784015        else                                    // "Last decay was fatal" case @@ buggy ?MK
    39794016        {
    3980 #ifdef pdebug
     4017#ifdef debug
    39814018          G4cout<<"***G4QEnv::HadrQE: M="<<totMass<<",dM="<<dM<<",nQ="<<nQuasmons<<G4endl;
    39824019#endif
     
    39864023          {
    39874024            G4QHadron* hadr = new G4QHadron(totQC,tot4M);
    3988 #ifdef pdebug
     4025#ifdef debug
    39894026            G4cout<<"G4QE::HQE:CheckGS failed H="<<totQC<<tot4M<<G4endl;
    39904027#endif
     
    40274064  G4QContent  theQC  = qH->GetQC();          // Quark Content of the hadron
    40284065  G4int theS=theQC.GetStrangeness();         // S (Strangeness of the nucleus)
    4029 #ifdef pdebug
     4066#ifdef debug
    40304067  G4cout<<"G4QE::EvaporateRes:Called for PDG="<<thePDG<<",4M="<<qH->Get4Momentum()<<G4endl;
    40314068#endif
    40324069  if(theS<0)                                 // Antistrange nucleus
    40334070  {
    4034 #ifdef pdebug
     4071#ifdef debug
    40354072    G4cout<<"G4QE::EvaporateRes: AntistrangeNucleus="<<thePDG<<qH->Get4Momentum()<<G4endl;
    40364073#endif
     
    40404077  else if(theBN==1)
    40414078  {
    4042 #ifdef pdebug
     4079#ifdef debug
    40434080    G4cout<<"G4QE::EvaporateRes: Baryon="<<thePDG<<qH->Get4Momentum()<<G4endl;
    40444081#endif
     
    40484085  else if(!theBN) // @@ In future it is usefull to add the MesonExcitationDecay (?!)
    40494086  {
    4050 #ifdef pdebug
     4087#ifdef debug
    40514088    G4LorentzVector mesLV=qH->Get4Momentum();
    40524089    G4cout<<"G4QE::EvaporateRes:(!)Meson(!) PDG="<<thePDG<<",4M="<<mesLV<<mesLV.m()
     
    40904127  else                                       // Correction must be done
    40914128  {
    4092 #ifdef pdebug
     4129#ifdef debug
    40934130    G4cout<<"G4QE::EvaRes: *Correct* "<<theQC<<q4M<<totMass<<"<"<<totGSM<<G4endl;
    40944131#endif
     
    40964133    if(!CheckGroundState(quasH,true))
    40974134    {
    4098 #ifdef pdebug
     4135#ifdef debug
    40994136      G4cout<<"***G4QE::EvaporResid:GSCorFailed.FillAsItIs,n="<<theQHadrons.size()<<G4endl;
    41004137#endif
     
    41164153  if (qH)
    41174154  {
    4118     G4cout<<"G4QEnvironment::EvaporateResidual: deleted at end, PDG="
    4119            <<qH->GetPDGCode()<<G4endl;
     4155    G4cout<<"G4QEnvironment::EvaporateResidual:EndDeleted, PDG="<<qH->GetPDGCode()<<G4endl;
    41204156    delete qH;
    41214157  }
     
    43264362  static const G4double mSigM= G4QPDGCode(3112).GetMass();
    43274363  static const G4double mSigP= G4QPDGCode(3222).GetMass();
    4328 #ifdef pdebug
     4364  static const G4double mXiZ = G4QPDGCode(3322).GetMass();
     4365  static const G4double mXiM = G4QPDGCode(3312).GetMass();
     4366#ifdef debug
    43294367  static const G4double mDeut= G4QPDGCode(2112).GetNuclMass(1,1,0);
    43304368#endif
     
    43464384  static const G4double mK0mN = mK0+mNeut;
    43474385  static const G4QNucleus vacuum(90000000);
    4348   static const G4double eps=0.005;
     4386  static const G4double eps=0.003;
    43494387  ///////////////static const G4double third=1./3.;
    43504388  ///////////////static const G4double nPDG=90000001;
     
    44544492  }
    44554493  G4int lHadr=theQHadrons[nHadr-1]->GetBaryonNumber();
    4456 #ifdef pdebug
     4494#ifdef debug
    44574495  G4cout<<"G4QE::FSI:after HQE,nH="<<nHadr<<",lHBN="<<lHadr<<",E="<<theEnvironment<<G4endl;
    44584496#endif
     
    44654503    G4int lhPDG=curHadr->GetPDGCode();            // PDG code of the last fragment
    44664504    G4double lhGSM=G4QPDGCode(lhPDG).GetMass();   // GroundStateMass of the last fragment
    4467 #ifdef pdebug
     4505#ifdef debug
    44684506    G4cout<<"G4QE::FSI:lastHadr 4M/M="<<lh4M<<lhM<<",GSM="<<lhGSM<<",PDG="<<lhPDG<<G4endl;
    44694507#endif
     
    44744512      EvaporateResidual(curHadr);      // Try to evaporate Hadr-Nucl (@@DecDib)(delete eq.)
    44754513      nHadr=theQHadrons.size();
    4476 #ifdef pdebug
     4514#ifdef debug
    44774515      G4cout<<"G4QE::FSI:After nH="<<nHadr<<",PDG="<<curHadr->GetPDGCode()<<G4endl;
    44784516#endif
     
    44854523      if(!CheckGroundState(quasH,true))// Try to correct with other hadrons
    44864524      {
    4487 #ifdef pdebug
     4525#ifdef debug
    44884526        // M.K. Fake complain in the low energy nHe/pHe reactions, while everything is OK
    44894527        G4cout<<"---Warning---G4QEnv::FSI:Correction error LeaveAsItIs h4m="<<lh4M<<G4endl;
     
    45014539    else delete curHadr;               // ==> Leave the nucleus as it is (close to the GSM)
    45024540  }
    4503 #ifdef pdebug
     4541#ifdef debug
    45044542  G4LorentzVector ccs4M(0.,0.,0.,0.);  // CurrentControlSum of outgoing Hadrons
    45054543#endif
     
    45414579    G4int hPDG = theCurr->GetPDGCode();
    45424580    G4LorentzVector h4Mom = theCurr->Get4Momentum();
    4543 #ifdef pdebug
     4581#ifdef debug
    45444582    G4int hNF  = theCurr->GetNFragments();
    45454583    G4cout<<"G4QE::FSI:h#"<<ipo<<",PDG="<<hPDG<<h4Mom<<",mGS="<<G4QPDGCode(hPDG).GetMass()
     
    45704608    if(hPDG==89002000||hPDG==89001001||hPDG==89000002)// 2pt dec. of anti-strange (3pt dec)
    45714609    {
    4572 #ifdef pdebug
     4610#ifdef debug
    45734611      G4cout<<"G4QE::FSI:***ANTISTRANGE*** i="<<ipo<<",PDG="<<hPDG<<",BaryN="<<hBN<<G4endl;
    45744612#endif
     
    45944632          else if(hMi>mProt+mPi) // @@ Does not conserve strangeness (Week decay)
    45954633          {
    4596 #ifdef pdebug
     4634#ifdef debug
    45974635            G4cout<<"**G4QE::FSI:ANTISTRANGE*++*STRANGENESS,PDG="<<hPDG<<",M="<<hM<<G4endl;
    45984636#endif
     
    46434681          else if(hMi>mProt+mPi0) // @@ Does not conserve strangeness (Week decay)
    46444682          {
    4645 #ifdef pdebug
     4683#ifdef debug
    46464684            G4cout<<"**G4QE::FSI:*ANTISTRANGE*+*STRANGENESS*PDG="<<hPDG<<",M="<<hM<<G4endl;
    46474685#endif
     
    46804718          else if(hMi>mProt+mPi) // @@ Does not conserve strangeness (Week decay)
    46814719          {
    4682 #ifdef pdebug
     4720#ifdef debug
    46834721            G4cout<<"**G4QE::FSI:**ANTISTRANGE*0*STRANGENE**PDG="<<hPDG<<",M="<<hM<<G4endl;
    46844722#endif
     
    46934731      if(!sPDG)
    46944732      {
    4695 #ifdef pdebug
     4733#ifdef debug
    46964734        G4cout<<"***G4QE::FSI:***ANTISTRANGE***CANN'T DECAY,PDG="<<hPDG<<",M="<<hM<<G4endl;
    46974735#endif
     
    48324870            hPDG==90999002||hPDG==91001999) // "3-particles decays of dibaryons and 3N"
    48334871    {
    4834 #ifdef pdebug
     4872#ifdef debug
    48354873      G4cout<<"G4QE::FSI:***nD-/pD++/nnn/ppp***i="<<ipo<<",PDG="<<hPDG<<",A="<<hBN<<G4endl;
    48364874#endif
     
    49544992      if(hM<sum || !G4QHadron(h4Mom).DecayIn3(nu4M,ba4M,pi4M))
    49554993      {
    4956 #ifdef pdebug
     4994#ifdef debug
    49574995        G4int eA=theEnvironment.GetA();
    49584996        G4cout<<"***G4QEnv::FSI:T="<<hPDG<<"("<<hM<<")-> N="<<nuQPDG<<"(M="<<nucM<<") + B="
     
    49635001          G4QHadron* theLast = theCurr;        // Prototype of the pointer to theLastHadron
    49645002          G4QHadron* qH = new G4QHadron(theCurr); // Copy of the Current Hadron
    4965 #ifdef pdebug
     5003#ifdef debug
    49665004          G4cout<<"***G4QE::FSI:#"<<ipo<<",4MQC="<<qH->Get4Momentum()<<qH->GetQC()<<G4endl;
    49675005#endif
     
    49745012            if(lQP.GetPDGCode()!=10) theCurr->SetQPDG(lQP); //CurHadr instead of LastHadr
    49755013            else theCurr->SetQC(theLast->GetQC());// CurHadrPDG instead of LastHadrPDG
    4976 #ifdef pdebug
     5014#ifdef debug
    49775015            G4cout<<"---Warning---G4QE::FSI:l#"<<nhd1<<",4M="<<l4M<<",PDG="<<lQP<<G4endl;
    49785016#endif
     
    50195057    else if(hBN>1 && !sBN && (cBN<0 || cBN>hBN)) // "nN+mD- or nP+mD++ decay"
    50205058    {
    5021 #ifdef pdebug
     5059#ifdef debug
    50225060      G4cout<<"G4QE::FSI:nNmD-/nPmD++ #"<<ipo<<",P="<<hPDG<<",B="<<hBN<<",C="<<cBN<<G4endl;
    50235061#endif
     
    50555093      if(hM<sum || !G4QHadron(h4Mom).DecayIn3(nu4M,ba4M,pi4M))
    50565094      {
    5057 #ifdef pdebug
     5095#ifdef debug
    50585096        G4cout<<"***G4QEnv::FSI:IsN M="<<hM<<","<<hPDG<<"->N="<<nuQPDG<<"(M="<<nucM<<")+"
    50595097              <<nN<<"*B="<<barPDG<<"(M="<<barM<<")+"<<nPi<<"*pi="<<tPDG<<"(M="<<tM<<")="
     
    51175155      }
    51185156    }
    5119 #ifdef pdebug
     5157#ifdef debug
    51205158    G4int           hNFrag= theQHadrons[ipo]->GetNFragments(); //Recover after swapping
    51215159    G4QContent      hQC   = theQHadrons[ipo]->GetQC();         // ...
     
    51285166    ipo=jpo;            // Take into account the roll back in case of the Last substitution
    51295167  }
    5130 #ifdef pdebug
     5168#ifdef debug
    51315169  G4cout<<"G4QE::FSI: >>>CurrentControlSumOf4MomOfHadrons="<<ccs4M<<G4endl;
    51325170#endif
     
    51735211      G4QPDGCode    hQPDG(hPDG);
    51745212      G4double      hGSM = hQPDG.GetMass();     // Ground State Mass of the first fragment
    5175 #ifdef pdebug
     5213#ifdef debug
    51765214      G4cout<<"G4QE::FSI:LOOP START,h#"<<hadron<<curHadr->Get4Momentum()<<hPDG<<G4endl;
    51775215#endif
     
    53525390      G4int hB           = curHadr->GetBaryonNumber();
    53535391      //////////////////////G4int hC           = curHadr->GetCharge();
    5354 #ifdef pdebug
     5392#ifdef debug
    53555393      if(!hF&&(hPDG>80000000&&hPDG<90000000||hPDG==90000000||
    53565394               hPDG>90000000&&(hPDG%1000000>200000||hPDG%1000>300)))
    53575395        G4cout<<"**G4QEnv::FSInteraction: PDG("<<hadron<<")="<<hPDG<<", M="<<hM<<G4endl;
    53585396#endif
    5359 #ifdef pdebug
     5397#ifdef debug
    53605398      G4cout<<"G4QE::FSI:h="<<hPDG<<",S="<<hS<<",B="<<hB<<",#"<<hadron<<"<"<<nHadr<<G4endl;
    53615399#endif
     
    53675405      //if(2>3)                         // Close the ThermoBackFusion (VIMP for gamA TotCS)
    53685406      {
    5369 #ifdef pdebug
     5407#ifdef debug
    53705408        //if(nHadr==3)
    53715409          G4cout<<"G4QE::FSI: h="<<hPDG<<",B="<<hB<<",h#"<<hadron<<" < nH="<<nHadr<<G4endl;
     
    53975435          G4double pCM2=(sM2-rm*rm)*(sM2-sm*sm)/(dsM2+dsM2);
    53985436          G4int   bS = backH->GetStrangeness();
    5399 #ifdef pdebug
     5437#ifdef debug
    54005438          //if(nHadr==3)
    54015439          G4cout<<"G4QE::FSI:"<<pt<<",B="<<bB<<",S="<<bS<<",p="<<pCM2<<"<"<<p2cut<<",hB="
     
    56875725              three=true;
    56885726            }
    5689 #ifdef pdebug
     5727#ifdef debug
    56905728            G4cout<<"G4QE::FSI: "<<three<<",r="<<rQPDG<<",f="<<fQPDG<<",t="<<hQPDG<<G4endl;
    56915729#endif
     
    57005738              else
    57015739              {
    5702 #ifdef pdebug
     5740#ifdef debug
    57035741                G4cout<<"G4QE::FSI:*FUSION IS DONE*,fPDG="<<sPDG<<",PDG1="<<hPDG<<",PDG2="
    57045742                      <<bPDG<<G4endl;
     
    57085746                backH->SetQPDG(rQPDG);
    57095747                backH->Set4Momentum(g4Mom);
    5710 #ifdef pdebug
     5748#ifdef debug
    57115749                G4cout<<"G4QE::FSI:h="<<h4m<<",b="<<b4m<<",s="<<s4M<<G4endl;
    57125750                G4cout<<"G4QE::FSI:f="<<f4Mom<<",g="<<g4Mom<<",s="<<f4Mom+g4Mom<<G4endl;
     
    57245762              else
    57255763              {
    5726 #ifdef pdebug
     5764#ifdef debug
    57275765                G4cout<<"G4QE::FSI:DONE,n="<<nHadr<<",PDG="<<sPDG<<",1="<<hPDG<<",2="<<bPDG
    57285766                      <<G4endl;
     
    57355773                theQHadrons.push_back(newH);      // (delete equivalent for newH)
    57365774                nHadr=theQHadrons.size();
    5737 #ifdef pdebug
     5775#ifdef debug
    57385776                G4cout<<"G4QE::FSI:h="<<h4m<<",b="<<b4m<<G4endl;
    57395777                G4cout<<"G4QE::FSI:s="<<s4M<<" = Sum"<<f4Mom+g4Mom+t4Mom<<G4endl;
     
    57575795            hM=h4m.m();
    57585796            // End of Instead ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    5759 #ifdef pdebug
     5797#ifdef debug
    57605798            G4cout<<"G4QE::FSI:cH4M="<<curHadr->Get4Momentum()<<G4endl;
    57615799#endif
     
    57965834        G4double dmo=rpx*rpx+rpy*rpy+rpz*rpz;
    57975835        G4double dem=re*re+dmo;
    5798 #ifdef pdebug
     5836#ifdef debug
    57995837        G4cout<<"G4QE::FSI: Is Energy&Mom conserved? t4M="<<tot4Mom<<",d2="<<dem<<G4endl;
    58005838#endif
     
    58025840        if(dem>0.0001)                          // Energy or momentum is not conserved
    58035841        {
    5804 #ifdef pdebug
     5842#ifdef debug
    58055843          if(dem>.1)
    58065844          {
     
    58895927          }
    58905928#endif
    5891           G4QHadron* prevHadr = theQHadrons[nHadr-2]; // GetPointer to Hadr prev to theLast
    5892           G4LorentzVector pH4Mom = prevHadr->Get4Momentum(); // 4-mom of thePreviousHadron
    58935929          G4double cHM = curHadr->GetMass();  // Mass of the current hadron
    5894           G4double pHM = prevHadr->GetMass(); // Mass of the current hadron
    5895           tot4Mom+=cH4Mom+pH4Mom;
    5896           G4double totRM=tot4Mom.m();
    5897           if(cHM+pHM<=totRM)                  // *** Make the final correction ***
    5898           {
    5899             if(!G4QHadron(tot4Mom).DecayIn2(pH4Mom,cH4Mom))
    5900             {
    5901               G4cout<<"***G4QE::FSI:**Correction**tot4M="<<tot4Mom<<totRM<<">sM="<<cHM+cHM
    5902                     <<G4endl;
    5903 #ifdef pdebug
    5904               throw G4QException("***G4QEnvironment::FSInteract:CORRECTION DecIn2 error");
    5905 #endif
    5906             }
     5930          G4int ch=0;
     5931          for(ch=nHadr-2; ch>-1; --ch)
     5932          {
     5933            G4QHadron* prevHadr = theQHadrons[ch]; // GetPointer to Hadr prev to theLast
     5934            G4LorentzVector pH4Mom = prevHadr->Get4Momentum();// 4-mom of thePreviousHadron
     5935            G4double pHM = prevHadr->GetMass(); // Mass of the current hadron
     5936            tot4Mom+=cH4Mom+pH4Mom;
     5937            G4double totRM=tot4Mom.m();
     5938            if(cHM+pHM<=totRM)                  // *** Make the final correction ***
     5939            {
     5940              if(!G4QHadron(tot4Mom).DecayIn2(pH4Mom,cH4Mom))
     5941              {
     5942                G4cout<<"***G4QEnv::FSI:**Correction**,tot4M="<<tot4Mom<<totRM<<" > sM="
     5943                      <<cHM+cHM<<G4endl;
     5944#ifdef debug
     5945                throw G4QException("***G4QEnvironment::FSInteract:CORRECTION DecIn2Error");
     5946#endif
     5947              }
    59075948#ifdef chdebug
    5908             G4cout<<"---Warning---G4QE::FSI:***CORRECTION IS DONE*** d="<<dem<<G4endl;
    5909 #endif
    5910             curHadr->Set4Momentum(cH4Mom);
    5911             prevHadr->Set4Momentum(pH4Mom);
    5912           }
    5913           else
    5914           {
    5915             G4cerr<<"*!*G4QE::FSI:NoCor "<<cHM<<"+"<<pHM<<"="<<cHM+pHM<<">"<<totRM<<G4endl;
    5916 #ifdef pdebug
    5917             throw G4QException("***G4QEnvironment::FSInteraction: TEMPORARY EXCEPTION");
    5918 #endif
    5919           }
    5920         }
    5921 #ifdef pdebug
     5949              G4cout<<"---!!!---G4QE::FSI:***CORRECTION IS DONE*** d="<<dem<<G4endl;
     5950#endif
     5951              curHadr->Set4Momentum(cH4Mom);
     5952              prevHadr->Set4Momentum(pH4Mom);
     5953              break;                            // Get out of the correction LOOP
     5954            }
     5955            else tot4Mom-=cH4Mom+pH4Mom;
     5956          }
     5957#ifdef ppdebug
     5958          if(ch<0)
     5959          {
     5960            G4cerr<<"*Warning*G4QEnvir::FSI:***EnergyMomentumCorrection FAILED***"<<G4endl;
     5961
     5962            throw G4QException("***G4QEnvironment::FSInteraction: EnMomCorrectionFailed");
     5963          }
     5964#endif
     5965        }
     5966#ifdef debug
    59225967        else G4cout<<"G4QE::FSI: Yes, it is. d="<<dem<<" for "<<nHadr<<" hadrons."<<G4endl;
    59235968#endif
     
    59545999    {
    59556000      G4int fBN=theQHadrons[f]->GetBaryonNumber(); // Baryon number of the fragment
    5956 #ifdef pdebug
    5957       G4cout<<"G4QE::FSI:"<<f<<",PDG="<<theQHadrons[f]->GetPDGCode()<<",fBN="<<fBN<<G4endl;
     6001#ifdef debug
     6002      G4int fPDG=theQHadrons[f]->GetPDGCode();     // PDG code of the fragment
     6003      G4LorentzVector fLV=theQHadrons[f]->Get4Momentum(); // 4Mom of the fragment
     6004      G4cout<<"G4QE::FSI:"<<f<<",PDG="<<fPDG<<",fBN="<<fBN<<",f4M="<<fLV<<G4endl;
    59586005#endif
    59596006      if(fBN>1) frag=true;                    // The fragment with A>1 is found
    59606007    }
    5961 #ifdef pdebug
     6008#ifdef debug
    59626009    G4cout<<"G4QE::FSI:===Before Gamma Compression===, nH="<<nHadr<<",frag="<<frag<<G4endl;
    59636010#endif
     
    59696016      if(hPDG==89999003||hPDG==90002999)
    59706017        G4cout<<"---Warning---G4QEnv::FSI:nD-/pD++(1)="<<hPDG<<G4endl;
    5971 #ifdef pdebug
     6018#ifdef debug
    59726019      G4cout<<"G4QE::FSI: h#"<<h<<", hPDG="<<hPDG<<", hNFrag="<<hF<<G4endl;
    59736020#endif
     
    59776024        if(hPDG==22)
    59786025        {
    5979           sum+=curHadr->Get4Momentum();       // Add 4Mom of gamma to the "sum"
     6026          G4LorentzVector g4M=curHadr->Get4Momentum();
     6027          sum+=g4M;                           // Add 4Mom of gamma to the "sum"
    59806028          gamCount++;
     6029#ifdef debug
     6030          G4cout<<"G4QE::FSI: gam4M="<<g4M<<" is added to s4M="<<sum<<G4endl;
     6031#endif
    59816032        }
    59826033        if(h<static_cast<G4int>(theQHadrons.size())-1) // Need swap with the Last
     
    59876038          if(lQP.GetPDGCode()!=10) curHadr->SetQPDG(lQP); //CurHadr instead of LastHadr
    59886039          else curHadr->SetQC(theLast->GetQC());// CurHadrPDG instead of LastHadrPDG
    5989 #ifdef pdebug
     6040#ifdef debug
    59906041          G4cout<<"G4QE::FSI: Exchange with the last is done"<<G4endl;
    59916042#endif
     
    59946045        delete theLast;//!!When kill,DON'T forget to delete theLastQHadron as an instance!!
    59956046        nHadr--;
    5996 #ifdef pdebug
     6047#ifdef debug
    59976048        G4cout<<"G4QE::FSI: The last is compessed"<<G4endl;
    59986049#endif
    59996050      }
    60006051    }
    6001 #ifdef pdebug
     6052#ifdef debug
    60026053    G4cout<<"G4QE::FSI: nH="<<nHadr<<"="<<theQHadrons.size()<<", sum="<<sum<<G4endl;
    60036054#endif
     
    60216072    if(nHadr>1)for(unsigned hdr=0; hdr<theQHadrons.size()-1; hdr++)//Ord:theBigestIstheLast
    60226073    {
    6023 #ifdef pdebug
     6074#ifdef debug
    60246075      G4cout<<"G4QE::FSI:ORD,h="<<hdr<<"<"<<nHadr<<",hPDG="<<theQHadrons[hdr]->GetPDGCode()
    60256076            <<G4endl;
     
    60296080      G4int hB           = curHadr->GetBaryonNumber();
    60306081      G4int lB           = theLast->GetBaryonNumber();
    6031 #ifdef pdebug
     6082#ifdef debug
    60326083      G4cout<<"G4QE::FSI:hBN="<<hB<<"<lBN="<<lB<<",lstPDG="<<theLast->GetPDGCode()<<G4endl;
    60336084#endif
     
    60656116    {
    60666117      G4QHadron* theLast = theQHadrons[nHadr-1];// Get a pointer to the Last Hadron
    6067       if(theLast->GetBaryonNumber()>1)        // "Absorb photons & evaporate/decay" case
     6118      if(theLast->GetBaryonNumber()>0)        // "Absorb photons & evaporate/decay" case
    60686119      {
    60696120        G4QHadron* theNew  = new G4QHadron(theLast); // Make New Hadron of the Last Hadron
     
    60766127        G4int newPDG=theNew->GetPDGCode();
    60776128        G4LorentzVector new4M=theNew->Get4Momentum(); // 4-mom of the fragment
    6078 #ifdef pdebug
     6129#ifdef debug
    60796130        G4cout<<"G4QE::FSI:gSum4M="<<sum<<" is added to "<<new4M<<", PDG="<<newPDG<<G4endl;
    60806131#endif
     
    62606311      G4int hBN  = theQHadrons[ipo]->GetBaryonNumber();
    62616312      tHadr+=hBN;
    6262 #ifdef pdebug
     6313#ifdef debug
    62636314      G4cout<<"G4QE::FSI:h#"<<ipo<<":hPDG="<<hPDG<<",hBN="<<hBN<<",nH="<<theQHadrons.size()
    62646315            <<G4endl;
     
    62716322    }
    62726323  }
    6273 #ifdef pdebug
     6324#ifdef debug
    62746325  G4cout<<"G4QE::FSI:max#"<<maxB<<",lB="<<lHadr<<",tBN="<<tHadr<<",gam="<<gamcnt<<G4endl;
    62756326#endif
     
    63146365      G4QHadron* theCurr = theQHadrons[gp];       // Pointer to the Current Hadron
    63156366      G4int hPDG=theCurr->GetPDGCode();
    6316 #ifdef pdebug
     6367#ifdef debug
    63176368      G4cout<<"G4QE::FSI:gp#"<<gp<<", PDG="<<hPDG<<", is found"<<G4endl;
    63186369#endif
    6319       if(hPDG==22)                                // Photon is foun on the "gp" position
     6370      if(hPDG==22)                                // Photon is foun ond the "gp" position
    63206371      {
    63216372        gamSum=gamSum+theCurr->Get4Momentum();    // Accumulate the 4Momenta of the photon
     6373#ifdef debug
     6374        G4cout<<"G4QE::FSI:Photon gp#"<<gp<<",nH="<<nHadr<<", update gS="<<gamSum<<G4endl;
     6375#endif
    63226376        unsigned nLast=nHadr-1;                   // position of theLastHadron (gp<nHadr-1)
    63236377        G4QHadron* theLast = theQHadrons[nLast];  // Pointer to the Last Hadron
    6324         while(nLast>gp && theLast->GetPDGCode()==22) // "TheLast is a photon too" LOOP
    6325         {
    6326           gamSum=gamSum+theLast->Get4Momentum();  // Accumulate 4-momentum of theLastPhoton
     6378#ifdef debug
     6379        G4int wcn=0;
     6380#endif
     6381        while(nLast>=gp && theLast->GetPDGCode()==22) // "TheLast is a photon too" LOOP
     6382        {
     6383#ifdef debug
     6384          ++wcn;
     6385#endif
     6386          if(nLast>gp)
     6387          {
     6388            gamSum=gamSum+theLast->Get4Momentum();// Accumulate 4-momentum of theLastPhoton
     6389#ifdef debug
     6390            G4cout<<"G4QE::FSI:TheLastPhotonIsFound #"<<wcn<<",update gS="<<gamSum<<G4endl;
     6391#endif
     6392          }
    63276393          theQHadrons.pop_back();                 // Pnt to theLastHadr.is excluded from HV
    63286394          delete theLast;//*!!When kill,DON'T forget to delete theLastQHadron as an inst!!*
     
    63316397          theLast = theQHadrons[nLast];
    63326398        }
    6333         if(nLast>gp)
     6399        if(nLast>gp)                              // -> swapping with the last
    63346400        {
    63356401          G4QPDGCode lQP=theLast->GetQPDG();      // The QPDG of the last
     
    63406406          delete theLast;//*!|When kill,DON'T forget to delete theLastQHadron as an inst!!*
    63416407          nHadr=theQHadrons.size();
    6342 #ifdef pdebug
    6343           G4cout<<"G4QE::FSI:RepBy lPDG="<<lQP<<",nH="<<nHadr<<",gS="<<gamSum<<G4endl;
     6408#ifdef debug
     6409          G4cout<<"G4QE::FSI:RepBy lPDG="<<lQP<<", nH="<<nHadr<<", gS="<<gamSum<<G4endl;
    63446410#endif
    63456411        }
     
    63546420      delete theLast; //**!!When kill,DON'T forget to delete theLastQHadron as an inst.!!**
    63556421      nHadr=theQHadrons.size();
    6356 #ifdef pdebug
    6357       G4cout<<"G4QE::FSI: The last photon is killed, nH="<<nHadr<<",gS="<<gamSum<<G4endl;
     6422#ifdef debug
     6423      G4cout<<"-Warning-G4QE::FSI: LastPhotonIsKilled, nH="<<nHadr<<",gS="<<gamSum<<G4endl;
    63586424#endif
    63596425      theLast = theQHadrons[nHadr-1];
     
    64026468          delete curHadr;
    64036469          G4int APDG=lrN.GetPDG();
    6404 #ifdef pdebug
     6470#ifdef debug
    64056471          G4cout<<"G4QE::FSI: Final A+alpha, A="<<APDG<<lr4M<<", a="<<al4M<<G4endl;
    64066472#endif
     
    68696935      else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,k4M))
    68706936      {
     6937#ifdef debug
     6938
    68716939        G4cout<<"---Warning---G4QE::FSI: Try to recover ASN="<<hPDG<<","<<reM<<"<"<<mR<<"+"
    68726940              <<mKaon<<"="<<sum<<G4endl;
     6941#endif
    68736942        if(!theEnvironment.GetA())
    68746943        {
     
    68896958          {
    68906959            qH->SetNFragments(-1);              //@@ To avoid looping
     6960#ifdef debug
    68916961            G4cout<<"---Warning---G4QE::FSI:AntiStraN Failed LeaveAsItIs 4m="<<r4M<<G4endl;
     6962#endif
    68926963            theQHadrons.push_back(qH);           // Leave as it is (delete equivalent)
    68936964          }
     
    69176988      }
    69186989    }
    6919     else if(hPDG>90500000&&hPDG!=91000000&&hPDG!=91000999&&hPDG!=90999001) // Only for G4
    6920  // @@ Xi & Omega- can be added here ^^^, if show up below
     6990    //                      =Lambda(Sigma0)=      = Sigma+ =        = Sigma- =
     6991    else if(hPDG>90500000 && hPDG!=91000000 && hPDG!=91000999 && hPDG!=90999001 &&
     6992                             hPDG!=91999000 && hPDG!=91999999 && hPDG!=92998999 )
     6993    //                        ==  Xi-  ==       ==  Xi0  ==      === Omega- ===
    69216994    {
    69226995#ifdef pdebug
     
    69287001      G4int nSM=0;                             // A#0f unavoidable Sigma-
    69297002      G4int nSP=0;                             // A#0f unavoidable Sigma+
    6930       if(nC<0)                                 // Negative hypernucleus
    6931       {
    6932         if(-nC<=nL)
    6933         {
    6934           nSM=-nC;                             // Can be compensated by Sigma-
    6935           nL+=nC;                              // Reduce the residual strangeness
     7003      G4int nXZ=0;                             // A#0f unavoidable Xi-
     7004      G4int nXM=0;                             // A#0f unavoidable Xi0
     7005      //G4int nOM=0;                             // A#0f unavoidable Omega-
     7006      // @@ Now it does not include more complicated clusters as Omega-,Xi- (Improve)
     7007      if(nC < 0)                               // Negative hypernucleus
     7008      {
     7009        if(-nC <= nL)                          // Negative Charge is smaller than Strange
     7010        {
     7011          if(nL <= nB)                         // ==> Big Hyper-nucleus
     7012          {
     7013            nSM=-nC;                           // Can be compensated by Sigma-
     7014            nL+=nC;                            // Reduce the residual strangeness
     7015          }
     7016          else                                 // ==> Lack of BaryonNumber (better use Xi-)
     7017          {
     7018            G4int nX=nL-nB;
     7019            if(-nC <= nX && nL >= nX+nX)       // Part or all Xi are Xi- (e.g. Xi-,Lambda)
     7020            {
     7021              nXM=-nC;
     7022              if(nXM != nX) nXZ=nX-nXM;        // The rest are Xi0
     7023              nL-=nX+nX;                       // Xi reduce srangeness twice faster
     7024            }
     7025            else if(nL >= nX-nC)               // Sigma- should be used in addition to Xi-
     7026            {                                  // e.g. Xi-, Sigma-
     7027              nXM=nX;
     7028              nSM=-nC-nX;
     7029              nL-=nX-nC;
     7030            }
     7031            else G4cout<<"-Warning-G4QEn::FSI:*Improve*,-nC<=nL,nL>nB, PDG="<<hPDG<<G4endl;
     7032          }
     7033        }
     7034        else                                   // -nC can not be totally compensated by nL
     7035        {
     7036          nSM=nL;                              // The maximumNumber of Sigma- (theRest pi-)
     7037          nL=0;                                // Kill the residualStrangeness (@notEnough)
     7038        }
     7039      }
     7040      else if(nC>nB-nL)                        // Extra positive hypernucleus (nC>=0 here)
     7041        {                                        // Can't compensate theCharge by onlyProtons
     7042        if(nC<=nB)
     7043        {
     7044          if(nL <= nB)
     7045          {
     7046            G4int dH=nB-nC;
     7047            nSP=nL-dH;                         // Can be compensated by Sigma+
     7048            nL=dH;                             // Reduce the residual strangeness
     7049          }
     7050          else if(nL<nB+nB)                    // Xi0 can be used
     7051          {
     7052            nXZ=nL-nB;                         // This is how many Xi0
     7053            nL=nB-nL+nB;                       // a#of S=1 particles
     7054            if(nC <= nL)
     7055            {
     7056              nSP=nC;
     7057              nL-=nSP;
     7058            }
     7059            else
     7060            {
     7061              nSP=nL;
     7062              nL=0;
     7063            }
     7064          }
     7065#ifdef pdebug
     7066          else G4cout<<"-Warning-G4QEn::FSI:*Improve*,nC>nB-nL,nC<=nB, PDG="<<hPDG<<G4endl;
     7067#endif
    69367068        }
    69377069        else
    69387070        {
    6939           nSM=nL;                              // The maximum number of Sigma-
     7071          nSP=nL;                              // The maximumNumber of Sigma+ (theRest pi+)
    69407072          nL=0;                                // Kill the residual strangeness
    69417073        }
    69427074      }
    6943       else if(nC>nB-nL)                        // Extra positive hypernucleus
    6944       {
    6945         if(nC<=nB)
    6946         {
    6947           G4int dH=nB-nC;
    6948           nSP=nL-dH;                           // Can be compensated by Sigma+
    6949           nL=dH;                               // Reduce the residual strangeness
    6950         }
    6951         else
    6952         {
    6953           nSP=nL;                              // The maximum number of Sigma+
    6954           nL=0;                                // Kill the residual strangeness
    6955         }
    6956       }
     7075      // else = the charge can be compensated by nucleons
    69577076      G4LorentzVector r4M=curHadr->Get4Momentum(); // Real 4-momentum of the hypernucleus
    69587077      G4double reM=r4M.m();                    // Real mass of the hypernucleus
    6959       G4int rlPDG = hPDG-nL*1000000-nSP*1000999-nSM*999001;// Subtract Lamb/Sig from Nucl
    6960       G4int    sPDG=3122;                      // Prototype for the Hyperon PDG (Lambda)
    6961       G4double MLa=mLamb;                      // Prototype for one Hyperon decay
     7078      // Subtract Lamb/Sig/Xi from the Nucleus and decay
     7079      G4int SS=nL+nSP+nSM+nXZ+nXM;
     7080      if(SS<nB)                                // Should not be Xi's in the nucleus
     7081      {
     7082        G4int rlPDG = hPDG-nL*1000000-nSP*1000999-nSM*999001;
     7083        G4int    sPDG=3122;                    // Prototype for the Hyperon PDG (Lambda)
     7084        G4double MLa=mLamb;                    // Prototype for one Hyperon decay
    69627085#ifdef pdebug
    6963       G4cout<<"G4QEnvironment::FSI:*G4* nS+="<<nSP<<", nS-="<<nSM<<", nL="<<nL<<G4endl;
    6964 #endif
    6965       if(nSP||nSM)
    6966       {
    6967         if(nL)
    6968         {
    6969           G4cout<<"***G4QE::FSI: HypNPDG="<<hPDG<<": both Sigm&Lamb -> Improve it"<<G4endl;
    6970           //throw G4QException("*G4QEnvironment::FSInter: Both Lambda&Sigma in Hypernucl");
    6971           // @@ Correction, which does not conserv the charge !! (-> add decay in 3)
    6972           if(nSP) nL+=nSP;
    6973           else    nL+=nSM;
    6974         }
    6975         if(nSP)
    6976         {
    6977           nL=nSP;
    6978           sPDG=3222;
    6979           MLa=mSigP;
    6980         }
    6981         else
    6982         {
    6983           nL=nSM;
    6984           sPDG=3112;
    6985           MLa=mSigM;
    6986         }
    6987       }
     7086        G4cout<<"G4QEnvironment::FSI:*G4* nS+="<<nSP<<", nS-="<<nSM<<", nL="<<nL<<G4endl;
     7087#endif
     7088        if(nSP||nSM)
     7089        {
     7090          if(nL)
     7091          {
     7092            // Hopefully it never happens
     7093            G4cout<<"-Warning-G4QE::FSI:*Improve*,PDG="<<hPDG<<": both Sigma&Lamb"<<G4endl;
     7094            // @@ Bad Correction, which does not conserve the charge !! (-> add decay in 3)
     7095            if(nSP) nL+=nSP;
     7096            else    nL+=nSM;
     7097          }
     7098          if(nSP)
     7099          {
     7100            nL=nSP;
     7101            sPDG=3222;
     7102            MLa=mSigP;
     7103          }
     7104          else
     7105          {
     7106            nL=nSM;
     7107            sPDG=3112;
     7108            MLa=mSigM;
     7109          }
     7110        }
    69887111#ifdef pdebug
    6989       G4cout<<"G4QEnvironment::FSI:*G4* mS="<<MLa<<", sPDG="<<sPDG<<", nL="<<nL<<G4endl;
    6990 #endif
    6991       if(nL>1) MLa*=nL;
    6992       G4double rlM=G4QNucleus(rlPDG).GetMZNS();// Mass of the new residualNonstrangeNucleus
    6993       if(!nSP&&!nSM&&nL==1&&reM>rlM+mSigZ&&G4UniformRand()>.5) // Sigma0 @@ AddToHadroniz.?
    6994       {
    6995         sPDG=3212;
    6996         MLa=mSigZ;
    6997       }
    6998       G4int rnPDG = hPDG-nL*999999;            // Convert Lambdas to neutrons (for convInN)
    6999       G4QNucleus rnN(rnPDG);                   // New nonstrange nucleus
    7000       G4double rnM=rnN.GetMZNS();              // Mass of the new nonstrange nucleus
    7001       // @@ Take into account that there can be Iso-Hypernucleus (Add PI+,R & Pi-,R decays)
    7002       if(rlPDG==90000000)                      // Multy Hyperon (HyperNuc of only hyperons)
    7003       {
    7004         if(nL>1) r4M=r4M/nL;                   // split the 4-mom for the MultyLambda
    7005         for(G4int il=0; il<nL; il++)           // loop over Lambdas
    7006         {
    7007           G4QHadron* theLam = new G4QHadron(sPDG,r4M);// Make a New Hadr for the Hyperon
    7008           theQHadrons.push_back(theLam);       // (del.eq.- user is responsible for del)
    7009         }
    7010       }
    7011       else if(reM>rlM+MLa-eps)                  // Lambda(or Sigma) can be split
    7012       {
    7013         G4LorentzVector n4M(0.,0.,0.,rlM);
    7014         G4LorentzVector h4M(0.,0.,0.,MLa);
    7015         G4double sum=rlM+MLa;
    7016         if(fabs(reM-sum)<eps)
    7017         {
    7018           n4M=r4M*(rlM/sum);
    7019           h4M=r4M*(MLa/sum);
    7020         }
    7021         else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
    7022         {
    7023           G4cerr<<"***G4QE::FSI:Hypern, M="<<reM<<"<A+n*L="<<sum<<",d="<<sum-reM<<G4endl;
    7024           throw G4QException("***G4QEnvironment::FSInter: Hypernuclear L-decay error");
    7025         }
     7112        G4cout<<"G4QEnvironment::FSI:*G4* mS="<<MLa<<", sPDG="<<sPDG<<", nL="<<nL<<G4endl;
     7113#endif
     7114        if(nL>1) MLa*=nL;
     7115        G4double rlM=G4QNucleus(rlPDG).GetMZNS();// Mass of theNewResidualNonstrangeNucleus
     7116        if(!nSP&&!nSM&&nL==1&&reM>rlM+mSigZ&&G4UniformRand()>.5)// Sigma0 @@ AddToHadroniz?
     7117        {
     7118          sPDG=3212;
     7119          MLa=mSigZ;
     7120        }
     7121        G4int rnPDG = hPDG-nL*999999;          // Convert Lambdas to neutrons (for convInN)
     7122        G4QNucleus rnN(rnPDG);                 // New nonstrange nucleus
     7123        G4double rnM=rnN.GetMZNS();            // Mass of the new nonstrange nucleus
     7124        // @@ Take into account that can be Iso-Hypernucleus (Add PI+,R & Pi-,R decays)
     7125        if(rlPDG==90000000)                    // Multy Hyperon (HyperNuc of only hyperons)
     7126        {
     7127          if(nL>1) r4M=r4M/nL;                 // split the 4-mom for the MultyLambda
     7128          for(G4int il=0; il<nL; il++)         // loop over Lambdas
     7129          {
     7130            G4QHadron* theLam = new G4QHadron(sPDG,r4M);// Make a New Hadr for the Hyperon
     7131            theQHadrons.push_back(theLam);     // (del.eq.- user is responsible for del)
     7132          }
     7133        }
     7134        else if(reM>rlM+MLa-eps)               // Lambda(or Sigma) can be split
     7135        {
     7136          G4LorentzVector n4M(0.,0.,0.,rlM);
     7137          G4LorentzVector h4M(0.,0.,0.,MLa);
     7138          G4double sum=rlM+MLa;
     7139          if(fabs(reM-sum)<eps)
     7140          {
     7141            n4M=r4M*(rlM/sum);
     7142            h4M=r4M*(MLa/sum);
     7143          }
     7144          else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
     7145          {
     7146            G4cerr<<"***G4QE::FSI:Hypern, M="<<reM<<"<A+n*L="<<sum<<",d="<<sum-reM<<G4endl;
     7147            throw G4QException("***G4QEnvironment::FSInter: Hypernuclear L-decay error");
     7148          }
    70267149#ifdef pdebug
    7027         G4cout<<"*G4QE::FSI:HypN "<<r4M<<"->A="<<rlPDG<<n4M<<", n*Lamb="<<nL<<h4M<<G4endl;
    7028 #endif
    7029         curHadr->Set4Momentum(n4M);
    7030         curHadr->SetQPDG(G4QPDGCode(rlPDG));   // converted hypernucleus
    7031         if(rlPDG==90000002)                    // Additional action with curHadr change
    7032         {
    7033           G4LorentzVector newLV=n4M/2.;
    7034           curHadr->Set4Momentum(newLV);
    7035           curHadr->SetQPDG(G4QPDGCode(90000001));
    7036           G4QHadron* secHadr = new G4QHadron(curHadr);
    7037           theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
    7038         }
    7039         else if(rlPDG==90002000)               // Additional action with curHadr change
    7040         {
    7041           G4LorentzVector newLV=n4M/2.;
    7042           curHadr->Set4Momentum(newLV);
    7043           curHadr->SetQPDG(G4QPDGCode(90001000));
    7044           G4QHadron* secHadr = new G4QHadron(curHadr);
    7045           theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
    7046         }
    7047         // @@(?) Add multybaryon decays if necessary (Now it anyhow is made later)
    7048 #ifdef fdebug
    7049         G4cout<<"*G4QE::FSI: resNucPDG="<<curHadr->GetPDGCode()<<G4endl;
    7050 #endif
    7051         if(nL>1) h4M=h4M/nL;                   // split the lambda's 4-mom if necessary
    7052         for(G4int il=0; il<nL; il++)           // loop over excessive
    7053         {
    7054           G4QHadron* theLamb = new G4QHadron(sPDG,h4M);// Make a New Hadr for the Hyperon
    7055           theQHadrons.push_back(theLamb);      // (del.eq.- user is responsible for del)
    7056         }
    7057       }
    7058       else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)    // Lambda->N only if Sigmas are absent
    7059       {
    7060         G4int nPi=static_cast<G4int>((reM-rnM)/mPi0);
    7061         if (nPi>nL) nPi=nL;
    7062         G4double npiM=nPi*mPi0;
    7063         G4LorentzVector n4M(0.,0.,0.,rnM);
    7064         G4LorentzVector h4M(0.,0.,0.,npiM);
    7065         G4double sum=rnM+npiM;
    7066         if(fabs(reM-sum)<eps)
    7067         {
    7068           n4M=r4M*(rnM/sum);
    7069           h4M=r4M*(npiM/sum);
    7070         }
    7071         else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
    7072         {
    7073           G4cerr<<"***G4QE::FSI:Hypern, M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
    7074           throw G4QException("***G4QEnvironment::FSInter: Hypernuclear decay error");
    7075         }
    7076         curHadr->Set4Momentum(n4M);
    7077         curHadr->SetQPDG(G4QPDGCode(rnPDG));   // converted hypernucleus
    7078 #ifdef fdebug
    7079         G4cout<<"*G4QE::FSI:HypN "<<r4M<<"->A="<<rnPDG<<n4M<<",n*Pi0="<<nPi<<h4M<<G4endl;
    7080 #endif
    7081         if(nPi>1) h4M=h4M/nPi;                 // split the 4-mom if necessary
    7082         for(G4int ihn=0; ihn<nPi; ihn++)       // loop over additional pions
    7083         {
    7084           G4QHadron* thePion = new G4QHadron(111,h4M);// Make a New Hadr for the pion
    7085           theQHadrons.push_back(thePion);    // (del.eq.- user is responsible for del)
    7086           //theFragments->push_back(thePion);    // (delete equivalent for the pion)
    7087         }
    7088         if(rnPDG==90000002)                    // Additional action with curHadr change
    7089         {
    7090           G4LorentzVector newLV=n4M/2.;
    7091           curHadr->Set4Momentum(newLV);
    7092           curHadr->SetQPDG(G4QPDGCode(90000001));
    7093           G4QHadron* secHadr = new G4QHadron(curHadr);
    7094           theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
    7095           //theFragments->push_back(secHadr);    // (del.eq.- user is responsible for del)
    7096         }
    7097         else if(rnPDG==90002000)               // Additional action with curHadr change
    7098         {
    7099           G4LorentzVector newLV=n4M/2.;
    7100           curHadr->Set4Momentum(newLV);
    7101           curHadr->SetQPDG(G4QPDGCode(90001000));
    7102           G4QHadron* secHadr = new G4QHadron(curHadr);
    7103           theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
    7104           //theFragments->push_back(secHadr);    // (del.eq.- user is responsible for del)
    7105         }
    7106         // @@ Add multybaryon decays if necessary
    7107       }
    7108       else if(reM>rnM-eps)    // Decay in nonstange and gamma
    7109       {
    7110         G4LorentzVector n4M(0.,0.,0.,rnM);
    7111         G4LorentzVector h4M(0.,0.,0.,0.);
    7112         G4double sum=rnM;
    7113         if(fabs(reM-sum)<eps) n4M=r4M;
    7114         else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
    7115         {
    7116           G4cerr<<"***G4QE::FSI:Hypern, M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
    7117           throw G4QException("***G4QEnvironment::FSInter: Hypernuclear gamma decay error");
    7118         }
    7119         curHadr->Set4Momentum(n4M);
    7120         curHadr->SetQPDG(G4QPDGCode(rnPDG));   // converted hypernucleus
    7121 #ifdef fdebug
    7122         G4cout<<"*G4QE::FSI:HypNg "<<r4M<<"->A="<<rnPDG<<n4M<<",gamma="<<h4M<<G4endl;
    7123 #endif
    7124         G4QHadron* theGamma = new G4QHadron(22,h4M);// Make a New Hadr for the gamma
    7125         theQHadrons.push_back(theGamma);      // (del.eq.- user is responsible for del)
    7126         if(rnPDG==90000002)                   // Additional action with curHadr change
    7127         {
    7128           G4LorentzVector newLV=n4M/2.;
    7129           curHadr->Set4Momentum(newLV);
    7130           curHadr->SetQPDG(G4QPDGCode(90000001));
    7131           G4QHadron* secHadr = new G4QHadron(curHadr);
    7132           theQHadrons.push_back(secHadr);     // (del.eq.- user is responsible for del)
    7133           //theFragments->push_back(secHadr);   // (del.eq.- user is responsible for del)
    7134         }
    7135         else if(rnPDG==90002000)              // Additional action with curHadr change
    7136         {
    7137           G4LorentzVector newLV=n4M/2.;
    7138           curHadr->Set4Momentum(newLV);
    7139           curHadr->SetQPDG(G4QPDGCode(90001000));
    7140           G4QHadron* secHadr = new G4QHadron(curHadr);
    7141           theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
    7142           //theFragments->push_back(secHadr);    // (del.eq.- user is responsible for del)
    7143         }
    7144         // @@ Add multybaryon decays if necessary
    7145       }
    7146       else // If this Error shows up (lowProbable appearance) => now it is left as is
    7147       {
    7148         G4double d=rlM+MLa-reM;
    7149         G4cerr<<"G4QE::FSI:R="<<rlM<<",S+="<<nSP<<",S-="<<nSM<<",L="<<nL<<",d="<<d<<G4endl;
    7150         d=rnM+mPi0-reM;
    7151         G4cerr<<"***G4QE::FSI: HypN="<<hPDG<<", M="<<reM<<"<"<<rnM+mPi0<<",d="<<d<<G4endl;
    7152         //throw G4QException("G4QEnvironment::FSInteract: Hypernuclear conversion");
    7153       }
     7150          G4cout<<"*G4QE::FSI:HypN="<<r4M<<"->A="<<rlPDG<<n4M<<",n*Lamb="<<nL<<h4M<<G4endl;
     7151#endif
     7152          curHadr->Set4Momentum(n4M);
     7153          curHadr->SetQPDG(G4QPDGCode(rlPDG)); // converted hypernucleus
     7154          if(rlPDG==90000002)                  // Additional action with curHadr change
     7155          {
     7156            G4LorentzVector newLV=n4M/2.;
     7157            curHadr->Set4Momentum(newLV);
     7158            curHadr->SetQPDG(G4QPDGCode(90000001));
     7159            G4QHadron* secHadr = new G4QHadron(curHadr);
     7160            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7161          }
     7162          else if(rlPDG==90002000)             // Additional action with curHadr change
     7163          {
     7164            G4LorentzVector newLV=n4M/2.;
     7165            curHadr->Set4Momentum(newLV);
     7166            curHadr->SetQPDG(G4QPDGCode(90001000));
     7167            G4QHadron* secHadr = new G4QHadron(curHadr);
     7168            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7169          }
     7170          // @@(?) Add multybaryon decays if necessary (Now it anyhow is made later)
     7171#ifdef pdebug
     7172          G4cout<<"*G4QE::FSI: resNucPDG="<<curHadr->GetPDGCode()<<G4endl;
     7173#endif
     7174          if(nL>1) h4M=h4M/nL;                 // split the lambda's 4-mom if necessary
     7175          for(G4int il=0; il<nL; il++)         // loop over excessive
     7176          {
     7177            G4QHadron* theLamb = new G4QHadron(sPDG,h4M);// Make a New Hadr for the Hyperon
     7178            theQHadrons.push_back(theLamb);    // (del.eq.- user is responsible for del)
     7179          }
     7180        }
     7181        else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)  // Lambda->N only if Sigmas are absent
     7182        {
     7183          G4int nPi=static_cast<G4int>((reM-rnM)/mPi0);
     7184          if (nPi>nL) nPi=nL;
     7185          G4double npiM=nPi*mPi0;
     7186          G4LorentzVector n4M(0.,0.,0.,rnM);
     7187          G4LorentzVector h4M(0.,0.,0.,npiM);
     7188          G4double sum=rnM+npiM;
     7189          if(fabs(reM-sum)<eps)
     7190          {
     7191            n4M=r4M*(rnM/sum);
     7192            h4M=r4M*(npiM/sum);
     7193          }
     7194          else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
     7195          {
     7196            G4cerr<<"**G4QE::FSI:HyperN,M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
     7197            throw G4QException("***G4QEnvironment::FSInter: Hypernuclear decay error");
     7198          }
     7199          curHadr->Set4Momentum(n4M);
     7200          curHadr->SetQPDG(G4QPDGCode(rnPDG)); // converted hypernucleus
     7201#ifdef pdebug
     7202          G4cout<<"*G4QE::FSI:HypN "<<r4M<<"->A="<<rnPDG<<n4M<<",n*Pi0="<<nPi<<h4M<<G4endl;
     7203#endif
     7204          if(nPi>1) h4M=h4M/nPi;               // split the 4-mom if necessary
     7205          for(G4int ihn=0; ihn<nPi; ihn++)     // loop over additional pions
     7206          {
     7207            G4QHadron* thePion = new G4QHadron(111,h4M);// Make a New Hadr for the pion
     7208            theQHadrons.push_back(thePion);    // (del.eq.- user is responsible for del)
     7209            //theFragments->push_back(thePion);  // (delete equivalent for the pion)
     7210          }
     7211          if(rnPDG==90000002)                  // Additional action with curHadr change
     7212          {
     7213            G4LorentzVector newLV=n4M/2.;
     7214            curHadr->Set4Momentum(newLV);
     7215            curHadr->SetQPDG(G4QPDGCode(90000001));
     7216            G4QHadron* secHadr = new G4QHadron(curHadr);
     7217            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7218            //theFragments->push_back(secHadr);  // (del.eq.- user is responsible for del)
     7219          }
     7220          else if(rnPDG==90002000)             // Additional action with curHadr change
     7221          {
     7222            G4LorentzVector newLV=n4M/2.;
     7223            curHadr->Set4Momentum(newLV);
     7224            curHadr->SetQPDG(G4QPDGCode(90001000));
     7225            G4QHadron* secHadr = new G4QHadron(curHadr);
     7226            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7227            //theFragments->push_back(secHadr);  // (del.eq.- user is responsible for del)
     7228          }
     7229          // @@ Add multybaryon decays if necessary
     7230        }
     7231        else if(reM>rnM-eps)    // Decay in nonstrange and gamma
     7232        {
     7233          G4LorentzVector n4M(0.,0.,0.,rnM);
     7234          G4LorentzVector h4M(0.,0.,0.,0.);
     7235          G4double sum=rnM;
     7236          if(fabs(reM-sum)<eps) n4M=r4M;
     7237          else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
     7238          {
     7239            G4cerr<<"**G4QE::FSI:Hypern,M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
     7240            throw G4QException("***G4QEnvironment::FSInter:Hypernuclear GammaDecay error");
     7241          }
     7242          curHadr->Set4Momentum(n4M);
     7243          curHadr->SetQPDG(G4QPDGCode(rnPDG)); // converted hypernucleus
     7244#ifdef pdebug
     7245          G4cout<<"*G4QE::FSI:HypNg "<<r4M<<"->A="<<rnPDG<<n4M<<",gamma="<<h4M<<G4endl;
     7246#endif
     7247          G4QHadron* theGamma = new G4QHadron(22,h4M);// Make a New Hadr for the gamma
     7248          theQHadrons.push_back(theGamma);     // (del.eq.- user is responsible for del)
     7249          if(rnPDG==90000002)                  // Additional action with curHadr change
     7250          {
     7251            G4LorentzVector newLV=n4M/2.;
     7252            curHadr->Set4Momentum(newLV);
     7253            curHadr->SetQPDG(G4QPDGCode(90000001));
     7254            G4QHadron* secHadr = new G4QHadron(curHadr);
     7255            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7256            //theFragments->push_back(secHadr);  // (del.eq.- user is responsible for del)
     7257          }
     7258          else if(rnPDG==90002000)             // Additional action with curHadr change
     7259          {
     7260            G4LorentzVector newLV=n4M/2.;
     7261            curHadr->Set4Momentum(newLV);
     7262            curHadr->SetQPDG(G4QPDGCode(90001000));
     7263            G4QHadron* secHadr = new G4QHadron(curHadr);
     7264            theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7265            //theFragments->push_back(secHadr);  // (del.eq.- user is responsible for del)
     7266          }
     7267          // @@ Add multybaryon decays if necessary
     7268        }
     7269#ifdef pdebug
     7270        else // If this Error shows up (lowProbable appearance) => now it is left as is
     7271        {
     7272          G4double d=rlM+MLa-reM;
     7273          G4cerr<<"G4QE::F:R="<<rlM<<",S+="<<nSP<<",S-="<<nSM<<",L="<<nL<<",d="<<d<<G4endl;
     7274          d=rnM+mPi0-reM;
     7275          G4cerr<<"-W-G4QE::FSI:HypN="<<hPDG<<", M="<<reM<<"<"<<rnM+mPi0<<",d="<<d<<G4endl;
     7276          //throw G4QException("G4QEnvironment::FSInteract: Hypernuclear conversion");
     7277        }
     7278#endif
     7279      }
     7280      else if(SS==nB)
     7281      {
     7282#ifdef pdebug
     7283        G4cout<<"G4QEnvironment::FSI:OnlyHyp,B="<<nB<<",SP="<<nSP<<",SM="<<nSM<<",L="<<nL
     7284              <<",XM="<<nXM<<",XZ="<<nXZ<<G4endl;
     7285#endif
     7286        G4int SP=0;
     7287        if(nL) ++SP;
     7288        if(nSP) ++SP;
     7289        if(nSM) ++SP;
     7290        if(nXZ) ++SP;
     7291        if(nXM) ++SP;
     7292        if(SP>1 && SP<4)
     7293        {
     7294          G4int fPDG=3122;
     7295          G4double fM=mLamb;
     7296          G4int fS=nL;
     7297          G4int sPDG=3222;
     7298          G4double sM=mSigP;
     7299          G4int sS=nSP;
     7300          G4int uPDG=3322;
     7301          G4double uM=mXiZ;
     7302          G4int uS=nSP;
     7303          if(nL)
     7304          {
     7305            if(nSM)
     7306            {
     7307              sPDG=3112;
     7308              sM  =mSigM;
     7309              sS  =nSM;
     7310              if(SP==3)
     7311              {
     7312                if(nXM)
     7313                {
     7314                  uPDG=3312;
     7315                  uM  =mXiM;
     7316                  uS  =nXM;
     7317                }
     7318              }
     7319            }
     7320            else if(nXZ)
     7321            {
     7322              sPDG=3322;
     7323              sM  =mXiZ;
     7324              sS  =nXZ;
     7325              if(SP==3)
     7326              {
     7327                if(nSP)
     7328                {
     7329                  uPDG=3222;
     7330                  uM  =mSigP;
     7331                  uS  =nSP;
     7332                }
     7333                else if(nXM)
     7334                {
     7335                  uPDG=3312;
     7336                  uM  =mXiM;
     7337                  uS  =nXM;
     7338                }
     7339              }
     7340            }
     7341            else if(nXM)
     7342            {
     7343              sPDG=3312;
     7344              sM  =mXiM;
     7345              sS  =nXM;
     7346              //if(SP==3) uXiZ is a default
     7347            }
     7348            else if(SP==3)                          // Lambda,Sigma+ (only Xi0 is possible)
     7349            {
     7350              if(nXZ)
     7351              {
     7352                uPDG=3322;
     7353                uM  =mXiZ;
     7354                uS  =nXZ;
     7355              }
     7356              else G4cout<<"-Warning-G4QE::FSI: *Improve* StrangeComb, PDG="<<hPDG<<G4endl;
     7357            }
     7358          }
     7359          else if(nSM)
     7360          {
     7361            fPDG=3112;
     7362            fM  =mSigM;
     7363            fS  =nSM;
     7364            if(nXZ)
     7365            {
     7366              sPDG=3322;
     7367              sM  =mXiZ;
     7368              sS  =nXZ;
     7369              if(SP==3)
     7370              {
     7371                if(nXM)
     7372                {
     7373                  uPDG=3312;
     7374                  uM  =mXiM;
     7375                  uS  =nXM;
     7376                }
     7377                else if(nXZ)
     7378                {
     7379                  uPDG=3322;
     7380                  uM  =mXiZ;
     7381                  uS  =nXZ;
     7382                }
     7383              }
     7384            }
     7385            else if(nXM)
     7386            {
     7387              sPDG=3312;
     7388              sM  =mXiM;
     7389              sS  =nXM;
     7390            }
     7391          }
     7392          else if(nSP)
     7393          {
     7394            fPDG=3222;
     7395            fM  =mSigP;
     7396            fS  =nSP;
     7397            if(nXZ)
     7398            {
     7399              sPDG=3322;
     7400              sM  =mXiZ;
     7401              sS  =nXZ;
     7402              if(SP==3)
     7403              {
     7404                if(nXZ)
     7405                {
     7406                  uPDG=3322;
     7407                  uM  =mXiZ;
     7408                  uS  =nXZ;
     7409                }
     7410              }
     7411            }
     7412            else if(nXM)
     7413            {
     7414              sPDG=3312;
     7415              sM  =mXiM;
     7416              sS  =nXM;
     7417            }
     7418          }
     7419          else if(nXZ)
     7420          {
     7421            fPDG=3322;
     7422            fM  =mXiZ;
     7423            fS  =nXZ;
     7424            if(nXM)
     7425            {
     7426              sPDG=3312;
     7427              sM  =mXiM;
     7428              sS  =nXM;
     7429            }
     7430          }
     7431          else G4cout<<"-Warning-G4QE::FSI: *Improve* StrangeFragment, PDG="<<hPDG<<G4endl;
     7432          // Now make two or three particles decay
     7433          if(SP==2)                           // @@ Only 2BodyDecay is implemented >Improve
     7434          {
     7435#ifdef pdebug
     7436            G4cout<<"G4QEnvironment::FSI:2HypD,fS="<<fS<<",fPDG="<<sPDG<<",fM="<<fM<<",sS="
     7437                  <<sS<<",sPDG="<<sPDG<<",sM="<<sM<<",rM="<<reM<<G4endl;
     7438#endif
     7439            fM*=fS;
     7440            sM+=sS;
     7441            if(reM>fM+sM-eps)                 // can be split or decayed
     7442            {
     7443              G4LorentzVector f4M(0.,0.,0.,fM);
     7444              G4LorentzVector s4M(0.,0.,0.,sM);
     7445              G4double sum=fM+sM;
     7446              if(fabs(reM-sum)<eps)           // splitting
     7447              {
     7448                f4M=r4M*(fM/sum);
     7449                s4M=r4M*(sM/sum);
     7450              }
     7451              else if(reM<sum || !G4QHadron(r4M).DecayIn2(f4M,s4M))
     7452              {
     7453                G4cerr<<"***G4QE::FSI:Hyp,M="<<reM<<"<A+n*L="<<sum<<",d="<<sum-reM<<G4endl;
     7454                throw G4QException("***G4QEnvironment::FSInter: HypernucOnlyStran2 error");
     7455              }
     7456#ifdef pdebug
     7457              G4cout<<"G4QEnv::FSI:HNuc="<<r4M<<hPDG<<"->First="<<fS<<f4M<<fPDG<<",Second="
     7458                    <<sS<<s4M<<sPDG<<G4endl;
     7459#endif
     7460              if(fS>1)
     7461              {
     7462                f4M/=fS;                           // split the Hyperons 4-mom if necessary
     7463                for(G4int il=1; il<fS; il++)       // loop over excessive Hyperons
     7464                {
     7465                  G4QHadron* theHyp = new G4QHadron(fPDG,f4M);// Make NewHadr for theHyper
     7466                  theQHadrons.push_back(theHyp);    // (del.eq.- user is respons for del)
     7467                }
     7468              }
     7469              curHadr->Set4Momentum(f4M);
     7470              curHadr->SetQPDG(G4QPDGCode(fPDG));  // converted hypernucleus
     7471              if(sS>1) s4M/=sS;                    // split the Hyperon 4-mom if necessary
     7472              for(G4int il=0; il<sS; il++)         // loop over excessive
     7473              {
     7474                G4QHadron* theHyp = new G4QHadron(sPDG,s4M);// Make NewHadr for theHyperon
     7475                theQHadrons.push_back(theHyp);     // (del.eq.- user is respons for del)
     7476              }
     7477            }
     7478            else G4cout<<"-Warning-G4QE::FSI:*Improve* S2, PDG="<<hPDG<<",M="<<reM<<G4endl;
     7479            //else if(reM>rnM+mPi0-eps&&!nSP&&!nSM)  // Lambda->N only if Sigmas are absent
     7480            //{
     7481            //  G4int nPi=static_cast<G4int>((reM-rnM)/mPi0);
     7482            //  if (nPi>nL) nPi=nL;
     7483            //  G4double npiM=nPi*mPi0;
     7484            //  G4LorentzVector n4M(0.,0.,0.,rnM);
     7485            //  G4LorentzVector h4M(0.,0.,0.,npiM);
     7486            //  G4double sum=rnM+npiM;
     7487            //  if(fabs(reM-sum)<eps)
     7488            //  {
     7489            //    n4M=r4M*(rnM/sum);
     7490            //    h4M=r4M*(npiM/sum);
     7491            //  }
     7492            //  else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
     7493            //  {
     7494            //    G4cerr<<"**G4QE::FSI:HypN,M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
     7495            //    throw G4QException("***G4QEnvironment::FSInter: Hypernuclear decay error");
     7496            //  }
     7497            //  curHadr->Set4Momentum(n4M);
     7498            //  curHadr->SetQPDG(G4QPDGCode(rnPDG)); // converted hypernucleus
     7499#ifdef pdebug
     7500            //  G4cout<<"*G4QE::FSI:HN="<<r4M<<"->A="<<rnPDG<<n4M<<",n*Pi0="<<nPi<<h4M
     7501            //        <<G4endl;
     7502#endif
     7503            //  if(nPi>1) h4M=h4M/nPi;               // split the 4-mom if necessary
     7504            //  for(G4int ihn=0; ihn<nPi; ihn++)     // loop over additional pions
     7505            //  {
     7506            //    G4QHadron* thePion = new G4QHadron(111,h4M);// Make a New Hadr for the pion
     7507            //    theQHadrons.push_back(thePion);    // (del.eq.- user is responsible for del)
     7508            //    //theFragments->push_back(thePion);  // (delete equivalent for the pion)
     7509            //  }
     7510            //  if(rnPDG==90000002)                  // Additional action with curHadr change
     7511            //  {
     7512            //    G4LorentzVector newLV=n4M/2.;
     7513            //    curHadr->Set4Momentum(newLV);
     7514            //    curHadr->SetQPDG(G4QPDGCode(90000001));
     7515            //    G4QHadron* secHadr = new G4QHadron(curHadr);
     7516            //    theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7517            //  }
     7518            //  else if(rnPDG==90002000)             // Additional action with curHadr change
     7519            //  {
     7520            //    G4LorentzVector newLV=n4M/2.;
     7521            //    curHadr->Set4Momentum(newLV);
     7522            //    curHadr->SetQPDG(G4QPDGCode(90001000));
     7523            //    G4QHadron* secHadr = new G4QHadron(curHadr);
     7524            //    theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7525            //  }
     7526            //  // @@ Add multybaryon decays if necessary
     7527            //}
     7528            //else if(reM>rnM-eps)    // Decay in nonstange and gamma
     7529            //{
     7530            //  G4LorentzVector n4M(0.,0.,0.,rnM);
     7531            //  G4LorentzVector h4M(0.,0.,0.,0.);
     7532            //  G4double sum=rnM;
     7533            //  if(fabs(reM-sum)<eps) n4M=r4M;
     7534            //  else if(reM<sum || !G4QHadron(r4M).DecayIn2(n4M,h4M))
     7535            //  {
     7536            //    G4cerr<<"**G4QE::FSI:HypN,M="<<reM<<"<A+n*Pi0="<<sum<<",d="<<sum-reM<<G4endl;
     7537            //    throw G4QException("***G4QEnvironment::FSInt:Hypernuclear GammaDecay error");
     7538            //  }
     7539            //  curHadr->Set4Momentum(n4M);
     7540            //  curHadr->SetQPDG(G4QPDGCode(rnPDG)); // converted hypernucleus
     7541#ifdef pdebug
     7542            //  G4cout<<"*G4QE::FSI:HyN="<<r4M<<"->A="<<rnPDG<<n4M<<",gamma="<<h4M<<G4endl;
     7543#endif
     7544            //  G4QHadron* theGamma = new G4QHadron(22,h4M);// Make a New Hadr for the gamma
     7545            //  theQHadrons.push_back(theGamma);     // (del.eq.- user is responsible for del)
     7546            //  if(rnPDG==90000002)                  // Additional action with curHadr change
     7547            //  {
     7548            //    G4LorentzVector newLV=n4M/2.;
     7549            //    curHadr->Set4Momentum(newLV);
     7550            //    curHadr->SetQPDG(G4QPDGCode(90000001));
     7551            //    G4QHadron* secHadr = new G4QHadron(curHadr);
     7552            //    theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7553            //  }
     7554            //  else if(rnPDG==90002000)             // Additional action with curHadr change
     7555            //  {
     7556            //    G4LorentzVector newLV=n4M/2.;
     7557            //    curHadr->Set4Momentum(newLV);
     7558            //    curHadr->SetQPDG(G4QPDGCode(90001000));
     7559            //    G4QHadron* secHadr = new G4QHadron(curHadr);
     7560            //    theQHadrons.push_back(secHadr);    // (del.eq.- user is responsible for del)
     7561            //  }
     7562            //  // @@ Add multybaryon decays if necessary
     7563            //}
     7564            //else // If this Error shows up (lowProbable appearance) => now it is left as is
     7565            //{
     7566            //  G4double d=rlM+MLa-reM;
     7567            //G4cerr<<"G4QE::F:R="<<rlM<<",S+="<<nSP<<",S-="<<nSM<<",L="<<nL<<",d="<<d<<G4endl;
     7568            //  d=rnM+mPi0-reM;
     7569            //  G4cerr<<"-W-G4QE::FSI:HyN="<<hPDG<<",M="<<reM<<"<"<<rnM+mPi0<<",d="<<d<<G4endl;
     7570            //  //throw G4QException("G4QEnvironment::FSInteract: Hypernuclear conversion");
     7571            //}
     7572          } // End of decay in 2
     7573        }
     7574      }
     7575#ifdef pdebug
     7576      else G4cout<<"-Warning-G4QE::FSI:*Improve*,S="<<SS<<">B="<<nB<<",PDG="<<hPDG<<G4endl;
     7577#endif
    71547578    }
    71557579    //unsigned nHd=theQHadrons.size()-1;
     
    71647588    if(!fOK) hd--;
    71657589  } //
    7166 #ifdef fdebug
     7590#ifdef pdebug
    71677591  G4cout<<"G4QE::FSI:==>OUT,nH="<<theQHadrons.size()<<",nF="<<theFragments->size()<<G4endl;
    71687592#endif
     
    71757599  {
    71767600    G4QHadron* curHadr = new G4QHadron(theQHadrons[f]);
    7177 #ifdef pdebug
     7601#ifdef debug
    71787602    G4cout<<"G4QE::FSI:#"<<f<<curHadr->Get4Momentum()<<curHadr->GetPDGCode()<<G4endl;
    71797603#endif
     
    72047628    }
    72057629  }
     7630#ifdef chdebug
    72067631  if(cfContSum-chContSum || bfContSum-bnContSum)
    72077632  {
    72087633    G4cerr<<"*G4QE::FSI:(9) Ch="<<cfContSum-chContSum<<",Bn="<<bfContSum-bnContSum<<G4endl;
    7209 #ifdef chdebug
     7634
    72107635    throw G4QException("G4QEnvironment::FSInteract: (9) Charge is not conserved");
    7211 #endif
    72127636  }
     7637#endif
    72137638  // ***
    72147639  return theFragments;
     
    72197644{//              =============================
    72207645  G4int nQ=theQuasmons.size();
    7221 #ifdef pdebug
     7646#ifdef debug
    72227647  G4cout<<"G4QEnvironment::GetQuasmons is called nQ="<<nQ<<G4endl;
    72237648#endif
     
    72257650  if(nQ) for(G4int iq=0; iq<nQ; iq++)
    72267651  {
    7227 #ifdef pdebug
     7652#ifdef debug
    72287653    G4cout<<"G4QEnv::GetQuasm:Q#"<<iq<<",QQPDG="<<theQuasmons[iq]->GetQPDG()<<",QQC="
    72297654          <<theQuasmons[iq]->GetQC()<<",M="<<theQuasmons[iq]->Get4Momentum().m()<<G4endl;
     
    72327657    quasmons->push_back(curQ);                 // (delete equivalent - user is responsible)
    72337658  }
    7234 #ifdef pdebug
     7659#ifdef debug
    72357660  G4cout<<"G4QEnvironment::GetQuasmons ===OUT==="<<G4endl;
    72367661#endif
     
    72427667{//              =============================
    72437668  G4int nH=theQHadrons.size();
    7244 #ifdef pdebug
     7669#ifdef debug
    72457670  G4cout<<"G4QEnvironment::GetQHadrons is called nH="<<nH<<G4endl;
    72467671#endif
     
    72487673  if(nH) for(G4int ih=0; ih<nH; ih++)
    72497674  {
    7250 #ifdef pdebug
     7675#ifdef debug
    72517676    G4cout<<"G4QEnv::GetQHadrons:H#"<<ih<<",HQPDG="<<theQHadrons[ih]->GetQPDG()<<",HQC="
    72527677          <<theQHadrons[ih]->GetQC()<<",HM="<<theQHadrons[ih]->GetMass()<<G4endl;
     
    72557680    hadrons->push_back(curH);                       // (del. equiv. - user is responsibile)
    72567681  }
    7257 #ifdef pdebug
     7682#ifdef debug
    72587683  G4cout<<"G4QEnvironment::GetQHadrons ===OUT=== Copied nQH="<<hadrons->size()<<G4endl;
    72597684#endif
     
    72727697{//                  ====================================
    72737698  G4int nH=input->size();
    7274 #ifdef pdebug
     7699#ifdef debug
    72757700  G4cout<<"G4QEnvironment::FillQHadrons is called nH="<<nH<<G4endl;
    72767701#endif
    72777702  if(nH) for(G4int ih=0; ih<nH; ih++)
    72787703  {
    7279 #ifdef pdebug
     7704#ifdef debug
    72807705    G4cout<<"G4QEnv::FillQHadrons:H#"<<ih<<",HQPDG="<<(*input)[ih]->GetQPDG()<<",HQC="
    72817706          <<(*input)[ih]->GetQC()<<",HM="<<(*input)[ih]->GetMass()<<G4endl;
     
    72847709    theQHadrons.push_back(curH);                        // (del. equiv.
    72857710  }
    7286 #ifdef pdebug
     7711#ifdef debug
    72877712  G4cout<<"G4QEnvironment::FillQHadrons ===OUT=== Filled nQH="<<theQHadrons.size()<<G4endl;
    72887713#endif
     
    73277752  static const G4double mLPi  = mPi + mLamb;
    73287753  static const G4double mSpPi = mPi + mSigP;
    7329   static const G4double mSmPi = mPi + mSigP;
     7754  static const G4double mSmPi = mPi + mSigM;
    73307755  static const G4double mPK   = mK  + mProt;
    73317756  static const G4double mPKZ  = mK0 + mProt;
     
    73517776  G4LorentzVector q4M = qH->Get4Momentum();    // Get 4-momentum of the Baryon
    73527777  G4double         qM = q4M.m();               // Mass of the Baryon
    7353 #ifdef pdebug
     7778#ifdef debug
    73547779  G4cout<<"G4QEnv::DecayBaryon: *Called* S="<<theLS<<",C="<<theLC<<",4M="<<q4M<<qM<<G4endl;
    73557780#endif
     
    73677792        if(fabs(qM-mNeut)<eps)
    73687793        {
    7369 #ifdef pdebug
     7794#ifdef debug
    73707795          G4cout<<"G4QEnv::DecayBaryon: Fill Neutron AsIs"<<G4endl;
    73717796#endif
     
    74037828        if(fabs(qM-mProt)<eps)
    74047829        {
    7405 #ifdef pdebug
     7830#ifdef debug
    74067831          G4cout<<"G4QEnv::DecayBaryon: Fill Proton AsIs"<<G4endl;
    74077832#endif
     
    74347859      else                      // @@ Can be aReason to search for anError in Fragmentation
    74357860      {
    7436 #ifdef pdebug
     7861#ifdef debug
    74377862        G4cout<<"-Warning-G4QE::DecBary:*AsIs* DEL++ M="<<qM<<"<"<<mPPi<<G4endl;
    74387863#endif
     
    74527877      else                      // @@ Can be aReason to search for anError in Fragmentation
    74537878      {
    7454 #ifdef pdebug
     7879#ifdef debug
    74557880        G4cout<<"-Warning-G4QE::DecBary:*AsIs* DEL++ M="<<qM<<"<"<<mNPi<<G4endl;
    74567881#endif
     
    74617886    else
    74627887    {
    7463 #ifdef pdebug
     7888#ifdef debug
    74647889      G4cout<<"-Warning-G4QE::DecBary:*AsIs* UnknBaryon (S=0) QC="<<qH->GetQC()<<G4endl;
    74657890#endif
     
    74767901        if(fabs(qM-mLamb)<eps)
    74777902        {
    7478 #ifdef pdebug
     7903#ifdef debug
    74797904          G4cout<<"G4QEnv::DecayBaryon: Fill Lambda AsIs"<<G4endl;
    74807905#endif
     
    76388063        if(fabs(qM-mSigP)<eps)
    76398064        {
    7640 #ifdef pdebug
     8065#ifdef debug
    76418066          G4cout<<"G4QEnv::DecayBaryon: Fill SigmaPlus AsIs"<<G4endl;
    76428067#endif
     
    77318156        if(fabs(qM-mSigM)<eps)
    77328157        {
    7733 #ifdef pdebug
     8158#ifdef debug
    77348159          G4cout<<"G4QEnv::DecayBaryon: Fill SigmaMinus AsIs"<<G4endl;
    77358160#endif
     
    78208245      }
    78218246    }
     8247    else if(theLC==2 || theLC==-2) // SigmaPlus+PiPlus or SigmaMinus+PiMinus
     8248    {
     8249      if(theLC==2 && qM>=mSpPi) // SigmaPlus+PiPlus decay is possible
     8250      {
     8251        fQPDG=spQPDG;           // Baryon is SigmaP
     8252        fMass=mSigP;
     8253        sQPDG=pipQPDG;          // Pi+ Meson
     8254        sMass=mPi;
     8255      }
     8256      if(theLC==-2 && qM>=mSmPi)// SigmaPlus+PiPlus decay is possible
     8257      {
     8258        fQPDG=smQPDG;           // Baryon is SigmaP
     8259        fMass=mSigM;
     8260        sQPDG=pimQPDG;          // Pi- Meson
     8261        sMass=mPi;
     8262      }
     8263      else
     8264      {
     8265#ifdef debug
     8266        G4cout<<"-Warning-G4QE::DecBary:*AsIs* Baryon(S=1,|C|=2),QC="<<qH->GetQC()<<G4endl;
     8267#endif
     8268        theQHadrons.push_back(qH);                 // Fill AsIs (delete equivalent)
     8269        return;
     8270      }
     8271    }
    78228272    else
    78238273    {
     
    78258275      //KsiZ: Ksi0+Pi0=1449.81, KsiM+Pi=1460.9, L+K0=1613.3, Sig0+K0=1690.3, SigP+K=1683.05
    78268276      //Omeg: Omeg+Pi0=1807.43, Ksi0+K=1808.5, KsiM+K0=1818.96
    7827       G4cout<<"-Warning-G4QE::DecBary:*AsIs* UnknownBaryon(S>1)QC="<<qH->GetQC()<<G4endl;
     8277      G4cout<<"-Warning-G4QE::DecBary:*AsIs* UnknownBaryon(S=1)QC="<<qH->GetQC()<<G4endl;
    78288278      theQHadrons.push_back(qH);                 // Fill AsIs (delete equivalent)
    78298279      return;
     
    78328282  else
    78338283  {
    7834 #ifdef pdebug
     8284#ifdef debug
    78358285    G4cout<<"---Warning---G4QE::DecBary:*AsIso*UnknBaryon(AntiS),QC="<<qH->GetQC()<<G4endl;
    78368286#endif
     
    78488298  else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
    78498299  {
    7850 #ifdef pdebug
     8300#ifdef debug
    78518301    G4cout<<"---Warning---G4QE::DecBar:fPDG="<<fQPDG<<"(M="<<fMass<<")+sPDG="<<sQPDG<<"(M="
    78528302          <<sMass<<") > TotM="<<q4M.m()<<G4endl;
     
    78678317    }
    78688318  }
    7869 #ifdef pdebug
     8319#ifdef debug
    78708320  G4cout<<"G4QEnv::DecayBaryon: *DONE* f4M="<<f4Mom<<",fPDG="<<fQPDG<<", s4M="<<s4Mom
    78718321        <<",sPDG="<<sQPDG<<G4endl;
     
    78988348    return;
    78998349  }
    7900   else if(theLS<-1)
    7901   {
    7902     G4cout<<"*Warning*G4QEnvironment::DecayAntistrange: S="<<theLS<<",AsIsImprove"<<G4endl;
    7903     theQHadrons.push_back(qH);                 // Fill AsIs (delete equivalent)
    7904     return;
    7905   }
     8350  //else if(theLS<-1)
     8351  //{
     8352  //  G4cout<<"*Warning*G4QEnviron::DecayAntistrange: S="<<theLS<<",AsIs->Improve"<<G4endl;
     8353  //  theQHadrons.push_back(qH);                 // Fill AsIs (delete equivalent)
     8354  //  return;
     8355  //}
     8356  G4int astr=-theLS;                           // Number of K+ (or anti-K0)
    79068357  G4int theLB= qH->GetBaryonNumber();          // Baryon number of the Nucleus
    79078358  G4int theLC= qH->GetCharge();                // Chsrge of the Nucleus
    79088359  G4int qPDG = qH->GetPDGCode();               // PDG Code of the decaying Nucleus
    7909   G4int K0PDG= qPDG+999999;                    // Residual nonStrange nucleus for antiK0
    7910   G4QPDGCode K0QPDG(K0PDG);                    // QPDG of the nuclear residual for antiK0
    7911   G4double rK0M=K0QPDG.GetMass();              // Mass of the nuclear residual for antiK0
    7912   G4int KpPDG= qPDG+999000;                    // Residual nonStrange nucleus for K+
    7913   G4QPDGCode KpQPDG(KpPDG);                    // QPDG of the nuclear residual for K+
    7914   G4double rKpM=KpQPDG.GetMass();              // Mass of the nuclear residual for K+
     8360  G4int K0PDG= qPDG+astr*999999;               // Residual nonStrange nucleus for S*antiK0
     8361  G4QPDGCode K0QPDG(K0PDG);                    // QPDG of the nuclear residual for S*antiK0
     8362  G4double rK0M=K0QPDG.GetMass();              // Mass of the nuclear residual for S*antiK0
     8363  G4int KpPDG= qPDG+astr*999000;               // Residual nonStrange nucleus for S*K+
     8364  G4QPDGCode KpQPDG(KpPDG);                    // QPDG of the nuclear residual for S*K+
     8365  G4double rKpM=KpQPDG.GetMass();              // Mass of the nuclear residual for S*K+
    79158366  G4LorentzVector q4M = qH->Get4Momentum();    // Get 4-momentum of the Nucleus
    79168367  G4double         qM = q4M.m();               // Mass of the Nucleus
    7917 #ifdef pdebug
     8368#ifdef debug
    79188369  G4cout<<"G4QE::DecayAntistrang:S="<<theLS<<",C="<<theLC<<",B="<<theLB<<",M="<<qM<<G4endl;
    79198370#endif
    7920   // Select a chanel of the decay
     8371  // Select a chanel of the decay: @@ The Kaon binding energy is not taken into account !!
    79218372  G4QPDGCode     fQPDG = kzQPDG;               // Prototype for Kaon (anti-K0)
    79228373  G4double       fMass= mK0;
    79238374  G4QPDGCode     sQPDG = K0QPDG;               // Prototype for residual nucleus to Kaon
    79248375  G4double       sMass= rK0M;
    7925   if(mK0+rK0M>qM)                              // Can not be K0
     8376  if(astr*mK0+rK0M>qM)                              // Can not be K0
    79268377  {
    7927     if(mK+rKpM>qM)                             // Can not be K+ too
    7928     {
     8378    if(astr*mK+rKpM>qM)                             // Can not be K+ too
     8379    {
     8380#ifdef debug
     8381      // @@ Survices, but...
    79298382      G4cout<<"*Warning*G4QEnvironment::DecayAntistrange: Too low mass, keep AsIs"<<G4endl;
     8383#endif
    79308384      theQHadrons.push_back(qH);               // Fill AsIs (delete equivalent)
    79318385      return;
     
    79398393    }
    79408394  }
    7941   else if(mK+rKpM<qM && theLC>theLB-theLC)     // Switch to K+ if Z>N
     8395  else if(astr*mK+rKpM<qM && theLC>theLB-theLC)     // Switch to K+ if Z>N
    79428396  {
    79438397    fQPDG = kpQPDG;                            // Positive Kaon
     
    79468400    sMass= rKpM;
    79478401  }
    7948   G4LorentzVector f4Mom(0.,0.,0.,fMass);
     8402  G4double afMass=fMass;
     8403  if(astr>1) afMass*=astr;
     8404  G4LorentzVector f4Mom(0.,0.,0.,afMass);
    79498405  G4LorentzVector s4Mom(0.,0.,0.,sMass);
    7950   G4double sum=fMass+sMass;
     8406  G4double sum=afMass+sMass;
    79518407  if(fabs(qM-sum)<eps)
    79528408  {
    7953     f4Mom=q4M*(fMass/sum);
     8409    f4Mom=q4M*(afMass/sum);
    79548410    s4Mom=q4M*(sMass/sum);
    79558411  }
    79568412  else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
    79578413  {
    7958 #ifdef pdebug
     8414#ifdef debug
    79598415    G4cout<<"--Warning--G4QE::DecAntistrange: fPDG="<<fQPDG<<"(M="<<fMass<<")+sPDG="<<sQPDG
    79608416          <<"(M="<<sMass<<") > TotM="<<q4M.m()<<G4endl;
     
    79638419    throw G4QException("G4QEnv::DecayAntistrange: Nucleus DecayIn2 error");
    79648420  }
    7965 #ifdef pdebug
     8421#ifdef debug
    79668422  G4cout<<"G4QEnv::DecayAntistrange: *Done* f4M="<<f4Mom<<",fPDG="<<fQPDG<<", s4M="<<s4Mom
    79678423        <<",sPDG="<<sQPDG<<G4endl;
     
    79698425  delete qH;
    79708426  //
    7971   G4QHadron* H1 = new G4QHadron(fQPDG,f4Mom); // Create a Hadron for the 1-st baryon
     8427  if(astr>1) f4Mom/=astr;
     8428  G4QHadron* H1 = new G4QHadron(fQPDG,f4Mom); // Create a Hadron for the 1-st kaon
    79728429  theQHadrons.push_back(H1);                  // Fill "H1" (delete equivalent)
    7973   G4QHadron* H2 = new G4QHadron(sQPDG,s4Mom); // Create a Hadron for the 2-nd baryon
     8430  for(G4int ia=1; ia < astr; ++ia)
     8431  {
     8432    H1 = new G4QHadron(fQPDG,f4Mom);          // Create a Hadron for other kaons
     8433    theQHadrons.push_back(H1);                // Fill "H1" (delete equivalent)
     8434  }
     8435  G4QHadron* H2 = new G4QHadron(sQPDG,s4Mom); // Create a Hadron for the Residual Nucleus
    79748436  theQHadrons.push_back(H2);                  // Fill "H2" (delete equivalent)
    79758437} // End of DecayAntistrange
     
    80288490      if(G4QHadron(toLV).DecayIn2(reTLV,enva4M))
    80298491      {
    8030 #ifdef pdebug
     8492#ifdef debug
    80318493        G4cout<<"G4QE::CGS: fill EnvPDG="<<envPDG<<",4M="<<enva4M<<" and continue"<<G4endl;
    80328494#endif
     
    80388500    G4int  baPDG=3122;                          // Prototype for MultiLambda
    80398501    if(!resS) baPDG = (!resC) ? 2112 : 2212;    // MultiNeutron or MultiProton
    8040 #ifdef pdebug
     8502#ifdef debug
    80418503    G4cout<<"G4QE::CGS: fill "<<resB<<" of "<<baPDG<<" with t4M="<<reTLV<<G4endl;
    80428504#endif
     
    81288590        {
    81298591          //@@CHECK CoulBar (only for ResQuasmon in respect to ResEnv) and may be evaporate
    8130 #ifdef pdebug
     8592#ifdef debug
    81318593          G4cout<<"G4QE::CGS: Modify the Last 4-momentum to "<<hadr4M<<G4endl;
    81328594#endif
     
    81358597          G4QContent theEQC=theEnvironment.GetQCZNS();
    81368598          G4QHadron* envaH = new G4QHadron(theEQC,enva4M);
    8137 #ifdef pdebug
     8599#ifdef debug
    81388600          G4cout<<"G4QE::CGS: Fill Quasm "<<valQ<<quas4M<<" in any form"<<G4endl;
    81398601#endif
    81408602          EvaporateResidual(quasH);     // Try to evaporate residual (del.eq.)
    8141 #ifdef pdebug
     8603#ifdef debug
    81428604          G4cout<<"G4QE::CGS: Fill envir "<<theEQC<<enva4M<<" in any form"<<G4endl;
    81438605#endif
     
    81648626          //@@CHECK CoulBar (only for ResQuasmon in respect to ResEnv) & may be evaporate
    81658627          theLast->Set4Momentum(hadr4M);
    8166 #ifdef pdebug
     8628#ifdef debug
    81678629          G4cout<<"G4QE::CGS: modify theLast 4M="<<hadr4M<<hadr4M.m()<<G4endl;
    81688630#endif
    81698631          quasH->Set4Momentum(quas4M);
    8170 #ifdef pdebug
     8632#ifdef debug
    81718633          G4cout<<"G4QE::CGS: fill newQH "<<valQ<<quas4M<<quas4M.m()<<" inAnyForm"<<G4endl;
    81728634#endif
     
    82198681            G4cout<<"G4QE::CGS:*SUCCESS**>CHECK, D4M="<<tmpTLV-hadr4M-prev4M-nuc4M<<G4endl;
    82208682#endif
    8221 #ifdef pdebug
     8683#ifdef debug
    82228684            G4cout<<"G4QE::CGS: Fill nucleus "<<reTQC<<nuc4M<<" in any form"<<G4endl;
    82238685#endif
     
    82798741                G4cout<<"G4QE::CGS:nPhot="<<nphot<<",ph4M="<<ch4M<<"+r4M="<<quas4M<<G4endl;
    82808742#endif
    8281 #ifdef pdebug
     8743#ifdef debug
    82828744                G4cout<<"G4QE::CGS: Fill Resid "<<reTQC<<quas4M<<" in any form"<<G4endl;
    82838745#endif
     
    83398801                {
    83408802                  G4QHadron* fnH = new G4QHadron(nuPD,fn4M);// First Nucleon(s)
    8341 #ifdef pdebug
     8803#ifdef debug
    83428804                  G4cout<<"G4QE::CGS: fill Nucleon #"<<ib<<", "<<nuPD<<fn4M<<G4endl;
    83438805#endif
     
    83458807                }
    83468808                G4QHadron* snH = new G4QHadron(nuPD,sn4M);// Second Nucleon
    8347 #ifdef pdebug
     8809#ifdef debug
    83488810                G4cout<<"G4QE::CGS: fill the Last Nucleon, "<<nuPD<<sn4M<<G4endl;
    83498811#endif
     
    83998861                {
    84008862                  G4QHadron* piH = new G4QHadron(piPD,pi4M);// Pion(s)
    8401 #ifdef pdebug
     8863#ifdef debug
    84028864                  G4cout<<"G4QE::CGS: fill Pion #"<<ip<<", "<<piPD<<pi4M<<G4endl;
    84038865#endif
     
    84088870                {
    84098871                  G4QHadron* fnH = new G4QHadron(nuPD,fn4M);// Nucleon(s)
    8410 #ifdef pdebug
     8872#ifdef debug
    84118873                  G4cout<<"G4QE::CGS: fill IsoNucleon #"<<ib<<", "<<nuPD<<fn4M<<G4endl;
    84128874#endif
     
    84908952                      curHadr->Set4Momentum(ch4M);// Change 4M of the Current Hadron
    84918953                      G4QHadron* rpH = new G4QHadron(ipiQC,ipi4M);// Prototype of ResidPion
    8492 #ifdef pdebug
     8954#ifdef debug
    84938955                      G4cout<<"G4QE::CGS: fill Pion "<<ipiQC<<ipi4M<<G4endl;
    84948956#endif
    84958957                      theQHadrons.push_back(rpH); // Fill Resid Pion (delete equivalent)
    84968958                      G4QHadron* rqH = new G4QHadron(nnQC,quas4M);// Prototype of OutResidQ
    8497 #ifdef pdebug
     8959#ifdef debug
    84988960                      G4cout<<"G4QE::CGS:Fill isoRes "<<nnQC<<quas4M<<" inAnyForm"<<G4endl;
    84998961#endif
     
    85569018                          rqH->SetQPDG(gamQPDG);      // Change QPDG of the ResidualQuasmon
    85579019                          theQHadrons.push_back(rqH); // Fill Gamma 1 as QHadron (del. eq.)
    8558 #ifdef pdebug
     9020#ifdef debug
    85599021                          G4cout<<"G4QE::CGS:Fill (SubRQ) Gamma 1,(22)4M="<<quas4M<<G4endl;
    85609022#endif
    85619023                          G4QHadron* gamH = new G4QHadron(gamQPDG, gam4M);
    85629024                          theQHadrons.push_back(gamH);// Fill Gamma 2 as QHadron (del. eq.)
    8563 #ifdef pdebug
     9025#ifdef debug
    85649026                          G4cout<<"G4QE::CGS:Fill newMadeGamma 2, (22) 4M="<<gam4M<<G4endl;
    85659027#endif
     
    85899051                          G4cout<<"G4QE::CGS:#"<<hd<<",h="<<ch4M<<"+rq="<<quas4M<<G4endl;
    85909052#endif
    8591 #ifdef pdebug
     9053#ifdef debug
    85929054                          G4cout<<"G4QE::CGS:FilFr "<<nnQPDG<<quas4M<<" inAnyForm"<<G4endl;
    85939055#endif
     
    86479109                            G4cout<<"G4QE::CGS:#"<<hd<<",ch="<<ch4M<<"+t4M="<<tc4M<<G4endl;
    86489110#endif
    8649 #ifdef pdebug
     9111#ifdef debug
    86509112                            G4cout<<"G4QE::CGS:FilTC "<<tcQPDG<<tc4M<<" inAnyForm"<<G4endl;
    86519113#endif
     
    86889150                            <<ch4M<<" + ResQ4M="<<totPDG<<quas4M<<G4endl;
    86899151#endif
    8690 #ifdef pdebug
     9152#ifdef debug
    86919153                      G4cout<<"G4QE::CGS:Fill GSRes "<<reTQC<<quas4M<<" inAnyForm"<<G4endl;
    86929154#endif
     
    87329194                  ttQPDG=G4QPDGCode(ttPDG);            // Update QPDGcode defining fragment
    87339195                  ttGSM=ttQPDG.GetMass();              // Update the degraded mass value
    8734 #ifdef pdebug
     9196#ifdef debug
    87359197                  G4cout<<"G4QEnv::CheckGS:Hypernucleus degraded to QPDG="<<ttQPDG<<G4endl;
    87369198#endif
     
    87569218                  }
    87579219                }
    8758                 else G4cout<<"**G4QEnv::CheckGS:M="<<ttM<<" < GSM="<<ttGSM<<ttQPDG<<G4endl;
     9220#ifdef debug
     9221                else G4cout<<"-W-G4QEn::CheckGS:M="<<ttM<<" < GSM="<<ttGSM<<ttQPDG<<G4endl;
     9222#endif
    87599223              }
    87609224            }
     
    87839247      if(!hNF)                                     // Fill only final hadrons
    87849248      {
    8785 #ifdef pdebug
     9249#ifdef debug
    87869250        G4cout<<"G4QEnv::Copy&DeleteHV:#"<<ih<<", hPDG="<<inH->GetPDGCode()<<G4endl;
    87879251#endif
     
    87939257    HV->clear();                                       // Delete pointers
    87949258  }
    8795 #ifdef pdebug
     9259#ifdef debug
    87969260  else G4cout<<"***G4QEnv::Kopy&DelHV: No hadrons in the QHadronVector"<<G4endl;
    87979261#endif
     
    88179281    resSMa+=resEMa;                               // Minimal Split Mass of Residual Nucleus
    88189282    G4double resTMa=reTLV.m();                    // CM Mass of theResidNucleus (Quasm+Env)
    8819  //#ifdef pdebug
     9283 //#ifdef debug
    88209284    G4cout<<"G4QEnv::DecayInEnvQ: totM="<<reTLV<<resTMa<<" > rQM+rEM="<<resSMa<<G4endl;
    88219285 //#endif
     
    88579321#endif
    88589322}
    8859 //General function makes Random Unit 3D-Vector
    8860 G4ThreeVector RndmDir()
    8861 {//  -------- =========
    8862   G4double x = G4UniformRand(), y = G4UniformRand(), z = G4UniformRand();
    8863   G4double r2= x*x+y*y+z*z;
    8864   while(r2>1.||r2<.000001)
    8865   {
    8866     x = G4UniformRand(); y = G4UniformRand(); z = G4UniformRand();
    8867     r2=x*x+y*y+z*z;
    8868   }
    8869   G4double r=sqrt(r2), quad=G4UniformRand();
    8870   if(quad>0.5)
    8871   {
    8872     if(quad>0.75)
    8873     {
    8874       if(quad>0.875)    return G4ThreeVector(-x/r,-y/r,-z/r);
    8875       else              return G4ThreeVector(-x/r,-y/r, z/r);
    8876     }
    8877     else
    8878     {
    8879       if(quad>0.625)    return G4ThreeVector(-x/r, y/r,-z/r);
    8880       else              return G4ThreeVector(-x/r, y/r, z/r);
    8881     }
    8882   }
    8883   else
    8884   {
    8885     if(quad>0.25)
    8886     {
    8887       if(quad>0.375)    return G4ThreeVector( x/r,-y/r,-z/r);
    8888       else              return G4ThreeVector( x/r,-y/r, z/r);
    8889     }
    8890     else if(quad>0.125) return G4ThreeVector( x/r, y/r,-z/r);
    8891   }
    8892   return                       G4ThreeVector( x/r, y/r, z/r);
    8893 } // End of RndmDir
     9323//General function makes Random Unit 3D-Vector -> now G4RandomDirection() is used
     9324//G4ThreeVector RndmDir()
     9325//{//  -------- =========
     9326//  G4double x = G4UniformRand(), y = G4UniformRand(), z = G4UniformRand();
     9327//  G4double r2= x*x+y*y+z*z;
     9328//  while(r2>1.||r2<.000001)
     9329//  {
     9330//    x = G4UniformRand(); y = G4UniformRand(); z = G4UniformRand();
     9331//    r2=x*x+y*y+z*z;
     9332//  }
     9333//  G4double r=sqrt(r2), quad=G4UniformRand();
     9334//  if(quad>0.5)
     9335//  {
     9336//    if(quad>0.75)
     9337//    {
     9338//      if(quad>0.875)    return G4ThreeVector(-x/r,-y/r,-z/r);
     9339//      else              return G4ThreeVector(-x/r,-y/r, z/r);
     9340//    }
     9341//    else
     9342//    {
     9343//      if(quad>0.625)    return G4ThreeVector(-x/r, y/r,-z/r);
     9344//      else              return G4ThreeVector(-x/r, y/r, z/r);
     9345//    }
     9346//  }
     9347//  else
     9348//  {
     9349//    if(quad>0.25)
     9350//    {
     9351//      if(quad>0.375)    return G4ThreeVector( x/r,-y/r,-z/r);
     9352//      else              return G4ThreeVector( x/r,-y/r, z/r);
     9353//    }
     9354//    else if(quad>0.125) return G4ThreeVector( x/r, y/r,-z/r);
     9355//  }
     9356//  return                       G4ThreeVector( x/r, y/r, z/r);
     9357//} // End of RndmDir
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QException.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QException.cc,v 1.10 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QException ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QHadron.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QHadron.cc,v 1.54 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QHadron.cc,v 1.64 2009/09/02 15:45:19 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QHadron ----------------
     
    3939//
    4040//#define debug
     41//#define edebug
    4142//#define pdebug
    4243//#define sdebug
     
    4748using namespace std;
    4849
    49 G4double G4QHadron::alpha = -0.5;   // changing rapidity distribution for all
    50 G4double G4QHadron::beta  = 2.5;    // changing rapidity distribution for projectile region
    51 G4double G4QHadron::theMinPz = 70.*MeV;             // Can be from 14 to 140 MeV
    5250G4double G4QHadron::StrangeSuppress = 0.48;         // ? M.K.
    53 G4double G4QHadron::sigmaPt = 1.7*GeV;              // Can be 0
     51G4double G4QHadron::sigmaPt = 1.7*GeV;              // Can be 0 ?
    5452G4double G4QHadron::widthOfPtSquare = 0.01*GeV*GeV; // ? M.K.
    55 G4double G4QHadron::minTransverseMass = 1.*keV;     // ? M.K.
    56 
    57 G4QHadron::G4QHadron() : theQPDG(0),theMomentum(0.,0.,0.,0.),valQ(0,0,0,0,0,0),nFragm(0),
    58   thePosition(0.,0.,0.),theCollisionCount(0),isSplit(false),Direction(true),
    59   Color(),AntiColor(),bindE(0.),formTime(0.) {}
    60 
    61 G4QHadron::G4QHadron(G4LorentzVector p) : theQPDG(0),theMomentum(p),valQ(0,0,0,0,0,0),
     53
     54G4QHadron::G4QHadron(): theMomentum(0.,0.,0.,0.), theQPDG(0), valQ(0,0,0,0,0,0), nFragm(0),
     55  thePosition(0.,0.,0.), theCollisionCount(0), isSplit(false), Direction(true),
     56  Color(), AntiColor(), bindE(0.), formTime(0.) {}
     57
     58G4QHadron::G4QHadron(G4LorentzVector p): theMomentum(p), theQPDG(0), valQ(0,0,0,0,0,0),
     59  nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0), isSplit(false), Direction(true),
     60  Color(), AntiColor(), bindE(0.), formTime(0.) {}
     61
     62// For Chipolino or Quasmon doesn't make any sense
     63G4QHadron::G4QHadron(G4int PDGCode, G4LorentzVector p): theMomentum(p), theQPDG(PDGCode),
    6264  nFragm(0),thePosition(0.,0.,0.),theCollisionCount(0),isSplit(false),Direction(true),
    63   Color(),AntiColor(),bindE(0.),formTime(0.) {}
    64 
    65 // For Chipolino or Quasmon doesn't make any sense
    66 G4QHadron::G4QHadron(G4int PDGCode, G4LorentzVector p) : theQPDG(PDGCode),theMomentum(p),
    67   nFragm(0),thePosition(0.,0.,0.),theCollisionCount(0),isSplit(false),Direction(true),
    68   Color(),AntiColor(),bindE(0.),formTime(0.)
     65  Color(), AntiColor(), bindE(0.), formTime(0.)
    6966{
    7067#ifdef debug
     
    8481
    8582// For Chipolino or Quasmon doesn't make any sense
    86 G4QHadron::G4QHadron(G4QPDGCode QPDG, G4LorentzVector p) : theQPDG(QPDG),theMomentum(p),
    87   nFragm(0),thePosition(0.,0.,0.),theCollisionCount(0),isSplit(false),Direction(true),
    88   Color(),AntiColor(),bindE(0.),formTime(0.)
     83G4QHadron::G4QHadron(G4QPDGCode QPDG, G4LorentzVector p): theMomentum(p), theQPDG(QPDG),
     84  nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0), isSplit(false), Direction(true),
     85  Color(), AntiColor(), bindE(0.), formTime(0.)
    8986{
    9087  if(theQPDG.GetQCode()>-1)
     
    10299
    103100// Make sense Chipolino or Quasmon
    104 G4QHadron::G4QHadron(G4QContent QC, G4LorentzVector p): theQPDG(0),theMomentum(p),valQ(QC),
    105   nFragm(0),thePosition(0.,0.,0.),theCollisionCount(0),isSplit(false),Direction(true),
    106   Color(),AntiColor(),bindE(0.),formTime(0.)
     101G4QHadron::G4QHadron(G4QContent QC, G4LorentzVector p): theMomentum(p),theQPDG(0),valQ(QC),
     102  nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0), isSplit(false), Direction(true),
     103  Color(), AntiColor(), bindE(0.), formTime(0.)
    107104{
    108105  G4int curPDG=valQ.GetSPDGCode();
     
    113110
    114111G4QHadron::G4QHadron(G4int PDGCode, G4double aMass, G4QContent QC) :
    115   theQPDG(PDGCode),theMomentum(0.,0.,0., aMass),valQ(QC),nFragm(0),thePosition(0.,0.,0.),
    116   theCollisionCount(0),isSplit(false),Direction(true),Color(),AntiColor(),bindE(0.),
     112  theMomentum(0.,0.,0.,aMass), theQPDG(PDGCode), valQ(QC), nFragm(0),thePosition(0.,0.,0.),
     113  theCollisionCount(0), isSplit(false), Direction(true), Color(), AntiColor(), bindE(0.),
    117114  formTime(0.)
    118115{}
    119116
    120117G4QHadron::G4QHadron(G4QPDGCode QPDG, G4double aMass, G4QContent QC) :
    121   theQPDG(QPDG),theMomentum(0.,0.,0., aMass),valQ(QC),nFragm(0),thePosition(0.,0.,0.),
    122   theCollisionCount(0),isSplit(false),Direction(true),Color(),AntiColor(),bindE(0.),
     118  theMomentum(0.,0.,0.,aMass), theQPDG(QPDG), valQ(QC), nFragm(0), thePosition(0.,0.,0.),
     119  theCollisionCount(0), isSplit(false), Direction(true), Color(), AntiColor(), bindE(0.),
    123120  formTime(0.)
    124121{}
    125122
    126 G4QHadron::G4QHadron(G4int PDGCode, G4LorentzVector p, G4QContent QC) :
    127   theQPDG(PDGCode),theMomentum(p),valQ(QC),nFragm(0),thePosition(0.,0.,0.),
    128   theCollisionCount(0),isSplit(false),Direction(true),Color(),AntiColor(),bindE(0.),
    129   formTime(0.)
     123G4QHadron::G4QHadron(G4int PDGCode, G4LorentzVector p, G4QContent QC) : theMomentum(p),
     124  theQPDG(PDGCode), valQ(QC), nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0),
     125  isSplit(false), Direction(true), Color(), AntiColor(), bindE(0.), formTime(0.)
    130126{}
    131127
    132 G4QHadron::G4QHadron(G4QPDGCode QPDG, G4LorentzVector p, G4QContent QC) :
    133   theQPDG(QPDG),theMomentum(p),valQ(QC),nFragm(0),thePosition(0.,0.,0.),
    134   theCollisionCount(0),isSplit(false),Direction(true),Color(),AntiColor(),bindE(0.),
    135   formTime(0.)
     128G4QHadron::G4QHadron(G4QPDGCode QPDG, G4LorentzVector p, G4QContent QC) : theMomentum(p),
     129  theQPDG(QPDG), valQ(QC), nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0),
     130  isSplit(false), Direction(true), Color(), AntiColor(), bindE(0.), formTime(0.)
    136131{}
    137132
    138 G4QHadron::G4QHadron(G4QParticle* pPart, G4double maxM) :
    139   theQPDG(pPart->GetQPDG()),theMomentum(0.,0.,0.,0.),nFragm(0),thePosition(0.,0.,0.),
    140   theCollisionCount(0),isSplit(false),Direction(true),Color(),AntiColor(),bindE(0.),
    141   formTime(0.)
     133G4QHadron::G4QHadron(G4QParticle* pPart, G4double maxM) : theMomentum(0.,0.,0.,0.),
     134  theQPDG(pPart->GetQPDG()), nFragm(0), thePosition(0.,0.,0.), theCollisionCount(0),
     135  isSplit(false), Direction(true), Color(), AntiColor(), bindE(0.), formTime(0.)
    142136{
    143137#ifdef debug
     
    567561  else if (iM+.001<fM+sM || iM==0.)
    568562  {
    569 #ifdef pdebug
     563#ifdef debug
    570564    G4cerr<<"***G4QHadron::DecayIn2*** fM="<<fM<<" + sM="<<sM<<"="<<fM+sM<<" > iM="<<iM
    571565          <<", d="<<iM-fM-sM<<G4endl;
     
    618612  }
    619613  G4ThreeVector ltb = theMomentum.boostVector(); // Boost vector for backward Lor.Trans.
    620 #ifdef pdebug
     614#ifdef debug
    621615  G4cout<<"G4QHadron::DecIn2:LorTrans v="<<ltb<<",f4Mom="<<f4Mom<<",s4Mom="<<s4Mom<<G4endl;
    622616#endif
     
    625619  if(s4Mom.e()+.001<s4Mom.rho())G4cerr<<"*G4QH::DecIn2:*Boost* s4M="<<s4Mom<<G4endl;
    626620  s4Mom.boost(ltb);                        // Lor.Trans. of 2nd hadron back to LS
    627 #ifdef pdebug
     621#ifdef debug
    628622  G4cout<<"G4QHadron::DecayIn2: ROOT OUTPUT f4Mom="<<f4Mom<<", s4Mom="<<s4Mom<<G4endl;
    629623#endif
     
    637631  G4LorentzVector comp=theMomentum+fr4Mom;  // 4Mom of the decaying compound system
    638632  G4double iM  = comp.m();                  // mass of the decaying compound system
    639 #ifdef pdebug
     633#ifdef debug
    640634  G4cout<<"G4QH::CMDIn2: iM="<<iM<<comp<<"=>fM="<<fM<<"+corM="<<corM<<"="<<fM+corM<<G4endl;
    641635#endif
     
    662656  if (p2<0.)
    663657  {
    664 #ifdef pdebug
     658#ifdef debug
    665659    G4cerr<<"**G4QH::CMDI2:p2="<<p2<<"<0,d="<<d2*d2/4.<<"<4*fM2*hM2="<<4*fM2*corM2<<G4endl;
    666660#endif
     
    718712  theMomentum.setVect((-1)*pVect);
    719713  theMomentum.setE(sqrt(corM2+p2));
    720 #ifdef pdebug
     714#ifdef debug
    721715  G4LorentzVector dif2=comp-fr4Mom-theMomentum;
    722716  G4cout<<"G4QH::CorMDIn2:c="<<comp<<"-f="<<fr4Mom<<"-4M="<<theMomentum<<"="<<dif2<<G4endl;
     
    730724  }
    731725  theMomentum.boost(ltb);                  // Lor.Trans. of the Hadron back to LS
    732 #ifdef pdebug
     726#ifdef debug
    733727  G4LorentzVector dif3=comp-fr4Mom-theMomentum;
    734728  G4cout<<"G4QH::CorMDecIn2:OUTPUT:f4M="<<fr4Mom<<",h4M="<<theMomentum<<"d="<<dif3<<G4endl;
     
    742736{//    ===============================================================
    743737  G4double fE  = fr4Mom.m();                // Energy of the Fragment
    744 #ifdef pdebug
     738#ifdef debug
    745739  G4cout<<"G4QH::CorEDecIn2:fE="<<fE<<fr4Mom<<">corE="<<corE<<",h4M="<<theMomentum<<G4endl;
    746740#endif
    747741  if (fE+.001<=corE)
    748742  {
    749 #ifdef pdebug
     743#ifdef debug
    750744    G4cerr<<"***G4QHadron::CorEDecIn2*** fE="<<fE<<"<corE="<<corE<<", d="<<corE-fE<<G4endl;
    751745#endif
     
    770764  ///////////G4double mM2=theMomentum.m2();
    771765  theMomentum= G4LorentzVector(Px,Py,Pz,mE+corE);
    772 #ifdef pdebug
     766#ifdef debug
    773767  G4double difF=fr4Mom.m2()-fM2;
    774768  G4cout<<"G4QH::CorEDecIn2: dF="<<difF<<",out:"<<theMomentum<<fr4Mom<<G4endl;
     
    10791073}
    10801074
    1081 // Split hadron in partons
     1075// Split the hadron in two partons ( quark = anti-diquark v.s. anti-quark = diquark)
    10821076void G4QHadron::SplitUp()
    10831077
    1084   if (IsSplit()) return;
    1085   Splitting();
    1086   if (Color.empty()) return;
    1087   if (GetSoftCollisionCount() == 0)
    1088   {
    1089     // Diffractive splitting: take the particle definition and get the partons
     1078  if (isSplit) return;
     1079#ifdef pdebug
     1080  G4cout<<"G4QHadron::SplitUp ***IsCalled***, before Splitting nC="<<Color.size()
     1081        <<", SoftColCount="<<theCollisionCount<<G4endl;
     1082#endif
     1083  isSplit=true;                                     // PutUp isSplit flag to avoid remake
     1084  if (!Color.empty()) return;                       // Do not split if it is already split
     1085  if (!theCollisionCount)                           // Diffractive splitting from particDef
     1086  {
    10901087    G4QParton* Left = 0;
    10911088    G4QParton* Right = 0;
    10921089    GetValenceQuarkFlavors(Left, Right);
    1093     Left->SetPosition(GetPosition());
    1094     Right->SetPosition(GetPosition());
     1090    G4ThreeVector Pos=GetPosition();
     1091    Left->SetPosition(Pos);
     1092    Right->SetPosition(Pos);
    10951093 
    1096     G4LorentzVector HadronMom = Get4Momentum();
    1097     //G4cout<<"DSU 1 - "<<HadronMom<<G4endl;
     1094    G4double theMomPlus  = theMomentum.plus();      // E+pz
     1095    G4double theMomMinus = theMomentum.minus();     // E-pz
     1096#ifdef pdebug
     1097    G4cout<<"G4QHadron::SplitUp: *Dif* possition="<<Pos<<", 4M="<<theMomentum<<G4endl;
     1098#endif
    10981099
    10991100    // momenta of string ends
    1100     G4double pt2 = HadronMom.perp2();
    1101     G4double transverseMass2 = HadronMom.plus()*HadronMom.minus();
     1101    G4double pt2 = theMomentum.perp2();
     1102    G4double transverseMass2 = theMomPlus*theMomMinus;
     1103    if(transverseMass2<0.) transverseMass2=0.;
    11021104    G4double maxAvailMomentum2 = sqr(std::sqrt(transverseMass2) - std::sqrt(pt2));
    1103     G4ThreeVector pt(minTransverseMass, minTransverseMass, 0);
    1104     if(maxAvailMomentum2/widthOfPtSquare>0.01)
    1105            pt=GaussianPt(widthOfPtSquare, maxAvailMomentum2);
    1106     //G4cout<<"DSU 1.1 - "<<maxAvailMomentum2<<", pt="<<pt<<G4endl;
    1107 
     1105    G4ThreeVector pt(0., 0., 0.); // Prototype
     1106    if(maxAvailMomentum2/widthOfPtSquare > 0.01)
     1107                                         pt=GaussianPt(widthOfPtSquare, maxAvailMomentum2);
     1108#ifdef pdebug
     1109    G4cout<<"G4QHadron::SplitUp: *Dif* maxMom2="<<maxAvailMomentum2<<", pt="<<pt<<G4endl;
     1110#endif
    11081111    G4LorentzVector LeftMom(pt, 0.);
    11091112    G4LorentzVector RightMom;
    1110     RightMom.setPx(HadronMom.px() - pt.x());
    1111     RightMom.setPy(HadronMom.py() - pt.y());
    1112     //G4cout<<"DSU 2: Right4M="<<RightMom<<", Left4M= "<<LeftMom<<G4endl;
    1113 
    1114     G4double Local1 = HadronMom.minus() +
    1115                       (RightMom.perp2() - LeftMom.perp2()) / HadronMom.plus();
     1113    RightMom.setPx(theMomentum.px() - pt.x());
     1114    RightMom.setPy(theMomentum.py() - pt.y());
     1115#ifdef pdebug
     1116    G4cout<<"G4QHadron::SplitUp: *Dif* right4m="<<RightMom<<", left4M="<<LeftMom<<G4endl;
     1117#endif
     1118    G4double Local1 = theMomMinus + (RightMom.perp2() - LeftMom.perp2()) / theMomPlus;
    11161119    G4double Local2 = std::sqrt(std::max(0., Local1*Local1 -
    1117                                 4*RightMom.perp2()*HadronMom.minus() / HadronMom.plus()));
    1118     //G4cout<<"DSU 3: L1="<< Local1 <<", L2="<<Local2<<G4endl;
    1119 
     1120                                             4*RightMom.perp2()*theMomMinus / theMomPlus));
     1121#ifdef pdebug
     1122    G4cout<<"G4QHadron::SplitUp:Dif,L1="<<Local1<<",L2="<<Local2<<",D="<<Direction<<G4endl;
     1123#endif
    11201124    if (Direction) Local2 = -Local2;
    11211125    G4double RightMinus   = 0.5*(Local1 + Local2);
    1122     G4double LeftMinus = HadronMom.minus() - RightMinus;
    1123     //G4cout<<"DSU 4: Rm="<<RightMinus<<", Lm="<<LeftMinus<<" "<<HadronMom.minus()<<G4endl;
    1124 
    1125     G4double LeftPlus  = LeftMom.perp2()/LeftMinus;
    1126     G4double RightPlus = HadronMom.plus() - LeftPlus;
    1127     //G4cout<<"DSU 5: Rp="<<RightPlus<<", Lp="<<LeftPlus<<G4endl;
     1126    G4double LeftMinus = theMomentum.minus() - RightMinus;
     1127#ifdef pdebug
     1128    G4cout<<"G4QHadron::SplitUp: *Dif* Rminus="<<RightMinus<<",Lminus="<<LeftMinus<<",hmm="
     1129          <<theMomentum.minus()<<G4endl;
     1130#endif
     1131    G4double LeftPlus  = 0.;
     1132    if(LeftMinus) LeftPlus  = LeftMom.perp2()/LeftMinus;
     1133    G4double RightPlus = theMomentum.plus() - LeftPlus;
     1134#ifdef pdebug
     1135    G4cout<<"G4QHadron::SplitUp: *Dif* Rplus="<<RightPlus<<", Lplus="<<LeftPlus<<G4endl;
     1136#endif
    11281137    LeftMom.setPz(0.5*(LeftPlus - LeftMinus));
    11291138    LeftMom.setE (0.5*(LeftPlus + LeftMinus));
     
    11311140    RightMom.setE (0.5*(RightPlus + RightMinus));
    11321141    //G4cout<<"DSU 6: Left4M="<<LeftMom<<", Right4M="<<RightMom<<G4endl;
     1142#ifdef pdebug
     1143    G4cout<<"G4QHadron::SplitUp: *Dif* -final- R4m="<<RightMom<<", L4M="<<LeftMom<<", L+R="
     1144          <<RightMom+LeftMom<<", D4M="<<theMomentum-RightMom+LeftMom<<G4endl;
     1145#endif
    11331146    Left->Set4Momentum(LeftMom);
    11341147    Right->Set4Momentum(RightMom);
     
    11391152  {
    11401153    // Soft hadronization splitting: sample transversal momenta for sea and valence quarks
    1141     G4double phi, pts;
    1142     G4double SumPy = 0.;
    1143     G4double SumPx = 0.;
    1144     G4ThreeVector Pos = GetPosition();
    1145     G4int nSeaPair = GetSoftCollisionCount()-1;
    1146    
     1154    //G4double phi, pts;
     1155    G4ThreeVector SumP(0.,0.,0.);                         // Remember the hadron position
     1156    G4ThreeVector Pos = GetPosition();                    // Remember the hadron position
     1157    G4int nSeaPair = theCollisionCount-1;                 // a#of sea-pairs
     1158#ifdef pdebug
     1159    G4cout<<"G4QHadron::SplitUp:*Soft* Pos="<<Pos<<", nSeaPair="<<nSeaPair<<G4endl;
     1160#endif   
    11471161    // here the condition,to ensure viability of splitting, also in cases
    11481162    // where difractive excitation occured together with soft scattering.
    1149     //G4double LightConeMomentum=(Direction)? Get4Momentum().plus():Get4Momentum().minus();
    1150     //G4double Xmin = theMinPz/LightConeMomentum;
    1151     G4double Xmin = theMinPz/( Get4Momentum().e() - GetMass() );
    1152     while(Xmin>=1-(2*nSeaPair+1)*Xmin) Xmin*=0.95;
    1153 
    1154     G4int aSeaPair;
    1155     for (aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++)
     1163    for (G4int aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++) // If the sea pairs exist!
    11561164    {
    11571165      //  choose quark flavour, d:u:s = 1:1:(1/StrangeSuppress-2)
     
    11601168      //  BuildSeaQuark() determines quark spin, isospin and colour
    11611169      //  via parton-constructor G4QParton(aPDGCode)
    1162       G4QParton* aParton = BuildSeaQuark(false, aPDGCode);
    1163 
    1164       //  G4cout << "G4QGSMSplitableHadron::SoftSplitUp()" << G4endl;
    1165 
    1166       //  G4cout << "Parton 1: "
    1167       //         << " PDGcode: "  << aPDGCode
    1168       //         << " - Name: "   << aParton->GetDefinition()->GetParticleName()
    1169       //         << " - Type: "   << aParton->GetDefinition()->GetParticleType()
    1170       //         << " - Spin-3: " << aParton->GetSpinZ()
    1171       //         << " - Colour: " << aParton->GetColour() << G4endl;
     1170      G4QParton* aParton = BuildSeaQuark(false, aPDGCode); // quark/anti-diquark creation
    11721171
    11731172      // save colour a spin-3 for anti-quark
    11741173      G4int firstPartonColour = aParton->GetColour();
    11751174      G4double firstPartonSpinZ = aParton->GetSpinZ();
    1176 
    1177       SumPx += aParton->Get4Momentum().px();
    1178       SumPy += aParton->Get4Momentum().py();
    1179       Color.push_back(aParton);
     1175#ifdef pdebug
     1176      G4cout<<"G4QHadron::SplitUp:*Soft* Part1 PDG="<<aPDGCode<<", Col="<<firstPartonColour
     1177            <<", SpinZ="<<firstPartonSpinZ<<", 4M="<<aParton->Get4Momentum()<<G4endl;
     1178#endif
     1179      SumP+=aParton->Get4Momentum();
     1180      Color.push_back(aParton);                           // Quark/anti-diquark is filled
    11801181
    11811182      // create anti-quark
    1182       aParton = BuildSeaQuark(true, aPDGCode);
     1183      aParton = BuildSeaQuark(true, aPDGCode); // Redefine "aParton" (working pointer)
    11831184      aParton->SetSpinZ(-firstPartonSpinZ);
    11841185      aParton->SetColour(-firstPartonColour);
    1185 
    1186       //  G4cout << "Parton 2: "
    1187       //         << " PDGcode: "  << -aPDGCode
    1188       //         << " - Name: "   << aParton->GetDefinition()->GetParticleName()
    1189       //         << " - Type: "   << aParton->GetDefinition()->GetParticleType()
    1190       //         << " - Spin-3: " << aParton->GetSpinZ()
    1191       //         << " - Colour: " << aParton->GetColour() << G4endl;
    1192       //  G4cerr << "------------" << G4endl;
    1193 
    1194       SumPx += aParton->Get4Momentum().px();
    1195       SumPy += aParton->Get4Momentum().py();
    1196       AntiColor.push_back(aParton);
    1197     }
    1198     // Valence quark   
    1199     G4QParton* pColorParton = 0;   
    1200     G4QParton* pAntiColorParton = 0;   
     1186#ifdef pdebug
     1187      G4cout<<"G4QHadron::SplUp:Sft,P2="<<aParton->Get4Momentum()<<",i="<<aSeaPair<<G4endl;
     1188#endif
     1189
     1190      SumP+=aParton->Get4Momentum();
     1191      AntiColor.push_back(aParton);                       // Anti-quark/diquark is filled
     1192#ifdef pdebug
     1193      G4cout<<"G4QHadron::SplUp:*Sft* Antiquark is filled, i="<<aSeaPair<<G4endl;
     1194#endif
     1195    }
     1196    // ---- Create valence quarks/diquarks
     1197    G4QParton* pColorParton = 0;
     1198    G4QParton* pAntiColorParton = 0;
    12011199    GetValenceQuarkFlavors(pColorParton, pAntiColorParton);
    12021200    G4int ColorEncoding = pColorParton->GetPDGCode();
     1201#ifdef pdebug
    12031202    G4int AntiColorEncoding = pAntiColorParton->GetPDGCode();
    1204    
    1205     pts   =  sigmaPt*std::sqrt(-std::log(G4UniformRand()));
    1206     phi   = twopi*G4UniformRand();
    1207     G4double Px = pts*std::cos(phi);
    1208     G4double Py = pts*std::sin(phi);
    1209     SumPx += Px;
    1210     SumPy += Py;
     1203    G4cout<<"G4QHadron::SplUp:*Sft*,C="<<ColorEncoding<<", AC="<<AntiColorEncoding<<G4endl;
     1204#endif
     1205    G4ThreeVector ptr = GaussianPt(sigmaPt, DBL_MAX);
     1206    SumP += ptr;
     1207#ifdef pdebug
     1208    G4cout<<"G4QHadron::SplitUp: *Sft*, ptr="<<ptr<<G4endl;
     1209#endif
    12111210
    12121211    if (ColorEncoding < 0) // use particle definition
    12131212    {
    1214       G4LorentzVector ColorMom(-SumPx, -SumPy, 0, 0);
     1213      G4LorentzVector ColorMom(-SumP, 0);
    12151214      pColorParton->Set4Momentum(ColorMom);
    1216       G4LorentzVector AntiColorMom(Px, Py, 0, 0);
     1215      G4LorentzVector AntiColorMom(ptr, 0.);
    12171216      pAntiColorParton->Set4Momentum(AntiColorMom);
    12181217    }
    12191218    else
    12201219    {
    1221       G4LorentzVector ColorMom(Px, Py, 0, 0);
     1220      G4LorentzVector ColorMom(ptr, 0);
    12221221      pColorParton->Set4Momentum(ColorMom);
    1223       G4LorentzVector AntiColorMom(-SumPx, -SumPy, 0, 0);
     1222      G4LorentzVector AntiColorMom(-SumP, 0);
    12241223      pAntiColorParton->Set4Momentum(AntiColorMom);
    12251224    }
    12261225    Color.push_back(pColorParton);
    12271226    AntiColor.push_back(pAntiColorParton);
    1228 
     1227#ifdef pdebug
     1228    G4cout<<"G4QHadron::SplitUp: *Soft* Col&Anticol are filled PDG="<<GetPDGCode()<<G4endl;
     1229#endif
    12291230    // Sample X
    1230     G4int nAttempt = 0;
    1231     G4double SumX = 0;
    1232     G4double aBeta = beta;
    1233     G4double ColorX, AntiColorX;
    1234     G4double HPWtest = 0;
    1235     G4int aPDG=std::abs(GetPDGCode());
    1236     if (aPDG ==211 || aPDG == 22 || aPDG == 111) aBeta = 1.;       
    1237     else if (aPDG == 321) aBeta = 0.;       
    1238     else G4cout<<"-Warning-G4QHadron::SplitUp: wrong PDG="<<GetPDGCode()<<G4endl;
    1239     do
    1240     {
    1241       SumX = 0;
    1242       nAttempt++;
    1243       G4int    NumberOfUnsampledSeaQuarks = 2*nSeaPair;
    1244       G4double beta1 = beta;
    1245       if (std::abs(ColorEncoding) <= 1000 && std::abs(AntiColorEncoding) <= 1000) beta1 = 1.; //...  in a meson       
    1246       ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
    1247       HPWtest = ColorX;
    1248       //while (ColorX < Xmin || ColorX > 1. || 1. -  ColorX <= Xmin)
    1249       //{
    1250       //}
    1251       Color.back()->SetX(SumX = ColorX); // this is the valenz quark.
    1252 
    1253       std::list<G4QParton*>::iterator icolor = Color.begin();
    1254       std::list<G4QParton*>::iterator ecolor = Color.end();
    1255       std::list<G4QParton*>::iterator ianticolor = AntiColor.begin();
    1256       std::list<G4QParton*>::iterator eanticolor = AntiColor.end();
    1257       for ( ; icolor != ecolor && ianticolor != eanticolor; ++icolor, ++ianticolor)
    1258       {
    1259         NumberOfUnsampledSeaQuarks--;
    1260         ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
    1261         (*icolor)->SetX(ColorX);
    1262         SumX += ColorX;
    1263         NumberOfUnsampledSeaQuarks--;
    1264         AntiColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
    1265         (*ianticolor)->SetX(AntiColorX); // the 'sea' partons
    1266         SumX += AntiColorX;
    1267         if (1. - SumX <= Xmin)  break;
    1268       }
    1269     } while (1. - SumX <= Xmin);
    1270     AntiColor.back()->SetX(1.0 - SumX); // the di-quark takes the rest, then go to momentum
    1271     // and here is the bug ;-) @@@@@@@@@@@@@
    1272     if(getenv("debug_QGSMSplitableHadron"))
    1273                          G4cout<<"particle energy at split = "<<Get4Momentum().t()<<G4endl;
    1274     G4double lightCone = ((!Direction) ? Get4Momentum().minus() : Get4Momentum().plus());
    1275     // lightCone -= 0.5*Get4Momentum().m();
    1276     // hpw testing @@@@@ lightCone = 2.*Get4Momentum().t();
    1277     if(getenv("debug_QGSMSplitableHadron") )G4cout << "Light cone = "<<lightCone<<G4endl;
     1231    G4int nColor=Color.size();
     1232    G4int nAntiColor=AntiColor.size();
     1233    if(nColor!=nAntiColor || nColor != nSeaPair+1)
     1234    {
     1235      G4cerr<<"***G4QHadron::SplitUp: nA="<<nAntiColor<<",nAC="<<nColor<<",nSea="<<nSeaPair
     1236             <<G4endl;
     1237      G4Exception("G4QHadron::SplitUp:","72",FatalException,"Colours&AntiColours notSinc");
     1238    }
     1239#ifdef pdebug
     1240    G4cout<<"G4QHad::SpUp:,nPartons="<<nColor+nColor<<<<G4endl;
     1241#endif
     1242    G4int dnCol=nColor+nColor;
     1243    // From here two algorithm of splitting can be used (All(default): New, OBO: Olg, Bad)
     1244    G4double* xs=RandomX(dnCol);        // All-Non-iterative CHIPS algorithm of splitting
     1245    // Instead one can try one-by-one CHIPS algorithm (faster? but not exact). OBO comment.
     1246    //G4double Xmax=1.;                   // OBO
     1247#ifdef pdebug
     1248    G4cout<<"G4QHadron::SplitUp:*Sft* Loop ColorX="<<ColorX<<G4endl;
     1249#endif
    12781250    std::list<G4QParton*>::iterator icolor = Color.begin();
    12791251    std::list<G4QParton*>::iterator ecolor = Color.end();
    12801252    std::list<G4QParton*>::iterator ianticolor = AntiColor.begin();
    12811253    std::list<G4QParton*>::iterator eanticolor = AntiColor.end();
     1254    G4int xi=-1;                        // XIndex for All-Non-interactive CHIPS algorithm
     1255    //G4double X=0.;                      // OBO
    12821256    for ( ; icolor != ecolor && ianticolor != eanticolor; ++icolor, ++ianticolor)
    12831257    {
    1284       (*icolor)->DefineMomentumInZ(lightCone, Direction);
    1285       (*ianticolor)->DefineMomentumInZ(lightCone, Direction);
    1286     }
    1287     //G4cout <<G4endl<<"XSAMPLE "<<HPWtest<<G4endl;
     1258      (*icolor)->SetX(xs[++xi]);        // All-Non-iterative CHIPS algorithm of splitting
     1259      //X=SampleCHIPSX(Xmax, dnCol);      // OBO
     1260      //Xmax-=X;                          // OBO
     1261      //--dnCol;                          // OBO
     1262      //(*icolor)->SetX(X);               // OBO
     1263      // ----
     1264      (*icolor)->DefineEPz(theMomentum);
     1265      (*ianticolor)->SetX(xs[++xi]);    // All-Non-iterative CHIPS algorithm of splitting
     1266      //X=SampleCHIPSX(Xmax, dnCol);      // OBO
     1267      //Xmax-=X;                          // OBO
     1268      //--dnCol;                          // OBO
     1269      //(*ianticolor)->SetX(X);           // OBO
     1270      // ----
     1271      (*ianticolor)->DefineEPz(theMomentum);
     1272    }
     1273    delete[] xs;                           // The calculated array must be deleted (All)
     1274#ifdef pdebug
     1275    G4cout<<"G4QHadron::SplitUp: *Soft* ===> End, ColSize="<<Color.size()<<G4endl;
     1276#endif
    12881277    return;
    12891278  }
     
    13121301} // End of BuildSeaQuark
    13131302
    1314 G4double G4QHadron::SampleX(G4double anXmin, G4int nSea, G4int totalSea, G4double aBeta)
    1315 {
    1316   G4double result;
    1317   G4double x1, x2;
    1318   G4double ymax = 0;
    1319   for(G4int ii=0; ii<100; ii++)                    // @@ 100 is hardwired ? M.K.
    1320   {
    1321     G4double y = std::pow(1./G4double(ii), alpha);
    1322     y*=std::pow(std::pow(1.-anXmin-totalSea*anXmin,alpha+1)-std::pow(anXmin,alpha+1),nSea);
    1323     y*=std::pow(1.-anXmin-totalSea*anXmin, aBeta+1) - std::pow(anXmin, aBeta+1);
    1324     if(y>ymax) ymax = y;
    1325   }
    1326   G4double y;
    1327   G4double xMax=1.-(totalSea+1.)*anXmin;
    1328   if(anXmin > xMax)
    1329   {
    1330     G4cerr<<"***G4QHadron::SampleX: anXmin="<<anXmin<<" > xMax="<<xMax<<", nSea="<<nSea
    1331           <<", totSea="<<totalSea<<G4endl;
    1332     G4Exception("G4QHadron::SampleX:","72",FatalException,"TooBigXValue");
    1333   }
    1334   do
    1335   {
    1336     x1 = CLHEP::RandFlat::shoot(anXmin, xMax);
    1337     y = std::pow(x1, alpha);
    1338     y*=std::pow(std::pow(1.-x1-totalSea*anXmin,alpha+1) - std::pow(anXmin, alpha+1), nSea);
    1339     y*=std::pow(1.-x1-totalSea*anXmin, aBeta+1) - std::pow(anXmin, aBeta+1); 
    1340     x2 = ymax*G4UniformRand();
    1341   } while(x2>y);
    1342   result = x1;
    1343   return result; 
    1344 } // End of SampleX
    1345 
    1346 
     1303// Fast non-iterative CHIPS algorithm
     1304G4double* G4QHadron::RandomX(G4int nPart)
     1305{
     1306  G4double* x = 0;
     1307  if(nPart<2)
     1308  {
     1309    G4cout<<"-Warning-G4QHadron::RandomX: nPart="<<nPart<<" < 2"<<G4endl;
     1310    return x;
     1311  }
     1312  x = new G4double[nPart];
     1313  G4int nP1=nPart-1;
     1314  x[0]=G4UniformRand();
     1315  for(G4int i=1; i<nP1; ++i)
     1316  {
     1317    G4double r=G4UniformRand();
     1318    G4int j=0;
     1319    for( ; j<i; ++j) if(r < x[j])
     1320    {
     1321      for(G4int k=i; k>j; --k) x[k]=x[k-1];
     1322      x[j]=r;
     1323      break;
     1324    }
     1325    if(j==i) x[i]=r;
     1326  }
     1327  x[nP1]=1.;
     1328  for(G4int i=nP1; i>0; --i) x[i]-=x[i-1];
     1329  return x;
     1330}
     1331
     1332// Non-iterative recursive phase-space CHIPS algorthm
     1333G4double G4QHadron::SampleCHIPSX(G4double anXtot, G4int nSea)
     1334{
     1335  G4double ns=nSea;
     1336  if(nSea<1 || anXtot<=0.) G4cout<<"-Warning-G4QHad::SCX:N="<<nSea<<",tX="<<anXtot<<G4endl;
     1337  if(nSea<2) return anXtot;
     1338  return anXtot*(1.-std::pow(G4UniformRand(),1./ns));
     1339}
     1340
     1341// Get flavors for the valence quarks of this hadron
    13471342void G4QHadron::GetValenceQuarkFlavors(G4QParton* &Parton1, G4QParton* &Parton2)
    13481343{
     
    13511346  G4int bEnd=0;
    13521347  G4int HadronEncoding = GetPDGCode();
    1353   if(!(GetBaryonNumber())) SplitMeson(HadronEncoding,&aEnd,&bEnd);
    1354   else SplitBaryon(HadronEncoding, &aEnd, &bEnd);
     1348  if(!(GetBaryonNumber())) SplitMeson(HadronEncoding, &aEnd, &bEnd);
     1349  else                     SplitBaryon(HadronEncoding, &aEnd, &bEnd);
    13551350
    13561351  Parton1 = new G4QParton(aEnd);
     
    14041399  G4int absPDGcode = std::abs(PDGcode);
    14051400  if (absPDGcode >= 1000) return false;
    1406   if(absPDGcode == 22)
     1401  if(absPDGcode == 22 || absPDGcode == 111) // only u-ubar, d-dbar configurations
    14071402  {
    14081403    G4int it=1;
     
    14101405    *aEnd = it;
    14111406    *bEnd = -it;
     1407  }
     1408  else if(absPDGcode == 130 || absPDGcode == 310) // K0-K0bar mixing
     1409  {
     1410    G4int it=1;
     1411    if(G4UniformRand()<.5) it=-1;
     1412    *aEnd = it;
     1413    if(it>0) *bEnd = -3;
     1414    else     *bEnd =  3;
    14121415  }
    14131416  else
     
    14391442  G4int                  nc=0;
    14401443  G4int            aPDGcode=std::abs(PDGcode);
    1441   if(aPDGcode==2212)                         // ==> Proton
     1444  if(aPDGcode==2212)        // ==> Proton
    14421445  {
    14431446    nc=3;
     
    14461449    qdq[2]=make_pair(2101, 2); prb[2]=r2;    // ud_0, u
    14471450  }
    1448   else if(aPDGcode==2112)                    // ==> Neutron
     1451  else if(aPDGcode==2112)   // ==> Neutron
    14491452  {
    14501453    nc=3;
     
    14531456    qdq[2]=make_pair(1103, 2); prb[2]=r3;    // dd_1, u
    14541457  }
    1455   else if(aPDGcode%10<3)                     // ==> Spin 1/2 Hyperons
    1456   {
    1457     if(aPDGcode==3122)
     1458  else if(aPDGcode%10<3)    // ==> Spin 1/2 Hyperons
     1459  {
     1460    if(aPDGcode==3122)      // Lambda
    14581461    {
    14591462      nc=5;
     
    14641467      qdq[4]=make_pair(3101, 2); prb[4]=r12; // sd_0, u
    14651468    }
    1466     else if(aPDGcode==3222)
     1469    else if(aPDGcode==3222) // Sigma+
    14671470    {
    14681471      nc=3;
    1469       qdq[0]=make_pair(2203, 3); prb[0]=r3;
    1470       qdq[1]=make_pair(3203, 2); prb[1]=r6;
    1471       qdq[2]=make_pair(3201, 2); prb[2]=r2;
    1472     }
    1473     else if(aPDGcode==3212)
     1472      qdq[0]=make_pair(2203, 3); prb[0]=r3;  // uu_1, s
     1473      qdq[1]=make_pair(3203, 2); prb[1]=r6;  // su_1, d
     1474      qdq[2]=make_pair(3201, 2); prb[2]=r2;  // su_0, d
     1475    }
     1476    else if(aPDGcode==3212) // Sigma0
    14741477    {
    14751478      nc=5;
    1476       qdq[0]=make_pair(2103, 3); prb[0]=r3;
    1477       qdq[1]=make_pair(3203, 1); prb[1]=r12;
    1478       qdq[2]=make_pair(3201, 1); prb[2]=r4;
    1479       qdq[3]=make_pair(3103, 2); prb[3]=r12;
    1480       qdq[4]=make_pair(3101, 2); prb[4]=r4;
    1481     }
    1482     else if(aPDGcode==3112)
     1479      qdq[0]=make_pair(2103, 3); prb[0]=r3;  // ud_1, s
     1480      qdq[1]=make_pair(3203, 1); prb[1]=r12; // su_1, d
     1481      qdq[2]=make_pair(3201, 1); prb[2]=r4;  // su_0, d
     1482      qdq[3]=make_pair(3103, 2); prb[3]=r12; // sd_1, u
     1483      qdq[4]=make_pair(3101, 2); prb[4]=r4;  // sd_0, u
     1484    }
     1485    else if(aPDGcode==3112) // Sigma-
    14831486    {
    14841487      nc=3;
    1485       qdq[0]=make_pair(1103, 3); prb[0]=r3;
    1486       qdq[1]=make_pair(3103, 1); prb[1]=r6;
    1487       qdq[2]=make_pair(3101, 1); prb[2]=r2;
    1488     }
    1489     else if(aPDGcode==3312)
     1488      qdq[0]=make_pair(1103, 3); prb[0]=r3;  // dd_1, s
     1489      qdq[1]=make_pair(3103, 1); prb[1]=r6;  // sd_1, d
     1490      qdq[2]=make_pair(3101, 1); prb[2]=r2;  // sd_0, d
     1491    }
     1492    else if(aPDGcode==3312) // Xi-
    14901493    {
    14911494      nc=3;
    1492       qdq[0]=make_pair(3103, 3); prb[0]=r6;
    1493       qdq[1]=make_pair(3101, 3); prb[1]=r2;
    1494       qdq[2]=make_pair(3303, 1); prb[2]=r3;
    1495     }
    1496     else if(aPDGcode==3322)
     1495      qdq[0]=make_pair(3103, 3); prb[0]=r6;  // sd_1, s
     1496      qdq[1]=make_pair(3101, 3); prb[1]=r2;  // sd_0, s
     1497      qdq[2]=make_pair(3303, 1); prb[2]=r3;  // ss_1, d
     1498    }
     1499    else if(aPDGcode==3322) // Xi0
    14971500    {
    14981501      nc=3;
    1499       qdq[0]=make_pair(3203, 3); prb[0]=r6;
    1500       qdq[1]=make_pair(3201, 3); prb[1]=r2;
    1501       qdq[2]=make_pair(3303, 2); prb[2]=r3;
     1502      qdq[0]=make_pair(3203, 3); prb[0]=r6;  // su_1, s
     1503      qdq[1]=make_pair(3201, 3); prb[1]=r2;  // su_0, s
     1504      qdq[2]=make_pair(3303, 2); prb[2]=r3;  // ss_1, u
    15021505    }
    15031506    else return false;
     
    15081511    {
    15091512      nc=1;
    1510       qdq[0]=make_pair(3303, 3); prb[0]=1.;
     1513      qdq[0]=make_pair(3303, 3); prb[0]=1.;  // ss_1, s
    15111514    }
    15121515    else if(aPDGcode==2224)
    15131516    {
    15141517      nc=1;
    1515       qdq[0]=make_pair(2203, 2); prb[0]=1.;
     1518      qdq[0]=make_pair(2203, 2); prb[0]=1.;  // uu_1, s
    15161519    }
    15171520    else if(aPDGcode==2214)
    15181521    {
    15191522      nc=2;
    1520       qdq[0]=make_pair(2203, 1); prb[0]=r3;
    1521       qdq[1]=make_pair(2103, 2); prb[1]=d3;
     1523      qdq[0]=make_pair(2203, 1); prb[0]=r3;  // uu_1, d
     1524      qdq[1]=make_pair(2103, 2); prb[1]=d3;  // ud_1, u
    15221525    }
    15231526    else if(aPDGcode==2114)
    15241527    {
    15251528      nc=2;
    1526       qdq[0]=make_pair(2103, 1); prb[0]=d3;
    1527       qdq[1]=make_pair(2103, 2); prb[1]=r3;
     1529      qdq[0]=make_pair(1103, 2); prb[0]=r3;  // dd_1, u
     1530      qdq[1]=make_pair(2103, 1); prb[1]=d3;  // ud_1, d
    15281531    }
    15291532    else if(aPDGcode==1114)
    15301533    {
    15311534      nc=1;
    1532       qdq[0]=make_pair(1103, 1); prb[0]=1.;
     1535      qdq[0]=make_pair(1103, 1); prb[0]=1.;  // uu_1, s
    15331536    }
    15341537    else if(aPDGcode==3224)
    15351538    {
    15361539      nc=2;
    1537       qdq[0]=make_pair(2203, 3); prb[0]=r3;
    1538       qdq[1]=make_pair(3203, 2); prb[1]=d3;
    1539     }
    1540     else if(aPDGcode==3214)
     1540      qdq[0]=make_pair(2203, 3); prb[0]=r3;  // uu_1, s
     1541      qdq[1]=make_pair(3203, 2); prb[1]=d3;  // su_1, u
     1542    }
     1543    else if(aPDGcode==3214) // @@ SU(3) is broken because of the s-quark mass
    15411544    {
    15421545      nc=3;
    1543       qdq[0]=make_pair(2103, 3); prb[0]=r3;
    1544       qdq[1]=make_pair(3203, 1); prb[1]=r3;
    1545       qdq[2]=make_pair(3103, 2); prb[2]=r3;
     1546      qdq[0]=make_pair(2103, 3); prb[0]=r3;  // ud_1, s
     1547      qdq[1]=make_pair(3203, 1); prb[1]=r3;  // su_1, d
     1548      qdq[2]=make_pair(3103, 2); prb[2]=r3;  // sd_1, u
    15461549    }
    15471550    else if(aPDGcode==3114)
    15481551    {
    15491552      nc=2;
    1550       qdq[0]=make_pair(1103, 3); prb[0]=r3;
    1551       qdq[1]=make_pair(3103, 1); prb[1]=d3;
     1553      qdq[0]=make_pair(1103, 3); prb[0]=r3;  // dd_1, s
     1554      qdq[1]=make_pair(3103, 1); prb[1]=d3;  // sd_1, d
    15521555    }
    15531556    else if(aPDGcode==3324)
    15541557    {
    15551558      nc=2;
    1556       qdq[0]=make_pair(3203, 3); prb[0]=r3;
    1557       qdq[1]=make_pair(3303, 2); prb[1]=d3;
     1559      qdq[0]=make_pair(3203, 3); prb[0]=r3;  // su_1, s
     1560      qdq[1]=make_pair(3303, 2); prb[1]=d3;  // ss_1, u
    15581561    }
    15591562    else if(aPDGcode==3314)
    15601563    {
    15611564      nc=2;
    1562       qdq[0]=make_pair(3103, 3); prb[0]=d3;
    1563       qdq[1]=make_pair(3303, 1); prb[1]=r3;
     1565      qdq[0]=make_pair(3103, 3); prb[0]=d3;  // sd_1, s
     1566      qdq[1]=make_pair(3303, 1); prb[1]=r3;  // ss_1, d
    15641567    }
    15651568    else return false;
     
    15791582      else
    15801583      {
    1581         *diQuark= -qdq[i].first;
    1582         *quark  = -qdq[i].second;
     1584        *diQuark= -qdq[i].second;
     1585        *quark  = -qdq[i].first;
    15831586      }
    15841587      break;
     
    15881591}
    15891592
     1593// This is not usual Gaussian, in fact it is dN/d(pt) ~ pt * exp(-pt^2/pt0^2)
    15901594G4ThreeVector G4QHadron::GaussianPt(G4double widthSquare, G4double maxPtSquare)
    15911595{
     
    15961600  return G4ThreeVector(R*std::cos(phi), R*std::sin(phi), 0.);   
    15971601}
     1602
     1603G4QParton* G4QHadron::GetNextParton()
     1604{
     1605  if(Color.size()==0) return 0;
     1606  G4QParton* result = Color.back();
     1607  Color.pop_back();
     1608  return result;
     1609}
     1610
     1611G4QParton* G4QHadron::GetNextAntiParton()
     1612{
     1613  if(AntiColor.size() == 0) return 0;
     1614  G4QParton* result = AntiColor.front();
     1615  AntiColor.pop_front();
     1616  return result;
     1617}
     1618
     1619// Random Split of the Hadron in 2 Partons (caller is responsible for G4QPartonPair delete)
     1620G4QPartonPair* G4QHadron::SplitInTwoPartons() // If result=0: impossible to split (?)
     1621{
     1622  if(std::abs(GetBaryonNumber())>1) // Not Baryons or Mesons or Anti-Baryons
     1623  {
     1624    G4cerr<<"***G4QHadron::SplitInTwoPartons: Can not split QC="<<valQ<< G4endl;
     1625    G4Exception("G4QFragmentation::ChooseX:","72",FatalException,"NeitherMesonNorBaryon");
     1626  }
     1627  std::pair<G4int,G4int> PP = valQ.MakePartonPair();
     1628  return new G4QPartonPair(new G4QParton(PP.first), new G4QParton(PP.second));
     1629}
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QInteraction.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QInteraction.cc,v 1.3 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QInteraction.cc,v 1.6 2009/08/28 14:49:10 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// ------------------------------------------------------------------
     
    3434//            Created by Mikhail Kossov Oct, 2006
    3535//   class for colliding particles (hadrons) in Parton String Models
    36 //   For comparison mirror member functions are taken from G4 class:
    37 //   G4InteractionContent
     36//   For comparison mirror member function is G4InteractionContent
    3837// ---------------------------------------------------------------------
    3938//  Short description: Classify the interaction in soft/hard/diffractive
     
    4342#include "G4QInteraction.hh"
    4443
    45 G4QInteraction::G4QInteraction(G4QHadron* aProjectile) : theProjectile(aProjectile),
    46   theTarget(0),theNumberOfHard(0),theNumberOfSoft(0),theNumberOfDiffractive(0)
     44G4QInteraction::G4QInteraction(G4QHadron* aProjectile) :
     45  theProjectile(aProjectile), theTarget(0), theNumberOfDINR(0),
     46  theNumberOfHard(0),theNumberOfSoft(0),theNumberOfDiffractive(0)
    4747{}
    4848
    4949G4QInteraction::G4QInteraction(const G4QInteraction &right) :
    5050  theProjectile(right.GetProjectile()), theTarget(right.GetTarget()),
    51   theNumberOfHard(0), theNumberOfSoft(0), theNumberOfDiffractive(0)
     51  theNumberOfDINR(0), theNumberOfHard(0), theNumberOfSoft(0), theNumberOfDiffractive(0)
    5252{}
    5353
    5454G4QInteraction::~G4QInteraction()
    55 {}
    56 
    57 
     55{
     56  //delete theProjectile;
     57  //if(theTarget) delete theTarget;
     58}
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QIsotope.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QIsotope.cc,v 1.11 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QIsotope.cc,v 1.13 2009/08/28 14:49:10 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QIsotope class ----------------
     
    697697    pair<G4int, vector<pair<G4int,G4double>*>* >* nEl= newElems[j];
    698698    G4int nEn=nEl->second->size();
    699     if(nEn) for(G4int k=0; k<nEn; k++)
    700     {
    701       pair<G4int,G4double>* curA=(*(nEl->second))[k];
    702       delete curA;                 // Delete vect<pair(N,Abundancy)*>
    703     }
     699    if(nEn) for(G4int k=0; k<nEn; k++) delete (*(nEl->second))[k]; // Del vect<pair(N,A)*>
     700    delete nEl->second;            // Delete the vector
    704701    delete nEl;                    // Delete vect<IndZ,vect<pair(N,Ab)*>*> newElementVector
    705702    //
    706703    pair<G4int, vector<pair<G4int,G4double>*>* >* nSA= newSumAb[j];
    707704    G4int nSn=nSA->second->size();
    708     if(nSn) for(G4int n=0; n<nSn; n++)
    709     {
    710       pair<G4int,G4double>* curS=(*(nSA->second))[n];
    711       delete curS;                 // Delete vect<pair(N,SumAbund)*>
    712     }
     705    if(nSn) for(G4int n=0; n<nSn; n++) delete (*(nSA->second))[n]; // Del vect<pair(N,S)*>
     706    delete nSA->second;            // Delete the vector
    713707    delete nSA;                    // Delete vect<IndZ,vect<pair(N,SA)*>*> newSumAbunVector
    714708    //
    715709    pair<G4int, vector<pair<G4int,G4double>*>* >* nCS= newIsoCS[j];
    716710    G4int nCn=nCS->second->size();
    717     if(nCn) for(G4int m=0; m<nCn; m++)
    718     {
    719       pair<G4int,G4double>* curC = (*(nCS->second))[m];
    720       delete curC;                 // Delete vect<pair(N,CrossSect)*>
    721     }
     711    if(nCn) for(G4int m=0; m<nCn; m++) delete (*(nCS->second))[m]; // Del vect<pair(N,C)*>
     712    delete nCS->second;            // Delete the vector
    722713    delete nCS;                    // Delete vect<IndZ,vect<pair(N,CS)*>*> newIsoCroSVector
    723714    //
     
    16291620    }
    16301621    pair<G4int,G4double>* abP= new pair<G4int,G4double>(N,abu);
    1631     A->push_back(abP);
     1622    A->push_back(abP); // @@ Valgrind thinks that it is not deleted (?) (Line 703)
    16321623    pair<G4int,G4double>* saP= new pair<G4int,G4double>(N,sumAbu);
    1633     S->push_back(saP);
     1624    S->push_back(saP); // @@ Valgrind thinks that it is not deleted (?) (Line 713)
    16341625    pair<G4int,G4double>* csP= new pair<G4int,G4double>(N,0.);
    1635     C->push_back(csP);
     1626    C->push_back(csP); // @@ Valgrind thinks that it is not deleted (?) (Line 723)
    16361627#ifdef debug
    16371628    G4cout<<"G4QIsotope::InitElement: A & S & C are filled nP="<<C->size()<<G4endl;
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QNucleus.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QNucleus.cc,v 1.96 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QNucleus.cc,v 1.115 2009/11/04 10:52:34 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QNucleus ----------------
     
    4141//#define cldebug
    4242//#define qdebug
     43//#define cldebug
    4344//#define pardeb
    4445//#define ppdebug
     
    5758G4double G4QNucleus::clustProb=4.;      // clusterization probability in dense region
    5859G4double G4QNucleus::mediRatio=1.;      // relative vacuum hadronization probability
    59 G4double G4QNucleus::nucleonDistance=.8*fermi; // Distance between nucleons (0.8 fm)
    60 
    61 G4QNucleus::G4QNucleus(): G4QHadron(),Z(0),N(0),S(0),dZ(0),dN(0),dS(0),maxClust(0),
    62      currentNucleon(-1),rho0(0),radius(0)
    63    //probVect(),theImpactParameter(),theNucleons(), currentNucleon(-1),rho0(),radius(),Tb()
     60G4double G4QNucleus::nucleonDistance=.8*fermi; // Distance between nucleons (0.8 fm) (Body)
     61G4double G4QNucleus::WoodSaxonSurf=.545*fermi; // WoodSaxon Surface Param (0.545 fm) (Body)
     62
     63G4QNucleus::G4QNucleus(): G4QHadron(), Z(0), N(0), S(0), dZ(0), dN(0), dS(0), maxClust(0),
     64                          theNucleons(),currentNucleon(-1),
     65                          rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
    6466{
    65   //Tb = new std::vector<G4double>;
    6667  probVect[0]=mediRatio;
    6768  for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
     
    7273}
    7374
    74 G4QNucleus::G4QNucleus(G4int z, G4int n, G4int s) : G4QHadron(90000000+s*1000000+z*1000+n),
    75   Z(z),N(n),S(s),dZ(0),dN(0),dS(0),maxClust(0),
    76   currentNucleon(-1),rho0(0),radius(0)
    77   //probVect(),theImpactParameter(),theNucleons(), currentNucleon(-1),rho0(),radius(),Tb()
     75G4QNucleus::G4QNucleus(G4int z, G4int n, G4int s) :
     76  G4QHadron(90000000+s*1000000+z*1000+n), Z(z),N(n),S(s), dZ(0),dN(0),dS(0), maxClust(0),
     77  theNucleons(), currentNucleon(-1), rho0(1.), radius(1.),
     78  Tb(), TbActive(false), RhoActive(false)
    7879{
    79   //Tb = new std::vector<G4double>;
    8080  probVect[0]=mediRatio;
    8181  for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
     
    9999  Set4Momentum(p);
    100100  SetNFragments(0);
    101 #ifdef pdebug
     101#ifdef debug
    102102  G4cout<<"G4QNucleus::Constructor:(2) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
    103103        <<", R="<<mediRatio<<G4endl;
     
    105105}
    106106
    107 G4QNucleus::G4QNucleus(G4int nucPDG): G4QHadron(nucPDG),maxClust(0),
    108   currentNucleon(-1),rho0(0),radius(0)
    109   //probVect(),theImpactParameter(),theNucleons(), currentNucleon(-1),rho0(),radius(),Tb()
     107G4QNucleus::G4QNucleus(G4int nucPDG):
     108  G4QHadron(nucPDG), maxClust(0), theNucleons(),
     109  currentNucleon(-1), rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
    110110{
    111   //Tb = new std::vector<G4double>;
    112111  InitByPDG(nucPDG);
     112  G4LorentzVector p(0.,0.,0.,GetGSMass());
     113  Set4Momentum(p);
    113114#ifdef pardeb
    114115  G4cout<<"G4QNucleus::Constructor:(3) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
    115         <<", R="<<mediRatio<<G4endl;
     116        <<", R="<<mediRatio<<", 4M="<<p<<G4endl;
    116117#endif
    117118}
    118119
    119 G4QNucleus::G4QNucleus(G4LorentzVector p, G4int nucPDG): G4QHadron(nucPDG,p),maxClust(0),
    120   currentNucleon(-1),rho0(0),radius(0)
    121   //probVect(),theImpactParameter(),theNucleons(), currentNucleon(-1),rho0(),radius(),Tb()
     120G4QNucleus::G4QNucleus(G4LorentzVector p, G4int nucPDG):
     121  G4QHadron(nucPDG, p), maxClust(0), theNucleons(),
     122  currentNucleon(-1), rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
    122123{
    123   //Tb = new std::vector<G4double>;
    124124  InitByPDG(nucPDG);
    125125  Set4Momentum(p);
    126126#ifdef pardeb
    127127  G4cout<<"G4QNucleus::Constructor:(4) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
    128         <<", R="<<mediRatio<<G4endl;
     128        <<", R="<<mediRatio<<", 4M="<<p<<G4endl;
    129129#endif
    130130}
    131131
    132132G4QNucleus::G4QNucleus(G4int z, G4int n, G4int s, G4LorentzVector p) :
    133   G4QHadron(90000000+s*1000000+z*1000+n,p),Z(z),N(n),S(s),dZ(0),dN(0),dS(0),maxClust(0),
    134   currentNucleon(-1),rho0(0),radius(0)
    135   //  probVect(),theImpactParameter(),theNucleons(),currentNucleon(-1),rho0(),radius(),Tb()
     133  G4QHadron(90000000+s*1000000+z*1000+n,p), Z(z),N(n),S(s), dZ(0),dN(0),dS(0), maxClust(0),
     134  theNucleons(), currentNucleon(-1), rho0(1.),radius(1.),
     135  Tb(), TbActive(false), RhoActive(false)
    136136{
    137   //Tb = new std::vector<G4double>;
    138137  probVect[0]=mediRatio;
    139138  for(G4int i=1; i<256; i++) {probVect[i] = 0.;}
     
    151150}
    152151
    153 G4QNucleus::G4QNucleus(G4QContent nucQC): G4QHadron(nucQC),dZ(0),dN(0),dS(0),maxClust(0),
    154   currentNucleon(-1),rho0(0),radius(0)
    155   //  probVect(),theImpactParameter(),theNucleons(),currentNucleon(-1),rho0(),radius(),Tb()
     152G4QNucleus::G4QNucleus(G4QContent nucQC):
     153  G4QHadron(nucQC), dZ(0), dN(0), dS(0), maxClust(0), theNucleons(), currentNucleon(-1),
     154  rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
    156155{
    157156  static const G4double mPi0 = G4QPDGCode(111).GetMass();
    158   //Tb = new std::vector<G4double>;
    159157#ifdef debug
    160158  G4cout<<"G4QNucleus::Construction By QC="<<nucQC<<G4endl;
     
    200198}
    201199
    202 G4QNucleus::G4QNucleus(G4QContent nucQC, G4LorentzVector p):G4QHadron(nucQC,p),dZ(0),dN(0),
    203   dS(0),maxClust(0),
    204   currentNucleon(-1),rho0(0),radius(0)                     
    205   //probVect(),theImpactParameter(),theNucleons(),currentNucleon(-1),rho0(),radius(),Tb()
     200G4QNucleus::G4QNucleus(G4QContent nucQC, G4LorentzVector p):
     201  G4QHadron(nucQC,p), dZ(0), dN(0), dS(0), maxClust(0), theNucleons(), currentNucleon(-1),
     202  rho0(1.), radius(1.), Tb(), TbActive(false), RhoActive(false)
    206203{
    207   //Tb = new std::vector<G4double>;
    208204#ifdef debug
    209205  G4cout<<"G4QNucleus::(LV)Construction By QC="<<nucQC<<G4endl;
     
    232228}
    233229
    234 //G4QNucleus::G4QNucleus(const G4QNucleus& right) : G4QHadron(&right), currentNucleon(-1)
    235 //{
    236 //  //Tb = new std::vector<G4double>;
    237 //  //G4int lTb=right.GetBThickness()->size();
    238 //  //if(lTb) for(G4int j=0; j<=lTb; j++) Tb->push_back((*right.GetBThickness())[j]);
    239 //  //if(lTb) for(G4int j=0; j<=lTb; j++) Tb.push_back((*right.GetBThickness())[j]);
    240 //  Set4Momentum   (right.Get4Momentum());
    241 //  SetQPDG        (right.GetQPDG());
    242 //  SetQC          (right.GetQC());
    243 //  SetNFragments  (right.GetNFragments());
    244 //  Z             = right.Z;
    245 //  N             = right.N;
    246 //  S             = right.S;
    247 //  dZ            = right.dZ;
    248 //  dN            = right.dN;
    249 //  dS            = right.dS;
    250 //  maxClust      = right.maxClust;
    251 //  for(G4int i=0; i<=maxClust; i++) probVect[i] = right.probVect[i];
    252 //  probVect[254] = right.probVect[254];
    253 //  probVect[255] = right.probVect[255];
    254 //#ifdef pardeb
    255 //  G4cout<<"G4QNucleus::Constructor:(8) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
    256 //        <<", R="<<mediRatio<<G4endl;
    257 //#endif
    258 //}
    259 
    260 G4QNucleus::G4QNucleus(G4QNucleus* right) : currentNucleon(-1)
     230G4QNucleus::G4QNucleus(G4QNucleus* right, G4bool cop3D) : currentNucleon(-1)
    261231{
    262   //Tb = new std::vector<G4double>;
    263   //G4int lTb=right->GetBThickness()->size();
    264   //if(lTb) for(G4int j=0; j<=lTb; j++) Tb->push_back((*right->GetBThickness())[j]);
    265   //if(lTb) for(G4int j=0; j<=lTb; j++) Tb.push_back((*right->GetBThickness())[j]);
    266   Tb = right->Tb;
    267   Set4Momentum   (right->Get4Momentum());
    268   SetQPDG        (right->GetQPDG());
    269   SetQC          (right->GetQC());
    270   SetNFragments  (right->GetNFragments());
    271232  Z             = right->Z;
    272233  N             = right->N;
     
    279240  probVect[254] = right->probVect[254];
    280241  probVect[255] = right->probVect[255];
     242  Tb            = right->Tb;
     243  TbActive      = right->TbActive;
     244  RhoActive     = right->RhoActive;
     245  Set4Momentum   (right->Get4Momentum());
     246  SetQPDG        (right->GetQPDG());
     247  SetQC          (right->GetQC());
     248  SetNFragments  (right->GetNFragments());
     249  rho0        = right->rho0;
     250  radius      = right->radius;
     251  if(cop3D)
     252  {
     253    G4int nn=right->theNucleons.size();
     254    for(G4int i=0; i<nn; ++i)
     255    {
     256      G4QHadron* nucleon = new G4QHadron(right->theNucleons[i]);
     257      theNucleons.push_back(nucleon);
     258    }
     259  }
     260#ifdef pardeb
     261  G4cout<<"G4QNucleus::Constructor:(8) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
     262        <<", R="<<mediRatio<<G4endl;
     263#endif
     264}
     265
     266G4QNucleus::G4QNucleus(const G4QNucleus &right, G4bool cop3D):
     267  G4QHadron(), currentNucleon(-1)
     268{
     269  Z             = right.Z;
     270  N             = right.N;
     271  S             = right.S;
     272  dZ            = right.dZ;
     273  dN            = right.dN;
     274  dS            = right.dS;
     275  maxClust      = right.maxClust;
     276  for(G4int i=0; i<=maxClust; i++) probVect[i] = right.probVect[i];
     277  probVect[254] = right.probVect[254];
     278  probVect[255] = right.probVect[255];
     279  Tb            = right.Tb;
     280  TbActive      = right.TbActive;
     281  RhoActive     = right.RhoActive;
     282  Set4Momentum   (right.Get4Momentum());
     283  SetQPDG        (right.GetQPDG());
     284  SetQC          (right.GetQC());
     285  SetNFragments  (right.GetNFragments());
     286  rho0        = right.rho0;
     287  radius      = right.radius;
     288  if(cop3D)
     289  {
     290    G4int nn=right.theNucleons.size();
     291    for(G4int i=0; i<nn; ++i)
     292    {
     293      G4QHadron* nucleon = new G4QHadron(right.theNucleons[i]);
     294      theNucleons.push_back(nucleon);
     295    }
     296  }
    281297#ifdef pardeb
    282298  G4cout<<"G4QNucleus::Constructor:(9) N="<<freeNuc<<", D="<<freeDib<<", W="<<clustProb
     
    290306  if(this != &right)                          // Beware of self assignment
    291307  {
    292     Tb = right.Tb;
    293     //Tb->clear();
    294     //G4int lTb=right.GetBThickness()->size();
    295     //if(lTb) for(G4int j=0; j<=lTb; j++) Tb->push_back((*right.GetBThickness())[j]);
    296     //if(lTb) for(G4int j=0; j<=lTb; j++) Tb.push_back((*right.GetBThickness())[j]);
     308    currentNucleon= -1;
     309    TbActive      = right.TbActive;
     310    Tb            = right.Tb;
     311    RhoActive     = right.RhoActive;
     312    rho0          = right.rho0;
     313    radius        = right.radius;
     314    G4int nn      = right.theNucleons.size();
     315    for(G4int i=0; i < nn; ++i)
     316    {
     317      G4QHadron* nucleon = new G4QHadron(right.theNucleons[i]);
     318      theNucleons.push_back(nucleon);
     319    }
    297320    Set4Momentum   (right.Get4Momentum());
    298321    SetQPDG        (right.GetQPDG());
     
    315338G4QNucleus::~G4QNucleus()
    316339{
    317   //if(theNucleons.size()) for_each(theNucleons.begin(),theNucleons.end(),DeleteQHadron());
    318   //Tb->clear();
    319   //delete Tb;
    320340  for_each(theNucleons.begin(),theNucleons.end(),DeleteQHadron());
    321341}
     
    410430  dS=0;
    411431  G4int a = Z + N + S;                       // atomic number
    412 #ifdef pdebug
     432#ifdef debug
    413433  G4cout<<"G4QN::UpdateCl:A="<<a<<"(Z="<<Z<<",N="<<N<<",S="<<S<<"),mR="<<mediRatio<<G4endl;
    414434#endif
     
    425445  G4int sA=static_cast<G4int>(surA);
    426446  if(surf>0.||surf<1.)sA=RandomizeBinom(surf,a); // randomize SurfaceNucleons by Binomial
    427 #ifdef pdebug
     447#ifdef debug
    428448  G4cout<<"G4QN::UpdateCl:surf="<<surf<<"= N="<<freeNuc<<"+D="<<freeDib<<",A="<<sA<<G4endl;
    429449#endif
     
    434454    sA=a-2;
    435455  }
    436 #ifdef pdebug
     456#ifdef debug
    437457  G4cout<<"G4QN::UpdtC:dA="<<dA<<",A="<<A<<",s="<<surf<<",S="<<sA<<",C="<<maxClust<<G4endl;
    438458#endif
     
    469489      probVect[255]= 0;                      // a#of dense "dibaryons" (correct)
    470490    }
    471 #ifdef pdebug
     491#ifdef debug
    472492    G4cout<<"G4QNucleus::UpdateClust:Only quasi-free nucleons pV[1]="<<probVect[1]<<G4endl;
    473493#endif
     
    484504    G4double prb=rd+uA;
    485505    sum =prb;
    486 #ifdef pdebug
     506#ifdef debug
    487507   G4cout<<"G4QNucl::UpdateCl:sud="<<sud<<",v[1]=s="<<sum<<",dA="<<dA<<",uA="<<uA<<G4endl;
    488508#endif
     
    498518    prb=rd+pA;
    499519    sum+=prb+prb;
    500 #ifdef pdebug
     520#ifdef debug
    501521    G4cout<<"G4QNucl::UpdateCl:sud="<<sud<<",v[2]="<<prb<<",s="<<sum<<",pA="<<pA<<G4endl;
    502522#endif
     
    522542        rd*=wrd*(idA-i)/i;
    523543        sum+=rd*i;
    524 #ifdef pdebug
     544#ifdef debug
    525545     G4cout<<"G4QNucleus::UpdateCl:sud="<<sud<<", v["<<i<<"]="<<rd<<", s="<<sum<<G4endl;
    526546#endif
     
    539559    dN = dA - dZ;
    540560  }
    541 #ifdef pdebug
     561#ifdef debug
    542562  G4cout<<"G4QNucleus::UpdateClusters: Sum of weighted probabilities s="<<sum<<G4endl;
    543563#endif
     
    546566  // ===================== From here probability randomization starts ===============
    547567  //  G4int rA=a;                              // Residual number of nucleons
    548   //#ifdef pdebug
     568  //#ifdef debug
    549569  //G4cout<<"G4QNuc::UpdateClust:A="<<A<<",M="<<k<<",P1="<<probVect[1]<<",P2="<<probVect[2]
    550570  //      <<G4endl;
     
    556576  //  {
    557577  //    G4double prob=probVect[j]/probSInt[j]; // Probab of the cluster in the dest nucleus
    558   //#ifdef pdebug
     578  //#ifdef debug
    559579  //    G4cout<<"G4QNucl::UpdateClusters: j="<<j<<",sP="<<probVect[j]<<",iP="<<probSInt[j]
    560580  //          <<G4endl;
     
    571591  //      if(j==maxClust) maxClust--;
    572592  //    }
    573   //#ifdef pdebug
     593  //#ifdef debug
    574594  //    G4cout<<"G4QNucl::UpdateClust:p="<<prob<<",r="<<rA<<",m="<<jmax<<",P="<<probVect[j]
    575595  //          <<G4endl;
     
    588608// End of "UpdateClusters"
    589609
     610// Reduce the 3D Nucleus by the used nucleon + update nucleon's energies (in LS!)
     611void G4QNucleus::SubtractNucleon(G4QHadron* uNuc)
     612{//  ============================================
     613  G4int NotFound=true;                              // Not found flag
     614  G4QHadronVector::iterator u;                      // iterator of the used nucleon
     615  for(u=theNucleons.begin(); u!=theNucleons.end(); u++)
     616  {
     617#ifdef debug
     618    G4cout<<"G4QNucleus::SubtractNucleon: LOOP 4M="<<(*u)->Get4Momentum()<<G4endl;
     619#endif
     620    if (uNuc==*u)                                   // Find uNuceon-pointer
     621    {
     622      NotFound=false;
     623      break;
     624    }
     625  }
     626  if(NotFound) throw G4QException("G4QNucleus::SubtractNucleon: The nucleon isn't found");
     627  else
     628  {
     629    G4int tPDG=GetPDGCode();                    // Nucleus PDG before the subtraction
     630    G4LorentzVector t4M=Get4Momentum();         // Nucleus 4-mom before the subtraction
     631#ifdef debug
     632    G4cout<<"G4QNucleus::SubtractNucleon: InitialNucleus 4M="<<t4M<<", PDG="<<tPDG<<", nN="
     633          <<theNucleons.size()<<G4endl;
     634#endif
     635    G4int uPDG=(*u)->GetPDGCode();              // PDG code of the subtracted nucleon
     636    G4LorentzVector u4M=(*u)->Get4Momentum();   // 4-momentum of the subtracted nucleon
     637#ifdef debug
     638    G4cout<<"G4QNucleus::SubtractNucleon: subtractNucleon 4M="<<u4M<<",PDG="<<uPDG<<G4endl;
     639#endif
     640    delete *u;                                  // Delete the nucleon as an object
     641    theNucleons.erase(u);                       // exclude the nucleon pointer from the HV
     642    --currentNucleon;                           // Continue selection from theSame position
     643    t4M-=u4M;                                   // Update the nucleus 4-momentum VALUE
     644    if     (uPDG==2212) tPDG-=1000;             // Reduce the nucleus PDG Code by a proton
     645    else if(uPDG==2112) tPDG--;                 // Reduce the nucleus PDG Code by a neutron
     646    else
     647    {
     648      G4cerr<<"***G4QNucleus::SubtractNucleon: Unexpected Nucleon PDGCode ="<<uPDG<<G4endl;
     649      throw G4QException("G4QNucleus::SubtractNucleon: Impossible nucleon PDG Code");
     650    }
     651#ifdef debug
     652    G4cout<<"G4QNucleus::SubtractNucleon: theResidualNucleus PDG="<<tPDG<<", 4M="<<t4M
     653          <<", nN="<<theNucleons.size()<<G4endl;
     654#endif
     655    InitByPDG(tPDG);                            // Reinitialize the nucleus, not 3D nucleus
     656    theMomentum=t4M;                            // Fill the residual 4-momentum
     657    //#ifdef debug
     658    G4double mR2=sqr(GetGSMass());              // Real squared residual nucleus mass
     659    G4double tM2=t4M.m2();                      // Squared residual nucleus mass from 4M
     660#ifdef debug
     661    G4cout<<"G4QNucleus::SubtractNucleon: rAm2="<<mR2<<" =? 4Mm2="<<tM2<<G4endl;
     662    G4int cnt=0;                                // Counter of nucleons for print
     663#endif
     664    if(std::fabs(mR2-tM2)>.01)G4cout<<"*G4QNucleus::SubNucleon:rM="<<mR2<<"#"<<tM2<<G4endl;
     665    //#endif
     666    G4double tE=t4M.e();                        // Energy of the residual nucleus (in CM!)
     667    G4double m2p=sqr(G4QNucleus(tPDG-1000).GetGSMass()); // subResid. nuclearM2 for protons
     668    G4double m2n=sqr(G4QNucleus(tPDG-1).GetGSMass()); // subResidual nuclearM2 for neutrons
     669    for(u=theNucleons.begin(); u!=theNucleons.end(); u++) // Correct the nucleon's energies
     670    {
     671      G4LorentzVector n4M=(*u)->Get4Momentum(); // 4-mom of the current nucleon
     672      G4double srP2=(t4M-n4M).vect().mag2();    // p2 of the subResNucleus
     673      G4double m2=m2n;                          // default subResNucleusM2 (for neutrons)
     674      if((*u)->GetPDGCode()==2212) m2=m2p;      // change it to subResNucleusM2 for protons
     675      G4double srE=std::sqrt(srP2+m2);          // Energy of the subResNucleus
     676#ifdef debug
     677      G4cout<<"G4QNucleus::SubtractNucleon:#"<<cnt++<<", correctedEnergy="<<tE-srE<<G4endl;
     678#endif
     679      n4M.setE(tE-srE);                         // Update the energy of the nucleon
     680      (*u)->Set4Momentum(n4M);                  // Update the 4-momentum of the nucleon
     681    }
     682  }
     683#ifdef debug
     684  G4cout<<"G4QNucleus::SubtractNucleon:ResNuc4M="<<theMomentum<<",Z="<<Z<<",N="<<N<<G4endl;
     685#endif
     686}
     687
     688// Delete all residual nucleons
     689void G4QNucleus::DeleteNucleons()
     690{//  ============================
     691  G4QHadronVector::iterator u;                      // iterator for the nucleons
     692  for(u=theNucleons.begin(); u!=theNucleons.end(); u++) delete *u;
     693  theMomentum=G4LorentzVector(0.,0.,0.,0.);
     694}
     695
    590696// Reduce nucleus by emitted cluster with PDG Code cPDG
    591697void G4QNucleus::Reduce(G4int cPDG)
     
    606712      //}
    607713      InitByPDG(newPDG);                         // Reinit the Nucleus
    608  }
     714    }
    609715  }
    610716  else if(cPDG!=NUCPDG) G4cerr<<"***G4QN::Reduce:Subtract not nuclear PDGC="<<cPDG<<G4endl;
     
    675781  G4double   totM=Get4Momentum().m();             // Real Mass value of the Nucleus
    676782  G4QContent valQC=GetQCZNS();                    // Quark Content of the Nucleus
    677 #ifdef pdebug
     783#ifdef debug
    678784  G4cout<<"G4QNucleus::SplitBaryon: B="<<baryn<<", M="<<totM<<valQC<<G4endl;
    679785#endif
     
    685791    G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
    686792    G4double sM=resMas+mNeut;
    687 #ifdef pdebug
     793#ifdef debug
    688794    G4cout<<"G4QNucleus::SplitBaryon: (neutron),sM="<<sM<<",d="<<totM-sM<<G4endl;
    689795#endif
     
    699805    G4double sM=resMas+mProt+CB;
    700806    /////////G4double sM=resMas+mProt;
    701 #ifdef pdebug
     807#ifdef debug
    702808    G4cout<<"G4QNucleus::SplitBaryon: (proton),sM="<<sM<<",d="<<totM-sM<<G4endl;
    703809#endif
     
    711817    G4double resMas=G4QPDGCode(resPDG).GetMass(); // GS Mass of the Residual
    712818    G4double sM=resMas+mLamb;
    713 #ifdef pdebug
     819#ifdef debug
    714820    G4cout<<"G4QNucleus::SplitBaryon: (lambda),sM="<<sM<<",d="<<totM-sM<<G4endl;
    715821#endif
     
    725831    G4double sM=resMas+mDeut+CB;
    726832    //G4double sM=resMas+mDeut;
    727 #ifdef pdebug
     833#ifdef debug
    728834    G4cout<<"G4QNucleus::SplitBaryon: (deuteron),sM="<<sM<<",d="<<totM-sM<<G4endl;
    729835#endif
     
    738844    G4double sM=resMas+mAlph;
    739845    if(NQ!=4||PQ!=4) sM+=CB;
    740 #ifdef pdebug
     846#ifdef debug
    741847    G4cout<<"G4QNucleus::SplitBaryon: (alpha),sM="<<sM<<",d="<<totM-sM<<G4endl;
    742848#endif
     
    757863  G4int     baryn=GetA();                        // Baryon Number of the Nucleus
    758864  if(baryn<3) return false;
    759   G4double   totM=Get4Momentum().m();            // Real Mass value of the Nucleus
     865  G4double   totM=theMomentum.m();            // Real Mass value of the Nucleus
    760866  G4QContent valQC=GetQCZNS();                   // Quark Content of the Nucleus
    761 #ifdef pdebug
     867#ifdef debug
    762868  G4cout<<"G4QNucleus::Split2Baryons: B="<<baryn<<", M="<<totM<<valQC<<G4endl;
    763869#endif
     
    769875    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    770876    G4double sM=resMas+mNeut+mNeut;
    771 #ifdef pdebug
     877#ifdef debug
    772878    G4cout<<"G4QNucleus::Split2Baryons: (2 neutrons), sM="<<sM<<", d="<<totM-sM<<G4endl;
    773879#endif
     
    781887    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    782888    G4double sM=resMas+mProt+mProt;
    783 #ifdef pdebug
     889#ifdef debug
    784890    G4cout<<"G4QNucleus::Split2Baryons: (2 protons), sM="<<sM<<", d="<<totM-sM<<G4endl;
    785891#endif
     
    792898    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    793899    G4double sM=resMas+mProt+mNeut;
    794 #ifdef pdebug
     900#ifdef debug
    795901    G4cout<<"G4QNucleus::Split2Baryons:(proton+neutron), sM="<<sM<<", d="<<totM-sM<<G4endl;
    796902#endif
     
    804910    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    805911    G4double sM=resMas+mLamb+mNeut;
    806 #ifdef pdebug
     912#ifdef debug
    807913    G4cout<<"G4QNucleus::Split2Baryons:(lambda+neutron), sM="<<sM<<", d="<<totM-sM<<G4endl;
    808914#endif
     
    815921    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    816922    G4double sM=resMas+mProt+mLamb;
    817 #ifdef pdebug
     923#ifdef debug
    818924    G4cout<<"G4QNucleus::Split2Baryons: (proton+lambda), sM="<<sM<<", d="<<totM-sM<<G4endl;
    819925#endif
     
    826932    G4double resMas=G4QPDGCode(resPDG).GetMass();// GS Mass of the Residual Nucleus
    827933    G4double sM=resMas+mLamb+mLamb;
    828 #ifdef pdebug
     934#ifdef debug
    829935    G4cout<<"G4QNucleus::Split2Baryons: (two lambdas), sM="<<sM<<", d="<<totM-sM<<G4endl;
    830936#endif
     
    893999  //if(a>4.5) evalph=2.7/sqrt(a-4.);                // Probability for alpha to evaporate
    8941000  //G4double evalph=clustProb*clustProb*clustProb;
    895 #ifdef pdebug
     1001#ifdef debug
    8961002  G4cout<<"G4QNucleus::EvaporBaryon: *Called*, a="<<a<<GetThis()<<",alph="<<evalph<<G4endl;
    8971003#endif
     
    9221028  G4LorentzVector h3mom;
    9231029  G4double totMass= GetMass();                    // Total mass of the Nucleus
    924   //if(totMass-GetGSMass()>100.)throw G4QException("****Big Mass");
    925 #ifdef pdebug
     1030#ifdef debug
    9261031  G4cout<<"G4QN::EB:pB="<<PBarr<<",aB="<<ABarr<<",ppB="<<PPBarr<<",paB="<<PABarr<<G4endl;
    9271032#endif
     
    9901095      if(totMass<=mNP)
    9911096      {
    992 #ifdef pdebug
     1097#ifdef debug
    9931098        G4cout<<"G4QNucl::EvaporateBaryon: Photon ### d+g ###, dM="<<totMass-mNP<<G4endl;
    9941099#endif
     
    11141219    G4double eMass  = 0.;          // Prototype of mass of Evaporated Baryon
    11151220    G4double fMass  = 0.;          // Prototype of mass of the Second Baryon
    1116 #ifdef pdebug
     1221#ifdef debug
    11171222    G4cout<<"G4QNuc::EvaB:a>2, totM="<<totMass<<" > GSMass="<<GSMass<<",d="<<totMass-GSMass
    11181223          <<G4endl;
     
    11401245        pBnd=mProt-GSMass+GSResNp;             // Binding energy for proton
    11411246        G4double eMax=sqrt(mP2+pp2m);
    1142 #ifdef pdebug
     1247#ifdef debug
    11431248        G4cout<<"G4QNuc::EvapBaryon:pm="<<eMax+sqrt(pp2m+GSResNp*GSResNp)<<" = M="<<totMass
    11441249              <<", sm="<<GSResNp+mProt+PBarr<<",pp2="<<pp2m<<",pB="<<pBnd<<G4endl;
     
    11511256        ppQPDG=G4QPDGCode(90000000+1000*(1000*S+Z-2)+N);
    11521257        GSResPP=ppQPDG.GetMass();
    1153 #ifdef pdebug
     1258#ifdef debug
    11541259        G4double sm=GSResPP+mProt+mProt+SPPBarr;
    11551260        G4cout<<"G4QNucl::EvapBaryon: ppM="<<GSResPP<<",T="<<sm-GSMass<<",E="<<totMass-sm
     
    11651270            paQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-3)+N-2);
    11661271            GSResPA=paQPDG.GetMass();
    1167 #ifdef pdebug
     1272#ifdef debug
    11681273            G4double s=GSResPA+mAlph+mProt+SAPBarr;
    11691274            G4cout<<"G4QN::EB:paM="<<GSResPA<<",T="<<s-GSMass<<",E="<<totMass-s<<G4endl;
     
    12441349            aaQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-4)+N-4);
    12451350            GSResAA=aaQPDG.GetMass();
    1246 #ifdef pdebug
     1351#ifdef debug
    12471352            G4double s=GSResAA+mAlph+mAlph+SAABarr;
    12481353            G4cout<<"G4QNucl::EvapBaryon: a="<<GSResNP<<",T="<<s-GSMass<<",E="<<totMass-s
     
    12551360            naQPDG =G4QPDGCode(90000000+1000*(1000*S+Z-2)+N-3);
    12561361            GSResNA=naQPDG.GetMass();
    1257 #ifdef pdebug
     1362#ifdef debug
    12581363            G4double s=GSResNA+mAlph+mNeut;
    12591364            G4cout<<"G4QNucl::EvapBary: M="<<GSResNA<<",T="<<s-GSMass<<",E="<<totMass-s
     
    12781383            aBnd=mAlph-GSMass+GSResNa;           // Binding energy for ALPHA
    12791384            G4double eMax=sqrt(mA2+ap2m);
    1280 #ifdef pdebug
     1385#ifdef debug
    12811386            G4cout<<"G4QNuc::EvapBar:m="<<eMax+sqrt(ap2m+GSResNa*GSResNa)<<" = M="<<totMass
    12821387                  <<", sm="<<GSResNp+mProt+PBarr<<",pp2="<<pp2m<<",pB="<<pBnd<<G4endl;
     
    12931398          npQPDG=G4QPDGCode(90000000+1000*(1000*S+Z-1)+N-1);
    12941399          GSResNP=npQPDG.GetMass();
    1295 #ifdef pdebug
     1400#ifdef debug
    12961401          G4double s=GSResNP+mNeut+mProt;
    12971402          G4cout<<"G4QNucl::EvapBaryon: npM="<<GSResNP<<",T="<<s-GSMass<<",E="<<totMass-s
     
    13341439      NQPDG=G4QPDGCode(90000000+1000*(1000*S+Z)+N-1);
    13351440      GSResNn=NQPDG.GetMass();
    1336 #ifdef pdebug
     1441#ifdef debug
    13371442      G4cout<<"G4QNucleus::EvapBaryon: M(A-N)="<<GSResNn<<",Z="<<Z
    13381443            <<",N="<<N<<",S="<<S<<G4endl;
     
    13461451        nBnd=mNeut-GSMass+GSResNn;    // Binding energy for neutron
    13471452        G4double eMax=sqrt(mN2+np2m);
    1348 #ifdef pdebug
     1453#ifdef debug
    13491454        G4cout<<"G4QNuc::EvapBaryon:nm="<<eMax+sqrt(np2m+GSResNn*GSResNn)<<" = M="<<totMass
    13501455              <<", sm="<<GSResNn+mNeut<<",np2="<<np2m<<",nB="<<nBnd<<G4endl;
     
    13971502        lBnd=mLamb-GSMass+GSResNl;    // Binding energy for lambda
    13981503        G4double eMax=sqrt(mL2+lp2m);
    1399 #ifdef pdebug
     1504#ifdef debug
    14001505        G4cout<<"G4QNuc::EvapBaryon:lm="<<eMax+sqrt(lp2m+GSResNl*GSResNl)<<" = M="<<totMass
    14011506              <<", sm="<<GSResNl+mLamb<<",lp2="<<lp2m<<",lB="<<lBnd<<G4endl;
     
    14261531    G4bool secB  = nSecF||pSecF||lSecF||aSecF; // Possibili to decay in TwoBaryons (Alphas)
    14271532    //G4bool thdB  = nTrF||pTrF||lTrF||aTrF||naaF||paaF||laaF||aaaF;// Pos to radiate three
    1428 #ifdef pdebug
     1533#ifdef debug
    14291534    G4cout<<"G4QNucl::EvapBary:n="<<nSecF<<",p="<<pSecF<<",l="<<lSecF<<",a="<<aSecF<<",nn="
    14301535          <<nnFlag<<", np="<<npFlag<<",pp="<<ppFlag<<",pa="<<paFlag<<",na="<<naFlag<<",aa="
     
    14401545      if(!lSecF) lFlag=false;
    14411546      if(!aSecF) aFlag=false;
    1442 #ifdef pdebug
     1547#ifdef debug
    14431548      G4cout<<"G4QNuc::EB:nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
    14441549#endif
     
    14911596          good=false;
    14921597        }
    1493 #ifdef pdebug
     1598#ifdef debug
    14941599        G4cout<<"G4QNuc::EvapBary:iE="<<minE<<",aE="<<maxE<<",mi="<<mi<<",mm="<<mm<<",ma="
    14951600              <<ma<<G4endl;
     
    15101615        xMi=sqrt(xMi);                          // @@ ?
    15111616        xMa=sqrt(xMa);                          // @@ ?
    1512 #ifdef pdebug
     1617#ifdef debug
    15131618        G4cout<<"G4QNuc:EvapBaryon:mi="<<mi<<",ma="<<ma<<", xi="<<xMi<<",xa="<<xMa<<G4endl;
    15141619#endif
    15151620        G4double powr=1.5*a1;                   // Power for low & up limits
    15161621        G4double revP=1./powr;                  // Reversed power for randomization
    1517 #ifdef pdebug
     1622#ifdef debug
    15181623        G4cout<<"G4QNucleus::EvaporateBaryon: Power="<<powr<<",RevPower="<<revP<<G4endl;
    15191624#endif
    15201625        G4double minR=pow(1.-xMa*xMa,powr);    // Look on @@ ? (up)
    15211626        G4double maxR=pow(1.-xMi*xMi,powr);
    1522 #ifdef pdebug
     1627#ifdef debug
    15231628        G4cout<<"G4QNucleus::EvaporateBaryon: miR="<<minR<<", maR="<<maxR<<G4endl;
    15241629#endif
     
    15341639          if(x<xMi||x>xMa)
    15351640          {
    1536 #ifdef pdebug
     1641#ifdef debug
    15371642            G4cerr<<"**G4QNucl::EvapB:R="<<R<<",xi="<<xMi<<" < "<<x<<" < xa="<<xMa<<G4endl;
    15381643#endif
     
    15481653            G4double psum =0.;
    15491654            G4double zCBPP=0.;                         // Probabylity for a proton
    1550 #ifdef pdebug
     1655#ifdef debug
    15511656            G4cout<<"G4QNuc::EvapB:t="<<tk<<",pM="<<pMin<<",pB="<<pBnd<<",n="<<nMin<<",a="
    15521657                  <<aMin<<G4endl;
     
    15561661              G4double kin=tk-pBnd;
    15571662              //if(barf) kin-=PBarr; //@@ This is a mistake
    1558 #ifdef pdebug
     1663#ifdef debug
    15591664              G4cout<<"G4QN::EB:Proton="<<kin<<",CB="<<PBarr<<",B="<<pBnd<<",M="<<pMin
    15601665                    <<",p="<<CoulBarPenProb(PBarr,kin,1,1)<<G4endl;
     
    15671672            {
    15681673              G4double kin=tk-nBnd;
    1569 #ifdef pdebug
     1674#ifdef debug
    15701675              G4cout<<"G4QN::EB:Neutron="<<kin<<",p="<<CoulBarPenProb(0.,kin,0,1)<<G4endl;
    15711676#endif
     
    15781683            {
    15791684              G4double kin=tk-lBnd;
    1580 #ifdef pdebug
     1685#ifdef debug
    15811686              G4cout<<"G4QN::EB:Lambda="<<kin<<",p="<<CoulBarPenProb(0,kin,0,1)<<G4endl;
    15821687#endif
     
    15891694              G4double kin=tk-aBnd;
    15901695              //if(barf) kin-=ABarr; //@@ This is a mistake
    1591 #ifdef pdebug
     1696#ifdef debug
    15921697              G4cout<<"G4QN::EB:Alpha="<<kin<<",CB="<<ABarr<<",p="
    15931698                    <<CoulBarPenProb(ABarr,kin,2,4)<<G4endl;
     
    15971702            }
    15981703            G4double r = psum*G4UniformRand();
    1599 #ifdef pdebug
     1704#ifdef debug
    16001705            G4cout<<"G4QNuc::EvapB:"<<r<<",p="<<zCBPP<<",pn="<<nCBPP<<",pnl="<<lCBPP<<",t="
    16011706                  <<psum<<G4endl;
     
    16041709            if     (r&&r>lCBPP)
    16051710            {
    1606 #ifdef pdebug
     1711#ifdef debug
    16071712              G4cout<<"G4QNuc::EvaB:ALPHA is selected for evap, r="<<r<<">"<<lCBPP<<G4endl;
    16081713#endif
     
    16111716            else if(r&&r>nCBPP&&r<=lCBPP)
    16121717            {
    1613 #ifdef pdebug
     1718#ifdef debug
    16141719              G4cout<<"G4QNuc::EvaB:LAMBDA is selected for evap,r="<<r<<"<"<<lCBPP<<G4endl;
    16151720#endif
     
    16181723            else if(r&&r>zCBPP&&r<=nCBPP)
    16191724            {
    1620 #ifdef pdebug
     1725#ifdef debug
    16211726              G4cout<<"G4QNuc::EvaBar: N is selected for evapor,r="<<r<<"<"<<nCBPP<<G4endl;
    16221727#endif
     
    16251730            else if(r&&r<=zCBPP)
    16261731            {
    1627 #ifdef pdebug
     1732#ifdef debug
    16281733              G4cout<<"G4QNuc::EvaBar: P is selected for evapor,r="<<r<<"<"<<zCBPP<<G4endl;
    16291734#endif
     
    16321737            else cond=true;
    16331738          }
    1634 #ifdef pdebug
     1739#ifdef debug
    16351740          G4cout<<"G4QNuc::EvapBar:c="<<cond<<",x="<<x<<",cnt="<<cntr<<",R="<<R<<",ma="<<ma
    16361741                <<",rn="<<rn<<"<r="<<x/xMa<<",tk="<<tk<<",ni="<<nMin<<",pi="<<pMin<<G4endl;
     
    16711776            tk-=nBnd-mNeut;                 // Pays for binding and convert to total energy
    16721777            p2=tk*tk-mN2;
    1673 #ifdef pdebug
     1778#ifdef debug
    16741779            G4cout<<"G4QNucleus::EvaporateBaryon:np2="<<p2<<",np2m="<<np2m<<G4endl;
    16751780#endif
     
    16981803          else G4cerr<<"***G4QNucleus::EvaporateBaryon: PDG="<<PDG<<G4endl;
    16991804          G4double rEn=totMass-tk;
    1700           rMass=sqrt(rEn*rEn-p2);                  // Mass of Residual Nucleus
     1805          G4double rEn2=rEn*rEn;
     1806          if (rEn2 > p2) rMass=sqrt(rEn2-p2);      // Mass of the Residual Nucleus
     1807          else           rMass=0.0;
    17011808          // Find out if the ResidualNucleus is below of the SecondBaryonDecayLimit
    17021809          //@@ Calculate it depending on PDG !!!!!!!
     
    17251832          G4bool aaCond = !aaFlag || (aaFlag && GSResAA+mAlph+AABarr > rMass);
    17261833          if(barf) aaCond = !aaFlag || (aaFlag && GSResAA+mAlph+SAABarr > rMass);
    1727 #ifdef pdebug
     1834#ifdef debug
    17281835          G4cout<<"G4QNucl::EvaB:"<<PDG<<", E="<<tk<<", rM="<<rMass<<", ";
    17291836          if(PDG==pPDG)      G4cout<<"PN="<<GSResNP+mNeut<<"("<<pnCond<<"),PP="
     
    17501857          if(PDG==pPDG&&(pnCond&&ppCond&&plCond&&paCond))//p+RN decay, p+b+RN dec is closed
    17511858          {
    1752 #ifdef pdebug
     1859#ifdef debug
    17531860            G4cout<<"G4QN::EB:*p*: n="<<pnCond<<",p="<<ppCond<<",l="<<plCond<<",a="<<paCond
    17541861                  <<G4endl;
     
    17831890            }
    17841891            G4double r = aLim*G4UniformRand();
    1785 #ifdef pdebug
     1892#ifdef debug
    17861893            G4cout<<"G4QNuc::EvaB:p, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="
    17871894                  <<aLim<<G4endl;
     
    17951902              rMass = GSResPA;
    17961903              rQPDG = paQPDG;
    1797 #ifdef pdebug
     1904#ifdef debug
    17981905              G4cout<<"G4QNucleus::EvaporateBary: P+A"<<G4endl;
    17991906#endif
     
    18051912              rMass = GSResPL;
    18061913              rQPDG = plQPDG;
    1807 #ifdef pdebug
     1914#ifdef debug
    18081915              G4cout<<"G4QNucleus::EvaporateBary: P+L"<<G4endl;
    18091916#endif
     
    18151922              rMass = GSResPP;
    18161923              rQPDG = ppQPDG;
    1817 #ifdef pdebug
     1924#ifdef debug
    18181925              G4cout<<"G4QNucleus::EvaporateBary: P+P"<<G4endl;
    18191926#endif
     
    18251932              rMass = GSResNP;
    18261933              rQPDG = npQPDG;
    1827 #ifdef pdebug
     1934#ifdef debug
    18281935              G4cout<<"G4QNucleus::EvaporateBary: P+N"<<G4endl;
    18291936#endif
     
    18331940          else if(PDG==nPDG&&(nnCond&&npCond&&nlCond&&naCond)) // n+b+RN decay can't happen
    18341941          { //@@ Take into account Coulomb Barier Penetration Probability
    1835 #ifdef pdebug
     1942#ifdef debug
    18361943            G4cout<<"G4QN::EB:*n*: n="<<nnCond<<",p="<<npCond<<",l="<<nlCond<<",a="<<naCond
    18371944                  <<G4endl;
     
    18601967            }
    18611968            G4double r = aLim*G4UniformRand();
    1862 #ifdef pdebug
     1969#ifdef debug
    18631970            G4cout<<"G4QN::EB:n, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
    18641971                  <<G4endl;
     
    18721979              rMass = GSResNA;
    18731980              rQPDG = naQPDG;
    1874 #ifdef pdebug
     1981#ifdef debug
    18751982              G4cout<<"G4QNucleus::EvaporateBary: N+A"<<G4endl;
    18761983#endif
     
    18821989              rMass = GSResNL;
    18831990              rQPDG = nlQPDG;
    1884 #ifdef pdebug
     1991#ifdef debug
    18851992              G4cout<<"G4QNucleus::EvaporateBary: N+L"<<G4endl;
    18861993#endif
     
    18921999              rMass = GSResNP;
    18932000              rQPDG = npQPDG;
    1894 #ifdef pdebug
     2001#ifdef debug
    18952002              G4cout<<"G4QNucleus::EvaporateBary: N+P"<<G4endl;
    18962003#endif
     
    19022009              rMass = GSResNN;
    19032010              rQPDG = nnQPDG;
    1904 #ifdef pdebug
     2011#ifdef debug
    19052012              G4cout<<"G4QNucleus::EvaporateBary: N+N"<<G4endl;
    19062013#endif
     
    19372044            }
    19382045            G4double r = aLim*G4UniformRand();
    1939 #ifdef pdebug
     2046#ifdef debug
    19402047            G4cout<<"G4QN::EB:l, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
    19412048                  <<G4endl;
     
    19492056              rMass = GSResLA;
    19502057              rQPDG = laQPDG;
    1951 #ifdef pdebug
     2058#ifdef debug
    19522059              G4cout<<"G4QNucleus::EvaporateBary: L+A"<<G4endl;
    19532060#endif
     
    19592066              rMass = GSResLL;
    19602067              rQPDG = llQPDG;
    1961 #ifdef pdebug
     2068#ifdef debug
    19622069              G4cout<<"G4QNucleus::EvaporateBary: L+L"<<G4endl;
    19632070#endif
     
    19692076              rMass = GSResPL;
    19702077              rQPDG = plQPDG;
    1971 #ifdef pdebug
     2078#ifdef debug
    19722079              G4cout<<"G4QNucleus::EvaporateBary: L+P"<<G4endl;
    19732080#endif
     
    19792086              rMass = GSResNL;
    19802087              rQPDG = nlQPDG;
    1981 #ifdef pdebug
     2088#ifdef debug
    19822089              G4cout<<"G4QNucleus::EvaporateBary: L+N"<<G4endl;
    19832090#endif
     
    19872094          else if(PDG==aPDG&&(anCond&&apCond&&alCond&&aaCond)) // a+b+RN decay can't happen
    19882095          { //@@ Take into account Coulomb Barier Penetration Probability
    1989 #ifdef pdebug
     2096#ifdef debug
    19902097            G4cout<<"G4QN::EB:*a*: n="<<anCond<<",p="<<apCond<<",l="<<alCond<<",a="<<aaCond
    19912098                  <<G4endl;
     
    20202127            }
    20212128            G4double r = aLim*G4UniformRand();
    2022 #ifdef pdebug
     2129#ifdef debug
    20232130            G4cout<<"G4QN::EB:a, r="<<r<<",n="<<nLim<<",z="<<zLim<<",s="<<sLim<<",a="<<aLim
    20242131                  <<G4endl;
     
    20322139              rMass = GSResAA;
    20332140              rQPDG = aaQPDG;
    2034 #ifdef pdebug
     2141#ifdef debug
    20352142              G4cout<<"G4QNucleus::EvaporateBary: A+A"<<G4endl;
    20362143#endif
     
    20422149              rMass = GSResLA;
    20432150              rQPDG = laQPDG;
    2044 #ifdef pdebug
     2151#ifdef debug
    20452152              G4cout<<"G4QNucleus::EvaporateBary: A+L"<<G4endl;
    20462153#endif
     
    20522159              rMass = GSResPA;
    20532160              rQPDG = paQPDG;
    2054 #ifdef pdebug
     2161#ifdef debug
    20552162              G4cout<<"G4QNucleus::EvaporateBary: A+P"<<G4endl;
    20562163#endif
     
    20622169              rMass = GSResNA;
    20632170              rQPDG = naQPDG;
    2064 #ifdef pdebug
     2171#ifdef debug
    20652172              G4cout<<"G4QNucleus::EvaporateBary: A+N"<<G4endl;
    20662173#endif
     
    20752182            else if(rQPDG==lQPDG)rMass=mLamb;
    20762183          }
    2077 #ifdef pdebug
     2184#ifdef debug
    20782185          G4cout<<"G4QNucleus::EvaporateBary:evaBar="<<eMass<<bQPDG<<",resN="<<rMass<<rQPDG
    20792186                <<",secB="<<fMass<<",three="<<three<<G4endl;
     
    21112218        }
    21122219        G4double r = aLim*G4UniformRand();
    2113 #ifdef pdebug
     2220#ifdef debug
    21142221        G4cout<<"G4QNucl::EvapBar:2Decay r="<<r<<",nLim="<<nLim<<",zLim="<<zLim<<",sLim="
    21152222              <<sLim<<",nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
     
    21452252        else
    21462253        {
    2147 #ifdef pdebug
     2254#ifdef debug
    21482255          G4cout<<"G4QNucleus::EvaporateBaryon: Photon #2-B#, dM="<<totMass-GSMass<<G4endl;
    21492256#endif
     
    21532260          rMass=GSMass;
    21542261        }
    2155 #ifdef pdebug
     2262#ifdef debug
    21562263        G4cout<<"G4QNucl::EvaporateBaryon: b="<<eMass<<bQPDG<<",r="<<rMass<<rQPDG<<G4endl;
    21572264#endif
     
    21592266      if(three)           // Decay in two baryons + Residual Nucleus
    21602267      {
    2161 #ifdef pdebug
     2268#ifdef debug
    21622269          G4cout<<"G4QNucl::EvaporateBaryon:Decay in 3 particles"<<G4endl;
    21632270#endif
     
    21802287        if(eMass+rMass<totMass&&cntr<cntm)
    21812288        {
    2182 #ifdef pdebug
     2289#ifdef debug
    21832290          G4cout<<"G4QN::EvaB:eM="<<eMass<<"+rM="<<rMass<<" ="<<eMass+rMass<<" < "<<totMass
    21842291                <<",c="<<cntr<<" < cm="<<cntm<<", bPDG="<<bQPDG<<", rPDG="<<rQPDG<<G4endl;
     
    21952302        else if(totMass>mNeut+GSResNn)               // Neutron if 2-Decay failed
    21962303        {
    2197 #ifdef pdebug
     2304#ifdef debug
    21982305          G4cout<<"G4QNucl::EvaporateBaryon: Neutron , dM="<<totMass-GSResNn-mNeut<<G4endl;
    21992306#endif
     
    22052312        else if(totMass>mProt+PBarr+GSResNp)               // Proton if 2-Decay failed
    22062313        {
    2207 #ifdef pdebug
     2314#ifdef debug
    22082315          G4cout<<"G4QNucl::EvaporateBaryon: Proton , dM="<<totMass-GSResNp-mProt<<G4endl;
    22092316#endif
     
    22152322        else if(totMass>mAlph+ABarr+GSResNa)               // Alpha if 2-Decay failed
    22162323        {
    2217 #ifdef pdebug
     2324#ifdef debug
    22182325          G4cout<<"G4QNucl::EvaporateBaryon: Alpha , dM="<<totMass-GSResNa-mAlph<<G4endl;
    22192326#endif
     
    22252332        else if(totMass>GSMass)               // Photon if 2-Decay failed
    22262333        {
    2227 #ifdef pdebug
     2334#ifdef debug
    22282335          G4cout<<"G4QNucl::EvaporateBaryon:Photon ### 2 ###, dM="<<totMass-GSMass<<G4endl;
    22292336#endif
     
    22452352      //if(2>3)
    22462353      {
    2247 #ifdef pdebug
     2354#ifdef debug
    22482355        G4cout<<"G4QNucleus::EvaporateBaryon: Decay in 2 baryons"<<G4endl;
    22492356#endif
     
    23132420          rQPDG=aaQPDG;
    23142421          rMass=GSResAA;
    2315 #ifdef pdebug
     2422#ifdef debug
    23162423          G4cout<<"G4QNuc::EvapBaryon: A+A, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23172424#endif
     
    23242431          rQPDG=laQPDG;
    23252432          rMass=GSResLA;
    2326 #ifdef pdebug
     2433#ifdef debug
    23272434          G4cout<<"G4QNuc::EvapBaryon: A+L, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23282435#endif
     
    23352442          rQPDG=paQPDG;
    23362443          rMass=GSResPA;
    2337 #ifdef pdebug
     2444#ifdef debug
    23382445          G4cout<<"G4QNuc::EvapBaryon: A+P, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23392446#endif
     
    23462453          rQPDG=naQPDG;
    23472454          rMass=GSResNA;
    2348 #ifdef pdebug
     2455#ifdef debug
    23492456          G4cout<<"G4QNuc::EvapBaryon: A+N, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23502457#endif
     
    23572464          rQPDG=llQPDG;
    23582465          rMass=GSResLL;
    2359 #ifdef pdebug
     2466#ifdef debug
    23602467          G4cout<<"G4QNuc::EvapBaryon: L+L, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23612468#endif
     
    23682475          rQPDG=plQPDG;
    23692476          rMass=GSResPL;
    2370 #ifdef pdebug
     2477#ifdef debug
    23712478          G4cout<<"G4QNuc::EvapBaryon: L+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23722479#endif
     
    23792486          rQPDG=nlQPDG;
    23802487          rMass=GSResNL;
    2381 #ifdef pdebug
     2488#ifdef debug
    23822489          G4cout<<"G4QNuc::EvapBaryon: L+n, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23832490#endif
     
    23912498          rQPDG=ppQPDG;
    23922499          rMass=GSResPP;
    2393 #ifdef pdebug
     2500#ifdef debug
    23942501          G4cout<<"G4QNuc::EvapBaryon: p+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    23952502#endif
     
    24022509          rQPDG=npQPDG;
    24032510          rMass=GSResNP;
    2404 #ifdef pdebug
     2511#ifdef debug
    24052512          G4cout<<"G4QNuc::EvapBaryon: n+p, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    24062513#endif
     
    24132520          rQPDG=nnQPDG;
    24142521          rMass=GSResNN;
    2415 #ifdef pdebug
     2522#ifdef debug
    24162523          G4cout<<"G4QNuc::EvapBaryon: n+n, e="<<eMass<<",f="<<fMass<<",r="<<rMass<<G4endl;
    24172524#endif
     
    24202527        else if(nFlag)
    24212528        {
    2422 #ifdef pdebug
     2529#ifdef debug
    24232530          G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in neutron ###"<<G4endl;
    24242531#endif
     
    24312538        else if(pFlag)
    24322539        {
    2433 #ifdef pdebug
     2540#ifdef debug
    24342541          G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in proton ###"<<G4endl;
    24352542#endif
     
    24422549        else if(aFlag)
    24432550        {
    2444 #ifdef pdebug
     2551#ifdef debug
    24452552          G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in alpha ###"<<G4endl;
    24462553#endif
     
    24532560        else if(lFlag)
    24542561        {
    2455 #ifdef pdebug
     2562#ifdef debug
    24562563          G4cout<<"G4QNucleus::EvaporateBaryon:Photon ### Decay in Lambda ###"<<G4endl;
    24572564#endif
     
    24642571        else
    24652572        {
    2466 #ifdef pdebug
     2573#ifdef debug
    24672574          G4cout<<"G4QNuc::EvaporBaryon: Photon ### 3-Big ###,dM="<<totMass-GSMass<<G4endl;
    24682575#endif
     
    24802587          if(!DecayIn3(h1mom,h2mom,h3mom))
    24812588          {
    2482 #ifdef pdebug
     2589#ifdef debug
    24832590            G4cout<<"*G4QNucl::EvaporateBaryon:Decay M="<<totMass<<",b="<<eMass<<bQPDG
    24842591            <<",f="<<fMass<<fQPDG<<",r="<<rMass<<rQPDG<<G4endl;
     
    24882595          h1mom+=h3mom;
    24892596          bQPDG=dbQPDG;
    2490 #ifdef pdebug
     2597#ifdef debug
    24912598          G4double sma=h1mom.m();
    24922599          G4double dma=sma-eMass-fMass;
     
    25072614          if(!DecayIn2(h1mom,h2mom))
    25082615          {
    2509 #ifdef pdebug
     2616#ifdef debug
    25102617            G4cout<<"***G4QNucleus::EvaporateBaryon: Emergency Decay M="<<totMass<<",b="
    25112618                  <<bQPDG<<h1->GetQC()<<eMass<<",r="<<rQPDG<<h2->GetQC()<<rMass<<G4endl;
     
    25172624          h1->Set4Momentum(h1mom);
    25182625          h2->Set4Momentum(h2mom);
    2519 #ifdef pdebug
     2626#ifdef debug
    25202627          G4cout<<"G4QNuc::EvapBaryon: Emergency decay is done for b="<<bQPDG<<h1->GetQC()
    25212628                <<h1mom<<h1mom.m()<<", r="<<rQPDG<<h2->GetQC()<<h2mom<<h2mom.m()<<G4endl;
     
    25262633      else                                     // Only decay in Baryon+Residual is possible
    25272634      {
    2528 #ifdef pdebug
     2635#ifdef debug
    25292636        G4cout<<"G4QNucleus::EvaporateBaryon: Decay in Baryon+Resid"<<G4endl;
    25302637#endif
     
    25562663          aLim+=CoulBarPenProb(ABarr,ken,2,4)*sqrt(ken)*evalph*Z*(Z-1)*N*(N-1)
    25572664                *6/a1/(a-2)/(a-3);
    2558 #ifdef pdebug
     2665#ifdef debug
    25592666          G4cout<<"G4QNucleus::EvaporateBaryon:al="<<evalph<<",k="<<ken<<",P="
    25602667                <<CoulBarPenProb(ABarr,ken,2,4)<<G4endl;
     
    25622669        }
    25632670        G4double r = aLim*G4UniformRand();
    2564 #ifdef pdebug
     2671#ifdef debug
    25652672        G4cout<<"G4QN::EB:DecIn2#2#r="<<r<<",nL="<<nLim<<",zL="<<zLim<<",sL="<<sLim<<",aL="
    25662673              <<aLim<<",nF="<<nFlag<<",pF="<<pFlag<<",lF="<<lFlag<<",aF="<<aFlag<<G4endl;
     
    25722679          rQPDG=AQPDG;
    25732680          rMass=GSResNa;
    2574 #ifdef pdebug
     2681#ifdef debug
    25752682          G4cout<<"G4QNucleus::EvaporateBaryon: Decay in A + rA="<<GSResNa+mAlph<<G4endl;
    25762683#endif
     
    25922699          rQPDG=PQPDG;
    25932700          rMass=GSResNp;
    2594 #ifdef pdebug
     2701#ifdef debug
    25952702          G4cout<<"G4QNucleus::EvaporateBaryon: Decay in P + rA="<<GSResNp+mProt<<G4endl;
    25962703#endif
     
    26022709          rQPDG=NQPDG;
    26032710          rMass=GSResNn;
    2604 #ifdef pdebug
     2711#ifdef debug
    26052712          G4cout<<"G4QNucleus::EvaporateBaryon: Decay in N + rA="<<GSResNn+mNeut<<G4endl;
    26062713#endif
     
    26082715        else if(mProt+GSResNp<totMass)
    26092716        {
    2610 #ifdef pdebug
     2717#ifdef debug
    26112718          G4cout<<"G4QNucl::EvapBar: Emergency Proton, dM="<<totMass-GSResNp-mProt<<G4endl;
    26122719#endif
     
    26182725        else if(mAlph+GSResNa<totMass)
    26192726        {
    2620 #ifdef pdebug
     2727#ifdef debug
    26212728          G4cout<<"G4QNucl::EvapBar: Emergency Alpha, dM="<<totMass-GSResNa-mAlph<<G4endl;
    26222729#endif
     
    26282735        else
    26292736        {
    2630 #ifdef pdebug
     2737#ifdef debug
    26312738          G4cout<<"G4QNuc::EvapBaryon: Photon ### 4-Big ###, dM="<<totMass-GSMass<<G4endl;
    26322739#endif
     
    26482755    if(!DecayIn2(h1mom,h2mom))
    26492756    {
    2650 #ifdef pdebug
     2757#ifdef debug
    26512758      G4cout<<"*G4QNucleus::EvaporateBaryon: Decay M="<<totMass<<",b="<<bQPDG<<h1->GetQC()
    26522759      <<eMass<<",r="<<rQPDG<<h2->GetQC()<<rMass<<G4endl;
     
    26542761      return false;
    26552762    }
    2656 #ifdef pdebug
     2763#ifdef debug
    26572764    G4cout<<"G4QN::EvaB: **RESULT** b="<<bQPDG<<h1mom<<", r="<<rQPDG<<h2mom<<G4endl;
    26582765#endif
     
    26612768    h1->Set4Momentum(h1mom);
    26622769    h2->Set4Momentum(h2mom);
    2663 #ifdef pdebug
     2770#ifdef debug
    26642771    G4cout<<"G4QNucleus::EvaporateBaryon: Evaporation is done for b="<<bQPDG<<h1->GetQC()
    26652772       <<h1mom<<h1mom.m()<<", r="<<rQPDG<<h2->GetQC()<<h2mom<<h2mom.m()<<G4endl;
     
    26692776  else if(a==1)
    26702777  {
    2671 #ifdef pdebug
     2778#ifdef debug
    26722779    G4cerr<<"***G4QNucleus::EvaporateBaryon: ??? A=1"<<G4endl;
    26732780#endif
     
    30893196  static const G4double mNeut= G4QPDGCode(2112).GetMass(); // Mass of neutron
    30903197  static const G4double mProt= G4QPDGCode(2212).GetMass(); // Mass of proton
    3091   if(!cZ && !cA) return Z*mProt+N*mNeut-G4QNucleus(Z,N,0).GetGSMass(); // For QGSM
     3198  if(!cZ && !cA) return Z*mProt+N*mNeut-GetGSMass();       // Total binding energy far all
    30923199  G4double GSM=GetGSMass();
    30933200  G4int iZ=static_cast<int>(cZ);
     
    32093316  sR=sqrt(CBD/ED);
    32103317  //sR=sqrt(wD/ED);
    3211 #ifdef pdebug
     3318#ifdef debug
    32123319  G4cout<<"G4QN::CBPP:s="<<sR<<",E="<<E<<",w="<<wD<<",CB="<<CB<<",B="<<B<<",C="<<C<<G4endl;
    32133320#endif
     
    32293336  }
    32303337  while(x*x+y*y > 1.);
     3338  std::pair<G4double, G4double> theImpactParameter;
    32313339  theImpactParameter.first  = x*maxImpact;
    32323340  theImpactParameter.second = y*maxImpact;
     
    32373345void G4QNucleus::ChooseNucleons()
    32383346{
     3347#ifdef debug
     3348  G4cout<<"G4QNucleus::ChooseNucleons: Nucleons search is started"<<rho0<<G4endl;
     3349#endif
    32393350  G4int protons =0;
    32403351  G4int nucleons=0;
    3241   G4int myA=GetA();
    3242   while (nucleons < myA)
    3243   {
    3244     if(protons<Z && G4UniformRand() < G4double(Z-protons)/G4double(myA-nucleons) )
     3352  G4int theA=GetA();
     3353  while (nucleons < theA)
     3354  {
     3355    if(protons<Z && G4UniformRand() < G4double(Z-protons)/G4double(theA-nucleons) )
    32453356    {
    32463357      protons++;
     
    32493360      theNucleons.push_back(proton);
    32503361    }
    3251     else if ( (nucleons-protons) < (myA-Z) )
     3362    else if ( (nucleons-protons) < N )
    32523363    {
    32533364      nucleons++;
     
    32653376  static const G4double mProt= G4QPDGCode(2212).GetMass();
    32663377  static const G4double mProt2= mProt*mProt;
    3267   G4int i=0;                                  // general index
    3268   G4int myA=GetA();                           // cashed value of A
    3269   G4ThreeVector aPos;                         // Prototype of nucleon position
    3270   G4ThreeVector delta;                        // Prototype of distance between nucleons
    3271   G4ThreeVector* places = new G4ThreeVector[myA]; // Vector of 3D positions
    3272   G4double*      placeM = new G4double[myA];  // Vector of radii
    3273   G4bool  freeplace;                          // flag of free space available
    3274   G4double nucDist2 = nucleonDistance*nucleonDistance; // @@ can be a common static
    3275   G4double maxR=GetRadius(0.01);              // there are no nucleons at this density
    3276   while(i<myA)                                // LOOP over all nucleons
    3277   {
    3278     aPos = maxR*RandomUnitSphere();           // Get random position of nucleon iside maxR
    3279     G4double density=GetRelativeDensity(aPos);
     3378  static const G4double third= 1./3.;
     3379#ifdef debug
     3380  G4cout<<"G4QNucl::ChoosePositions: is called"<<G4endl;
     3381#endif
     3382  G4int          i=0;                         // nucleon index
     3383  G4int          theA=GetA();                 // cashed value of A
     3384  G4int          lastN=theA-1;                // cashed value of A-1 (theLastNucleon index)
     3385  G4ThreeVector  aPos(0.,0.,0.);              // Prototype of the nucleon position
     3386  G4double       rPos=0.;                     // Radius of the nucleon position
     3387  G4ThreeVector  delta(0.,0.,0.);             // Prototype of the distance between nucleons
     3388  G4ThreeVector* places= new G4ThreeVector[theA]; // Vector of 3D positions
     3389  G4bool      freeplace= false;               // flag of free space available
     3390  G4double nucDist2= nucleonDistance*nucleonDistance; // @@ can be a common static
     3391  G4double maxR= GetRadius(0.01);             // there are cond no nucleons at this density
     3392  G4ThreeVector sumPos(0.,0.,0.);             // Vector of the current 3D sum
     3393  while(i<theA)                               // LOOP over all nucleons
     3394  {
     3395    rPos = maxR*pow(G4UniformRand(),third);   // Get random radius of the nucleon position
     3396    G4double density=rPos*rPos;               // Density at R (temporary squared radius)
     3397    if(theA<17) density=GetRelOMDensity(density); // Oscilator model (M.K.?)
     3398    else        density=GetRelWSDensity(rPos);    // Wood-Saxon model
     3399#ifdef debug
     3400    G4cout<<"G4QNucl::ChoosePositions: i="<<i<<", pos="<<aPos<<", dens="<<density<<G4endl;
     3401#endif
    32803402    if(G4UniformRand()<density)               // Try this position with frequency ~Density
    32813403    {
     3404      // @@ Gaussian oscilator distribution is good only up to He4 (s-wave). Above: p-wave
     3405      // (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
     3406      if(i==lastN) aPos=-rPos*sumPos.unit();  // TheLast tries to compensate CenterOfGravity
     3407      else     aPos=rPos*G4RandomDirection(); // It uses the standard G4 function
    32823408      freeplace = true;                       // Imply that there is a free space
    32833409      for(G4int j=0; j<i && freeplace; j++)   // Check that there is no overlap with others
    32843410      {
    32853411        delta = places[j] - aPos;             // Distance to nucleon j
    3286         freeplace= delta.mag2()>nucDist2;     // If false break the LOOP (M.K.)
    3287         if(!freeplace) break;                 // M.K. acceleration
     3412        freeplace= delta.mag2()>nucDist2;     // If false break the LOOP
    32883413      }
    32893414      //  protons must at least have binding energy of CoulombBarrier (@@ ? M.K.), so
    32903415      //  assuming Fermi Energy corresponds to Potential, we must place protons such
    32913416      //  that the Fermi Energy > CoulombBarrier (?)
    3292       if(freeplace && theNucleons[i]->GetPDGCode() == 2212) // Free Space Protons
     3417      //  @@ M.K.: 1. CoulBar depends on aPos; 2. Makes Isotopic assymetry (!); 3. Perform.
     3418      G4int nucPDG= theNucleons[i]->GetPDGCode();
     3419#ifdef debug
     3420      G4cout<<"G4QNucl::ChoosePositions: frpl="<<freeplace<<", nucPDG="<<nucPDG<<G4endl;
     3421#endif     
     3422      if(freeplace && nucPDG == 2212) // Free Space Protons
    32933423      {
    32943424        G4double pFermi=GetFermiMomentum(GetDensity(aPos));
    3295         G4double eFermi= sqrt(pFermi*pFermi+mProt2)-mProt; // Kinetic energy
     3425        G4double eFermi= sqrt(pFermi*pFermi+mProt2)-mProt;  // Kinetic energy
    32963426        if (eFermi <= CoulombBarrier()) freeplace=false;
    32973427      }
    32983428      if(freeplace)
    32993429      {
     3430#ifdef debug
     3431        G4cout<<"G4QNucl::ChoosePositions: fill nucleon i="<<i<<", V="<<aPos<<G4endl;
     3432#endif     
    33003433        places[i]=aPos;
     3434        sumPos+=aPos;
    33013435        ++i;
    33023436      }
    33033437    }
    33043438  }
    3305   ReduceSum(places,placeM);                    // Reduce center of mass shift (equalWeight)
    3306   for(i=0; i<myA; i++) theNucleons[i]->SetPosition(places[i]);
     3439#ifdef debug
     3440  G4cout<<"G4QNucl::ChoosePositions: Out of the positioning LOOP"<<G4endl;
     3441#endif
     3442  if(theA > 2) ReduceSum(places,sumPos);              // Reduce the CM shift (equal weights)
     3443#ifdef debug
     3444  G4cout<<"G4QNucl::ChoosePositions: The reduced summ is made"<<G4endl;
     3445#endif
     3446  for(i=0; i<theA; i++) theNucleons[i]->SetPosition(places[i]);
    33073447  delete [] places;
    3308   delete [] placeM;
    3309 #ifdef debug
    3310   G4cout << "G4QNucleus::ChoosePositions: A="<<myA<<G4endl;
     3448#ifdef debug
     3449  G4cout << "G4QNucleus::ChoosePositions: The positions are defined for A="<<theA<<G4endl;
    33113450#endif
    33123451} // End of ChoosePositions
     
    33153454void G4QNucleus::InitDensity()
    33163455{
    3317   static const G4double deld=0.545*fermi;           // Surface thickness
    3318   static const G4double r0sq=0.8133*fermi*fermi;    // Base for A-dep of rel.mean.radius
     3456  static const G4double r0sq=0.8133*fermi*fermi;      // Base for A-dep of rel.mean.radius
    33193457  static const G4double third=1./3.;
    33203458  G4int    iA = GetA();
     
    33223460  G4double At = pow(rA,third);
    33233461  G4double At2= At*At;
    3324   if(iA<17)                                         // Gaussian density distribution
    3325   {
    3326     radius = r0sq*At2;                              // Mean Squared Radius (fm^2)
    3327     rho0   = pow(pi*radius, -1.5);                  // Central Density
    3328   }
    3329   else                                              // Wood-Saxon density distribution
    3330   {
    3331     G4double r0=1.16*(1.-1.16/At2)*fermi;           // Base for A-dependent radius
    3332     G4double rd=deld/r0;                            // Relative thickness of the surface
    3333     radius = r0*At;                                 // Half Density Radius (fm)
    3334     rho0=0.75/(pi*pow(r0,3.)*iA*(1.+rd*rd*pi2));    // Central Density
    3335   }
     3462#ifdef debug
     3463  G4cout<<"G4QNucleus::InitDensity: rA=iA=A="<<iA<<", A^1/3="<<At<<", A^2/3="<<At2<<G4endl;
     3464#endif
     3465  if(iA<17)                                           // Gaussian density distribution
     3466  {
     3467    radius = r0sq*At2;                                // R2 Mean Squared Radius (fm^2)
     3468    if(radius<=0.)
     3469    {
     3470      G4cout<<"-Warning-G4QNucl::ChoosePositions:L,iA="<<iA<<",Radius(?)="<<radius<<G4endl;
     3471      radius=1.;
     3472    }
     3473    rho0   = pow(2*pi*radius, -1.5);                  // Central Density (M.K. 2 is added)
     3474    // V=4pi*R2*sqrt(pi*R2/2)=(sqrt(2*pi*R2))^3
     3475  }
     3476  else                                                // Wood-Saxon density distribution
     3477  {
     3478    G4double r0=1.16*(1.-1.16/At2)*fermi;             // Base for A-dependent radius
     3479    radius = r0*At;                                   // Half Density Radius (fm)
     3480    if(radius<=0.)
     3481    {
     3482      G4cout<<"-Warning-G4QNucl::ChoosePositions:H,iA="<<iA<<",Radius(?)="<<radius<<G4endl;
     3483      radius=1.;
     3484    }
     3485    G4double rd=WoodSaxonSurf/radius;                 // Relative thickness of the surface
     3486    if(!(rd<=0.1) && !(rd>-0.1))                      // NAN for rd
     3487    {
     3488      G4cout<<"-Warning-G4QNucl::ChoosePositions:H,NAN,iA="<<iA<<", rd="<<rd<<G4endl;
     3489      rd=1.;
     3490    }
     3491    rho0=0.75/(pi*pow(radius,3)*(1.+rd*rd*pi2));      // Central Density
     3492  }
     3493  RhoActive=true;
    33363494} // End of InitDensity
    33373495
    3338 // Calculates Derivity of the nuclear density (for Binary Cascade, can be absolete)
     3496// Calculates Derivity of the nuclear density
    33393497G4double G4QNucleus::GetDeriv(const G4ThreeVector& aPosition)
    33403498{
    3341   static const G4double deld=0.545*fermi;           // Surface thickness
    33423499  if(radius==0.) InitDensity();
    33433500  G4double rPos=aPosition.mag();
     
    33453502  // Wood-Saxon density distribution
    33463503  G4double dens=GetRelativeDensity(aPosition);
    3347   return -exp((rPos-radius)/deld)*dens*dens*rho0/deld;
     3504  return -exp((rPos-radius)/WoodSaxonSurf)*dens*dens*rho0/WoodSaxonSurf;
    33483505} // End of GetDeriv
    33493506
    3350 // Radius of the deffinit % of nuclear density
     3507// Radius of the deffinit % of nuclear density (very strange solution ?? @@ M.K.)
    33513508G4double G4QNucleus::GetRadius(const G4double maxRelDens)
    33523509{
    3353   static const G4double deld=0.545*fermi;           // Surface thickness
    33543510  if(radius==0.) InitDensity();
    33553511  if(GetA()<17)                                     // Gaussian density distribution
    3356     return (maxRelDens>0 && maxRelDens <= 1. ) ? sqrt(-radius*log(maxRelDens)) : DBL_MAX;
     3512    return (maxRelDens>0 && maxRelDens <= 1. ) ? sqrt(-radius*log(maxRelDens) ) : DBL_MAX;
    33573513  // Wood-Saxon density distribution
    3358   return (maxRelDens>0 && maxRelDens <= 1. ) ?
    3359          (radius + deld*log((1.-maxRelDens+exp(-radius/deld))/maxRelDens)) : DBL_MAX;
    3360 } // End of GetRadius
     3514  return (maxRelDens>0 && maxRelDens <= 1. ) ? (radius + WoodSaxonSurf*
     3515         log((1.-maxRelDens+exp(-radius/WoodSaxonSurf))/maxRelDens) ) : DBL_MAX;
     3516} // End of GetRadius (check @@ radius=sqr0 (fm^2) for A<17,  r0 (fm) for A>16 (units)
    33613517
    33623518// Calculates Densyty/rho0
    33633519G4double G4QNucleus::GetRelativeDensity(const G4ThreeVector& aPosition)
    33643520{
    3365   static const G4double deld=0.545*fermi;           // Surface thickness
    33663521  if(radius==0.) InitDensity();
    3367   if(GetA()<17)return exp(-aPosition.mag2()/radius);// Gaussian distribution
    3368   // Wood-Saxon density distribution
    3369   return 1./(1.+exp((aPosition.mag()-radius)/deld));
     3522  if(GetA()<17) return GetRelOMDensity(aPosition.mag2());// Gaussian distribution (OscMod?)
     3523  return GetRelWSDensity(aPosition.mag());               // Wood-Saxon density distribution
    33703524} // End of GetRelativeDensity
    33713525
     
    33833537  static const G4double mProt= G4QPDGCode(2212).GetMass(); // Mass of proton
    33843538  static const G4double mProt2= mProt*mProt;
    3385   static const G4double mNeut= G4QPDGCode(2112).GetMass(); // Mass of neutron
     3539  //static const G4double mNeut= G4QPDGCode(2112).GetMass(); // Mass of neutron
     3540  static const G4double third= 1./3.;
    33863541  G4int i=0;
    3387   G4double density=0;
    3388   G4int myA=GetA();
    3389   G4ThreeVector* momentum = new G4ThreeVector[myA];
    3390   G4double*      fermiM   = new G4double[myA];
    3391   for(i=0; i<myA; i++) // momenta for all, including the last, in case we swap nucleons
     3542  G4double density=0.;                                // Prototype of density for Loop calc
     3543  G4int theA=GetA();                                  // Atomic weight of the nucleus
     3544  G4int am1=theA-1;                                   // The last index in the Loop
     3545  G4ThreeVector* momentum = new G4ThreeVector[theA];  // Temporary array for nucleon's moms
     3546  G4ThreeVector  sumMom(0.,0.,0.);                    // Sum of all momenta for mom-conserv
     3547#ifdef debug
     3548  G4cout<<"G4QNucleus::ChooseFermiMomentum is called for Z="<<Z<<", N="<<N<<G4endl;
     3549#endif
     3550  for(i=0; i<theA; i++) // momenta for all, including the last, in case we swap nucleons
    33923551  {
    33933552    density=GetDensity(theNucleons[i]->GetPosition());// density around nucleon i
    3394     G4double ferm = GetFermiMomentum(density);        // module of momentun for nucleon i
    3395     fermiM[i] = ferm;                                 // module of momentun for nucleon i
    3396     G4ThreeVector mom=ferm*RandomUnitSphere();        // 3-vector for nucleon mpomentum
    3397     if(theNucleons[i]->GetPDGCode() == 2212)           // the nucleon is proton
     3553    G4double ferm = GetFermiMomentum(density);        // module of momentum for nucleon i
     3554    G4ThreeVector mom(0.,0.,0.);                      // proto 3vector for nucleon momentum
     3555    G4double rn3=pow(G4UniformRand(),third);          // Spherical randomization
     3556    G4ThreeVector dir(0.,0.,0.);                      // proto 3vector for the momDirection
     3557    if( i == am1) dir=-sumMom.unit();                 // try to compensate the mom noncons.
     3558    else          dir=G4RandomDirection();            // free randomization for i < A-1
     3559    if(theNucleons[i]->GetPDGCode() == 2212)          // the nucleon is a proton
    33983560    {
    33993561      G4double eMax = sqrt(ferm*ferm+mProt2)-CoulombBarrier();
    3400       if(eMax>mProt)
    3401       {
    3402         G4double pmax2= eMax*eMax - mProt2;
    3403         fermiM[i] = sqrt(pmax2);                      // modify proton momentum
    3404         while(mom.mag2() > pmax2) mom=Get3DFermiMomentum(density, fermiM[i]);
    3405       }
    3406       else
    3407       {
    3408         G4cerr<<"G4QNucleus: difficulty finding proton momentum -> mom=0"<<G4endl;
    3409         mom=0;
    3410       }
    3411     }
     3562      if(eMax>mProt) mom=sqrt(eMax*eMax - mProt2)*rn3*dir; // 3D proton momentum
     3563#ifdef debug
     3564      else G4cerr<<"-Warning-G4QNucleus::ChooseFermM: FailToGetProtonMomentum,p=0"<<G4endl;
     3565#endif
     3566    }
     3567    else mom=ferm*rn3*dir;                            // 3-vector for the neutron momentum
    34123568    momentum[i]= mom;
    3413   }
    3414   ReduceSum(momentum,fermiM);                    // Reduse momentum nonconservation
    3415   for(i=0; i< myA ; i++ )
    3416   {
    3417     G4double mN=mNeut;
    3418     if(theNucleons[i]->GetPDGCode() == 2212) mN=mProt;
    3419     G4double energy = mN - BindingEnergy()/myA;
    3420     G4LorentzVector tempV(momentum[i],energy);
     3569    sumMom+= mom;
     3570#ifdef pdebug
     3571    G4cout<<"G4QNucleus::ChooseFermiMomentum: for i="<<i<<", candidate mom="<<mom<<G4endl;
     3572#endif
     3573  }
     3574  if(theA > 2) SimpleSumReduction(momentum, sumMom);  // Reduse momentum nonconservation
     3575  //G4double bindEn=BindingEnergy()/theA;
     3576  G4int thisPDG=GetPDG();
     3577  G4double rMp=G4QPDGCode(thisPDG-1000).GetMass();    // Residual for the proton
     3578  G4double rMn=G4QPDGCode(thisPDG-1).GetMass();       // Residual for the neutron
     3579  G4double rMp2=rMp*rMp;
     3580  G4double rMn2=rMn*rMn;
     3581  G4double rM=rMn;
     3582  G4double rM2=rMn2;
     3583  G4double thisM=GetGSMass();
     3584#ifdef pdebug
     3585  G4LorentzVector sum(0.,0.,0.,0.);
     3586#endif
     3587  for(i=0; i< theA ; i++ )
     3588  {
     3589    if(theNucleons[i]->GetPDGCode() == 2212)
     3590    {
     3591      rM=rMp;
     3592      rM2=rMp2;
     3593    }
     3594    else
     3595    {
     3596      rM=rMn;
     3597      rM2=rMn2;
     3598    }
     3599    G4ThreeVector curMom = momentum[i];
     3600    G4double energy = thisM-std::sqrt(rM2+curMom.mag2()); // @@ update after splitting
     3601    G4LorentzVector tempV(curMom,energy);
     3602#ifdef pdebug
     3603    G4cout<<"G4QNucleus::ChooseFermiMomentum: FINALLY for i="<<i<<", 4mom="<<tempV<<G4endl;
     3604    sum+=tempV;
     3605#endif
    34213606    theNucleons[i]->Set4Momentum(tempV);
    34223607  }
     3608#ifdef pdebug
     3609    G4cout<<"G4QNucleus::ChooseFermiMomentum: FINALLY sum4M="<<sum<<G4endl;
     3610#endif
    34233611  delete [] momentum;
    3424   delete [] fermiM;
    34253612} // End of ChooseFermiMomenta
    34263613
    3427 // Reduce momentum nonconservation (reenterable attempts
    3428 G4bool G4QNucleus::ReduceSum(G4ThreeVector* momentum, G4double* pFermiM)
     3614// Reduce momentum nonconservation or center of mass shift (Changes the momena!)
     3615void G4QNucleus::SimpleSumReduction(G4ThreeVector* vect, G4ThreeVector sum)
    34293616{
    3430   G4int myA=GetA();
    3431   if(myA<2)                                           // Can not reduce only one nucleon
    3432   {
    3433     G4cout<<"-W-G4QNucleus::ReduceSum: *Failed* A="<<myA<<" < 2"<<G4endl;
     3617  G4int theA=GetA();                                // A#of nucleons
     3618  sum/=theA;
     3619  for(G4int i=0; i<theA; i++) vect[i]-=sum;        // Simple reduction
     3620}
     3621
     3622// Reduce momentum nonconservation or center of mass shift (Keep values of momena) @@Bug!@@
     3623G4bool G4QNucleus::ReduceSum(G4ThreeVector* vect, G4ThreeVector sum)
     3624{
     3625  G4int theA=GetA();                                // A#of nucleons
     3626  if(theA<3)                                        // Can not reduce for 1 or 2 nucleons
     3627  {
     3628    G4cout<<"-Warning-G4QNucleus::ReduceSum: *Failed* A="<<theA<<" < 3"<<G4endl;
    34343629    return false;
    34353630  }
    3436   G4int i=0;                                          // To avoid declaration in j-LOOP
    3437   G4ThreeVector sum(0.,0.,0.);                        // The sum which must be reduced
    3438   G4double minV=DBL_MAX;                              // Min value of Fermi Momentum
    3439   G4double maxV=0.;                                   // Max value of Fermi Momentum
    3440   G4int    maxI=-1;                                   // Index of maximum Fermi Momentum
    3441   for(i=0; i<myA; i++)
    3442   {
    3443     sum+=momentum[i];                                 // Make sum of 3D Momenta
    3444     G4double pfi=pFermiM[i];                          // To avoid multiple call by index
    3445     if(pfi<minV) minV=pfi;                            // Find the minimum Fermi Momentum
    3446     if(pfi>maxV)                                      // Better maximum is found
    3447     {
    3448       maxV=pfi;                                       // Find the maximum Fermi Momentum
    3449       maxI=i;                                         // Index of maximum Fermi Momentum
    3450     }
    3451   }
    3452   minV*=0.01;                                         // Value to estimate residual (@@par)
    3453   if(sum.mag()<minV)                                  // Probably reduction is not needed
    3454   {
    3455     momentum[maxI]-=sum;                              // add residual to maximum momentum
    3456     pFermiM[maxI]=momentum[maxI].mag();               // udate only one Fermi Momentum
    3457     return true;
    3458   }
    3459   G4double* fm2   = new G4double[myA];                // collect temporary squared FermiMom
    3460   for(i=0; i<myA; i++) fm2[i]=pFermiM[i]*pFermiM[i];  // calculate squared Fermi Momenta
    3461   G4int myA1=myA-1;                                   // to avoid calculation in the j-LOOP
    3462   for(G4int j=0; j<myA; j++)                          // Not more than myA attempts
    3463   {
    3464     G4double minP=DBL_MAX;                            // Minimal progection value
    3465     G4int    minI=-1;                                 // Minimal projection index
    3466     for(i=0; i<myA; i++)                              // Sirch for minimum projection
    3467     {
    3468       G4double proj=fabs(sum.dot(momentum[i])/fm2[i]);// abs value of |sum|*cos(theta)
    3469       if(proj<minP)
    3470       {
    3471         minP=proj;
     3631  // The last vector must have the same direction as the SUM (do not take into account
     3632  G4int am1=theA-1;                                 // A-1 elements, which canBeCorrected
     3633  G4double  sum2=sum.mag2();                        // Initial squared sum
     3634  G4double  hsum2=sum2/2;                           // Half squared sum
     3635  G4double*  dp= new G4double[am1];                 // Displacements
     3636  G4int     m=am1;                                  // #0fVectors used for correction
     3637  G4double  minS=DBL_MAX;                           // Min value of Fermi Momentum
     3638  G4int     minI=0;                                 // Index of maximum Fermi Momentum
     3639  for(G4int i=0; i<am1; i++) dp[i]=sum.dot(vect[i]);// Calculation of dot-products
     3640  while(m)
     3641  {
     3642    m=0;
     3643    for(G4int i=0; i<am1; i++) if(dp[i]>0 && dp[i]<sum2) // can be used for the reduction
     3644    {
     3645      m++;
     3646      G4double shift=fabs(dp[i]-hsum2);
     3647      if(shift < minS)
     3648      {
     3649        minS=shift;
    34723650        minI=i;
    34733651      }
    34743652    }
    3475     G4ThreeVector cand=momentum[minI]-sum;
    3476     G4double      canV=cand.mag();                    // what we've got
    3477     if(canV<0.000001)                                 // Never should come in
    3478     {
    3479       G4cout<<"-W-G4QNucleus::ReduceSumm: *Failed* A="<<myA<<",C="<<canV<<",j="<<j<<G4endl;
    3480       return false;
    3481     }
    3482     cand = cand*pFermiM[minI]/canV;                   // pFermiM is unchanged !
    3483     sum += cand-momentum[minI];                       // sum is updated
    3484     momentum[minI] = cand;                            // Update direction of the momentum
    3485     if(sum.mag()<minV || j == myA1)                   // Two resons to finish reduction
    3486     {
    3487       momentum[maxI]-=sum;                            // add residual to maximum momentum
    3488       pFermiM[maxI]=momentum[maxI].mag();             // update the biggest momentum
    3489     }
    3490   }
     3653    if(m)                                            // There is a vector reducing the sum
     3654    {
     3655      G4ThreeVector x=(dp[minI]/hsum2)*sum;          // turn-reduction of the sum-vector
     3656      vect[minI]-=x;                                 // turn the minI-th vector
     3657      sum-=x;                                        // reduce the sum
     3658      sum2=sum.mag2();                               // Current squared sum
     3659      hsum2=sum2/2;                                  // Current half squared sum
     3660    }
     3661  }
     3662  if(sum2 > 0.)
     3663  {
     3664    sum/=theA;
     3665    for(G4int i=0; i<theA; i++) vect[i]-=sum;        // Final reduction
     3666  }
     3667  delete[] dp;
    34913668  return true;
    34923669} // End of ReduceSum
     
    34983675  G4cout<<"G4QNucleus::Init3D: is called currentNucleon="<<currentNucleon<<G4endl;
    34993676#endif
    3500   if(currentNucleon>-1) return;                       // This is a global parameter in Body
    3501   G4int myA = GetA();
    3502 #ifdef debug
    3503   G4cout<<"G4QNucleus::Init3D: A="<<myA<<", Z="<<Z<<G4endl;
     3677  for_each(theNucleons.begin(),theNucleons.end(),DeleteQHadron());
     3678  theNucleons.clear();
     3679  G4int theA = GetA();
     3680  ChooseNucleons();
     3681#ifdef debug
     3682  G4cout<<"G4QNucleus::Init3D: Nucleons are initialized, nN="<<theNucleons.size()<<G4endl;
    35043683#endif
    35053684  InitDensity();
    3506   ChooseNucleons(); 
    3507   ChoosePositions();
    3508   ChooseFermiMomenta();
    3509   G4double Ebind= BindingEnergy()/myA;
    3510   for (G4int i=0; i<myA; i++) theNucleons[i]->SetBindingEnergy(Ebind); // @@ ? M.K.
     3685#ifdef debug
     3686  G4cout<<"G4QNucl::Init3D: DensityPars for A="<<theA<<":R="<<radius <<",r0="<<rho0<<G4endl;
     3687#endif
     3688  ChoosePositions(); // CMS positions! No Lorentz boost! Use properely!
     3689#ifdef debug
     3690  G4cout<<"G4QNucleus::Init3D: Nucleons are positioned in the coordinate space"<<G4endl;
     3691#endif
     3692  ChooseFermiMomenta(); // CMS Fermi Momenta! Must be transfered to the LS if not at rest!
     3693  G4ThreeVector n3M=Get3Momentum();                   // Velocity of the nucleus in LS
     3694  if(n3M.x() || n3M.y() || n3M.z())                   // Boost the nucleons to LS
     3695  {
     3696    n3M/=GetEnergy();                                 // Now this is the boost velocity
     3697    DoLorentzBoost(n3M);                              // Now nucleons are in LS
     3698  }
     3699#ifdef debug
     3700  G4cout<<"G4QNucleus::Init3D: Nucleons are positioned in the momentum space"<<G4endl;
     3701#endif
     3702  G4double Ebind= BindingEnergy()/theA;
     3703  for (G4int i=0; i<theA; i++) theNucleons[i]->SetBindingEnergy(Ebind); // @@ ? M.K.
    35113704  currentNucleon=0;                                   // Automatically starts the LOOP
    3512   return; 
     3705  return;
    35133706} // End of Init3D
    35143707
     
    35173710{
    35183711  G4double maxradius2=0;
    3519   G4int myA=theNucleons.size();
    3520   if(myA) for(G4int i=0; i<myA; i++)
     3712  G4int theA=theNucleons.size();
     3713  if(theA) for(G4int i=0; i<theA; i++)
    35213714  {
    35223715    G4double nucr2=theNucleons[i]->GetPosition().mag2();
     
    35253718  return sqrt(maxradius2)+nucleonDistance;
    35263719} // End of GetOuterRadius
    3527 
    3528 //
    3529 void G4QNucleus::DoLorentzBoost(const G4LorentzVector& theBoost)
    3530 {
    3531   G4int myA=theNucleons.size();
    3532   if(myA) for(G4int i=0; i<myA; i++) theNucleons[i]->Boost(theBoost);
    3533 } // End of DoLorentzBoost(G4LorentzVector)
    3534 
    3535 //
    3536 void G4QNucleus::DoLorentzBoost(const G4ThreeVector& theBoost)
    3537 {
    3538   G4int myA=theNucleons.size();
    3539   if(myA) for(G4int i=0; i<myA; i++) theNucleons[i]->Boost(theBoost);
    3540 } // End of DoLorentzBoost(G4ThreeVector)
    35413720
    35423721//
     
    35453724  G4double bet2=theBeta.mag2();
    35463725  G4double factor=(1.-sqrt(1.-bet2))/bet2;         // 1./(beta2*gamma2)
    3547   G4int myA=theNucleons.size();
    3548   if(myA) for (G4int i=0; i< myA; i++)
     3726  G4int theA=theNucleons.size();
     3727  if(theA) for (G4int i=0; i< theA; i++)
    35493728  {
    35503729    G4ThreeVector pos=theNucleons[i]->GetPosition();
     
    35573736void G4QNucleus::DoTranslation(const G4ThreeVector& theShift)
    35583737{
    3559   G4int myA=theNucleons.size();
    3560   if(myA) for(G4int i=0; i<myA; i++)
     3738  G4int theA=theNucleons.size();
     3739  if(theA) for(G4int i=0; i<theA; i++)
    35613740    theNucleons[i]->SetPosition(theNucleons[i]->GetPosition() + theShift);
    35623741} // End of DoTranslation
     
    35653744G4bool G4QNucleus::StartLoop()
    35663745{
    3567   G4int myA=theNucleons.size();
    3568   if(myA) currentNucleon=0;
     3746  G4int theA=theNucleons.size();
     3747  if(theA) currentNucleon=0;
    35693748  else G4cout<<"-Warning-G4QNucleus::StartLoop: LOOP starts for uninited nucleons"<<G4endl;
    3570   return myA;
     3749  return theA;
    35713750} // End of StartLoop
    35723751
     
    35953774    T=C*E/(1.+E);                           // T(b) in fm^-2
    35963775  }
     3776  TbActive=true;                            // Flag of activation
    35973777} // End of "ActivateBThickness"
    35983778
    3599 // Randomize position inside 3D UnitRadius Sphere
    3600 G4ThreeVector G4QNucleus::RandomUnitSphere()
    3601 { //                      ==================
    3602   G4double x=G4UniformRand(), y=G4UniformRand(), z=G4UniformRand();
    3603   G4double r2= x*x+y*y+z*z;
    3604   while(r2>1.)
    3605   {
    3606     x = G4UniformRand(); y = G4UniformRand(); z = G4UniformRand();
    3607     r2=x*x+y*y+z*z;
    3608   }
    3609   return G4ThreeVector(x, y, z);
    3610 } // End of RandomUnitSphere
     3779// Calculate the integral of T(b)
     3780G4double G4QNucleus::GetTbIntegral() // Calculate the integral of T(b)
     3781//==================================
     3782{
     3783  if(!TbActive) ActivateBThickness();
     3784  G4int nt = Tb.size();
     3785  G4double sum=0.;
     3786  for(G4int i=0; i<nt; ++i) sum+=i*Tb[i];
     3787  sum*=.02*pi;
     3788#ifdef debug
     3789  G4cout<<"G4QNucleus::GetTbIntegral:TI="<<sum<<", RI="<<4*pi*rho0*pow(radius,3)/3<<G4endl;
     3790#endif
     3791  return sum;
     3792}
     3793
     3794// Calculates T(b)
     3795G4double G4QNucleus::GetBThickness(G4double b)
     3796//============================================
     3797{
     3798  static const G4double dfermi=fermi/10.;
     3799  static const G4double sfermi=fermi*fermi;
     3800  if(!TbActive) ActivateBThickness();
     3801  G4double bf = b/dfermi;
     3802  G4int nb = static_cast<int>(bf);
     3803  G4int eb = nb+1;
     3804  G4int nt = Tb.size();
     3805  if(eb>=nt) return 0.;
     3806  G4double nT=Tb[nb];
     3807  G4double eT=Tb[eb];
     3808  return (nT-(bf-nb)*(nT-eT))/sfermi; // Independent units
     3809}
     3810
     3811// Calculates T(b)/rho0
     3812G4double G4QNucleus::GetThickness(G4double b)
     3813//===========================================
     3814{
     3815  G4int tA=GetA();
     3816  if(tA<1)
     3817  {
     3818    G4cout<<"-Warning-G4QNucleus::GetThickness: for A="<<tA<<", => return 0"<<G4endl;
     3819    return 0.;
     3820  }
     3821  else if(tA==1) return 0.;
     3822  if(!TbActive) ActivateBThickness();
     3823  if(!RhoActive) InitDensity();
     3824  return GetBThickness(b)/rho0/tA;
     3825}
    36113826
    36123827// Add Cluster
    36133828G4QNucleus G4QNucleus::operator+=(const G4QNucleus& rhs)
    3614 //====================================================
     3829//======================================================
    36153830{
    36163831  Z+=rhs.Z;
     
    36213836  dS+=rhs.dS;
    36223837  // Atributes of aHadron
    3623   G4int           newPDG= GetPDGCode()   + rhs.GetPDGCode() - 90000000;
     3838  G4int           newPDG= GetPDGCode() + rhs.GetPDGCode() - 90000000;
    36243839  SetQPDG        (newPDG);
    3625   G4QContent      newQC = GetQC()        + rhs.GetQC();
     3840  G4QContent      newQC = GetQC()      + rhs.GetQC();
    36263841  SetQC          (newQC);
    3627   G4LorentzVector newLV = Get4Momentum() + rhs.Get4Momentum();
    3628   Set4Momentum   (newLV);
     3842  theMomentum += rhs.Get4Momentum();
    36293843  return *this;
    36303844}
     
    36453859  G4QContent      newQC = GetQC()        - rhs.GetQC();
    36463860  SetQC          (newQC);
    3647   G4LorentzVector newLV = Get4Momentum() - rhs.Get4Momentum();
    3648   Set4Momentum   (newLV);
     3861  theMomentum -= rhs.Get4Momentum();
    36493862  return *this;
    36503863}
     
    36653878  G4QContent      newQC = rhs*GetQC();
    36663879  SetQC          (newQC);
    3667   G4LorentzVector newLV = rhs*Get4Momentum();
    3668   Set4Momentum   (newLV);
     3880  theMomentum *= rhs;
    36693881  return *this;
    36703882}
     
    37513963  if(theBN<1 || thePDG<80000000 || thePDG==90000000) // Hadron, anti-nucleous, or vacuum
    37523964  {
    3753 #ifdef pdebug
     3965#ifdef debug
    37543966    G4cout<<"G4QNucleus::EvaporateNucleus: Nucleus="<<thePDG<<qH->Get4Momentum()<<G4endl;
    37553967#endif
     
    37783990  if(thePDG>91000000) //@@MadeForGeant4@@: If there is a Lambda, substitute it by A neutron
    37793991  {
    3780     G4int SSS=(thePDG-90000000)/1000000;
     3992    G4int SSS=(thePDG-90000000)/1000000;      // A # of Lambdas
    37813993    thePDG-=SSS*999999;                       // S Neutrons instead of S Lambdas
    37823994    qH->SetQPDG(G4QPDGCode(thePDG));
     3995    theQC  = qH->GetQC();          // Quark Content of the hadron
     3996#ifdef debug
     3997    G4cout<<"=>Hyper Change=>G4QNucleus::EvaporateNuceus: NewNucPDG="<<thePDG<<G4endl;
     3998#endif
    37833999  }
    37844000  /// @@@ *** ^^^ END OF TEMPORARY ^^^ *** @@@
    37854001  if(thePDG<80000000)
    37864002  {
    3787 #ifdef pdebug
     4003#ifdef debug
    37884004    G4cout<<"G4QN::EvaporateNuc: FundamentalParticle="<<thePDG<<qH->Get4Momentum()<<G4endl;
    37894005#endif
     
    37994015  G4double totGSM = G4QNucleus(thePDG).GetGSMass();// TheGroundStateMass of theTotalNucleus
    38004016  G4double totMass = q4M.m();              // Get the Real(Excited?)Mass of theTotalNucleus
    3801 #ifdef pdebug
     4017#ifdef debug
    38024018  G4cout<<"G4QNucleus::EvaporateNucleus(EVA):===IN==> PDG="<<thePDG<<",4Mom="<<q4M<<", B="
    38034019        <<theBN<<", Z="<<theC<<", N="<<theN<<", S="<<theS<<G4endl;
     
    38114027    if(fabs(totMass-gsM)<.001)
    38124028    {
    3813 #ifdef pdebug
     4029#ifdef debug
    38144030      G4cout<<"G4QNu::EvaporateNucl:GSM="<<gsM<<", H="<<thePDG<<qH->Get4Momentum()<<G4endl;
    38154031#endif
     
    38364052    {
    38374053      G4double d=totMass-gsM;
    3838 #ifdef pdebug
     4054#ifdef debug
    38394055      G4cout<<"G4QN::EvaporNucl: PDG="<<thePDG<<",M="<<totMass<<">"<<gsM<<",d="<<d<<G4endl;
    38404056#endif
     
    38784094        throw G4QException("G4QNucleus::EvaporateNucleus:BaryonDecay In Baryon+Gam Error");
    38794095      }
    3880 #ifdef pdebug
     4096#ifdef debug
    38814097      G4cout<<"G4QNucl::EvaNuc:"<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<"+g="<<g4Mom<<",n="
    38824098            <<evaHV->size()<<G4endl;
    38834099#endif
    38844100      G4QHadron* curH = new G4QHadron(thePDG,h4Mom);
    3885 #ifdef pdebug
     4101#ifdef debug
    38864102      G4cout<<"G4QNucleus::EvaporateNucleus: Hadr="<<thePDG<<h4Mom<<G4endl;
    38874103#endif
    38884104      evaHV->push_back(curH);         // Fill Baryon (delete equiv.)
    38894105      G4QHadron* curG = new G4QHadron(decPDG,g4Mom);
    3890 #ifdef pdebug
     4106#ifdef debug
    38914107      G4cout<<"G4QNucleus::EvaporateNucleus: Gamma(pion)4M="<<g4Mom<<G4endl;
    38924108#endif
     
    39164132    if(fabs(totMass-gsM-mPi)<.001)
    39174133    {
    3918 #ifdef pdebug
     4134#ifdef debug
    39194135      G4cout<<"G4QN::EvaporateNuc:(D)GSM="<<gsM<<",H="<<thePDG<<qH->Get4Momentum()<<G4endl;
    39204136#endif
     
    39654181        throw G4QException("G4QNucleus::EvaporateNucleus: DeltaDecInBaryon+Pi Error");
    39664182      }
    3967 #ifdef pdebug
     4183#ifdef debug
    39684184      G4cout<<"G4QNuc::EvaNuc:"<<totMass<<q4M<<"->"<<thePDG<<h4Mom<<"+pi="<<g4Mom<<", nH="
    39694185            <<evaHV->size()<<G4endl;
    39704186#endif
    39714187      G4QHadron* curH = new G4QHadron(barPDG,h4Mom);
    3972 #ifdef pdebug
     4188#ifdef debug
    39734189      G4cout<<"G4QNucleus::EvaporateNucl: Nucleon="<<thePDG<<h4Mom<<G4endl;
    39744190#endif
    39754191      evaHV->push_back(curH);         // Fill the nucleon (delete equiv.)
    39764192      G4QHadron* curG = new G4QHadron(mesPDG,g4Mom);
    3977 #ifdef pdebug
     4193#ifdef debug
    39784194      G4cout<<"G4QE::EvaporateR: Pion="<<g4Mom<<G4endl;
    39794195#endif
     
    40504266#endif
    40514267      G4QHadron* h1H = new G4QHadron(nucPDG,n14M);
    4052 #ifdef pdebug
     4268#ifdef debug
    40534269      G4cout<<"G4QNucleus::EvaporateNucleus: Bar1="<<nucPDG<<n14M<<G4endl;
    40544270#endif
    40554271      evaHV->push_back(h1H);                // (delete equivalent)
    40564272      G4QHadron* h2H = new G4QHadron(nucPDG,n24M);
    4057 #ifdef pdebug
     4273#ifdef debug
    40584274      G4cout<<"G4QNucleus::EvaporateNucleus: Bar2="<<nucPDG<<n24M<<G4endl;
    40594275#endif
    40604276      evaHV->push_back(h2H);                // (delete equivalent)
    40614277      G4QHadron* piH = new G4QHadron(piPDG,pi4M);
    4062 #ifdef pdebug
     4278#ifdef debug
    40634279      G4cout<<"G4QNucleus::EvaporateNucleus: Pi="<<piPDG<<pi4M<<G4endl;
    40644280#endif
     
    41254341#endif
    41264342      G4QHadron* h1H = new G4QHadron(n1PDG,n14M);
    4127 #ifdef pdebug
     4343#ifdef debug
    41284344      G4cout<<"G4QNucleus::EvaporateNucleus: Bar1="<<n1PDG<<n14M<<G4endl;
    41294345#endif
    41304346      evaHV->push_back(h1H);                // (delete equivalent)
    41314347      G4QHadron* h2H = new G4QHadron(n2PDG,n24M);
    4132 #ifdef pdebug
     4348#ifdef debug
    41334349      G4cout<<"G4QNucleus::EvaporateNucleus: Bar2="<<n2PDG<<n24M<<G4endl;
    41344350#endif
    41354351      evaHV->push_back(h2H);                // (delete equivalent)
    41364352      G4QHadron* piH = new G4QHadron(piPDG,pi4M);
    4137 #ifdef pdebug
     4353#ifdef debug
    41384354      G4cout<<"G4QNucleus::EvaporateNucleus: Pi="<<piPDG<<pi4M<<G4endl;
    41394355#endif
     
    41574373  else if(fabs(totMass-totGSM)<.001)  // Fill as it is or decay Be8, He5, Li5 (@@ add more)
    41584374  {
    4159 #ifdef pdebug
     4375#ifdef debug
    41604376    G4cout<<"G4QNucleus::EvaNuc:GS "<<qH->GetQC()<<qH->Get4Momentum()<<" FillAsIs"<<G4endl;
    41614377#endif
     
    42484464#endif
    42494465    G4QHadron* k1H = new G4QHadron(k1PDG,k14M);
    4250 #ifdef pdebug
     4466#ifdef debug
    42514467    G4cout<<"G4QNucleus::EvaporateNucleus: k1="<<k1PDG<<k14M<<G4endl;
    42524468#endif
    42534469    evaHV->push_back(k1H);                // (delete equivalent)
    42544470    G4QHadron* k2H = new G4QHadron(k2PDG,k24M);
    4255 #ifdef pdebug
     4471#ifdef debug
    42564472    G4cout<<"G4QNucleus::EvaporateNucleus: k2="<<k2PDG<<k24M<<G4endl;
    42574473#endif
    42584474    evaHV->push_back(k2H);                // (delete equivalent)
    42594475    G4QHadron* nH = new G4QHadron(nucPDG,n4M);
    4260 #ifdef pdebug
     4476#ifdef debug
    42614477    G4cout<<"G4QNucleus::EvaporateNucleus: Nuc="<<nucPDG<<n4M<<G4endl;
    42624478#endif
     
    42804496    G4int    bN     =qNuc.GetN();              // A#of neutrons in theTotal ResidualNucleus
    42814497    G4int    bS     =qNuc.GetS();              // A#of lambdas in theTotal Residual Nucleus
    4282 #ifdef pdebug
     4498#ifdef debug
    42834499    if(bZ==2&&bN==5)G4cout<<"G4QNucleus::EvaNucl: (2,5) GSM="<<GSMass<<" > "
    42844500                          <<G4QPDGCode(2112).GetNuclMass(2,4,0)+mNeut<<G4endl;
     
    42914507    G4int   bsCond =qNuc.SplitBaryon();        // (Bary/Deut/Alph)SeparCond for TotResNucl
    42924508    G4bool  dbsCond=qNuc.Split2Baryons();      // (Two Baryons)SeparCond for TotResidNucl
    4293 #ifdef pdebug
     4509#ifdef debug
    42944510    G4cout<<"G4QNucleus::EvaporateNuc: bs="<<bsCond<<", dbs="<<dbsCond<<", A="<<bA<<G4endl;
    42954511#endif
    42964512    if(fabs(totMass-GSMass)<.003&&!bsCond&&!dbsCond) // GS or can't split 1(2)B FillAsItIs
    42974513    {
    4298 #ifdef pdebug
     4514#ifdef debug
    42994515      G4cout<<"G4QN::EvaNuc: GS direct "<<qH->GetQC()<<qH->Get4Momentum()<<" AsIs"<<G4endl;
    43004516#endif
     
    43084524    //else if(2>3)                                // Close "Fuse&Decay Technology"***@@@***
    43094525    {
    4310 #ifdef pdebug
     4526#ifdef debug
    43114527      G4cout<<"G4QN::EvaN:SplitBar, s="<<bsCond<<",M="<<totMass<<" > GSM="<<GSMass<<G4endl;
    43124528#endif
     
    43194535        G4int          nFrag  = theLast->GetNFragments();
    43204536        //////////////////G4int          gam    = theLast->GetPDGCode();
    4321 #ifdef pdebug
     4537#ifdef debug
    43224538        G4cout<<"G4QN::EvaNuc:*BackFus*,BN="<<lastBN<<",nF="<<nFrag<<",n="<<nOfOUT<<G4endl;
    43234539#endif
     
    43274543          nFrag  = thePrev->GetNFragments();
    43284544          G4int      prevBN = thePrev->GetBaryonNumber();
    4329 #ifdef pdebug
     4545#ifdef debug
    43304546          G4int     prevPDG = thePrev->GetPDGCode();
    43314547          G4cout<<"G4QNucl::EvaNucl: DelTheLast, nFr="<<nFrag<<", pPDG="<<prevPDG<<G4endl;
     
    43584574          G4int totBN=totQC.GetBaryonNumber();// BaryonNumber of the Total Residual Nucleus
    43594575          G4double dM=totMass-GSMass-lastM;
    4360 #ifdef pdebug
     4576#ifdef debug
    43614577          G4cout<<"G4QN::EvaNuc: tM="<<totMass<<"-LM="<<lastM<<lastQC<<"-GSM="<<GSMass<<"="
    43624578                <<dM<<G4endl;
     
    43774593              qH=0;                                              // @Not necessary@
    43784594#endif
    4379 #ifdef pdebug
     4595#ifdef debug
    43804596              G4cout<<"G4QNucleus::EvaporateNucl: EVH "<<totPDG<<q4M<<" fill AsIs"<<G4endl;
    43814597#endif
     
    43984614                qH=0;                                              // @Not necessary@
    43994615#endif
    4400 #ifdef pdebug
     4616#ifdef debug
    44014617                G4cout<<"***G4QNucleus::EvaNucl: EVH "<<totPDG<<q4M<<" fill AsIs"<<G4endl;
    44024618#endif
    44034619                evaHV->push_back(evH);// Fill TRN to Vect as it is (delete equivalent)
    4404 #ifdef pdebug
     4620#ifdef debug
    44054621                G4cout<<"***G4QN::EvaN:DecayIn L"<<lastQC<<"+RN"<<totQC<<" failed"<<G4endl;
    44064622#endif
     
    44194635                theLast->Set4Momentum(last4M);// Already exists:don't create&fill,->set4Mom
    44204636                G4QHadron* nucH = new G4QHadron(thePDG,r4Mom); // Create QHadron for qH-nuc
    4421 #ifdef pdebug
     4637#ifdef debug
    44224638                G4cout<<"G4QNucleus::EvaNuc:fill NH "<<totPDG<<r4Mom<<G4endl;
    44234639#endif
     
    44554671          throw G4QException("G4QNucleus::EvaporateNucleus: Decay in Gamma failed");
    44564672        }
    4457 #ifdef pdebug
     4673#ifdef debug
    44584674        G4cout<<"G4QNuc::EvaNuc: "<<q4M<<"->totResN="<<thePDG<<h4Mom<<"+g="<<g4Mom<<G4endl;
    44594675#endif
    44604676        G4QHadron* curH = new G4QHadron(thePDG,h4Mom);
    4461 #ifdef pdebug
     4677#ifdef debug
    44624678        G4cout<<"G4QNucleus::EvaporateNucleus: Fill a Fragment="<<thePDG<<h4Mom<<G4endl;
    44634679#endif
     
    44654681        else evaHV->push_back(curH);  // Fill the TotalResidualNucleus (del.equiv.)
    44664682        G4QHadron* curG = new G4QHadron(22,g4Mom);
    4467 #ifdef pdebug
     4683#ifdef debug
    44684684        G4cout<<"G4QNucleus::EvaporateNucleus: Fill  a Gamma="<<g4Mom<<G4endl;
    44694685#endif
     
    44954711    else if(totMass<GSMass+.003&&(bsCond||dbsCond))//==>" M<GSM but decay is possible" case
    44964712    {
    4497 #ifdef pdebug
     4713#ifdef debug
    44984714      G4cout<<"G4QN::EvN:2B="<<dbsCond<<",B="<<bsCond<<",M="<<totMass<<"<"<<GSMass<<G4endl;
    44994715#endif
     
    46374853        else llResM  =resN.GetMZNS();      // min mass of the Residual Nucleus
    46384854      }
    4639 #ifdef pdebug
     4855#ifdef debug
    46404856      G4cout<<"G4QNucleus::EvaNucl: rP="<<pResPDG<<",rN="<<nResPDG<<",rL="<<lResPDG<<",N="
    46414857            <<bN<<",Z="<<bZ<<",nL="<<bS<<",totM="<<totMass<<",n="<<totMass-nResM-mNeut
     
    48065022#endif
    48075023            G4QHadron* HadrB = new G4QHadron(barPDG,a4Mom);
    4808 #ifdef pdebug
     5024#ifdef debug
    48095025            G4cout<<"G4QNucleus::EvaNucleus:(1) Baryon="<<barPDG<<a4Mom<<G4endl;
    48105026#endif
    48115027            evaHV->push_back(HadrB);       // Fill the baryon (delete equivalent)
    48125028            G4QHadron* HadrR = new G4QHadron(resPDG,b4Mom);
    4813 #ifdef pdebug
     5029#ifdef debug
    48145030            G4cout<<"G4QNucleus::EvaNucleus:(1) Residual="<<resPDG<<b4Mom<<G4endl;
    48155031#endif
     
    48465062#endif
    48475063            G4QHadron* HadrB = new G4QHadron(barPDG,a4Mom);
    4848 #ifdef pdebug
     5064#ifdef debug
    48495065            G4cout<<"G4QNucleus::EvaporateNucleus:(2) Baryon1="<<barPDG<<a4Mom<<G4endl;
    48505066#endif
    48515067            evaHV->push_back(HadrB);       // Fill the first baryon (del.equiv.)
    48525068            G4QHadron* HadrC = new G4QHadron(thdPDG,c4Mom);
    4853 #ifdef pdebug
     5069#ifdef debug
    48545070            G4cout<<"G4QNucleus::EvaporateNucleus:(2) Baryon2="<<thdPDG<<c4Mom<<G4endl;
    48555071#endif
    48565072            evaHV->push_back(HadrC);       // Fill the second baryon (del.equiv.)
    48575073            G4QHadron* HadrR = new G4QHadron(resPDG,b4Mom);
    4858 #ifdef pdebug
     5074#ifdef debug
    48595075            G4cout<<"G4QNucleus::EvaporateNucleus:(2) Residual="<<resPDG<<b4Mom<<G4endl;
    48605076#endif
     
    48675083      else if (fabs(totMass-GSMass)<.003) // @@ Looks like a duplication of the prev. check
    48685084      {
    4869 #ifdef pdebug
     5085#ifdef debug
    48705086        G4cout<<"*|*|*|*G4QNucleus::EvaporateNuc: fill AsIs. Should never be here"<<G4endl;
    48715087#endif
     
    48785094      else                             // "System is below mass shell and can't decay" case
    48795095      {
    4880 #ifdef pdebug
     5096#ifdef debug
    48815097        G4cout<<"***G4QNucl::EvaNuc: tM="<<totMass<<"("<<thePDG<<") < GSM="<<GSMass<<", d="
    48825098              <<totMass-GSMass<<", QC="<<qH->GetQC()<<qH->Get4Momentum()<<"*AsIs*"<<G4endl;
     
    48915107    else                                        // ===> Evaporation of excited system
    48925108    {
    4893 #ifdef pdebug
     5109#ifdef debug
    48945110      G4cout<<"G4QN::EvaNuc:***EVA***tPDG="<<thePDG<<",M="<<totMass<<">GSM="<<GSMass<<",d="
    48955111            <<totMass-GSMass<<", N="<<qNuc.Get4Momentum()<<qNuc.Get4Momentum().m()<<G4endl;
     
    49165132        if(!qNuc.EvaporateBaryon(bHadron,rHadron)) // Evaporation did not succeed
    49175133        {
    4918 #ifdef pdebug
     5134#ifdef debug
    49195135          G4cout<<"***G4QNuc::EvaNuc:***EVA Failed***PDG="<<thePDG<<",M="<<totMass<<G4endl;
    49205136#endif
    49215137          delete bHadron;
    49225138          delete rHadron;
    4923 #ifdef pdebug
     5139#ifdef debug
    49245140          G4cout<<"***G4QNucl::EvaNuc: Residual="<<qH->GetQC()<<qH->Get4Momentum()<<G4endl;
    49255141#endif
     
    49495165        //if(b4M.e()-b4M.m()<bCB&&evcn<evcm) evC=true;
    49505166      }  // End of while
    4951 #ifdef pdebug
     5167#ifdef debug
    49525168      G4cout<<"G4QNucl::EvaNuc:*** EVA IS DONE *** F="<<bPDG<<b4M<<",bB="<<bB<<", ResNuc="
    49535169            <<rPDG<<r4M<<",rB="<<rB<<G4endl;
     
    49775193      {
    49785194        G4double rGSM = rHadron->GetQPDG().GetMass(); // Ground State mass of the dibaryon
    4979 #ifdef pdebug
     5195#ifdef debug
    49805196        G4cout<<"G4QNuc::EvaNuc:ResidDibM="<<rM<<",GSM="<<rGSM<<",M-GSM="<<rM-rGSM<<G4endl;
    49815197#endif
     
    49945210      else evaHV->push_back(rHadron);        // Fill ResidNucl=Baryon to OutputHadronVector
    49955211    } // End of Evaporation of excited system
    4996 #ifdef pdebug
     5212#ifdef debug
    49975213    G4cout<<"G4QNucleus::EvaporateNucleus: === End of the evaporation attempt"<<G4endl;
    49985214#endif
     
    50005216  else                                          // => "Decay if impossible evaporate" case
    50015217  {
    5002 #ifdef pdebug
     5218#ifdef debug
    50035219    G4cout<<"*G4QNucleus::EvaporateNucleus: InputHadron4M="<<q4M<<", PDG="<<thePDG<<G4endl;
    50045220#endif
     
    50315247          }
    50325248          G4QHadron* H2 = new G4QHadron(h2.GetPDGCode(),qe4M);
    5033 #ifdef pdebug
     5249#ifdef debug
    50345250          G4cout<<"G4QNucleus::EvaporateNucleus:(2) h2="<<h2.GetPDGCode()<<qe4M<<G4endl;
    50355251#endif
    50365252          evaHV->push_back(H2);            // (delete equivalent)
    50375253          G4QHadron* H1 = new G4QHadron(h1.GetPDGCode(),fq4M);
    5038 #ifdef pdebug
     5254#ifdef debug
    50395255          G4cout<<"G4QNucleus::EvaporateNucleus:(2) h1="<<h1.GetPDGCode()<<fq4M<<G4endl;
    50405256#endif
     
    50605276        if(fabs(totMass-totM)<0.001||abs(thePDG)-10*(abs(thePDG)/10)>2)
    50615277        {
    5062 #ifdef pdebug
     5278#ifdef debug
    50635279          G4cout<<"**G4QNuc::EvaNuc:EmerFill(2) "<<qH->GetQC()<<qH->Get4Momentum()<<G4endl;
    50645280#endif
     
    50865302          }
    50875303          G4QHadron* H1 = new G4QHadron(211,fq4M);
    5088 #ifdef pdebug
     5304#ifdef debug
    50895305          G4cout<<"G4QNucleus::EvaporateNucleus:(3) PiPlus="<<fq4M<<G4endl;
    50905306#endif
    50915307          evaHV->push_back(H1);            // (delete equivalent)
    50925308          G4QHadron* H2 = new G4QHadron(-211,qe4M);
    5093 #ifdef pdebug
     5309#ifdef debug
    50945310          G4cout<<"G4QNucleus::EvaporateNucleus:(3) PiMinus="<<qe4M<<G4endl;
    50955311#endif
     
    51145330          }
    51155331          G4QHadron* H1 = new G4QHadron(111,fq4M);
    5116 #ifdef pdebug
     5332#ifdef debug
    51175333          G4cout<<"G4QNucleus::EvaporateNucleus:(4) Pi01="<<fq4M<<G4endl;
    51185334#endif
    51195335          evaHV->push_back(H1);            // (delete equivalent)
    51205336          G4QHadron* H2 = new G4QHadron(111,qe4M);
    5121 #ifdef pdebug
     5337#ifdef debug
    51225338          G4cout<<"G4QNucleus::EvaporateNucleus:(4) Pi02="<<qe4M<<G4endl;
    51235339#endif
     
    51425358          }
    51435359          G4QHadron* H2 = new G4QHadron(thePDG,qe4M);
    5144 #ifdef pdebug
     5360#ifdef debug
    51455361          G4cout<<"G4QNucleus::EvaporateNucleus:(5) tot="<<thePDG<<qe4M<<G4endl;
    51465362#endif
    51475363          evaHV->push_back(H2);            // (delete equivalent)
    51485364          G4QHadron* H1 = new G4QHadron(22,fq4M);
    5149 #ifdef pdebug
     5365#ifdef debug
    51505366          G4cout<<"G4QNucleus::EvaporateNucleus:(5) GamFortot="<<fq4M<<G4endl;
    51515367#endif
     
    51705386          }
    51715387          G4QHadron* H2 = new G4QHadron(22,qe4M);
    5172 #ifdef pdebug
     5388#ifdef debug
    51735389          G4cout<<"G4QNucleus::EvaporateNucleus:(6) gam1="<<qe4M<<G4endl;
    51745390#endif
    51755391          evaHV->push_back(H2);            // (delete equivalent)
    51765392          G4QHadron* H1 = new G4QHadron(22,fq4M);
    5177 #ifdef pdebug
     5393#ifdef debug
    51785394          G4cout<<"G4QNucleus::EvaporateNucleus:(6) gam2="<<fq4M<<G4endl;
    51795395#endif
     
    52195435  }
    52205436#endif
    5221 #ifdef pdebug
     5437#ifdef debug
    52225438  G4cout<<"G4QNucleus::EvaporateNucleus: ===>>>> End. "<<G4endl;
    52235439#endif
     
    52425458  G4int qC=qQC.GetCharge();                      // Charge of the IsoNucleus
    52435459  G4int qS=qQC.GetStrangeness();                 // Strangness of the IsoNucleus
    5244 #ifdef pdebug
     5460#ifdef debug
    52455461  G4cout<<"G4QNuc:DecayIson:QC="<<qQC<<",M="<<qM<<",B="<<qBN<<",S="<<qS<<",C="<<qC<<G4endl;
    52465462#endif
     
    55315747  else if(!qS && (qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom)))
    55325748  {
    5533 #ifdef pdebug
     5749#ifdef debug
    55345750    G4cout<<"***G4QNuc::DecIsonuc:fPDG="<<fPDG<<"*"<<qBN<<"(fM="<<fMass<<")+sPDG="<<sPDG
    55355751          <<"*"<<qPN<<"(sM="<<sMass<<")"<<"="<<sum<<" > TotM="<<qM<<q4M<<qQC<<qS<<G4endl;
     
    55435759  else if(qS && (qM<sum || !G4QHadron(q4M).DecayIn3(f4Mom, s4Mom, t4Mom)))
    55445760  {
    5545 #ifdef pdebug
     5761#ifdef debug
    55465762    G4cout<<"***G4QNuc::DecIsonuc: "<<fPDG<<"*"<<qBN<<"("<<fMass<<")+"<<sPDG<<"*"<<qPN<<"("
    55475763          <<sMass<<")+Lamb*"<<qS<<"="<<sum<<" > TotM="<<qM<<q4M<<qQC<<G4endl;
     
    55535769    return;
    55545770  }
    5555 #ifdef pdebug
     5771#ifdef debug
    55565772  G4cout<<"G4QNuc::DecayIsonucleus: *DONE* n="<<qPN<<f4Mom<<fPDG<<", m="<<qPN<<s4Mom<<sPDG
    55575773        <<", l="<<qS<<t4Mom<<G4endl;
     
    56345850  G4double         qM = q4M.m();
    56355851  G4double         rM = qM+eps;                // Just to avoid the computer accuracy
    5636 #ifdef pdebug
     5852#ifdef debug
    56375853  G4cout<<"G4QNucl::DecayDibaryon: *Called* PDG="<<qPDG<<",4Mom="<<q4M<<", M="<<qM<<G4endl;
    56385854#endif
     
    58006016      return;
    58016017    }
    5802 #ifdef pdebug
     6018#ifdef debug
    58036019    G4cout<<"G4QNucleus::DecayDibaryon:(2) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
    58046020          <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
     
    58356051      return;
    58366052    }
    5837 #ifdef pdebug
     6053#ifdef debug
    58386054    G4cout<<"G4QNucleus::DecayDibaryon:(3) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
    58396055          <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
     
    58606076      throw G4QException("G4QNucleus::DecayDibaryon: General DecayIn2 error");
    58616077    }
    5862 #ifdef pdebug
     6078#ifdef debug
    58636079    G4cout<<"G4QNucl::DecayDibaryon:(4) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG
    58646080          <<", s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
     
    58946110      return;
    58956111    }
    5896 #ifdef pdebug
     6112#ifdef debug
    58976113    G4cout<<"G4QNuc::DecayDibaryon:(5) *DONE* f4M="<<f4Mom<<",fPDG="<<fPDG<<", s4M="<<s4Mom
    58986114          <<",sPDG="<<sPDG<<", t4M="<<t4Mom<<",tPDG="<<tPDG<<G4endl;
     
    59356151  G4int            qB = qH->GetBaryonNumber(); // BaryonNumber of the AntiStrangeNuclearSt.
    59366152  G4int            qP = qH->GetCharge();       // Charge of the AntiStranNuclState (a#of p)
    5937 #ifdef pdebug
     6153#ifdef debug
    59386154  G4cout<<"G4QNuc::DecAntS:QC="<<qQC<<",S="<<qS<<",B="<<qB<<",C="<<qP<<",4M="<<q4M<<G4endl;
    59396155#endif
     
    60376253  G4int qPDG=90000000+(qP-n2)*1000+(qN-n1);     // PDG of the Residual Nucleus
    60386254  G4double nucM = G4QNucleus(qPDG).GetGSMass(); // Mass of the Residual Nucleus
    6039 #ifdef pdebug
     6255#ifdef debug
    60406256  G4cout<<"G4QNucleus::DecayAnStran:nK0="<<n1<<",nK+="<<n2<<", nucM="<<nucM<<G4endl;
    60416257#endif
     
    60536269    n2=m2;
    60546270  }
    6055 #ifdef pdebug
     6271#ifdef debug
    60566272  G4cout<<"G4QNucleus::DecayAnStran: n1="<<n1<<", n2="<<n2<<", nM="<<nucM<<G4endl;
    60576273#endif
     
    60856301      else k1M=mK0;                      // Only anti-K0's (default k1PDG)
    60866302    }
    6087 #ifdef pdebug
     6303#ifdef debug
    60886304    G4int naPDG=90000000+(qP-1)*1000+qN; // Prot PDG of the Alternative Residual Nucleus
    60896305    G4double naM=G4QNucleus(naPDG).GetGSMass(); // Prot Mass of the Alt. Residual Nucleus
     
    61346350    else if(qM<sum || !G4QHadron(q4M).DecayIn2(f4Mom, s4Mom))
    61356351    {
    6136 #ifdef pdebug
     6352#ifdef debug
    61376353      G4cout<<"--Warning--G4QNuc::DASt:AsItIs, H="<<qQC<<q4M<<qM<<" < sum="<<sum<<"=(F)"
    61386354            <<nucM<<"+(kK)"<<n1M<<G4endl;
     
    61416357      return;
    61426358    }
    6143 #ifdef pdebug
     6359#ifdef debug
    61446360    G4cout<<"G4QNuc::DecAntiS: nK+N "<<n1<<"*K="<<k1PDG<<f4Mom<<",N="<<qPDG<<s4Mom<<G4endl;
    61456361#endif
     
    61836399      return;
    61846400    }
    6185 #ifdef pdebug
     6401#ifdef debug
    61866402    G4cout<<"G4QNuc::DecAntiS:*DONE* nPDG="<<qPDG<<",1="<<f4Mom<<",2="<<s4Mom<<",n="<<t4Mom
    61876403          <<G4endl;
     
    62326448  G4int          qPDG = qH->GetPDGCode();         // PDG Code of the decaying multybar
    62336449  G4QContent      qQC = qH->GetQC();              // PDG Code of the decaying multibar
    6234 #ifdef pdebug
     6450#ifdef debug
    62356451  G4cout<<"G4QNuc::DecayMultyBaryon: *Called* PDG="<<qPDG<<",4M="<<q4M<<qQC<<G4endl;
    62366452#endif
     
    62606476    throw G4QException("***G4QNuc::DecayMultyBaryon: Can not decay this PDG Code");
    62616477  }
    6262 #ifdef pdebug
     6478#ifdef debug
    62636479  else
    62646480  {
     
    62916507      return;
    62926508    }
    6293 #ifdef pdebug
     6509#ifdef debug
    62946510    G4cout<<"G4QNucleus::DecMulBar:*DONE* fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<G4endl;
    62956511#endif
     
    63246540      return;
    63256541    }
    6326 #ifdef pdebug
     6542#ifdef debug
    63276543    G4cout<<"G4QNuc::DecMBar:*DONE*, fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<",t="
    63286544          <<t4Mom<<G4endl;
     
    63446560    // !! OK !! Checked by the warning print that they are mostly in the Ground State !!
    63456561    G4LorentzVector f4Mom=q4M/totBN; // @@ Too simple solution (split in two parts!)
    6346 #ifdef pdebug
     6562#ifdef debug
    63476563    // Warning for the future development
    63486564    G4cout<<"*G4QNul::DecMulBar:SplitMultiBar inEqParts M="<<totBN<<"*"<<f4Mom.m()<<G4endl;
     
    63806596  G4double         qM = q4M.m();                 // Real mass of the AlphaDibaryon
    63816597  G4int          qPDG = qH->GetPDGCode();        // PDG Code of the decayin AlphaDybaryon
    6382 #ifdef pdebug
     6598#ifdef debug
    63836599  G4cout<<"G4QNuc::DecayAlphaDiN: *Called* PDG="<<qPDG<<",4M="<<q4M<<G4endl;
    63846600#endif
     
    64376653    return;
    64386654  }
    6439 #ifdef pdebug
     6655#ifdef debug
    64406656  G4cout<<"G4QNuc::DecAl2N: fPDG="<<fPDG<<",f="<<f4Mom<<",s="<<s4Mom<<",t="<<t4Mom<<G4endl;
    64416657#endif
     
    64666682  G4int          qPDG = qH->GetPDGCode();       // PDG Code of the decayin Alpha-Baryon
    64676683  G4QContent      qQC = qH->GetQC();            // PDG Code of the decaying Alpha-Bar
    6468 #ifdef pdebug
     6684#ifdef debug
    64696685  G4cout<<"G4QNucleus::DecayAlphaBar: *Called* PDG="<<qPDG<<",4M="<<q4M<<qQC<<G4endl;
    64706686#endif
     
    65246740      return;
    65256741    }
    6526 #ifdef pdebug
     6742#ifdef debug
    65276743    G4cout<<"G4QNucleus::DecAlB:*DONE*, fPDG="<<fPDG<<f4Mom<<",sPDG="<<sPDG<<s4Mom<<G4endl;
    65286744#endif
     
    65766792      return;
    65776793    }
    6578 #ifdef pdebug
     6794#ifdef debug
    65796795    G4cout<<"G4QNucl::DecAlB: *DONE*, f="<<fPDG<<f4Mom<<", s="<<sPDG<<s4Mom<<t4Mom<<G4endl;
    65806796#endif
     
    66356851      return;
    66366852    }
    6637 #ifdef pdebug
     6853#ifdef debug
    66386854    G4cout<<"G4QNuc::DecAlphaB: *DONE*, fPDG="<<fPDG<<f4Mom<<",sPDG="<<sPDG<<s4Mom<<G4endl;
    66396855#endif
     
    66796895    if(dM>0.&&dM<1.)
    66806896    {
    6681 #ifdef pdebug
     6897#ifdef debug
    66826898      G4cout<<"***Corrected***G4QNuc::DecayAlphaBar:fPDG="<<fPDG<<"(fM="<<fMass<<")+ sPDG="
    66836899            <<sPDG<<"(sM="<<sMass<<")="<<fMass+sMass<<" > TotM="<<qM<<q4M<<G4endl;
     
    67076923      return;
    67086924    }
    6709 #ifdef pdebug
     6925#ifdef debug
    67106926    G4cout<<"G4QNucl::DecAlBar:*DONE*a4M="<<f4Mom<<",s4M="<<s4Mom<<",sPDG="<<sPDG<<G4endl;
    67116927#endif
     
    67486964  G4LorentzVector q4M = qH->Get4Momentum();       // Get 4-momentum of the Dibaryon
    67496965  G4double qM=q4M.m();
    6750 #ifdef pdebug
     6966#ifdef debug
    67516967  G4cout<<"G4QNucleus::DecayAlAl: *Called* PDG="<<qPDG<<",M="<<qM<<q4M<<">"<<aaGSM<<G4endl;
    67526968#endif
     
    67756991      return;
    67766992    }
    6777 #ifdef pdebug
     6993#ifdef debug
    67786994    G4cout<<"G4QNucleus::DecayAlphaAlpha: *DONE* gam4M="<<f4Mom<<", aa4M="<<s4Mom<<G4endl;
    67796995#endif
     
    68037019    return;
    68047020  }
    6805 #ifdef pdebug
     7021#ifdef debug
    68067022  G4cout<<"G4QNucleus::DecayAlphaAlpha: *DONE* fal4M="<<f4Mom<<", sal4M="<<s4Mom<<G4endl;
    68077023#endif
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QPDGCode.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QPDGCode.cc,v 1.57 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QPDGCode.cc,v 1.63 2009/11/03 16:13:37 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QPDGCode ----------------
     
    5656  G4cout<<"G4QPDGCode:Constructer is called with PDGCode="<<PDGCode<<G4endl; 
    5757#endif
     58  if(PDGCode==130) PDGCode= 311; // Safety. Should not happen.
     59  if(PDGCode==310) PDGCode=-311; // Safety. Should not happen.
    5860  if(PDGCode) theQCode=MakeQCode(PDGCode);
    5961  else       
     
    242244                           91001999 , 90001002 , 90002001 , 91000002 , 91001001 ,     //110
    243245                           91002000 , 92000001 , 92001000 , 90999003 , 90001003 ,
    244          90002002 , 90003001 , 91001002 , 91002001 , 92000002 ,     //120
     246                           90002002 , 90003001 , 91001002 , 91002001 , 92000002 ,     //120
    245247                           92001001 , 92002000};
    246248  static G4int aC[15] = {1,1000,999001,1000000,1000999,1999000,1999999,        // sum 1
     
    268270{//      ===========================
    269271  static G4bool iniFlag=true;
    270   static G4double m[nQHM]={.511, 0., 105.65837, 0., 1777., 0.,   0., 91.188, 80.425, 140.00
    271     ,120.000,    800.,     980.,    1370.,  134.98,  139.57, 547.75, 497.65, 493.68, 957.78
    272     ,939.5654,938.272, 1115.683,  1197.45, 1192.64, 1189.37, 1321.3, 1314.8,  775.8,  775.8
    273     ,  782.6,   896.1,   891.66, 1019.456,   1232.,   1232.,  1232.,  1232., 1519.5, 1387.2
     272  static G4double m[nQHM]={.511, 0., 105.65837, 0., 1777., 0.,   0., 91188., 80403., 140.00
     273    ,120.000,    800.,     980.,    1370.,  134.98,  139.57, 547.51, 497.65, 493.68, 957.78
     274    ,939.5654,938.272, 1115.683,  1197.45, 1192.64, 1189.37,1321.31,1314.83,  775.5,  775.5
     275    , 782.65,   896.0,   891.66,  1019.46,   1232.,   1232.,  1232.,  1232., 1519.5, 1387.2
    274276    , 1383.7,  1382.8,    1535.,   1531.8, 1672.45,  1318.3, 1318.3, 1275.4, 1432.4, 1425.6
    275277    ,  1525.,   1680.,    1680.,    1820.,   1915.,   1915.,  1915.,  2025.,  2025.,  1691.
     
    19261928    if(A==256 && Z==128) m=256000.;
    19271929    else                 m=k+G4NucleiProperties::GetNuclearMass(A,Z);
    1928     //if(G4NucleiPropertiesTable::IsInTable(Z,A))
    1929     //                                         m=k+G4NucleiProperties::GetNuclearMass(A,Z);
    1930     //else if(A==256 && Z==128) m=256000.;
    1931     //else
    1932     //  m=k+G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z)->GetPDGMass();
    1933    //m+=-sh[Z]-sh[N]+b1*D*D*pow(fA,b2)+b3*(1.-2./(1.+exp(b4*D)))+Z*Z*(b5*pow(fA,b9)+b6/fA);
    19341930  }
    19351931  //@@//G4double maxM= k+Z*mP+N*mN+S*mL+eps;      // @@ eps -- Wings of the Mass parabola
     
    19681964      // G4ParticleTable::GetParticleTable()->FindIon(Zm,Am,0,Zm) creates new Ion!
    19691965      mm=km+G4NucleiProperties::GetNuclearMass(Am,Zm);
    1970       //G4double fA=Am;
    1971       //if(G4NucleiPropertiesTable::IsInTable(Zm,Am))
    1972       //  mm=km+G4NucleiProperties::GetNuclearMass(Am,Zm);
    1973       //else
    1974       //  mm=km+G4ParticleTable::GetParticleTable()->FindIon(Zm,Am,0,Zm)->GetPDGMass();
    1975       //  //mm+=-sh[Zm]-sh[Nm]+b1*Dm*Dm*pow(fA,b2)+b3*(1.-2./(1.+exp(b4*Dm)))
    1976       //  //    +Zm*Zm*(b5*pow(fA,b9)+b6/Am);
    19771966    }
    19781967    //@@//G4double mM= km+Zm*mP+Nm*mN+eps;
     
    20242013  else if(ab<99)
    20252014  {
     2015    if     (thePDGCode== 11) return G4QContent(1,0,0,0,1,0);
     2016    else if(thePDGCode==-11) return G4QContent(0,1,0,1,0,0);
     2017    else if(thePDGCode== 13) return G4QContent(1,0,0,0,1,0);
     2018    else if(thePDGCode==-13) return G4QContent(0,1,0,1,0,0);
     2019    else if(thePDGCode== 15) return G4QContent(1,0,0,0,1,0);
     2020    else if(thePDGCode==-15) return G4QContent(0,1,0,1,0,0);
    20262021#ifdef debug
    20272022    if     (ab==22) G4cout<<"-W-G4QPDGC::GetQuarkCont: For the Photon? - Return 0"<<G4endl;
     
    23442339  return;
    23452340}
     2341
     2342// Only for irreducable DiQaDiQ! L1!=R1 && L1!=R2 && L2!=R1 && L2!=R2
     2343std::pair<G4int,G4int> G4QPDGCode::MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2)
     2344{//  ====================================================================================
     2345  G4int dl=0;
     2346  G4int ul=0;
     2347  //G4int sl=0;
     2348  if     (L1==1) ++dl;
     2349  else if(L1==2) ++ul;
     2350  //else if(L1==3) ++sl;
     2351  if     (L2==1) ++dl;
     2352  else if(L2==2) ++ul;
     2353  //else if(L2==3) ++sl;
     2354  if     (R1==1) ++dl;
     2355  else if(R1==2) ++ul;
     2356  //else if(R1==3) ++sl;
     2357  if     (R2==1) ++dl;
     2358  else if(R2==2) ++ul;
     2359  //else if(R2==3) ++sl;
     2360  if     (dl==2 && ul==2) return make_pair(1114,2212); // @@ can be (2112,2224)
     2361  else if(dl==1 && ul==2) return make_pair(3112,2212);
     2362  else if(dl==0 && ul==2) return make_pair(3212,3212); // @@ can be (3312,2212)
     2363  else if(dl==2 && ul==1) return make_pair(3222,2112);
     2364  else if(dl==1 && ul==1) return make_pair(3312,2112); // @@ can be (3322,2212)
     2365  else if(dl==2 && ul==0) return make_pair(3112,3112); // @@ can be (3322,1122)
     2366  //#ifdef debug
     2367  else G4cout<<"-Warning-G4QPDGCode::MakeTwoBaryons: Irreduceble? L1="<<L1<<",L2="<<L2
     2368             <<",R1="<<R1<<",R2="<<R2<<G4endl;
     2369  //#endif
     2370  return make_pair(2212,2112);                         // @@ Just theMinimum, makeException
     2371}
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QParentCluster.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QParentCluster.cc,v 1.26 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QParentCluster ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QParticle.cc

    r1055 r1196  
    2626//
    2727// $Id: G4QParticle.cc,v 1.34 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030//      ---------------- G4QParticle ----------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QParton.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QParton.cc,v 1.4 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QParton.cc,v 1.9 2009/07/17 16:54:57 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// ------------------------------------------------------------
     
    4040// are quarks and some times gluons.
    4141// ------------------------------------------------------------------------
     42
     43//#define debug
     44
    4245#include "G4QParton.hh"
    4346
    44 G4QParton::G4QParton(G4int PDGcode)
    45 {
    46   PDGencoding=PDGcode;
    47   theX = 0;
    48   theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding);
    49        G4int aPDG=std::abs(PDGcode);
    50   //___________quarks__ 2 possible codes for gluons _ Condition for di-quarks
    51   if(!aPDG || (aPDG>3 && PDGcode!=9 && PDGcode!=21 &&
    52           (aPDG>3303||aPDG<1103||aPDG%100>3)) || theDefinition==0)
    53   {
    54     G4cerr<<"***G4QParton::Constructor: wrong quark/diquark PDG="<<PDGcode<<G4endl;
    55          G4Exception("G4QParton::Constructor:","72",FatalException,"WrongPartonPDG");
    56   }
     47G4QParton::G4QParton() // By default creates only quarks (not di-quarks)
     48{
     49  // CHIPS is working only with u, d, and s quarks (SU(3)xSU(3)) (no gluons! M.K.)
     50  // Random Flavor/Colour/Spin definition for default constructor (with .3 s-suppresion)
     51  PGGCode=(G4int)(2.3*G4UniformRand())+1; //@@ Additional parameter of s/u (M.K.)
     52  theType=1;
     53#ifdef debug
     54  G4cout<<"....G4QParton::DefConstructer: PDG = "<<PGGCode<<", Type="<<theType<<G4endl;
     55#endif
     56  // random colour (1,2,3)=(R,G,B) for quarks and (-1,-2,-3)=(aR,aG,aB) for anti-quarks
     57  theColour = (G4int)(3*G4UniformRand())+1;
     58  if(theColour>3) theColour = 3;                   // Should never happend
     59  theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
     60  QCont = G4QContent(0,0,0,0,0,0); 
     61  // Default definition (initialization)
     62  theX = 0.;
     63  thePosition=G4ThreeVector(0.,0.,0.);
     64  theMomentum=G4LorentzVector(0.,0.,0.,0.);
     65}
     66
     67G4QParton::G4QParton(G4int PDG)
     68{
     69  SetPDGCode(PDG);
     70  // Default definition (initialization)
     71  theX = 0.;
     72  thePosition=G4ThreeVector(0.,0.,0.);
     73  theMomentum=G4LorentzVector(0.,0.,0.,0.);
     74}
     75
     76G4QParton::G4QParton(const G4QParton &right)
     77{
     78  PGGCode     = right.PGGCode;
     79  QCont       = right.QCont;
     80  theType     = right.theType;
     81  theMomentum = right.theMomentum;
     82  thePosition = right.thePosition;
     83  theX        = right.theX;
     84  theColour   = right.theColour;
     85  theSpinZ    = right.theSpinZ;
     86#ifdef debug
     87  G4cout<<"G4QParton::RCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
     88        <<theSpinZ<<G4endl;
     89#endif
     90}
     91
     92G4QParton::G4QParton(const G4QParton* right)
     93{
     94  PGGCode       = right->PGGCode;
     95  QCont         = right->QCont;
     96  theType       = right->theType;
     97  theMomentum   = right->theMomentum;
     98  thePosition   = right->thePosition;
     99  theX          = right->theX;
     100  theColour     = right->theColour;
     101  theSpinZ      = right->theSpinZ;
     102#ifdef debug
     103  G4cout<<"G4QParton::PCopyConstructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
     104        <<theSpinZ<<G4endl;
     105#endif
     106}
     107
     108const G4QParton& G4QParton::operator=(const G4QParton &right)
     109{
     110  if(this != &right)                          // Beware of self assignment
     111  {
     112    PGGCode     = right.GetPDGCode();
     113    QCont       = right.QCont;
     114    theType     = right.GetType();
     115    theMomentum = right.Get4Momentum();
     116    thePosition = right.GetPosition();
     117    theX        = right.theX;
     118    theColour   = right.theColour;
     119    theSpinZ    = right.theSpinZ;
     120#ifdef debug
     121    G4cout<<"G4QParton::=Constructer: PDG="<<PGGCode<<", Col="<<theColour<<", Sz="
     122          <<theSpinZ<<G4endl;
     123#endif
     124  }
     125  return *this;
     126}
     127
     128G4QParton::~G4QParton() {}
     129
     130// Redefine the parton nature without changing x, 4Mom, Pos etc.
     131void G4QParton::SetPDGCode(G4int PDG)
     132{
     133  PGGCode=PDG;
     134  G4int aPDG=std::abs(PDG);
     135  if(aPDG < 3304 && aPDG > 1100 && aPDG%100 < 4) // di-quark
     136  {
     137    theType=2;
     138    G4int cPDG=aPDG/100;
     139    if(PDG>0)
     140    {
     141      if     (cPDG==11) QCont=G4QContent(2,0,0,0,0,0);   // dd
     142      else if(cPDG==21) QCont=G4QContent(1,1,0,0,0,0);   // ud
     143      else if(cPDG==22) QCont=G4QContent(0,2,0,0,0,0);   // uu
     144      else if(cPDG==31) QCont=G4QContent(1,0,1,0,0,0);   // sd
     145      else if(cPDG==32) QCont=G4QContent(0,1,1,0,0,0);   // su
     146      else if(cPDG==33) QCont=G4QContent(0,0,2,0,0,0);   // ss
     147      else
     148      {
     149        G4cerr<<"***G4QParton::SetPDGCode: bad di-quark PDG="<<PDG<<G4endl;
     150        G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) DiQuark");
     151      }
     152    }
     153    else
     154    {
     155      if     (cPDG==11) QCont=G4QContent(0,0,0,2,0,0);   // anti-dd
     156      else if(cPDG==21) QCont=G4QContent(0,0,0,1,1,0);   // anti-ud
     157      else if(cPDG==22) QCont=G4QContent(0,0,0,0,2,0);   // anti-uu
     158      else if(cPDG==31) QCont=G4QContent(0,0,0,1,0,1);   // anti-sd
     159      else if(cPDG==32) QCont=G4QContent(0,0,0,0,1,1);   // anti-su
     160      else if(cPDG==33) QCont=G4QContent(0,0,0,0,0,2);   // anti-ss
     161      else
     162      {
     163        G4cerr<<"***G4QParton::SetPDGCode: bad anti-di-quark PDG="<<PDG<<G4endl;
     164        G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) AntiDiQuark");
     165      }
     166    }
     167  }
     168  else if(aPDG && aPDG<4)                        // quark
     169  {
     170    theType=1;
     171    if(PDG>0)
     172    {
     173      if     (PDG==1) QCont=G4QContent(1,0,0,0,0,0);   // d
     174      else if(PDG==2) QCont=G4QContent(0,1,0,0,0,0);   // u
     175      else if(PDG==3) QCont=G4QContent(0,0,1,0,0,0);   // s
     176      else
     177      {
     178        G4cerr<<"***G4QParton::SetPDGCode: bad quark PDG="<<PDG<<G4endl;
     179        G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Quark");
     180      }
     181    }
     182    else
     183    {
     184      if     (PDG==-1) QCont=G4QContent(0,0,0,1,0,0);  // anti-d
     185      else if(PDG==-2) QCont=G4QContent(0,0,0,0,1,0);  // anti-u
     186      else if(PDG==-3) QCont=G4QContent(0,0,0,0,0,1);  // anti-s
     187      else
     188      {
     189        G4cerr<<"***G4QParton::SetPDGCode: bad anti-quark PDG="<<PDG<<G4endl;
     190        G4Exception("G4QParton::SetPDGCode:","72",FatalException,"Not SU(3) Anti-Quark");
     191      }
     192    }
     193  }
     194  else if(aPDG==9 || aPDG==21)                   // gluon
     195  {
     196    theType=0;
     197    QCont=G4QContent(0,0,0,0,0,0);
     198  }
     199  else
     200  {
     201    G4cerr<<"***G4QParton::SetPDGCode: wrong gluon/quark/diquark PDG="<<PDG<<G4endl;
     202    G4Exception("G4QParton::SetPDGCode:","72",FatalException,"WrongPartonPDG");
     203  }
     204#ifdef debug
     205  G4cout<<"....G4QParton::SetPDGCode: PDG = "<<PDG<<", Type="<<theType<<G4endl;
     206#endif
    57207  //
    58208  // colour by random in (1,2,3)=(R,G,B) for quarks and
    59209  //                  in (-1,-2,-3)=(Rbar,Gbar,Bbar) for anti-quarks:
    60        G4int RGB=(G4int)(3*G4UniformRand())+1;
    61   G4String name=theDefinition->GetParticleType();
    62   if(name == "quarks")
    63   {
    64     if(PDGcode>0) theColour = RGB;
    65     else          theColour =-RGB;
     210  G4int RGB=(G4int)(3*G4UniformRand())+1;
     211  if(theType==1)
     212  {
     213    if(PDG>0) theColour = RGB;
     214    else      theColour =-RGB;
    66215  }
    67216  // colour by random in (-1,-2,-3)=(Rbar,Gbar,Bbar)=(GB,RB,RG) for di-quarks and
    68217  //                  in (1,2,3)=(R,G,B)=(GB,RB,RG) for anti-di-quarks:
    69   else if(name == "diquarks")
    70   {
    71     if(PDGcode>0) theColour =-RGB;
    72     else          theColour = RGB;
     218  else if(theType==2)
     219  {
     220    if(PDG>0) theColour =-RGB;
     221    else      theColour = RGB;
    73222  }
    74223  // ColourByRandom (-11,-12,-13,-21,...,-33)=(RRbar,RGbar,RBbar,...,BBbar) for gluons
    75   else if(name == "gluons") theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
    76   else
    77   {
    78     G4cerr<<"***G4QParton::Constructor: not quark/diquark/gluon = "
    79           <<theDefinition->GetParticleType()<<G4endl;
    80     G4Exception("G4QParton::Constructor:","72",FatalException,"WrongParton");
    81   }
    82   // isospin-z from PDG-encoded isospin-z for
    83   // quarks, anti-quarks, di-quarks, and anti-di-quarks:
    84   if(name == "quarks" || name == "diquarks") theIsoSpinZ = theDefinition->GetPDGIsospin3();
    85        // isospin-z choosen at random from PDG-encoded isospin for gluons (should be zero):
    86   else
    87   {
    88     G4int thisPDGiIsospin=theDefinition->GetPDGiIsospin();
    89     if (thisPDGiIsospin == 0) theIsoSpinZ = 0;
    90          //@@ ? M.K.
    91     else theIsoSpinZ=((G4int)((thisPDGiIsospin+1)*G4UniformRand())) - thisPDGiIsospin*0.5;
    92   }
     224  else theColour = -(RGB*10 + (G4int)(3*G4UniformRand())+1);
    93225  //
    94226  // spin-z choosen at random from PDG-encoded spin:
    95227  //
    96   G4int thisPDGiSpin=theDefinition->GetPDGiSpin();
    97   if(thisPDGiSpin == 0) theSpinZ = 0;
    98   else theSpinZ = (G4int)((thisPDGiSpin+1)*G4UniformRand())-thisPDGiSpin*0.5;;
    99 }
    100 
    101 G4QParton::G4QParton(const G4QParton &right)
    102 {
    103   PDGencoding = right.PDGencoding;
    104   theMomentum = right.theMomentum;
    105   thePosition = right.thePosition;
    106   theX = right.theX;
    107   theDefinition = right.theDefinition;
    108   theColour = right.theColour;
    109   theIsoSpinZ = right.theIsoSpinZ;
    110   theSpinZ = right.theSpinZ;
    111 }
    112 
    113 G4QParton::G4QParton(const G4QParton* right)
    114 {
    115   PDGencoding   = right->PDGencoding;
    116   theMomentum   = right->theMomentum;
    117   thePosition   = right->thePosition;
    118   theX          = right->theX;
    119   theDefinition = right->theDefinition;
    120   theColour     = right->theColour;
    121   theIsoSpinZ   = right->theIsoSpinZ;
    122   theSpinZ      = right->theSpinZ;
    123 }
    124 
    125 const G4QParton& G4QParton::operator=(const G4QParton &right)
    126 {
    127   if(this != &right)                          // Beware of self assignment
    128   {
    129     PDGencoding=right.GetPDGCode();
    130     theMomentum=right.Get4Momentum();
    131     thePosition=right.GetPosition();
    132     theX = right.theX;
    133     theDefinition = right.theDefinition;
    134     theColour = right.theColour;
    135     theIsoSpinZ = right.theIsoSpinZ;
    136     theSpinZ = right.theSpinZ;
    137   }
    138   return *this;
    139 }
    140 
    141 G4QParton::~G4QParton()
    142 {
    143   //G4cout << "G4QParton::~G4QParton(): this = "<<this <<G4endl;
    144   //G4cout << "break here"<<this <<G4endl;
    145 }
    146 
     228  G4double            dPDGSpin=1.;        // Quark 2S
     229  if     (theType==0) dPDGSpin=2.;        // Gluon 2S
     230  else if(theType==2) dPDGSpin=aPDG%10-1; // Di-quark 2S
     231  theSpinZ = (G4int)((dPDGSpin+1)*G4UniformRand())-dPDGSpin/2;
     232}
     233
     234// QGS x+/x- logic of the Energy and Pz calculation
    147235void G4QParton::DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection)
    148236{
    149   G4double Mass = GetMass();
    150237  G4LorentzVector a4Momentum = Get4Momentum();
    151238  aLightConeMomentum*=theX;
    152   G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py()) + sqr(Mass);
     239  G4double TransverseMass2 = sqr(a4Momentum.px()) + sqr(a4Momentum.py());
    153240  a4Momentum.setPz(0.5*(aLightConeMomentum - TransverseMass2/aLightConeMomentum) *
    154241                                                                      (aDirection? 1: -1));
     
    156243  Set4Momentum(a4Momentum);
    157244
     245
     246// Reduce DiQ-aDiQ to Q-aQ (true if succeeded). General function of the QPartons operations
     247G4bool G4QParton::ReduceDiQADiQ(G4QParton* d1, G4QParton* d2)
     248{
     249  G4bool result=false;
     250  G4int sPDG=d1->GetPDGCode();
     251  G4int nPDG=d2->GetPDGCode();
     252#ifdef debug
     253  G4cout<<"G4QParton::ReduceDiQADiQ: **Called** LPDG="<<sPDG<<", RPDG="<<nPDG<<G4endl;
     254#endif
     255  G4int        qPDG=sPDG;
     256  if(qPDG<-99) qPDG=(-qPDG)/100;
     257  else         qPDG/=100;
     258  G4int        dPDG=nPDG;
     259  if(dPDG<-99) dPDG=(-dPDG)/100;
     260  else         dPDG/=100;
     261  G4int L1=qPDG/10;
     262  G4int L2=qPDG%10;
     263  G4int R1=dPDG/10;
     264  G4int R2=dPDG%10;
     265  if(L1==R1 || L1==R2 || L2==R1 || L2==R2) // Annihilation condition
     266  {
     267    if     (L1==R1)
     268    {
     269      if(sPDG>0) sPDG=L2;
     270      else       sPDG=-L2;
     271      if(nPDG>0) nPDG=R2;
     272      else       nPDG=-R2;
     273#ifdef debug
     274      G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
     275#endif
     276    }
     277    else if(L1==R2)
     278    {
     279      if(sPDG>0) sPDG=L2;
     280      else       sPDG=-L2;
     281      if(nPDG>0) nPDG=R1;
     282      else       nPDG=-R1;
     283#ifdef debug
     284      G4cout<<"G4QParton::ReDiQADiQ:L2="<<L2<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
     285#endif
     286    }
     287    else if(L2==R1)
     288    {
     289      if(sPDG>0) sPDG=L1;
     290      else       sPDG=-L1;
     291      if(nPDG>0) nPDG=R2;
     292      else       nPDG=-R2;
     293#ifdef debug
     294      G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R2="<<R2<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
     295#endif
     296    }
     297    else //(L2==R2)
     298    {
     299      if(sPDG>0) sPDG=L1;
     300      else       sPDG=-L1;
     301      if(nPDG>0) nPDG=R1;
     302      else       nPDG=-R1;
     303#ifdef debug
     304      G4cout<<"G4QParton::ReDiQADiQ:L1="<<L1<<",R1="<<R1<<",L="<<sPDG<<",R="<<nPDG<<G4endl;
     305#endif
     306    }
     307    d1->SetPDGCode(sPDG);             // Reset the left quark
     308    d2->SetPDGCode(nPDG);            // Reset the right quark
     309    result=true;
     310#ifdef debug
     311    G4cout<<"G4QParton::ReduceDiQADiQ:AfterReduction,L="<<sPDG<<",R="<<nPDG<<G4endl;
     312#endif
     313  }
     314#ifdef debug
     315  else G4cout<<"-Warning-G4QParton::ReduceDiQADiQ:DQ-aDQ reduction to Q-aQ Failed"<<G4endl;
     316#endif
     317  return result;
     318}
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QPartonPair.cc

    r1055 r1196  
    2727//
    2828// $Id: G4QPartonPair.cc,v 1.2 2009/02/23 09:49:24 mkossov Exp $
    29 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     29// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3030//
    3131// ------------------------------------------------------------
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4QString.cc

    r1055 r1196  
    2525//
    2626//
    27 // $Id: G4QString.cc,v 1.5 2009/02/23 09:49:24 mkossov Exp $
    28 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     27// $Id: G4QString.cc,v 1.17 2009/09/04 14:38:00 mkossov Exp $
     28// GEANT4 tag $Name: geant4-09-03-cand-01 $
    2929//
    3030// ------------------------------------------------------------
     
    5050
    5151//#define debug
     52//#define pdebug
     53//#define edebug
    5254
    5355#include "G4QString.hh"
     
    5557// Static parameters definition
    5658G4double G4QString::MassCut=350.*MeV;     // minimum mass cut for the string
    57 G4double G4QString::ClusterMass=150.*MeV; // minimum cluster mass for fragmentation
    5859G4double G4QString::SigmaQT=0.5*GeV;      // quarkTransverseMomentum distribution parameter
    5960G4double G4QString::DiquarkSuppress=0.1;  // is Diquark suppression parameter 
     
    6263G4double G4QString::StrangeSuppress=0.435;// Strangeness suppression (u:d:s=1:1:0.3 ?M.K.)
    6364G4double G4QString::widthOfPtSquare=-0.72*GeV*GeV; // pt -width2 forStringExcitation
    64 G4int G4QString::StringLoopInterrupt=999; // String fragmentation LOOP limit
    65 G4int G4QString::ClusterLoopInterrupt=500;// Cluster fragmentation LOOP limit
    66 
    67 G4QString::G4QString() : theDirection(0),thePosition(G4ThreeVector(0.,0.,0.)),
    68  hadronizer(new G4QHadronBuilder){}
    69 
    70 G4QString::G4QString(G4QParton* Color, G4QParton* AntiColor, G4int Direction) :
    71   hadronizer(new G4QHadronBuilder)
    72 {
     65
     66G4QString::G4QString() : theDirection(0), thePosition(G4ThreeVector(0.,0.,0.)) {}
     67
     68G4QString::G4QString(G4QParton* Color, G4QParton* AntiColor, G4int Direction)
     69{
     70#ifdef debug
     71  G4cout<<"G4QString::PPD-Constructor: Direction="<<Direction<<G4endl;
     72#endif
    7373  ExciteString(Color, AntiColor, Direction);
     74#ifdef debug
     75  G4cout<<"G4QString::PPD-Constructor: >>> String is excited"<<G4endl;
     76#endif
     77}
     78
     79G4QString::G4QString(G4QPartonPair* CAC)
     80{
     81#ifdef debug
     82  G4cout<<"G4QString::PartonPair-Constructor: Is CALLED"<<G4endl;
     83#endif
     84  ExciteString(CAC->GetParton1(), CAC->GetParton2(), CAC->GetDirection());
     85#ifdef debug
     86  G4cout<<"G4QString::PartonPair-Constructor: >>> String is excited"<<G4endl;
     87#endif
    7488}
    7589
    7690G4QString::G4QString(G4QParton* QCol,G4QParton* Gluon,G4QParton* QAntiCol,G4int Direction):
    77   theDirection(Direction),thePosition(QCol->GetPosition()),hadronizer(new G4QHadronBuilder)
     91  theDirection(Direction), thePosition(QCol->GetPosition())
    7892{
    7993  thePartons.push_back(QCol);
     94  G4LorentzVector sum=QCol->Get4Momentum();
    8095  thePartons.push_back(Gluon);
     96  sum+=Gluon->Get4Momentum();
    8197  thePartons.push_back(QAntiCol);
     98  sum+=QAntiCol->Get4Momentum();
     99  Pplus =sum.e() + sum.pz();
     100  Pminus=sum.e() - sum.pz();
     101  decaying=None;
    82102}
    83103
    84104G4QString::G4QString(const G4QString &right) : theDirection(right.GetDirection()),
    85 thePosition(right.GetPosition()), hadronizer(new G4QHadronBuilder){}
     105thePosition(right.GetPosition())
     106{
     107  //LeftParton=right.LeftParton;
     108  //RightParton=right.RightParton;
     109  Ptleft=right.Ptleft;
     110  Ptright=right.Ptright;
     111  Pplus=right.Pplus;
     112  Pminus=right.Pminus;
     113  decaying=right.decaying;
     114}
    86115
    87116G4QString::~G4QString()
    88  {if(thePartons.size())std::for_each(thePartons.begin(),thePartons.end(),DeleteQParton());}
     117{if(thePartons.size()) std::for_each(thePartons.begin(),thePartons.end(),DeleteQParton());}
    89118
    90119G4LorentzVector G4QString::Get4Momentum() const
     
    101130}
    102131
    103 void G4QString::InsertParton(G4QParton* aParton, const G4QParton* addafter)
    104 {
    105   G4QPartonVector::iterator insert_index;   // Begin by default (? M.K.)
    106  
    107   if(addafter != NULL)
    108   {
    109     insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
    110     if (insert_index == thePartons.end())  // No object addafter in thePartons
    111     {
    112       G4cerr<<"***G4QString::InsertParton: Address Parton is not found"<<G4endl;
    113       G4Exception("G4QString::InsertParton:","72",FatalException,"NoAddressParton");
    114     }
    115   }
    116   thePartons.insert(insert_index+1, aParton);
    117 }
    118 
    119 G4LorentzRotation G4QString::TransformToCenterOfMass()
    120 {
    121   G4LorentzRotation toCms(-1*Get4Momentum().boostVector());
    122   for(unsigned i=0; i<thePartons.size(); i++)
    123                       thePartons[i]->Set4Momentum(toCms*thePartons[i]->Get4Momentum());
    124   return toCms;
    125 }
    126 
    127 G4LorentzRotation G4QString::TransformToAlignedCms()
    128 {
    129   G4LorentzVector momentum=Get4Momentum();
    130   G4LorentzRotation toAlignedCms(-1*momentum.boostVector());
    131   momentum= toAlignedCms* thePartons[0]->Get4Momentum();
    132   toAlignedCms.rotateZ(-1*momentum.phi());
    133   toAlignedCms.rotateY(-1*momentum.theta());
    134   for(unsigned index=0; index<thePartons.size(); index++)
    135   {
    136     momentum=toAlignedCms * thePartons[index]->Get4Momentum();
    137     thePartons[index]->Set4Momentum(momentum);
    138   }
    139   return toAlignedCms;
    140 }
     132//void G4QString::InsertParton(G4QParton* aParton, const G4QParton* addafter)
     133//{
     134//  G4QPartonVector::iterator insert_index;   // Begin by default (? M.K.)
     135//  if(addafter != NULL)
     136//  {
     137//    insert_index=std::find(thePartons.begin(), thePartons.end(), addafter);
     138//    if (insert_index == thePartons.end())  // No object addafter in thePartons
     139//    {
     140//      G4cerr<<"***G4QString::InsertParton: Addressed Parton is not found"<<G4endl;
     141//      G4Exception("G4QString::InsertParton:","72",FatalException,"NoAddressParton");
     142//    }
     143//  }
     144//  thePartons.insert(insert_index+1, aParton);
     145//}
    141146
    142147void G4QString::Boost(G4ThreeVector& Velocity)
     
    150155}
    151156
    152 G4QParton* G4QString::GetColorParton(void) const
    153 {
    154   G4QParton* start = *(thePartons.begin());
    155   G4QParton* end = *(thePartons.end()-1);
    156   G4int Encoding = start->GetPDGCode();
    157   if (Encoding<-1000 || (Encoding  < 1000 && Encoding > 0)) return start;
    158   return end;
    159 }
    160 
    161 G4QParton* G4QString::GetAntiColorParton(void) const
    162 {
    163   G4QParton* start = *(thePartons.begin());
    164   G4QParton* end = *(thePartons.end()-1);
    165   G4int Encoding = start->GetPDGCode();
    166   if (Encoding < -1000 || (Encoding  < 1000 && Encoding > 0)) return end;
    167   return start;
    168 }
     157//G4QParton* G4QString::GetColorParton(void) const
     158//{
     159//  G4QParton* start = *(thePartons.begin());
     160//  G4QParton* end = *(thePartons.end()-1);
     161//  G4int Encoding = start->GetPDGCode();
     162//  if (Encoding<-1000 || (Encoding  < 1000 && Encoding > 0)) return start;
     163//  return end;
     164//}
     165
     166//G4QParton* G4QString::GetAntiColorParton(void) const
     167//{
     168//  G4QParton* start = *(thePartons.begin());
     169//  G4QParton* end = *(thePartons.end()-1);
     170//  G4int Encoding = start->GetPDGCode();
     171//  if (Encoding < -1000 || (Encoding  < 1000 && Encoding > 0)) return end;
     172//  return start;
     173//}
    169174
    170175// Fill parameters
    171 void G4QString::SetParameters(G4double mCut,G4double clustM, G4double sigQT,G4double DQSup,
    172     G4double DQBU, G4double smPar, G4double SSup, G4double SigPt, G4int SLmax, G4int CLmax)
     176void G4QString::SetParameters(G4double mCut, G4double sigQT, G4double DQSup, G4double DQBU,
     177                              G4double smPar, G4double SSup, G4double SigPt)
    173178{//  =============================================================================
    174179  MassCut         = mCut;           // minimum mass cut for the string
    175   ClusterMass     = clustM;         // minimum cluster mass for the fragmentation
    176180  SigmaQT         = sigQT;          // quark transverse momentum distribution parameter
    177181  DiquarkSuppress = DQSup;          // is Diquark suppression parameter 
     
    180184  StrangeSuppress = SSup;           // Strangeness suppression parameter
    181185  widthOfPtSquare = -2*SigPt*SigPt; // width^2 of pt for string excitation
    182   StringLoopInterrupt = SLmax;      // String fragmentation LOOP limit
    183   ClusterLoopInterrupt= CLmax;      // Cluster fragmentation LOOP limit
    184186}
    185187
     
    194196
    195197// Diffractively excite the string
    196 void G4QString::DiffString(G4QHadron* hadron, G4bool isProjectile)
    197 {
    198   hadron->SplitUp();
    199   G4QParton* start = hadron->GetNextParton();
    200   if( start==NULL)
    201   {
    202     G4cerr<<"***G4QString::DiffString: No start parton found, nothing is done"<<G4endl;
    203     return;
    204   }
    205   G4QParton* end = hadron->GetNextParton();
    206   if( end==NULL)
    207   {
    208     G4cerr<<"***G4QString::DiffString: No end parton found, nothing is done"<<G4endl;
    209     return;
    210   }
    211   if(isProjectile) ExciteString(end, start, 1); //  1 = Projectile
    212   else             ExciteString(start, end,-1); // -1 = Target
    213   SetPosition(hadron->GetPosition());
    214   // momenta of string ends
    215   G4double ptSquared= hadron->Get4Momentum().perp2();
    216   G4double hmins=hadron->Get4Momentum().minus();
    217   G4double hplus=hadron->Get4Momentum().plus();
    218   G4double transMassSquared=hplus*hmins;
    219   G4double maxMomentum = std::sqrt(transMassSquared) - std::sqrt(ptSquared);
    220   G4double maxAvailMomentumSquared = maxMomentum * maxMomentum;
    221   G4ThreeVector pt=GaussianPt(widthOfPtSquare,maxAvailMomentumSquared);
    222   G4LorentzVector Pstart(G4LorentzVector(pt,0.));
    223   G4LorentzVector Pend(hadron->Get4Momentum().px(), hadron->Get4Momentum().py(), 0.);
    224   Pend-=Pstart;
    225   G4double tm1=hmins+(Pend.perp2()-Pstart.perp2())/hplus;
    226   G4double tm2=std::sqrt( std::max(0., tm1*tm1-4*Pend.perp2()*hmins/hplus ) );
    227   G4int Sign= isProjectile ? TARGET : PROJECTILE;
    228   G4double endMinus  = 0.5 * (tm1 + Sign*tm2);
    229   G4double startMinus= hmins - endMinus;
    230   G4double startPlus = Pstart.perp2() / startMinus;
    231   G4double endPlus   = hplus - startPlus;
    232   Pstart.setPz(0.5*(startPlus - startMinus));
    233   Pstart.setE (0.5*(startPlus + startMinus));
    234   Pend.setPz  (0.5*(endPlus - endMinus));
    235   Pend.setE   (0.5*(endPlus + endMinus));
    236   start->Set4Momentum(Pstart);
    237   end->Set4Momentum(Pend);
    238 #ifdef debug
    239   G4cout<<"G4QString::DiffString: StartQ="<<start->GetPDGCode()<<start->Get4Momentum()<<"("
    240         <<start->Get4Momentum().mag()<<"), EndQ="<<end->GetPDGCode()<<end ->Get4Momentum()
    241         <<"("<<end->Get4Momentum().mag()<<"), sumOfEnds="<<Pstart+Pend<<", H4M(original)="
    242         <<hadron->Get4Momentum()<<G4endl;
    243 #endif
    244 } // End of DiffString (The string is excited diffractively)
     198//void G4QString::DiffString(G4QHadron* hadron, G4bool isProjectile)
     199//{
     200//  hadron->SplitUp();
     201//  G4QParton* start = hadron->GetNextParton();
     202//  if( start==NULL)
     203//  {
     204//    G4cerr<<"***G4QString::DiffString: No start parton found, nothing is done"<<G4endl;
     205//    return;
     206//  }
     207//  G4QParton* end = hadron->GetNextParton();
     208//  if( end==NULL)
     209//  {
     210//    G4cerr<<"***G4QString::DiffString: No end parton found, nothing is done"<<G4endl;
     211//    return;
     212//  }
     213//  if(isProjectile) ExciteString(end, start, 1); //  1 = Projectile
     214//  else             ExciteString(start, end,-1); // -1 = Target
     215//  SetPosition(hadron->GetPosition());
     216//  // momenta of string ends
     217//  G4double ptSquared= hadron->Get4Momentum().perp2();
     218//  G4double hmins=hadron->Get4Momentum().minus();
     219//  G4double hplus=hadron->Get4Momentum().plus();
     220//  G4double transMassSquared=hplus*hmins;
     221//  G4double maxMomentum = std::sqrt(transMassSquared) - std::sqrt(ptSquared);
     222//  G4double maxAvailMomentumSquared = maxMomentum * maxMomentum;
     223//  G4ThreeVector pt=GaussianPt(widthOfPtSquare,maxAvailMomentumSquared);
     224//  G4LorentzVector Pstart(G4LorentzVector(pt,0.));
     225//  G4LorentzVector Pend(hadron->Get4Momentum().px(), hadron->Get4Momentum().py(), 0.);
     226//  Pend-=Pstart;
     227//  G4double tm1=hmins+(Pend.perp2()-Pstart.perp2())/hplus;
     228//  G4double tm2=std::sqrt( std::max(0., tm1*tm1-4*Pend.perp2()*hmins/hplus ) );
     229//  G4int Sign= isProjectile ? TARGET : PROJECTILE;
     230//  G4double endMinus  = 0.5 * (tm1 + Sign*tm2);
     231//  G4double startMinus= hmins - endMinus;
     232//  G4double startPlus = Pstart.perp2() / startMinus;
     233//  G4double endPlus   = hplus - startPlus;
     234//  Pstart.setPz(0.5*(startPlus - startMinus));
     235//  Pstart.setE (0.5*(startPlus + startMinus));
     236//  Pend.setPz  (0.5*(endPlus - endMinus));
     237//  Pend.setE   (0.5*(endPlus + endMinus));
     238//  start->Set4Momentum(Pstart);
     239//  end->Set4Momentum(Pend);
     240//#ifdef debug
     241//  G4cout<<"G4QString::DiffString: StartQ="<<start->GetPDGCode()<<start->Get4Momentum()<<"("
     242//        <<start->Get4Momentum().mag()<<"), EndQ="<<end->GetPDGCode()<<end ->Get4Momentum()
     243//        <<"("<<end->Get4Momentum().mag()<<"), sumOfEnds="<<Pstart+Pend<<", H4M(original)="
     244//        <<hadron->Get4Momentum()<<G4endl;
     245//#endif
     246//} // End of DiffString (The string is excited diffractively)
    245247
    246248// Excite the string by two partons
    247249void G4QString::ExciteString(G4QParton* Color, G4QParton* AntiColor, G4int Direction)
    248250{
     251#ifdef debug
     252  G4cout<<"G4QString::ExciteString: **Called**, direction="<<Direction<<G4endl;
     253#endif
     254  if(thePartons.size()) std::for_each(thePartons.begin(),thePartons.end(),DeleteQParton());
     255  thePartons.clear();
    249256  theDirection = Direction;
    250257  thePosition  = Color->GetPosition();
     258#ifdef debug
     259  G4cout<<"G4QString::ExciteString: ColourPosition = "<<thePosition<<", beg="<<Color->GetPDGCode()
     260          <<",end="<<AntiColor->GetPDGCode()<<G4endl;
     261#endif
    251262  thePartons.push_back(Color);
    252   thePartons.push_back(AntiColor);
     263  G4LorentzVector sum=Color->Get4Momentum();
     264  thePartons.push_back(AntiColor); // @@ Complain of Valgrind
     265  sum+=AntiColor->Get4Momentum();
     266  Pplus =sum.e() + sum.pz();
     267  Pminus=sum.e() - sum.pz();
     268  decaying=None;
     269#ifdef debug
     270  G4cout<<"G4QString::ExciteString: ***Done***, beg="<<(*thePartons.begin())->GetPDGCode()
     271          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     272#endif
    253273} // End of ExciteString
    254274
     
    257277                                      G4QHadron* pHadron, G4double Px, G4double Py)
    258278{
    259     static const G4double  alund = 0.7/GeV/GeV;
    260     // If blund get restored, you MUST adapt the calculation of zOfMaxyf.
    261     //static const G4double  blund = 1;
    262     G4double z, yf;
    263     G4double Mt2 = Px*Px + Py*Py + pHadron->GetMass2();
    264     G4double zOfMaxyf=alund*Mt2/(alund*Mt2+1.);
    265     G4double maxYf=(1.-zOfMaxyf)/zOfMaxyf * std::exp(-alund*Mt2/zOfMaxyf);
    266     do
    267     {
    268        z = zmin + G4UniformRand()*(zmax-zmin);
    269        // yf = std::pow(1. - z, blund)/z*std::exp(-alund*Mt2/z);
    270        yf = (1-z)/z * std::exp(-alund*Mt2/z);
    271     } while (G4UniformRand()*maxYf>yf);
    272     return z;
     279  static const G4double  alund = 0.7/GeV/GeV;
     280  // If blund get restored, you MUST adapt the calculation of zOfMaxyf.
     281  //static const G4double  blund = 1;
     282  G4double z, yf;
     283  G4double Mt2 = Px*Px + Py*Py + pHadron->GetMass2();
     284  G4double zOfMaxyf=alund*Mt2/(alund*Mt2+1.);
     285  G4double maxYf=(1.-zOfMaxyf)/zOfMaxyf * std::exp(-alund*Mt2/zOfMaxyf);
     286  do
     287  {
     288     z = zmin + G4UniformRand()*(zmax-zmin);
     289     // yf = std::pow(1. - z, blund)/z*std::exp(-alund*Mt2/z);
     290     yf = (1-z)/z * std::exp(-alund*Mt2/z);
     291  } while (G4UniformRand()*maxYf>yf);
     292  return z;
    273293} // End of GetLundLightConeZ
    274294
     
    320340} // End of GetQGSMLightConeZ
    321341
    322 // Diffractively excite the string
     342// Diffractively excite the string (QL=true - QGS Light Cone, =false - Lund Light Cone)
    323343G4QHadronVector* G4QString::FragmentString(G4bool QL)
    324344{
    325345  // Can no longer modify Parameters for Fragmentation.
    326   // PastInitPhase=true;                                     // Now static
    327  
    328   //  check if string has enough mass to fragment...
    329   G4QHadronVector* LeftVector=LightFragmentationTest();
    330   if(LeftVector) return LeftVector;
    331  
    332   LeftVector = new G4QHadronVector;
     346#ifdef edebug
     347  G4LorentzVector string4M=Get4Momentum();         // Just for Energy-Momentum ConservCheck
     348#endif
     349#ifdef debug
     350  G4cout<<"G4QString::FragmentString:-->Called,QL="<<QL<<", M="<<Get4Momentum().m()<<", L="
     351        <<GetLeftParton()->Get4Momentum()<<",R="<<GetRightParton()->Get4Momentum()<<G4endl;
     352#endif
     353  //  check if string has enough mass to fragment. If not, convert to one or two hadrons
     354  G4QHadronVector* LeftVector = LightFragmentationTest();
     355  if(LeftVector)
     356  {
     357#ifdef edebug
     358    G4LorentzVector sL=string4M;
     359    for(unsigned L = 0; L < LeftVector->size(); L++)
     360    {
     361      G4QHadron* LH = (*LeftVector)[L];
     362      G4LorentzVector L4M=LH->Get4Momentum();
     363      sL-=L4M;
     364      G4cout<<"-EMC-G4QStr::FragStr:L#"<<L<<",PDG="<<LH->GetPDGCode()<<",4M="<<L4M<<G4endl;
     365    }
     366    G4cout<<"-EMC-G4QString::FragmentString:---LightFragmentation---> Res4M="<<sL<<G4endl;
     367#endif
     368    return LeftVector; //@@ Just decay in 2 or 1 (?) hadron, if below theCut
     369  }
     370#ifdef debug
     371  G4cout<<"G4QString::FragmentString:OUTPUT is not yet defined, define Left/Right"<<G4endl;
     372#endif 
     373  LeftVector = new G4QHadronVector; // Valgrind complain to LeftVector
    333374  G4QHadronVector* RightVector = new G4QHadronVector;
    334 
    335   // this should work but it's only a semi deep copy.
    336   // %GF G4ExcitedString theStringInCMS(theString);
    337   G4QString* theStringInCMS=CPExcited();                      // must be deleted
    338   G4LorentzRotation toCms=theStringInCMS->TransformToAlignedCms();
     375  // Remember 4-momenta of the string ends (@@ only for the two-parton string, no gluons)
     376  G4LorentzVector left4M=GetLeftParton()->Get4Momentum(); // For recovery when failed
     377  G4LorentzVector right4M=GetRightParton()->Get4Momentum();
     378#ifdef debug
     379  G4cout<<"G4QString::FragmString: ***Remember*** L4M="<<left4M<<", R4M="<<right4M<<G4endl;
     380#endif
     381  G4int leftPDG=GetLeftParton()->GetPDGCode();
     382  G4int rightPDG=GetRightParton()->GetPDGCode();
     383  // Transform string to CMS
     384  G4LorentzVector momentum=Get4Momentum();
     385  G4LorentzRotation toCms(-(momentum.boostVector()));
     386  momentum= toCms * thePartons[0]->Get4Momentum();
     387  toCms.rotateZ(-1*momentum.phi());
     388  toCms.rotateY(-1*momentum.theta());
     389  for(unsigned index=0; index<thePartons.size(); index++)
     390  {
     391    momentum = toCms * thePartons[index]->Get4Momentum(); // @@ reuse of the momentum
     392    thePartons[index]->Set4Momentum(momentum);
     393  }
     394  // Copy the string for independent attempts
     395  G4QParton* LeftParton = new G4QParton(GetLeftParton());
     396  G4QParton* RightParton= new G4QParton(GetRightParton());
     397  G4QString* theStringInCMS = new G4QString(LeftParton,RightParton,GetDirection());
     398#ifdef debug
     399  G4cout<<"G4QString::FragmentString: Copy with nP="<<theStringInCMS->thePartons.size()
     400        <<", beg="<<(*(theStringInCMS->thePartons.begin()))->GetPDGCode()
     401        <<", end="<<(*(theStringInCMS->thePartons.end()-1))->GetPDGCode()<<G4endl;
     402#endif
    339403  G4bool success=false;
    340404  G4bool inner_sucess=true;
    341405  G4int attempt=0;
    342   while (!success && attempt++<StringLoopInterrupt)              //@@ It's Loop with break
    343   {
    344     G4QString* currentString = new G4QString(*theStringInCMS);
     406  G4int StringLoopInterrupt=27;  // String fragmentation LOOP limit
     407#ifdef debug
     408  G4cout<<"G4QString::FragmentString: BeforeWhileLOOP, max = "<<StringLoopInterrupt
     409        <<", nP="<<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     410        <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     411#endif
     412#ifdef edebug
     413  G4LorentzVector cmS4M=theStringInCMS->Get4Momentum();
     414  G4cout<<"-EMC-G4QString::FragmString: c4M="<<cmS4M<<",Max="<<StringLoopInterrupt<<G4endl;
     415#endif
     416  while (!success && attempt++ < StringLoopInterrupt) // Try fragment String till success
     417  {
     418    // Recover the CMS String
     419    G4QParton* LeftParton = new G4QParton(theStringInCMS->GetLeftParton());
     420    G4QParton* RightParton= new G4QParton(theStringInCMS->GetRightParton());
     421    ExciteString(LeftParton, RightParton, theStringInCMS->GetDirection());
     422#ifdef edebug
     423    G4LorentzVector cm4M=cmS4M;    // Copy the full momentum for the reduction and check
     424    G4cout<<"-EMC-.G4QString::FragmentString: CHEK "<<cm4M<<" ?= "<<Get4Momentum()<<G4endl;
     425#endif
     426#ifdef debug
     427    G4cout<<"G4QString::FragmentString:===>LOOP, attempt = "<<attempt<<", nP="
     428          <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     429          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     430#endif
     431    // Now clean up all hadrons in the Left and Right vectors for the new attempt
    345432    if(LeftVector->size())
    346433    {
     
    348435      LeftVector->clear();
    349436    }
     437    //delete LeftVector; // @@ Valgrind ?
    350438    if(RightVector->size())
    351439    {
     
    353441      RightVector->clear();
    354442    }
    355     inner_sucess=true;  // set false on failure..
    356     while (!StopFragmentation())
    357     {  // Split current string into hadron + new string
    358       G4QString* newString=0;  // used as output from SplitUp...
    359       G4QHadron* Hadron=Splitup(QL);
    360       if(Hadron && IsFragmentable())
     443    //delete RightVector; // @@ Valgrind ?
     444    inner_sucess=true;                                           // set false on failure
     445    while (!StopFragmentation())                                 // LOOP with break
     446    {  // Split current string into hadron + new string state
     447#ifdef debug
     448      G4cout<<"G4QString::FragmentString:-->Begin LOOP/LOOP, decaying="<<decaying<<G4endl;
     449#endif
     450      G4QHadron* Hadron=Splitup(QL); // MAIN: where the hadron is split from the string
     451#ifdef edebug
     452      cm4M-=Hadron->Get4Momentum();
     453      G4cout<<"-EMC-G4QString::FragmentString:LOOP/LOOP,d4M="<<cm4M-Get4Momentum()<<G4endl;
     454#endif
     455      G4bool canBeFrag=IsFragmentable();
     456#ifdef debug
     457      G4cout<<"G4QString::FragmentString: LOOP/LOOP, canBeFrag="<<canBeFrag<<", decay="
     458            <<decaying<<", H="<<Hadron<<", newStringMass="<<Get4Momentum().m()<<G4endl;
     459#endif
     460      if(Hadron && canBeFrag)
    361461      {
    362         if(currentString->GetDecayDirection()>0) LeftVector->push_back(Hadron);
     462#ifdef debug
     463        G4cout<<">>G4QString::FragmentString: LOOP/LOOP-NO FRAGM-, dec="<<decaying<<G4endl;
     464#endif
     465        if(GetDecayDirection()>0) LeftVector->push_back(Hadron);
    363466        else RightVector->push_back(Hadron);
    364         delete currentString;
    365         currentString=newString;
    366467      }
    367468      else
    368469      {
     470        // @@ Try to convert to the resonance and decay, abandon if M<mGS+mPI0
    369471        // abandon ... start from the beginning
    370         if (newString) delete newString;
    371         if (Hadron)    delete Hadron;
     472#ifdef debug
     473        G4cout<<"G4QString::FragmentString: LOOP/LOOP, Start from scratch"<<G4endl;
     474#endif
     475        if (Hadron) delete Hadron;
    372476        inner_sucess=false;
    373477        break;
    374478      }
     479#ifdef debug
     480      G4cout<<"G4QString::FragmentString: LOOP/LOOP End, nP="
     481            <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     482            <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     483#endif
    375484    }
    376   // Split current string into 2 final Hadrons
    377     if( inner_sucess && SplitLast(currentString, LeftVector, RightVector) )  success=true;
    378     delete currentString;
    379   }
     485#ifdef edebug
     486    G4LorentzVector fLR=cmS4M-Get4Momentum();
     487    for(unsigned L = 0; L < LeftVector->size(); L++)
     488    {
     489      G4QHadron* LH = (*LeftVector)[L];
     490      G4LorentzVector L4M=LH->Get4Momentum();
     491      fLR-=L4M;
     492      G4cout<<"-EMC-G4QStr::FrStr:L#"<<L<<",PDG="<<LH->GetPDGCode()<<",4M="<<L4M<<G4endl;
     493    }
     494    for(unsigned R = 0; R < RightVector->size(); R++)
     495    {
     496      G4QHadron* RH = (*RightVector)[R];
     497      G4LorentzVector R4M=RH->Get4Momentum();
     498      fLR-=R4M;
     499      G4cout<<"-EMC-G4QStr::FrStr:R#"<<R<<",PDG="<<RH->GetPDGCode()<<",4M="<<R4M<<G4endl;
     500    }
     501    G4cout<<"-EMC-G4QString::FragmentString:L/R_BeforLast->r4M/M2="<<fLR<<fLR.m2()<<G4endl;
     502#endif
     503    // Split current string into 2 final Hadrons
     504#ifdef debug
     505    G4cout<<"G4QString::FragmentString: inner_success = "<<inner_sucess<<G4endl;
     506#endif
     507    if(inner_sucess)
     508    {
     509      success=true;                                      // Default prototype
     510      //... perform last cluster decay
     511      G4LorentzVector tot4M = Get4Momentum();
     512      G4double totM    = tot4M.m();
     513#ifdef debug
     514      G4cout<<"G4QString::FragmString: string4M="<<tot4M<<totM<<G4endl;
     515#endif
     516      G4QHadron* LeftHadron;
     517      G4QHadron* RightHadron;
     518      G4QParton* RQuark = 0;
     519      SetLeftPartonStable();              // to query quark contents
     520      if(DecayIsQuark() && StableIsQuark()) // There're quarks on clusterEnds
     521      {
     522#ifdef debug
     523        G4cout<<"G4QString::FragmentString: LOOP Quark Algorithm"<<G4endl;
     524#endif
     525        LeftHadron= QuarkSplitup(GetLeftParton(), RQuark);
     526      }
     527      else
     528      {
     529#ifdef debug
     530        G4cout<<"G4QString::FragmentString: LOOP Di-Quark Algorithm"<<G4endl;
     531#endif
     532        //... there is a Diquark on cluster ends
     533        G4int IsParticle;
     534        if(StableIsQuark()) IsParticle=(GetLeftParton()->GetPDGCode()>0)?-1:1;
     535        else                IsParticle=(GetLeftParton()->GetPDGCode()>0)?1:-1;
     536        G4QPartonPair QuarkPair = CreatePartonPair(IsParticle,false); // no diquarks
     537        RQuark = QuarkPair.GetParton2();
     538        G4QParton* LQuark = QuarkPair.GetParton1();
     539        LeftHadron = CreateHadron(LQuark, GetLeftParton()); // Create Left Hadron
     540        delete LQuark;                                      // Delete the temporaryParton
     541      }
     542      RightHadron = CreateHadron(GetRightParton(), RQuark); // Create Right Hadron
     543      delete RQuark;                                        // Delete the temporaryParton
     544      //... repeat procedure, if mass of cluster is too low to produce hadrons
     545      G4double LhM=LeftHadron->GetMass();
     546      G4double RhM=RightHadron->GetMass();
     547#ifdef debug
     548      G4cout<<"G4QStr::FrSt:L="<<LeftHadron->GetPDGCode()<<",R="<<RightHadron->GetPDGCode()
     549            <<",ML="<<LhM<<",MR="<<RhM<<",SumM="<<LhM+RhM<<",tM="<<totM<<G4endl;
     550#endif
     551      if(totM < LhM + RhM) success=false;
     552      //... compute hadron momenta and energies   
     553      if(success)
     554      {
     555        G4ThreeVector    Pos=GetPosition();
     556        G4LorentzVector  Lh4M(0.,0.,0.,LhM);
     557        G4LorentzVector  Rh4M(0.,0.,0.,RhM);
     558        if(G4QHadron(tot4M).DecayIn2(Lh4M,Rh4M))
     559        {
     560          LeftVector->push_back(new G4QHadron(LeftHadron, 0, Pos, Lh4M));
     561          delete LeftHadron;
     562          RightVector->push_back(new G4QHadron(RightHadron, 0, Pos, Rh4M));
     563          delete RightHadron;
     564        }
     565#ifdef debug
     566        G4cout<<">>>G4QStr::FragString:HFilled (L) PDG="<<LeftHadron->GetPDGCode()<<", 4M="
     567              <<Lh4M<<", (R) PDG="<<RightHadron->GetPDGCode()<<", 4M="<<Rh4M<<G4endl;
     568#endif
     569#ifdef edebug
     570          G4cout<<"-EMC-G4QString::FragmentString: Residual4M="<<tot4M-Lh4M-Rh4M<<G4endl;
     571#endif
     572      }
     573      else
     574      {
     575        if(LeftHadron)  delete LeftHadron;
     576        if(RightHadron) delete RightHadron;
     577      }
     578    } // End of inner success
     579  } // End of while
    380580  delete theStringInCMS;
     581#ifdef debug
     582  G4cout<<"G4QString::FragmentString: LOOP/LOOP, success="<<success<<G4endl;
     583#endif
    381584  if (!success)
    382585  {
     
    392595      LeftVector->clear();
    393596    }
    394     return LeftVector;
    395   } 
     597    delete LeftVector;
     598#ifdef debug
     599    G4cout<<"G4QString::FragmString:StringNotFragm,L4M="<<left4M<<",R4M="<<right4M<<G4endl;
     600#endif
     601    // Recover the Left/Right partons 4-moms of the String in ZLS
     602    GetLeftParton()->SetPDGCode(leftPDG);
     603    GetRightParton()->SetPDGCode(rightPDG);
     604    GetLeftParton()->Set4Momentum(left4M);
     605    GetRightParton()->Set4Momentum(right4M);
     606    return 0;                         // The string can not be fragmented
     607  }
     608  // @@@@@ Print collected Left and Right Hadrons (decay resonances!)
     609#ifdef edebug
     610  G4LorentzVector sLR=cmS4M;
     611  for(unsigned L = 0; L < LeftVector->size(); L++)
     612  {
     613    G4QHadron* LH = (*LeftVector)[L];
     614    G4LorentzVector L4M=LH->Get4Momentum();
     615    sLR-=L4M;
     616    G4cout<<"-EMC-G4QStr::FragmStri:L#"<<L<<",PDG="<<LH->GetPDGCode()<<",4M="<<L4M<<G4endl;
     617  }
     618  for(unsigned R = 0; R < RightVector->size(); R++)
     619  {
     620    G4QHadron* RH = (*RightVector)[R];
     621    G4LorentzVector R4M=RH->Get4Momentum();
     622    sLR-=R4M;
     623    G4cout<<"-EMC-G4QStr::FragmStri:R#"<<R<<",PDG="<<RH->GetPDGCode()<<",4M="<<R4M<<G4endl;
     624  }
     625  G4cout<<"-EMC-G4QString::FragmentString:---L/R_BeforeMerge---> Res4M="<<sLR<<G4endl;
     626#endif
    396627  // Join Left and Right Vectors into LeftVector in correct order.
    397628  while(!RightVector->empty())
     
    401632  }
    402633  delete RightVector;
    403   CalculateHadronTimePosition(Get4Momentum().mag(), LeftVector);
     634  // @@ A trick, the real bug should be found !!
     635  G4QHadronVector::iterator ilv;                                           // @@
     636  for(ilv = LeftVector->begin(); ilv < LeftVector->end(); ilv++)           // @@
     637  {
     638    G4ThreeVector CV=(*ilv)->Get4Momentum().vect();                        // @@
     639    if(CV.x()==0. && CV.y()==0. && CV.z()==0.) LeftVector->erase(ilv);     // @@
     640  }
     641  // Calculate time and position of hadrons with @@ very rough formation time
     642  G4double StringMass=Get4Momentum().mag();
     643  static const G4double dkappa = 2.0 * GeV/fermi; // @@ 2*kappa kappa=1 GeV/fermi (?)
     644  for(unsigned c1 = 0; c1 < LeftVector->size(); c1++)
     645  {
     646    G4double SumPz = 0;
     647    G4double SumE  = 0;
     648    for(unsigned c2 = 0; c2 < c1; c2++)
     649    {
     650      G4LorentzVector hc2M=(*LeftVector)[c2]->Get4Momentum();
     651      SumPz += hc2M.pz();
     652      SumE  += hc2M.e();   
     653    }
     654    G4QHadron* hc1=(*LeftVector)[c1];
     655    G4LorentzVector hc1M=hc1->Get4Momentum();
     656    G4double HadronE = hc1M.e();
     657    G4double HadronPz= hc1M.pz();
     658    hc1->SetFormationTime((StringMass-SumPz-SumPz+HadronE-HadronPz)/dkappa);
     659    hc1->SetPosition(G4ThreeVector(0,0,(StringMass-SumE-SumE-HadronE+HadronPz)/dkappa));
     660  }
    404661  G4LorentzRotation toObserverFrame(toCms.inverse());
     662#ifdef debug
     663  G4cout<<"G4QString::FragmentString: beforeLoop LVsize = "<<LeftVector->size()<<G4endl;
     664#endif
    405665  for(unsigned C1 = 0; C1 < LeftVector->size(); C1++)
    406666  {
     
    414674    Hadron->SetPosition(GetPosition()+Momentum.vect());
    415675  }
    416   return LeftVector;
    417 } // End of FragmentLundString
    418 
    419 // Creates a string, using only the end-partons of the string
    420 G4QString* G4QString::CPExcited()
    421 {
    422  G4QParton* LeftParton = new G4QParton(GetLeftParton());
    423  G4QParton* RightParton= new G4QParton(GetRightParton());
    424  return new G4QString(LeftParton,RightParton,GetDirection());
    425 } // End of CPExcited
    426 
    427 // Simple decay of the string
     676#ifdef edebug
     677  G4LorentzVector sLA=string4M;
     678  for(unsigned L = 0; L < LeftVector->size(); L++)
     679  {
     680    G4QHadron* LH = (*LeftVector)[L];
     681    G4LorentzVector L4M=LH->Get4Momentum();
     682    sLA-=L4M;
     683    G4cout<<"-EMC-G4QStr::FragmStri:L#"<<L<<",PDG="<<LH->GetPDGCode()<<",4M="<<L4M<<G4endl;
     684  }
     685  G4cout<<"-EMC-G4QString::FragmentString:---LSAfterMerge&Conv---> Res4M="<<sLA<<G4endl;
     686#endif
     687#ifdef debug
     688  G4cout<<"G4QString::FragmentString: *** Done *** "<<G4endl;
     689#endif
     690  return LeftVector; // Should be deleted by user (@@ Valgrind complain ?)
     691} // End of FragmentString
     692
     693// Simple decay of the string if the excitation mass is too small for HE fragmentation
     694// !! If the mass is below the single hadron threshold, make warning (improve) and convert
     695// the string to the single S-hadron breaking energy conservation (temporary) and improve,
     696// taking the threshold into account on the level of the String creation (merge strings) !!
    428697G4QHadronVector* G4QString::LightFragmentationTest()
    429698{
    430699  // Check string decay threshold
    431  
    432   G4QHadronVector* result=0;  // return 0 when string exceeds the mass cut
     700  G4LorentzVector tot4M=Get4Momentum();
     701#ifdef debug
     702  G4cout<<"G4QString::LightFragmentationTest: ***Called***, string4M="<<tot4M<<G4endl;
     703#endif
     704  G4QHadronVector* result=0;  // return 0 when string exceeds the mass cut or below mh1+mh2
    433705 
    434   G4QHadronPair hadrons((G4QHadron*)0, (G4QHadron*)0); // pair of hadrons
    435   if(sqr(FragmentationMass(0,&hadrons)+MassCut)<Mass2()) return 0; //Par MassCut
    436  
    437   result = new G4QHadronVector;
    438        
    439   if(hadrons.second==0)                   // Second hadron exists
    440   {
    441     // Substitute string by a light hadron, Note that Energy is not conserved here! @@
    442     G4ThreeVector Mom3 = Get4Momentum().vect();
    443     G4LorentzVector Mom(Mom3, std::sqrt(Mom3.mag2() + hadrons.first->GetMass2()) );
    444     result->push_back(new G4QHadron(hadrons.first, 0, GetPosition(), Mom));
    445   }
    446   else
    447   {
    448     //... string was qq--qqbar type: Build two stable hadrons,
    449     G4LorentzVector  Mom1, Mom2;
    450     Sample4Momentum(&Mom1, hadrons.first->GetMass(), &Mom2, hadrons.second->GetMass(),
    451                                                              Get4Momentum().mag());
    452     result->push_back(new G4QHadron(hadrons.first, 0, GetPosition(), Mom1));
    453     result->push_back(new G4QHadron(hadrons.second,0, GetPosition(), Mom2));
    454     G4ThreeVector Velocity = Get4Momentum().boostVector();
    455     G4int L=result->size(); if(L) for(G4int i=0; i<L; i++) (*result)[i]->Boost(Velocity);
    456   }
     706  G4QHadronPair hadrons((G4QHadron*)0, (G4QHadron*)0); // pair of hadrons for output of FrM
     707  G4double fragMass = FragmentationMass(0,&hadrons);   // Minimum mass to decay the string
     708#ifdef debug
     709  G4cout<<"G4QString::LightFragTest: before check nP="<<thePartons.size()<<", MS2="
     710        <<Mass2()<<", MCut="<<MassCut<<", beg="<<(*thePartons.begin())->GetPDGCode()
     711        <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<", fM="<<fragMass<<G4endl;
     712#endif 
     713  if(Mass2() > sqr(fragMass+MassCut))// Big enough to fragment in a lader (avoid the decay)
     714  {
     715    if(hadrons.first) delete hadrons.first;
     716    if(hadrons.second) delete hadrons.second;
     717#ifdef debug
     718    G4cout<<"G4QString::LightFragTest:NO,M2="<<Mass2()<<">"<<sqr(fragMass+MassCut)<<G4endl;
     719#endif 
     720    return result;                          // =0. Depends on the parameter of the Mass Cut
     721  }
     722  G4double totM= tot4M.m();
     723  G4QHadron* h1=hadrons.first;
     724  G4QHadron* h2=hadrons.second;
     725  if(h1 && h2)
     726  {
     727    G4double h1M = h1->GetMass();
     728    G4double h2M = h2->GetMass();
     729#ifdef debug
     730    G4cout<<"G4QString::LightFragTest:tM="<<totM<<","<<h1M<<"+"<<h2M<<"+"<<h1M+h2M<<G4endl;
     731#endif
     732    if(h1M + h2M <= totM)                   // The string can decay in these two hadrons
     733    { 
     734      // Create two stable hadrons
     735      G4LorentzVector  h4M1(0.,0.,0.,h1M);
     736      G4LorentzVector  h4M2(0.,0.,0.,h2M);
     737      if(G4QHadron(tot4M).DecayIn2(h4M1,h4M2))
     738      {
     739        result = new G4QHadronVector;       
     740        result->push_back(new G4QHadron(hadrons.first, 0, GetPosition(), h4M1));
     741        result->push_back(new G4QHadron(hadrons.second,0, GetPosition(), h4M2));
     742      }
     743#ifdef edebug
     744      G4int L=result->size(); if(L) for(G4int i=0; i<L; i++)
     745      {
     746        tot4M-=(*result)[i]->Get4Momentum();
     747        G4cout<<"-EMC-G4QString::LightFragTest: i="<<i<<", residual4M="<<tot4M<<G4endl;
     748      }
     749#endif
     750    }
     751#ifdef debug
     752    else G4cout<<"-Warning-G4QString::LightFragTest: TooBigHadronMasses to decay"<<G4endl;
     753#endif
     754  }
     755#ifdef debug
     756  else G4cout<<"-Warning-G4QString::LightFragTest: No Hadrons have been proposed"<<G4endl;
     757#endif
     758  delete hadrons.first;
     759  delete hadrons.second;
    457760  return result;
    458761} // End of LightFragmentationTest
    459762
    460763// Calculate Fragmentation Mass (if pdefs # 0, returns two hadrons)
    461 G4double G4QString::FragmentationMass(G4QHcreate build, G4QHadronPair* pdefs)
    462 {
    463   G4double mass;
     764G4double G4QString::FragmentationMass(G4int HighSpin, G4QHadronPair* pdefs)
     765{
     766  G4double mass=0.;
     767#ifdef debug
     768  G4cout<<"G4QString::FragmMass: ***Called***, s4M="<<Get4Momentum()<<G4endl;
     769#endif
    464770  // Example how to use an interface to different member functions
    465   if(build==0) build=&G4QHadronBuilder::BuildLowSpin; // @@ Build S Hadrons?
    466   G4QHadron* Hadron1 = 0;                            // @@ Not initialized
     771  G4QHadron* Hadron1 = 0;
    467772  G4QHadron* Hadron2 = 0;
    468   if(!FourQuarkString() )
    469   {
    470     // spin 0 meson or spin 1/2 barion will be built
    471     Hadron1 = (hadronizer->*build)(GetLeftParton(), GetRightParton());
    472     mass    = Hadron1->GetMass();
     773#ifdef debug
     774  G4cout<<"G4QString::FragmentationMass: Create spin-0 or spin-1/2 hadron: nP="
     775        <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     776        <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     777#endif
     778  G4int iflc = (G4UniformRand() < 0.5) ? 1 : 2; // Create additional Q-antiQ pair @@ No S
     779  G4int LPDG= GetLeftParton()->GetPDGCode();
     780  G4int LT  = GetLeftParton()->GetType();
     781  if ( (LPDG > 0 && LT == 1)  || (LPDG < 0 && LT == 2) ) iflc = -iflc; // anti-quark
     782  G4QParton* piflc = new G4QParton( iflc);
     783  G4QParton* miflc = new G4QParton(-iflc);
     784  if(HighSpin)
     785  {
     786    Hadron1 = CreateHighSpinHadron(GetLeftParton(),piflc);
     787    Hadron2 = CreateHighSpinHadron(GetRightParton(),miflc);
     788#ifdef debug
     789    G4cout<<"G4QString::FragmentationMass: High, PDG1="<<Hadron1->GetPDGCode()
     790          <<", PDG2="<<Hadron2->GetPDGCode()<<G4endl;
     791#endif
    473792  }
    474793  else
    475794  {
    476     // string is qq--qqbar: Build two stable hadrons, with extra uubar or ddbar quark pair
    477     G4int iflc = (G4UniformRand() < 0.5)? 1 : 2;
    478     if (GetLeftParton()->GetPDGCode() < 0) iflc = -iflc;
    479     //... theSpin = 4; spin 3/2 baryons will be built
    480     Hadron1 = (hadronizer->*build)(GetLeftParton(),CreateParton(iflc));
    481     Hadron2 = (hadronizer->*build)(GetRightParton(),CreateParton(-iflc));
    482     mass    = Hadron1->GetMass() + Hadron2->GetMass();
    483   }
    484   if(pdefs) // need to return hadrons as well....
    485   {
    486     pdefs->first  = Hadron1;
    487     pdefs->second = Hadron2;
    488   }
     795    Hadron1 = CreateLowSpinHadron(GetLeftParton(),piflc);
     796    Hadron2 = CreateLowSpinHadron(GetRightParton(),miflc);
     797#ifdef debug
     798    G4cout<<"G4QString::FragmentationMass: Low, PDG1="<<Hadron1->GetPDGCode()
     799          <<", PDG2="<<Hadron2->GetPDGCode()<<G4endl;
     800#endif
     801  }
     802  mass    = Hadron1->GetMass() + Hadron2->GetMass();
     803  if(pdefs) // need to return hadrons as well as the mass estimate
     804  {
     805    pdefs->first  = Hadron1;  // To be deleted by the calling program if not zero
     806    pdefs->second = Hadron2;  // To be deleted by the calling program if not zero
     807  }
     808  else      // Forget about the hadrons
     809  {
     810    if(Hadron1) delete Hadron1;
     811    if(Hadron2) delete Hadron2;
     812  }
     813  delete piflc;
     814  delete miflc;
     815#ifdef debug
     816  G4cout<<"G4QString::FragmentationMass: ***Done*** mass="<<mass<<G4endl;
     817#endif
    489818  return mass;
    490819} // End of FragmentationMass
    491820
    492  // Checks that the string is qq-(qq)bar string
    493 G4bool G4QString::FourQuarkString() const
    494 {
    495   return    GetLeftParton()->GetParticleSubType() == "di_quark"
    496          && GetRightParton()->GetParticleSubType()== "di_quark";
    497 } // End of FourQuarkString
    498 
    499 void G4QString::CalculateHadronTimePosition(G4double StringMass, G4QHadronVector* Hadrons)
    500 {
    501   // `yo-yo` formation time
    502   static const G4double kappa = 1.0 * GeV/fermi;
    503   static const G4double dkappa = kappa+kappa;
    504   for(unsigned c1 = 0; c1 < Hadrons->size(); c1++)
    505   {
    506     G4double SumPz = 0;
    507     G4double SumE  = 0;
    508     for(unsigned c2 = 0; c2 < c1; c2++)
    509     {
    510       G4LorentzVector hc2M=(*Hadrons)[c2]->Get4Momentum();
    511       SumPz += hc2M.pz();
    512       SumE  += hc2M.e();   
    513     }
    514     G4QHadron* hc1=(*Hadrons)[c1];
    515     G4LorentzVector hc1M=hc1->Get4Momentum();
    516     G4double HadronE = hc1M.e();
    517     G4double HadronPz= hc1M.pz();
    518     hc1->SetFormationTime((StringMass-SumPz-SumPz+HadronE-HadronPz)/dkappa);
    519     hc1->SetPosition(G4ThreeVector(0,0,(StringMass-SumE-SumE-HadronE+HadronPz)/dkappa));
    520   }
    521 } // End of CalculateHadronTimePosition
    522 
    523821void G4QString::SetLeftPartonStable()
    524822{
    525      theStableParton=GetLeftParton();
    526      theDecayParton=GetRightParton();
    527      decaying=Right;
     823  theStableParton=GetLeftParton();
     824  theDecayParton=GetRightParton();
     825  decaying=Right;
    528826}
    529827
    530828void G4QString::SetRightPartonStable()
    531829{
    532      theStableParton=GetRightParton();
    533      theDecayParton=GetLeftParton();
    534      decaying=Left;
     830  theStableParton=GetRightParton();
     831  theDecayParton=GetLeftParton();
     832  decaying=Left;
    535833}
    536834
     
    547845}
    548846
    549 G4ThreeVector G4QString::StablePt()
    550 {
    551   if (decaying == Left ) return Ptright;
    552   else if (decaying == Right ) return Ptleft;
    553   else
    554   {
    555     G4cerr<<"***G4QString::StablePt: wrong DecayDirection="<<decaying<<G4endl;
    556     G4Exception("G4QString::StablePt:","72",FatalException,"WrongDecayDirection");
    557   }
    558   return G4ThreeVector();
    559 }
     847//G4ThreeVector G4QString::StablePt()
     848//{
     849//  if (decaying == Left ) return Ptright;
     850//  else if (decaying == Right ) return Ptleft;
     851//  else
     852//  {
     853//    G4cerr<<"***G4QString::StablePt: wrong DecayDirection="<<decaying<<G4endl;
     854//    G4Exception("G4QString::StablePt:","72",FatalException,"WrongDecayDirection");
     855//  }
     856//  return G4ThreeVector();
     857//}
    560858
    561859G4ThreeVector G4QString::DecayPt()
     
    571869}
    572870
    573 G4double G4QString::LightConeDecay()
    574 {
    575   if      (decaying == Left  ) return Pplus;
    576   else if (decaying == Right ) return Pminus;
    577   else
    578   {
    579     G4cerr<<"***G4QString::LightConeDecay: wrong DecayDirection="<<decaying<<G4endl;
    580     G4Exception("G4QString::LightConeDecay:","72",FatalException,"WrongDecayDirection");
    581   }
    582   return 0;
    583 }
    584 
    585 G4LorentzVector G4QString::GetFragmentation4Mom() const
    586 {
    587   G4LorentzVector momentum(Ptleft+Ptright,0.5*(Pplus+Pminus));
    588   momentum.setPz(0.5*(Pplus-Pminus));
    589   return momentum;
    590 }
    591 
    592871// Random choice of string end to use it for creating the hadron (decay)   
    593872G4QHadron* G4QString::Splitup(G4bool QL)
    594873{
    595   SideOfDecay = (G4UniformRand() < 0.5)? 1: -1;
     874  SideOfDecay = (G4UniformRand() < 0.5) ? 1: -1;
     875#ifdef debug
     876  G4cout<<"G4QString::Splitup:**Called**,s="<<SideOfDecay<<",s4M="<<Get4Momentum()<<G4endl;
     877#endif
    596878  if(SideOfDecay<0) SetLeftPartonStable();  // Decay Right parton
    597879  else              SetRightPartonStable(); // Decay Left parton
    598880  G4QParton* newStringEnd;
    599881  G4QHadron* Hadron;
    600   if(DecayIsQuark()) Hadron=QuarkSplitup(GetDecayParton(), newStringEnd);    // MF1
    601   else               Hadron= DiQuarkSplitup(GetDecayParton(), newStringEnd); // MF2
    602   // create new String from old, ie. keep Left and Right order, but replace decay
    603   G4LorentzVector* HadronMomentum=SplitEandP(Hadron, QL);                    // MF3
    604   if(HadronMomentum)
     882  if(DecayIsQuark()) Hadron= QuarkSplitup(theDecayParton, newStringEnd);   // Split Quark
     883  else               Hadron= DiQuarkSplitup(theDecayParton, newStringEnd); // Split DiQuark
     884#ifdef debug
     885  G4cout<<"G4QString::Splitup: newStringEndPDG="<<newStringEnd->GetPDGCode()<<", nP="
     886          <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     887          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     888#endif
     889  // create new String from the old one: keep Left and Right order, but replace decay
     890  G4LorentzVector* HadronMomentum=SplitEandP(Hadron, QL);//The decayed parton isn't changed
     891#ifdef debug
     892  G4cout<<"G4QString::Splitup: HM="<<HadronMomentum<<", nP="
     893          <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     894          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     895#endif
     896  if(HadronMomentum) // The decay succeeded, now the new 4-mon can be set to NewStringEnd
    605897  {   
    606     G4ThreeVector   Pos(0.,0.,0.);
     898#ifdef pdebug
     899    G4cout<<">>>>>G4QString::Splitup: HFilled 4M="<<*HadronMomentum<<",PDG="
     900          <<Hadron->GetPDGCode()<<",s4M-h4M="<<Get4Momentum()-*HadronMomentum<<G4endl;
     901#endif
     902    newStringEnd->Set4Momentum(theDecayParton->Get4Momentum()-*HadronMomentum);
    607903    Hadron->Set4Momentum(*HadronMomentum);
    608     UpdateString(newStringEnd, HadronMomentum);
     904    Hadron->SetPosition(GetPosition());
     905    if(decaying == Left)
     906    {
     907      G4QParton* theFirst = thePartons[0];            // Substitute for the First Parton
     908      delete theFirst;                                // The OldParton instance is deleted
     909      thePartons[0] = newStringEnd;                   // Delete equivalent for newStringEnd
     910#ifdef debug
     911      G4cout<<"G4QString::Splitup:  theFirstPDG="<<theFirst->GetPDGCode()<<G4endl;
     912#endif
     913      Ptleft  -= HadronMomentum->vect();
     914      Ptleft.setZ(0.);                                // @@ (Z is anyway ignored) M.K. (?)
     915    }
     916    else if (decaying == Right)
     917    {
     918      G4QParton* theLast = thePartons[thePartons.size()-1]; // Substitute for theLastParton
     919      delete theLast;                                 // The OldParton instance is deleted
     920      thePartons[thePartons.size()-1] = newStringEnd; // Delete equivalent for newStringEnd
     921#ifdef debug
     922      G4cout<<"G4QString::Splitup:  theLastPDG="<<theLast->GetPDGCode()<<", nP="
     923            <<thePartons.size()<<", beg="<<thePartons[0]->GetPDGCode()<<",end="
     924            <<thePartons[thePartons.size()-1]->GetPDGCode()<<",P="<<theLast
     925            <<"="<<thePartons[thePartons.size()-1]<<G4endl;
     926#endif
     927      Ptright -= HadronMomentum->vect();
     928      Ptright.setZ(0.);                               // @@ (Z is anyway ignored) M.K. (?)
     929    }
     930    else
     931    {
     932      G4cerr<<"***G4QString::Splitup: wrong oldDecay="<<decaying<<G4endl;
     933      G4Exception("G4QString::Splitup","72",FatalException,"WrongDecayDirection");
     934    }
     935    Pplus  -= HadronMomentum->e() + HadronMomentum->pz();// Reduce Pplus ofTheString (Left)
     936    Pminus -= HadronMomentum->e() - HadronMomentum->pz();// Reduce Pminus ofTheString(Rite)
     937#ifdef debug
     938    G4cout<<"G4QString::Splitup:  P+="<<Pplus<<",P-="<<Pminus<<", nP="
     939          <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     940          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     941    G4cout<<">...>G4QString::Splitup: NewString4M="<<Get4Momentum()<<G4endl;
     942#endif
    609943    delete HadronMomentum;
    610944  }     
     945#ifdef debug
     946  G4cout<<"G4QString::Splitup: ***Done*** H4M="<<Hadron->Get4Momentum()<<", nP="
     947          <<thePartons.size()<<", beg="<<(*thePartons.begin())->GetPDGCode()
     948          <<",end="<<(*(thePartons.end()-1))->GetPDGCode()<<G4endl;
     949#endif
    611950  return Hadron;
    612951} // End of Splitup
    613952
    614 void G4QString::UpdateString(G4QParton* decay, const G4LorentzVector* mom)
    615 {
    616   decaying=None;
    617   if(decaying == Left)
    618   {
    619     G4QParton* theFirst = thePartons[0];
    620     delete theFirst;
    621     theFirst = decay;
    622     Ptleft  -= mom->vect();
    623     Ptleft.setZ(0.);
    624   }
    625   else if (decaying == Right)
    626   {
    627     G4QParton* theLast = thePartons[thePartons.size()-1];
    628     delete theLast;
    629     theLast  = decay;
    630     Ptright -= mom->vect();
    631     Ptright.setZ(0.);
    632   }
    633   else
    634   {
    635     G4cerr<<"***G4QString::UpdateString: wrong oldDecay="<<decaying<<G4endl;
    636     G4Exception("G4QString::UpdateString","72",FatalException,"WrongDecayDirection");
    637   }
    638   Pplus  -= mom->e() + mom->pz();
    639   Pminus -= mom->e() - mom->pz();
    640 } // End of UpdateString
    641 
    642953// QL=true for QGSM and QL=false for Lund fragmentation
    643954G4LorentzVector* G4QString::SplitEandP(G4QHadron* pHadron, G4bool QL)
    644955{
    645956  G4double HadronMass = pHadron->GetMass();
     957#ifdef debug
     958  G4cout<<"G4QString::SplitEandP: ***Called*** HMass="<<HadronMass<<G4endl;
     959#endif
    646960  // calculate and assign hadron transverse momentum component HadronPx andHadronPy
    647   G4ThreeVector HadronPt = SampleQuarkPt() + DecayPt();
     961  G4ThreeVector HadronPt = SampleQuarkPt() + DecayPt(); // @@ SampleQuarkPt & DecayPt once
    648962  HadronPt.setZ(0.);
    649963  //...  sample z to define hadron longitudinal momentum and energy
    650964  //... but first check the available phase space
    651   G4double DecayQuarkMass2  = sqr(GetDecayParton()->GetMass()); // Mass of quark? M.K.
    652965  G4double HadronMass2T = HadronMass*HadronMass + HadronPt.mag2();
    653   if (DecayQuarkMass2 + HadronMass2T >= SmoothParam*Mass2() )  return 0;  // restart!
     966  if (HadronMass2T >= SmoothParam*Mass2() )  return 0;  // restart!
    654967  //... then compute allowed z region  z_min <= z <= z_max
    655968  G4double zMin = HadronMass2T/Mass2();
    656   G4double zMax = 1. - DecayQuarkMass2/Mass2();
     969  G4double zMax = 1.;
     970#ifdef debug
     971  G4cout<<"G4QString::SplitEandP: zMin="<<zMin<<", zMax"<<zMax<<G4endl;
     972#endif
    657973  if (zMin >= zMax) return 0;  // have to start all over! 
    658974  G4double z=0;
    659   if(QL) z = GetQGSMLightConeZ(zMin, zMax, GetDecayParton()->GetPDGCode(), pHadron,
     975  if(QL) z = GetQGSMLightConeZ(zMin, zMax, theDecayParton->GetPDGCode(), pHadron,
    660976                               HadronPt.x(), HadronPt.y());     
    661   else   z = GetLundLightConeZ(zMin, zMax, GetDecayParton()->GetPDGCode(), pHadron,
     977  else   z = GetLundLightConeZ(zMin, zMax, theDecayParton->GetPDGCode(), pHadron,
    662978                               HadronPt.x(), HadronPt.y());     
    663979  //... now compute hadron longitudinal momentum and energy
    664980  // longitudinal hadron momentum component HadronPz
    665   G4double zl= z*LightConeDecay();
     981  G4double zl= z;
     982  if      (decaying == Left  ) zl*=Pplus;
     983  else if (decaying == Right ) zl*=Pminus;
     984  else                                                // @@ Is that possible?
     985  {
     986    G4cerr<<"***G4QString::SplitEandP: wrong DecayDirection="<<decaying<<G4endl;
     987    G4Exception("G4QString::SplitEandP:","72",FatalException,"WrongDecayDirection");
     988  }
    666989  G4double HadronE = (zl + HadronMass2T/zl)/2;
    667990  HadronPt.setZ( GetDecayDirection() * (zl - HadronE) );
    668991  G4LorentzVector* a4Momentum= new G4LorentzVector(HadronPt,HadronE);
    669 
    670992  return a4Momentum;
    671993}
     
    6781000}
    6791001
    680 void G4QString::Sample4Momentum(G4LorentzVector* Mom, G4double Mass,
    681                          G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass)
    682 {
    683   G4double m2 = Mass*Mass;
    684   G4double am2= AntiMass*AntiMass;
    685   G4double dub=InitialMass*InitialMass - m2 - am2;
    686   G4double r_val = dub - 4*m2*am2;
    687   G4double Pabs = (r_val > 0.) ? std::sqrt(r_val)/(InitialMass*InitialMass) : 0;
    688   //... sample unit vector       
    689   G4double r  = G4UniformRand();                    // @@ G4RandomDirection()
    690   G4double pz = 1. - r - r;                         // cos(theta)
    691   G4double st = std::sqrt(1. - pz * pz) * Pabs;
    692   G4double phi= twopi*G4UniformRand();
    693   G4double px = st*std::cos(phi);
    694   G4double py = st*std::sin(phi);
    695   pz *= Pabs;
    696   G4double p2=Pabs*Pabs;
    697   Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
    698   Mom->setE(std::sqrt(p2 + Mass*Mass));
    699   AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
    700   AntiMom->setE (std::sqrt(Pabs*Pabs + AntiMass*AntiMass));
    701 } // End of Sample4Momentum
    702 
    703 G4bool G4QString::SplitLast(G4QString* string, G4QHadronVector* LeftVector,
    704                                                G4QHadronVector* RightVector)
    705 {
    706   //... perform last cluster decay
    707   G4ThreeVector ClusterVel =string->Get4Momentum().boostVector();
    708   G4double ResidualMass    =string->Mass();
    709   G4double ClusterMassCut = ClusterMass;
    710   G4int cClusterInterrupt = 0;
    711   G4QHadron* LeftHadron;
    712   G4QHadron* RightHadron;
    713   do
    714   {
    715     if(cClusterInterrupt++ >= ClusterLoopInterrupt) return false;
    716     G4QParton* quark = 0;
    717     string->SetLeftPartonStable(); // to query quark contents..
    718     if(string->DecayIsQuark() && string->StableIsQuark()) // There're quarks on clusterEnds
    719       LeftHadron= QuarkSplitup(string->GetLeftParton(), quark);
    720     else
    721     {
    722       //... there is a Diquark on cluster ends
    723       G4int IsParticle;
    724       if(string->StableIsQuark())IsParticle=(string->GetLeftParton()->GetPDGCode()>0)?-1:1;
    725       else                       IsParticle=(string->GetLeftParton()->GetPDGCode()>0)?1:-1;
    726       G4QPartonPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
    727       quark = QuarkPair.GetParton2();
    728       LeftHadron=hadronizer->Build(QuarkPair.GetParton1(), string->GetLeftParton());
    729     }
    730     RightHadron = hadronizer->Build(string->GetRightParton(), quark);
    731     //... repeat procedure, if mass of cluster is too low to produce hadrons
    732     //... ClusterMassCut = 0.15*GeV model parameter
    733     if ( quark->GetParticleSubType()== "quark" ) ClusterMassCut = 0.;
    734     else                                         ClusterMassCut = ClusterMass;
    735   } while(ResidualMass <= LeftHadron->GetMass() + RightHadron->GetMass() + ClusterMassCut);
    736   //... compute hadron momenta and energies   
    737   G4LorentzVector  LeftMom, RightMom;
    738   G4ThreeVector    Pos;
    739   Sample4Momentum(&LeftMom,LeftHadron->GetMass(),&RightMom,RightHadron->GetMass(),
    740                                                                              ResidualMass);
    741   LeftMom.boost(ClusterVel);
    742   RightMom.boost(ClusterVel);
    743   LeftVector->push_back(new G4QHadron(LeftHadron, 0, Pos, LeftMom));
    744   RightVector->push_back(new G4QHadron(RightHadron, 0, Pos, RightMom));
    745 
    746   return true;
    747 } // End of SplitLast
    748 
    749 G4QHadron* G4QString::QuarkSplitup(G4QParton* decay, G4QParton *&created)
     1002G4QHadron* G4QString::QuarkSplitup(G4QParton* decay, G4QParton* &created)// VGComplTo decay
    7501003{
    7511004  G4int IsParticle=(decay->GetPDGCode()>0) ? -1 : +1; // a quark needs antiquark or diquark
    7521005  G4QPartonPair QuarkPair = CreatePartonPair(IsParticle);
    753   created = QuarkPair.GetParton2();
    754   return hadronizer->Build(QuarkPair.GetParton1(), decay);
     1006  created = QuarkPair.GetParton2();                   // New Parton after splitting
     1007#ifdef debug
     1008  G4cout<<"G4QString::QuarkSplitup: ***Called*** crP="<<created->GetPDGCode()<<G4endl;
     1009#endif
     1010  G4QParton* P1=QuarkPair.GetParton1();
     1011  G4QHadron* result=CreateHadron(P1, decay);         // New Hadron after splitting
     1012  delete P1;                                         // Clean up the temporary parton
     1013  return result;
    7551014} // End of QuarkSplitup
    7561015
     
    7701029      decayQuarkEncoding = Swap;
    7711030    }
    772     G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1;
    773     // if we have a quark, we need antiquark)
     1031    G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1;// Diquark is equivalent to antiquark
    7741032    G4QPartonPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
    775     //... Build new Diquark
    776     G4int QuarkEncoding=QuarkPair.GetParton2()->GetPDGCode();
     1033    G4QParton* P2=QuarkPair.GetParton2();
     1034    G4int QuarkEncoding=P2->GetPDGCode();
     1035    delete P2;
    7771036    G4int i10  = std::max(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
    7781037    G4int i20  = std::min(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
    779     G4int spin = (i10 != i20 && G4UniformRand() <= 0.5)? 1 : 3;
     1038    G4int spin = (i10 != i20 && G4UniformRand() <= 0.5) ? 1 : 3;
    7801039    G4int NewDecayEncoding = -1*IsParticle*(i10 * 1000 + i20 * 100 + spin);
    781     created = CreateParton(NewDecayEncoding);
    782     G4QParton* decayQuark=CreateParton(decayQuarkEncoding);
    783     return hadronizer->Build(QuarkPair.GetParton1(), decayQuark);
     1040    created = new G4QParton(NewDecayEncoding);
     1041#ifdef debug
     1042    G4cout<<"G4QString::DiQuarkSplitup: inside, crP="<<created->GetPDGCode()<<G4endl;
     1043#endif
     1044    G4QParton* decayQuark= new G4QParton(decayQuarkEncoding);
     1045    G4QParton* P1=QuarkPair.GetParton1();
     1046    G4QHadron* newH=CreateHadron(P1, decayQuark);
     1047    delete P1;
     1048    delete decayQuark;
     1049    return newH;
    7841050  }
    7851051  else
     
    7871053    //... Diquark does not break
    7881054    G4int IsParticle=(decay->GetPDGCode()>0) ? +1 : -1;
    789      // if we have a diquark, we need quark)
    7901055    G4QPartonPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
    7911056    created = QuarkPair.GetParton2();
    792     return hadronizer->Build(QuarkPair.GetParton1(), decay);
     1057#ifdef debug
     1058    G4cout<<"G4QString::DiQuarkSplitup: diQ not break, crP="<<created->GetPDGCode()<<G4endl;
     1059#endif
     1060    G4QParton* P1=QuarkPair.GetParton1();
     1061    G4QHadron* newH=CreateHadron(P1, decay);
     1062    delete P1;
     1063    return newH;
    7931064 }
    7941065} // End of DiQuarkSplitup
     
    7961067G4QPartonPair G4QString::CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks)
    7971068{
     1069#ifdef debug
     1070                G4cout<<"G4QString::CreatePartonPair: ***Called***, P="<<NeedParticle<<", ALLOWdQ="
     1071        <<AllowDiquarks<<G4endl;
     1072#endif
    7981073  //  NeedParticle = {+1 for Particle, -1 for AntiParticle}
    7991074  if(AllowDiquarks && G4UniformRand() < DiquarkSuppress)
     
    8021077    G4int q1  = SampleQuarkFlavor();
    8031078    G4int q2  = SampleQuarkFlavor();
    804     G4int spin = (q1 != q2 && G4UniformRand() <= 0.5)? 1 : 3;
     1079    G4int spin = (q1 != q2 && G4UniformRand() <= 0.5) ? 1 : 3; // @@ 0.5 M.K.?
    8051080    // Convention: quark with higher PDG number is first
    8061081    G4int PDGcode = (std::max(q1,q2) * 1000 + std::min(q1,q2) * 100 + spin) * NeedParticle;
    807     return G4QPartonPair(CreateParton(-PDGcode),CreateParton(PDGcode));
     1082#ifdef debug
     1083                  G4cout<<"G4QString::CreatePartonPair: Created dQ-AdQ, PDG="<<PDGcode<<G4endl;
     1084#endif
     1085    return G4QPartonPair(new G4QParton(-PDGcode), new G4QParton(PDGcode));
    8081086  }
    8091087  else
    8101088  {
    811     // Create a Quark - AntiQuark pair, first in pair  IsParticle
     1089    // Create a Quark - AntiQuark pair, first in pair is a Particle
    8121090    G4int PDGcode=SampleQuarkFlavor()*NeedParticle;
    813     return G4QPartonPair(CreateParton(PDGcode),CreateParton(-PDGcode));
     1091#ifdef debug
     1092                G4cout<<"G4QString::CreatePartonPair: Created Q-aQ, PDG="<<PDGcode<<G4endl;
     1093#endif
     1094    return G4QPartonPair(new G4QParton(PDGcode), new G4QParton(-PDGcode));
    8141095  }
    8151096} // End of CreatePartonPair
     1097
     1098// Creation of the Meson out of two partons (q, anti-q)
     1099G4QHadron* G4QString::CreateMeson(G4QParton* black, G4QParton* white, Spin theSpin)
     1100{
     1101  static G4double scalarMesonMixings[6]={0.5, 0.25, 0.5, 0.25, 1.0, 0.5};
     1102  static G4double vectorMesonMixings[6]={0.5, 0.0, 0.5, 0.0, 1.0, 1.0};
     1103  G4int id1= black->GetPDGCode();
     1104  G4int id2= white->GetPDGCode();
     1105#ifdef debug
     1106  G4cout<<"G4QString::CreateMeson: bT="<<black->GetType()<<"("<<id1<<"), wT="
     1107        <<white->GetType()<<"("<<id2<<")"<<G4endl;
     1108#endif
     1109  if (std::abs(id1) < std::abs(id2))     // exchange black and white
     1110  {
     1111    G4int xchg = id1;
     1112    id1 = id2; 
     1113    id2 = xchg;
     1114  }
     1115  if(std::abs(id1)>3)
     1116  {
     1117    G4cerr<<"***G4QString::CreateMeson: q1="<<id1<<", q2="<<id2
     1118          <<" while CHIPS is only SU(3)"<<G4endl;
     1119    G4Exception("G4QString::CreateMeson:","72",FatalException,"HeavyQuarkFound");
     1120  }
     1121  G4int PDGEncoding=0;
     1122  if(!(id1+id2))                      // annihilation case (neutral)
     1123  {     
     1124    G4double rmix = G4UniformRand();
     1125    G4int    imix = 2*std::abs(id1) - 1;
     1126    if(theSpin == SpinZero)
     1127       PDGEncoding = 110*(1 + G4int(rmix + scalarMesonMixings[imix - 1])
     1128                            + G4int(rmix + scalarMesonMixings[imix]    ) ) +  theSpin;
     1129    else
     1130       PDGEncoding = 110*(1 + G4int(rmix + vectorMesonMixings[imix - 1])
     1131                            + G4int(rmix + vectorMesonMixings[imix]    ) ) +  theSpin;
     1132  }
     1133  else
     1134  {
     1135    PDGEncoding = 100 * std::abs(id1) + 10 * std::abs(id2) +  theSpin; 
     1136    G4bool IsUp = (std::abs(id1)&1) == 0; // quark 1 is up type quark (u or c?)
     1137    G4bool IsAnti = id1 < 0;              // quark 1 is an antiquark?
     1138    if( (IsUp && IsAnti) || (!IsUp && !IsAnti) )  PDGEncoding = - PDGEncoding;
     1139    // Correction for the true neutral mesons
     1140    if( PDGEncoding == -111 || PDGEncoding == -113 || PDGEncoding == -223 ||
     1141        PDGEncoding == -221 || PDGEncoding == -331 || PDGEncoding == -333 )
     1142                                                               PDGEncoding = - PDGEncoding;
     1143  }
     1144  G4QHadron* Meson= new G4QHadron(PDGEncoding);
     1145#ifdef debug
     1146  G4cout<<"G4QString::CreateBaryon: Meson is created with PDG="<<PDGEncoding<<G4endl;
     1147#endif
     1148  //delete black;                          // It is better to delete here and consider 
     1149  //delete white;                          // the hadron creation as a delete equivalent
     1150  return Meson;
     1151}
     1152
     1153// Creation of the Baryon out of two partons (q, di-q), (anti-q, anti-di-q)
     1154G4QHadron* G4QString::CreateBaryon(G4QParton* black, G4QParton* white, Spin theSpin)
     1155{
     1156  G4int id1= black->GetPDGCode();
     1157  G4int id2= white->GetPDGCode();
     1158#ifdef debug
     1159  G4cout<<"G4QString::CreateBaryon: bT="<<black->GetType()<<"("<<id1<<"), wT="
     1160        <<white->GetType()<<"("<<id2<<")"<<G4endl;
     1161#endif
     1162  if(std::abs(id1) < std::abs(id2))
     1163  {
     1164    G4int xchg = id1;
     1165    id1 = id2; 
     1166    id2 = xchg;
     1167  }
     1168  if(std::abs(id1)<1000 || std::abs(id2)> 3)
     1169  {
     1170    G4cerr<<"***G4QString::CreateBaryon: q1="<<id1<<", q2="<<id2
     1171          <<" can't create a Baryon"<<G4endl;
     1172    G4Exception("G4QString::CreateBaryon:","72",FatalException,"WrongQdQSequence");
     1173  }
     1174  G4int ifl1= std::abs(id1)/1000;
     1175  G4int ifl2 = (std::abs(id1) - ifl1 * 1000)/100;
     1176  G4int diquarkSpin = std::abs(id1)%10;
     1177  G4int ifl3 = id2;
     1178  if (id1 < 0) {ifl1 = - ifl1; ifl2 = - ifl2;}
     1179  //... Construct baryon, distinguish Lambda and Sigma baryons.
     1180  G4int kfla = std::abs(ifl1);
     1181  G4int kflb = std::abs(ifl2);
     1182  G4int kflc = std::abs(ifl3);
     1183  G4int kfld = std::max(kfla,kflb);
     1184        kfld = std::max(kfld,kflc);
     1185  G4int kflf = std::min(kfla,kflb);
     1186        kflf = std::min(kflf,kflc);
     1187  G4int kfle = kfla + kflb + kflc - kfld - kflf;
     1188  //... baryon with content uuu or ddd or sss has always spin = 3/2
     1189  if(kfla==kflb && kflb==kflc) theSpin=SpinThreeHalf;   
     1190
     1191  G4int kfll = 0;
     1192  if(theSpin == SpinHalf && kfld > kfle && kfle > kflf)
     1193  {
     1194    // Spin J=1/2 and all three quarks different
     1195    // Two states exist: (uds -> lambda or sigma0)
     1196    //   -  lambda: s(ud)0 s : 3122; ie. reverse the two lighter quarks
     1197    //   -  sigma0: s(ud)1 s : 3212
     1198    if(diquarkSpin == 1 )
     1199    {
     1200       if ( kfla == kfld) kfll = 1; // heaviest quark in diquark
     1201       else kfll = G4int(0.25 + G4UniformRand());
     1202    }   
     1203    if(diquarkSpin==3 && kfla!=kfld) kfll = G4int(0.75+G4UniformRand());
     1204  }
     1205  G4int PDGEncoding=0;
     1206  if (kfll == 1) PDGEncoding = 1000 * kfld + 100 * kflf + 10 * kfle + theSpin;
     1207  else           PDGEncoding = 1000 * kfld + 100 * kfle + 10 * kflf + theSpin;
     1208  if (id1 < 0) PDGEncoding = -PDGEncoding;
     1209  G4QHadron* Baryon= new G4QHadron(PDGEncoding);
     1210#ifdef debug
     1211  G4cout<<"G4QString::CreateBaryon: Baryon is created with PDG="<<PDGEncoding<<G4endl;
     1212#endif
     1213  //delete black;                          // It is better to delete here and consider 
     1214  //delete white;                          // the hadron creation as a delete equivalent
     1215  return Baryon;
     1216} // End of CreateBaryon
     1217
     1218G4QHadron* G4QString::CreateHadron(G4QParton* black, G4QParton* white)
     1219{
     1220  //static G4double mesonLowSpin = 0.25;      // probability to create scalar meson (2s+1)
     1221  //static G4double baryonLowSpin= 1./3.;     // probability to create 1/2 baryon  (2s+1)
     1222  static G4double mesonLowSpin = 0.5;      // probability to create scalar meson (spFlip)
     1223  static G4double baryonLowSpin= 0.5;      // probability to create 1/2 baryon (spinFlip)
     1224  G4int bT=black->GetType();
     1225  G4int wT=white->GetType();
     1226#ifdef debug
     1227  G4cout<<"G4QString::CreateHadron: bT="<<bT<<"("<<black->GetPDGCode()<<"), wT="<<wT<<"("
     1228        <<white->GetPDGCode()<<")"<<G4endl;
     1229#endif
     1230  if(bT==2 || wT==2)
     1231  {
     1232    // Baryon consists of quark and at least one di-quark
     1233    Spin spin = (G4UniformRand() < baryonLowSpin) ? SpinHalf : SpinThreeHalf;
     1234#ifdef debug
     1235    G4cout<<"G4QString::CreateHadron: ----> Baryon is under creation"<<G4endl;
     1236#endif
     1237    return CreateBaryon(black, white, spin);
     1238  }
     1239  else
     1240  {
     1241    // Meson consists of quark and abnti-quark
     1242    Spin spin = (G4UniformRand() < mesonLowSpin) ? SpinZero : SpinOne;
     1243#ifdef debug
     1244    G4cout<<"G4QString::CreateHadron: ----> Meson is under creation"<<G4endl;
     1245#endif
     1246    return CreateMeson(black, white, spin);
     1247  }
     1248} // End of Create Hadron
     1249
     1250// Creation of only High Spin (2,3/2) hadrons
     1251G4QHadron* G4QString::CreateLowSpinHadron(G4QParton* black, G4QParton* white)
     1252{
     1253  G4int bT=black->GetType();
     1254  G4int wT=white->GetType();
     1255#ifdef debug
     1256  G4cout<<"G4QString::CreateLowSpinHadron: ***Called***, bT="<<bT<<"("<<black->GetPDGCode()
     1257        <<"), wT="<<wT<<"("<<white->GetPDGCode()<<")"<<G4endl;
     1258#endif
     1259  if(bT == 1 && wT == 1)
     1260  {
     1261#ifdef debug
     1262    G4cout<<"G4QString::CreateLowSpinHadron: ----> Meson is under creation"<<G4endl;
     1263#endif
     1264    return CreateMeson(black, white, SpinZero);
     1265  }
     1266  else                  // returns a SpinThreeHalf Baryon if all quarks are the same
     1267  {
     1268#ifdef debug
     1269    G4cout<<"G4QString::CreateLowSpinHadron: ----> Baryon is under creation"<<G4endl;
     1270#endif
     1271    return CreateBaryon(black, white, SpinHalf);
     1272  }
     1273} // End of CreateLowSpinHadron
     1274
     1275// Creation of only High Spin (2,3/2) hadrons
     1276G4QHadron* G4QString::CreateHighSpinHadron(G4QParton* black, G4QParton* white)
     1277{
     1278  G4int bT=black->GetType();
     1279  G4int wT=white->GetType();
     1280#ifdef debug
     1281  G4cout<<"G4QString::CreateHighSpinHadron:***Called***, bT="<<bT<<"("<<black->GetPDGCode()
     1282        <<"), wT="<<wT<<"("<<white->GetPDGCode()<<")"<<G4endl;
     1283#endif
     1284  if(bT == 1 && wT == 1)
     1285  {
     1286#ifdef debug
     1287    G4cout<<"G4QString::CreateHighSpinHadron: ----> Meson is created"<<G4endl;
     1288#endif
     1289    return CreateMeson(black,white, SpinOne);
     1290  }
     1291  else
     1292  {
     1293#ifdef debug
     1294    G4cout<<"G4QString::CreateHighSpinHadron: ----> Baryon is created"<<G4endl;
     1295#endif
     1296    return CreateBaryon(black,white,SpinThreeHalf);
     1297  }
     1298} // End of CreateHighSpinHadron
  • trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/src/G4Quasmon.cc

    r1055 r1196  
    2828//
    2929//
    30 // $Id: G4Quasmon.cc,v 1.111 2009/05/27 08:53:15 mkossov Exp $
    31 // GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
     30// $Id: G4Quasmon.cc,v 1.119 2009/11/16 18:15:01 mkossov Exp $
     31// GEANT4 tag $Name: geant4-09-03-cand-01 $
    3232//
    3333//      ---------------- G4Quasmon ----------------
     
    294294#ifdef debug
    295295  G4cout<<"G4Quasmon::HadrQ:*=>>>START QUASMON HADRONIZATION<<<=*, aP="<<addPhoton<<",Env="
    296         <<qEnv<<qEnv.GetProbability()<<G4endl;
     296        <<qEnv<<qEnv.GetProbability()<<", #ofQuasms="<<nQuasms<<G4endl;
    297297#endif
    298298  G4bool first=false;
     
    36893689  G4LorentzVector t = qH->Get4Momentum();      // 4-Mom of Chipolino
    36903690#ifdef psdebug
    3691   if(thePDG==113&&fabs(t.m()-770.)<.001)
     3691  if(thePDG==113 && fabs(t.m()-770.)<.001)
    36923692  {
    36933693    G4cerr<<"G4Q::FillHadronVector: PDG="<<thePDG<<",M="<<t.m()<<G4endl;
     
    46284628                                   <<",pN="<<barot-charge<<", cPDG="<<cPDG<<G4endl;
    46294629#endif
    4630                   if(possib&&charge<=envZ&&barot-charge<=envN)
     4630                  if(possib && charge<=envZ && barot-charge<=envN)
    46314631                  {
    4632                     G4QContent rQQC = valQ+ioQC;  // Quark Content of Residual Quasmon
     4632                    //G4QContent rQQC = valQ+ioQC;  // Quark Content of Residual Quasmon
    46334633                    ///////////G4int rQU=rQQC.GetU()-rQQC.GetAU();
    46344634                    ///////////G4int rQD=rQQC.GetD()-rQQC.GetAD();
     
    47214721                                      <<kCut<<",E="<<E<<">"<<nDelta<<",p="<<parPDG<<G4endl;
    47224722#endif
    4723                       if(resPDG&&minM>0.) // Kinematical analysis of hadronization
     4723                      if(resPDG && minM>0.) // Kinematical analysis of hadronization
    47244724                      {
    47254725#ifdef pdebug
     
    50945094                          // noc   - a#of o-quarks in the Parent Cluster
    50955095                          // pUD   - suppression for NuclearClusters fare from Z=N Mirror
     5096                          G4QContent rQQC = valQ+ioQC;// Quark Content of Residual Quasmon
     5097                          G4int BarRQC=rQQC.GetBaryonNumber(); // Res Quasmon BaryonNumber
     5098                          G4int StrRQC=rQQC.GetStrangeness();  // Res Quasmon Strangeness
     5099                          if(BarRQC==2 && !StrRQC)             // --> DiBaryon Correction
     5100                          {
     5101                            G4int ChgRQC=rQQC.GetCharge();     // Res Quasmon Charge
     5102                            if(ChgRQC==1) probab/=2;           // Only one S
     5103                            else          probab*=2;           // One S + three P
     5104                          }
    50965105#ifdef pdebug
    50975106                          if(pPrint)G4cout<<"G4Q::CHP:prob="<<probab<<",qF="<<qFact<<",iq="
     
    51225131#endif
    51235132                        pc++;
    5124                       }
    5125                     }
     5133                      }                       // >>>> End of the Minimum mass cut
     5134                    }                         // >>>> End of the isotope focusing
    51265135#ifdef sdebug
    51275136                    else G4cout<<"***G4Q::CHP:dI="<<dI<<",cC="<<cC<<G4endl;
    51285137#endif
    5129                   }
     5138                  }                           // >>>> End of tje final state possibility
    51305139                }                             // >>>> End of if of QuarkExchangePossibility
    51315140              }                               // +++> End of if of existinr residual Q Code
     
    51835192          }
    51845193          curQ -= candQC;                    // This is a quark content of residual quasmon
    5185           resPDG = curQ.GetSPDGCode();       // PDG for the lowest residual hadronic state
     5194          resPDG = curQ.GetSPDGCode();       // PDG of theLowest residualQuas hadronicState
    51865195          G4QContent resTQC = curQ+envQC;    // Total nuclear Residual Quark Content
    51875196          G4double resTM=G4QPDGCode(resTQC.GetSPDGCode()).GetMass();
    51885197#ifdef pdebug
    5189           G4bool priCon=aPDG<10000&&aPDG%10<3;
     5198          G4bool priCon = aPDG < 10000 && aPDG%10 < 3;
    51905199          if(priCon) G4cout<<"G4Q::CHP:***>>cPDG="<<cPDG<<",cQC="<<candQC<<",comb="<<comb
    51915200                           <<",curQC="<<curQ<<",mQ="<<mQ<<",ab="<<absb<<G4endl;
     
    52035212          if (comb && resPDG && totMass > frM-CB+resTM &&
    52045213             ((resPDG > 80000000 && resPDG != 90000000) || resPDG<10000) )
    5205    {
     5214          {
    52065215#ifdef pdebug
    52075216            if(priCon) G4cout<<"G4Q::CHP:ind="<<index<<",qQC="<<valQ<<mQ<<",cPDG="<<cPDG
     
    52795288#endif
    52805289               
    5281                   if(qBar>1&&baryn>0)           //---> High baryon number ("nuclear") case
    5282                   {
    5283                     G4QContent rtQC=curQ+envQC;      // Total Residual Quark Content @@ ??
    5284                     G4QNucleus rtN(rtQC);             // Create pseudo-nucleus for residual
    5285                     //////G4double rtM =rtN.GetMZNS();// Min Mass of total residual Nucleus
    5286                     /////////G4double bnRQ=rtM-envM;      // Bound mass of residual Quasmon
    5287                   }
    5288                   else                        //---> Low baryon number case (tuned on p-ap)
    5289                   {
     5290                  //if(qBar > 1 && baryn > 0)     //---> HighBaryonNumber ("nuclear") case
     5291                  //{
     5292                  //  //G4QContent rtQC=curQ+envQC; // Total Residual Quark Content @@ ??
     5293                  //  //G4QNucleus rtN(rtQC);       // Create pseudo-nucleus for residual
     5294                  //  /////G4double rtM =rtN.GetMZNS();// MinMass of total residual Nucleus
     5295                  //  /////////G4double bnRQ=rtM-envM; // Bound mass of residual Quasmon
     5296                  //}
     5297                  //else                        //---> LowBaryonNumber case (tuned on p-ap)
     5298                  //{
    52905299                    if(cPDG==110||cPDG==220||cPDG==330) probability*=comb; // f0 has spin 0
    52915300                    else probability*=comb*(abs(cPDG)%10); // Spin of resonance
    5292                   }
     5301                    G4int BarRQC=curQ.GetBaryonNumber();   // Res Quasmon BaryonNumber
     5302                    G4int StrRQC=curQ.GetStrangeness();    // Res Quasmon Strangeness
     5303                    if(BarRQC==2 && !StrRQC)               // --> DiBaryon Correction
     5304                    {
     5305                      G4int ChgRQC=curQ.GetCharge();       // Res Quasmon Charge
     5306                      if(ChgRQC==1) probability/=2;        // Only one S
     5307                      else          probability*=2;        // One S + three P
     5308                    }
     5309                  //}
    52935310                }
    52945311              }
     
    53175334                             <<"+rTM="<<resTM<<"-CB="<<CB<< G4endl;
    53185335#endif
    5319           }
     5336          } // ---> End of the possibility IF
    53205337          //if(cPDG==111) secondProbab = 1.;
    5321         }// ---> End of Hadronic Case of fragmentation
     5338        }   // ---> End of Hadronic Case of fragmentation
    53225339        else probability=0.;
    53235340#ifdef pdebug
     
    56305647    {
    56315648      G4cerr<<"---Warning---G4Q::DecayQHadr:n="<<nPart<<",ch#"<<i<<",PDG="<<thePDG<<G4endl;
    5632       return false;
     5649      theFragments->push_back(qH);                    // Fill as it is (del.equiv.)
     5650      return theFragments;
    56335651    }
    56345652#ifdef pdebug
     
    56895707          delete fHadr;                                   // Delete "new fHadr"
    56905708          delete sHadr;                                   // Delete "new sHadr"
     5709#ifdef pdebug
    56915710          G4cerr<<"---Warning---G4Q::DecayQHadron:in2,PDGC="<<thePDG<<", ch#"<<i<<": 4M="
    56925711                <<qH->Get4Momentum()<<"("<<qH->GetMass()<<")->"<<f4Mom<<"+"<<s4Mom<<G4endl;
    56935712          //throw G4QException("***Exception***G4Q::DecayQHadron: Failed to decay in 2");
     5713#endif
    56945714          theFragments->push_back(qH);                    // Fill as it is (del.equiv.)
    56955715          return theFragments;
     
    58105830        else  // Randomize masses of all three Hadrons
    58115831        {
    5812           G4QParticle* sPart=theWorld->GetQParticle(cV[1]);//Pt for theSecondHadr
    5813           G4double smim = sPart->MinMassOfFragm();        // MinMassLim for theSecondHadron
     5832          G4QParticle* sPart=theWorld->GetQParticle(cV[1]); // Pt for theSecondHadr
     5833          G4double smim = sPart->MinMassOfFragm();          // MinMassLim for SecondHadron
    58145834          G4QParticle* tPart=theWorld->GetQParticle(cV[2]); // Pt for the Third Hadron
    5815           G4double tmim = tPart->MinMassOfFragm();           // MinMassLimit for theThirdHd
    5816           G4double fdm = m - smim - tmim;                    // MaxMassLimit for theFirstHd
     5835          G4double tmim = tPart->MinMassOfFragm();          // MinMassLimit for theThirdHd
     5836          G4double fdm = m - smim - tmim;                   // MaxMassLimit for theFirstHd
    58175837          G4QParticle* fPart=theWorld->GetQParticle(cV[0]); // Pt for the First Hadron
    5818           fHadr = new G4QHadron(fPart,fdm);                  // the First Hadron is created
     5838          fHadr = new G4QHadron(fPart,fdm);                 // the First Hadron is created
    58195839          if(fPDG<0) fHadr->MakeAntiHadron();
    5820           m-=fHadr->GetMass();                               // Reduce the residual MaxMass
    5821           G4double  sdm = m - tmim;                          // MaxMassLimit for theSecondH
    5822           sHadr = new G4QHadron(sPart,sdm);                  // theSecondHadron is created
     5840          m-=fHadr->GetMass();                              // Reduce the residual MaxMass
     5841          G4double  sdm = m - tmim;                         // MaxMassLimit for theSecondH
     5842          sHadr = new G4QHadron(sPart,sdm);                 // theSecondHadron is created
    58235843          if(sPDG<0) sHadr->MakeAntiHadron();
    5824           G4double  tdm = m - sHadr->GetMass();              // MaxMassLimit for theThird H
    5825           tHadr = new G4QHadron(tPart,tdm);                  // the Third Hadron is created
     5844          G4double  tdm = m - sHadr->GetMass();             // MaxMassLimit for theThird H
     5845          tHadr = new G4QHadron(tPart,tdm);                 // the Third Hadron is created
    58265846          if(tPDG<0) tHadr->MakeAntiHadron();
    58275847        }     
     
    58465866          G4cerr<<"---Warning---G4Q::DecayQHadron:in3,PDGC="<<thePDG<<", ch#"<<i<<G4endl;
    58475867          theFragments->push_back(qH);             // Fill as it is (delete equivalent)
    5848           return false;
     5868          return theFragments;
    58495869        }
    58505870        else
     
    60066026  return theFragments;
    60076027} // End of "Fragment"
     6028
     6029// Boost Quasmon 4-momentum, using Boost Lorentz vector
     6030void G4Quasmon::Boost(const G4LorentzVector& boost4M)
     6031
     6032  // see CERNLIB short writeup U101 for the algorithm
     6033  G4double bm=boost4M.mag();
     6034  G4double factor = (q4Mom.vect()*boost4M.vect()/(boost4M.e()+bm) - q4Mom.e())/bm;
     6035  q4Mom.setE(q4Mom.dot(boost4M)/bm);
     6036  q4Mom.setVect(factor*boost4M.vect() + q4Mom.vect());
     6037} // End of Boost
Note: See TracChangeset for help on using the changeset viewer.