Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Chips.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Chips.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Chips.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4Chips.hh,v 1.19 2006/06/29 20:05:53 gunter Exp $
-// GEANT4 tag $Name: geant4-09-02 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4Chips ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QBesIKJY.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QBesIKJY.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QBesIKJY.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QBesIKJY.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QBesIKJY ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCHIPSWorld.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCHIPSWorld.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCHIPSWorld.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QCHIPSWorld.hh,v 1.26 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCHIPSWorld ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidate.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidate.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidate.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QCandidate.hh,v 1.29 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidate ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidateVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidateVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QCandidateVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QCandidateVector.hh,v 1.22 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QChipolino.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QChipolino.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QChipolino.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QChipolino.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QChipolino ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QContent.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QContent.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QContent.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QContent.hh,v 1.29 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QContent.hh,v 1.31 2009/07/24 16:37:03 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QContent ----------------
@@ -55,4 +55,5 @@
 public:
   G4QContent(G4int d=0, G4int u=0, G4int s=0, G4int ad=0, G4int au=0, G4int as=0);
+  G4QContent(std::pair<G4int,G4int> PP); // Create HadronQC from two partons
   G4QContent(const G4QContent& rhs);     // Copy constructor by value
   G4QContent(G4QContent* rhs);           // Copy constructor by pointer
@@ -116,4 +117,7 @@
   G4int GetADAS() const;    // A#of anti-ds-di-quarks
   G4int GetAUAS() const;    // A#of anti-us-di-quarks
+
+  std::pair<G4int,G4int> MakePartonPair() const;// Make PDG's of PartonPairs for Mes&Baryon
+  G4int AddParton(G4int pPDG) const; // Add parton with pPDG to the hadron with this QC
 
   // Modifiers
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChan.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChan.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChan.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QDecayChan.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QDecayChan ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChanVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChanVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QDecayChanVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QDecayChanVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QEnvironment.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QEnvironment.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QEnvironment.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QEnvironment.hh,v 1.33 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QEnvironment.hh,v 1.36 2009/11/16 18:15:01 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QEnvironment ----------------
@@ -44,4 +44,5 @@
 #define G4QEnvironment_h 1
 
+#include "G4RandomDirection.hh"
 #include "G4QuasmonVector.hh"
 
@@ -122,5 +123,5 @@
 
 //General function makes Random Unit 3D-Vector
-G4ThreeVector RndmDir();
+//G4ThreeVector RndmDir();
 
 // Inline functions
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QException.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QException.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QException.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QException.hh,v 1.11 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QException ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadron.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QHadron.hh,v 1.37 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QHadron.hh,v 1.46 2009/09/08 14:04:14 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QHadron ----------------
@@ -47,4 +47,6 @@
 #include "G4QParticle.hh"
 #include "G4QPartonVector.hh"
+#include "G4QPartonPair.hh"
+#include "G4LorentzRotation.hh"
 #include <list>
 
@@ -76,5 +78,7 @@
   G4QPDGCode            GetQPDG()         const;    // Get QPDG of the Hadron
   G4double              GetSpin()         const{return .5*(GetPDGCode()%10-1);}
-  G4LorentzVector       Get4Momentum()    const;    // Get 4-mom of the Hadron
+  G4LorentzVector       Get4Momentum()    const{return theMomentum;} // Get 4-mom of Hadron
+  G4ThreeVector         Get3Momentum()    const{return theMomentum.vect();}// Get 3-mom ofH
+  G4double              GetEnergy()       const{return theMomentum.e();} // Get E of Hadron
   G4QContent            GetQC()           const;    // Get private quark content
   G4double              GetMass()         const;    // Get a mass of the Hadron
@@ -86,11 +90,11 @@
   G4int                 GetBaryonNumber() const;    // Get Baryon Number of the Hadron
   const G4ThreeVector&  GetPosition()     const;    // Get hadron coordinates
-  G4int                 GetSoftCollisionCount();    // Get QGS Counter of collisions
-  G4bool                IsSplit() {return isSplit;} // Check that hadron has been split
   G4double              GetBindingEnergy() {return bindE;}// Returns binding E in NucMatter
   G4double              GetFormationTime() {return formTime;} // Returns formation time
-
+  std::list<G4QParton*> GetColor() {return Color;}  // pointer to quarks/anti-diquarks
+  std::list<G4QParton*> GetAntiColor() {return AntiColor;}//pointer to anti-quarks/diquarks
   // Modifiers
   void SetQPDG(const G4QPDGCode& QPDG);             // Set QPDG of the Hadron
+  void SetPDGCode(const G4QPDGCode& PDG){SetQPDG(G4QPDGCode(PDG));}// Set PDGCode of Hadron
   void Set4Momentum(const G4LorentzVector& aMom);   // Set 4-mom of the Hadron
   void SetQC(const G4QContent& newQC);              // Set new private quark content
@@ -99,8 +103,7 @@
   void MakeAntiHadron();                            // Make AntiHadron of this Hadron
   void SetPosition(const G4ThreeVector& aPosition); // Set coordinates of hadron position
-  void IncrementCollisionCount(G4int aCount);       // Increnment counter of collisions
-  void SetCollisionCount(G4int aCount);             // Set counter of QGSM collisions
-  void Splitting() {isSplit = true;}                // Put Up a flag that splitting is done
+  void IncrementCollisionCount(G4int aCount) {theCollisionCount+=aCount;}// IncrTheCCounter
   void SplitUp();                                   // Make QGSM String Splitting of Hadron
+  G4QPartonPair* SplitInTwoPartons();               // RandomSplit ofTheHadron in 2 partons
   G4QParton* GetNextParton();                       // Next Parton in a string
   G4QParton* GetNextAntiParton();                   // Next Anti-Parton in a string
