99   #ifdef debugFTFexictation   105   if ( Pprojectile.
z() < 0.0 ) 
return false;
   108   G4int absProjectilePDGcode = std::abs( ProjectilePDGcode );
   115   G4int absTargetPDGcode = std::abs( TargetPDGcode );
   128   G4bool PutOnMassShell( 
false );
   135   if ( M0projectile < MminProjectile ) 
   137     PutOnMassShell = 
true;
   141   G4double M0projectile2 = M0projectile * M0projectile;
   144   if ( M0projectile > ProjectileDiffStateMinMass ) {                               
   145     ProjectileDiffStateMinMass    = M0projectile + 220.0*
MeV;
   146     ProjectileNonDiffStateMinMass = M0projectile + 220.0*
MeV;
   147     if(absProjectilePDGcode > 3000) {                          
   148       ProjectileDiffStateMinMass    += 140.0*
MeV;                                  
   149       ProjectileNonDiffStateMinMass += 140.0*
MeV;                                  
   155   if ( M0target < MminTarget ) 
   157     PutOnMassShell = 
true;
   161   G4double M0target2 = M0target * M0target; 
   164   if ( M0target > TargetDiffStateMinMass ) {                                       
   165     TargetDiffStateMinMass    = M0target + 220.0*
MeV;
   166     TargetNonDiffStateMinMass = M0target + 220.0*
MeV;
   167     if(absTargetPDGcode > 3000) {                          
   168       TargetDiffStateMinMass    += 140.0*
MeV;                                      
   169       TargetNonDiffStateMinMass += 140.0*
MeV;                                      
   173   #ifdef debugFTFexictation   174   G4cout << 
"Proj Targ PDGcodes " << ProjectilePDGcode << 
" " << TargetPDGcode << G4endl
   175          << 
"M0projectile Y " << M0projectile << 
" " << ProjectileRapidity << 
G4endl;
   177   G4cout << 
"Pproj " << Pprojectile << G4endl << 
"Ptarget " << Ptarget << 
G4endl;
   183   G4double SumMasses = M0projectile + M0target; 
   189   if ( Ptmp.pz() <= 0.0 ) 
return false;        
   191   toCms.
rotateZ( -1*Ptmp.phi() );
   192   toCms.
rotateY( -1*Ptmp.theta() );
   199   #ifdef debugFTFexictation   200   G4cout << 
"SqrtS     " << SqrtS << G4endl << 
"M0pr M0tr SumM+220 " << M0projectile << 
" "   201          << M0target << 
" " << SumMasses << 
G4endl;
   204   if ( SqrtS < M0projectile + M0target ) 
return false;
   205   if ( SqrtS < SumMasses ) 
return false;
   208   PZcms2 = ( S*S + M0projectile2*M0projectile2 + M0target2*M0target2
   209              - 2*S*M0projectile2 - 2*S*M0target2 - 2*M0projectile2*M0target2 ) / 4.0 / S;
   211   #ifdef debugFTFexictation   212   G4cout << 
"PZcms2 after PutOnMassShell " << PZcms2 << 
G4endl;
   215   if ( PZcms2 < 0 ) 
return false;
   218   PZcms = std::sqrt( PZcms2 );
   219   if ( PutOnMassShell ) {
   220     if ( Pprojectile.z() > 0.0 ) {
   221       Pprojectile.setPz(  PZcms );
   222       Ptarget.setPz(     -PZcms );
   224       Pprojectile.setPz( -PZcms );
   225       Ptarget.setPz(      PZcms );
   227     Pprojectile.setE( std::sqrt( M0projectile2 +
   228                                  Pprojectile.x()*Pprojectile.x() +
   229                                  Pprojectile.y()*Pprojectile.y() +
   231     Ptarget.setE( std::sqrt( M0target2 +
   232                              Ptarget.x()*Ptarget.x() +
   233                              Ptarget.y()*Ptarget.y() +
   246   #ifdef debugFTFexictation   247   G4cout << 
"Start --------------------" << G4endl << 
"Proj M0 Mdif Mndif " << M0projectile 
   248          << 
" " << ProjectileDiffStateMinMass << 
"  " << ProjectileNonDiffStateMinMass << G4endl
   249          << 
"Targ M0 Mdif Mndif " << M0target << 
" " << TargetDiffStateMinMass << 
" "    250          << TargetNonDiffStateMinMass << G4endl << 
"SqrtS " << SqrtS << G4endl
   251          << 
"Proj CMS " << Pprojectile << G4endl << 
"Targ CMS " << Ptarget << 
G4endl;
   270   if(QeNoExc+QeExc+ProbProjectileDiffraction+ProbTargetDiffraction > 1.)   
   271     {QeNoExc=1.0-QeExc-ProbProjectileDiffraction-ProbTargetDiffraction;}
   274   if ( QeExc + QeNoExc != 0.0 ) ProbExc = QeExc/(QeExc + QeNoExc);
   280   G4double ProbOfDiffraction = ProbProjectileDiffraction + ProbTargetDiffraction;
   282   #ifdef debugFTFexictation   283   G4cout << 
"Proc Probs " << QeNoExc << 
" " << QeExc << 
" " << ProbProjectileDiffraction
   284          << 
" " << ProbTargetDiffraction << G4endl 
   285          << 
"ProjectileRapidity " << ProjectileRapidity << 
G4endl;
   292   if ( 1.0 - QeExc - QeNoExc > 0.0 ) { 
   293     ProbProjectileDiffraction /= ( 1.0 - QeExc - QeNoExc );
   294     ProbTargetDiffraction     /= ( 1.0 - QeExc - QeNoExc );
   299     #ifdef debugFTFexictation   300     G4cout << 
"Q exchange --------------------------" << 
G4endl;
   303     G4int NewProjCode( 0 ), NewTargCode( 0 );
   304     G4int ProjQ1( 0 ), ProjQ2( 0 ), ProjQ3( 0 );
   307     if ( absProjectilePDGcode < 1000 ) {  
   310       UnpackBaryon( ProjectilePDGcode, ProjQ1, ProjQ2, ProjQ3 );
   314     G4int TargQ1( 0 ), TargQ2( 0 ), TargQ3( 0 );
   317     #ifdef debugFTFexictation   318     G4cout << 
"Proj Quarks " << ProjQ1 << 
" " << ProjQ2 << 
" " << ProjQ3 << G4endl
   319            << 
"Targ Quarks " << TargQ1 << 
" " << TargQ2 << 
" " << TargQ3 << 
G4endl;
   323     G4int ProjExchangeQ( 0 );
   324     G4int TargExchangeQ( 0 );
   326     if ( absProjectilePDGcode < 1000 ) 
   331         ProjExchangeQ = ProjQ1;
   333         G4int NpossibleStates=3; 
   336         if(ProjQ1 != TargQ1) NpossibleStates++;
   337         if(ProjQ1 != TargQ2) NpossibleStates++;
   338         if(ProjQ1 != TargQ3) NpossibleStates++;  
   340         G4int Nsampled = G4RandFlat::shootInt( 
G4long( NpossibleStates ) ) + 1;
   347          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ; ProjQ1 = TargExchangeQ;}
   352          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ; ProjQ1 = TargExchangeQ;}
   357          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ; ProjQ1 = TargExchangeQ;}
   367         ProjExchangeQ = ProjQ2;
   369         G4int NpossibleStates=3; 
   372         if(ProjQ2 != TargQ1) NpossibleStates++;
   373         if(ProjQ2 != TargQ2) NpossibleStates++;
   374         if(ProjQ2 != TargQ3) NpossibleStates++;  
   376         G4int Nsampled = G4RandFlat::shootInt( 
G4long( NpossibleStates ) ) + 1;
   382          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ; ProjQ2 = TargExchangeQ;}
   387          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ; ProjQ2 = TargExchangeQ;}
   392          if(NpossibleStates == Nsampled) {TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ; ProjQ2 = TargExchangeQ;}
   401       #ifdef debugFTFexictation   402       G4cout << 
"Exchanged Qs in Pr Tr " << ProjExchangeQ << 
" " << TargExchangeQ << 
G4endl;
   405       G4int aProjQ1 = std::abs( ProjQ1 );
   406       G4int aProjQ2 = std::abs( ProjQ2 );
   408       G4bool ProjExcited = 
false;                                          
   417        if ( aProjQ1 == aProjQ2 ) 
   425              if ( Ksi < 0.25 ) {NewProjCode = 331;} 
   430            if( Ksi < 0.5 ) {NewProjCode = 331;}    
   434          if ( aProjQ1 > aProjQ2 ) 
   436            NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
   439            NewProjCode = aProjQ2*100 + aProjQ1*10 + 1;
   443        #ifdef debugFTFexictation   456        if     ( aProjQ1 == 1 ) {Qquarks -= ProjQ1;}
   457        else if( aProjQ1 == 2 ) {Qquarks += ProjQ1;}
   458        else                    {Qquarks -= ProjQ1/aProjQ1;}
   460        if     ( aProjQ2 == 1 ) {Qquarks -= ProjQ2;}
   461        else if( aProjQ2 == 2 ) {Qquarks += ProjQ2;}
   462        else                    {Qquarks -= ProjQ2/aProjQ2;}
   464        if( Qquarks < 0 ) NewProjCode *=(-1);
   467        #ifdef debugFTFexictation   468        G4cout << 
"NewProjCode +2 or 0 " << NewProjCode << 
G4endl;
   469        G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
   471        G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
   476        if(!TestParticle) 
continue;
   481        if(SqrtS-M0target < MminProjectile) 
continue;
   486        #ifdef debugFTFexictation   489        G4cout << 
"M0projectile projectile PDGMass " << M0projectile << 
" "    496        #ifdef debugFTFexictation   497        G4cout << 
"New TrQ " << TargQ1 << 
" " << TargQ2 << 
" " << TargQ3 << G4endl
   498               << 
"NewTargCode " << NewTargCode << 
G4endl;
   501        if( TargQ1 != TargQ2  &&  TargQ1 != TargQ3  &&  TargQ2 != TargQ3 ) 
   506        else if( TargQ1 == TargQ2  &&  TargQ1 == TargQ3 ) 
   508                NewTargCode += 2; ProjExcited = 
true;                   
   511          {NewTargCode += 2; ProjExcited = 
true;}                       
   513        } 
else if ( ! ProjExcited  &&
   515                    SqrtS > M0projectile + DeltaMass ) {                
   521        if(!TestParticle) 
continue;
   523        #ifdef debugFTFexictation   529        if(SqrtS-MtestPr < MminTarget) 
continue;
   533        if(SqrtS > MtestPr+MtestTr) 
break;
   536       if(attempts >= 50) 
return false; 
   547       if ( MtestPr >= Pprojectile.mag() ) {M0projectile = MtestPr;}                            
   548       else if (projectile->
GetStatus() != 0  ) {M0projectile = MtestPr;}                       
   551       #ifdef debugFTFexictation   552       G4cout << 
"M0projectile After check " << M0projectile << 
G4endl;
   555       M0projectile2 = M0projectile * M0projectile;
   556       ProjectileDiffStateMinMass    = M0projectile + 220.0*
MeV;  
   557       ProjectileNonDiffStateMinMass = M0projectile + 220.0*
MeV;  
   559       if ( MtestTr >= Ptarget.mag()     ) {M0target = MtestTr;}                                
   560       else if (target->
GetStatus() != 0 ) {M0target = MtestTr;}                                
   572       M0target2 = M0target * M0target;
   574       #ifdef debugFTFexictation   575       G4cout << 
"New targ M0 M0^2 " << M0target << 
" " << M0target2 << 
G4endl;
   578       TargetDiffStateMinMass    = M0target + 220.0*
MeV;          
   579       TargetNonDiffStateMinMass = M0target + 220.0*
MeV;          
   592         if ( Ksi < 0.333333 ) {
   593           ProjExchangeQ = ProjQ1;
   594         } 
else if ( 0.333333 <= Ksi  &&  Ksi < 0.666667 ) {
   595           ProjExchangeQ = ProjQ2;
   597           ProjExchangeQ = ProjQ3;
   601           TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ; ProjExchangeQ = TargExchangeQ;
   604             TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ; ProjExchangeQ = TargExchangeQ;
   606             TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ; ProjExchangeQ = TargExchangeQ;
   610         #ifdef debugFTFexictation   611         G4cout << 
"Exchange Qs Pr  Tr " << ProjExchangeQ << 
" " << TargExchangeQ << 
G4endl;
   614         if ( Ksi < 0.333333 ) {
   615           ProjQ1 = ProjExchangeQ;
   616         } 
else if ( 0.333333 <= Ksi  &&  Ksi < 0.666667 ) {
   617           ProjQ2 = ProjExchangeQ;
   619           ProjQ3 = ProjExchangeQ;
   624         if ( Ksi < 0.333333 ) {
   625           TargExchangeQ = TargQ1;
   626         } 
else if ( 0.333333 <= Ksi  &&  Ksi < 0.666667 ) {
   627           TargExchangeQ = TargQ2;
   629           TargExchangeQ = TargQ3;
   632           ProjExchangeQ = ProjQ1; ProjQ1 = TargExchangeQ; TargExchangeQ = ProjExchangeQ;
   635             ProjExchangeQ = ProjQ2; ProjQ2 = TargExchangeQ; TargExchangeQ = ProjExchangeQ;
   637             ProjExchangeQ = ProjQ3; ProjQ3 = TargExchangeQ; TargExchangeQ = ProjExchangeQ;
   641         if ( Ksi < 0.333333 ) {
   642           TargQ1 = TargExchangeQ;
   643         } 
else if ( 0.333333 <= Ksi  &&  Ksi < 0.666667 )  {
   644           TargQ2 = TargExchangeQ;
   646           TargQ3 = TargExchangeQ;
   659        if ( ProjQ1 == ProjQ2  &&  ProjQ1 == ProjQ3 ) {
   668          if ( 
G4UniformRand() < DeltaProbAtQuarkExchange  &&  SqrtS > DeltaMass + M0target ) {
   675        if ( TargQ1 == TargQ2  &&  TargQ1 == TargQ3 ) { 
   684          if ( 
G4UniformRand() < DeltaProbAtQuarkExchange  &&  SqrtS > M0projectile + DeltaMass ) {
   691        #ifdef debugFTFexictation   692        G4cout << 
"NewProjCode NewTargCode " << NewProjCode << 
" " << NewTargCode << 
G4endl;
   696        if ( absProjectilePDGcode == NewProjCode  &&  absTargetPDGcode == NewTargCode ) { 
   726        if(!TestParticle) 
continue;
   730        if(SqrtS-M0target < MminProjectile) 
continue;
   736        if(!TestParticle) 
continue;
   740        if(SqrtS-MtestPr < MminTarget) 
continue;
   744        if(SqrtS > MtestPr+MtestTr) 
break;
   747       if(attempts >= 50) 
return false; 
   749       if ( MtestPr >= Pprojectile.mag() ) {M0projectile = MtestPr;}
   750       else if (projectile->
GetStatus() != 0  ) {M0projectile = MtestPr;}        
   751       M0projectile2 = M0projectile * M0projectile;
   752       ProjectileDiffStateMinMass =    M0projectile + 220.0*
MeV;  
   753       ProjectileNonDiffStateMinMass = M0projectile + 220.0*
MeV;  
   755       if ( MtestTr >= Ptarget.mag()     ) {M0target = MtestTr;}
   756       else if (target->
GetStatus() != 0 ) {M0target = MtestTr;}                 
   757       M0target2 = M0target * M0target;
   758       TargetDiffStateMinMass    = M0target + 220.0*
MeV;          
   759       TargetNonDiffStateMinMass = M0target + 220.0*
MeV;          
   766     if ( SqrtS < M0projectile + M0target ) 
return false;
   768     PZcms2 = ( S*S + M0projectile2*M0projectile2 + M0target2*M0target2
   769                - 2*S*M0projectile2 - 2*S*M0target2 - 2*M0projectile2*M0target2 ) / 4.0 / S;
   771     #ifdef debugFTFexictation   772     G4cout << 
"At the end// NewProjCode " << NewProjCode << G4endl 
   773            << 
"At the end// NewTargCode " << NewTargCode << G4endl
   774            << 
"M0pr  M0tr  SqS " << M0projectile << 
" " << M0target << 
" " << SqrtS << G4endl
   775            << 
"M0pr2 M0tr2 SqS " << M0projectile2 << 
" " << M0target2 << 
" " << SqrtS << G4endl
   776            << 
"PZcms2 after the change " << PZcms2 << G4endl << 
G4endl;
   779     if ( PZcms2 < 0 ) 
return false;  
   784     PZcms = std::sqrt( PZcms2 );
   785     Pprojectile.setPz( PZcms );
   786     Pprojectile.setE( std::sqrt( M0projectile2 + PZcms2 ) );
   787     Ptarget.setPz(    -PZcms );
   788     Ptarget.setE( std::sqrt( M0target2 + PZcms2 ) );
   793     #ifdef debugFTFexictation   794     G4cout << 
"Proj Targ and Proj+Targ in CMS" << G4endl << Pprojectile << G4endl << Ptarget
   795            << G4endl << Pprojectile + Ptarget << 
G4endl;
   799     if((SqrtS < M0projectile + TargetDiffStateMinMass) ||             
   800        (SqrtS < ProjectileDiffStateMinMass + M0target) ||
   801        (ProbOfDiffraction == 0.)                         ) ProbExc=0.;
   805       #ifdef debugFTFexictation   806       G4cout << 
"Make elastic scattering of new hadrons" << 
G4endl;
   809       Pprojectile.transform( toLab );
   810       Ptarget.transform( toLab );
   817       #ifdef debugFTFexictation   818       G4cout << 
"Result of el. scatt " << Result << G4endl << 
"Proj Targ and Proj+Targ in Lab"   828     #ifdef debugFTFexictation   834     ProbOfDiffraction = ProbProjectileDiffraction + ProbTargetDiffraction; 
   835     if ( ProbOfDiffraction != 0.0 ) {
   836       ProbProjectileDiffraction /= ProbOfDiffraction;
   837       ProbTargetDiffraction     /= ProbOfDiffraction;
   842   ProbOfDiffraction = ProbProjectileDiffraction + ProbTargetDiffraction;
   844   #ifdef debugFTFexictation   845   G4cout << 
"Excitation --------------------" << G4endl
   846          << 
"Proj M0 MdMin MndMin " << M0projectile << 
" " << ProjectileDiffStateMinMass << 
"  "   847          << ProjectileNonDiffStateMinMass << G4endl
   848          << 
"Targ M0 MdMin MndMin " << M0target << 
" " << TargetDiffStateMinMass << 
" "    849          << TargetNonDiffStateMinMass << G4endl << 
"SqrtS " << SqrtS << G4endl
   850          << 
"Prob: ProjDiff TargDiff + Sum " << ProbProjectileDiffraction << 
" "    851          << ProbTargetDiffraction << 
" " << ProbOfDiffraction << 
G4endl;
   854   if ( ProbOfDiffraction != 0.0 ) {
   855     ProbProjectileDiffraction /= ProbOfDiffraction;
   857     ProbProjectileDiffraction = 0.0;
   860   #ifdef debugFTFexictation   861   G4cout << 
"Prob: ProjDiff TargDiff + Sum " << ProbProjectileDiffraction << 
" "    862          << ProbTargetDiffraction << 
" " << ProbOfDiffraction << 
G4endl;
   865   G4double ProjectileDiffStateMinMass2    = 
sqr( ProjectileDiffStateMinMass );
   866   G4double ProjectileNonDiffStateMinMass2 = 
sqr( ProjectileNonDiffStateMinMass );
   867   G4double TargetDiffStateMinMass2        = 
sqr( TargetDiffStateMinMass );
   868   G4double TargetNonDiffStateMinMass2     = 
sqr( TargetNonDiffStateMinMass );
   876   G4double PMinusNew, PPlusNew, TPlusNew, TMinusNew;
   879   G4int whilecount = 0;  
   886       #ifdef debugFTFexictation   901         if ( whilecount > 1000 ) {
   907         ProjMassT2 = ProjectileDiffStateMinMass2;
   908         ProjMassT  = ProjectileDiffStateMinMass;
   909         TargMassT2 = M0target2;
   910         TargMassT  = M0target;
   911         if ( SqrtS < ProjMassT + TargMassT ) 
return false;
   913         PZcms2 =( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
   914                   - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
   916         if ( PZcms2 < 0 ) 
return false; 
   918         maxPtSquare = PZcms2;
   923         ProjMassT2 = ProjectileDiffStateMinMass2 + Pt2;
   924         ProjMassT = std::sqrt( ProjMassT2 );
   925         TargMassT2 = M0target2 + Pt2;
   926         TargMassT = std::sqrt( TargMassT2 );
   927         if ( SqrtS < ProjMassT + TargMassT ) 
continue;
   929         PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
   930                    - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
   932         if ( PZcms2 < 0 ) 
continue;
   934         PZcms = std::sqrt( PZcms2 );
   935         PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
   936         PMinusMax = SqrtS - TargMassT;
   939         PMinusNew = 
ChooseP( PMinusMin, PMinusMax );
   941         TMinusNew = SqrtS - PMinusNew;
   942         Qminus = Ptarget.minus() - TMinusNew;
   943         TPlusNew = TargMassT2 / TMinusNew;
   944         Qplus = Ptarget.plus() - TPlusNew;
   945         Qmomentum.
setPz( (Qplus - Qminus)/2 );
   946         Qmomentum.
setE(  (Qplus + Qminus)/2 );
   948       } 
while ( ( Pprojectile + Qmomentum ).mag2() <  ProjectileDiffStateMinMass2 );  
   959       #ifdef debugFTFexictation   974         if ( whilecount > 1000 ) {
   980         ProjMassT2 = M0projectile2;
   981         ProjMassT  = M0projectile;
   983         TargMassT2 = TargetDiffStateMinMass2;
   984         TargMassT  = TargetDiffStateMinMass;
   986         if ( SqrtS < ProjMassT + TargMassT ) 
return false;
   988         PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
   989                    - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
   991         if ( PZcms2 < 0 ) 
return false; 
   993         maxPtSquare = PZcms2;
   998         ProjMassT2 = M0projectile2 + Pt2;
   999         ProjMassT  = std::sqrt( ProjMassT2 );
  1000         TargMassT2 = TargetDiffStateMinMass2 + Pt2;
  1001         TargMassT  = std::sqrt( TargMassT2 );
  1002         if ( SqrtS < ProjMassT + TargMassT ) 
continue;
  1004         PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
  1005                    - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
  1007         if ( PZcms2 < 0 ) 
continue;
  1009         PZcms = std::sqrt( PZcms2 );
  1010         TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
  1012         TPlusMax = SqrtS - ProjMassT;
  1014         TPlusNew = 
ChooseP( TPlusMin, TPlusMax );
  1017         PPlusNew = SqrtS - TPlusNew;
  1018         Qplus = PPlusNew - Pprojectile.plus();
  1019         PMinusNew = ProjMassT2 / PPlusNew;
  1020         Qminus = PMinusNew - Pprojectile.minus();
  1021         Qmomentum.
setPz( (Qplus - Qminus)/2 );
  1022         Qmomentum.
setE(  (Qplus + Qminus)/2 );
  1024       } 
while ( ( Ptarget - Qmomentum ).mag2() <  TargetDiffStateMinMass2 );  
  1037     #ifdef debugFTFexictation  1052       if ( whilecount > 1000 ) {
  1058       ProjMassT2 = ProjectileNonDiffStateMinMass2;
  1059       ProjMassT  = ProjectileNonDiffStateMinMass;
  1060       TargMassT2 = TargetNonDiffStateMinMass2;
  1061       TargMassT  = TargetNonDiffStateMinMass;
  1062       if ( SqrtS < ProjMassT + TargMassT ) 
return false;
  1064       PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
  1065                  - 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
  1067       if ( PZcms2 < 0 ) 
return false; 
  1069       maxPtSquare = PZcms2;
  1074       ProjMassT2 = ProjectileNonDiffStateMinMass2 + Pt2;
  1075       ProjMassT  = std::sqrt( ProjMassT2 );
  1076       TargMassT2 = TargetNonDiffStateMinMass2 + Pt2;
  1077       TargMassT  = std::sqrt( TargMassT2 );
  1078       if ( SqrtS < ProjMassT + TargMassT ) 
continue;
  1080       PZcms2 =( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
  1081                 -2.0*S*ProjMassT2 - 2.0*S*TargMassT2 -2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
  1083       if ( PZcms2 < 0 ) 
continue;
  1085       PZcms = std::sqrt( PZcms2 );
  1086       PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
  1088       PMinusMax = SqrtS - TargMassT;
  1090       TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
  1092       TPlusMax = SqrtS - ProjMassT;                              
  1106         PMinusNew = 
ChooseP( PMinusMin, PMinusMax );
  1107         TPlusNew = 
ChooseP( TPlusMin, TPlusMax );
  1109         PMinusNew = ( PMinusMax - PMinusMin )*
G4UniformRand() + PMinusMin;
  1110         TPlusNew = ( TPlusMax - TPlusMin )*
G4UniformRand() + TPlusMin;
  1113       Qminus = PMinusNew - Pprojectile.minus();
  1115       Qplus = -( TPlusNew - Ptarget.plus() );
  1116       Qmomentum.
setPz( (Qplus - Qminus)/2 );
  1117       Qmomentum.
setE(  (Qplus + Qminus)/2 );
  1119       #ifdef debugFTFexictation  1120       G4cout << ( Pprojectile + Qmomentum ).mag2() << 
" " << ProjectileNonDiffStateMinMass2
  1121              << G4endl << ( Ptarget - Qmomentum ).mag2() << 
" "  1122              << TargetNonDiffStateMinMass2 << 
G4endl;
  1127     } 
while ( ( Pprojectile + Qmomentum ).mag2() <  ProjectileNonDiffStateMinMass2  ||  
  1128               ( Ptarget     - Qmomentum ).mag2() <  TargetNonDiffStateMinMass2      ||  
  1129               ( Pprojectile + Qmomentum ).pz()   <  0.);  
  1136   Pprojectile += Qmomentum;
  1137   Ptarget     -= Qmomentum;
  1161   #ifdef debugFTFexictation  1162   G4cout << 
"Mproj " << Pprojectile.mag() << G4endl << 
"Mtarg " << Ptarget.mag() << 
G4endl;
  1195   if ( start == NULL ) { 
  1196     G4cout << 
" G4FTFModel::String() Error: No start parton found" << 
G4endl;
  1197     FirstString = 0; SecondString = 0;
  1202   if ( end == NULL ) { 
  1203     G4cout << 
" G4FTFModel::String() Error: No end parton found" <<  
G4endl;
  1204     FirstString = 0; SecondString = 0;
  1225   if ( isProjectile ) {
  1257       if ( Pt > 500.0*
MeV ) {
  1261         x3 = 1.0 - Pt/W * 
G4Exp(-Y );
  1265         if ( PDGcode_startQ <  3 ) Mass_startQ =  325.0*
MeV;
  1266         if ( PDGcode_startQ == 3 ) Mass_startQ =  500.0*
MeV;
  1267         if ( PDGcode_startQ == 4 ) Mass_startQ = 1600.0*
MeV;
  1269         if ( PDGcode_endQ <  3 ) Mass_endQ =  325.0*
MeV;
  1270         if ( PDGcode_endQ == 3 ) Mass_endQ =  500.0*
MeV;
  1271         if ( PDGcode_endQ == 4 ) Mass_endQ = 1600.0*
MeV;
  1273         G4double P2_1 = W2*x1*x1/4.0 - Mass_endQ*Mass_endQ;
  1274         G4double P2_3 = W2*x3*x3/4.0 - Mass_startQ*Mass_startQ;
  1276         if ( P2_1 <= 0.0  ||  P2_3 <= 0.0 ) { 
  1282           G4double CosT12 = ( P2_3 - P2_1 - P2_2 ) / (2.0*P_1*P_2);
  1283           G4double CosT13 = ( P2_2 - P2_1 - P2_3 ) / (2.0*P_1*P_3);
  1286           if ( std::abs( CosT12 ) > 1.0  ||  std::abs( CosT13 ) > 1.0 ) {
  1290             Pt = P_2 * std::sqrt( 1.0 - CosT12*CosT12 );  
  1294             Pstart.
setE( x3*W/2.0 );                
  1296             Pend.
setE( x1*W/2.0 );
  1299             if ( Pkink.
getZ() > 0.0 ) {
  1301                 PkinkQ1 = XkQ*Pkink;
  1303                 PkinkQ1 = (1.0 - XkQ)*Pkink;
  1307                 PkinkQ1 = (1.0 - XkQ)*Pkink;
  1309                 PkinkQ1 = XkQ*Pkink;
  1313             PkinkQ2 = Pkink - PkinkQ1;
  1316                                std::sqrt( 
sqr( 
sqr(x1) - 
sqr(x3) ) + 
sqr( 2.0*x1*x3*CosT13 ) );
  1317             G4double Psi = std::acos( Cos2Psi );
  1320             if ( isProjectile ) {
  1347     std::vector< G4double > QuarkProbabilitiesAtGluonSplitUp = 
  1351     for ( 
unsigned int Iq = 0; Iq < 3; Iq++ ) {
  1353       if ( Ksi > QuarkProbabilitiesAtGluonSplitUp[Iq] ) QuarkInGluon++;
  1378     G4int absPDGcode = 1500;  
  1385     if ( absPDGcode < 1000 ) {  
  1386       if ( isProjectile ) { 
  1420       if ( isProjectile ) {  
  1485     if ( Momentum > 0.0 ) {
  1491       tmp.
set( 0.0, 0.0, 1.0 );
  1495     if ( isProjectile ) {
  1496       Pstart1 *= (-1.0)*Minus/2.0;
  1497       Pend1   *= (+1.0)*Plus /2.0;
  1499       Pstart1 *= (+1.0)*Plus/ 2.0;
  1500       Pend1   *= (-1.0)*Minus/2.0;
  1502     Momentum = -Pstart1.
mag();
  1503     Pstart1.
setT( Momentum );  
  1504     Momentum = -Pend1.
mag();
  1505     Pend1.
setT( Momentum );    
  1520          << 
" generated string momenta: Diquark " << end->
Get4Momentum() << 
"mass : "   1522          << Pstart + Pend << 
G4endl << 
" Original                          "   1536   if ( Pmin <= 0.0 || range <= 0.0 ) {
  1537     G4cout << 
" Pmin, range : " << Pmin << 
" , " << range << 
G4endl;
  1539                                "G4DiffractiveExcitation::ChooseP : Invalid arguments " );
  1552   if ( AveragePt2 <= 0.0 ) {
  1556                                         ( 
G4Exp( -maxPtSquare/AveragePt2 ) - 1.0 ) );
  1560   return G4ThreeVector( Pt * std::cos( phi ), Pt * std::sin( phi ), 0.0 );
  1568   const G4int maxNumberOfLoops = 10000;
  1569   G4int loopCounter = 0;
  1572     yf = z*z + 
sqr(1.0 - z);
  1574             ++loopCounter < maxNumberOfLoops );  
  1575   if ( loopCounter >= maxNumberOfLoops ) {
  1576     z = 0.5*(zmin + zmax);  
  1585   G4int absIdPDG = std::abs( IdPDG );
  1586   if(!((absIdPDG == 111)||(absIdPDG == 221)||(absIdPDG == 331)))         
  1588    Q1 =  absIdPDG / 100;
  1589    Q2 = (absIdPDG % 100) / 10;
  1591    if ( IdPDG < 0 ) anti *= -1;
  1598    else                        {Q1 = 2; Q2 = -2;}
  1609   Q2 = (IdPDG % 1000) / 100;
  1610   Q3 = (IdPDG % 100)  / 10;
  1623   } 
else if ( Q3 > Q1 ) {
  1633   G4int NewCode = Q1*1000 + Q2*100 + Q3*10 + 2; 
  1642                              "G4DiffractiveExcitation copy contructor not meant to be called" );
  1650                              "G4DiffractiveExcitation = operator not meant to be called" );
  1659                              "G4DiffractiveExcitation == operator not meant to be called" );
  1667                              "G4DiffractiveExcitation != operator not meant to be called" );
 
void set(double x, double y, double z)
 
static G4Pow * GetInstance()
 
const G4ThreeVector & GetPosition() const
 
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
 
const G4LorentzVector & Get4Momentum() const
 
virtual G4bool ExciteParticipants(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters, G4ElasticHNScattering *theElastic) const
 
G4double ChooseP(G4double Pmin, G4double Pmax) const
 
G4double GetProjMinDiffMass()
 
int operator==(const G4DiffractiveExcitation &right) const
 
CLHEP::Hep3Vector G4ThreeVector
 
void UnpackBaryon(G4int IdPDG, G4int &Q1, G4int &Q2, G4int &Q3) const
 
G4int GetSoftCollisionCount()
 
virtual void CreateStrings(G4VSplitableHadron *aHadron, G4bool isProjectile, G4ExcitedString *&FirstString, G4ExcitedString *&SecondString, G4FTFParameters *theParameters) const
 
G4double GetProbLogDistr()
 
G4double GetTarMinDiffMass()
 
void Set4Momentum(const G4LorentzVector &aMomentum)
 
G4ParticleDefinition * GetDefinition()
 
const G4String & GetParticleType() const
 
virtual ~G4DiffractiveExcitation()
 
void SetDefinition(const G4ParticleDefinition *aDefinition)
 
HepLorentzVector & rotateZ(double)
 
void SetStatus(const G4int aStatus)
 
G4double SampleMass(const G4double poleMass, const G4double gamma, const G4double minMass, const G4double maxMass) const
 
G4int GetPDGiIsospin() const
 
HepLorentzRotation & rotateY(double delta)
 
const G4String & GetParticleName() const
 
void SetPosition(const G4ThreeVector &aPosition)
 
G4GLOB_DLL std::ostream G4cout
 
const G4LorentzVector & Get4Momentum() const
 
G4ThreeVector GaussianPt(G4double AveragePt2, G4double maxPtSquare) const
 
void SetTimeOfCreation(G4double aTime)
 
G4int GetPDGEncoding() const
 
virtual G4Parton * GetNextParton()=0
 
static const double twopi
 
G4double GetTimeOfCreation()
 
G4double GetMinimumMass(const G4ParticleDefinition *p) const
 
HepLorentzRotation & transform(const HepBoost &b)
 
G4double GetPDGWidth() const
 
G4double GetQuarkFractionOfKink(G4double zmin, G4double zmax) const
 
void IncrementCollisionCount(G4int aCount)
 
G4double GetProcProb(const G4int ProcN, const G4double y)
 
HepLorentzRotation & rotateZ(double delta)
 
G4double G4Log(G4double x)
 
G4double G4Exp(G4double initial_x)
Exponential Function double precision. 
 
int operator!=(const G4DiffractiveExcitation &right) const
 
G4double GetTarMinNonDiffMass()
 
static G4ParticleTable * GetParticleTable()
 
G4double GetPDGMass() const
 
Hep3Vector boostVector() const
 
cout<< "-> Edep in the target
 
HepLorentzVector & rotateY(double)
 
G4double GetDeltaProbAtQuarkExchange()
 
const G4DiffractiveExcitation & operator=(const G4DiffractiveExcitation &right)
 
G4double GetProbOfSameQuarkExchange()
 
HepLorentzVector & transform(const HepRotation &)
 
G4int NewNucleonId(G4int Q1, G4int Q2, G4int Q3) const
 
G4double GetProjMinNonDiffMass()
 
const G4ParticleDefinition * GetDefinition() const
 
void Set4Momentum(const G4LorentzVector &a4Momentum)
 
G4double powA(G4double A, G4double y) const
 
const G4String & GetParticleSubType() const
 
virtual G4bool ElasticScattering(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters) const
 
G4DiffractiveExcitation()
 
void UnpackMeson(G4int IdPDG, G4int &Q1, G4int &Q2) const
 
std::vector< G4double > GetQuarkProbabilitiesAtGluonSplitUp()
 
CLHEP::HepLorentzVector G4LorentzVector