Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/hadronic/models/parton_string/diffraction/src/G4FTFAnnihilation.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/diffraction/src/G4FTFAnnihilation.cc (Version 11.3.0) and /processes/hadronic/models/parton_string/diffraction/src/G4FTFAnnihilation.cc (Version 10.2.p1)


  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: G4FTFAnnihilation.cc 91914 2015-08-11 07:00:39Z gcosmo $
 27 //                                                 28 //
 28                                                    29 
 29 // -------------------------------------------     30 // ------------------------------------------------------------
 30 //      GEANT 4 class implemetation file           31 //      GEANT 4 class implemetation file
 31 //                                                 32 //
 32 //      ---------------- G4FTFAnnihilation ---     33 //      ---------------- G4FTFAnnihilation --------------
 33 //                by V. Uzhinsky, Spring 2011.     34 //                by V. Uzhinsky, Spring 2011.
 34 //                Take a projectile and a targ     35 //                Take a projectile and a target
 35 //        make annihilation or re-orangement o     36 //        make annihilation or re-orangement of quarks and anti-quarks.
 36 //     Ideas of Quark-Gluon-String model my A.     37 //     Ideas of Quark-Gluon-String model my A. Capella and A.B. Kaidalov
 37 //                       are implemented.          38 //                       are implemented.
 38 // -------------------------------------------     39 // ---------------------------------------------------------------------
 39                                                    40 
 40 #include "globals.hh"                              41 #include "globals.hh"
 41 #include "Randomize.hh"                            42 #include "Randomize.hh"
 42 #include "G4PhysicalConstants.hh"                  43 #include "G4PhysicalConstants.hh"
 43 #include "G4SystemOfUnits.hh"                      44 #include "G4SystemOfUnits.hh"
 44                                                    45 
 45 #include "G4DiffractiveSplitableHadron.hh"         46 #include "G4DiffractiveSplitableHadron.hh"
 46 #include "G4DiffractiveExcitation.hh"              47 #include "G4DiffractiveExcitation.hh"
 47 #include "G4FTFParameters.hh"                      48 #include "G4FTFParameters.hh"
 48 #include "G4ElasticHNScattering.hh"                49 #include "G4ElasticHNScattering.hh"
 49 #include "G4FTFAnnihilation.hh"                    50 #include "G4FTFAnnihilation.hh"
 50                                                    51 
 51 #include "G4LorentzRotation.hh"                    52 #include "G4LorentzRotation.hh"
 52 #include "G4RotationMatrix.hh"                     53 #include "G4RotationMatrix.hh"
 53 #include "G4ThreeVector.hh"                        54 #include "G4ThreeVector.hh"
 54 #include "G4ParticleDefinition.hh"                 55 #include "G4ParticleDefinition.hh" 
 55 #include "G4VSplitableHadron.hh"                   56 #include "G4VSplitableHadron.hh"
 56 #include "G4ExcitedString.hh"                      57 #include "G4ExcitedString.hh"
 57 #include "G4ParticleTable.hh"                      58 #include "G4ParticleTable.hh"
 58 #include "G4Neutron.hh"                            59 #include "G4Neutron.hh"
 59 #include "G4ParticleDefinition.hh"                 60 #include "G4ParticleDefinition.hh"
 60                                                    61 
 61 #include "G4Exp.hh"                                62 #include "G4Exp.hh"
 62 #include "G4Log.hh"                                63 #include "G4Log.hh"
 63 #include "G4Pow.hh"                                64 #include "G4Pow.hh"
 64                                                    65 
                                                   >>  66 //#include "G4ios.hh"
 65 //#include "UZHI_diffraction.hh"                   67 //#include "UZHI_diffraction.hh"
 66                                                    68 
 67 #include "G4ParticleTable.hh"                  << 
 68                                                    69 
 69 //============================================     70 //============================================================================
 70                                                    71 
 71 //#define debugFTFannih                        <<  72 //define debugFTFannih
 72                                                    73 
 73                                                    74 
 74 //============================================     75 //============================================================================
 75                                                    76 
 76 G4FTFAnnihilation::G4FTFAnnihilation() {}          77 G4FTFAnnihilation::G4FTFAnnihilation() {}
 77                                                    78 
 78                                                    79 
 79 //============================================     80 //============================================================================
 80                                                    81 
 81 G4FTFAnnihilation::~G4FTFAnnihilation() {}         82 G4FTFAnnihilation::~G4FTFAnnihilation() {}
 82                                                    83 
 83                                                    84 
 84 //============================================     85 //============================================================================
 85                                                    86 
 86 G4bool G4FTFAnnihilation::Annihilate( G4VSplit     87 G4bool G4FTFAnnihilation::Annihilate( G4VSplitableHadron* projectile, 
 87                                       G4VSplit     88                                       G4VSplitableHadron* target,
 88                                       G4VSplit     89                                       G4VSplitableHadron*& AdditionalString,
 89                                       G4FTFPar     90                                       G4FTFParameters* theParameters ) const  {
 90                                                    91 
 91   #ifdef debugFTFannih                             92   #ifdef debugFTFannih 
 92   G4cout << "---------------------------- Anni     93   G4cout << "---------------------------- Annihilation----------------" << G4endl;
 93   #endif                                           94   #endif
 94                                                    95 
 95   CommonVariables common;                      << 
 96                                                << 
 97   // Projectile parameters                         96   // Projectile parameters
 98   common.Pprojectile = projectile->Get4Momentu <<  97   G4LorentzVector Pprojectile = projectile->Get4Momentum();
 99   G4int ProjectilePDGcode = projectile->GetDef     98   G4int ProjectilePDGcode = projectile->GetDefinition()->GetPDGEncoding();
100   if ( ProjectilePDGcode > 0 ) {                   99   if ( ProjectilePDGcode > 0 ) {
101     target->SetStatus( 3 );                    << 100     target->SetStatus( 3 );                                      // 2->3   Uzhi Oct 2014
102     return false;                                 101     return false;
103   }                                               102   } 
104   G4double M0projectile2 = common.Pprojectile. << 103   //G4double M0projectile = Pprojectile.mag();  
                                                   >> 104   //G4double M0projectile2 = projectile->GetDefinition()->GetPDGMass() *
                                                   >> 105   //                         projectile->GetDefinition()->GetPDGMass(); 
                                                   >> 106   G4double M0projectile2 = Pprojectile.mag2();
105                                                   107 
106   // Target parameters                            108   // Target parameters
107   G4int TargetPDGcode = target->GetDefinition(    109   G4int TargetPDGcode = target->GetDefinition()->GetPDGEncoding();
108   common.Ptarget = target->Get4Momentum();     << 110   G4LorentzVector Ptarget = target->Get4Momentum();
109   G4double M0target2 = common.Ptarget.mag2();  << 111   //G4double M0target = Ptarget.mag();
                                                   >> 112   //G4double M0target2 = target->GetDefinition()->GetPDGMass() *
                                                   >> 113   //                     target->GetDefinition()->GetPDGMass();
                                                   >> 114   G4double M0target2 = Ptarget.mag2();
110                                                   115 
111   #ifdef debugFTFannih                            116   #ifdef debugFTFannih
112   G4cout << "PDG codes " << ProjectilePDGcode     117   G4cout << "PDG codes " << ProjectilePDGcode << " " << TargetPDGcode << G4endl
113          << "Pprojec " << common.Pprojectile < << 118          << "Pprojec " << Pprojectile << " " << Pprojectile.mag() << G4endl
114          << "Ptarget " << common.Ptarget    << << 119          << "Ptarget " << Ptarget    << " " << Ptarget.mag() << G4endl
115          << "M0 proj target " << std::sqrt( M0    120          << "M0 proj target " << std::sqrt( M0projectile2 ) 
116          << " " << std::sqrt( M0target2 ) << G    121          << " " << std::sqrt( M0target2 ) << G4endl;
117   #endif                                          122   #endif
118                                                   123 
                                                   >> 124   G4double AveragePt2 = theParameters->GetAveragePt2();
                                                   >> 125 
119   // Kinematical properties of the interaction    126   // Kinematical properties of the interactions
120   G4LorentzVector Psum = common.Pprojectile +  << 127   G4LorentzVector Psum;  // 4-momentum in CMS
121   common.S = Psum.mag2();                      << 128   Psum = Pprojectile + Ptarget;
122   common.SqrtS = std::sqrt( common.S );        << 129   G4double S = Psum.mag2(); 
                                                   >> 130 
123   #ifdef debugFTFannih                            131   #ifdef debugFTFannih
124   G4cout << "Psum SqrtS S " << Psum << " " <<  << 132   G4cout << "Psum SqrtS S " << Psum << " " << std::sqrt( S ) << " " << S << G4endl;
125   #endif                                          133   #endif
126                                                   134 
127   // Transform momenta to cms and then rotate     135   // Transform momenta to cms and then rotate parallel to z axis
128   G4LorentzRotation toCms( -1*Psum.boostVector    136   G4LorentzRotation toCms( -1*Psum.boostVector() );
129   G4LorentzVector Ptmp( toCms*common.Pprojecti << 137   G4LorentzVector Ptmp = toCms*Pprojectile;
130   toCms.rotateZ( -1*Ptmp.phi() );                 138   toCms.rotateZ( -1*Ptmp.phi() );
131   toCms.rotateY( -1*Ptmp.theta() );               139   toCms.rotateY( -1*Ptmp.theta() );
132   common.toLab = toCms.inverse();              << 140   G4LorentzRotation toLab( toCms.inverse() );
133                                                << 
134   if ( G4UniformRand() <= G4Pow::GetInstance() << 
135     common.RotateStrings = true;               << 
136     common.RandomRotation.rotateZ( 2.0*pi*G4Un << 
137     common.RandomRotation.rotateY( std::acos(  << 
138     common.RandomRotation.rotateZ( 2.0*pi*G4Un << 
139   }                                            << 
140                                                   141 
                                                   >> 142   G4double SqrtS = std::sqrt( S );
                                                   >> 143   G4double maxPtSquare;
                                                   >> 144   G4double X_a( 0.0 ), X_b( 0.0 ), X_c( 0.0 ), X_d( 0.0 );
141   G4double MesonProdThreshold = projectile->Ge    145   G4double MesonProdThreshold = projectile->GetDefinition()->GetPDGMass() +
142                                 target->GetDef    146                                 target->GetDefinition()->GetPDGMass() +
143                                 ( 2.0*140.0 +     147                                 ( 2.0*140.0 + 16.0 )*MeV;  // 2 Mpi + DeltaE
144   G4double Prel2 = sqr(common.S) + sqr(M0proje << 148   G4double Prel2 = S*S + M0projectile2*M0projectile2 + M0target2*M0target2 -
145                    - 2.0*( common.S*(M0project << 149                    2.0*S*M0projectile2 - 2.0*S*M0target2 - 2.0*M0projectile2*M0target2;
146   Prel2 /= common.S;                           << 150   Prel2 /= S;
147   G4double X_a = 0.0, X_b = 0.0, X_c = 0.0, X_ << 151   //G4cout << "Prel2 " << Prel2 << G4endl;
148   if ( Prel2 <= 0.0 ) {                        << 152   if ( Prel2 <= 0.0 ) {  // *MeV*MeV 1600.
149     // Annihilation at rest! Values are copied    153     // Annihilation at rest! Values are copied from Parameters
150     X_a = 625.1;    // mb  // 3-shirt diagram  << 154     X_a =  625.1;    // mb  // 3-shirt diagram
151     X_b =   0.0;    // mb  // anti-quark-quark << 155     X_b =    0.0;    // 9.780 12 Dec. 2012;  // mb  // anti-quark-quark annihilation
152     X_c =  49.989;  // mb  // 2 Q-Qbar string  << 156     X_c =   49.989;  // mb
153     X_d =   6.614;  // mb  // One Q-Qbar strin << 157     X_d =    6.614;  // mb
                                                   >> 158 
154     #ifdef debugFTFannih                          159     #ifdef debugFTFannih 
155     G4cout << "Annih at Rest X a b c d " << X_    160     G4cout << "Annih at Rest X a b c d " << X_a << " " << X_b << " " << X_c << " " << X_d 
156            << G4endl;                             161            << G4endl;
157     #endif                                        162     #endif
                                                   >> 163 
158   } else { // Annihilation in flight!             164   } else { // Annihilation in flight!
159     G4double FlowF = 1.0 / std::sqrt( Prel2 )*    165     G4double FlowF = 1.0 / std::sqrt( Prel2 )*GeV;
                                                   >> 166 
160     // Process cross sections                     167     // Process cross sections
161     X_a = 25.0*FlowF;  // mb 3-shirt diagram      168     X_a = 25.0*FlowF;  // mb 3-shirt diagram
162     if ( common.SqrtS < MesonProdThreshold ) { << 169     if ( SqrtS < MesonProdThreshold ) {
163       X_b = 3.13 + 140.0*G4Pow::GetInstance()- << 170       X_b = 3.13 + 140.0*G4Pow::GetInstance()->powA( ( MesonProdThreshold - SqrtS )/GeV, 2.5 ); 
164     } else {                                      171     } else {
165       X_b = 6.8*GeV / common.SqrtS;  // mb ant << 172       X_b = 6.8*GeV / SqrtS;  // mb anti-quark-quark annihilation
166     }                                             173     }
167     if ( projectile->GetDefinition()->GetPDGMa    174     if ( projectile->GetDefinition()->GetPDGMass() + target->GetDefinition()->GetPDGMass()
168          > common.SqrtS ) {                    << 175          > SqrtS ) {
169       X_b = 0.0;                                  176       X_b = 0.0;
170     }                                             177     }
171     // This can be in an interaction of low en    178     // This can be in an interaction of low energy anti-baryon with off-shell nuclear nucleon
172     X_c = 2.0 * FlowF * sqr( projectile->GetDe    179     X_c = 2.0 * FlowF * sqr( projectile->GetDefinition()->GetPDGMass() +
173                              target->GetDefini << 180                              target->GetDefinition()->GetPDGMass() ) / S; // mb re-arrangement of
174                                                << 181                                                                           // 2 quarks and 2 anti-quarks
175     X_d = 23.3*GeV*GeV / common.S; // mb anti- << 182     X_d = 23.3*GeV*GeV / S; // mb anti-quark-quark string creation
                                                   >> 183 
176     #ifdef debugFTFannih                          184     #ifdef debugFTFannih 
177     G4cout << "Annih in Flight X a b c d " <<     185     G4cout << "Annih in Flight X a b c d " << X_a << " " << X_b << " " << X_c << " " << X_d
178            << G4endl << "SqrtS MesonProdThresh << 186            << G4endl << "SqrtS MesonProdThreshold " << SqrtS << " " << MesonProdThreshold
179            << G4endl;                             187            << G4endl;
180     #endif                                        188     #endif
                                                   >> 189 
181   }                                               190   } 
182                                                   191 
183   G4bool isUnknown = false;                    << 192   if        ((ProjectilePDGcode == -2212 || ProjectilePDGcode == -2214)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) { 
184   if ( TargetPDGcode == 2212  ||  TargetPDGcod << 193     X_b *= 5.0; X_c *= 5.0; X_d *= 6.0;  // Pbar P
185     if        ( ProjectilePDGcode == -2212  || << 194   } else if ((ProjectilePDGcode == -2212 || ProjectilePDGcode == -2214)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
186       X_b *= 5.0; X_c *= 5.0; X_d *= 6.0;  //  << 195     X_b *= 4.0; X_c *= 4.0; X_d *= 4.0;  // Pbar N
187     } else if ( ProjectilePDGcode == -2112  || << 196   } else if ((ProjectilePDGcode == -2112 || ProjectilePDGcode == -2114)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
188       X_b *= 4.0; X_c *= 4.0; X_d *= 4.0;  //  << 197     X_b *= 4.0; X_c *= 4.0; X_d *= 4.0;  // NeutrBar P
189     } else if ( ProjectilePDGcode == -3122 ) { << 198   } else if ((ProjectilePDGcode == -2112 || ProjectilePDGcode == -2114)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
190       X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  //  << 199     X_b *= 5.0; X_c *= 5.0; X_d *= 6.0;  // NeutrBar N
191     } else if ( ProjectilePDGcode == -3112 ) { << 200   } else if ((ProjectilePDGcode == -3122 || ProjectilePDGcode == -3124)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
192       X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  //  << 201     X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  // LambdaBar P
193     } else if ( ProjectilePDGcode == -3212 ) { << 202   } else if ((ProjectilePDGcode == -3122 || ProjectilePDGcode == -3124)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
194       X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  //  << 203     X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  // LambdaBar N
195     } else if ( ProjectilePDGcode == -3222 ) { << 204   } else if ((ProjectilePDGcode == -3112 || ProjectilePDGcode == -3114)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
196       X_b *= 4.0; X_c *= 4.0; X_d *= 2.0;  //  << 205     X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  // Sigma-Bar P
197     } else if ( ProjectilePDGcode == -3312 ) { << 206   } else if ((ProjectilePDGcode == -3112 || ProjectilePDGcode == -3114)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
198       X_b *= 1.0; X_c *= 1.0; X_d *= 0.0;  //  << 207     X_b *= 4.0; X_c *= 4.0; X_d *= 2.0;  // Sigma-Bar N
199     } else if ( ProjectilePDGcode == -3322 ) { << 208   } else if ((ProjectilePDGcode == -3212 || ProjectilePDGcode == -3214)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
200       X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  //  << 209     X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  // Sigma0Bar P
201     } else if ( ProjectilePDGcode == -3334 ) { << 210   } else if ((ProjectilePDGcode == -3212 || ProjectilePDGcode == -3214)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
202       X_b *= 0.0; X_c *= 0.0; X_d *= 0.0;  //  << 211     X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  // Sigma0Bar N
203     } else {                                   << 212   } else if ((ProjectilePDGcode == -3222 || ProjectilePDGcode == -3224)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
204       isUnknown = true;                        << 213     X_b *= 4.0; X_c *= 4.0; X_d *= 2.0;  // Sigma+Bar P
205     }                                          << 214   } else if ((ProjectilePDGcode == -3222 || ProjectilePDGcode == -3224)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
206   } else if ( TargetPDGcode == 2112  ||  Targe << 215     X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  // Sigma+Bar N
207     if        ( ProjectilePDGcode == -2212  || << 216   } else if ((ProjectilePDGcode == -3312 || ProjectilePDGcode == -3314)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
208       X_b *= 4.0; X_c *= 4.0; X_d *= 4.0;  //  << 217     X_b *= 1.0; X_c *= 1.0; X_d *= 0.0;  // Xi-Bar P
209     } else if ( ProjectilePDGcode == -2112  || << 218   } else if ((ProjectilePDGcode == -3312 || ProjectilePDGcode == -3314)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
210       X_b *= 5.0; X_c *= 5.0; X_d *= 6.0;  //  << 219     X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  // Xi-Bar N
211     } else if ( ProjectilePDGcode == -3122 ) { << 220   } else if ((ProjectilePDGcode == -3322 || ProjectilePDGcode == -3324)&& ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
212       X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  //  << 221     X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  // Xi0Bar P
213     } else if ( ProjectilePDGcode == -3112 ) { << 222   } else if ((ProjectilePDGcode == -3322 || ProjectilePDGcode == -3324)&& ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
214       X_b *= 4.0; X_c *= 4.0; X_d *= 2.0;  //  << 223     X_b *= 1.0; X_c *= 1.0; X_d *= 0.0;  // Xi0Bar N
215     } else if ( ProjectilePDGcode == -3212 ) { << 224   } else if ( ProjectilePDGcode == -3334 && ( TargetPDGcode == 2212 || TargetPDGcode == 2214 ) ) {
216       X_b *= 3.0; X_c *= 3.0; X_d *= 2.0;  //  << 225     X_b *= 0.0; X_c *= 0.0; X_d *= 0.0;  // Omega-Bar P
217     } else if ( ProjectilePDGcode == -3222 ) { << 226   } else if ( ProjectilePDGcode == -3334 && ( TargetPDGcode == 2112 || TargetPDGcode == 2114 ) ) {
218       X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  //  << 227     X_b *= 0.0; X_c *= 0.0; X_d *= 0.0;  // Omega-Bar N
219     } else if ( ProjectilePDGcode == -3312 ) { << 
220       X_b *= 2.0; X_c *= 2.0; X_d *= 0.0;  //  << 
221     } else if ( ProjectilePDGcode == -3322 ) { << 
222       X_b *= 1.0; X_c *= 1.0; X_d *= 0.0;  //  << 
223     } else if ( ProjectilePDGcode == -3334 ) { << 
224       X_b *= 0.0; X_c *= 0.0; X_d *= 0.0;  //  << 
225     } else {                                   << 
226       isUnknown = true;                        << 
227     }                                          << 
228   } else {                                        228   } else {
229     isUnknown = true;                          << 
230   }                                            << 
231   if ( isUnknown ) {                           << 
232     G4cout << "Unknown anti-baryon for FTF ann    229     G4cout << "Unknown anti-baryon for FTF annihilation: PDGcodes - "
233            << ProjectilePDGcode << " " << Targ    230            << ProjectilePDGcode << " " << TargetPDGcode << G4endl;
234   }                                               231   }
235                                                   232 
236   #ifdef debugFTFannih                            233   #ifdef debugFTFannih 
237   G4cout << "Annih Actual X a b c d " << X_a <    234   G4cout << "Annih Actual X a b c d " << X_a << " " << X_b << " " << X_c << " " << X_d << G4endl;
238   #endif                                          235   #endif
239                                                   236 
240   G4double Xannihilation = X_a + X_b + X_c + X    237   G4double Xannihilation = X_a + X_b + X_c + X_d;
241                                                   238 
242   // Projectile unpacking                         239   // Projectile unpacking
243   UnpackBaryon( ProjectilePDGcode, common.AQ[0 << 240   G4int AQ[3];
                                                   >> 241   UnpackBaryon( ProjectilePDGcode, AQ[0], AQ[1], AQ[2] );
244                                                   242 
245   // Target unpacking                             243   // Target unpacking
246   UnpackBaryon( TargetPDGcode, common.Q[0], co << 244   G4int Q[3];
                                                   >> 245   UnpackBaryon( TargetPDGcode, Q[0], Q[1], Q[2] ); 
247                                                   246 
248   G4double Ksi = G4UniformRand();                 247   G4double Ksi = G4UniformRand();
249                                                   248 
250   if ( Ksi < X_a / Xannihilation ) {              249   if ( Ksi < X_a / Xannihilation ) {
251     return Create3QuarkAntiQuarkStrings( proje << 
252   }                                            << 
253                                                << 
254   G4int resultCode = 99;                       << 
255   if ( Ksi < (X_a + X_b) / Xannihilation ) {   << 
256     resultCode = Create1DiquarkAntiDiquarkStri << 
257     if ( resultCode == 0 ) {                   << 
258       return true;                             << 
259     } else if ( resultCode == 99 ) {           << 
260       return false;                            << 
261     }                                          << 
262   }                                            << 
263                                                << 
264   if ( Ksi < ( X_a + X_b + X_c ) / Xannihilati << 
265     resultCode = Create2QuarkAntiQuarkStrings( << 
266     if ( resultCode == 0 ) {                   << 
267       return true;                             << 
268     } else if ( resultCode == 99 ) {           << 
269       return false;                            << 
270     }                                          << 
271   }                                            << 
272                                                << 
273   if ( Ksi < ( X_a + X_b + X_c + X_d ) / Xanni << 
274     return Create1QuarkAntiQuarkString( projec << 
275   }                                            << 
276                                                << 
277   return true;                                 << 
278 }                                              << 
279                                                << 
280                                                << 
281 //-------------------------------------------- << 
282                                                << 
283 G4bool G4FTFAnnihilation::                     << 
284 Create3QuarkAntiQuarkStrings( G4VSplitableHadr << 
285                               G4VSplitableHadr << 
286                               G4VSplitableHadr << 
287                               G4FTFParameters* << 
288                               G4FTFAnnihilatio << 
289   // Simulation of 3 anti-quark - quark string << 
290                                                << 
291   #ifdef debugFTFannih                         << 
292   G4cout << "Process a, 3 shirt diagram" << G4 << 
293   #endif                                       << 
294                                                   250 
295   // Sampling kinematical properties of quark. << 251     // Simulation of 3 anti-quark-quark strings creation
                                                   >> 252     //    Sampling of anti-quark order in projectile
296                                                   253 
297   const G4int maxNumberOfLoops = 1000;         << 254     #ifdef debugFTFannih 
298   G4double MassQ2 = 0.0;               // Simp << 255     G4cout << "Process a, 3 shirt diagram" << G4endl;
299                                        // In p << 256     #endif
300   G4double      Quark_Xs[6];                   << 
301   G4ThreeVector Quark_Mom[6];                  << 
302                                                << 
303   G4double Alfa_R = 0.5;                       << 
304   G4double AveragePt2 = 200.0*200.0, maxPtSqua << 
305   G4double ScaleFactor = 1.0;                  << 
306   G4double Alfa = 0.0, Beta = 0.0;             << 
307                                                << 
308   G4int NumberOfTries = 0, loopCounter = 0;    << 
309                                                << 
310   do {                                         << 
311     // Sampling X's of anti-baryon and baryon  << 
312     G4double x1 = 0.0, x2 = 0.0, x3 = 0.0;     << 
313     G4double Product = 1.0;                    << 
314     for ( G4int iCase = 0; iCase < 2; ++iCase  << 
315                                                   257 
316       G4double r1 = G4UniformRand(), r2 = G4Un << 258     G4int SampledCase = G4RandFlat::shootInt( G4long( 6 ) );
317       if ( Alfa_R == 1.0 ) {                   << 
318         x1 = 1.0 - std::sqrt( r1 );            << 
319         x2 = (1.0 - x1) * r2;                  << 
320       } else {                                 << 
321         x1 = sqr( r1 );                        << 
322         x2 = (1.0 - x1) * sqr( std::sin( pi/2. << 
323       }                                        << 
324       x3 = 1.0 - x1 - x2;                      << 
325                                                   259 
326       G4int index = iCase*3;  // 0 for anti-ba << 260     G4int Tmp1( 0 ), Tmp2( 0 );
327       Quark_Xs[index] = x1; Quark_Xs[index+1]  << 261     if ( SampledCase == 0 ) {                                    
328       Product *= (x1*x2*x3);                   << 262     } else if ( SampledCase == 1 ) { 
329     }                                          << 263       Tmp1 = AQ[1]; AQ[1] = AQ[2]; AQ[2] = Tmp1;
                                                   >> 264     } else if ( SampledCase == 2 ) { 
                                                   >> 265       Tmp1 = AQ[0]; AQ[0] = AQ[1]; AQ[1] = Tmp1; 
                                                   >> 266     } else if ( SampledCase == 3 ) { 
                                                   >> 267       Tmp1 = AQ[0]; Tmp2 = AQ[1];  AQ[0] = AQ[2]; AQ[1] = Tmp1;  AQ[2] = Tmp2;
                                                   >> 268     } else if ( SampledCase == 4 ) { 
                                                   >> 269       Tmp1 = AQ[0]; Tmp2 = AQ[1];  AQ[0] = Tmp2;  AQ[1] = AQ[2]; AQ[2] = Tmp1; 
                                                   >> 270     } else if ( SampledCase == 5 ) { 
                                                   >> 271       Tmp1 = AQ[0]; Tmp2 = AQ[1];  AQ[0] = AQ[2]; AQ[1] = Tmp2;  AQ[2] = Tmp1;
                                                   >> 272     }  
330                                                   273 
331     if ( Product == 0.0 ) continue;            << 274     //  Set the string properties
332                                                   275 
333     ++NumberOfTries;                           << 276     //G4cout << "String 1 " << AQ[0] << " " << Q[0] << G4endl;
334     if ( NumberOfTries == 100*(NumberOfTries/1 << 277     projectile->SplitUp();
335       // After a large number of tries, it is  << 278     projectile->SetFirstParton( AQ[0] );
336       ScaleFactor /= 2.0;                      << 279     projectile->SetSecondParton( Q[0] );
337       AveragePt2 *= ScaleFactor;               << 280     projectile->SetStatus( 0 );
338     }                                          << 
339                                                   281 
340     G4ThreeVector PtSum( 0.0, 0.0, 0.0 );      << 282     //G4cout << "String 2 " << Q[1] << " " << AQ[1] << G4endl;
341     for ( G4int i = 0; i < 6; ++i ) {          << 283     target->SplitUp();
342       Quark_Mom [i] = GaussianPt( AveragePt2,  << 284     target->SetFirstParton( Q[1] );
343       PtSum += Quark_Mom[i];                   << 285     target->SetSecondParton( AQ[1] );
                                                   >> 286     target->SetStatus( 0 );
                                                   >> 287 
                                                   >> 288     //G4cout << "String 3 " << AQ[2] << " " << Q[2] << G4endl;
                                                   >> 289     AdditionalString = new G4DiffractiveSplitableHadron();
                                                   >> 290     AdditionalString->SplitUp();
                                                   >> 291     AdditionalString->SetFirstParton( AQ[2] );
                                                   >> 292     AdditionalString->SetSecondParton( Q[2] );
                                                   >> 293     AdditionalString->SetStatus( 0 );
                                                   >> 294     //G4cout << G4endl << "*AdditionalString in Annih" << AdditionalString << G4endl;
                                                   >> 295 
                                                   >> 296     // Sampling kinematical properties
                                                   >> 297     // 1 string AQ[0]-Q[0]// 2 string AQ[1]-Q[1]// 3 string AQ[2]-Q[2]
                                                   >> 298 
                                                   >> 299     G4ThreeVector Quark_Mom[6];
                                                   >> 300     G4double ModMom2[6];  //ModMom[6]
                                                   >> 301 
                                                   >> 302     AveragePt2 = 200.0*200.0; maxPtSquare = S;
                                                   >> 303 
                                                   >> 304     G4double SumMt( 0.0 );
                                                   >> 305     G4double MassQ2 = 0.0;  // 100.0*100.0*MeV*MeV;
                                                   >> 306     G4int NumberOfTries( 0 );
                                                   >> 307     G4double ScaleFactor( 1.0 );
                                                   >> 308 
                                                   >> 309     const G4int maxNumberOfLoops = 1000;
                                                   >> 310     G4int loopCounter = 0;
                                                   >> 311     do {
                                                   >> 312       NumberOfTries++;
                                                   >> 313       if ( NumberOfTries == 100*(NumberOfTries/100) ) {
                                                   >> 314         // At large number of tries it would be better to reduce the values of <Pt^2>
                                                   >> 315         ScaleFactor /= 2.0;
                                                   >> 316         AveragePt2 *= ScaleFactor;
                                                   >> 317       }
                                                   >> 318       G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
                                                   >> 319       for ( G4int i = 0; i < 6; i++ ) {
                                                   >> 320         Quark_Mom [i] = GaussianPt( AveragePt2, maxPtSquare );
                                                   >> 321         PtSum += Quark_Mom[i];
                                                   >> 322       }
                                                   >> 323       PtSum /= 6.0;
                                                   >> 324       SumMt = 0.0;    
                                                   >> 325       for( G4int i = 0; i < 6; i++ ) {
                                                   >> 326         Quark_Mom[i] -= PtSum;
                                                   >> 327         //ModMom[i] = Quark_Mom[i].mag();
                                                   >> 328         ModMom2[i] = Quark_Mom[i].mag2();
                                                   >> 329         SumMt += std::sqrt( ModMom2[i] + MassQ2 );
                                                   >> 330       }
                                                   >> 331     } while ( ( SumMt > SqrtS ) && 
                                                   >> 332               ++loopCounter < maxNumberOfLoops );  /* Loop checking, 10.08.2015, A.Ribon */
                                                   >> 333     if ( loopCounter >= maxNumberOfLoops ) {
                                                   >> 334       return false;
344     }                                             335     }
345                                                   336 
346     PtSum /= 6.0;                              << 337     G4double WminusTarget( 0.0 ), WplusProjectile( 0.0 );
347     Alfa = 0.0; Beta = 0.0;                    << 
348                                                   338 
349     for ( G4int i = 0; i < 6; ++i ) {  // Loop << 339     // Closed is variant with sampling of Xs at minimum
350       Quark_Mom[i] -= PtSum;                   << 340     //G4double SumMod_anti = ModMom[0] + ModMom[1] + ModMom[2];
351                                                << 341     //Quark_Mom[0].setZ( ModMom[0]/SumMod_anti );
352       G4double val = ( Quark_Mom[i].mag2() + M << 342     //Quark_Mom[1].setZ( ModMom[1]/SumMod_anti );
353       if ( i < 3 ) {  // anti-baryon           << 343     //Quark_Mom[2].setZ( ModMom[2]/SumMod_anti );
354         Alfa += val;                           << 344     //G4double SumMod_bary = ModMom[3] + ModMom[4] + ModMom[5];
355       } else {        // baryon (iCase == 1)   << 345     //Quark_Mom[3].setZ( ModMom[3]/SumMod_bary );
356         Beta += val;                           << 346     //Quark_Mom[4].setZ( ModMom[4]/SumMod_bary );
                                                   >> 347     //Quark_Mom[5].setZ( ModMom[5]/SumMod_bary );
                                                   >> 348     //G4double Alfa = SumMod_anti*SumMod_anti;
                                                   >> 349     //G4double Beta = SumMod_bary*SumMod_bary;
                                                   >> 350     //G4double DecayMomentum2 = S*S + Alfa*Alfa + Beta*Beta
                                                   >> 351     //                          - 2.0*S*Alfa - 2.0*S*Beta - 2.0*Alfa*Beta;  
                                                   >> 352     //WminusTarget = ( S - Alfa + Beta + std::sqrt( DecayMomentum2 ) )/2.0/SqrtS; 
                                                   >> 353     //WplusProjectile = SqrtS - Beta/WminusTarget;
                                                   >> 354     // Closed is variant with sampling of Xs at minimum
                                                   >> 355 
                                                   >> 356     // Sampling X's of anti-baryon
                                                   >> 357     G4double Alfa_R = 0.5;
                                                   >> 358     NumberOfTries = 0;
                                                   >> 359     ScaleFactor = 1.0;
                                                   >> 360     G4bool Succes( true );
                                                   >> 361 
                                                   >> 362     loopCounter = 0;
                                                   >> 363     do {
                                                   >> 364 
                                                   >> 365       Succes = true;
                                                   >> 366       NumberOfTries++;
                                                   >> 367       if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
                                                   >> 368         // At large number of tries it would be better to reduce the values of Pt's
                                                   >> 369         ScaleFactor /= 2.0;
357       }                                           370       }
358     }                                          << 
359                                                << 
360   } while ( ( std::sqrt( Alfa ) + std::sqrt( B << 
361             ++loopCounter < maxNumberOfLoops ) << 
362                                                   371 
363   if ( loopCounter >= maxNumberOfLoops ) {     << 372       if ( Alfa_R == 1.0 ) {
364     return false;                              << 373         G4double Xaq1 = 1.0 - std::sqrt( G4UniformRand() );
365   }                                            << 374         G4double Xaq2 = (1.0 - Xaq1) * G4UniformRand();
366                                                << 375         G4double Xaq3 = 1.0 - Xaq1 - Xaq2;
367   G4double DecayMomentum2 = sqr(common.S) + sq << 376         Quark_Mom[0].setZ( Xaq1 ); Quark_Mom[1].setZ( Xaq2 ); Quark_Mom[2].setZ( Xaq3 );
368                             - 2.0*( common.S*( << 
369                                                << 
370   G4double WminusTarget = 0.0, WplusProjectile << 
371   WminusTarget = ( common.S - Alfa + Beta + st << 
372   WplusProjectile = common.SqrtS - Beta/Wminus << 
373                                                << 
374   for ( G4int iCase = 0; iCase < 2; ++iCase )  << 
375     G4int index = iCase*3;                 //  << 
376     G4double w = WplusProjectile;          //  << 
377     if ( iCase == 1 ) w = - WminusTarget;  //  << 
378     for ( G4int i = 0; i < 3; ++i ) {          << 
379       G4double Pz = w * Quark_Xs[index+i] / 2. << 
380                     ( Quark_Mom[index+i].mag2( << 
381                     ( 2.0 * w * Quark_Xs[index << 
382       Quark_Mom[index+i].setZ( Pz );           << 
383     }                                          << 
384   }                                            << 
385                                                << 
386   // Sampling of anti-quark order in projectil << 
387   G4int SampledCase = (G4int)G4RandFlat::shoot << 
388   G4int Tmp1 = 0, Tmp2 = 0;                    << 
389   switch ( SampledCase ) {                     << 
390     case 1 : Tmp1 = common.AQ[1]; common.AQ[1] << 
391     case 2 : Tmp1 = common.AQ[0]; common.AQ[0] << 
392     case 3 : Tmp1 = common.AQ[0]; Tmp2         << 
393              common.AQ[1] = Tmp1;         comm << 
394     case 4 : Tmp1 = common.AQ[0]; Tmp2         << 
395              common.AQ[1] = common.AQ[2]; comm << 
396     case 5 : Tmp1 = common.AQ[0]; Tmp2         << 
397              common.AQ[1] = Tmp2;         comm << 
398   }                                            << 
399                                                << 
400   // Set the string properties                 << 
401   // An anti quark - quark pair can have the q << 
402   // or a vector meson: the last digit of the  << 
403   // For simplicity only scalar is considered  << 
404   G4int NewCode = 0, antiQuark = 0, quark = 0; << 
405   G4ParticleDefinition* TestParticle = nullptr << 
406   for ( G4int iString = 0; iString < 3; ++iStr << 
407     if ( iString == 0 ) {                      << 
408       antiQuark = common.AQ[0];  quark = commo << 
409       projectile->SetFirstParton( antiQuark ); << 
410       projectile->SetSecondParton( quark );    << 
411       projectile->SetStatus( 0 );              << 
412     } else if ( iString == 1 ) {               << 
413       quark = common.Q[1];  antiQuark = common << 
414       target->SetFirstParton( quark );         << 
415       target->SetSecondParton( antiQuark );    << 
416       target->SetStatus( 0 );                  << 
417     } else {  // iString == 2                  << 
418       antiQuark = common.AQ[2]; quark =  commo << 
419     }                                          << 
420     G4int absAntiQuark = std::abs( antiQuark ) << 
421     G4double aKsi = G4UniformRand();           << 
422     if ( absAntiQuark == absQuark ) {          << 
423       if ( absAntiQuark != 3 ) {  // Not yet c << 
424         NewCode = 111;            // Pi0-meson << 
425         if ( aKsi < 0.5 ) {                    << 
426           NewCode = 221;          // Eta -meso << 
427           if ( aKsi < 0.25 ) {                 << 
428             NewCode = 331;        // Eta'-meso << 
429           }                                    << 
430         }                                      << 
431       } else {                                 << 
432         NewCode = 221;            // Eta -meso << 
433         if ( aKsi < 0.5 ) {                    << 
434           NewCode = 331;          // Eta'-meso << 
435         }                                      << 
436       }                                        << 
437     } else {  // Vector mesons - rho, omega, p << 
438       if ( absAntiQuark > absQuark ) {         << 
439         NewCode = absAntiQuark*100 + absQuark* << 
440       } else {                                    377       } else {
441         NewCode = absQuark*100 + absAntiQuark* << 378         G4double Xaq1 = sqr( G4UniformRand() );
                                                   >> 379         G4double Xaq2 = (1.0 - Xaq1)*sqr( std::sin( pi/2.0*G4UniformRand() ) );
                                                   >> 380         G4double Xaq3 = 1.0 - Xaq1 - Xaq2;
                                                   >> 381         Quark_Mom[0].setZ( Xaq1 ); Quark_Mom[1].setZ( Xaq2 ); Quark_Mom[2].setZ( Xaq3 );
442       }                                           382       }
443     }                                          << 
444     if ( iString == 2 ) AdditionalString = new << 
445     TestParticle = G4ParticleTable::GetParticl << 
446     if ( ! TestParticle ) return false;        << 
447     if ( iString == 0 ) {                      << 
448       projectile->SetDefinition( TestParticle  << 
449       theParameters->SetProjMinDiffMass( 0.5 ) << 
450       theParameters->SetProjMinNonDiffMass( 0. << 
451     } else if ( iString == 1 ) {               << 
452       target->SetDefinition( TestParticle );   << 
453       theParameters->SetTarMinDiffMass( 0.5 ); << 
454       theParameters->SetTarMinNonDiffMass( 0.5 << 
455     } else {  // iString == 2                  << 
456       AdditionalString->SetDefinition( TestPar << 
457       AdditionalString->SetFirstParton( common << 
458       AdditionalString->SetSecondParton( commo << 
459       AdditionalString->SetStatus( 0 );        << 
460     }                                          << 
461   }  // End of the for loop over the 3 string  << 
462                                                << 
463   // 1st string AQ[0]-Q[0], 2nd string AQ[1]-Q << 
464                                                   383 
465   G4LorentzVector Pstring1, Pstring2, Pstring3 << 384       // Sampling X's of baryon
466   G4int QuarkOrder[3] = { 0 };                 << 385       if ( Alfa_R == 1.0 ) {
467   G4double YstringMax = 0.0, YstringMin = 0.0; << 386         G4double Xq1 = 1.0 - std::sqrt( G4UniformRand() );
468   for ( G4int i = 0; i < 3; ++i ) {            << 387         G4double Xq2 = (1.0 - Xq1) * G4UniformRand();
469     G4ThreeVector tmp = Quark_Mom[i] + Quark_M << 388         G4double Xq3 = 1.0 - Xq1 - Xq2;
470     G4LorentzVector Pstring( tmp, std::sqrt( Q << 389         Quark_Mom[3].setZ( Xq1 ); Quark_Mom[4].setZ( Xq2 ); Quark_Mom[5].setZ( Xq3 );
471                                   std::sqrt( Q << 
472     // Add protection for  rapidity = 0.5*ln(  << 
473     G4double Ystring = 0.0;                    << 
474     if ( Pstring.e() > 1.0e-30 ) {             << 
475       if ( Pstring.e() + Pstring.pz() < 1.0e-3 << 
476         Ystring = -1.0e30;   // A very large n << 
477         if ( Pstring.e() - Pstring.pz() < 1.0e << 
478           Ystring = 1.0e30;  // A very large p << 
479         } else {  // Normal case               << 
480           Ystring = Pstring.rapidity();        << 
481         }                                      << 
482       }                                        << 
483     }                                          << 
484     // Keep ordering in rapidity: "1" highest, << 
485     if ( i == 0 ) {                            << 
486       Pstring1 = Pstring;     YstringMax = Yst << 
487       QuarkOrder[0] = 0;                       << 
488     } else if ( i == 1 ) {                     << 
489       if ( Ystring > YstringMax ) {            << 
490         Pstring2 = Pstring1;  YstringMin = Yst << 
491         Pstring1 = Pstring;   YstringMax = Yst << 
492         QuarkOrder[0] = 1; QuarkOrder[1] = 0;  << 
493       } else {                                 << 
494         Pstring2 = Pstring;   YstringMin = Yst << 
495         QuarkOrder[1] = 1;                     << 
496       }                                        << 
497     } else {  // i == 2                        << 
498       if ( Ystring > YstringMax ) {            << 
499         Pstring3 = Pstring2;                   << 
500         Pstring2 = Pstring1;                   << 
501         Pstring1 = Pstring;                    << 
502         QuarkOrder[1] = QuarkOrder[0];         << 
503         QuarkOrder[2] = QuarkOrder[1];         << 
504         QuarkOrder[0] = 2;                     << 
505       } else if ( Ystring > YstringMin ) {     << 
506         Pstring3 = Pstring2;                   << 
507         Pstring2 = Pstring;                    << 
508       } else {                                    390       } else {
509         Pstring3 = Pstring;                    << 391         G4double Xq1 = sqr( G4UniformRand() );
510         QuarkOrder[2] = 2;                     << 392         G4double Xq2 = (1.0 - Xq1) * sqr( std::sin( pi/2.0*G4UniformRand() ) );
                                                   >> 393         G4double Xq3 = 1.0 - Xq1 - Xq2;
                                                   >> 394         Quark_Mom[3].setZ( Xq1 ); Quark_Mom[4].setZ( Xq2 ); Quark_Mom[5].setZ( Xq3 );
511       }                                           395       }
512     }                                          << 
513   }                                            << 
514                                                << 
515   G4LorentzVector Quark_4Mom[6];               << 
516   for ( G4int i = 0; i < 6; ++i ) {            << 
517     Quark_4Mom[i] = G4LorentzVector( Quark_Mom << 
518     if ( common.RotateStrings ) Quark_4Mom[i]  << 
519     Quark_4Mom[i].transform( common.toLab );   << 
520   }                                            << 
521                                                << 
522   projectile->Splitting();                     << 
523   projectile->GetNextAntiParton()->Set4Momentu << 
524   projectile->GetNextParton()->Set4Momentum( Q << 
525                                                << 
526   target->Splitting();                         << 
527   target->GetNextParton()->Set4Momentum( Quark << 
528   target->GetNextAntiParton()->Set4Momentum( Q << 
529                                                << 
530   AdditionalString->Splitting();               << 
531   AdditionalString->GetNextAntiParton()->Set4M << 
532   AdditionalString->GetNextParton()->Set4Momen << 
533                                                << 
534   common.Pprojectile = Pstring1;           //  << 
535   common.Ptarget     = Pstring3;           //  << 
536   G4LorentzVector LeftString( Pstring2 );  //  << 
537                                                << 
538   if ( common.RotateStrings ) {                << 
539     common.Pprojectile *= common.RandomRotatio << 
540     common.Ptarget     *= common.RandomRotatio << 
541     LeftString         *= common.RandomRotatio << 
542   }                                            << 
543                                                << 
544   common.Pprojectile.transform( common.toLab ) << 
545   common.Ptarget.transform( common.toLab );    << 
546   LeftString.transform( common.toLab );        << 
547                                                << 
548   // Calculation of the creation time          << 
549   // Creation time and position of target nucl << 
550   projectile->SetTimeOfCreation( target->GetTi << 
551   projectile->SetPosition( target->GetPosition << 
552   AdditionalString->SetTimeOfCreation( target- << 
553   AdditionalString->SetPosition( target->GetPo << 
554                                                << 
555   projectile->Set4Momentum( common.Pprojectile << 
556   AdditionalString->Set4Momentum( LeftString ) << 
557   target->Set4Momentum( common.Ptarget );      << 
558                                                << 
559   projectile->IncrementCollisionCount( 1 );    << 
560   AdditionalString->IncrementCollisionCount( 1 << 
561   target->IncrementCollisionCount( 1 );        << 
562                                                   396 
563   return true;                                 << 397       G4double Alfa( 0.0 ), Beta( 0.0 );
564 }                                              << 398       for ( G4int i = 0; i < 3; i++ ) {  // For Anti-baryon
565                                                << 399         if ( Quark_Mom[i].getZ() != 0.0 ) { 
566                                                << 400           Alfa += ( ScaleFactor * ModMom2[i] + MassQ2 ) / Quark_Mom[i].getZ();
567 //-------------------------------------------- << 401         } else {
568                                                << 402           Succes = false;
569 G4int G4FTFAnnihilation::                      << 403         }
570 Create1DiquarkAntiDiquarkString( G4VSplitableH << 404       } 
571                                  G4VSplitableH << 405       for ( G4int i = 3; i < 6; i++ ) {  // For baryon
572                                  G4FTFAnnihila << 406         if ( Quark_Mom[i].getZ() != 0.0 ) {
573   // Simulation of anti-diquark-diquark string << 407           Beta += ( ScaleFactor * ModMom2[i] + MassQ2 ) / Quark_Mom[i].getZ();
574   // This method returns an integer code - ins << 408         } else {
575   //   "0" : successfully ended and nothing el << 409           Succes = false;
576   //   "1" : successfully completed, but the w << 410         }
577   //  "99" : unsuccessfully ended, nothing els << 411       } 
578                                                   412 
579   #ifdef debugFTFannih                         << 413       if ( ! Succes ) continue;
580   G4cout << "Process b, quark - anti-quark ann << 
581   #endif                                       << 
582                                                   414 
583   G4int CandidatsN = 0, CandAQ[9][2] = {}, Can << 415       if ( std::sqrt( Alfa ) + std::sqrt( Beta ) > SqrtS ) {
584   for ( G4int iAQ = 0; iAQ < 3; ++iAQ ) {  //  << 416         Succes = false; 
585     for ( G4int iQ = 0; iQ < 3; ++iQ ) {   //  << 417         continue;
586       if ( -common.AQ[iAQ] == common.Q[iQ] ) { << 
587         // Here "0", "1", "2" means, respectiv << 
588         // of the (anti-baryon) projectile or  << 
589         if ( iAQ == 0 ) { CandAQ[CandidatsN][0 << 
590         if ( iAQ == 1 ) { CandAQ[CandidatsN][0 << 
591         if ( iAQ == 2 ) { CandAQ[CandidatsN][0 << 
592         if ( iQ  == 0 ) { CandQ[CandidatsN][0] << 
593         if ( iQ  == 1 ) { CandQ[CandidatsN][0] << 
594         if ( iQ  == 2 ) { CandQ[CandidatsN][0] << 
595         ++CandidatsN;                          << 
596       }                                           418       }
597     }                                          << 
598   }                                            << 
599                                                   419 
600   // Remaining two (anti-)quarks that form the << 420       G4double DecayMomentum2 = S*S + Alfa*Alfa + Beta*Beta
601   G4int LeftAQ1 = 0, LeftAQ2 = 0, LeftQ1 = 0,  << 421                               - 2.0*S*Alfa - 2.0*S*Beta - 2.0*Alfa*Beta;
602   if ( CandidatsN != 0 ) {                     << 422       
603     G4int SampledCase = (G4int)G4RandFlat::sho << 423       WminusTarget = ( S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / SqrtS; 
604     LeftAQ1 = common.AQ[ CandAQ[SampledCase][0 << 424       WplusProjectile = SqrtS - Beta/WminusTarget;
605     LeftAQ2 = common.AQ[ CandAQ[SampledCase][1 << 
606     LeftQ1  =  common.Q[ CandQ[SampledCase][0] << 
607     LeftQ2  =  common.Q[ CandQ[SampledCase][1] << 
608                                                << 
609     // Build anti-diquark and diquark : the la << 
610     // of anti-quark - anti-quark and quark -  << 
611     // or quarks are different. For simplicity << 
612     G4int Anti_DQ = 0, DQ = 0;                 << 
613     if ( std::abs( LeftAQ1 ) > std::abs( LeftA << 
614       Anti_DQ = 1000*LeftAQ1 + 100*LeftAQ2 - 3 << 
615     } else {                                   << 
616       Anti_DQ = 1000*LeftAQ2 + 100*LeftAQ1 - 3 << 
617     }                                          << 
618     if ( std::abs( LeftQ1 ) > std::abs( LeftQ2 << 
619       DQ = 1000*LeftQ1 + 100*LeftQ2 + 3;       << 
620     } else {                                   << 
621       DQ = 1000*LeftQ2 + 100*LeftQ1 + 3;       << 
622     }                                          << 
623                                                   425 
624     // Set the string properties               << 426     } while ( ( ! Succes ) &&
625     projectile->SetFirstParton( DQ );          << 427               ++loopCounter < maxNumberOfLoops );  /* Loop checking, 10.08.2015, A.Ribon */
626     projectile->SetSecondParton( Anti_DQ );    << 428     if ( loopCounter >= maxNumberOfLoops ) {
627                                                << 429       return false;
628     // It is assumed that quark and di-quark m << 
629     G4LorentzVector Pquark  = G4LorentzVector( << 
630     G4LorentzVector Paquark = G4LorentzVector( << 
631                                                << 
632     if ( common.RotateStrings ) {              << 
633       Pquark  *= common.RandomRotation;        << 
634       Paquark *= common.RandomRotation;        << 
635     }                                             430     }
636                                                   431 
637     Pquark.transform( common.toLab );          << 432     G4double SqrtScaleF = std::sqrt( ScaleFactor );
638     Paquark.transform( common.toLab );         << 433     for ( G4int i = 0; i < 3; i++ ) {
639                                                << 434       G4double Pz = WplusProjectile * Quark_Mom[i].getZ() / 2.0 -
640     projectile->GetNextParton()->Set4Momentum( << 435                     ( ScaleFactor * ModMom2[i] + MassQ2 ) / 
641     projectile->GetNextAntiParton()->Set4Momen << 436                     ( 2.0 * WplusProjectile * Quark_Mom[i].getZ() ); 
642                                                << 437       Quark_Mom[i].setZ( Pz );
643     projectile->Splitting();                   << 438       if ( ScaleFactor != 1.0 ) {
644                                                << 439         Quark_Mom[i].setX( SqrtScaleF * Quark_Mom[i].getX() ); 
645     projectile->SetStatus( 0 );                << 440         Quark_Mom[i].setY( SqrtScaleF * Quark_Mom[i].getY() );
646     target->SetStatus( 4 );  // The target nuc << 441       }
647     common.Pprojectile.setPx( 0.0 );           << 442     }
648     common.Pprojectile.setPy( 0.0 );           << 443     for ( G4int i = 3; i < 6; i++ ) {
649     common.Pprojectile.setPz( 0.0 );           << 444       G4double Pz = -WminusTarget * Quark_Mom[i].getZ() / 2.0 +
650     common.Pprojectile.setE( common.SqrtS );   << 445                      ( ScaleFactor * ModMom2[i] + MassQ2 ) / 
651     common.Pprojectile.transform( common.toLab << 446                      ( 2.0 * WminusTarget * Quark_Mom[i].getZ() );
                                                   >> 447       Quark_Mom[i].setZ( Pz );
                                                   >> 448       if ( ScaleFactor != 1.0 ) {
                                                   >> 449         Quark_Mom[i].setX( SqrtScaleF * Quark_Mom[i].getX() ); 
                                                   >> 450         Quark_Mom[i].setY( SqrtScaleF * Quark_Mom[i].getY() );
                                                   >> 451       }
                                                   >> 452     }
                                                   >> 453     //G4cout << "Sum AQ " << Quark_Mom[0] + Quark_Mom[1] + Quark_Mom[2] << G4endl
                                                   >> 454     //       << "Sum Q  " << Quark_Mom[3] + Quark_Mom[4] + Quark_Mom[5] << G4endl;
                                                   >> 455 
                                                   >> 456     G4ThreeVector tmp = Quark_Mom[0] + Quark_Mom[3];
                                                   >> 457     G4LorentzVector Pstring1( tmp, std::sqrt( Quark_Mom[0].mag2() + MassQ2 ) +
                                                   >> 458                                    std::sqrt( Quark_Mom[3].mag2() + MassQ2 ) );
                                                   >> 459     G4double Ystring1 = Pstring1.rapidity();
                                                   >> 460 
                                                   >> 461     //G4cout << "Mom 1 string " << G4endl << Quark_Mom[0] << G4endl << Quark_Mom[3] << G4endl
                                                   >> 462     //       << tmp << " " << tmp.mag() << G4endl;
                                                   >> 463     //G4cout << "1 str " << Pstring1 << " " << Pstring1.mag() << " " << Ystring1 << G4endl;
                                                   >> 464 
                                                   >> 465     tmp = Quark_Mom[1] + Quark_Mom[4];
                                                   >> 466     G4LorentzVector Pstring2( tmp, std::sqrt( Quark_Mom[1].mag2() + MassQ2 ) +
                                                   >> 467                                    std::sqrt( Quark_Mom[4].mag2() + MassQ2 ) );
                                                   >> 468     G4double Ystring2 = Pstring2.rapidity();
                                                   >> 469 
                                                   >> 470     //G4cout << "Mom 2 string " << G4endl << Quark_Mom[1] << G4endl << Quark_Mom[4] << G4endl
                                                   >> 471     //       << tmp << " " << tmp.mag() << G4endl;
                                                   >> 472     //G4cout << "2 str " << Pstring2 << " " << Pstring2.mag() << " " << Ystring2 << G4endl;
                                                   >> 473 
                                                   >> 474     tmp = Quark_Mom[2] + Quark_Mom[5];
                                                   >> 475     G4LorentzVector Pstring3( tmp, std::sqrt( Quark_Mom[2].mag2() + MassQ2 ) +
                                                   >> 476                                    std::sqrt( Quark_Mom[5].mag2() + MassQ2 ) );
                                                   >> 477     G4double Ystring3 = Pstring3.rapidity();
                                                   >> 478 
                                                   >> 479     //G4cout << "Mom 3 string " << G4endl << Quark_Mom[2] << G4endl << Quark_Mom[5] << G4endl
                                                   >> 480     //       << tmp << " " << tmp.mag() << G4endl;
                                                   >> 481     //G4cout << "3 str " << Pstring3 << " " << Pstring3.mag() << " " << Ystring3 << G4endl
                                                   >> 482     //       << "SumE " << Pstring1.e() + Pstring2.e() + Pstring3.e() << G4endl
                                                   >> 483     //       << Pstring1.mag() << " " <<Pstring2.mag() << " " << Pstring3.mag() << G4endl;
                                                   >> 484     //G4int Uzhi; G4cin >> Uzhi;
                                                   >> 485 
                                                   >> 486     G4LorentzVector LeftString( 0.0, 0.0, 0.0, 0.0 );
                                                   >> 487     if ( Ystring1 > Ystring2  &&  Ystring2 > Ystring3 ) {
                                                   >> 488       Pprojectile = Pstring1;
                                                   >> 489       LeftString  = Pstring2;
                                                   >> 490       Ptarget     = Pstring3;
                                                   >> 491     }
                                                   >> 492     if ( Ystring1 > Ystring3  &&  Ystring3 > Ystring2 ) {
                                                   >> 493       Pprojectile = Pstring1;
                                                   >> 494       LeftString  = Pstring3;
                                                   >> 495       Ptarget     = Pstring2;
                                                   >> 496     }
                                                   >> 497 
                                                   >> 498     if ( Ystring2 > Ystring1  &&  Ystring1 > Ystring3 ) {
                                                   >> 499       Pprojectile = Pstring2;
                                                   >> 500       LeftString  = Pstring1;
                                                   >> 501       Ptarget     = Pstring3;
                                                   >> 502     }  
                                                   >> 503     if ( Ystring2 > Ystring3  &&  Ystring3 > Ystring1 ) {
                                                   >> 504       Pprojectile = Pstring2;
                                                   >> 505       LeftString  = Pstring3;
                                                   >> 506       Ptarget     = Pstring1;
                                                   >> 507     }
                                                   >> 508 
                                                   >> 509     if ( Ystring3 > Ystring1  &&  Ystring1 > Ystring2 ) {
                                                   >> 510       Pprojectile = Pstring3;
                                                   >> 511       LeftString  = Pstring1;
                                                   >> 512       Ptarget     = Pstring2;
                                                   >> 513     }
                                                   >> 514     if ( Ystring3 > Ystring2  &&  Ystring2 > Ystring1 ) {
                                                   >> 515       Pprojectile = Pstring3;
                                                   >> 516       LeftString  = Pstring2;
                                                   >> 517       Ptarget     = Pstring1;
                                                   >> 518     }
                                                   >> 519     //G4cout << "SumP " << Pprojectile + LeftString + Ptarget << " " << SqrtS << G4endl;
                                                   >> 520 
                                                   >> 521     Pprojectile.transform( toLab );
                                                   >> 522     LeftString.transform( toLab );
                                                   >> 523     Ptarget.transform( toLab );
                                                   >> 524     //G4cout << "SumP " << Pprojectile + LeftString + Ptarget << " " << SqrtS << G4endl;
652                                                   525 
653     // Calculation of the creation time           526     // Calculation of the creation time
654     // Creation time and position of target nu << 
655     projectile->SetTimeOfCreation( target->Get    527     projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
656     projectile->SetPosition( target->GetPositi    528     projectile->SetPosition( target->GetPosition() );
657     projectile->Set4Momentum( common.Pprojecti << 529     AdditionalString->SetTimeOfCreation( target->GetTimeOfCreation() );
658                                                << 530     AdditionalString->SetPosition( target->GetPosition() );
                                                   >> 531     // Creation time and position of target nucleon were determined in
                                                   >> 532     // ReggeonCascade() of G4FTFModel
                                                   >> 533 
                                                   >> 534     //G4cout << "Mproj " << Pprojectile.mag() << G4endl << "Mtarg " << Ptarget.mag() << G4endl;
                                                   >> 535     projectile->Set4Momentum( Pprojectile );
                                                   >> 536     AdditionalString->Set4Momentum( LeftString );
                                                   >> 537     target->Set4Momentum( Ptarget );
659     projectile->IncrementCollisionCount( 1 );     538     projectile->IncrementCollisionCount( 1 );
                                                   >> 539     AdditionalString->IncrementCollisionCount( 1 );
660     target->IncrementCollisionCount( 1 );         540     target->IncrementCollisionCount( 1 );
661                                                   541 
662     return 0;  // Completed successfully: noth << 542     return true;
663   }  // End of if ( CandidatsN != 0 )          << 
664                                                   543 
665   // If we allow the string to interact with o << 544   }  // End of if ( Ksi < X_a / Xannihilation )
666   // set up MinDiffrMass in Parameters, and as << 
667                                                << 
668   return 1;  // Successfully ended, but the wo << 
669 }                                              << 
670                                                   545 
                                                   >> 546   // Simulation of anti-diquark-diquark string creation
671                                                   547 
672 //-------------------------------------------- << 548   if ( Ksi < (X_a + X_b) / Xannihilation ) {
673                                                   549 
674 G4int G4FTFAnnihilation::                      << 550     #ifdef debugFTFannih 
675 Create2QuarkAntiQuarkStrings( G4VSplitableHadr << 551     G4cout << "Process b, quark - anti-quark annihilation, di-q - anti-di-q string" << G4endl;
676                               G4VSplitableHadr << 552     #endif
677                               G4FTFParameters* << 
678                               G4FTFAnnihilatio << 
679   // Simulation of 2 anti-quark-quark strings  << 
680   // This method returns an integer code - ins << 
681   //   "0" : successfully ended and nothing el << 
682   //   "1" : successfully completed, but the w << 
683   //  "99" : unsuccessfully ended, nothing els << 
684                                                   553 
685   #ifdef debugFTFannih                         << 554     G4int CandidatsN( 0 ), CandAQ[9][2], CandQ[9][2];
686   G4cout << "Process c, quark - anti-quark and << 555     G4int LeftAQ1( 0 ), LeftAQ2( 0 ), LeftQ1( 0 ), LeftQ2( 0 );
687          << G4endl;                            << 
688   #endif                                       << 
689                                                   556 
690   // Sampling kinematical properties: 1st stri << 557     for ( G4int iAQ = 0; iAQ < 3; iAQ++ ) {
691   G4ThreeVector Quark_Mom[4];                  << 558       for ( G4int iQ = 0; iQ < 3; iQ++ ) {
692   G4double Quark_Xs[4];                        << 559         if ( -AQ[iAQ] == Q[iQ] ) {
693   G4double AveragePt2 = 200.0*200.0, maxPtSqua << 560           if ( iAQ == 0 ) { CandAQ[CandidatsN][0] = 1; CandAQ[CandidatsN][1] = 2; }
694   G4int NumberOfTries = 0, loopCounter = 0;    << 561           if ( iAQ == 1 ) { CandAQ[CandidatsN][0] = 0; CandAQ[CandidatsN][1] = 2; }
695   const G4int maxNumberOfLoops = 1000;         << 562           if ( iAQ == 2 ) { CandAQ[CandidatsN][0] = 0; CandAQ[CandidatsN][1] = 1; }
696   G4double Alfa = 0.0, Beta = 0.0;             << 563           if ( iQ  == 0 ) { CandQ[CandidatsN][0]  = 1; CandQ[CandidatsN][1]  = 2; }
697   G4double WminusTarget = 0.0, WplusProjectile << 564           if ( iQ  == 1 ) { CandQ[CandidatsN][0]  = 0; CandQ[CandidatsN][1]  = 2; }
698   do {                                         << 565           if ( iQ  == 2 ) { CandQ[CandidatsN][0]  = 0; CandQ[CandidatsN][1]  = 1; }
699     // Sampling X's of the 2 quarks and 2 anti << 566           CandidatsN++;
700                                                << 
701     G4double Product = 1.0;                    << 
702     for ( G4int iCase = 0; iCase < 2; ++iCase  << 
703       G4double x = 0.0, r = G4UniformRand();   << 
704       if ( Alfa_R == 1.0 ) {                   << 
705         if ( iCase == 0 ) {  // first string   << 
706           x = std::sqrt( r );                  << 
707         } else {             // second string  << 
708           x = 1.0 - std::sqrt( r );            << 
709         }                                         567         }
710       } else {                                 << 
711         x = sqr( std::sin( pi/2.0*r ) );       << 
712       }                                           568       }
713       G4int index = iCase*2;  // 0 for the fir << 
714       Quark_Xs[index] = x ; Quark_Xs[index+1]  << 
715       Product *= x*(1.0-x);                    << 
716     }                                             569     }
                                                   >> 570     //G4cout << "CandidatsN " << CandidatsN << G4endl;
717                                                   571 
718     if ( Product == 0.0 ) continue;            << 572     if ( CandidatsN != 0 ) {
                                                   >> 573       G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
                                                   >> 574       LeftAQ1 = AQ[ CandAQ[SampledCase][0] ];
                                                   >> 575       LeftAQ2 = AQ[ CandAQ[SampledCase][1] ];
                                                   >> 576       LeftQ1  =  Q[ CandQ[SampledCase][0] ];
                                                   >> 577       LeftQ2  =  Q[ CandQ[SampledCase][1] ];
                                                   >> 578 
                                                   >> 579       // Build anti-diquark and diquark
                                                   >> 580       G4int Anti_DQ( 0 ), DQ( 0 );
                                                   >> 581       if ( std::abs( LeftAQ1 ) > std::abs( LeftAQ2 ) ) { 
                                                   >> 582         Anti_DQ = 1000*LeftAQ1 + 100*LeftAQ2 - 3;  // 1
                                                   >> 583       } else {
                                                   >> 584         Anti_DQ = 1000*LeftAQ2 + 100*LeftAQ1 - 3;  // 1
                                                   >> 585       }
                                                   >> 586       //if ( G4UniformRand() > 0.5 ) Anti_DQ -= 2;
                                                   >> 587       if ( std::abs( LeftQ1 ) > std::abs( LeftQ2 ) ) { 
                                                   >> 588         DQ = 1000*LeftQ1 + 100*LeftQ2 + 3;  // 1
                                                   >> 589       } else {
                                                   >> 590         DQ = 1000*LeftQ2 + 100*LeftQ1 + 3;  // 1
                                                   >> 591       }
                                                   >> 592       // if ( G4UniformRand() > 0.5 ) DQ += 2;
719                                                   593 
720     ++NumberOfTries;                           << 594       // Set the string properties
721     if ( NumberOfTries == 100*(NumberOfTries/1 << 595       //G4cout << "Left ADiQ DiQ " << Anti_DQ << " " << DQ << G4endl;
722       // After a large number of tries, it is  << 596       projectile->SplitUp();
723       ScaleFactor /= 2.0;                      << 597       //projectile->SetFirstParton( Anti_DQ );
724       AveragePt2 *= ScaleFactor;               << 598       //projectile->SetSecondParton( DQ );
725     }                                          << 599       projectile->SetFirstParton( DQ );
                                                   >> 600       projectile->SetSecondParton( Anti_DQ );
                                                   >> 601       projectile->SetStatus( 0 );
                                                   >> 602       target->SetStatus( 4 );  // The target nucleon has annihilated 3->4 Uzhi Oct 2014
                                                   >> 603       Pprojectile.setPx( 0.0 );
                                                   >> 604       Pprojectile.setPy( 0.0 );
                                                   >> 605       Pprojectile.setPz( 0.0 );
                                                   >> 606       Pprojectile.setE( SqrtS );
                                                   >> 607       Pprojectile.transform( toLab );
                                                   >> 608 
                                                   >> 609       // Calculation of the creation time
                                                   >> 610       projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
                                                   >> 611       projectile->SetPosition( target->GetPosition() );
                                                   >> 612       // Creation time and position of target nucleon were determined in
                                                   >> 613       // ReggeonCascade() of G4FTFModel
                                                   >> 614 
                                                   >> 615       //G4cout << "Mproj " << Pprojectile.mag() << G4endl
                                                   >> 616       //       << "Mtarg " << Ptarget.mag() << G4endl;
                                                   >> 617       projectile->Set4Momentum( Pprojectile );
726                                                   618 
727     G4ThreeVector PtSum( 0.0, 0.0, 0.0 );      << 619       projectile->IncrementCollisionCount( 1 );
728     for( G4int i = 0; i < 4; ++i ) {           << 620       target->IncrementCollisionCount( 1 );
729       Quark_Mom[i] = GaussianPt( AveragePt2, m << 
730       PtSum += Quark_Mom[i];                   << 
731     }                                          << 
732                                                   621 
733     PtSum /= 4.0;                              << 622       return true;
734     for ( G4int i = 0; i < 4; ++i ) {          << 
735       Quark_Mom[i] -= PtSum;                   << 
736     }                                             623     }
737                                                   624 
738     Alfa = 0.0; Beta = 0.0;                    << 625   }  // End of if ( Ksi < (X_a + X_b) / Xannihilation )
739     for ( G4int iCase = 0; iCase < 2; ++iCase  << 
740        G4int index = iCase * 2;                << 
741        for ( G4int i = 0; i < 2; ++i ) {       << 
742           G4double val = ( Quark_Mom[index+i]. << 
743           if ( iCase == 0 ) {  // first string << 
744             Alfa += val;                       << 
745           } else {             // second strin << 
746             Beta += val;                       << 
747           }                                    << 
748        }                                       << 
749     }                                          << 
750                                                   626 
751   } while ( ( std::sqrt( Alfa ) + std::sqrt( B << 627   if ( Ksi < ( X_a + X_b + X_c ) / Xannihilation ) {
752             ++loopCounter < maxNumberOfLoops ) << 
753                                                   628 
754   if ( loopCounter >= maxNumberOfLoops ) {     << 629     // Simulation of 2 anti-quark-quark strings creation
755     return 99;  // unsuccessfully ended, nothi << 
756   }                                            << 
757                                                   630 
758   G4double DecayMomentum2 = sqr(common.S) + sq << 631     #ifdef debugFTFannih 
759                             - 2.0*( common.S*( << 632     G4cout << "Process c, quark - anti-quark and string junctions annihilation, 2 strings left."
760   WminusTarget = ( common.S - Alfa + Beta + st << 633            << G4endl;
761   WplusProjectile = common.SqrtS - Beta/Wminus << 634     #endif
762                                                << 
763   for ( G4int iCase = 0; iCase < 2; ++iCase )  << 
764     G4int index = iCase*2;  // 0 for the first << 
765     for ( G4int i = 0; i < 2; ++i ) {          << 
766       G4double w = WplusProjectile;          / << 
767       if ( iCase == 1 ) w = - WminusTarget;  / << 
768       G4double Pz = w * Quark_Xs[index+i] / 2. << 
769                     - ( Quark_Mom[index+i].mag << 
770                       ( 2.0 * w * Quark_Xs[ind << 
771       Quark_Mom[index+i].setZ( Pz );           << 
772     }                                          << 
773   }                                            << 
774                                                   635 
775   G4int CandidatsN = 0, CandAQ[9][2] = {}, Can << 636     G4int CandidatsN( 0 ), CandAQ[9][2], CandQ[9][2];
776   G4int LeftAQ1 = 0, LeftAQ2 = 0, LeftQ1 = 0,  << 637     G4int LeftAQ1( 0 ), LeftAQ2( 0 ), LeftQ1( 0 ), LeftQ2( 0 );
777   for ( G4int iAQ = 0; iAQ < 3; ++iAQ ) {  //  << 
778     for ( G4int iQ = 0; iQ < 3; ++iQ ) {   //  << 
779       if ( -common.AQ[iAQ] == common.Q[iQ] ) { << 
780         // Here "0", "1", "2" means, respectiv << 
781         // of the (anti-baryon) projectile or  << 
782         if ( iAQ == 0 ) { CandAQ[CandidatsN][0 << 
783         if ( iAQ == 1 ) { CandAQ[CandidatsN][0 << 
784         if ( iAQ == 2 ) { CandAQ[CandidatsN][0 << 
785         if ( iQ  == 0 ) { CandQ[CandidatsN][0] << 
786         if ( iQ  == 1 ) { CandQ[CandidatsN][0] << 
787         if ( iQ  == 2 ) { CandQ[CandidatsN][0] << 
788         ++CandidatsN;                          << 
789       }                                        << 
790     }                                          << 
791   }                                            << 
792                                                   638 
793   if ( CandidatsN != 0 ) {                     << 639     for ( G4int iAQ = 0; iAQ < 3; iAQ++ ) {
794     G4int SampledCase = (G4int)G4RandFlat::sho << 640       for ( G4int iQ = 0; iQ < 3; iQ++ ) {
795     LeftAQ1 = common.AQ[ CandAQ[SampledCase][0 << 641         if ( -AQ[iAQ] == Q[iQ] ) {
796     LeftAQ2 = common.AQ[ CandAQ[SampledCase][1 << 642           if ( iAQ == 0 ) { CandAQ[CandidatsN][0] = 1; CandAQ[CandidatsN][1] = 2; }
797     if ( G4UniformRand() < 0.5 ) {             << 643           if ( iAQ == 1 ) { CandAQ[CandidatsN][0] = 0; CandAQ[CandidatsN][1] = 2; }
798       LeftQ1 = common.Q[ CandQ[SampledCase][0] << 644           if ( iAQ == 2 ) { CandAQ[CandidatsN][0] = 0; CandAQ[CandidatsN][1] = 1; }
799       LeftQ2 = common.Q[ CandQ[SampledCase][1] << 645           if ( iQ  == 0 ) { CandQ[CandidatsN][0]  = 1; CandQ[CandidatsN][1]  = 2; }
800     } else {                                   << 646           if ( iQ  == 1 ) { CandQ[CandidatsN][0]  = 0; CandQ[CandidatsN][1]  = 2; }
801       LeftQ2 = common.Q[ CandQ[SampledCase][0] << 647           if ( iQ  == 2 ) { CandQ[CandidatsN][0]  = 0; CandQ[CandidatsN][1]  = 1; }
802       LeftQ1 = common.Q[ CandQ[SampledCase][1] << 648           CandidatsN++;
                                                   >> 649         }
                                                   >> 650       }
803     }                                             651     }
                                                   >> 652     //G4cout << "CandidatsN " << CandidatsN << G4endl;
804                                                   653 
805     // Set the string properties               << 654     if ( CandidatsN != 0 ) {
806     // An anti quark - quark pair can have the << 655       G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
807     // or a vector meson: the last digit of th << 656       LeftAQ1 = AQ[ CandAQ[SampledCase][0] ];
808     // For simplicity only scalar is considere << 657       LeftAQ2 = AQ[ CandAQ[SampledCase][1] ];
809     G4int NewCode = 0, antiQuark = 0, quark =  << 658       if ( G4UniformRand() < 0.5 ) {
810     G4ParticleDefinition* TestParticle = nullp << 659         LeftQ1 = Q[ CandQ[SampledCase][0] ];
811     for ( G4int iString = 0; iString < 2; ++iS << 660         LeftQ2 = Q[ CandQ[SampledCase][1] ];
812       if ( iString == 0 ) {                    << 661       } else {
813         antiQuark = LeftAQ1; quark = LeftQ1;   << 662         LeftQ2 = Q[ CandQ[SampledCase][0] ];
814         projectile->SetFirstParton( antiQuark  << 663         LeftQ1 = Q[ CandQ[SampledCase][1] ];
815         projectile->SetSecondParton( quark );  << 
816         projectile->SetStatus( 0 );            << 
817       } else {  // iString == 1                << 
818         quark = LeftQ2; antiQuark = LeftAQ2;   << 
819         target->SetFirstParton( quark );       << 
820         target->SetSecondParton( antiQuark );  << 
821         target->SetStatus( 0 );                << 
822       }                                           664       }
823       G4int absAntiQuark = std::abs( antiQuark << 665 
824       G4double aKsi = G4UniformRand();         << 666       // Set the string properties
825       if ( absAntiQuark == absQuark ) {        << 667       //G4cout << "String 1 " << LeftAQ1 << " " << LeftQ1 << G4endl;
826         if ( absAntiQuark != 3 ) {             << 668       projectile->SplitUp();
827           NewCode = 111;          // Pi0-meson << 669       projectile->SetFirstParton( LeftAQ1 );
828           if ( aKsi < 0.5 ) {                  << 670       projectile->SetSecondParton( LeftQ1 );
829             NewCode = 221;        // Eta -meso << 671       projectile->SetStatus( 0 );
830             if ( aKsi < 0.25 ) {               << 672       //G4cout << "String 2 " << LeftAQ2 << " " << LeftQ2 << G4endl;
831               NewCode = 331;      // Eta'-meso << 673       target->SplitUp();
832             }                                  << 674       target->SetFirstParton( LeftQ2 );
833           }                                    << 675       target->SetSecondParton( LeftAQ2 );
                                                   >> 676       target->SetStatus( 0 );
                                                   >> 677 
                                                   >> 678       // Sampling kinematical properties
                                                   >> 679       // 1 string LeftAQ1-LeftQ1// 2 string LeftAQ2-LeftQ2
                                                   >> 680       G4ThreeVector Quark_Mom[4];
                                                   >> 681       G4double ModMom2[4]; //ModMom[4], 
                                                   >> 682 
                                                   >> 683       AveragePt2 = 200.0*200.0; maxPtSquare = S;
                                                   >> 684 
                                                   >> 685       G4double SumMt( 0.0 );
                                                   >> 686       G4double MassQ2 = 0.0; //100.0*100.0*MeV*MeV;
                                                   >> 687       G4int    NumberOfTries( 0 );
                                                   >> 688       G4double ScaleFactor( 1.0 );
                                                   >> 689 
                                                   >> 690       const G4int maxNumberOfLoops = 1000;
                                                   >> 691       G4int loopCounter = 0;
                                                   >> 692       do { 
                                                   >> 693         NumberOfTries++;
                                                   >> 694         if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
                                                   >> 695           // At large number of tries it would be better to reduce the values of <Pt^2>
                                                   >> 696           ScaleFactor /= 2.0;
                                                   >> 697           AveragePt2 *= ScaleFactor;
                                                   >> 698         }
                                                   >> 699         G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
                                                   >> 700         for( G4int i = 0; i < 4; i++ ) {
                                                   >> 701           Quark_Mom[i] = GaussianPt( AveragePt2, maxPtSquare );
                                                   >> 702           PtSum += Quark_Mom[i];
                                                   >> 703         }
                                                   >> 704         PtSum /= 4.0;
                                                   >> 705         SumMt = 0.0;    
                                                   >> 706         for ( G4int i = 0; i < 4; i++ ) {
                                                   >> 707           Quark_Mom[i] -= PtSum;
                                                   >> 708           //ModMom[i] = Quark_Mom[i].mag();
                                                   >> 709           ModMom2[i] = Quark_Mom[i].mag2();
                                                   >> 710           SumMt += std::sqrt( ModMom2[i] + MassQ2 );
                                                   >> 711         }
                                                   >> 712       } while ( ( SumMt > SqrtS ) &&  
                                                   >> 713                 ++loopCounter < maxNumberOfLoops );  /* Loop checking, 10.08.2015, A.Ribon */
                                                   >> 714       if ( loopCounter >= maxNumberOfLoops ) {
                                                   >> 715         return false;
                                                   >> 716       }
                                                   >> 717 
                                                   >> 718       G4double WminusTarget( 0.0 ), WplusProjectile( 0.0 );
                                                   >> 719 
                                                   >> 720       // Sampling X's of anti-baryon
                                                   >> 721       G4double Alfa_R = 0.5;
                                                   >> 722       NumberOfTries = 0;
                                                   >> 723       ScaleFactor = 1.0;
                                                   >> 724       G4bool Succes( true );
                                                   >> 725 
                                                   >> 726       loopCounter = 0;
                                                   >> 727       do { 
                                                   >> 728 
                                                   >> 729         Succes = true;
                                                   >> 730         NumberOfTries++;
                                                   >> 731         if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
                                                   >> 732           // At large number of tries it would be better to reduce the values of Pt's
                                                   >> 733           ScaleFactor /= 2.0;
                                                   >> 734         }
                                                   >> 735 
                                                   >> 736         if ( Alfa_R == 1.0 ) {
                                                   >> 737           G4double Xaq1 = std::sqrt( G4UniformRand() );
                                                   >> 738           G4double Xaq2 = 1.0 - Xaq1;
                                                   >> 739           Quark_Mom[0].setZ( Xaq1 ); Quark_Mom[1].setZ( Xaq2 ); 
834         } else {                                  740         } else {
835           NewCode = 221;          // Eta -meso << 741           G4double Xaq1 = sqr( std::sin( pi/2.0*G4UniformRand() ) );
836           if ( aKsi < 0.5 ) {                  << 742           G4double Xaq2 = 1.0 - Xaq1;
837             NewCode = 331;        // Eta'-meso << 743           Quark_Mom[0].setZ( Xaq1 ); Quark_Mom[1].setZ( Xaq2 );
838           }                                    << 
839         }                                         744         }
840       } else {                                 << 745 
841         if ( absAntiQuark > absQuark ) {       << 746         // Sampling X's of baryon ------------
842           NewCode = absAntiQuark*100 + absQuar << 747         if ( Alfa_R == 1.0 ) {
843         } else {                               << 748           G4double Xq1 = 1.0 - std::sqrt( G4UniformRand() );
844           NewCode = absQuark*100 + absAntiQuar << 749           G4double Xq2 = 1.0 - Xq1;
                                                   >> 750           Quark_Mom[2].setZ( Xq1 ); Quark_Mom[3].setZ( Xq2 );
                                                   >> 751         } else {
                                                   >> 752           G4double Xq1 = sqr( std::sin( pi/2.0*G4UniformRand() ) );
                                                   >> 753           G4double Xq2 = 1.0 - Xq1;
                                                   >> 754           Quark_Mom[2].setZ( Xq1 ); Quark_Mom[3].setZ( Xq2 );
845         }                                         755         }
846       }                                        << 
847       TestParticle = G4ParticleTable::GetParti << 
848       if ( ! TestParticle ) return 99;  // uns << 
849       if ( iString == 0 ) {                    << 
850         projectile->SetDefinition( TestParticl << 
851         theParameters->SetProjMinDiffMass( 0.5 << 
852         theParameters->SetProjMinNonDiffMass(  << 
853       } else {  // iString == 1                << 
854         target->SetDefinition( TestParticle ); << 
855         theParameters->SetTarMinDiffMass( 0.5  << 
856         theParameters->SetTarMinNonDiffMass( 0 << 
857       }                                        << 
858     }  // End of loop over the 2 string cases  << 
859                                                   756 
860     G4int QuarkOrder[2];                       << 757         G4double Alfa( 0.0 ), Beta( 0.0 );
861     G4LorentzVector Pstring1, Pstring2;        << 758         for ( G4int i = 0; i < 2; i++ ) {  // For Anti-baryon
862     G4double Ystring1 = 0.0, Ystring2 = 0.0;   << 759           if ( Quark_Mom[i].getZ() != 0.0 ) {
863                                                << 760             Alfa += ( ScaleFactor * ModMom2[i] + MassQ2 ) / Quark_Mom[i].getZ();
864     for ( G4int iCase = 0; iCase < 2; ++iCase  << 761           } else {
865       G4ThreeVector tmp = Quark_Mom[iCase] + Q << 762             Succes = false;
866       G4LorentzVector Pstring( tmp, std::sqrt( << 
867                                     std::sqrt( << 
868       // Add protection for  rapidity = 0.5*ln << 
869       G4double Ystring = 0.0;                  << 
870       if ( Pstring.e() > 1.0e-30 ) {           << 
871         if ( Pstring.e() + Pstring.pz() < 1.0e << 
872           Ystring = -1.0e30;   // A very large << 
873           if ( Pstring.e() - Pstring.pz() < 1. << 
874             Ystring = 1.0e30;  // A very large << 
875           } else {  // Normal case             << 
876             Ystring = Pstring.rapidity();      << 
877           }                                       763           }
                                                   >> 764         } 
                                                   >> 765         for ( G4int i = 2; i < 4; i++ ) {  // For baryon
                                                   >> 766           if ( Quark_Mom[i].getZ() != 0.0 ) { 
                                                   >> 767             Beta += ( ScaleFactor * ModMom2[i] + MassQ2 ) / Quark_Mom[i].getZ();
                                                   >> 768           } else {
                                                   >> 769             Succes = false;
                                                   >> 770           }
                                                   >> 771         } 
                                                   >> 772 
                                                   >> 773         if ( ! Succes ) continue;
                                                   >> 774 
                                                   >> 775         if ( std::sqrt( Alfa ) + std::sqrt( Beta ) > SqrtS ) {
                                                   >> 776           Succes = false; 
                                                   >> 777           continue;
878         }                                         778         }
                                                   >> 779 
                                                   >> 780         G4double DecayMomentum2 = S*S + Alfa*Alfa + Beta*Beta
                                                   >> 781                                 - 2.0*S*Alfa - 2.0*S*Beta - 2.0*Alfa*Beta;
                                                   >> 782         WminusTarget = ( S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / SqrtS; 
                                                   >> 783         WplusProjectile = SqrtS - Beta/WminusTarget;
                                                   >> 784 
                                                   >> 785       } while ( ( ! Succes ) &&
                                                   >> 786                 ++loopCounter < maxNumberOfLoops );  /* Loop checking, 10.08.2015, A.Ribon */
                                                   >> 787       if ( loopCounter >= maxNumberOfLoops ) {
                                                   >> 788         return false;
                                                   >> 789       }
                                                   >> 790 
                                                   >> 791       G4double SqrtScaleF = std::sqrt( ScaleFactor );
                                                   >> 792 
                                                   >> 793       for ( G4int i = 0; i < 2; i++ ) {
                                                   >> 794         G4double Pz = WplusProjectile * Quark_Mom[i].getZ() / 2.0 -
                                                   >> 795                       ( ScaleFactor * ModMom2[i] + MassQ2 ) /
                                                   >> 796                       ( 2.0 * WplusProjectile * Quark_Mom[i].getZ() ); 
                                                   >> 797         Quark_Mom[i].setZ( Pz );
                                                   >> 798         if ( ScaleFactor != 1.0 ) {
                                                   >> 799           Quark_Mom[i].setX( SqrtScaleF * Quark_Mom[i].getX() ); 
                                                   >> 800           Quark_Mom[i].setY( SqrtScaleF * Quark_Mom[i].getY() );
                                                   >> 801         }
                                                   >> 802         //G4cout << "Anti Q " << i << " " << Quark_Mom[i] << G4endl;
879       }                                           803       }
880       if ( iCase == 0 ) {  // For the first st << 804       for ( G4int i = 2; i < 4; i++ ) {
881         Pstring1 = Pstring; Ystring1 = Ystring << 805         G4double Pz = -WminusTarget * Quark_Mom[i].getZ() / 2.0 +
882       } else {             // For the second s << 806                       ( ScaleFactor * ModMom2[i] + MassQ2 ) /
883         Pstring2 = Pstring; Ystring2 = Ystring << 807                       ( 2.0 * WminusTarget * Quark_Mom[i].getZ() );
                                                   >> 808         Quark_Mom[i].setZ( Pz );
                                                   >> 809         if ( ScaleFactor != 1.0 ) {
                                                   >> 810           Quark_Mom[i].setX( SqrtScaleF * Quark_Mom[i].getX() ); 
                                                   >> 811           Quark_Mom[i].setY( SqrtScaleF * Quark_Mom[i].getY() );
                                                   >> 812         }
                                                   >> 813         //G4cout << "Bary Q " << i << " " << Quark_Mom[i] << G4endl;
884       }                                           814       }
885     }                                          << 815       //G4cout << "Sum AQ " << Quark_Mom[0] + Quark_Mom[1] << G4endl
886     if ( Ystring1 > Ystring2 ) {               << 816       //       << "Sum Q  " << Quark_Mom[2] + Quark_Mom[3] << G4endl;
887       common.Pprojectile = Pstring1;  common.P << 
888       QuarkOrder[0] = 0; QuarkOrder[1] = 1;    << 
889     } else {                                   << 
890       common.Pprojectile = Pstring2;  common.P << 
891       QuarkOrder[0] = 1; QuarkOrder[1] = 0;    << 
892     }                                          << 
893                                                << 
894     if ( common.RotateStrings ) {              << 
895       common.Pprojectile *= common.RandomRotat << 
896       common.Ptarget     *= common.RandomRotat << 
897     }                                          << 
898                                                   817 
899     common.Pprojectile.transform( common.toLab << 818       G4ThreeVector tmp = Quark_Mom[0] + Quark_Mom[2];
900     common.Ptarget.transform( common.toLab );  << 819       G4LorentzVector Pstring1( tmp, std::sqrt( Quark_Mom[0].mag2() + MassQ2 ) +
901                                                << 820                                      std::sqrt( Quark_Mom[2].mag2() + MassQ2 ) );
902     G4LorentzVector Quark_4Mom[4];             << 821       G4double Ystring1 = Pstring1.rapidity();
903     for ( G4int i = 0; i < 4; ++i ) {          << 822 
904       Quark_4Mom[i] = G4LorentzVector( Quark_M << 823       //G4cout << "Mom 1 string " << G4endl << Quark_Mom[0] << G4endl << Quark_Mom[2] << G4endl
905       if ( common.RotateStrings ) Quark_4Mom[i << 824       //       << tmp << " " << tmp.mag() << G4endl;
906       Quark_4Mom[i].transform( common.toLab ); << 825       //G4cout << "1 str " << Pstring1 << " " << Pstring1.mag() << " " << Ystring1 << G4endl;
907     }                                          << 826 
                                                   >> 827       tmp = Quark_Mom[1] + Quark_Mom[3];
                                                   >> 828       G4LorentzVector Pstring2( tmp, std::sqrt( Quark_Mom[1].mag2() + MassQ2 ) +
                                                   >> 829                                      std::sqrt( Quark_Mom[3].mag2() + MassQ2 ) );
                                                   >> 830       G4double Ystring2 = Pstring2.rapidity();
                                                   >> 831 
                                                   >> 832       //G4cout << "Mom 2 string " << G4endl <<Quark_Mom[1] << G4endl << Quark_Mom[3] << G4endl
                                                   >> 833       //       << tmp << " " << tmp.mag() << G4endl;
                                                   >> 834       //G4cout << "2 str " << Pstring2 << " " << Pstring2.mag() << " " << Ystring2 << G4endl;
                                                   >> 835 
                                                   >> 836       if ( Ystring1 > Ystring2 ) {
                                                   >> 837         Pprojectile = Pstring1;
                                                   >> 838         Ptarget     = Pstring2;
                                                   >> 839       } else {
                                                   >> 840         Pprojectile = Pstring2;
                                                   >> 841         Ptarget     = Pstring1;
                                                   >> 842       }
908                                                   843 
909     projectile->Splitting();                   << 844       //G4cout << "SumP CMS " << Pprojectile + Ptarget << " " << SqrtS << G4endl;
910     projectile->GetNextAntiParton()->Set4Momen << 845       Pprojectile.transform( toLab );
911     projectile->GetNextParton()->Set4Momentum( << 846       Ptarget.transform( toLab );
912                                                << 847       //G4cout << " SumP Lab " << Pprojectile + Ptarget << " " << SqrtS << G4endl;
913     target->Splitting();                       << 848 
914     target->GetNextParton()->Set4Momentum( Qua << 849       // Calculation of the creation time
915     target->GetNextAntiParton()->Set4Momentum( << 850       projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
                                                   >> 851       projectile->SetPosition( target->GetPosition() );
                                                   >> 852       // Creation time and position of target nucleon were determined in
                                                   >> 853       // ReggeonCascade() of G4FTFModel
                                                   >> 854       //G4cout << "Mproj " << Pprojectile.mag() << G4endl << "Mtarg " << Ptarget.mag() << G4endl;
                                                   >> 855       projectile->Set4Momentum( Pprojectile );
                                                   >> 856       target->Set4Momentum( Ptarget );
                                                   >> 857       projectile->IncrementCollisionCount( 1 );
                                                   >> 858       target->IncrementCollisionCount( 1 );
916                                                   859 
917     // Calculation of the creation time        << 860       return true;
918     // Creation time and position of target nu << 
919     projectile->SetTimeOfCreation( target->Get << 
920     projectile->SetPosition( target->GetPositi << 
921     projectile->Set4Momentum( common.Pprojecti << 
922     target->Set4Momentum( common.Ptarget );    << 
923                                                << 
924     projectile->IncrementCollisionCount( 1 );  << 
925     target->IncrementCollisionCount( 1 );      << 
926                                                   861 
927     return 0;  // Completed successfully: noth << 862     } // End of if ( CandidatsN != 0 )
928   }  // End of if ( CandidatsN != 0 )          << 
929                                                   863 
930   return 1;  // Successfully ended, but the wo << 864   } // End of if ( Ksi < ( X_a + X_b + X_c ) / Xannihilation )
931 }                                              << 
932                                                   865 
                                                   >> 866   // Simulation of anti-quark-quark string creation
933                                                   867 
934 //-------------------------------------------- << 868   if ( Ksi < ( X_a + X_b + X_c + X_d ) / Xannihilation ) {
935                                                   869 
936 G4bool G4FTFAnnihilation::                     << 870     #ifdef debugFTFannih 
937 Create1QuarkAntiQuarkString( G4VSplitableHadro << 871     G4cout << "Process d, only 1 quark - anti-quark string" << G4endl;
938                              G4VSplitableHadro << 872     #endif
939                              G4FTFParameters*  << 
940                              G4FTFAnnihilation << 
941   // Simulation of anti-quark - quark string c << 
942                                                   873 
943   #ifdef debugFTFannih                         << 874     G4int CandidatsN( 0 ), CandAQ[36], CandQ[36];
944   G4cout << "Process d, only 1 quark - anti-qu << 875     G4int LeftAQ( 0 ), LeftQ( 0 );
945   #endif                                       << 
946                                                   876 
947   // Determine the set of candidates anti-quar << 877     for ( G4int iAQ1 = 0; iAQ1 < 3; iAQ1++ ) {
948   // Here "0", "1", "2" means, respectively, " << 878       for ( G4int iAQ2 = 0; iAQ2 < 3; iAQ2++ ) {
949   // of the (anti-baryon) projectile or (nucle << 879         if ( iAQ1 != iAQ2 ) {
950   G4int CandidatsN = 0, CandAQ[36], CandQ[36]; << 880           for ( G4int iQ1 = 0; iQ1 < 3; iQ1++ ) {
951   G4int LeftAQ = 0, LeftQ = 0;                 << 881             for ( G4int iQ2 = 0; iQ2 < 3; iQ2++ ) {
952   for ( G4int iAQ1 = 0; iAQ1 < 3; ++iAQ1 ) {   << 882               if ( iQ1 != iQ2 ) {
953     for ( G4int iAQ2 = 0; iAQ2 < 3; ++iAQ2 ) { << 883                 if ( -AQ[iAQ1] == Q[iQ1]  &&  -AQ[iAQ2] == Q[iQ2] ) {
954       if ( iAQ1 != iAQ2 ) {                    << 884                   if ( iAQ1 == 0  &&  iAQ2 == 1 ) { CandAQ[CandidatsN] = 2; }
955         for ( G4int iQ1 = 0; iQ1 < 3; ++iQ1 )  << 885                   if ( iAQ1 == 1  &&  iAQ2 == 0 ) { CandAQ[CandidatsN] = 2; }
956           for ( G4int iQ2 = 0; iQ2 < 3; ++iQ2  << 886 
957             if ( iQ1 != iQ2 ) {                << 887                   if ( iAQ1 == 0  &&  iAQ2 == 2 ) { CandAQ[CandidatsN] = 1; }
958               if ( -common.AQ[iAQ1] == common. << 888                   if ( iAQ1 == 2  &&  iAQ2 == 0 ) { CandAQ[CandidatsN] = 1; }
959                 if        ( ( iAQ1 == 0  &&  i << 889 
960                   CandAQ[CandidatsN] = 2;      << 890                   if ( iAQ1 == 1  &&  iAQ2 == 2 ) { CandAQ[CandidatsN] = 0; }
961                 } else if ( ( iAQ1 == 0  &&  i << 891                   if ( iAQ1 == 2  &&  iAQ2 == 1 ) { CandAQ[CandidatsN] = 0; }
962                   CandAQ[CandidatsN] = 1;      << 892 
963                 } else if ( ( iAQ1 == 1  &&  i << 893                   if ( iQ1 == 0   &&   iQ2 == 1 ) { CandQ[CandidatsN]  = 2; }
964                   CandAQ[CandidatsN] = 0;      << 894                   if ( iQ1 == 1   &&   iQ2 == 0 ) { CandQ[CandidatsN]  = 2; }
965                 }                              << 895 
966                 if        ( ( iQ1 == 0   &&    << 896                   if ( iQ1 == 0   &&   iQ2 == 2 ) { CandQ[CandidatsN]  = 1; }
967                   CandQ[CandidatsN]  = 2;      << 897                   if ( iQ1 == 2   &&   iQ2 == 0 ) { CandQ[CandidatsN]  = 1; }
968                 } else if ( ( iQ1 == 0   &&    << 898 
969                   CandQ[CandidatsN]  = 1;      << 899                   if ( iQ1 == 1   &&   iQ2 == 2 ) { CandQ[CandidatsN]  = 0; }
970                 } else if ( ( iQ1 == 1   &&    << 900                   if ( iQ1 == 2   &&   iQ2 == 1 ) { CandQ[CandidatsN]  = 0; }
971                   CandQ[CandidatsN]  = 0;      << 901                   CandidatsN++;
972                 }                                 902                 }
973                 ++CandidatsN;                  << 
974               }                                   903               }
975             }                                     904             }
976           }                                       905           }
977         }                                         906         }
978       }                                           907       }
979     }                                             908     }
980   }                                            << 
981                                                << 
982   if ( CandidatsN != 0 ) {                     << 
983     G4int SampledCase = (G4int)G4RandFlat::sho << 
984     LeftAQ = common.AQ[ CandAQ[SampledCase] ]; << 
985     LeftQ  =  common.Q[ CandQ[SampledCase] ];  << 
986                                                << 
987     // Set the string properties               << 
988     projectile->SetFirstParton( LeftQ );       << 
989     projectile->SetSecondParton( LeftAQ );     << 
990     projectile->SetStatus( 0 );                << 
991     G4int aAQ = std::abs( LeftAQ ), aQ = std:: << 
992     G4int NewCode = 0;                         << 
993     G4double aKsi = G4UniformRand();           << 
994     // The string can have the quantum number  << 
995     // of the PDG code is, respectively, 1 and << 
996     if ( aAQ == aQ ) {                         << 
997       if ( aAQ != 3 ) {                        << 
998         NewCode = 111;          // Pi0-meson   << 
999         if ( aKsi < 0.5 ) {                    << 
1000           NewCode = 221;        // Eta -meson << 
1001           if ( aKsi < 0.25 ) {                << 
1002             NewCode = 331;      // Eta'-meson << 
1003           }                                   << 
1004         }                                     << 
1005       } else {                                << 
1006         NewCode = 221;          // Eta -meson << 
1007         if ( aKsi < 0.5 ) {                   << 
1008           NewCode = 331;        // Eta'-meson << 
1009         }                                     << 
1010       }                                       << 
1011     } else {                                  << 
1012       if ( aAQ > aQ ) {                       << 
1013         NewCode = aAQ*100 + aQ*10 + 1; NewCod << 
1014       } else {                                << 
1015         NewCode = aQ*100 + aAQ*10 + 1; NewCod << 
1016       }                                       << 
1017     }                                         << 
1018                                               << 
1019     G4ParticleDefinition* TestParticle = G4Pa << 
1020     if ( ! TestParticle ) return false;       << 
1021     projectile->SetDefinition( TestParticle ) << 
1022     theParameters->SetProjMinDiffMass( 0.5 ); << 
1023     theParameters->SetProjMinNonDiffMass( 0.5 << 
1024                                               << 
1025     target->SetStatus( 4 );  // The target nu << 
1026     common.Pprojectile.setPx( 0.0 );          << 
1027     common.Pprojectile.setPy( 0.0 );          << 
1028     common.Pprojectile.setPz( 0.0 );          << 
1029     common.Pprojectile.setE( common.SqrtS );  << 
1030                                               << 
1031     common.Pprojectile.transform( common.toLa << 
1032                                                  909 
1033     G4LorentzVector Pquark  = G4LorentzVector << 910     if ( CandidatsN != 0 ) {
1034     G4LorentzVector Paquark = G4LorentzVector << 911       G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
1035                                               << 912       LeftAQ = AQ[ CandAQ[SampledCase] ];
1036     if ( common.RotateStrings ) {             << 913       LeftQ  =  Q[ CandQ[SampledCase] ];
1037       Pquark *= common.RandomRotation; Paquar << 914       //G4cout << "Left Aq Q " << LeftAQ << " " << LeftQ << G4endl;
1038     }                                         << 915 
1039     Pquark.transform(common.toLab);  projecti << 916       // Set the string properties
1040     Paquark.transform(common.toLab); projecti << 917       projectile->SplitUp();
1041                                               << 918       //projectile->SetFirstParton( LeftAQ );
1042     projectile->Splitting();                  << 919       //projectile->SetSecondParton( LeftQ );
                                                   >> 920       projectile->SetFirstParton( LeftQ );
                                                   >> 921       projectile->SetSecondParton( LeftAQ );
                                                   >> 922       projectile->SetStatus( 0 );
                                                   >> 923       target->SetStatus( 4 );  // The target nucleon has annihilated 3->4 Uzhi Oct 2014
                                                   >> 924       Pprojectile.setPx( 0.0 );
                                                   >> 925       Pprojectile.setPy( 0.0 );
                                                   >> 926       Pprojectile.setPz( 0.0 );
                                                   >> 927       Pprojectile.setE( SqrtS );
                                                   >> 928       Pprojectile.transform( toLab );
                                                   >> 929 
                                                   >> 930       // Calculation of the creation time
                                                   >> 931       projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
                                                   >> 932       projectile->SetPosition( target->GetPosition() );
                                                   >> 933       // Creation time and position of target nucleon were determined in
                                                   >> 934       // ReggeonCascade() of G4FTFModel
1043                                                  935 
1044     // Calculation of the creation time       << 936       //G4cout << "Mproj " << Pprojectile.mag() << G4endl << "Mtarg " << Ptarget.mag() << G4endl;
1045     // Creation time and position of target n << 937       projectile->Set4Momentum( Pprojectile );
1046     projectile->SetTimeOfCreation( target->Ge << 
1047     projectile->SetPosition( target->GetPosit << 
1048     projectile->Set4Momentum( common.Pproject << 
1049                                                  938 
1050     projectile->IncrementCollisionCount( 1 ); << 939       projectile->IncrementCollisionCount( 1 );
1051     target->IncrementCollisionCount( 1 );     << 940       target->IncrementCollisionCount( 1 );
                                                   >> 941       return true;
                                                   >> 942     }
1052                                                  943 
1053     return true;                              << 944   }  // End of if ( Ksi < ( X_a + X_b + X_c + X_d ) / Xannihilation )
1054   }  // End of if ( CandidatsN != 0 )         << 
1055                                                  945 
                                                   >> 946   //G4cout << "Pr Y " << Pprojectile.rapidity() << " Tr Y " << Ptarget.rapidity() << G4endl;
1056   return true;                                   947   return true;
1057 }                                                948 }
1058                                                  949 
1059                                                  950 
1060 //===========================================    951 //============================================================================
1061                                                  952 
1062 G4double G4FTFAnnihilation::ChooseX( G4double    953 G4double G4FTFAnnihilation::ChooseX( G4double /* Alpha */, G4double /* Beta */ ) const {
1063   // If for sampling Xs other values of Alfa     954   // If for sampling Xs other values of Alfa and Beta instead of 0.5 will be
1064   // chosen the method will be implemented       955   // chosen the method will be implemented
1065   //G4double tmp = Alpha*Beta;                   956   //G4double tmp = Alpha*Beta;
1066   //tmp *= 1.0;                                  957   //tmp *= 1.0;
1067   return 0.5;                                    958   return 0.5;
1068 }                                                959 }
1069                                                  960 
1070                                                  961 
                                                   >> 962 
1071 //===========================================    963 //============================================================================
1072                                                  964 
1073 G4ThreeVector G4FTFAnnihilation::GaussianPt(     965 G4ThreeVector G4FTFAnnihilation::GaussianPt( G4double AveragePt2, G4double maxPtSquare ) const {
1074   //  @@ this method is used in FTFModel as w    966   //  @@ this method is used in FTFModel as well. Should go somewhere common!
1075   G4double Pt2 = 0.0;                         << 967   G4double Pt2( 0.0 );
1076   if ( AveragePt2 <= 0.0 ) {                     968   if ( AveragePt2 <= 0.0 ) {
1077     Pt2 = 0.0;                                   969     Pt2 = 0.0;
1078   } else {                                       970   } else {
1079     Pt2 = -AveragePt2 * G4Log( 1.0 + G4Unifor    971     Pt2 = -AveragePt2 * G4Log( 1.0 + G4UniformRand() * 
1080                                         ( G4E    972                                         ( G4Exp( -maxPtSquare/AveragePt2 ) -1.0 ) );
1081   }                                              973   }
1082   G4double Pt = std::sqrt( Pt2 );                974   G4double Pt = std::sqrt( Pt2 );
1083   G4double phi = G4UniformRand() * twopi;        975   G4double phi = G4UniformRand() * twopi;
1084   return G4ThreeVector ( Pt*std::cos( phi ),     976   return G4ThreeVector ( Pt*std::cos( phi ), Pt*std::sin( phi ), 0.0 );
1085 }                                                977 }
1086                                                  978 
1087                                                  979 
1088 //===========================================    980 //============================================================================
1089                                                  981 
1090 void G4FTFAnnihilation::UnpackBaryon( G4int I    982 void G4FTFAnnihilation::UnpackBaryon( G4int IdPDG, G4int& Q1, G4int& Q2, G4int& Q3 ) const {
1091   G4int AbsId = std::abs( IdPDG );               983   G4int AbsId = std::abs( IdPDG );
1092   Q1 =   AbsId          / 1000;                  984   Q1 =   AbsId          / 1000;
1093   Q2 = ( AbsId % 1000 ) / 100;                   985   Q2 = ( AbsId % 1000 ) / 100;
1094   Q3 = ( AbsId % 100 )  / 10;                    986   Q3 = ( AbsId % 100 )  / 10;     
1095   if ( IdPDG < 0 ) { Q1 = -Q1; Q2 = -Q2; Q3 =    987   if ( IdPDG < 0 ) { Q1 = -Q1; Q2 = -Q2; Q3 = -Q3; }  // Anti-baryon     
1096   return;                                        988   return;
1097 }                                                989 }
1098                                                  990 
1099                                                  991 
1100 //===========================================    992 //============================================================================
1101                                                  993 
1102 G4FTFAnnihilation::G4FTFAnnihilation( const G    994 G4FTFAnnihilation::G4FTFAnnihilation( const G4FTFAnnihilation& ) {
1103   throw G4HadronicException( __FILE__, __LINE    995   throw G4HadronicException( __FILE__, __LINE__, 
1104                              "G4FTFAnnihilati << 996                              "G4FTFAnnihilation copy contructor not meant to be called" );
1105 }                                                997 }
1106                                                  998 
1107                                                  999 
1108 //===========================================    1000 //============================================================================
1109                                                  1001 
1110 const G4FTFAnnihilation & G4FTFAnnihilation::    1002 const G4FTFAnnihilation & G4FTFAnnihilation::operator=( const G4FTFAnnihilation& ) {
1111   throw G4HadronicException( __FILE__, __LINE    1003   throw G4HadronicException( __FILE__, __LINE__, 
1112                              "G4FTFAnnihilati    1004                              "G4FTFAnnihilation = operator not meant to be called" ); 
1113 }                                                1005 }
1114                                                  1006 
1115                                                  1007 
1116 //===========================================    1008 //============================================================================
1117                                                  1009 
1118 G4bool G4FTFAnnihilation::operator==( const G << 1010 int G4FTFAnnihilation::operator==( const G4FTFAnnihilation& ) const {
1119   throw G4HadronicException( __FILE__, __LINE    1011   throw G4HadronicException( __FILE__, __LINE__, 
1120                              "G4FTFAnnihilati    1012                              "G4FTFAnnihilation == operator not meant to be called" );
1121 }                                                1013 }
1122                                                  1014 
1123                                                  1015 
1124 //===========================================    1016 //============================================================================
1125                                                  1017 
1126 G4bool G4FTFAnnihilation::operator!=( const G << 1018 int G4FTFAnnihilation::operator!=( const G4FTFAnnihilation& ) const {
1127   throw G4HadronicException( __FILE__, __LINE    1019   throw G4HadronicException( __FILE__, __LINE__, 
1128                              "G4DiffractiveEx    1020                              "G4DiffractiveExcitation != operator not meant to be called" );
1129 }                                                1021 }
1130                                                  1022