@@ -108,4 +111,5 @@
   void Boost(const G4LorentzVector& theBoost);      // Boosts hadron's 4-Momentum using 4M
   void Boost(const G4ThreeVector& B){theMomentum.boost(B);} // Boosts 4-Momentum using v/c
+  void LorentzRotate(const G4LorentzRotation& rotation){theMomentum=rotation*theMomentum;}
   void SetFormationTime(G4double fT){formTime=fT;}  // Defines formationTime for the Hadron
 
@@ -126,10 +130,10 @@
                      G4LorentzVector& dir, G4double cosp);
   void   Init3D();                         // Initializes 3D nucleus with (Pos,4M)nucleons
-
 private:
   // Private methods
   void DefineQC(G4int PDGCode);
   G4QParton* BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCode);
-  G4double SampleX(G4double anXmin, G4int nSea, G4int theTotalSea, G4double aBeta);
+  G4double SampleCHIPSX(G4double anXtot, G4int nSea);
+  G4double* RandomX(G4int nPart);
   void GetValenceQuarkFlavors(G4QParton* &Part1,G4QParton* &Part2);
   G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare);
@@ -137,16 +141,14 @@
   G4bool SplitBaryon(G4int PDGcode, G4int* aEnd, G4int* bEnd);
 
+protected:
+  G4LorentzVector        theMomentum;       // The 4-mom of Hadron
+
 private:
   // Static Parameters of QGSM Splitting
-  static G4double alpha;            // changing rapidity distribution for all
-  static G4double beta;             // changing rapidity distribution for projectile region
-  static G4double theMinPz;         // Can be from 14 to 140 MeV
   static G4double StrangeSuppress;  // ? M.K.
-  static G4double sigmaPt;          // Can be 0
+  static G4double sigmaPt;          // Can be 0 ?
   static G4double widthOfPtSquare;  // ? M.K.
-  static G4double minTransverseMass;// ? M.K.
   // Body 
   G4QPDGCode             theQPDG;           // Instance of QPDG for the Hadron
-  G4LorentzVector        theMomentum;       // The 4-mom of Hadron
   G4QContent             valQ;              // QC (@@ for Quasmon and Chipolino?)
   G4int                  nFragm;            // 0 - stable, N - decayed in N part's
@@ -156,6 +158,6 @@
   G4bool                 isSplit;           // Flag, that splitting was done
   G4bool                 Direction;         // FALSE=target, TRUE=projectile
-  std::list<G4QParton*> Color;              // container for quarks & anti-diquarks
-  std::list<G4QParton*> AntiColor;          // container for anti-quarks & diquarks
+  std::list<G4QParton*>  Color;             // container for quarks & anti-diquarks
+  std::list<G4QParton*>  AntiColor;         // container for anti-quarks & diquarks
   G4double               bindE;             // Binding energy in nuclear matter
   G4double               formTime;          // Formation time for the hadron
@@ -171,5 +173,4 @@
 inline G4QPDGCode      G4QHadron::GetQPDG()         const  {return theQPDG;}
 inline G4QContent      G4QHadron::GetQC()           const  {return valQ;}
-inline G4LorentzVector G4QHadron::Get4Momentum()    const  {return theMomentum;}
 inline G4int           G4QHadron::GetNFragments()   const  {return nFragm;}
 //@@ This is an example how to make other inline selectors for the 4-Momentum of the Hadron
@@ -181,5 +182,5 @@
 inline G4int           G4QHadron::GetBaryonNumber() const  {return valQ.GetBaryonNumber();}
 inline const G4ThreeVector& G4QHadron::GetPosition() const {return thePosition;}
-inline G4int           G4QHadron::GetSoftCollisionCount()  {return theCollisionCount;}
+//inline G4int           G4QHadron::GetSoftCollisionCount()  {return theCollisionCount;}
 
 inline void            G4QHadron::MakeAntiHadron()    {if(TestRealNeutral()) NegPDGCode();}
@@ -188,24 +189,7 @@
 inline void   G4QHadron::SetNFragments(const G4int& nf)             {nFragm=nf;}
 inline void   G4QHadron::SetPosition(const G4ThreeVector& position) {thePosition=position;}
-inline void   G4QHadron::IncrementCollisionCount(G4int aCount) {theCollisionCount+=aCount;}
-inline void   G4QHadron::SetCollisionCount(G4int aCount)       {theCollisionCount =aCount;}
 
 inline void   G4QHadron::NegPDGCode()                  {theQPDG.NegPDGCode(); valQ.Anti();}
 inline G4bool G4QHadron::TestRealNeutral()             { return theQPDG.TestRealNeutral();}
 
-inline G4QParton* G4QHadron::GetNextParton()
-{
-   if(Color.size()==0) return 0;
-   G4QParton* result = Color.back();
-   Color.pop_back();
-   return result;
-}
-
-inline G4QParton* G4QHadron::GetNextAntiParton()
-{
-   if(AntiColor.size() == 0) return 0;
-   G4QParton* result = AntiColor.front();
-   AntiColor.pop_front();
-   return result;
-}
 #endif
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadronVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadronVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QHadronVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QHadronVector.hh,v 1.23 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
@@ -43,5 +43,5 @@
 //
 // $Id: G4QHadronVector.hh,v 1.23 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // ------------------------------------------------------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteraction.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteraction.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteraction.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QInteraction.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QInteraction.hh,v 1.7 2009/08/28 14:49:10 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 
@@ -42,5 +42,6 @@
 // -------------------------------------------------------------------
 //  Short description: Classify the interaction in soft/hard/diffractive
-//  parts for firther treatment by the QGS algorithm.
+//  parts for firther treatment by the QGS algorithm. Pure data class...
+//  Except for the SplitHadrons, which can be done elsewhere (@@ M.K.)
 // ---------------------------------------------------------------------
 
