Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/parton_string/hadronization/src/G4QGSMFragmentation.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/hadronization/src/G4QGSMFragmentation.cc (Version 11.3.0) and /processes/hadronic/models/parton_string/hadronization/src/G4QGSMFragmentation.cc (Version 10.1)


  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 //                                                 26 //
                                                   >>  27 // $Id: G4QGSMFragmentation.cc 84707 2014-10-20 07:15:31Z gcosmo $
 27 //                                                 28 //
 28 // -------------------------------------------     29 // -----------------------------------------------------------------------------
 29 //      GEANT 4 class implementation file          30 //      GEANT 4 class implementation file
 30 //                                                 31 //
 31 //      History: first implementation, Maxim K     32 //      History: first implementation, Maxim Komogorov, 10-Jul-1998
 32 // -------------------------------------------     33 // -----------------------------------------------------------------------------
 33 #include "G4QGSMFragmentation.hh"                  34 #include "G4QGSMFragmentation.hh"
 34 #include "G4PhysicalConstants.hh"                  35 #include "G4PhysicalConstants.hh"
 35 #include "G4SystemOfUnits.hh"                  << 
 36 #include "Randomize.hh"                            36 #include "Randomize.hh"
 37 #include "G4ios.hh"                                37 #include "G4ios.hh"
 38 #include "G4FragmentingString.hh"                  38 #include "G4FragmentingString.hh"
 39 #include "G4DiQuarks.hh"                           39 #include "G4DiQuarks.hh"
 40 #include "G4Quarks.hh"                             40 #include "G4Quarks.hh"
 41 #include "G4HadronicParameters.hh"             << 
 42 #include "G4Pow.hh"                            << 
 43                                                    41 
 44 //#define debug_QGSMfragmentation              <<  42 //#define debug_QGSMfragmentation                       // Uzhi Oct. 2014
 45                                                    43 
 46 // Class G4QGSMFragmentation                       44 // Class G4QGSMFragmentation 
 47 //********************************************     45 //****************************************************************************************
 48                                                    46  
 49 G4QGSMFragmentation::G4QGSMFragmentation()     <<  47 G4QGSMFragmentation::G4QGSMFragmentation() :
 50 {                                              <<  48 arho(0.5), aphi(0.), an(-0.5), ala(-0.75), aksi(-1.), alft(0.5)
 51     SigmaQT = 0.45 * GeV;                      <<  49    {
 52                                                <<  50     SetStrangenessSuppression(0.41); // 0.47 0.447                        Uzhi 27.09.2014 0.43 last 0.425
 53     MassCut = 0.35*GeV;                        <<  51     SetDiquarkSuppression(0.25);      // 0.087    std 0.07                Uzhi 0.25 Last
 54                                                <<  52     SetDiquarkBreakProbability(0.4); // 0.05     std 0.1                  Uzhi 27.09.2014
 55     SetStrangenessSuppression((1.0 - 0.16)/2.) <<  53    }
 56                                                << 
 57     // Check if charmed and bottom hadrons are << 
 58     // set the non-zero probabilities for c-cb << 
 59     // else set them to 0.0. If these probabil << 
 60     // hadrons can't/can be created during the << 
 61     // (i.e. not heavy) projectile hadron nucl << 
 62     if ( G4HadronicParameters::Instance()->Ena << 
 63       SetProbCCbar(0.0002);  // According to O << 
 64       SetProbBBbar(5.0e-5);  // According to O << 
 65     } else {                                   << 
 66       SetProbCCbar(0.0);                       << 
 67       SetProbBBbar(0.0);                       << 
 68     }                                          << 
 69                                                << 
 70     SetDiquarkSuppression(0.32);               << 
 71     SetDiquarkBreakProbability(0.7);           << 
 72                                                << 
 73     SetMinMasses();                            << 
 74                                                << 
 75     arho = 0.5;    // alpha_rho0               << 
 76     aphi = 0.0;    // alpha_fi                 << 
 77     aJPs =-2.2;    // alpha_J/Psi              << 
 78     aUps =-8.0;    // alpha_Y      ??? O. Pisk << 
 79                                                << 
 80     aksi =-1.0;                                << 
 81     alft = 0.5;    // 2 * alpha'_R *<Pt^2>     << 
 82                                                << 
 83     an    = -0.5 ;                             << 
 84     ala   = -0.75; // an - arho/2 + aphi/2     << 
 85     alaC  =  an - arho/2.0 + aJPs/2.0;         << 
 86     alaB  =  an - arho/2.0 + aUps/2.0;         << 
 87     aXi   =  0.0;  // ??                       << 
 88     aXiC  =  0.0;  // ??                       << 
 89     aXiB  =  0.0;  // ??                       << 
 90     aXiCC =  0.0;  // ??                       << 
 91     aXiCB =  0.0;  // ??                       << 
 92     aXiBB =  0.0;  // ??                       << 
 93                                                << 
 94     SetFFq2q();                                << 
 95     SetFFq2qq();                               << 
 96     SetFFqq2q();                               << 
 97     SetFFqq2qq();                              << 
 98                          // d  u   s   c   b   << 
 99     G4int Index[5][5] = { { 0, 1,  2,  3,  4 } << 
100                           { 1, 5,  6,  7,  8 } << 
101                           { 2, 6,  9, 10, 11 } << 
102                           { 3, 7, 10, 12, 13 } << 
103                           { 4, 8, 11, 13, 14 } << 
104     for (G4int i = 0; i < 5; i++ ) {           << 
105       for ( G4int j = 0; j < 5; j++ ) {        << 
106         IndexDiQ[i][j] = Index[i][j];          << 
107       }                                        << 
108     };                                         << 
109 }                                              << 
110                                                    54 
111 G4QGSMFragmentation::~G4QGSMFragmentation()        55 G4QGSMFragmentation::~G4QGSMFragmentation()
112 {}                                             <<  56    {
                                                   >>  57    }
113                                                    58 
114 //--------------------------------------------     59 //----------------------------------------------------------------------------------------------------------
115                                                    60 
116 G4KineticTrackVector* G4QGSMFragmentation::Fra     61 G4KineticTrackVector* G4QGSMFragmentation::FragmentString(const G4ExcitedString& theString)
117 {                                                  62 {
118                                                <<  63 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
119   G4FragmentingString  aString(theString);     << 
120   SetMinimalStringMass(&aString);              << 
121                                                << 
122   #ifdef debug_QGSMfragmentation               << 
123   G4cout<<G4endl<<"QGSM StringFragm: String Ma     64   G4cout<<G4endl<<"QGSM StringFragm: String Mass "
124                              <<theString.Get4M     65                              <<theString.Get4Momentum().mag()<<" Pz "
125                              <<theString.Get4M     66                              <<theString.Get4Momentum().pz()
126                              <<"--------------     67                              <<"------------------------------------"<<G4endl;
127   G4cout<<"String ends Direct "<<theString.Get     68   G4cout<<"String ends Direct "<<theString.GetLeftParton()->GetPDGcode()<<" "
128                                <<theString.Get     69                                <<theString.GetRightParton()->GetPDGcode()<<" "
129                                <<theString.Get     70                                <<theString.GetDirection()<< G4endl;
130   G4cout<<"Left  mom "<<theString.GetLeftParto     71   G4cout<<"Left  mom "<<theString.GetLeftParton()->Get4Momentum()<<G4endl;
131   G4cout<<"Right mom "<<theString.GetRightPart     72   G4cout<<"Right mom "<<theString.GetRightParton()->Get4Momentum()<<G4endl;
132   G4cout<<"Check for Fragmentation "<<G4endl;      73   G4cout<<"Check for Fragmentation "<<G4endl;
133   #endif                                       <<  74 #endif
134                                                    75 
135   // Can no longer modify Parameters for Fragm <<  76 //    Can no longer modify Parameters for Fragmentation.
136   PastInitPhase=true;                          <<  77   PastInitPhase=true;
137                                                    78   
138   // Check if string has enough mass to fragme <<  79 //  check if string has enough mass to fragment...
139   G4KineticTrackVector * LeftVector=NULL;      << 
140                                                    80 
141   if ( !IsItFragmentable(&aString) ) {         <<  81   G4KineticTrackVector * LeftVector=LightFragmentationTest(&theString);
142      LeftVector=ProduceOneHadron(&theString);  << 
143                                                    82 
144      #ifdef debug_QGSMfragmentation            <<  83 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
145      if ( LeftVector != 0 ) G4cout<<"Non fragm <<  84   if ( LeftVector != 0 ) G4cout<<"Non fragmentable - the string is converted to one hadron "<<G4endl;
146      #endif                                    <<  85 #endif
147                                                    86 
148      if ( LeftVector == nullptr ) LeftVector = <<  87   if ( LeftVector != 0 ) return LeftVector;
149      return LeftVector;                        << 
150   }                                            << 
151                                                    88 
152   #ifdef debug_QGSMfragmentation               <<  89 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
153   G4cout<<"The string will be fragmented. "<<G     90   G4cout<<"The string will be fragmented. "<<G4endl;
154   #endif                                       <<  91 #endif
155                                                    92   
156   LeftVector = new G4KineticTrackVector;       <<  93   LeftVector = new G4KineticTrackVector;
157   G4KineticTrackVector * RightVector=new G4Kin <<  94   G4KineticTrackVector * RightVector=new G4KineticTrackVector;
158                                                    95 
159   G4ExcitedString *theStringInCMS=CopyExcited( <<  96 // this should work but its only a semi deep copy. %GF  G4ExcitedString theStringInCMS(theString);
160   G4LorentzRotation toCms=theStringInCMS->Tran <<  97         G4ExcitedString *theStringInCMS=CPExcited(theString);
161                                                <<  98   G4LorentzRotation toCms=theStringInCMS->TransformToAlignedCms();
162   G4bool success=false, inner_sucess=true;     <<  99 
163   G4int attempt=0;                             << 100   G4bool success=false, inner_sucess=true;
164   while ( !success && attempt++ < StringLoopIn << 101   G4int attempt=0;
165   {                                            << 102   while ( !success && attempt++ < StringLoopInterrupt )
166                 #ifdef debug_QGSMfragmentation << 103   {
167                 G4cout<<"Loop_toFrag "<<theStr << 104 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
168                                       <<theStr << 105   G4cout<<"Loop_toFrag "<<theStringInCMS->GetLeftParton()->GetPDGcode()<<" "
169                                       <<theStr << 106                         <<theStringInCMS->GetRightParton()->GetPDGcode()<<" "
170                 #endif                         << 107                         <<theStringInCMS->GetDirection()<< G4endl;
                                                   >> 108 #endif
171                                                   109 
172     G4FragmentingString *currentString=new G4F    110     G4FragmentingString *currentString=new G4FragmentingString(*theStringInCMS);
173                                                   111 
174     std::for_each(LeftVector->begin(), LeftVec    112     std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
175     LeftVector->clear();                          113     LeftVector->clear();
176     std::for_each(RightVector->begin(), RightV    114     std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
177     RightVector->clear();                         115     RightVector->clear();
178                                                   116     
179     inner_sucess=true;  // set false on failur    117     inner_sucess=true;  // set false on failure..
180                 const G4int maxNumberOfLoops = << 118 
181                 G4int loopCounter = -1;        << 119     while (! StopFragmenting(currentString) )
182     while (! StopFragmenting(currentString) && << 
183     {  // Split current string into hadron + n    120     {  // Split current string into hadron + new string
184                                                   121 
185                         #ifdef debug_QGSMfragm << 122 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
186                         G4cout<<"The string ca << 123   G4cout<<"The string can fragment. "<<G4endl;;
187                         #endif                 << 124 #endif
188       G4FragmentingString *newString=0;  // us    125       G4FragmentingString *newString=0;  // used as output from SplitUp...
189       G4KineticTrack * Hadron=Splitup(currentS    126       G4KineticTrack * Hadron=Splitup(currentString,newString);
190                                                   127 
191       if ( Hadron != 0 )                       << 128       if ( Hadron != 0 ) // && IsFragmentable(newString))   // Closed by Uzhi, Oct. 2014
192       {                                           129       {
193                            #ifdef debug_QGSMfr << 130 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
194                            G4cout<<"Hadron pro << 131   G4cout<<"Hadron prod at fragm. "<<Hadron->GetDefinition()->GetParticleName()<<G4endl;
195                            #endif              << 132 #endif
196                            // To close the pro << 
197          if ( currentString->GetDecayDirection    133          if ( currentString->GetDecayDirection() > 0 )
198            LeftVector->push_back(Hadron);         134            LeftVector->push_back(Hadron);
199                else                               135                else
200              RightVector->push_back(Hadron);      136              RightVector->push_back(Hadron);
201                                                   137 
202          delete currentString;                    138          delete currentString;
203          currentString=newString;                 139          currentString=newString;
204                                                   140 
205       } else {                                    141       } else {
206                                                   142 
207                            #ifdef debug_QGSMfr << 143 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
208                            G4cout<<"abandon .. << 144   G4cout<<"abandon ... start from the beginning ---------------"<<G4endl;
209                            #endif              << 145 #endif
210                                                   146 
211          // Abandon ... start from the beginni << 147        // abandon ... start from the beginning
212          if (newString) delete newString;         148          if (newString) delete newString;
                                                   >> 149          if (Hadron)    delete Hadron;
213          inner_sucess=false;                      150          inner_sucess=false;
214          break;                                   151          break;
215       }                                           152       }
216     }                                          << 153     } 
217                 if ( loopCounter >= maxNumberO << 
218                   inner_sucess=false;          << 
219                 }                              << 
220                                                << 
221     // Split current string into 2 final Hadro    154     // Split current string into 2 final Hadrons
222                 #ifdef debug_QGSMfragmentation << 155 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
223                 if( inner_sucess ) {           << 156   G4cout<<"Split remaining string into 2 final hadrons."<<G4endl;
224                   G4cout<<"Split remaining str << 157 #endif
225                 } else {                       << 158 
226       G4cout<<" New attempt to fragment string << 159     if ( inner_sucess &&                                    //true)  // Uzhi -- No Last Splitting
227     }                                          << 
228                 #endif                         << 
229                 // To the close production of  << 
230     if ( inner_sucess &&                       << 
231          SplitLast(currentString,LeftVector, R    160          SplitLast(currentString,LeftVector, RightVector) ) 
232     {                                             161     {
233       success=true;                               162       success=true;
234     }                                             163     }
235     delete currentString;                         164     delete currentString;
236   }                                               165   }
237                                                   166   
238   delete theStringInCMS;                          167   delete theStringInCMS;
239                                                   168   
240   if ( ! success )                                169   if ( ! success )
241   {                                               170   {
242     std::for_each(LeftVector->begin(), LeftVec    171     std::for_each(LeftVector->begin(), LeftVector->end(), DeleteKineticTrack());
243     LeftVector->clear();                          172     LeftVector->clear();
244     std::for_each(RightVector->begin(), RightV    173     std::for_each(RightVector->begin(), RightVector->end(), DeleteKineticTrack());
245     delete RightVector;                           174     delete RightVector;
246     return LeftVector;                            175     return LeftVector;
247   }                                               176   }
248                                                   177     
249   // Join Left- and RightVector into LeftVecto    178   // Join Left- and RightVector into LeftVector in correct order.
250   while(!RightVector->empty())  /* Loop checki << 179   while(!RightVector->empty())
251   {                                               180   {
252       LeftVector->push_back(RightVector->back(    181       LeftVector->push_back(RightVector->back());
253       RightVector->erase(RightVector->end()-1)    182       RightVector->erase(RightVector->end()-1);
254   }                                               183   }
255   delete RightVector;                             184   delete RightVector;
256                                                   185 
257   CalculateHadronTimePosition(theString.Get4Mo    186   CalculateHadronTimePosition(theString.Get4Momentum().mag(), LeftVector);
258                                                   187 
259   G4LorentzRotation toObserverFrame(toCms.inve    188   G4LorentzRotation toObserverFrame(toCms.inverse());
260                                                   189 
261   for (size_t C1 = 0; C1 < LeftVector->size(); << 190   for(size_t C1 = 0; C1 < LeftVector->size(); C1++)
262   {                                               191   {
263      G4KineticTrack* Hadron = LeftVector->oper    192      G4KineticTrack* Hadron = LeftVector->operator[](C1);
264      G4LorentzVector Momentum = Hadron->Get4Mo    193      G4LorentzVector Momentum = Hadron->Get4Momentum();
265      Momentum = toObserverFrame*Momentum;         194      Momentum = toObserverFrame*Momentum;
266      Hadron->Set4Momentum(Momentum);              195      Hadron->Set4Momentum(Momentum);
267      G4LorentzVector Coordinate(Hadron->GetPos    196      G4LorentzVector Coordinate(Hadron->GetPosition(), Hadron->GetFormationTime());
268      Momentum = toObserverFrame*Coordinate;       197      Momentum = toObserverFrame*Coordinate;
269      Hadron->SetFormationTime(Momentum.e());      198      Hadron->SetFormationTime(Momentum.e());
270      G4ThreeVector aPosition(Momentum.vect());    199      G4ThreeVector aPosition(Momentum.vect());
271      Hadron->SetPosition(theString.GetPosition    200      Hadron->SetPosition(theString.GetPosition()+aPosition);
272   }                                               201   }
273   return LeftVector;                              202   return LeftVector;
274 }                                              << 203     
275                                                   204 
276 //-------------------------------------------- << 
277                                                   205 
278 G4bool G4QGSMFragmentation::IsItFragmentable(c << 
279 {                                              << 
280   return sqr( MinimalStringMass + MassCut ) <  << 
281 }                                                 206 }
282                                                   207 
283 //--------------------------------------------    208 //----------------------------------------------------------------------------------------------------------
284                                                   209 
285 G4bool G4QGSMFragmentation::StopFragmenting(co << 210 G4double G4QGSMFragmentation::GetLightConeZ(G4double zmin, G4double zmax, G4int PartonEncoding,  
286 {                                              << 211                                             G4ParticleDefinition* pHadron, G4double , G4double )
287   SetMinimalStringMass(string);                << 212 {    
288         if ( MinimalStringMass < 0.0 ) return  << 213 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
289                                                << 214   G4cout<<"GetLightConeZ zmin zmax Parton pHadron "<<zmin<<" "<<zmax<<" "<<PartonEncoding<<" "<<pHadron->GetParticleName()<<G4endl;
290         G4double smass = string->Mass();       << 215 #endif
291   G4double x = (string->IsAFourQuarkString())  << 216   G4double z;    
292     : 0.66e-6*(smass - MinimalStringMass)*(sma << 217   G4double d1, d2, yf;
293                                                << 218   G4double invD1(0.),invD2(0.), r1(0.),r2(0.),r12(0.);
294         G4bool res = true;                     << 
295         if(x > 0.0) {                          << 
296           res = (x < 200.) ? (G4UniformRand()  << 
297   }                                            << 
298   return res;                                  << 
299 }                                              << 
300                                                << 
301 //-------------------------------------------- << 
302                                                << 
303 G4KineticTrack * G4QGSMFragmentation::Splitup( << 
304                              G4FragmentingStri << 
305 {                                              << 
306        #ifdef debug_QGSMfragmentation          << 
307        G4cout<<G4endl;                         << 
308        G4cout<<"Start SplitUP (G4VLongitudinal << 
309        G4cout<<"String partons: " <<string->Ge << 
310                                   <<string->Ge << 
311              <<"Direction "       <<string->Ge << 
312        #endif                                  << 
313                                                << 
314        //... random choice of string end to us << 
315        G4int SideOfDecay = (G4UniformRand() <  << 
316        if (SideOfDecay < 0)                    << 
317        {                                       << 
318     string->SetLeftPartonStable();             << 
319        } else                                  << 
320        {                                       << 
321           string->SetRightPartonStable();      << 
322        }                                       << 
323                                                << 
324        G4ParticleDefinition *newStringEnd;     << 
325        G4ParticleDefinition * HadronDefinition << 
326        if (string->DecayIsQuark())             << 
327        {                                       << 
328     G4double ProbDqADq = GetDiquarkSuppress(); << 
329                                                << 
330     G4int NumberOfpossibleBaryons = 2;         << 
331                                                << 
332     if (string->GetLeftParton()->GetParticleSu << 
333     if (string->GetRightParton()->GetParticleS << 
334                                                << 
335     G4double ActualProb  = ProbDqADq ;         << 
336           ActualProb *= (1.0-G4Exp(2.0*(1.0 -  << 
337                                                << 
338     SetDiquarkSuppression(ActualProb);         << 
339                                                << 
340           HadronDefinition= QuarkSplitup(strin << 
341                                                << 
342     SetDiquarkSuppression(ProbDqADq);          << 
343        } else {                                << 
344           HadronDefinition= DiQuarkSplitup(str << 
345        }                                       << 
346                                                << 
347        if ( HadronDefinition == NULL ) return  << 
348                                                << 
349        #ifdef debug_QGSMfragmentation          << 
350        G4cout<<"The parton "<<string->GetDecay << 
351              <<" produces hadron "<<HadronDefi << 
352              <<" and is transformed to "<<newS << 
353        G4cout<<"The side of the string decay L << 
354        #endif                                  << 
355        // create new String from old, ie. keep << 
356                                                << 
357        newString=new G4FragmentingString(*stri << 
358                                                << 
359                                                << 
360        #ifdef debug_QGSMfragmentation          << 
361        G4cout<<"An attempt to determine its en << 
362        #endif                                  << 
363        G4LorentzVector* HadronMomentum=SplitEa << 
364                                                   219 
365        delete newString; newString=0;          << 220   G4int absCode = std::abs( PartonEncoding );
366                                                << 221   G4int absHadronCode=std::abs(pHadron->GetPDGEncoding());
367        G4KineticTrack * Hadron =0;             << 
368        if ( HadronMomentum != 0 ) {            << 
369                                                   222 
370            #ifdef debug_QGSMfragmentation      << 223   G4int q1, q2, q3;
371            G4cout<<"The attempt was successful << 224   q1 = absHadronCode/1000; q2 = (absHadronCode % 1000)/100; q3 = (absHadronCode % 100)/10;
372            #endif                              << 
373      G4ThreeVector   Pos;                      << 
374      Hadron = new G4KineticTrack(HadronDefinit << 
375                                                << 
376          newString=new G4FragmentingString(*st << 
377                                                << 
378      delete HadronMomentum;                    << 
379        }                                       << 
380        else                                    << 
381        {                                       << 
382          #ifdef debug_QGSMfragmentation        << 
383          G4cout<<"The attempt was not successf << 
384          #endif                                << 
385        }                                       << 
386                                                << 
387        #ifdef debug_VStringDecay               << 
388        G4cout<<"End SplitUP (G4VLongitudinalSt << 
389        #endif                                  << 
390                                                   225 
391        return Hadron;                          << 226   G4bool StrangeHadron = (q1 == 3) || (q2 == 3) || (q3 == 3);
392 }                                              << 
393                                                << 
394 //-------------------------------------------- << 
395                                                << 
396 G4ParticleDefinition *G4QGSMFragmentation::DiQ << 
397                                                << 
398 {                                              << 
399    //... can Diquark break or not?             << 
400    if (G4UniformRand() < DiquarkBreakProb )  / << 
401    {                                           << 
402       G4int stableQuarkEncoding = decay->GetPD << 
403       G4int decayQuarkEncoding = (decay->GetPD << 
404                                                   227 
405       if (G4UniformRand() < 0.5)               << 228   if (absCode < 10)
406       {                                        << 229   {                                              // A quark fragmentation ----------------------------
407          G4int Swap = stableQuarkEncoding;     << 230     if(absCode == 1 || absCode == 2) 
408          stableQuarkEncoding = decayQuarkEncod << 231     {
409          decayQuarkEncoding = Swap;            << 232       if(absHadronCode < 1000) 
                                                   >> 233       {                        // Meson  produced
                                                   >> 234         if( !StrangeHadron )  {d1=2.0;        d2 = -arho + alft;}
                                                   >> 235         else                  {d1=1.0;        d2 = -aphi + alft;}
                                                   >> 236       } else                 
                                                   >> 237       {                        // Baryon produced
                                                   >> 238         if( !StrangeHadron )  {d1=0.0;        d2 =      arho - 2.0*an        + alft;}
                                                   >> 239         else                  {d1=0.0;        d2 =  2.0*arho - 2.0*an - aphi + alft;} 
410       }                                           240       }
                                                   >> 241     } 
                                                   >> 242     else if(absCode == 3)  
                                                   >> 243     {
                                                   >> 244       if(absHadronCode < 1000){d1=1.0 - aphi; d2 =  -arho          + alft;}  // Meson  produced s->K + u/d
                                                   >> 245       else                    {d1=1.0 - aphi; d2 =   arho - 2.0*an + alft;}  // Baryon produced 
411                                                   246 
412       G4int IsParticle=(decayQuarkEncoding>0)  << 247     } else throw G4HadronicException(__FILE__, __LINE__, "Unknown PDGencoding in G4QGSMFragmentation::G4LightConeZ");
413                                                   248 
414       G4double StrSup=GetStrangeSuppress();    << 249 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
415       SetStrangenessSuppression((1.0 - 0.07)/2 << 250   G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
416       pDefPair QuarkPair = CreatePartonPair(Is << 251 #endif
417       SetStrangenessSuppression(StrSup);       << 
418                                                   252 
419       //... Build new Diquark                  << 253     d1+=1.0; d2+=1.0;
420       G4int QuarkEncoding=QuarkPair.second->Ge << 
421       G4int i10  = std::max(std::abs(QuarkEnco << 
422       G4int i20  = std::min(std::abs(QuarkEnco << 
423       G4int spin = (i10 != i20 && G4UniformRan << 
424       G4int NewDecayEncoding = -1*IsParticle*( << 
425                                                << 
426       created = FindParticle(NewDecayEncoding) << 
427       G4ParticleDefinition * decayQuark=FindPa << 
428       G4ParticleDefinition * had=hadronizer->B << 
429                                                   254 
430       DecayQuark = decay->GetPDGEncoding();    << 255     invD1=1./d1; invD2=1./d2;
431       NewQuark   = NewDecayEncoding;           << 
432                                                   256 
433       return had;                              << 257     do
                                                   >> 258     {
                                                   >> 259      r1=std::pow(G4UniformRand(),invD1);
                                                   >> 260      r2=std::pow(G4UniformRand(),invD2);
                                                   >> 261      r12=r1+r2;
                                                   >> 262      z=r1/r12;
                                                   >> 263     } while( (r12 > 1.0) || !((zmin <= z)&&(z <= zmax)));
434                                                   264 
435    } else {  //... Diquark does not break      << 265     return z;
                                                   >> 266   }
                                                   >> 267   else
                                                   >> 268   {                                              // A di-quark fragmentation -------------------------
                                                   >> 269     if(absCode == 1103 || absCode == 2101 || 
                                                   >> 270        absCode == 2203 || absCode == 2103)
                                                   >> 271     {
                                                   >> 272      if(absHadronCode < 1000)                                                // Meson production
                                                   >> 273      {
                                                   >> 274         if( !StrangeHadron )  {d1=1.0; d2=     arho - 2.0*an        + alft;} 
                                                   >> 275         else                  {d1=1.0; d2 = 2.*arho - 2.0*an - aphi + alft;}
                                                   >> 276      } else                                                                 // Baryon production
                                                   >> 277      {
                                                   >> 278         if( !StrangeHadron )  {d1=2.0*(arho - an); d2= -arho         + alft;}
                                                   >> 279         else                  {d1=2.0*(arho - an); d2 =-aphi         + alft;} 
                                                   >> 280      }
                                                   >> 281 
                                                   >> 282 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
                                                   >> 283   G4cout<<"d1 d2 "<<d1<<" "<<d2<<G4endl;
                                                   >> 284 #endif
                                                   >> 285 
                                                   >> 286      d1+=1.0; d2+=1.0;
                                                   >> 287      invD1=1./d1; invD2=1./d2;
                                                   >> 288 
                                                   >> 289      do
                                                   >> 290      {
                                                   >> 291       r1=std::pow(G4UniformRand(),invD1);
                                                   >> 292       r2=std::pow(G4UniformRand(),invD2);
                                                   >> 293       r12=r1+r2;
                                                   >> 294       z=r1/r12;
                                                   >> 295      } while( (r12 > 1.0) || !((zmin <= z)&&(z <= zmax)));
436                                                   296 
437       G4int IsParticle=(decay->GetPDGEncoding( << 297      return z;
438       G4double StrSup=GetStrangeSuppress();  / << 298     }
439       SetStrangenessSuppression((1.0 - 0.07)/2 << 299     else if(absCode == 3101 || absCode == 3103 ||           // For strange d-quarks
440       pDefPair QuarkPair = CreatePartonPair(Is << 300             absCode == 3201 || absCode == 3203)
441       SetStrangenessSuppression(StrSup);       << 301     {
                                                   >> 302       d2 =  (alft - (2.*ala - arho));
442                                                   303 
443       created = QuarkPair.second;              << 304     }
                                                   >> 305     else
                                                   >> 306     {
                                                   >> 307       d2 =  (alft - (2.*aksi - arho));
                                                   >> 308     }
444                                                   309 
445       DecayQuark = decay->GetPDGEncoding();    << 310     do  
446       NewQuark   = created->GetPDGEncoding();  << 311     {
                                                   >> 312       z = zmin + G4UniformRand() * (zmax - zmin);
                                                   >> 313       d1 =  (1. - z);
                                                   >> 314       yf = std::pow(d1, d2);
                                                   >> 315     } 
                                                   >> 316     while (G4UniformRand() > yf); 
                                                   >> 317   }
447                                                   318 
448       G4ParticleDefinition * had=hadronizer->B << 319   return z;
449       return had;                              << 
450    }                                           << 
451 }                                                 320 }
452                                                << 
453 //--------------------------------------------    321 //-----------------------------------------------------------------------------------------
454                                                   322 
455 G4LorentzVector * G4QGSMFragmentation::SplitEa    323 G4LorentzVector * G4QGSMFragmentation::SplitEandP(G4ParticleDefinition * pHadron,
456                                                << 324                                                   G4FragmentingString * string,    // Uzhi
457                                                << 325                                                   G4FragmentingString * NewString) // Uzhi Oct. 2014
458 {                                                 326 {
459        G4double HadronMass = pHadron->GetPDGMa    327        G4double HadronMass = pHadron->GetPDGMass();
460                                                   328 
461        SetMinimalStringMass(NewString);        << 329        G4double MinimalStringMass= FragmentationMass(NewString,&G4HadronBuilder::BuildHighSpin);
462                                                << 
463        if ( MinimalStringMass < 0.0 ) return n << 
464                                                   330 
465        #ifdef debug_QGSMfragmentation          << 331 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
466        G4cout<<"G4QGSMFragmentation::SplitEand << 332   G4cout<<"G4QGSMFragmentation::SplitEandP "<<pHadron->GetParticleName()<<G4endl;
467        G4cout<<"String 4 mom, String M "<<stri << 333   G4cout<<"String 4 mom, String M "<<string->Get4Momentum()<<" "<<string->Mass()<<G4endl;
468        G4cout<<"HadM MinimalStringMassLeft Str << 334   G4cout<<"HadM MinimalStringMassLeft StringM hM+sM "<<HadronMass<<" "<<MinimalStringMass<<" "
469              <<string->Mass()<<" "<<HadronMass << 335         <<string->Mass()<<" "<<HadronMass+MinimalStringMass<<G4endl;
470        #endif                                  << 336 #endif
471                                                   337 
472        if (HadronMass + MinimalStringMass > st << 338         if(HadronMass + MinimalStringMass > string->Mass())
473        {                                       << 339   {
474          #ifdef debug_QGSMfragmentation        << 340 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
475          G4cout<<"Mass of the string is not su << 341   G4cout<<"Mass of the string is not sufficient to produce the hadron!"<<G4endl;
476          #endif                                << 342 #endif
477    return 0;                                      343    return 0;
478        }  // have to start all over!           << 344   }// have to start all over!
479                                                   345 
480        // calculate and assign hadron transver    346        // calculate and assign hadron transverse momentum component HadronPx andHadronPy
481        G4double StringMT2 = string->MassT2();     347        G4double StringMT2 = string->MassT2();
482        G4double StringMT  = std::sqrt(StringMT    348        G4double StringMT  = std::sqrt(StringMT2);
483                                                   349 
484        G4LorentzVector String4Momentum = strin    350        G4LorentzVector String4Momentum = string->Get4Momentum();
485        String4Momentum.setPz(0.);                 351        String4Momentum.setPz(0.);
486        G4ThreeVector StringPt = String4Momentu    352        G4ThreeVector StringPt = String4Momentum.vect();
487                                                   353 
488        G4ThreeVector HadronPt    , RemSysPt;      354        G4ThreeVector HadronPt    , RemSysPt;
489        G4double      HadronMassT2, ResidualMas    355        G4double      HadronMassT2, ResidualMassT2;
490                                                   356 
491        // Mt distribution is implemented       << 
492        G4double HadronMt, Pt, Pt2, phi;        << 
493                                                << 
494        //...  sample Pt of the hadron             357        //...  sample Pt of the hadron
495        G4int attempt=0;                           358        G4int attempt=0;
496        do                                         359        do
497        {                                          360        {
498          attempt++; if (attempt > StringLoopIn << 361         attempt++; if(attempt > StringLoopInterrupt) return 0;
499                                                   362 
500          HadronMt = HadronMass - 200.0*G4Log(G << 363         HadronPt =SampleQuarkPt()  + string->DecayPt(); 
501          Pt2 = sqr(HadronMt)-sqr(HadronMass);  << 364         HadronPt.setZ(0);
502          phi = 2.*pi*G4UniformRand();          << 365         RemSysPt = StringPt - HadronPt;
503          G4ThreeVector SampleQuarkPtw= G4Three << 
504          HadronPt =SampleQuarkPtw  + string->D << 
505          HadronPt.setZ(0);                     << 
506          RemSysPt = StringPt - HadronPt;       << 
507                                                   366 
508          HadronMassT2 = sqr(HadronMass) + Hadr << 367         HadronMassT2 = sqr(HadronMass) + HadronPt.mag2();
509          ResidualMassT2=sqr(MinimalStringMass) << 368         ResidualMassT2=sqr(MinimalStringMass) + RemSysPt.mag2();
510                                                   369 
511        } while (std::sqrt(HadronMassT2) + std: << 370        } while(std::sqrt(HadronMassT2) + std::sqrt(ResidualMassT2) > StringMT);
512                                                   371 
513        //...  sample z to define hadron longit    372        //...  sample z to define hadron longitudinal momentum and energy
514        //... but first check the available pha    373        //... but first check the available phase space
515                                                   374 
516        G4double Pz2 = (sqr(StringMT2 - HadronM << 375   G4double Pz2 = (sqr(StringMT2 - HadronMassT2 - ResidualMassT2) -
517           4*HadronMassT2 * ResidualMassT2)/4./ << 376       4*HadronMassT2 * ResidualMassT2)/4./StringMT2;
                                                   >> 377 
                                                   >> 378   if(Pz2 < 0 ) {return 0;}          // have to start all over!
518                                                   379 
519        if ( Pz2 < 0 ) {return 0;}          //  << 380   //... then compute allowed z region  z_min <= z <= z_max
520                                                   381 
521        //... then compute allowed z region  z_ << 382   G4double Pz = std::sqrt(Pz2);
                                                   >> 383   G4double zMin = (std::sqrt(HadronMassT2+Pz2) - Pz)/std::sqrt(StringMT2);
                                                   >> 384   G4double zMax = (std::sqrt(HadronMassT2+Pz2) + Pz)/std::sqrt(StringMT2);
522                                                   385 
523        G4double Pz = std::sqrt(Pz2);           << 386 /*  close by Uzhi, Oct. 2014
524        G4double zMin = (std::sqrt(HadronMassT2 << 387        G4double DecayQuarkMass2  = sqr(string->GetDecayParton()->GetPDGMass());
525        G4double zMax = (std::sqrt(HadronMassT2 << 388        G4double HadronMass2T = sqr(HadronMass) + HadronPt.mag2();
526                                                   389 
                                                   >> 390        if (DecayQuarkMass2 + HadronMass2T >= SmoothParam*(string->Mass2()) ) 
                                                   >> 391           return 0;   // have to start all over!
                                                   >> 392 
                                                   >> 393        //... then compute allowed z region  z_min <= z <= z_max 
                                                   >> 394  
                                                   >> 395 //       G4double zMin = HadronMass2T/(string->Mass2());
                                                   >> 396 //       G4double zMax = 1. - DecayQuarkMass2/(string->Mass2());
                                                   >> 397 */
527        if (zMin >= zMax) return 0;    // have     398        if (zMin >= zMax) return 0;    // have to start all over!
528                                                   399   
529        G4double z = GetLightConeZ(zMin, zMax,     400        G4double z = GetLightConeZ(zMin, zMax,
530                       string->GetDecayParton() << 401            string->GetDecayParton()->GetPDGEncoding(), pHadron,
531                       HadronPt.x(), HadronPt.y << 402            HadronPt.x(), HadronPt.y());      
532                                                   403 
533        //... now compute hadron longitudinal m    404        //... now compute hadron longitudinal momentum and energy
534        // longitudinal hadron momentum compone    405        // longitudinal hadron momentum component HadronPz
535                                                   406 
536        HadronPt.setZ( 0.5* string->GetDecayDir << 407         HadronPt.setZ(0.5* string->GetDecayDirection() *
537           (z * string->LightConeDecay() -      << 408       (z * string->LightConeDecay() - 
538            HadronMassT2/(z * string->LightCone << 409        HadronMassT2/(z * string->LightConeDecay())));
539        G4double HadronE  = 0.5* (z * string->L << 410         G4double HadronE  = 0.5* (z * string->LightConeDecay() + 
540          HadronMassT2/(z * string->LightConeDe << 411           HadronMassT2/(z * string->LightConeDecay()));
541                                                   412 
542        G4LorentzVector * a4Momentum= new G4Lor    413        G4LorentzVector * a4Momentum= new G4LorentzVector(HadronPt,HadronE);
543                                                   414 
544        #ifdef debug_QGSMfragmentation          << 415 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
545        G4cout<<"string->GetDecayDirection() st << 416   G4cout<<"string->GetDecayDirection() string->LightConeDecay() "
546              <<string->GetDecayDirection()<<"  << 417         <<string->GetDecayDirection()<<" "<<string->LightConeDecay()<<G4endl;
547        G4cout<<"HadronPt,HadronE "<<HadronPt<< << 418   G4cout<<"HadronPt,HadronE "<<HadronPt<<" "<<HadronE<<G4endl;
548        G4cout<<"Out of QGSM SplitEandP "<<G4en << 419 //  G4cout<<"String4Momentum "<<String4Momentum<<G4endl;
549        #endif                                  << 420 //G4int Uzhi; G4cin>>Uzhi;
                                                   >> 421   G4cout<<"Out of QGSM SplitEandP "<<G4endl;
                                                   >> 422 #endif
550                                                   423 
551        return a4Momentum;                         424        return a4Momentum;
552 }                                                 425 }
553                                                   426 
554 //-------------------------------------------- << 
555                                                << 
556 G4double G4QGSMFragmentation::GetLightConeZ(G4 << 
557                                             G4 << 
558 {                                              << 
559   G4double lambda = 2.0*(sqr(ptx)+sqr(pty))/sq << 
560                                                << 
561   #ifdef debug_QGSMfragmentation               << 
562   G4cout<<"GetLightConeZ zmin zmax Parton pHad << 
563         <<" "/*<< pHadron->GetParticleName() * << 
564   #endif                                       << 
565                                                << 
566   G4double z(0.);                              << 
567   G4int DiQold(0), DiQnew(0);                  << 
568   G4double d1(-1.0), d2(0.);                   << 
569   G4double invD1(0.),invD2(0.), r1(0.),r2(0.), << 
570                                                << 
571   G4int absDecayQuarkCode = std::abs( DecayQua << 
572   G4int absNewQuarkCode   = std::abs( NewQuark << 
573                                                << 
574   G4int q1(0), q2(0);                          << 
575   //  q1 = absDecayQuarkCode/1000; q2 = (absDe << 
576                                                << 
577   G4int qA(0), qB(0);                          << 
578   //  qA = absNewQuarkCode/1000;   qB = (absNe << 
579                                                << 
580   if ( (absDecayQuarkCode < 6) && (absNewQuark << 
581     d1 = FFq2q[absDecayQuarkCode-1][absNewQuar << 
582   }                                            << 
583                                                << 
584   if ( (absDecayQuarkCode < 6) && (absNewQuark << 
585    qA = absNewQuarkCode/1000;   qB = (absNewQu << 
586    d1 = FFq2qq[absDecayQuarkCode-1][DiQnew][0] << 
587   }                                            << 
588                                                << 
589   if ( (absDecayQuarkCode > 6) && (absNewQuark << 
590     q1 = absDecayQuarkCode/1000; q2 = (absDeca << 
591     d1 = FFqq2q[DiQold][absNewQuarkCode-1][0]; << 
592   }                                            << 
593                                                << 
594   if ( d1 < 0. ) {                             << 
595     q1 = absDecayQuarkCode/1000; q2 = (absDeca << 
596     qA = absNewQuarkCode/1000;   qB = (absNewQ << 
597     d1 = FFqq2qq[DiQold][DiQnew][0]; d2 = FFqq << 
598   }                                            << 
599                                                << 
600   d2 +=lambda;                                 << 
601   d1+=1.0; d2+=1.0;                            << 
602                                                << 
603   invD1=1./d1; invD2=1./d2;                    << 
604                                                << 
605   const G4int maxNumberOfLoops = 10000;        << 
606   G4int loopCounter = 0;                       << 
607   do  // Jong's algorithm                      << 
608   {                                            << 
609     r1=G4Pow::GetInstance()->powA(G4UniformRan << 
610     r2=G4Pow::GetInstance()->powA(G4UniformRan << 
611     r12=r1+r2;                                 << 
612     z=r1/r12;                                  << 
613   } while ( ( (r12 > 1.0) || !((zmin <= z)&&(z << 
614             ++loopCounter < maxNumberOfLoops ) << 
615                                                << 
616   if ( loopCounter >= maxNumberOfLoops ) {     << 
617     z = 0.5*(zmin + zmax);  // Just a value be << 
618   }                                            << 
619                                                << 
620   return z;                                    << 
621 }                                              << 
622                                                   427 
623 //--------------------------------------------    428 //-----------------------------------------------------------------------------------------
624                                                   429 
625 G4bool G4QGSMFragmentation::SplitLast(G4Fragme    430 G4bool G4QGSMFragmentation::SplitLast(G4FragmentingString * string,
626                     G4KineticTrackVector * Lef << 431                G4KineticTrackVector * LeftVector,
627                   G4KineticTrackVector * Right << 432                    G4KineticTrackVector * RightVector)
628 {                                                 433 {
629     //... perform last cluster decay              434     //... perform last cluster decay
630                                                   435 
631     G4ThreeVector ClusterVel =string->Get4Mome    436     G4ThreeVector ClusterVel =string->Get4Momentum().boostVector();
632     G4double ResidualMass    =string->Mass();  << 437     G4double ResidualMass    =string->Mass(); 
633                                                   438 
634     #ifdef debug_QGSMfragmentation             << 439 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
635     G4cout<<"Split last----------------------- << 440   G4cout<<"Split last-----------------------------------------"<<G4endl;
636     G4cout<<"StrMass "<<ResidualMass<<" q's "  << 441   G4cout<<"StrMass "<<ResidualMass<<" q's "
637           <<string->GetLeftParton()->GetPartic << 442         <<string->GetLeftParton()->GetParticleName()<<" "
638           <<string->GetRightParton()->GetParti << 443         <<string->GetRightParton()->GetParticleName()<<G4endl;
639     #endif                                     << 444 #endif
640                                                   445 
                                                   >> 446     G4double ClusterMassCut = ClusterMass;            // Taken from G4VLongitudinalStringDecay
641     G4int cClusterInterrupt = 0;                  447     G4int cClusterInterrupt = 0;
642     G4ParticleDefinition *LeftHadron = nullptr << 448     G4ParticleDefinition * LeftHadron, * RightHadron;
643     G4ParticleDefinition *RightHadron = nullpt << 
644     const G4int maxNumberOfLoops = 1000;       << 
645     G4int loopCounter = 0;                     << 
646                                                << 
647     G4double LeftHadronMass(0.); G4double Righ << 
648     do                                            449     do
649     {                                             450     {
650         if (cClusterInterrupt++ >= ClusterLoop << 451         if (cClusterInterrupt++ >= ClusterLoopInterrupt)
651         LeftHadronMass = -MaxMass; RightHadron << 452         {
                                                   >> 453           return false;
                                                   >> 454         }
652                                                   455 
653   G4ParticleDefinition * quark = nullptr;      << 456   G4ParticleDefinition * quark = NULL;
654   string->SetLeftPartonStable(); // to query q    457   string->SetLeftPartonStable(); // to query quark contents..
655                                                   458 
656   if (string->DecayIsQuark() && string->Stable    459   if (string->DecayIsQuark() && string->StableIsQuark() ) 
657   {                                               460   {
658     //... there are quarks on cluster ends     << 461      //... there are quarks on cluster ends
659                                                << 462     LeftHadron= QuarkSplitup(string->GetLeftParton(), quark);
660     G4int IsParticle=(string->GetLeftParton()- << 463   } else {
661                 // if we have a quark, we need << 464      //... there is a Diquark on cluster ends
                                                   >> 465     G4int IsParticle;
                                                   >> 466     if ( string->StableIsQuark() ) {
                                                   >> 467       IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? -1 : +1; 
                                                   >> 468     } else {
                                                   >> 469       IsParticle=(string->GetLeftParton()->GetPDGEncoding()>0) ? +1 : -1;
                                                   >> 470     }
662                                                   471 
663     pDefPair QuarkPair = CreatePartonPair(IsPa << 472           pDefPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
664     quark = QuarkPair.second;                  << 473           quark = QuarkPair.second;
                                                   >> 474           LeftHadron=hadronizer->Build(QuarkPair.first, string->GetLeftParton());
                                                   >> 475   }
665                                                   476 
666     LeftHadron= hadronizer->Build(QuarkPair.fi << 477         RightHadron = hadronizer->Build(string->GetRightParton(), quark);
667           if ( LeftHadron == NULL ) continue;  << 
668           RightHadron = hadronizer->Build(stri << 
669           if ( RightHadron == NULL ) continue; << 
670   } else if( (!string->DecayIsQuark() &&  stri << 
671              ( string->DecayIsQuark() && !stri << 
672     //... there is a Diquark on one of cluster << 
673     G4int IsParticle;                          << 
674     if ( string->StableIsQuark() ) {           << 
675       IsParticle=(string->GetLeftParton()->Get << 
676     } else {                                   << 
677       IsParticle=(string->GetLeftParton()->Get << 
678     }                                          << 
679                                                << 
680           //G4double ProbSaS   = 1.0 - 2.0 * G << 
681           //G4double ActualProb = ProbSaS * 1. << 
682           //SetStrangenessSuppression((1.0-Act << 
683                                                << 
684           pDefPair QuarkPair = CreatePartonPai << 
685           //SetStrangenessSuppression((1.0-Pro << 
686           quark = QuarkPair.second;            << 
687           LeftHadron=hadronizer->Build(QuarkPa << 
688           if ( LeftHadron == NULL ) continue;  << 
689           RightHadron = hadronizer->Build(stri << 
690           if ( RightHadron == NULL ) continue; << 
691         } else {  // Diquark and anti-diquark  << 
692           if (cClusterInterrupt++ >= ClusterLo << 
693           G4int LeftQuark1= string->GetLeftPar << 
694           G4int LeftQuark2=(string->GetLeftPar << 
695           G4int RightQuark1= string->GetRightP << 
696           G4int RightQuark2=(string->GetRightP << 
697           if (G4UniformRand()<0.5) {           << 
698             LeftHadron  =hadronizer->Build(Fin << 
699             RightHadron =hadronizer->Build(Fin << 
700           } else {                             << 
701             LeftHadron  =hadronizer->Build(Fin << 
702             RightHadron =hadronizer->Build(Fin << 
703           }                                    << 
704     if ( (LeftHadron == NULL) || (RightHadron  << 
705         }                                      << 
706         LeftHadronMass  = LeftHadron->GetPDGMa << 
707         RightHadronMass = RightHadron->GetPDGM << 
708         //... repeat procedure, if mass of clu << 
709     } while ( ( ResidualMass <= LeftHadronMass << 
710               && ++loopCounter < maxNumberOfLo << 
711                                                   478 
712     if ( loopCounter >= maxNumberOfLoops ) {   << 479        //... repeat procedure, if mass of cluster is too low to produce hadrons
713       return false;                            << 480        //... ClusterMassCut = 0.15*GeV model parameter
714     }                                          << 481   if ( quark->GetParticleSubType()== "quark" ) {ClusterMassCut = 0.;}
                                                   >> 482   else {ClusterMassCut = ClusterMass;}
                                                   >> 483     } 
                                                   >> 484     while (ResidualMass <= LeftHadron->GetPDGMass() + RightHadron->GetPDGMass()  + ClusterMassCut);
715                                                   485 
716     //... compute hadron momenta and energies     486     //... compute hadron momenta and energies   
717     G4LorentzVector  LeftMom, RightMom;           487     G4LorentzVector  LeftMom, RightMom;
718     G4ThreeVector    Pos;                         488     G4ThreeVector    Pos;
719     Sample4Momentum(&LeftMom , LeftHadron->Get    489     Sample4Momentum(&LeftMom , LeftHadron->GetPDGMass() , 
720                     &RightMom, RightHadron->Ge    490                     &RightMom, RightHadron->GetPDGMass(), ResidualMass);
721     LeftMom.boost(ClusterVel);                    491     LeftMom.boost(ClusterVel);
722     RightMom.boost(ClusterVel);                   492     RightMom.boost(ClusterVel);
723                                                   493 
724     #ifdef debug_QGSMfragmentation             << 494 #ifdef debug_QGSMfragmentation                          // Uzhi Oct. 2014
725     G4cout<<LeftHadron->GetParticleName()<<" " << 495   G4cout<<LeftHadron->GetParticleName()<<" "<<RightHadron->GetParticleName()<<G4endl;
726     G4cout<<"Left  Hadrom P M "<<LeftMom<<" "< << 496   G4cout<<"Left  Hadrom P M "<<LeftMom<<" "<<LeftMom.mag()<<G4endl;
727     G4cout<<"Right Hadrom P M "<<RightMom<<" " << 497   G4cout<<"Right Hadrom P M "<<RightMom<<" "<<RightMom.mag()<<G4endl;
728     #endif                                     << 498 #endif
729                                                   499 
730     LeftVector->push_back(new G4KineticTrack(L    500     LeftVector->push_back(new G4KineticTrack(LeftHadron, 0, Pos, LeftMom));
731     RightVector->push_back(new G4KineticTrack(    501     RightVector->push_back(new G4KineticTrack(RightHadron, 0, Pos, RightMom));
732                                                   502 
733     return true;                                  503     return true;
                                                   >> 504 
734 }                                                 505 }
735                                                   506 
736 //--------------------------------------------    507 //----------------------------------------------------------------------------------------------------------
737                                                   508 
738 void G4QGSMFragmentation::Sample4Momentum(G4Lo << 509 G4bool G4QGSMFragmentation::IsFragmentable(const G4FragmentingString * const string)
739                                           G4Lo << 510 {
                                                   >> 511   return sqr(FragmentationMass(string)+MassCut) <
                                                   >> 512       string->Mass2();
                                                   >> 513 }
                                                   >> 514 
                                                   >> 515 //----------------------------------------------------------------------------------------------------------
                                                   >> 516 
                                                   >> 517 G4bool G4QGSMFragmentation::StopFragmenting(const G4FragmentingString * const string)
740 {                                                 518 {
741     #ifdef debug_QGSMfragmentation             << 519   return
742     G4cout<<"Sample4Momentum Last------------- << 520          sqr(FragmentationMass(string,&G4HadronBuilder::BuildHighSpin)+MassCut) >
743     G4cout<<"  StrMass "<<InitialMass<<" Mass1 << 521          string->Get4Momentum().mag2();
744     G4cout<<"  SumMass "<<Mass+AntiMass<<G4end << 522 }
745     #endif                                     << 523 
                                                   >> 524 //----------------------------------------------------------------------------------------------------------
                                                   >> 525 
                                                   >> 526 //----------------------------------------------------------------------------------------------------------
746                                                   527 
                                                   >> 528 void G4QGSMFragmentation::Sample4Momentum(G4LorentzVector* Mom    , G4double Mass    , 
                                                   >> 529                                           G4LorentzVector* AntiMom, G4double AntiMass, G4double InitialMass) 
                                                   >> 530     {
747     G4double r_val = sqr(InitialMass*InitialMa    531     G4double r_val = sqr(InitialMass*InitialMass - Mass*Mass - AntiMass*AntiMass) - sqr(2.*Mass*AntiMass);
748     G4double Pabs = (r_val > 0.)? std::sqrt(r_    532     G4double Pabs = (r_val > 0.)? std::sqrt(r_val)/(2.*InitialMass) : 0;
749                                                   533 
750     //... sample unit vector                      534     //... sample unit vector       
751     G4double pz = 1. - 2.*G4UniformRand();        535     G4double pz = 1. - 2.*G4UniformRand();  
752     G4double st     = std::sqrt(1. - pz * pz)*    536     G4double st     = std::sqrt(1. - pz * pz)*Pabs;
753     G4double phi    = 2.*pi*G4UniformRand();      537     G4double phi    = 2.*pi*G4UniformRand();
754     G4double px = st*std::cos(phi);               538     G4double px = st*std::cos(phi);
755     G4double py = st*std::sin(phi);               539     G4double py = st*std::sin(phi);
756     pz *= Pabs;                                   540     pz *= Pabs;
757                                                   541     
758     Mom->setPx(px); Mom->setPy(py); Mom->setPz    542     Mom->setPx(px); Mom->setPy(py); Mom->setPz(pz);
759     Mom->setE(std::sqrt(Pabs*Pabs + Mass*Mass)    543     Mom->setE(std::sqrt(Pabs*Pabs + Mass*Mass));
760                                                   544 
761     AntiMom->setPx(-px); AntiMom->setPy(-py);     545     AntiMom->setPx(-px); AntiMom->setPy(-py); AntiMom->setPz(-pz);
762     AntiMom->setE (std::sqrt(Pabs*Pabs + AntiM    546     AntiMom->setE (std::sqrt(Pabs*Pabs + AntiMass*AntiMass));
763 }                                              << 547     }
764                                                   548 
765 //-------------------------------------------- << 549     
                                                   >> 550 //*********************************************************************************************
                                                   >> 551 // Uzhi June 2014 Insert from G4ExcitedStringDecay.cc
                                                   >> 552 //-----------------------------------------------------------------------------
766                                                   553 
767 void G4QGSMFragmentation::SetFFq2q()  // q-> q << 554 G4ParticleDefinition *G4QGSMFragmentation::DiQuarkSplitup(
                                                   >> 555                                                           G4ParticleDefinition* decay,
                                                   >> 556                                                           G4ParticleDefinition *&created)
768 {                                                 557 {
769   for (G4int i=0; i < 5; i++) {                << 558    //... can Diquark break or not?
770     FFq2q[i][0][0] = 2.0 ; FFq2q[i][0][1] = -a << 559    if (G4UniformRand() < DiquarkBreakProb ){
771     FFq2q[i][1][0] = 2.0 ; FFq2q[i][1][1] = -a << 560    //... Diquark break
772     FFq2q[i][2][0] = 1.0 ; FFq2q[i][2][1] = -a << 
773     FFq2q[i][3][0] = 1.0 ; FFq2q[i][3][1] = -a << 
774     FFq2q[i][4][0] = 1.0 ; FFq2q[i][4][1] = -a << 
775   }                                            << 
776 }                                              << 
777                                                   561 
778 //-------------------------------------------- << 562       G4int stableQuarkEncoding = decay->GetPDGEncoding()/1000;
                                                   >> 563       G4int decayQuarkEncoding = (decay->GetPDGEncoding()/100)%10;
779                                                   564 
780 void G4QGSMFragmentation::SetFFq2qq()  // q->  << 565       if (G4UniformRand() < 0.5)
781 {                                              << 566          {
782   for (G4int i=0; i < 5; i++) {                << 567          G4int Swap = stableQuarkEncoding;
783     FFq2qq[i][ 0][0] = 0.0 ; FFq2qq[i][ 0][1]  << 568          stableQuarkEncoding = decayQuarkEncoding;
784     FFq2qq[i][ 1][0] = 0.0 ; FFq2qq[i][ 1][1]  << 569          decayQuarkEncoding = Swap;
785     FFq2qq[i][ 2][0] = 0.0 ; FFq2qq[i][ 2][1]  << 570          }
786     FFq2qq[i][ 3][0] = 0.0 ; FFq2qq[i][ 3][1]  << 
787     FFq2qq[i][ 4][0] = 0.0 ; FFq2qq[i][ 4][1]  << 
788     FFq2qq[i][ 5][0] = 0.0 ; FFq2qq[i][ 5][1]  << 
789     FFq2qq[i][ 6][0] = 0.0 ; FFq2qq[i][ 6][1]  << 
790     FFq2qq[i][ 7][0] = 0.0 ; FFq2qq[i][ 7][1]  << 
791     FFq2qq[i][ 8][0] = 0.0 ; FFq2qq[i][ 8][1]  << 
792     FFq2qq[i][ 9][0] = 0.0 ; FFq2qq[i][ 9][1]  << 
793     FFq2qq[i][10][0] = 0.0 ; FFq2qq[i][10][1]  << 
794     FFq2qq[i][11][0] = 0.0 ; FFq2qq[i][11][1]  << 
795     FFq2qq[i][12][0] = 0.0 ; FFq2qq[i][12][1]  << 
796     FFq2qq[i][13][0] = 0.0 ; FFq2qq[i][13][1]  << 
797     FFq2qq[i][14][0] = 0.0 ; FFq2qq[i][14][1]  << 
798   }                                            << 
799 }                                              << 
800                                                   571 
801 //-------------------------------------------- << 572       G4int IsParticle=(decayQuarkEncoding>0) ? -1 : +1;
                                                   >> 573                         // if we have a quark, we need antiquark)
802                                                   574 
803 void G4QGSMFragmentation::SetFFqq2q()  // q1q2 << 575       G4double StrSup=GetStrangeSuppress();  // for changing s-sbar production, Uzhi Oct. 2014
804 {                                              << 576       StrangeSuppress=0.41;                          // was 0.47
805   for (G4int i=0; i < 15; i++) {               << 577       pDefPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
806     FFqq2q[i][0][0] = 2.0*(arho - an); FFqq2q[ << 578       StrangeSuppress=StrSup;
807     FFqq2q[i][1][0] = 2.0*(arho - an); FFqq2q[ << 
808     FFqq2q[i][2][0] = 2.0*(arho - an); FFqq2q[ << 
809     FFqq2q[i][3][0] = 2.0*(arho - an); FFqq2q[ << 
810     FFqq2q[i][4][0] = 2.0*(arho - an); FFqq2q[ << 
811   }                                            << 
812 }                                              << 
813                                                   579 
814 //-------------------------------------------- << 580       //... Build new Diquark
                                                   >> 581       G4int QuarkEncoding=QuarkPair.second->GetPDGEncoding();
                                                   >> 582       G4int i10  = std::max(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
                                                   >> 583       G4int i20  = std::min(std::abs(QuarkEncoding), std::abs(stableQuarkEncoding));
                                                   >> 584       G4int spin = (i10 != i20 && G4UniformRand() <= 0.5)? 1 : 3;
                                                   >> 585       G4int NewDecayEncoding = -1*IsParticle*(i10 * 1000 + i20 * 100 + spin);
                                                   >> 586       created = FindParticle(NewDecayEncoding);
                                                   >> 587       G4ParticleDefinition * decayQuark=FindParticle(decayQuarkEncoding);
                                                   >> 588       G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decayQuark);
815                                                   589 
816 void G4QGSMFragmentation::SetFFqq2qq()  // q1( << 590       return had;
817 {                                              << 591 //      return hadronizer->Build(QuarkPair.first, decayQuark);
818   for (G4int i=0; i < 15; i++) {               << 592 
819     FFqq2qq[i][0][0] = 0.  ;  FFqq2qq[i][0][1] << 593    } else {
820     FFqq2qq[i][1][0] = 0.  ;  FFqq2qq[i][1][1] << 594    //... Diquark does not break
821     FFqq2qq[i][2][0] = 0.  ;  FFqq2qq[i][2][1] << 595 
822     FFqq2qq[i][3][0] = 0.  ;  FFqq2qq[i][3][1] << 596       G4int IsParticle=(decay->GetPDGEncoding()>0) ? +1 : -1;
823     FFqq2qq[i][4][0] = 0.  ;  FFqq2qq[i][4][1] << 597                         // if we have a diquark, we need quark)
824   }                                            << 598       G4double StrSup=GetStrangeSuppress();  // for changing s-sbar production, Uzhi Oct. 2014
                                                   >> 599       StrangeSuppress=0.41; //0.41; 0.47
                                                   >> 600       pDefPair QuarkPair = CreatePartonPair(IsParticle,false);  // no diquarks wanted
                                                   >> 601       StrangeSuppress=StrSup;
                                                   >> 602 
                                                   >> 603       created = QuarkPair.second;
                                                   >> 604 
                                                   >> 605       G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
                                                   >> 606       return had;
                                                   >> 607 //      return G4ParticleDefinition * had=hadronizer->Build(QuarkPair.first, decay);
                                                   >> 608    }
825 }                                                 609 }
                                                   >> 610 // Uzhi June 2014 End of the inserting
826                                                   611 
827                                                   612