Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/parton_string/qgsm/src/G4QGSMSplitableHadron.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/parton_string/qgsm/src/G4QGSMSplitableHadron.cc (Version 11.3.0) and /processes/hadronic/models/parton_string/qgsm/src/G4QGSMSplitableHadron.cc (Version 9.6.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 #include "G4QGSMSplitableHadron.hh"                26 #include "G4QGSMSplitableHadron.hh"
 27 #include "G4PhysicalConstants.hh"                  27 #include "G4PhysicalConstants.hh"
 28 #include "G4SystemOfUnits.hh"                      28 #include "G4SystemOfUnits.hh"
 29 #include "G4ParticleTable.hh"                      29 #include "G4ParticleTable.hh" 
 30 #include "G4PionPlus.hh"                           30 #include "G4PionPlus.hh"
 31 #include "G4PionMinus.hh"                          31 #include "G4PionMinus.hh"
 32 #include "G4Gamma.hh"                              32 #include "G4Gamma.hh"
 33 #include "G4PionZero.hh"                           33 #include "G4PionZero.hh"
 34 #include "G4KaonPlus.hh"                           34 #include "G4KaonPlus.hh"
 35 #include "G4KaonMinus.hh"                          35 #include "G4KaonMinus.hh"
 36                                                    36 
 37 #include "G4Log.hh"                            << 
 38 #include "G4Pow.hh"                            << 
 39                                                << 
 40 // based on prototype by Maxim Komogorov           37 // based on prototype by Maxim Komogorov
 41 // Splitting into methods, and centralizing of     38 // Splitting into methods, and centralizing of model parameters HPW Feb 1999
 42 // restructuring HPW Feb 1999                      39 // restructuring HPW Feb 1999
 43 // fixing bug in the sampling of 'x', HPW Feb      40 // fixing bug in the sampling of 'x', HPW Feb 1999
 44 // fixing bug in sampling pz, HPW Feb 1999.        41 // fixing bug in sampling pz, HPW Feb 1999. 
 45 // Code now also good for p-nucleus scattering     42 // Code now also good for p-nucleus scattering (before only p-p), HPW Feb 1999.
 46 // Using Parton more directly, HPW Feb 1999.       43 // Using Parton more directly, HPW Feb 1999.
 47 // Shortening the algorithm for sampling x, HP     44 // Shortening the algorithm for sampling x, HPW Feb 1999.
 48 // sampling of x replaced by formula, taking X     45 // sampling of x replaced by formula, taking X_min into account in the correlated sampling. HPW, Feb 1999.
 49 // logic much clearer now. HPW Feb 1999            46 // logic much clearer now. HPW Feb 1999
 50 // Removed the ordering problem. No Direction      47 // Removed the ordering problem. No Direction needed in selection of valence quark types. HPW Mar'99.
 51 // Fixing p-t distributions for scattering of      48 // Fixing p-t distributions for scattering of nuclei.
 52 // Separating out parameters.                      49 // Separating out parameters.
 53                                                    50 
 54 void G4QGSMSplitableHadron::InitParameters()       51 void G4QGSMSplitableHadron::InitParameters()
 55 {                                                  52 {
 56   // changing rapidity distribution for all    <<  53   // changing rapidity distribution for all
 57   alpha = -0.5; // Note that this number is st <<  54   alpha = -0.5; // Note that this number is still assumed in the algorithm
 58   // needs to be generalized.                  <<  55   // needs to be generalized.
 59   // changing rapidity distribution for projec <<  56   // changing rapidity distribution for projectile like
 60   beta = 2.5;// Note that this number is still <<  57   beta = 2.5;// Note that this number is still assumed in the algorithm
 61   // needs to be generalized.                  <<  58   // needs to be generalized.
 62   theMinPz = 0.5*G4PionMinus::PionMinus()->Get <<  59   theMinPz = 0.5*G4PionMinus::PionMinus()->GetPDGMass();
 63   //  theMinPz = 0.1*G4PionMinus::PionMinus()- <<  60   //  theMinPz = 0.1*G4PionMinus::PionMinus()->GetPDGMass();
 64   //  theMinPz = G4PionMinus::PionMinus()->Get <<  61   //  theMinPz = G4PionMinus::PionMinus()->GetPDGMass();
 65   // as low as possible, otherwise, we have un <<  62   // as low as possible, otherwise, we have unphysical boundary conditions in the sampling.
 66   StrangeSuppress = 0.48;                      <<  63   StrangeSuppress = 0.48;
 67   sigmaPt = 0.*GeV; // widens eta slightly, if <<  64   sigmaPt = 0.*GeV; // widens eta slightly, if increased to 1.7,
 68   // but Maxim's algorithm breaks energy conse <<  65   // but Maxim's algorithm breaks energy conservation
 69   widthOfPtSquare = 0.5*sqr(GeV);              <<  66   // to be revised.
 70   Direction = FALSE;                           <<  67   widthOfPtSquare = 0.01*GeV*GeV;
 71   minTransverseMass = 1*keV;                   <<  68   Direction = FALSE;
 72   iP  =0;//     Color.begin();                 <<  69   minTransverseMass = 1*keV;
 73   iAP =0;// AntiColor.begin();                 << 
 74 }                                                  70 } 
 75                                                    71 
 76 G4QGSMSplitableHadron::G4QGSMSplitableHadron()     72 G4QGSMSplitableHadron::G4QGSMSplitableHadron() 
 77 {                                                  73 {
 78   InitParameters();                            <<  74   InitParameters();
 79 }                                                  75 }
 80                                                    76 
 81 G4QGSMSplitableHadron::G4QGSMSplitableHadron(c     77 G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary, G4bool aDirection)
 82 :G4VSplitableHadron(aPrimary)                      78 :G4VSplitableHadron(aPrimary)
 83 {                                                  79 {
 84   InitParameters();                            <<  80   InitParameters();
 85   Direction = aDirection;                      <<  81   Direction = aDirection;
 86 }                                                  82 }
 87                                                    83 
 88                                                    84 
 89 G4QGSMSplitableHadron::G4QGSMSplitableHadron(c     85 G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4ReactionProduct & aPrimary)
 90 :  G4VSplitableHadron(aPrimary)                    86 :  G4VSplitableHadron(aPrimary)
 91 {                                                  87 {
 92   InitParameters();                            <<  88   InitParameters();
 93 }                                                  89 }
 94                                                    90 
 95 G4QGSMSplitableHadron::G4QGSMSplitableHadron(c     91 G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4Nucleon & aNucleon)
 96 :  G4VSplitableHadron(aNucleon)                    92 :  G4VSplitableHadron(aNucleon)
 97 {                                                  93 {
 98   InitParameters();                            <<  94   InitParameters();
 99 }                                                  95 }
100                                                    96 
101 G4QGSMSplitableHadron::G4QGSMSplitableHadron(c     97 G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4Nucleon & aNucleon, G4bool aDirection)
102 :  G4VSplitableHadron(aNucleon)                    98 :  G4VSplitableHadron(aNucleon)
103 {                                                  99 {
104   InitParameters();                            << 100   InitParameters();
105   Direction = aDirection;                      << 101   Direction = aDirection;
106 }                                                 102 }
107                                                   103 
108 G4QGSMSplitableHadron::~G4QGSMSplitableHadron( << 104 G4QGSMSplitableHadron::~G4QGSMSplitableHadron(){}
                                                   >> 105 
109                                                   106 
110                                                   107 
111 //********************************************    108 //**************************************************************************************************************************
112                                                   109 
113 void G4QGSMSplitableHadron::SplitUp()             110 void G4QGSMSplitableHadron::SplitUp()
114 {                                                 111 {  
115   if (IsSplit()) return;                       << 112   if (IsSplit()) return;
116   Splitting();  // To mark that a hadron is sp << 113   Splitting();
117   if (Color.size()!=0) return;                 << 114   if (Color.size()!=0) return;
118   if (GetSoftCollisionCount() == 0)  // GetSof << 115   if (GetSoftCollisionCount() == 0)
119   {                                            << 116   {
120     DiffractiveSplitUp();                      << 117     DiffractiveSplitUp();
121   }                                            << 118   }
122   else                                         << 119   else
123   {                                            << 120   {
124     SoftSplitUp();                             << 121     SoftSplitUp();
125   }                                            << 122   }
126 }                                                 123 }
127                                                   124 
128 void G4QGSMSplitableHadron::DiffractiveSplitUp    125 void G4QGSMSplitableHadron::DiffractiveSplitUp()
129 {                                                 126 {   
130   // take the particle definitions and get the << 127   // take the particle definitions and get the partons HPW
131   G4Parton * Left = NULL;                      << 128   G4Parton * Left = NULL;
132   G4Parton * Right = NULL;                     << 129   G4Parton * Right = NULL;
133   GetValenceQuarkFlavors(GetDefinition(), Left << 130   GetValenceQuarkFlavors(GetDefinition(), Left, Right);
134   Left->SetPosition(GetPosition());            << 131   Left->SetPosition(GetPosition());
135   Right->SetPosition(GetPosition());           << 132   Right->SetPosition(GetPosition());
136                                                << 133 
137   G4LorentzVector HadronMom = Get4Momentum();  << 134   G4LorentzVector HadronMom = Get4Momentum();
138                                                << 135   //std::cout << "DSU 1 - "<<HadronMom<<std::endl;
139   G4double maxAvailMomentum2 = sqr(HadronMom.m << 136 
140                                                << 137   // momenta of string ends
141   G4ThreeVector pt(minTransverseMass, minTrans << 138   G4double pt2 = HadronMom.perp2();
142   if (maxAvailMomentum2/widthOfPtSquare>0.01)  << 139   G4double transverseMass2 = HadronMom.plus()*HadronMom.minus();
143                                                << 140   G4double maxAvailMomentum2 = sqr(std::sqrt(transverseMass2) - std::sqrt(pt2));
144   G4LorentzVector LeftMom(pt, 0.);             << 141   G4ThreeVector pt(minTransverseMass, minTransverseMass, 0);
145   G4LorentzVector RightMom;                    << 142   if(maxAvailMomentum2/widthOfPtSquare>0.01) pt = GaussianPt(widthOfPtSquare, maxAvailMomentum2);
146   RightMom.setPx(HadronMom.px() - pt.x());     << 143   //std::cout << "DSU 1.1 - "<< maxAvailMomentum2<< pt <<std::endl;
147   RightMom.setPy(HadronMom.py() - pt.y());     << 144 
148                                                << 145   G4LorentzVector LeftMom(pt, 0.);
149   G4double Local1 = HadronMom.minus() + (Right << 146   G4LorentzVector RightMom;
150   G4double Local2 = std::sqrt(std::max(0., sqr << 147   RightMom.setPx(HadronMom.px() - pt.x());
151                                                << 148   RightMom.setPy(HadronMom.py() - pt.y());
152   if (Direction) Local2 = -Local2;             << 149   //std::cout << "DSU 2 - "<<RightMom<<" "<< LeftMom <<std::endl;
153   G4double RightMinus   = 0.5*(Local1 + Local2 << 150 
154   G4double LeftMinus = HadronMom.minus() - Rig << 151   G4double Local1 = HadronMom.minus() + (RightMom.perp2() - LeftMom.perp2())/HadronMom.plus();
155                                                << 152   G4double Local2 = std::sqrt(std::max(0., sqr(Local1) - 4.*RightMom.perp2()*HadronMom.minus()/HadronMom.plus()));
156   if (LeftMinus <= 0.) {                       << 153   //std::cout << "DSU 3 - "<< Local1 <<" "<< Local2 <<std::endl;
157     RightMinus   = 0.5*(Local1 - Local2);      << 154   if (Direction) Local2 = -Local2;
158     LeftMinus = HadronMom.minus() - RightMinus << 155   G4double RightMinus   = 0.5*(Local1 + Local2);
159   }                                            << 156   G4double LeftMinus = HadronMom.minus() - RightMinus;
160                                                << 157   //std::cout << "DSU 4 - "<< RightMinus <<" "<< LeftMinus << " "<<HadronMom.minus() <<std::endl;
161   G4double LeftPlus  = LeftMom.perp2()/LeftMin << 158 
162   G4double RightPlus = HadronMom.plus() - Left << 159   G4double LeftPlus  = LeftMom.perp2()/LeftMinus;
163                                                << 160   G4double RightPlus = HadronMom.plus() - LeftPlus;
164   LeftMom.setPz(0.5*(LeftPlus - LeftMinus));   << 161   //std::cout << "DSU 5 - "<< RightPlus <<" "<< LeftPlus <<std::endl;
165   LeftMom.setE (0.5*(LeftPlus + LeftMinus));   << 162   LeftMom.setPz(0.5*(LeftPlus - LeftMinus));
166   RightMom.setPz(0.5*(RightPlus - RightMinus)) << 163   LeftMom.setE (0.5*(LeftPlus + LeftMinus));
167   RightMom.setE (0.5*(RightPlus + RightMinus)) << 164   RightMom.setPz(0.5*(RightPlus - RightMinus));
168                                                << 165   RightMom.setE (0.5*(RightPlus + RightMinus));
169   Left->Set4Momentum(LeftMom);                 << 166   //std::cout << "DSU 6 - "<< LeftMom <<" "<< RightMom <<std::endl;
170   Right->Set4Momentum(RightMom);               << 167   Left->Set4Momentum(LeftMom);
171                                                << 168   Right->Set4Momentum(RightMom);
172   Color.push_back(Left);                       << 169   Color.push_back(Left);
173   AntiColor.push_back(Right);                  << 170   AntiColor.push_back(Right);
174   iP=0; iAP=0;                                 << 
175 }                                                 171 }
176                                                   172 
177                                                   173 
178 void G4QGSMSplitableHadron::SoftSplitUp()         174 void G4QGSMSplitableHadron::SoftSplitUp()
179 {                                                 175 {
180   G4int nSeaPair = GetSoftCollisionCount()-1;  << 176   //... sample transversal momenta for sea and valence quarks
181                                                << 177   G4double phi, pts;
182   G4LorentzVector tmp(0., 0., 0., 0.);         << 178   G4double SumPy = 0.;
183                                                << 179   G4double SumPx = 0.;
184   G4int aSeaPair;                              << 180   G4ThreeVector Pos    = GetPosition();
185   for (aSeaPair = 0; aSeaPair < nSeaPair; aSea << 181   G4int nSeaPair = GetSoftCollisionCount()-1;
186   {                                            << 182 
187     //  choose quark flavour, d:u:s = 1:1:(1/S << 183   // here the condition,to ensure viability of splitting, also in cases
188     G4int aPDGCode = 1 + (G4int)(G4UniformRand << 184   // where difractive excitation occured together with soft scattering.
189                                                << 185   //   G4double LightConeMomentum = (Direction)? Get4Momentum().plus() : Get4Momentum().minus();
190     //  BuildSeaQuark() determines quark spin, << 186   //   G4double Xmin = theMinPz/LightConeMomentum;
191     //  via parton-constructor G4Parton(aPDGCo << 187   G4double Xmin = theMinPz/( Get4Momentum().e() - GetDefinition()->GetPDGMass() );
192     G4Parton * aParton = BuildSeaQuark(false,  << 188   while(Xmin>=1-(2*nSeaPair+1)*Xmin) Xmin*=0.95;
193                                                << 189 
194     G4int firstPartonColour = aParton->GetColo << 190   G4int aSeaPair;
195     G4double firstPartonSpinZ = aParton->GetSp << 191   for (aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++)
196                                                << 192   {
197     aParton->Set4Momentum(tmp);                << 193     //  choose quark flavour, d:u:s = 1:1:(1/StrangeSuppress-2)
198     Color.push_back(aParton);                  << 194 
199                                                << 195     G4int aPDGCode = 1 + (G4int)(G4UniformRand()/StrangeSuppress);
200     // create anti-quark                       << 196 
201     aParton = BuildSeaQuark(true, aPDGCode, nS << 197     //  BuildSeaQuark() determines quark spin, isospin and colour
202     aParton->SetSpinZ(-firstPartonSpinZ);      << 198     //  via parton-constructor G4Parton(aPDGCode)
203     aParton->SetColour(-firstPartonColour);    << 199 
204     AntiColor.push_back(aParton);              << 200     G4Parton * aParton = BuildSeaQuark(false, aPDGCode, nSeaPair);
205   }                                            << 201 
206                                                << 202     //    G4cerr << "G4QGSMSplitableHadron::SoftSplitUp()" << G4endl;
207   // Valence quark                             << 203 
208   G4Parton* pColorParton = NULL;               << 204     //    G4cerr << "Parton 1: "
209   G4Parton* pAntiColorParton = NULL;           << 205     //           << " PDGcode: "  << aPDGCode
210   GetValenceQuarkFlavors(GetDefinition(), pCol << 206     //           << " - Name: "   << aParton->GetDefinition()->GetParticleName()
211                                                << 207     //           << " - Type: "   << aParton->GetDefinition()->GetParticleType()
212   pColorParton->Set4Momentum(tmp);             << 208     //           << " - Spin-3: " << aParton->GetSpinZ()
213   pAntiColorParton->Set4Momentum(tmp);         << 209     //           << " - Colour: " << aParton->GetColour() << G4endl;
214                                                << 210 
215   Color.push_back(pColorParton);               << 211     // save colour a spin-3 for anti-quark
216   AntiColor.push_back(pAntiColorParton);       << 212 
217                                                << 213     G4int firstPartonColour = aParton->GetColour();
218   iP=0; iAP=0;                                 << 214     G4double firstPartonSpinZ = aParton->GetSpinZ();
219                                                << 215 
220   return;                                      << 216     SumPx += aParton->Get4Momentum().px();
                                                   >> 217     SumPy += aParton->Get4Momentum().py();
                                                   >> 218     Color.push_back(aParton);
                                                   >> 219 
                                                   >> 220     // create anti-quark
                                                   >> 221 
                                                   >> 222     aParton = BuildSeaQuark(true, aPDGCode, nSeaPair);
                                                   >> 223     aParton->SetSpinZ(-firstPartonSpinZ);
                                                   >> 224     aParton->SetColour(-firstPartonColour);
                                                   >> 225 
                                                   >> 226     //    G4cerr << "Parton 2: "
                                                   >> 227     //           << " PDGcode: "  << -aPDGCode
                                                   >> 228     //           << " - Name: "   << aParton->GetDefinition()->GetParticleName()
                                                   >> 229     //           << " - Type: "   << aParton->GetDefinition()->GetParticleType()
                                                   >> 230     //           << " - Spin-3: " << aParton->GetSpinZ()
                                                   >> 231     //           << " - Colour: " << aParton->GetColour() << G4endl;
                                                   >> 232     //    G4cerr << "------------" << G4endl;
                                                   >> 233 
                                                   >> 234     SumPx += aParton->Get4Momentum().px();
                                                   >> 235     SumPy += aParton->Get4Momentum().py();
                                                   >> 236     AntiColor.push_back(aParton);
                                                   >> 237   }
                                                   >> 238   // Valence quark
                                                   >> 239   G4Parton* pColorParton = NULL;
                                                   >> 240   G4Parton* pAntiColorParton = NULL;
                                                   >> 241   GetValenceQuarkFlavors(GetDefinition(), pColorParton, pAntiColorParton);
                                                   >> 242   G4int ColorEncoding = pColorParton->GetPDGcode();
                                                   >> 243 
                                                   >> 244   pts   =  sigmaPt*std::sqrt(-std::log(G4UniformRand()));
                                                   >> 245   phi   = 2.*pi*G4UniformRand();
                                                   >> 246   G4double Px = pts*std::cos(phi);
                                                   >> 247   G4double Py = pts*std::sin(phi);
                                                   >> 248   SumPx += Px;
                                                   >> 249   SumPy += Py;
                                                   >> 250 
                                                   >> 251   if (ColorEncoding < 0) // use particle definition
                                                   >> 252   {
                                                   >> 253     G4LorentzVector ColorMom(-SumPx, -SumPy, 0, 0);
                                                   >> 254     pColorParton->Set4Momentum(ColorMom);
                                                   >> 255     G4LorentzVector AntiColorMom(Px, Py, 0, 0);
                                                   >> 256     pAntiColorParton->Set4Momentum(AntiColorMom);
                                                   >> 257   }
                                                   >> 258   else
                                                   >> 259   {
                                                   >> 260     G4LorentzVector ColorMom(Px, Py, 0, 0);
                                                   >> 261     pColorParton->Set4Momentum(ColorMom);
                                                   >> 262     G4LorentzVector AntiColorMom(-SumPx, -SumPy, 0, 0);
                                                   >> 263     pAntiColorParton->Set4Momentum(AntiColorMom);
                                                   >> 264   }
                                                   >> 265   Color.push_back(pColorParton);
                                                   >> 266   AntiColor.push_back(pAntiColorParton);
                                                   >> 267 
                                                   >> 268   // Sample X
                                                   >> 269   G4int nAttempt = 0;
                                                   >> 270   G4double SumX = 0;
                                                   >> 271   G4double aBeta = beta;
                                                   >> 272   G4double ColorX, AntiColorX;
                                                   >> 273   if (GetDefinition() == G4PionMinus::PionMinusDefinition()) aBeta = 1.;
                                                   >> 274   if (GetDefinition() == G4Gamma::GammaDefinition()) aBeta = 1.;
                                                   >> 275   if (GetDefinition() == G4PionPlus::PionPlusDefinition()) aBeta = 1.;
                                                   >> 276   if (GetDefinition() == G4PionZero::PionZeroDefinition()) aBeta = 1.;
                                                   >> 277   if (GetDefinition() == G4KaonPlus::KaonPlusDefinition()) aBeta = 0.;
                                                   >> 278   if (GetDefinition() == G4KaonMinus::KaonMinusDefinition()) aBeta = 0.;
                                                   >> 279   do
                                                   >> 280   {
                                                   >> 281     SumX = 0;
                                                   >> 282     nAttempt++;
                                                   >> 283     G4int    NumberOfUnsampledSeaQuarks = 2*nSeaPair;
                                                   >> 284     ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
                                                   >> 285     Color.back()->SetX(SumX = ColorX);// this is the valenz quark.
                                                   >> 286     for(G4int aPair = 0; aPair < nSeaPair; aPair++)
                                                   >> 287     {
                                                   >> 288       NumberOfUnsampledSeaQuarks--;
                                                   >> 289       ColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
                                                   >> 290       Color[aPair]->SetX(ColorX);
                                                   >> 291       SumX += ColorX;
                                                   >> 292       NumberOfUnsampledSeaQuarks--;
                                                   >> 293       AntiColorX = SampleX(Xmin, NumberOfUnsampledSeaQuarks, 2*nSeaPair, aBeta);
                                                   >> 294       AntiColor[aPair]->SetX(AntiColorX); // the 'sea' partons
                                                   >> 295       SumX += AntiColorX;
                                                   >> 296       if (1. - SumX <= Xmin)  break;
                                                   >> 297     }
                                                   >> 298   }
                                                   >> 299   while (1. - SumX <= Xmin);
                                                   >> 300 
                                                   >> 301   (*(AntiColor.end()-1))->SetX(1. - SumX); // the di-quark takes the rest, then go to momentum
                                                   >> 302   G4double lightCone  = ((!Direction) ? Get4Momentum().minus() : Get4Momentum().plus());
                                                   >> 303   G4double lightCone2 = ((!Direction) ? Get4Momentum().plus() : Get4Momentum().minus());
                                                   >> 304   for(aSeaPair = 0; aSeaPair < nSeaPair+1; aSeaPair++)
                                                   >> 305   {
                                                   >> 306     G4Parton* aParton = Color[aSeaPair];
                                                   >> 307     aParton->DefineMomentumInZ(lightCone, lightCone2, Direction);
                                                   >> 308 
                                                   >> 309     aParton = AntiColor[aSeaPair];
                                                   >> 310     aParton->DefineMomentumInZ(lightCone, lightCone2, Direction);
                                                   >> 311   }
                                                   >> 312   return;
221 }                                                 313 } 
222                                                   314 
223                                                << 315 void G4QGSMSplitableHadron::GetValenceQuarkFlavors(const G4ParticleDefinition * aPart, G4Parton *& Parton1, G4Parton *& Parton2)
224 void G4QGSMSplitableHadron::GetValenceQuarkFla << 
225                                                << 
226 {                                                 316 {
227   // Note! convention aEnd = q or (qq)bar and  << 317   // Note! convention aEnd = q or (qq)bar and bEnd = qbar or qq.
228   G4int aEnd=0;                                << 318   G4int aEnd;
229   G4int bEnd=0;                                << 319   G4int bEnd;
230   G4int HadronEncoding = aPart->GetPDGEncoding << 320   G4int HadronEncoding = aPart->GetPDGEncoding();
231   if (aPart->GetBaryonNumber() == 0)           << 321   if (aPart->GetBaryonNumber() == 0)
232   {                                            << 322   {
233     theMesonSplitter.SplitMeson(HadronEncoding << 323     theMesonSplitter.SplitMeson(HadronEncoding, &aEnd, &bEnd);
234   }                                            << 324   }
235   else                                         << 325   else
236   {                                            << 326   {
237     theBaryonSplitter.SplitBarion(HadronEncodi << 327     theBaryonSplitter.SplitBarion(HadronEncoding, &aEnd, &bEnd);
238   }                                            << 328   }
239                                                << 329 
240   Parton1 = new G4Parton(aEnd);                << 330   Parton1 = new G4Parton(aEnd);
241   Parton1->SetPosition(GetPosition());         << 331   Parton1->SetPosition(GetPosition());
242                                                << 332 
243   Parton2 = new G4Parton(bEnd);                << 333   //  G4cerr << "G4QGSMSplitableHadron::GetValenceQuarkFlavors()" << G4endl;
244   Parton2->SetPosition(GetPosition());         << 334   //  G4cerr << "Parton 1: "
245                                                << 335   //         << " PDGcode: "  << aEnd
246   // colour of parton 1 choosen at random by G << 336   //         << " - Name: "   << Parton1->GetDefinition()->GetParticleName()
247   // colour of parton 2 is the opposite:       << 337   //         << " - Type: "   << Parton1->GetDefinition()->GetParticleType()
248                                                << 338   //         << " - Spin-3: " << Parton1->GetSpinZ()
249   Parton2->SetColour(-(Parton1->GetColour())); << 339   //         << " - Colour: " << Parton1->GetColour() << G4endl;
250                                                << 340 
251   // isospin-3 of both partons is handled by G << 341   Parton2 = new G4Parton(bEnd);
252                                                << 342   Parton2->SetPosition(GetPosition());
253   // spin-3 of parton 1 and 2 choosen at rando << 343 
254   // spin-3 of parton 2 may be constrained by  << 344   //  G4cerr << "Parton 2: "
255                                                << 345   //         << " PDGcode: "  << bEnd
256   if ( std::abs(Parton1->GetSpinZ() + Parton2- << 346   //         << " - Name: "   << Parton2->GetDefinition()->GetParticleName()
257   {                                            << 347   //         << " - Type: "   << Parton2->GetDefinition()->GetParticleType()
258     Parton2->SetSpinZ(-(Parton2->GetSpinZ())); << 348   //         << " - Spin-3: " << Parton2->GetSpinZ()
259   }                                            << 349   //         << " - Colour: " << Parton2->GetColour() << G4endl;
                                                   >> 350   //  G4cerr << "... now checking for color and spin conservation - yielding: " << G4endl;
                                                   >> 351 
                                                   >> 352   // colour of parton 1 choosen at random by G4Parton(aEnd)
                                                   >> 353   // colour of parton 2 is the opposite:
                                                   >> 354 
                                                   >> 355   Parton2->SetColour(-(Parton1->GetColour()));
                                                   >> 356 
                                                   >> 357   // isospin-3 of both partons is handled by G4Parton(PDGCode)
                                                   >> 358 
                                                   >> 359   // spin-3 of parton 1 and 2 choosen at random by G4Parton(aEnd)
                                                   >> 360   // spin-3 of parton 2 may be constrained by spin of original particle:
                                                   >> 361 
                                                   >> 362   if ( std::abs(Parton1->GetSpinZ() + Parton2->GetSpinZ()) > aPart->GetPDGSpin())
                                                   >> 363   {
                                                   >> 364     Parton2->SetSpinZ(-(Parton2->GetSpinZ()));    
                                                   >> 365   }
                                                   >> 366 
                                                   >> 367   //  G4cerr << "Parton 2: "
                                                   >> 368   //         << " PDGcode: "  << bEnd
                                                   >> 369   //         << " - Name: "   << Parton2->GetDefinition()->GetParticleName()
                                                   >> 370   //         << " - Type: "   << Parton2->GetDefinition()->GetParticleType()
                                                   >> 371   //         << " - Spin-3: " << Parton2->GetSpinZ()
                                                   >> 372   //         << " - Colour: " << Parton2->GetColour() << G4endl;
                                                   >> 373   //  G4cerr << "------------" << G4endl;
                                                   >> 374 
260 }                                                 375 }
261                                                   376 
262                                                   377 
263 G4ThreeVector G4QGSMSplitableHadron::GaussianP    378 G4ThreeVector G4QGSMSplitableHadron::GaussianPt(G4double widthSquare, G4double maxPtSquare)
264 {                                                 379 {
265   G4double R;                                  << 380   G4double R;
266   const G4int maxNumberOfLoops = 1000;         << 381   while((R = -widthSquare*std::log(G4UniformRand())) > maxPtSquare) {;}
267   G4int loopCounter = -1;                      << 382   R = std::sqrt(R);
268   while( ((R = -widthSquare*G4Log(G4UniformRan << 383   G4double phi = twopi*G4UniformRand();
269          ++loopCounter < maxNumberOfLoops ) {; << 384   return G4ThreeVector (R*std::cos(phi), R*std::sin(phi), 0.);
270   if ( loopCounter >= maxNumberOfLoops ) {     << 
271     R = 0.99*maxPtSquare;  // Just an acceptab << 
272   }                                            << 
273   R = std::sqrt(R);                            << 
274   G4double phi = twopi*G4UniformRand();        << 
275   return G4ThreeVector (R*std::cos(phi), R*std << 
276 }                                                 385 }
277                                                   386 
278                                                << 
279 G4Parton * G4QGSMSplitableHadron::                387 G4Parton * G4QGSMSplitableHadron::
280 BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCo    388 BuildSeaQuark(G4bool isAntiQuark, G4int aPDGCode, G4int /* nSeaPair*/)
281 {                                                 389 {
282   if (isAntiQuark) aPDGCode*=-1;               << 390   if (isAntiQuark) aPDGCode*=-1;
283   G4Parton* result = new G4Parton(aPDGCode);   << 391   G4Parton* result = new G4Parton(aPDGCode);
284   result->SetPosition(GetPosition());          << 392   result->SetPosition(GetPosition());
285   G4ThreeVector aPtVector = GaussianPt(sigmaPt << 393   G4ThreeVector aPtVector = GaussianPt(sigmaPt, DBL_MAX);
286   G4LorentzVector a4Momentum(aPtVector, 0);    << 394   G4LorentzVector a4Momentum(aPtVector, 0);
287   result->Set4Momentum(a4Momentum);            << 395   result->Set4Momentum(a4Momentum);
288   return result;                               << 396   return result;
289 }                                                 397 }
290                                                   398 
291                                                << 
292 G4double G4QGSMSplitableHadron::                  399 G4double G4QGSMSplitableHadron::
293 SampleX(G4double anXmin, G4int nSea, G4int tot    400 SampleX(G4double anXmin, G4int nSea, G4int totalSea, G4double aBeta)
294 {                                                 401 {
295   G4double result;                             << 402   G4double result;
296   G4double x1, x2;                             << 403   G4double x1, x2;
297   G4double ymax = 0;                           << 404   G4double ymax = 0;
298   for(G4int ii=1; ii<100; ii++)                << 405   for(G4int ii=1; ii<100; ii++)
299   {                                            << 406   {
300     G4double y = G4Pow::GetInstance()->powA(1. << 407     G4double y = std::pow(1./G4double(ii), alpha);
301     y *= G4Pow::GetInstance()->powN( G4Pow::Ge << 408     y *= std::pow( std::pow(1-anXmin-totalSea*anXmin, alpha+1) - std::pow(anXmin, alpha+1), nSea);
302                                      G4Pow::Ge << 409     y *= std::pow(1-anXmin-totalSea*anXmin, aBeta+1) - std::pow(anXmin, aBeta+1);
303     y *= G4Pow::GetInstance()->powA(1-anXmin-t << 410     if(y>ymax) ymax = y;
304          G4Pow::GetInstance()->powA(anXmin, aB << 411   }
305    if (y>ymax) ymax = y;                       << 412   G4double y;
306   }                                            << 413   G4double xMax=1-(totalSea+1)*anXmin;
307   G4double y;                                  << 414   if(anXmin > xMax)
308   G4double xMax=1-(totalSea+1)*anXmin;         << 415   {
309   if (anXmin > xMax)                           << 416     G4cout << "anXmin = "<<anXmin<<" nSea = "<<nSea<<" totalSea = "<< totalSea<<G4endl;
310   {                                            << 417     throw G4HadronicException(__FILE__, __LINE__, "G4QGSMSplitableHadron - Fatal: Cannot sample parton densities under these constraints.");
311     throw G4HadronicException(__FILE__, __LINE << 418   }
312             "G4QGSMSplitableHadron - Fatal: Ca << 419   do
313   }                                            << 420   {
314   const G4int maxNumberOfLoops = 1000;         << 421     x1 = CLHEP::RandFlat::shoot(anXmin, xMax);
315   G4int loopCounter = 0;                       << 422     y = std::pow(x1, alpha);
316   do                                           << 423     y *= std::pow( std::pow(1-x1-totalSea*anXmin, alpha+1) - std::pow(anXmin, alpha+1), nSea);
317   {                                            << 424     y *= std::pow(1-x1-totalSea*anXmin, aBeta+1) - std::pow(anXmin, aBeta+1);
318     x1 = G4RandFlat::shoot(anXmin, xMax);      << 425     x2 = ymax*G4UniformRand();
319     y = G4Pow::GetInstance()->powA(x1, alpha); << 426   }
320     y *= G4Pow::GetInstance()->powN( G4Pow::Ge << 427   while(x2>y);
321                                      G4Pow::Ge << 428   result = x1;
322     y *= G4Pow::GetInstance()->powA(1-x1-total << 429   return result;
323          G4Pow::GetInstance()->powA(anXmin, aB << 
324     x2 = ymax*G4UniformRand();                 << 
325   } while( (x2>y) && ++loopCounter < maxNumber << 
326   if ( loopCounter >= maxNumberOfLoops ) {     << 
327     x1 = 0.5*( anXmin + xMax );  // Just an ac << 
328   }                                            << 
329   result = x1;                                 << 
330   return result;                               << 
331 }                                                 430 }
332                                                   431