@@ -58,9 +59,11 @@
   G4QHadron* GetTarget() const                          {return theTarget;}
   G4int GetNumberOfSoftCollisions()                     {return theNumberOfSoft;}
+  G4int GetNumberOfDINRCollisions()                     {return theNumberOfDINR;}
   G4int GetNumberOfHardCollisions()                     {return theNumberOfHard;}
   G4int GetNumberOfDiffractiveCollisions()              {return theNumberOfDiffractive;}
-  void  SetTarget(G4QHadron *aTarget)                   {theTarget = aTarget;}
-  void  SetProjectile(G4QHadron *aProjectile)           {theProjectile = aProjectile;}
+  void  SetTarget(G4QHadron* aTarget)                   {theTarget = aTarget;}
+  void  SetProjectile(G4QHadron* aProjectile)           {theProjectile = aProjectile;}
   void  SetNumberOfSoftCollisions(G4int nofSoft)        {theNumberOfSoft = nofSoft;}
+  void  SetNumberOfDINRCollisions(G4int nofDINR)        {theNumberOfDINR = nofDINR;}
   void  SetNumberOfHardCollisions(G4int nofHard)        {theNumberOfHard = nofHard;}
   void  SetNumberOfDiffractiveCollisions(G4int nofDiff) {theNumberOfDiffractive = nofDiff;}
@@ -75,4 +78,5 @@
   G4QHadron* theProjectile;
   G4QHadron* theTarget;
+  G4int theNumberOfDINR;
   G4int theNumberOfHard;
   G4int theNumberOfSoft;
@@ -81,4 +85,2 @@
 
 #endif
-
-
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteractionVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteractionVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QInteractionVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QInteractionVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
@@ -38,5 +38,5 @@
 //
 // $Id: G4QInteractionVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // ------------------------------------------------------------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QIsotope.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QIsotope.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QIsotope.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QIsotope.hh,v 1.6 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QNucleus.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QNucleus.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QNucleus.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QNucleus.hh,v 1.34 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QNucleus.hh,v 1.45 2009/08/31 11:21:48 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QNucleus ----------------
@@ -41,8 +41,10 @@
 #include "G4QCandidateVector.hh"
 #include "G4QHadronVector.hh"
+#include "G4LorentzRotation.hh"
 #include "G4QChipolino.hh"
 #include <utility>
 #include <vector>
 #include "globals.hh"
+#include "G4RandomDirection.hh"
 
 class G4QNucleus : public G4QHadron
@@ -56,6 +58,6 @@
   G4QNucleus(G4int z, G4int n, G4int s=0);                 // At Rest ZNS-Constructor
   G4QNucleus(G4int z, G4int n, G4int s, G4LorentzVector p);// Full ZNS-Constructor
-  //G4QNucleus(const G4QNucleus& right);                     // Copy Constructor by value
-  G4QNucleus(G4QNucleus* right);                           // Copy Constructor by pointer
+  G4QNucleus(G4QNucleus* right, G4bool cop3D = false);     // Copy Constructor by pointer
+  G4QNucleus(const G4QNucleus &right, G4bool cop3D=false); // Copy Constructor by value
   ~G4QNucleus();                                           // Public Destructor
   // Overloaded Operators
@@ -76,6 +78,7 @@
   G4double   GetProbability(G4int bn=0) const {return probVect[bn];} // clust(BarN)probabil
   G4double   GetMZNS()     const {return GetQPDG().GetNuclMass(Z,N,S);} // not H or Q
+  G4double   GetTbIntegral(); // Calculate the integral of T(b)
   G4double   GetGSMass()   const {return GetQPDG().GetMass();}//Nucleus GSMass (not Hadron)
-  G4QContent GetQCZNS()    const                   // Get ZNS quark content of Nucleus
+  G4QContent GetQCZNS()    const                    // Get ZNS quark content of Nucleus
   {
     if(S>=0) return G4QContent(Z+N+N+S,Z+Z+N+S,S,0,0,0);
@@ -84,19 +87,28 @@
   G4int      GetNDefMesonC() const{return nDefMesonC;}; // max#of predefed mesonCandidates
   G4int      GetNDefBaryonC()const{return nDefBaryonC;};// max#of predefed baryonCandidates
-  std::pair<G4double, G4double> RefetchImpactXandY() const {return theImpactParameter;}
   G4double GetDensity(const G4ThreeVector&aPos) {return rho0*GetRelativeDensity(aPos);}
+  G4double GetRho0()                 {return rho0;} // One nucleon prob-density 
   G4double GetRelativeDensity(const G4ThreeVector& aPosition); // Densyty/rho0
+  G4double GetRelWSDensity(const G4double& r)       // Wood-Saxon rho/rho0(r)
+                                        {return 1./(1.+exp((r-radius)/WoodSaxonSurf));}    
+  G4double GetRelOMDensity(const G4double& r2){return exp(-r2/radius);} // OscModelRelDens
   G4double GetRadius(const G4double maxRelativeDenisty=0.5); // Radius of %ofDensity
   G4double GetOuterRadius();                        // Get radius of the most far nucleon
   G4double GetDeriv(const G4ThreeVector& point);    // Derivitive of density
   G4double GetFermiMomentum(G4double density);      // Returns modul of FermyMomentum(dens)
-  G4ThreeVector Get3DFermiMomentum(G4double density, G4double maxMom=-1.)
-  {
-    if(maxMom<0) maxMom=GetFermiMomentum(density);
-    return maxMom*RandomUnitSphere();
-  }
   G4QHadron* GetNextNucleon()
-    {return (currentNucleon>=0&&currentNucleon<GetA()) ? theNucleons[currentNucleon++] :0;}
-  //std::vector<G4double>* GetBThickness() const {return Tb;} // T(b) function, step .1 fm
+  {
+    //G4cout<<"G4QNucleus::GetNextNucleon: cN="<<currentNucleon<<", A="<<GetA()<<G4endl;
+    return (currentNucleon>=0&&currentNucleon<GetA()) ? theNucleons[currentNucleon++] : 0;
+  }
+  void SubtractNucleon(G4QHadron* pNucleon); // Subtract the nucleon from the 3D Nucleus
+  void DeleteNucleons();                     // Deletes all residual nucleons
+  G4LorentzVector GetNucleons4Momentum()
+  {
+    G4LorentzVector sum(0.,0.,0.,0.);
+    for(unsigned i=0; i<theNucleons.size(); i++) sum += theNucleons[i]->Get4Momentum();
+    sum.setE(std::sqrt(sqr(GetGSMass())+sum.v().mag2())); // Energy is corrected !
+    return sum;
+  }
   std::vector<G4double> const* GetBThickness() {return &Tb;} // T(b) function, step .1 fm
 
@@ -117,4 +129,6 @@
   G4bool     Split2Baryons();                       // Is it possible to split two baryons?
   void       ActivateBThickness();                  // Calculate T(b) for nucleus (db=.1fm)
+  G4double   GetBThickness(G4double b);             // Calculates T(b)
+  G4double   GetThickness(G4double b);              // Calculates T(b)/rho(0)
   void       InitByPDG(G4int newPDG);               // Init existing nucleus by new PDG
   void       InitByQC(G4QContent newQC)             // Init existing nucleus by new QCont
@@ -135,10 +149,24 @@
   G4QNucleus operator*=(const G4int& rhs);          // Multiplication of the Nucleus
   G4bool StartLoop();                               // returns size of theNucleons (cN=0)
-  G4bool ReduceSum(G4ThreeVector* momentum, G4double*); // Reduce momentum nonconservation
-  void DoLorentzBoost(const G4LorentzVector& theBoost); // Boost nucleons by 4-vector
-  void DoLorentzBoost(const G4ThreeVector& theBeta);// Boost nucleons by v/c
+  G4bool ReduceSum(G4ThreeVector* vectors, G4ThreeVector sum);// Reduce zero-sum of vectors
+  void SimpleSumReduction(G4ThreeVector* vectors, G4ThreeVector sum); // Reduce zero-V-sum
+  void DoLorentzBoost(const G4LorentzVector& theBoost) // Boost nucleons by 4-vector
+  {
+    theMomentum.boost(theBoost);
+    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->Boost(theBoost);
+  }
+  void DoLorentzRotation(const G4LorentzRotation& theLoRot) // Lorentz Rotate nucleons
+  {
+    theMomentum=theLoRot*theMomentum;
+    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->LorentzRotate(theLoRot);
+  }
+  void DoLorentzBoost(const G4ThreeVector& theBeta)// Boost nucleons by v/c
+  {
+    theMomentum.boost(theBeta);
+    for(unsigned i=0; i<theNucleons.size(); i++) theNucleons[i]->Boost(theBeta);
+  }
   void DoLorentzContraction(const G4LorentzVector&B){DoLorentzContraction(B.vect()/B.e());}
   void DoLorentzContraction(const G4ThreeVector& theBeta); // Lorentz Contraction by v/c
-  void DoTranslation(const G4ThreeVector& theShift); // Used only in GHAD-TFT
+  void DoTranslation(const G4ThreeVector& theShift); // Used only in G4QFragmentation
 
   // Static functions
@@ -147,5 +175,4 @@
 
   // Specific General Functions
-  G4ThreeVector RandomUnitSphere();                 // Randomize position inside UnitSphere
   G4int RandomizeBinom(G4double p,G4int N);         // Randomize according to Binomial Law
   G4double CoulombBarrier(const G4double& cZ=1, const G4double& cA=1, G4double dZ=0.,
@@ -179,4 +206,5 @@
   static G4double mediRatio;      // relative vacuum hadronization probability
   static G4double nucleonDistance;// Distance between nucleons (0.8 fm)
+  static G4double WoodSaxonSurf;  // Surface parameter of Wood-Saxon density (0.545 fm)
   // The basic  
   G4int Z;                        // Z of the Nucleus
@@ -190,11 +218,11 @@
   G4double probVect[256];         // Cluster probability ("a#of issues" can be real) Vector
   // 3D
-  std::pair<G4double, G4double> theImpactParameter; // 2D impact parameter vector bbar
-  G4QHadronVector theNucleons;  // Vector of nucleons of which Nucleus consists of
-  G4int currentNucleon;         // Current nucleon for the NextNucleon (? M.K.)
-  G4double rho0;                // Normalazation density
-  G4double radius;              // Nuclear radius
-  //std::vector<G4double>* Tb;    // T(b) function with step .1 fm (@@ make .1 a parameter)
-  std::vector<G4double> Tb;    // T(b) function with step .1 fm (@@ make .1 a parameter)
+  G4QHadronVector theNucleons;    // Vector of nucleons of which the Nucleus consists of
+  G4int currentNucleon;           // Current nucleon for the NextNucleon (? M.K.)
+  G4double rho0;                  // Normalazation density
+  G4double radius;                // Nuclear radius
+  std::vector<G4double> Tb;       // T(b) function with step .1 fm (@@ make .1 a parameter)
+  G4bool TbActive;                // Flag that the T(b) is activated
+  G4bool RhoActive;               // Flag that the Density is activated
 };
 
@@ -202,4 +230,3 @@
 std::ostream& operator<<(std::ostream& lhs, const G4QNucleus& rhs);
 
-
 #endif
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCode.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCode.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCode.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QPDGCode.hh,v 1.27 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QPDGCode.hh,v 1.30 2009/11/04 11:01:59 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QPDGCode ----------------
@@ -45,8 +45,96 @@
 #include <iostream>
 #include "globals.hh"
-#include "G4ParticleTable.hh"
+// Geant4 particles for consistency of masses only
+// Leptons
+#include "G4MuonPlus.hh"
+#include "G4MuonMinus.hh"
+#include "G4TauMinus.hh"
+#include "G4TauPlus.hh"
+#include "G4Electron.hh"
+#include "G4Positron.hh"
+#include "G4NeutrinoTau.hh"
+#include "G4AntiNeutrinoTau.hh"
+#include "G4NeutrinoMu.hh"
+#include "G4AntiNeutrinoMu.hh"
+#include "G4NeutrinoE.hh"
+#include "G4AntiNeutrinoE.hh"
+// Mesons
+#include "G4PionPlus.hh"
+#include "G4PionMinus.hh"
+#include "G4PionZero.hh"
+#include "G4Eta.hh"
+#include "G4EtaPrime.hh"
+
+#include "G4KaonPlus.hh"
+#include "G4KaonMinus.hh"
+#include "G4KaonZero.hh"
+#include "G4AntiKaonZero.hh"
+#include "G4KaonZeroLong.hh"
+#include "G4KaonZeroShort.hh"
+
+#include "G4DMesonPlus.hh"
+#include "G4DMesonMinus.hh"
+#include "G4DMesonZero.hh"
+#include "G4AntiDMesonZero.hh"
+#include "G4DsMesonPlus.hh"
+#include "G4DsMesonMinus.hh"
+#include "G4JPsi.hh"
+
+#include "G4BMesonPlus.hh"
+#include "G4BMesonMinus.hh"
+#include "G4BMesonZero.hh"
+#include "G4AntiBMesonZero.hh"
+#include "G4BsMesonZero.hh"
+#include "G4AntiBsMesonZero.hh"
+
+
+// Barions
+#include "G4Proton.hh"
+#include "G4AntiProton.hh"
+#include "G4Neutron.hh"
+#include "G4AntiNeutron.hh"
+
+#include "G4Lambda.hh"
+#include "G4SigmaPlus.hh"
+#include "G4SigmaZero.hh"
+#include "G4SigmaMinus.hh"
+#include "G4XiMinus.hh"
+#include "G4XiZero.hh"
+#include "G4OmegaMinus.hh"
+
+#include "G4AntiLambda.hh"
+#include "G4AntiSigmaPlus.hh"
+#include "G4AntiSigmaZero.hh"
+#include "G4AntiSigmaMinus.hh"
+#include "G4AntiXiMinus.hh"
+#include "G4AntiXiZero.hh"
+#include "G4AntiOmegaMinus.hh"
+
+#include "G4LambdacPlus.hh"
+#include "G4SigmacPlusPlus.hh"
+#include "G4SigmacPlus.hh"
+#include "G4SigmacZero.hh"
+#include "G4XicPlus.hh"
+#include "G4XicZero.hh"
+#include "G4OmegacZero.hh"
+
+#include "G4AntiLambdacPlus.hh"
+#include "G4AntiSigmacPlusPlus.hh"
+#include "G4AntiSigmacPlus.hh"
+#include "G4AntiSigmacZero.hh"
+#include "G4AntiXicPlus.hh"
+#include "G4AntiXicZero.hh"
+#include "G4AntiOmegacZero.hh"
+
+// Nuclei
+#include "G4Alpha.hh"
+#include "G4Deuteron.hh"
+#include "G4He3.hh"
+#include "G4Triton.hh"
+
+//ions
+#include "G4GenericIon.hh"
 #include "G4NucleiProperties.hh"
-#include "G4NucleiPropertiesTable.hh"
-#include "G4ParticleTypes.hh"
+// --- End of consistency headers ---
 
 #include "G4QContent.hh"
@@ -102,6 +190,8 @@
   // General
   G4bool     TestRealNeutral();
+
   void       NegPDGCode();
   void       ConvertPDGToZNS(G4int PDG, G4int& z, G4int& n, G4int& s);
+  std::pair<G4int,G4int> MakeTwoBaryons(G4int L1, G4int L2, G4int R1, G4int R2);
 
 private:
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCodeVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCodeVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPDGCodeVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QPDGCodeVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentCluster.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentCluster.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentCluster.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QParentCluster.hh,v 1.24 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QParentCluster ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentClusterVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentClusterVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParentClusterVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QParentClusterVector.hh,v 1.19 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticle.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticle.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticle.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QParticle.hh,v 1.25 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QParticle ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticleVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticleVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParticleVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QParticleVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParton.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParton.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QParton.hh	(revision 1196)
@@ -28,6 +28,6 @@
 #define G4QParton_h 1
 
-// $Id: G4QParton.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QParton.hh,v 1.8 2009/07/17 16:54:57 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // ------------------------------------------------------------
@@ -45,8 +45,8 @@
 
 #include "globals.hh"
+#include "G4QContent.hh"
+#include "G4LorentzVector.hh"
 #include "G4ThreeVector.hh"
-#include "G4LorentzVector.hh"
 #include <iostream>
-#include "G4ParticleTable.hh"
 #include "Randomize.hh"
 
@@ -55,17 +55,6 @@
  public:
   // Constructors
-  G4QParton()
-  {
-    // CHIPS is working only with u, d, and s quarks (SU(3)xSU(3)) (no gluons! M.K.)
-    // Random Flavor/Colour/Spin definition for default constructor (with .3 s-suppresion)
-    PDGencoding=(G4int)(2.3*G4UniformRand())+1; //@@ What about antiquarks? (M.K.)
-    theDefinition=G4ParticleTable::GetParticleTable()->FindParticle(PDGencoding);
-    // random colour (1,2,3)=(R,G,B) for quarks and (-1,-2,-3)=(aR,aG,aB) for anti-quarks
-    theColour = (G4int)(3*G4UniformRand())+1;
-    if(theColour>3) theColour = 3;
-    theIsoSpinZ = theDefinition->GetPDGIsospin3();
-    theSpinZ = (G4int)(2*G4UniformRand()) - 0.5;
-  }
-  G4QParton(G4int PDGencoding);                            // Collor/Spin are still random
+  G4QParton();                                            // Default fullRandom constructor
+  G4QParton(G4int aPGG);                                  // Collor/Spin are still random
   G4QParton(const G4QParton &right);
   G4QParton(const G4QParton* right);
@@ -80,33 +69,33 @@
 
   // Modifiers
+  void DefineEPz(G4LorentzVector hadr4Mom){theMomentum+=hadr4Mom*theX;} // CHIPS solution
   void DefineMomentumInZ(G4double aLightConeMomentum, G4bool aDirection);
+  void SetPDGCode(G4int aPDG);
   void SetColour(G4int aColour)                       {theColour = aColour;}
   void SetX(G4double anX)                             {theX = anX;}
   void Set4Momentum(const G4LorentzVector& aMomentum) {theMomentum=aMomentum;}
   void SetPosition(const G4ThreeVector& aPosition)    {thePosition=aPosition;}
-  void SetIsoSpinZ(G4double anIsoSpinZ)               {theIsoSpinZ = anIsoSpinZ;}
   void SetSpinZ(G4double aSpinZ)                      {theSpinZ = aSpinZ;}
+  G4bool ReduceDiQADiQ(G4QParton* d1, G4QParton* d2); // Reduce DiQ-aDiQ to Q-aQ (general)
 
   // Selectors
-  G4int GetPDGCode() const                            {return PDGencoding;}
-  G4ParticleDefinition* GetDefinition()               {return theDefinition;}    
-  const G4ThreeVector& GetPosition()const             {return thePosition;}
+  G4int GetPDGCode() const                            {return PGGCode;}
+  G4QContent GetQC() const                            {return QCont;}
+  const G4ThreeVector& GetPosition() const            {return thePosition;}
   const G4LorentzVector& Get4Momentum() const         {return theMomentum;} 
   G4double GetX()                                     {return theX;}    
   G4int GetColour()                                   {return theColour;}    
   G4double GetSpinZ()                                 {return theSpinZ;}
-  G4double GetIsoSpinZ()                              {return theIsoSpinZ;}
-  G4double GetMass()                                  {return theDefinition->GetPDGMass();}
-  G4String GetParticleSubType()               {return theDefinition->GetParticleSubType();}
+  const G4int& GetType() const                        {return theType;}
  private: 
   // Body 
-  G4int                 PDGencoding;
-  G4ParticleDefinition* theDefinition;
+  G4int                 PGGCode;
+  G4QContent            QCont;   // Quark Content of the parton
+  G4int                 theType; // 0 = gluon, 1 = quark-antiquark, 2 = diquark/antidiquark
+  G4int                 theColour;
+  G4double              theSpinZ;
+  G4double              theX;
+  G4ThreeVector         thePosition;
   G4LorentzVector       theMomentum;
-  G4ThreeVector         thePosition;
-  G4int                 theColour;
-  G4double              theIsoSpinZ;
-  G4double              theSpinZ;
-  G4double              theX;   
 };
 
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPair.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPair.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPair.hh	(revision 1196)
@@ -28,5 +28,5 @@
 //
 // $Id: G4QPartonPair.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // ------------------------------------------------------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPairVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPairVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonPairVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QPartonPairVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QPartonVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QPartonVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QCandidateVector ----------------
@@ -40,5 +40,5 @@
 //
 // $Id: G4QPartonVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 // ------------------------------------------------------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QString.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QString.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QString.hh	(revision 1196)
@@ -26,6 +26,6 @@
 //
 //
-// $Id: G4QString.hh,v 1.3 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QString.hh,v 1.11 2009/08/24 14:41:49 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 
 #ifndef G4QString_h
@@ -60,5 +60,4 @@
 #include "G4LorentzRotation.hh"
 #include "G4QHadronVector.hh"
-#include "G4QHadronBuilder.hh"
 #include "G4QPartonPair.hh"
 #include "G4QPartonVector.hh"
@@ -73,6 +72,10 @@
   G4QString(); // formal creation of the string with future excitation
   G4QString(G4QParton* Color,G4QParton* Gluon, G4QParton* AntiColor, G4int Dir=PROJECTILE);
-  G4QString(G4QParton* Col,G4QParton* AntiCol, G4int Dir=PROJECTILE);
+  G4QString(G4QParton* Col, G4QParton* AntiCol, G4int Dir=PROJECTILE);
+  G4QString(G4QPartonPair* ColAntiCol);
   G4QString(const G4QString &right);
+  G4QString(const G4QString &old, G4QParton* newdecay, const G4LorentzVector *momentum);
+  G4QString(const G4QString &old, G4QParton* newdecay);
+  G4QString(G4QParton* newdecay, const G4LorentzVector* momentum);
 
   ~G4QString();
@@ -83,59 +86,54 @@
   const G4ThreeVector& GetPosition() const       {return thePosition;}
   const G4QPartonVector* GetPartonList() const   {return &thePartons;}
-  G4QParton* GetGluon() const                    {return thePartons[1];}
-  G4QParton* GetGluon(G4int GluonPos) const      {return thePartons[1 + GluonPos];}
   G4QParton* GetLeftParton() const               {return *thePartons.begin();}
   G4QParton* GetRightParton() const              {return *(thePartons.end()-1);}
-  G4bool     IsItKinkyString() const             {return (thePartons.size() > 2);}
   G4int      GetDirection() const                {return theDirection;}
-  G4bool     IsExcited() const                   {return true;} // Can be absolete? @@ M.K.
   G4LorentzVector Get4Momentum() const;
-  //G4QHadron* GetAsQHadron(); //@@ Create a QHadron, corresponding to not excited string
-  G4QParton* GetColorParton() const;
-  G4QParton* GetAntiColorParton() const;
-  G4QParton* GetStableParton() const{ return theStableParton;} // stable at the moment
-  G4QParton* GetDecayParton() const{return theDecayParton;}// now involved in fragmentation
+  G4QContent GetQC() const {return GetLeftParton()->GetQC()+GetRightParton()->GetQC();}
+  G4int      GetCharge() const {return GetQC().GetCharge();}
+  G4int      GetBaryonNumber() const {return GetQC().GetBaryonNumber();}
+  G4int      GetStrangeness() const {return GetQC().GetStrangeness();}
   G4int GetDecayDirection() const;
-  G4bool FourQuarkString() const; // Checks that the string is qq-(qq)bar string
-  G4bool DecayIsQuark() const {return theDecayParton->GetParticleSubType()=="quark";}
-  G4bool StableIsQuark() const {return theStableParton->GetParticleSubType()=="quark";}
-  G4ThreeVector StablePt(); // Get Pt of the stable quark
-  G4ThreeVector DecayPt();  // Get Pt of the decaying quark
-  G4double LightConePlus(){return Pplus;}
-  G4double LightConeMinus() {return Pminus;}
-  G4double LightConeDecay();
-  G4LorentzVector GetFragmentation4Mom() const; //!! Instead of Get$Momentum in FragmString
-  G4double Mass2() const {return Pplus*Pminus-(Ptleft+Ptright).mag2();}
-  G4double Mass() const{return std::sqrt(Mass2());}
-  G4bool StopFragmentation() {return FragmentationMass(&G4QHadronBuilder::BuildHighSpin)
-                                                 + MassCut > GetFragmentation4Mom().mag();}
-  G4bool IsFragmentable() {return FragmentationMass() + MassCut < Mass();}
-  G4ThreeVector SampleQuarkPt();
-  G4bool SplitLast(G4QString* string, G4QHadronVector* LeftHV, G4QHadronVector* RightHV);
+  G4bool DecayIsQuark() const {return theDecayParton->GetType()==1;}
+  G4bool StableIsQuark() const {return theStableParton->GetType()==1;}
+  G4ThreeVector DecayPt();  // Get Pt of the decaying quark @@ Called once
+  G4double Mass2() const { return Pplus*Pminus-(Ptleft+Ptright).mag2();}
+  G4double Mass() const  // @@ Very dangerous! USE ONLY FORE THE LIGHT CONE ALGORITHM !!
+  {
+    G4double  m2=Mass2();
+    if(m2>0) return std::sqrt(Mass2());
+    else     return 0.; // @@ Make Warning
+  }
+  G4bool StopFragmentation()
+  {
+    G4LorentzVector mom(Ptleft+Ptright, 0.5*(Pplus+Pminus));
+    mom.setPz(0.5*(Pplus-Pminus));
+    return FragmentationMass(1) + MassCut > mom.mag();
+  }
+  G4bool IsFragmentable() {return FragmentationMass() + MassCut < Mass();} // @@ Mass() ?
+  G4ThreeVector SampleQuarkPt(); // @@ Called once
+  G4QHadron* CreateHadron(G4QParton* black, G4QParton* white);
+  G4QHadron* CreateLowSpinHadron(G4QParton* black, G4QParton* white);
+  G4QHadron* CreateHighSpinHadron(G4QParton* black, G4QParton* white);
 
-  void Sample4Momentum(G4LorentzVector* Mom, G4double M, G4LorentzVector* aMom,
-                       G4double aM, G4double InitialMass);
   // Modifiers
-  void SetPosition(const G4ThreeVector& aPosition) {thePosition= aPosition;}
-  void SetDirection(G4int dir)                     {theDirection=dir;}
+  void SetPosition(const G4ThreeVector& aPosition){thePosition= aPosition;}
+  void SetDirection(G4int dir)       {if(dir==1 || dir==-1) theDirection=dir;}
+  void SetLeftParton(G4QParton* LP)  {thePartons[0]=LP;} // !! Not deleting the substituty
+  void SetRightParton(G4QParton* RP) {thePartons.pop_back(); thePartons.push_back(RP);}
+  void KillString()                  {theDirection=0;} // @@ Can be absolete
   void LorentzRotate(const G4LorentzRotation& rotation);
-  void InsertParton(G4QParton* aParton, const G4QParton* addafter = NULL);
+  //void InsertParton(G4QParton* aParton, const G4QParton* addafter = NULL);
   void Boost(G4ThreeVector& Velocity);
-  G4LorentzRotation TransformToCenterOfMass();
-  G4LorentzRotation TransformToAlignedCms();
-  void DiffString(G4QHadron* aHadron, G4bool isProjectile);
+  G4LorentzRotation TransformToAlignedCms(); // @@ caled once
+  //void DiffString(G4QHadron* aHadron, G4bool isProjectile); @@ Mast be used!!
   void ExciteString(G4QParton* Col,G4QParton* AntiCol, G4int Dir);
   G4QHadronVector* FragmentString(G4bool QL); // Fragment String using QGSM=true/LUND=false
-  G4QString* CPExcited(); // Creates a string, using only CMS end-partons of the string
   G4QHadronVector* LightFragmentationTest();
-  G4double FragmentationMass(G4QHcreate build=0, G4QHadronPair* pdefs=0);
-  void CalculateHadronTimePosition(G4double theInitialStringMass, G4QHadronVector*);
+  G4double FragmentationMass(G4int HighSpin = 0, G4QHadronPair* pdefs = 0);
   void SetLeftPartonStable();
   void SetRightPartonStable();
-  void UpdateString(G4QParton* decay, const G4LorentzVector* mom);
-  G4QString(G4QParton* newdecay, const G4LorentzVector* momentum);
-  G4QHadron* Splitup(G4bool QL);  // Split Hadron & update the string, QGSM:true,Lund:false
+  G4QHadron* Splitup(G4bool QL);
   G4LorentzVector* SplitEandP(G4QHadron* pHadron, G4bool QL); // QGSM:QL=true,Lund:QL=false
-  G4QParton* CreateParton(G4int PDGcode)                   {return new G4QParton(PDGcode);}
   G4QPartonPair CreatePartonPair(G4int NeedParticle, G4bool AllowDiquarks=true);
   G4QHadron* QuarkSplitup(G4QParton* decay, G4QParton* &created);
@@ -144,9 +142,12 @@
 
   // Static functions
-  static void SetParameters(G4double mCut, G4double clustM, G4double sigQT, G4double DQSup,
-   G4double DQBU, G4double smPar, G4double SSup, G4double SigPt, G4int SLmax, G4int CLmax);
+  static void SetParameters(G4double mCut, G4double sigQT, G4double DQSup, G4double DQBU,
+                            G4double smPar, G4double SSup, G4double SigPt);
 
  private:
+  enum Spin {SpinZero=1, SpinHalf=2, SpinOne=3, SpinThreeHalf=4};
   // Private functions
+  G4QHadron* CreateMeson(G4QParton* black, G4QParton* white, Spin spin);
+  G4QHadron* CreateBaryon(G4QParton* black,G4QParton* white, Spin spin);
   G4ThreeVector GaussianPt(G4double widthSquare, G4double maxPtSquare) const;
   G4double GetLundLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding,
@@ -158,5 +159,4 @@
   // Parameters of Longitudinal String Fragmentation
   static G4double MassCut;           // minimum mass cut for the string
-  static G4double ClusterMass;       // minimum cluster mass for the fragmentation
   static G4double SigmaQT;           // quark transverse momentum distribution parameter 
   static G4double DiquarkSuppress;   // is Diquark suppression parameter  
@@ -165,12 +165,9 @@
   static G4double StrangeSuppress;   // Strangeness suppression parameter
   static G4double widthOfPtSquare;   // width^2 of pt for string excitation
-  static G4int StringLoopInterrupt;  // String fragmentation LOOP limit 
-  static G4int ClusterLoopInterrupt; // Cluster fragmentation LOOP limit 
 
   // Body
-  G4int         theDirection;        // must be 1 or -1 (PROJECTILE or TARGET)
+  G4int         theDirection;        // must be 1 (PROJECTILE) or -1 (TARGET), 0 - DEAD
   G4ThreeVector thePosition;         // Defined by the first quark position
-  G4QPartonVector thePartons;        // would like initial capacity for 3 Partons (? M.K.)
-  G4QHadronBuilder* hadronizer;      // Hadronizer of hodrons out of partons
+  G4QPartonVector thePartons;        // Partons on the ends of the string @@ Use PartonPair
   G4ThreeVector Ptleft,Ptright;      // Pt (px,py) for partons (pz ignored!)
   G4double Pplus, Pminus;            // p-, p+ of string, Plus is assigned to Left!
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QStringVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QStringVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QStringVector.hh	(revision 1196)
@@ -26,5 +26,5 @@
 //
 // $Id: G4QStringVector.hh,v 1.2 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QStringVector ----------------
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Quasmon.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Quasmon.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4Quasmon.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4Quasmon.hh,v 1.41 2009/03/23 14:14:35 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4Quasmon.hh,v 1.46 2009/11/16 18:15:01 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4Quasmon ----------------
@@ -95,8 +95,12 @@
 
   //Modifiers
+  void Set4Momentum(G4LorentzVector Q4M) {q4Mom=Q4M;} // Set new value for the Quasmon 4mom
+  void SetQC(G4QContent QQC)             {valQ=QQC;}  // Set new Quark Cont for the Quasmon
+  void Boost(const G4LorentzVector& theBoost);        // Boosts hadron's 4Momentum using 4M
+  void Boost(const G4ThreeVector& B){q4Mom.boost(B);} // Boosts 4-Momentum using v/c
   // Public wrapper for HadronizeQuasmon(,)
   G4QHadronVector*  Fragment(G4QNucleus& nucEnviron, G4int nQ = 1);
   G4QHadronVector*  DecayQuasmon();                   // Decay Quasmon if it's Res or Chipo
-  G4QHadronVector*  DecayQHadron(G4QHadron* hadron);  // Decay Quasmon if it's Res or Chipo
+  G4QHadronVector*  DecayQHadron(G4QHadron* hadron);  // Decay QHadron if it's Res or Chipo
   void              ClearOutput();                    // Clear but not destroy the output
   void              InitQuasmon(const G4QContent& qQCont, const G4LorentzVector& q4M);
Index: trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QuasmonVector.hh
===================================================================
--- trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QuasmonVector.hh	(revision 1055)
+++ trunk/source/processes/hadronic/models/chiral_inv_phase_space/body/include/G4QuasmonVector.hh	(revision 1196)
@@ -25,6 +25,6 @@
 //
 //
-// $Id: G4QuasmonVector.hh,v 1.20 2009/02/23 09:49:24 mkossov Exp $
-// GEANT4 tag $Name: geant4-09-03-beta-cand-01 $
+// $Id: G4QuasmonVector.hh,v 1.22 2009/11/16 18:15:01 mkossov Exp $
+// GEANT4 tag $Name: geant4-09-03-cand-01 $
 //
 //      ---------------- G4QuasmonVector ----------------
