82   for ( 
G4int i = 0; i < 250; i++ ) {
   134        if ( aNucleon ) 
delete aNucleon;
   142        if ( aNucleon ) 
delete aNucleon;
   162          << 
"FTF init Target A Z " << aNucleus.
GetA_asInt() 
   295     G4cout << 
"FTF PutOnMassShell Success?  " << Success << 
G4endl;
   307   G4cout << 
"FTF ExciteParticipants Success? " << Success << 
G4endl;
   313     G4cout << 
"FTF BuildStrings ";
   319     G4cout << 
"FTF BuildStrings " << theStrings << 
" OK" << G4endl
   320            << 
"FTF GetResiduals of Nuclei " << 
G4endl;
   331     std::vector< G4VSplitableHadron* > primaries;
   336       if ( primaries.end() == 
   337            std::find( primaries.begin(), primaries.end(), interaction.
GetProjectile() ) ) {
   351     if ( aNucleon ) 
delete aNucleon;
   353   NumberOfInvolvedNucleonsOfProjectile = 0;
   358     if ( aNucleon ) 
delete aNucleon;
   360   NumberOfInvolvedNucleonsOfTarget = 0;
   363   G4cout << 
"End of FTF. Go to fragmentation" << G4endl
   364          << 
"To continue - enter 1, to stop - ^C" << 
G4endl;
   393   G4cout << 
"G4FTFModel::StoreInvolvedNucleon -------------" << 
G4endl;
   408   while ( ( aProjectileNucleon = theProjectileNucleus->
GetNextNucleon() ) ) {  
   429   #ifdef debugReggeonCascade   430   G4cout << 
"G4FTFModel::ReggeonCascade -----------" << 
G4endl   439   for ( 
G4int InvTN = 0; InvTN < InitNINt; InvTN++ ) { 
   466           Neighbour->
Hit( targetSplitable );
   474   #ifdef debugReggeonCascade   475   G4cout << 
"Final NumberOfInvolvedNucleonsOfTarget "    485   for ( 
G4int InvPN = 0; InvPN < InitNINp; InvPN++ ) { 
   497     while ( ( Neighbour = theProjectileNucleus->
GetNextNucleon() ) ) {  
   512           Neighbour->
Hit( projectileSplitable );
   520   #ifdef debugReggeonCascade   521   G4cout << 
"NumberOfInvolvedNucleonsOfProjectile "   531   G4bool isProjectileNucleus = 
false;
   533     isProjectileNucleus = 
true;
   536   #ifdef debugPutOnMassShell   538   if ( isProjectileNucleus ) {
   539     G4cout << 
"PutOnMassShell for Nucleus_Nucleus " << 
G4endl;
   544   if ( Pprojectile.z() < 0.0 ) {
   556   #ifdef debugPutOnMassShell   562   if ( ! isOk ) 
return false;
   571   if ( ! isProjectileNucleus ) {  
   572     Mprojectile  = Pprojectile.mag();
   573     M2projectile = Pprojectile.mag2();
   574     SumMasses += Mprojectile + 20.0*
MeV;
   576     #ifdef debugPutOnMassShell   577     G4cout << 
"Projectile : ";
   582     if ( ! isOk ) 
return false;
   589   #ifdef debugPutOnMassShell   590   G4cout << 
"Psum " << Psum/
GeV << 
" GeV" << G4endl << 
"SqrtS " << SqrtS/
GeV << 
" GeV" << G4endl
   591          << 
"SumMasses, PrResidualMass and TargetResidualMass " << SumMasses/
GeV << 
" "    592          << PrResidualMass/
GeV << 
" " << TargetResidualMass/
GeV << 
" GeV" << 
G4endl;
   595   if ( SqrtS < SumMasses ) {
   601   G4double savedSumMasses = SumMasses;
   602   if ( isProjectileNucleus ) {
   603     SumMasses -= std::sqrt( 
sqr( PrResidualMass ) + PprojResidual.
perp2() );
   605                             + PprojResidual.
perp2() ); 
   607   SumMasses -= std::sqrt( 
sqr( TargetResidualMass ) + PtargetResidual.
perp2() );
   609                           + PtargetResidual.
perp2() );
   611   if ( SqrtS < SumMasses ) {
   612     SumMasses = savedSumMasses;
   613     if ( isProjectileNucleus ) {
   620   if ( isProjectileNucleus ) {
   624   #ifdef debugPutOnMassShell   625   if ( isProjectileNucleus ) {
   626     G4cout << 
"PrResidualMass ProjResidualExcitationEnergy " << PrResidualMass/
GeV << 
" "   629   G4cout << 
"TargetResidualMass TargetResidualExcitationEnergy " << TargetResidualMass/
GeV << 
" "    631          << 
"Sum masses " << SumMasses/
GeV << 
G4endl;
   635   if ( isProjectileNucleus  &&  thePrNucleus->
GetMassNumber() != 1 ) {
   644   if ( ! isOk ) 
return false;
   655   if ( Ptmp.pz() <= 0.0 ) {  
   662   if ( isProjectileNucleus ) {
   664     YprojectileNucleus = Ptmp.
rapidity();
   666   Ptmp = toCms*Ptarget;                      
   667   G4double YtargetNucleus = Ptmp.rapidity();
   671   if ( isProjectileNucleus ) {
   678   #ifdef debugPutOnMassShell   679   if ( isProjectileNucleus ) {
   680     G4cout << 
"Y projectileNucleus " << YprojectileNucleus << 
G4endl;
   682   G4cout << 
"Y targetNucleus     " << YtargetNucleus << G4endl 
   684          << 
" DcorP DcorT " << DcorP << 
" " << DcorT << 
" AveragePt2 " << AveragePt2 << 
G4endl;
   691   G4int NumberOfTries = 0;
   693   G4bool OuterSuccess = 
true;
   695   const G4int maxNumberOfLoops = 1000;
   696   G4int loopCounter = 0;
   699     const G4int maxNumberOfInnerLoops = 10000;
   702       if ( NumberOfTries == 100*(NumberOfTries/100) ) {
   708         DcorP       *= ScaleFactor;
   709         DcorT       *= ScaleFactor;
   710         AveragePt2  *= ScaleFactor;
   712       if ( isProjectileNucleus ) {
   715                                           thePrNucleus, PprojResidual, 
   723                                         theTargetNucleus, PtargetResidual, 
   728       #ifdef debugPutOnMassShell   729       G4cout << 
"SqrtS, Mp+Mt, Mp, Mt " << SqrtS/
GeV << 
" "    730              << ( std::sqrt( M2proj ) + std::sqrt( M2target) )/
GeV << 
" "   731              << std::sqrt( M2proj )/
GeV << 
" " << std::sqrt( M2target )/
GeV << 
G4endl;
   734       if ( ! isOk ) 
return false;
   735     } 
while ( ( SqrtS < std::sqrt( M2proj ) + std::sqrt( M2target ) ) &&
   736               NumberOfTries < maxNumberOfInnerLoops );  
   737     if ( NumberOfTries >= maxNumberOfInnerLoops ) {
   738       #ifdef debugPutOnMassShell   739       G4cout << 
"BAD situation: forced exit of the inner while loop!" << 
G4endl;
   743     if ( isProjectileNucleus ) {
   744       isOk = 
CheckKinematics( S, SqrtS, M2proj, M2target, YprojectileNucleus, 
true, 
   747                               WminusTarget, WplusProjectile, OuterSuccess );
   752                             WminusTarget, WplusProjectile, OuterSuccess );
   753     if ( ! isOk ) 
return false;
   754   } 
while ( ( ! OuterSuccess ) &&
   755             ++loopCounter < maxNumberOfLoops );  
   756   if ( loopCounter >= maxNumberOfLoops ) {
   757     #ifdef debugPutOnMassShell   758     G4cout << 
"BAD situation: forced exit of the while loop!" << 
G4endl;
   769   if ( ! isProjectileNucleus ) {  
   771     G4double Pzprojectile = WplusProjectile/2.0 - M2projectile/2.0/WplusProjectile;
   772     G4double Eprojectile  = WplusProjectile/2.0 + M2projectile/2.0/WplusProjectile;
   773     Pprojectile.setPz( Pzprojectile ); 
   774     Pprojectile.setE( Eprojectile );
   776     #ifdef debugPutOnMassShell   777     G4cout << 
"Proj after in CMS " << Pprojectile << 
G4endl;
   780     Pprojectile.transform( toLab );  
   789     #ifdef debugPutOnMassShell   799     #ifdef debugPutOnMassShell   803     if ( ! isOk ) 
return false;
   807     #ifdef debugPutOnMassShell   817   #ifdef debugPutOnMassShell   821   if ( ! isOk ) 
return false;
   825   #ifdef debugPutOnMassShell   838   #ifdef debugBuildString   839   G4cout << 
"G4FTFModel::ExciteParticipants() " << 
G4endl;
   842   G4bool Successfull( 
true );  
   844   if ( MaxNumOfInelCollisions > 0 ) {  
   846     if ( 
G4UniformRand() < ProbMaxNumber ) MaxNumOfInelCollisions++;
   849     MaxNumOfInelCollisions = 1;
   852   #ifdef debugBuildString   853   G4cout << 
"MaxNumOfInelCollisions MaxNumOfInelCollisions " << MaxNumOfInelCollisions << 
G4endl;
   856   G4int CurrentInteraction( 0 );
   861     CurrentInteraction++;
   868     #ifdef debugBuildString   869     G4cout << G4endl << 
"Interaction # Status    " << CurrentInteraction << 
" "    870            << collision.
GetStatus() << G4endl << 
"Pr* Tr* " << projectile << 
" "   871            << target << G4endl << 
"projectile->GetStatus target->GetStatus "   881         #ifdef debugBuildString   886           G4bool Annihilation = 
false;
   888                                           TargetNucleon, Annihilation );
   889           if ( ! Result ) 
continue;
   896         #ifdef debugBuildString   897         G4cout << 
"Inelastic interaction" << G4endl
   898                << 
"MaxNumOfInelCollisions " << MaxNumOfInelCollisions << 
G4endl;
   902           G4bool Annihilation = 
false;
   904                                           TargetNucleon, Annihilation );
   905           if ( ! Result ) 
continue;
   918             #ifdef debugBuildString   931             #ifdef debugBuildString   932             G4cout << 
"FTF excitation Non Successfull -> Elastic scattering "    938           #ifdef debugBuildString   939           G4cout << 
"Elastic scat. at rejection inelastic scattering" << 
G4endl;
   953         #ifdef debugBuildString   962           if ( projectile == NextProjectileNucleon  ||  target == NextTargetNucleon ) {
   973           G4bool Annihilation = 
true;
   975                                           TargetNucleon, Annihilation );
   976           if ( ! Result ) 
continue;
   980           Successfull = Successfull  ||  
true;
   982           #ifdef debugBuildString   983           G4cout << 
"Annihilation successfull. " << 
"*AdditionalString "    984                  << AdditionalString << 
G4endl;
  1007     #ifdef debugBuildString  1008     G4cout << 
"----------------------------- Final properties " << G4endl
  1009            << 
"projectile->GetStatus target->GetStatus " << projectile->
GetStatus() 
  1010            << 
" " << target->
GetStatus() << G4endl << 
"projectile->GetSoftC  target->GetSoftC  "  1012            << G4endl << 
"ExciteParticipants() Successfull? " << Successfull << 
G4endl;
  1030   G4cout << 
"AdjustNucleons ---------------------------------------" << 
G4endl  1034          << 
"Pr ResidualMassNumber Pr ResidualCharge Pr ResidualExcitationEnergy "  1037          << 
"Tr ResidualMassNumber Tr ResidualCharge Tr ResidualExcitationEnergy  "  1052   G4double DcorP( 0.0 ), DcorT( 0.0 );
  1058   G4double ExcitationEnergyPerWoundedNucleon = 
  1072     G4cout << 
"case 1, hA prcol=0 trcol=0, AA prcol#0 trcol=0" << 
G4endl;
  1119     if ( TResidualMassNumber <= 1 ) {
  1120       TResidualExcitationEnergy = 0.0;
  1124     if ( TResidualMassNumber != 0 ) {
  1126                           ->
GetIonMass( TResidualCharge, TResidualMassNumber );
  1138     if ( ! Annihilation ) {
  1139       if ( SqrtS < SumMasses ) {
  1142       if ( SqrtS < SumMasses + TResidualExcitationEnergy ) { 
  1145         G4cout << 
"TResidualExcitationEnergy " << TResidualExcitationEnergy << 
G4endl;
  1148         TResidualExcitationEnergy = SqrtS - SumMasses;
  1151         G4cout << 
"TResidualExcitationEnergy " << TResidualExcitationEnergy << 
G4endl;
  1159     if ( Annihilation ) {
  1162       G4cout << 
"SqrtS < SumMasses - TNucleonMass " << SqrtS << 
" "   1163              << SumMasses - TNucleonMass << 
G4endl;
  1166       if ( SqrtS < SumMasses - TNucleonMass ) {
  1171       G4cout << 
"SqrtS < SumMasses " << SqrtS << 
" " << SumMasses << 
G4endl;
  1174       if ( SqrtS < SumMasses ) { 
  1175         TNucleonMass = SqrtS - (SumMasses - TNucleonMass) - TResidualExcitationEnergy; 
  1181         SumMasses = SqrtS - TResidualExcitationEnergy; 
  1187       G4cout << 
"SqrtS < SumMasses " << SqrtS << 
" " << SumMasses << 
G4endl;
  1190       if ( SqrtS < SumMasses + TResidualExcitationEnergy ) { 
  1191         TResidualExcitationEnergy = SqrtS - SumMasses; 
  1210       Pprojectile = Ptmp; Pprojectile.
transform( toLab );
  1214       Ptmp.
setE( TNucleonMass );
  1220       Ptarget = Ptmp; Ptarget.
transform( toLab );
  1244     G4double Mprojectile  = Pprojectile.mag();
  1245     G4double M2projectile = Pprojectile.mag2();
  1251     TResidualMass += TResidualExcitationEnergy;
  1260     G4int NumberOfTries( 0 );
  1262     G4bool OuterSuccess( 
true );
  1264     const G4int maxNumberOfLoops = 1000;
  1265     G4int loopCounter = 0;
  1267       OuterSuccess = 
true;
  1269       const G4int maxNumberOfTries = 10000;
  1274         if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
  1277           DcorT      *= ScaleFactor;
  1278           AveragePt2 *= ScaleFactor;
  1288         G4bool InerSuccess = 
true;
  1290           const G4int maxNumberOfInnerLoops = 1000;
  1291           G4int innerLoopCounter = 0;
  1295             PtNucleon = 
GaussianPt( AveragePt2, maxPtSquare );
  1296             PtResidual = -PtNucleon;
  1298             G4double Mtarget = std::sqrt( 
sqr( TNucleonMass ) + PtNucleon.
mag2() ) + 
  1299                                std::sqrt( 
sqr( TResidualMass ) + PtResidual.
mag2() );
  1300             if ( SqrtS < Mprojectile + Mtarget ) {
  1301               InerSuccess = 
false; 
  1306             G4double Xcenter = std::sqrt( 
sqr( TNucleonMass )  + PtNucleon.
mag2() ) / Mtarget;
  1307             XminusNucleon = Xcenter + tmpX.
x();
  1308             if ( XminusNucleon <= 0.0  ||  XminusNucleon >= 1.0 ) {
  1309               InerSuccess = 
false; 
  1313             XminusResidual = 1.0 - XminusNucleon;
  1314           } 
while ( ( ! InerSuccess ) &&
  1315                     ++innerLoopCounter < maxNumberOfInnerLoops );  
  1316           if ( innerLoopCounter >= maxNumberOfInnerLoops ) {
  1318             G4cout << 
"BAD situation: forced exit of the inner while loop!" << 
G4endl;
  1324           XminusNucleon  = 1.0;
  1325           XminusResidual = 1.0;  
  1329         M2target = ( 
sqr( TNucleonMass ) + PtNucleon.
mag2() ) / XminusNucleon + 
  1330                    ( 
sqr( TResidualMass ) + PtResidual.
mag2() ) / XminusResidual;
  1332       } 
while ( ( SqrtS < Mprojectile + std::sqrt( M2target) ) &&
  1333                 ++NumberOfTries < maxNumberOfTries );  
  1334       if ( NumberOfTries >= maxNumberOfTries ) {
  1336         G4cout << 
"BAD situation: forced exit of the intermediate while loop!" << 
G4endl;
  1342                                 - 2.0*S*M2projectile - 2.0*S*M2target - 2.0*M2projectile*M2target;
  1344       WminusTarget = ( S - M2projectile + M2target + std::sqrt( DecayMomentum2 ) ) / 2.0 / SqrtS;
  1345       WplusProjectile = SqrtS - M2target / WminusTarget;
  1347       G4double Pzprojectile = WplusProjectile/2.0 - M2projectile/2.0/WplusProjectile;
  1348       G4double Eprojectile  = WplusProjectile/2.0 + M2projectile/2.0/WplusProjectile;
  1349       G4double Yprojectile  = 0.5 * 
G4Log( (Eprojectile + Pzprojectile) /
  1350                                            (Eprojectile - Pzprojectile) );
  1353       G4cout << 
"DecayMomentum2 " << DecayMomentum2 << G4endl
  1354              << 
"WminusTarget WplusProjectile " << WminusTarget << 
" " << WplusProjectile
  1355              << G4endl << 
"Yprojectile " << Yprojectile << 
G4endl;
  1359       G4double Pz = -WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  1360       G4double E  =  WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  1364       G4cout << 
"YtN Ytr YtN-Ytr " << 
" " << YtargetNucleon << 
" " << YtargetNucleus << 
" "  1365              << YtargetNucleon - YtargetNucleus << G4endl
  1366              << 
"YtN Ypr YtN-Ypr " << 
" " << YtargetNucleon << 
" " << Yprojectile
  1367              << 
" " << YtargetNucleon - Yprojectile << 
G4endl;
  1370       if ( std::abs( YtargetNucleon - YtargetNucleus ) > 2 || Yprojectile < YtargetNucleon ) {
  1371         OuterSuccess = 
false; 
  1375     } 
while ( ( ! OuterSuccess ) &&
  1376               ++loopCounter < maxNumberOfLoops );  
  1377     if ( loopCounter >= maxNumberOfLoops ) {
  1379       G4cout << 
"BAD situation: forced exit of the while loop!" << 
G4endl;
  1384     G4double Pzprojectile = WplusProjectile/2.0 - M2projectile/2.0/WplusProjectile;
  1385     G4double Eprojectile  = WplusProjectile/2.0 + M2projectile/2.0/WplusProjectile;
  1386     Pprojectile.setPz( Pzprojectile ); Pprojectile.setE( Eprojectile );
  1389     G4cout << 
"Proj after in CMS " << Pprojectile << 
G4endl;
  1392     Pprojectile.transform( toLab ); 
  1401     G4double Pz = -WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  1402     G4double E  =  WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  1404     Ptarget.setPx( PtNucleon.
x() ); Ptarget.setPy( PtNucleon.
y() );
  1405     Ptarget.setPz( Pz );            Ptarget.setE( E ); 
  1406     Ptarget.transform( toLab );
  1419     G4cout << 
"TargetResidualMassNumber TargetResidualCharge TargetResidualExcitationEnergy "  1425       Mt2 = 
sqr( TResidualMass ) + PtResidual.
mag2();
  1426       Pz = -WminusTarget*XminusResidual/2.0 + Mt2/(2.0*WminusTarget*XminusResidual);
  1427       E =   WminusTarget*XminusResidual/2.0 + Mt2/(2.0*WminusTarget*XminusResidual);
  1429       TargetResidual4Momentum.setPx( PtResidual.
x() );
  1430       TargetResidual4Momentum.setPy( PtResidual.
y() );
  1431       TargetResidual4Momentum.setPz( Pz );
  1432       TargetResidual4Momentum.setE( E );
  1435       G4cout << 
"New Residu " << TargetResidual4Momentum << 
" CMS" << 
G4endl;
  1438       TargetResidual4Momentum.transform( toLab );
  1441       G4cout << 
"New Residu " << TargetResidual4Momentum << 
" Lab" << 
G4endl;
  1495     if ( TResidualMassNumber <= 1 ) {
  1496       TResidualExcitationEnergy = 0.0;
  1500     if ( TResidualMassNumber != 0 ) {
  1502                         ->
GetIonMass( TResidualCharge , TResidualMassNumber );
  1508                          TNucleonMass + TResidualMass;
  1511     G4cout << 
"SelectedTN.mag() PNMass + PResidualMass "   1513            << TNucleonMass << 
" " << TResidualMass << 
G4endl;
  1518     if ( ! Annihilation ) {
  1519       if ( SqrtS < SumMasses ) {
  1522       if ( SqrtS < SumMasses + TResidualExcitationEnergy ) { 
  1523         TResidualExcitationEnergy = SqrtS - SumMasses;
  1529     if ( Annihilation ) {
  1530       if ( SqrtS < SumMasses - TNucleonMass ) {
  1533       if ( SqrtS < SumMasses ) { 
  1534         TNucleonMass = SqrtS - (SumMasses - TNucleonMass);
  1536         TResidualExcitationEnergy = 0.0;
  1540       if ( SqrtS < SumMasses + TResidualExcitationEnergy ) { 
  1541         TResidualExcitationEnergy = SqrtS - SumMasses; 
  1555       Ptarget = Ptmp; Ptarget.
transform( toLab );
  1559       Ptmp.
setE( TNucleonMass );
  1560       Pprojectile = Ptmp; Pprojectile.
transform( toLab );
  1576     G4double M2target = Ptarget.mag2();
  1581     TResidualMass += TResidualExcitationEnergy;
  1590     G4int NumberOfTries( 0 );
  1592     G4bool OuterSuccess( 
true );
  1594     const G4int maxNumberOfLoops = 1000;
  1595     G4int loopCounter = 0;
  1598       OuterSuccess = 
true;
  1599       const G4int maxNumberOfTries = 10000;
  1604         if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
  1607           DcorP      *= ScaleFactor;
  1608           AveragePt2 *= ScaleFactor;
  1616           PtNucleon = 
GaussianPt( AveragePt2, maxPtSquare );
  1620         PtResidual = -PtNucleon;
  1622         G4double Mprojectile = std::sqrt( 
sqr( TNucleonMass )  + PtNucleon.
mag2() ) + 
  1623                                std::sqrt( 
sqr( TResidualMass ) + PtResidual.
mag2() );
  1626         G4cout << 
"SqrtS < Mtarget + Mprojectile " << SqrtS << 
"  " << Mtarget
  1627                << 
" " << Mprojectile << 
" " << Mtarget + Mprojectile << 
G4endl;
  1630         M2projectile = 
sqr( Mprojectile );  
  1631         if ( SqrtS < Mtarget + Mprojectile ) {
  1632           OuterSuccess = 
false; 
  1636         G4double Xcenter = std::sqrt( 
sqr( TNucleonMass ) + PtNucleon.
mag2() ) / Mprojectile;
  1638         G4bool InerSuccess = 
true;
  1640           const G4int maxNumberOfInnerLoops = 1000;
  1641           G4int innerLoopCounter = 0;
  1645             XplusNucleon = Xcenter + tmpX.
x();
  1646             if ( XplusNucleon <= 0.0  ||  XplusNucleon >= 1.0 ) { 
  1647               InerSuccess = 
false; 
  1650             XplusResidual = 1.0 - XplusNucleon;
  1651           } 
while ( ( ! InerSuccess ) &&
  1652                     ++innerLoopCounter < maxNumberOfInnerLoops );  
  1653           if ( innerLoopCounter >= maxNumberOfInnerLoops ) {
  1655             G4cout << 
"BAD situation: forced exit of the inner while loop!" << 
G4endl;
  1662           XplusResidual = 1.0; 
  1667         G4cout << 
"TNucleonMass PtNucleon XplusNucleon " << TNucleonMass << 
" " << PtNucleon
  1668                << 
" " << XplusNucleon << G4endl
  1669                << 
"TResidualMass PtResidual XplusResidual " << TResidualMass << 
" " << PtResidual
  1670                << 
"  " << XplusResidual << 
G4endl;
  1673         M2projectile = ( 
sqr( TNucleonMass )  + PtNucleon.
mag2() ) / XplusNucleon + 
  1674                        ( 
sqr( TResidualMass ) + PtResidual.
mag2() ) / XplusResidual;
  1677         G4cout << 
"SqrtS < Mtarget + std::sqrt(M2projectile) " << SqrtS << 
"  " << Mtarget
  1678                << 
" " << std::sqrt( M2projectile ) << 
" " << Mtarget + std::sqrt( M2projectile ) 
  1682       } 
while ( ( SqrtS < Mtarget + std::sqrt( M2projectile ) ) &&
  1683                 ++NumberOfTries < maxNumberOfTries );  
  1684       if ( NumberOfTries >= maxNumberOfTries ) {
  1686         G4cout << 
"BAD situation: forced exit of the intermediate while loop!" << 
G4endl;
  1692                                 - 2.0*S*M2projectile - 2.0*S*M2target - 2.0*M2projectile*M2target;
  1694       WplusProjectile = ( S + M2projectile - M2target + std::sqrt( DecayMomentum2 ) )/2.0/SqrtS;
  1695       WminusTarget = SqrtS - M2projectile/WplusProjectile;
  1697       G4double Pztarget = -WminusTarget/2.0 + M2target/2.0/WminusTarget;
  1698       G4double Etarget =   WminusTarget/2.0 + M2target/2.0/WminusTarget;
  1699       G4double Ytarget = 0.5 * 
G4Log( (Etarget + Pztarget)/(Etarget - Pztarget) );
  1702       G4cout << 
"DecayMomentum2 " << DecayMomentum2 << G4endl
  1703              << 
"WminusTarget WplusProjectile " << WminusTarget << 
" " << WplusProjectile 
  1704              << G4endl << 
"YtargetNucleon " << Ytarget << 
G4endl;
  1708       G4double Pz = WplusProjectile*XplusNucleon/2.0 - Mt2/(2.0*WplusProjectile*XplusNucleon);
  1709       G4double E =  WplusProjectile*XplusNucleon/2.0 + Mt2/(2.0*WplusProjectile*XplusNucleon);
  1710       G4double YprojectileNucleon = 0.5 * 
G4Log( (E + Pz)/(E - Pz) ); 
  1713       G4cout << 
"YpN Ypr YpN-Ypr " << 
" " << YprojectileNucleon << 
" " << YprojectileNucleus
  1714              << 
" " << YprojectileNucleon - YprojectileNucleus << G4endl
  1715              << 
"YpN Ytr YpN-Ytr " << 
" " << YprojectileNucleon << 
" " << Ytarget 
  1716              << 
" " << YprojectileNucleon - Ytarget << 
G4endl;
  1719       if ( std::abs( YprojectileNucleon - YprojectileNucleus ) > 2  ||
  1720            Ytarget  > YprojectileNucleon ) {
  1721         OuterSuccess = 
false; 
  1725     } 
while ( ( ! OuterSuccess ) &&
  1726               ++loopCounter < maxNumberOfLoops );  
  1727     if ( loopCounter >= maxNumberOfLoops ) {
  1729       G4cout << 
"BAD situation: forced exit of the while loop!" << 
G4endl;
  1735     G4double Pztarget = -WminusTarget/2.0 + M2target/2.0/WminusTarget;
  1736     G4double Etarget  =  WminusTarget/2.0 + M2target/2.0/WminusTarget;
  1737     Ptarget.setPz( Pztarget ); Ptarget.setE( Etarget );
  1738     Ptarget.transform( toLab ); 
  1747     G4double Pz = WplusProjectile*XplusNucleon/2.0 - Mt2/(2.0*WplusProjectile*XplusNucleon);
  1748     G4double E =  WplusProjectile*XplusNucleon/2.0 + Mt2/(2.0*WplusProjectile*XplusNucleon);
  1749     Pprojectile.setPx( PtNucleon.
x() ); Pprojectile.setPy( PtNucleon.
y() );
  1750     Pprojectile.setPz( Pz );            Pprojectile.setE( E ); 
  1751     Pprojectile.transform( toLab );
  1755     G4cout << 
"Proj after in Lab " << Pprojectile << 
G4endl;
  1764       Mt2 = 
sqr( TResidualMass ) + PtResidual.
mag2();
  1765       Pz = WplusProjectile*XplusResidual/2.0 - Mt2/(2.0*WplusProjectile*XplusResidual);
  1766       E  = WplusProjectile*XplusResidual/2.0 + Mt2/(2.0*WplusProjectile*XplusResidual);
  1767       ProjectileResidual4Momentum.setPx( PtResidual.
x() );
  1768       ProjectileResidual4Momentum.setPy( PtResidual.
y() );
  1769       ProjectileResidual4Momentum.setPz( Pz );
  1770       ProjectileResidual4Momentum.setE( E );
  1771       ProjectileResidual4Momentum.transform( toLab );
  1791            << 
"ProjectileResidualMassNumber ProjectileResidualCharge "   1819     if ( PResidualMassNumber <= 1 ) {
  1820       PResidualExcitationEnergy = 0.0;
  1824     if ( PResidualMassNumber != 0 ) {
  1826                         ->
GetIonMass( PResidualCharge, PResidualMassNumber );
  1838     if ( TResidualMassNumber <= 1 ) {
  1839       TResidualExcitationEnergy = 0.0;
  1842     if ( TResidualMassNumber != 0 ) {
  1844                         ->
GetIonMass( TResidualCharge, TResidualMassNumber );
  1849     G4double SumMasses = PNucleonMass + PResidualMass + TNucleonMass + TResidualMass;
  1852     G4cout << 
"PNucleonMass PResidualMass TNucleonMass TResidualMass " << PNucleonMass 
  1853            << 
" " << PResidualMass << 
" " << TNucleonMass << 
" " << TResidualMass << G4endl
  1854            << 
"PResidualExcitationEnergy " << PResidualExcitationEnergy << G4endl
  1855            << 
"TResidualExcitationEnergy " << TResidualExcitationEnergy << 
G4endl;
  1860     if ( ! Annihilation ) {
  1863       G4cout << 
"SqrtS < SumMasses " << SqrtS << 
" " << SumMasses << 
G4endl;
  1866       if ( SqrtS < SumMasses ) {
  1871       G4cout << 
"SqrtS < SumMasses + PResidualExcitationEnergy + TResidualExcitationEnergy "  1872              << SqrtS << 
" " << SumMasses + PResidualExcitationEnergy + TResidualExcitationEnergy
  1876       if ( SqrtS < SumMasses + PResidualExcitationEnergy + TResidualExcitationEnergy ) { 
  1879         if ( PResidualExcitationEnergy <= 0.0 ) {
  1880           TResidualExcitationEnergy = SqrtS - SumMasses;
  1881         } 
else if ( TResidualExcitationEnergy <= 0.0 ) {
  1882           PResidualExcitationEnergy = SqrtS - SumMasses;
  1884           G4double Fraction = (SqrtS - SumMasses) / 
  1885                               (PResidualExcitationEnergy + TResidualExcitationEnergy);
  1886           PResidualExcitationEnergy *= Fraction;
  1887           TResidualExcitationEnergy *= Fraction;
  1896     if ( Annihilation ) {
  1897       if ( SqrtS < SumMasses - TNucleonMass ) {
  1900       if ( SqrtS < SumMasses ) { 
  1902         TNucleonMass = SqrtS - (SumMasses - TNucleonMass);
  1904         TResidualExcitationEnergy = 0.0;
  1906       if ( SqrtS < SumMasses + PResidualExcitationEnergy + TResidualExcitationEnergy ) { 
  1908         if ( PResidualExcitationEnergy <= 0.0 ) {
  1909           TResidualExcitationEnergy = SqrtS - SumMasses;
  1910         } 
else if ( TResidualExcitationEnergy <= 0.0 ) {
  1911           PResidualExcitationEnergy = SqrtS - SumMasses;
  1913           G4double Fraction = (SqrtS - SumMasses) / 
  1914                               (PResidualExcitationEnergy + TResidualExcitationEnergy);
  1915           PResidualExcitationEnergy *= Fraction;
  1916           TResidualExcitationEnergy *= Fraction;
  1925       Ptmp.
setE( PNucleonMass );
  1926       Pprojectile = Ptmp; Pprojectile.
transform( toLab );
  1940       Ptmp.
setE( TNucleonMass );
  1941       Ptarget = Ptmp; Ptarget.
transform( toLab );
  1951       TargetResidual4Momentum = Ptmp;
  1960     G4cout << 
"YprojectileNucleus XcenterP " << YprojectileNucleus << 
G4endl;
  1966     PResidualMass += PResidualExcitationEnergy;
  1967     TResidualMass += TResidualExcitationEnergy;
  1984     G4int NumberOfTries( 0 );
  1986     G4bool OuterSuccess( 
true );
  1988     const G4int maxNumberOfLoops = 1000;
  1989     G4int loopCounter = 0;
  1992       OuterSuccess = 
true;
  1993       const G4int maxNumberOfTries = 10000;
  1998         if ( NumberOfTries == 100*(NumberOfTries/100) ) { 
  2001           DcorP      *= ScaleFactor;
  2002           DcorT      *= ScaleFactor;
  2003           AveragePt2 *= ScaleFactor;
  2011           PtNucleonP = 
GaussianPt( AveragePt2, maxPtSquare );
  2015         PtResidualP = -PtNucleonP;
  2018           PtNucleonT = 
GaussianPt( AveragePt2, maxPtSquare );
  2022         PtResidualT = -PtNucleonT;
  2024         G4double Mprojectile = std::sqrt( 
sqr( PNucleonMass )  + PtNucleonP.
mag2() ) + 
  2025                                std::sqrt( 
sqr( PResidualMass ) + PtResidualP.
mag2() );
  2026         M2projectile = 
sqr( Mprojectile );  
  2028         G4double Mtarget = std::sqrt( 
sqr( TNucleonMass )  + PtNucleonT.
mag2() ) + 
  2029                            std::sqrt( 
sqr( TResidualMass ) + PtResidualT.
mag2() );
  2030         M2target = 
sqr( Mtarget );  
  2032         if ( SqrtS < Mprojectile + Mtarget ) {
  2033           OuterSuccess = 
false; 
  2037         G4bool InerSuccess = 
true;
  2040           const G4int maxNumberOfInnerLoops = 1000;
  2041           G4int innerLoopCounter = 0;
  2045             G4double XcenterP = std::sqrt( 
sqr( PNucleonMass ) + PtNucleonP.
mag2() ) / Mprojectile;
  2046             XplusNucleon = XcenterP + tmpX.
x();
  2053             if ( XplusNucleon <= 0.0 || XplusNucleon >= 1.0 ) {
  2054               InerSuccess = 
false; 
  2057             XplusResidual = 1.0 - XplusNucleon;
  2058           } 
while ( ( ! InerSuccess ) &&
  2059                     ++innerLoopCounter < maxNumberOfInnerLoops );  
  2060           if ( innerLoopCounter >= maxNumberOfInnerLoops ) {
  2062             G4cout << 
"BAD situation: forced exit of the first inner while loop!" << 
G4endl;
  2075           XplusResidual = 1.0; 
  2080           const G4int maxNumberOfInnerLoops = 1000;
  2081           G4int innerLoopCounter = 0;
  2086             G4double XcenterT = std::sqrt( 
sqr( TNucleonMass )  + PtNucleonT.
mag2() ) / Mtarget;
  2087             XminusNucleon = XcenterT + tmpX.
x();
  2088             if ( XminusNucleon <= 0.0 || XminusNucleon >= 1.0 ) {
  2089               InerSuccess = 
false; 
  2092             XminusResidual = 1.0 - XminusNucleon;
  2093           } 
while ( ( ! InerSuccess ) &&
  2094                     ++innerLoopCounter < maxNumberOfInnerLoops );  
  2095           if ( innerLoopCounter >= maxNumberOfInnerLoops ) {
  2097             G4cout << 
"BAD situation: forced exit of the second inner while loop!" << 
G4endl;
  2102           XminusNucleon  = 1.0;
  2103           XminusResidual = 1.0;  
  2107         G4cout << 
"PtNucleonP " << PtNucleonP << 
" " << PtResidualP << G4endl
  2108                << 
"XplusNucleon XplusResidual " << XplusNucleon << 
" " << XplusResidual << G4endl
  2109                << 
"PtNucleonT " << PtNucleonT << 
" " << PtResidualT << G4endl
  2110                << 
"XminusNucleon XminusResidual " << XminusNucleon << 
" " << XminusResidual 
  2114         M2projectile = ( 
sqr( PNucleonMass ) + PtNucleonP.
mag2() )  / XplusNucleon + 
  2115                        ( 
sqr( PResidualMass) + PtResidualP.
mag2() ) / XplusResidual;
  2116         M2target = ( 
sqr( TNucleonMass )  + PtNucleonT.
mag2() )  / XminusNucleon + 
  2117                    ( 
sqr( TResidualMass ) + PtResidualT.
mag2() ) / XminusResidual;
  2119       } 
while ( ( SqrtS < std::sqrt( M2projectile ) + std::sqrt( M2target ) ) &&
  2120                 ++NumberOfTries < maxNumberOfTries );  
  2121       if ( NumberOfTries >= maxNumberOfTries ) {
  2123         G4cout << 
"BAD situation: forced exit of the intermediate while loop!" << 
G4endl;
  2129                                 - 2.0*S*M2projectile - 2.0*S*M2target - 2.0*M2projectile*M2target;
  2131       WplusProjectile = ( S + M2projectile - M2target + std::sqrt( DecayMomentum2 ) )/2.0/SqrtS;
  2132       WminusTarget = SqrtS - M2projectile/WplusProjectile;
  2135       G4double Pz = WplusProjectile*XplusNucleon/2.0 - Mt2/(2.0*WplusProjectile*XplusNucleon);
  2136       G4double E =  WplusProjectile*XplusNucleon/2.0 + Mt2/(2.0*WplusProjectile*XplusNucleon);
  2137       G4double YprojectileNucleon = 0.5 * 
G4Log( (E + Pz)/(E - Pz) );
  2139       Mt2 = 
sqr( TNucleonMass ) + PtNucleonT.
mag2();
  2140       Pz = -WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  2141       E =   WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  2144       if ( std::abs( YtargetNucleon - YtargetNucleus ) > 2         || 
  2145            std::abs( YprojectileNucleon - YprojectileNucleus ) > 2 ||
  2146            YprojectileNucleon < YtargetNucleon ) {        
  2147         OuterSuccess = 
false;
  2151     } 
while ( ( ! OuterSuccess ) &&
  2152               ++loopCounter < maxNumberOfLoops );  
  2153     if ( loopCounter >= maxNumberOfLoops ) {
  2155       G4cout << 
"BAD situation: forced exit of the while loop!" << 
G4endl;
  2165     G4double Pz = WplusProjectile*XplusNucleon/2.0 - Mt2/(2.0*WplusProjectile*XplusNucleon);
  2166     G4double E =  WplusProjectile*XplusNucleon/2.0 + Mt2/(2.0*WplusProjectile*XplusNucleon);
  2168     Pprojectile.setPx( PtNucleonP.
x() ); Pprojectile.setPy( PtNucleonP.
y() );
  2169     Pprojectile.setPz( Pz );             Pprojectile.setE( E ); 
  2170     Pprojectile.transform( toLab );
  2179     G4cout << 
"PResidualMass PtResidualP " << PResidualMass << 
" " << PtResidualP << 
G4endl;
  2183       Mt2 = 
sqr( PResidualMass ) + PtResidualP.
mag2();
  2184       Pz = WplusProjectile*XplusResidual/2.0 - Mt2/(2.0*WplusProjectile*XplusResidual);
  2185       E  = WplusProjectile*XplusResidual/2.0 + Mt2/(2.0*WplusProjectile*XplusResidual);
  2186       ProjectileResidual4Momentum.setPx( PtResidualP.
x() );
  2187       ProjectileResidual4Momentum.setPy( PtResidualP.
y() );
  2188       ProjectileResidual4Momentum.setPz( Pz );
  2189       ProjectileResidual4Momentum.setE( E );
  2190       ProjectileResidual4Momentum.transform( toLab );
  2196     G4cout << 
"Pr N R " << Pprojectile << G4endl << 
"       "   2197            << ProjectileResidual4Momentum << 
G4endl;
  2200     Mt2 = 
sqr( TNucleonMass ) + PtNucleonT.
mag2();
  2201     Pz = -WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  2202     E =   WminusTarget*XminusNucleon/2.0 + Mt2/(2.0*WminusTarget*XminusNucleon);
  2204     Ptarget.
setPx( PtNucleonT.
x() ); Ptarget.
setPy( PtNucleonT.
y() );
  2215       Mt2 = 
sqr( TResidualMass ) + PtResidualT.
mag2();
  2216       Pz = -WminusTarget*XminusResidual/2.0 + Mt2/(2.0*WminusTarget*XminusResidual);
  2217       E =   WminusTarget*XminusResidual/2.0 + Mt2/(2.0*WminusTarget*XminusResidual);
  2219       TargetResidual4Momentum.setPx( PtResidualT.
x() );
  2220       TargetResidual4Momentum.setPy( PtResidualT.
y() );
  2221       TargetResidual4Momentum.setPz( Pz );
  2222       TargetResidual4Momentum.setE( E) ;
  2223       TargetResidual4Momentum.transform( toLab );
  2229     G4cout << 
"Tr N R " << Ptarget << G4endl << 
"       " << TargetResidual4Momentum << 
G4endl;
  2251     std::vector< G4VSplitableHadron* > primaries;
  2257         if ( primaries.end() == std::find( primaries.begin(), primaries.end(), 
  2264     #ifdef debugBuildString  2266            << 
"Number of projectile strings " << primaries.size() << 
G4endl;
  2269     for ( 
unsigned int ahadron = 0; ahadron < primaries.size(); ahadron++ ) {
  2270       G4bool isProjectile( 
true );
  2273       FirstString = 0; SecondString = 0;
  2274       if ( primaries[ahadron]->GetStatus() <= 1 )                                    
  2279       else if(primaries[ahadron]->GetStatus() == 2)
  2283                                   primaries[ahadron]->GetDefinition(),
  2284                                   primaries[ahadron]->GetTimeOfCreation(),
  2285                                   primaries[ahadron]->GetPosition(),
  2289       else {
G4cout<<
"Something wrong in FTF Model Build String" << 
G4endl;}          
  2291       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2292       if ( SecondString != 0 ) strings->push_back( SecondString );
  2294       #ifdef debugBuildString  2295       G4cout << 
"FirstString & SecondString? " << FirstString << 
" " << SecondString << 
G4endl;
  2305     #ifdef debugBuildString  2308      G4cout << 
"Check 1 string " << strings->operator[](0)->GetRightParton()->GetPDGcode() 
  2309             << 
" " << strings->operator[](0)->GetLeftParton()->GetPDGcode() << 
G4endl << 
G4endl;
  2318     #ifdef debugBuildString  2319     G4cout << 
"Building of projectile-like strings" << 
G4endl;
  2322     G4bool isProjectile = 
true;
  2325       #ifdef debugBuildString  2326       G4cout << 
"Nucleon #, status, intCount " << ahadron << 
" "  2335       #ifdef debugBuildString  2336       G4cout << G4endl << 
"ahadron aProjectile Status " << ahadron << 
" " << aProjectile
  2342         #ifdef debugBuildString  2343         G4cout << 
"Case1 aProjectile->GetStatus() == 0 " << 
G4endl;
  2346         FirstString = 0; SecondString = 0;
  2350         if ( FirstString  != 0 ) strings->push_back( FirstString );
  2351         if ( SecondString != 0 ) strings->push_back( SecondString );
  2355         #ifdef debugBuildString  2356         G4cout << 
"Case2 aProjectile->GetStatus() !=0 St==1 SoftCol!=0" << 
G4endl;
  2359         FirstString = 0; SecondString = 0;
  2363         if ( FirstString  != 0 ) strings->push_back( FirstString );
  2364         if ( SecondString != 0 ) strings->push_back( SecondString );
  2371         #ifdef debugBuildString  2372         G4cout << 
"Case3 aProjectile->GetStatus() !=0 St==1 SoftCol==0" << 
G4endl;
  2375         FirstString = 0; SecondString = 0;
  2379         if ( FirstString  != 0 ) strings->push_back( FirstString );
  2380         if ( SecondString != 0 ) strings->push_back( SecondString );
  2382         #ifdef debugBuildString  2383         G4cout << 
" Strings are built for nucleon marked for an interaction, but"  2384                << 
" the interaction was skipped." << 
G4endl;
  2390         #ifdef debugBuildString  2391         G4cout << 
"Case4 aProjectile->GetStatus() !=0 St==2 " << 
G4endl;
  2394         FirstString = 0; SecondString = 0;
  2398         if ( FirstString  != 0 ) strings->push_back( FirstString );
  2399         if ( SecondString != 0 ) strings->push_back( SecondString );
  2401         #ifdef debugBuildString  2402         G4cout << 
" Strings are build for involved nucleon." << 
G4endl;
  2407         #ifdef debugBuildString  2414         #ifdef debugBuildString  2422   #ifdef debugBuildString  2426   G4bool isProjectile = 
false;
  2430     #ifdef debugBuildString  2431     G4cout << 
"Nucleon #, status, intCount " << aNucleon << 
" " << ahadron << 
" "  2436       FirstString = 0 ; SecondString = 0;
  2439       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2440       if ( SecondString != 0 ) strings->push_back( SecondString );
  2442       #ifdef debugBuildString  2448       FirstString = 0; SecondString = 0;
  2451       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2452       if ( SecondString != 0 ) strings->push_back( SecondString );
  2454       #ifdef debugBuildString  2455       G4cout << 
" 2 case A string is build, nucleon was excited." << 
G4endl;
  2463       FirstString = 0; SecondString = 0;
  2467       if(SecondString == 0)                                      
  2479       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2480       if ( SecondString != 0 ) strings->push_back( SecondString );
  2482       #ifdef debugBuildString  2494       #ifdef debugBuildString  2498     } 
else if(( aNucleon->
GetStatus() == 2 )||   
  2500       FirstString = 0; SecondString = 0;
  2504       if(SecondString == 0)                                      
  2516       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2517       if ( SecondString != 0 ) strings->push_back( SecondString );
  2519       #ifdef debugBuildString  2525       #ifdef debugBuildString  2532   #ifdef debugBuildString  2537   isProjectile = 
true;
  2541       FirstString = 0; SecondString = 0;
  2544       if ( FirstString  != 0 ) strings->push_back( FirstString );
  2545       if ( SecondString != 0 ) strings->push_back( SecondString );
  2564   #ifdef debugFTFmodel  2565   G4cout << 
"GetResiduals(): HighEnergyInter? GetProjectileNucleus()?"  2571     #ifdef debugFTFmodel  2583       #ifdef debugFTFmodel  2607          residualMomentum +=
tmp;
  2629      const G4int maxNumberOfLoops = 1000;
  2630      G4int loopCounter = 0;
  2647       if(SumMasses > Mass) {Chigh=
C;}
  2650      } 
while( (Chigh-Clow > 0.01) &&  
  2651               ++loopCounter < maxNumberOfLoops );  
  2652      if ( loopCounter >= maxNumberOfLoops ) {
  2653        #ifdef debugFTFmodel  2654        G4cout << 
"BAD situation: forced exit of the first while loop in G4FTFModel::GetResidual" << G4endl
  2655               << 
"\t return immediately from the method!" << 
G4endl;
  2676     #ifdef debugFTFmodel  2678            << G4endl << 
"ProjectileResidualExcitationEnergy ProjectileResidual4Momentum "  2690       #ifdef debugFTFmodel  2710      while ( ( aNucleon = theProjectileNucleus->
GetNextNucleon() ) ) {  
  2714          residualMomentum +=
tmp;
  2725      while ( ( aNucleon = theProjectileNucleus->
GetNextNucleon() ) ) {  
  2736      const G4int maxNumberOfLoops = 1000;
  2737      G4int loopCounter = 0;
  2745       while ( ( aNucleon = theProjectileNucleus->
GetNextNucleon() ) ) {  
  2754       if(SumMasses > Mass) {Chigh=
C;}
  2757      } 
while( (Chigh-Clow > 0.01) &&  
  2758               ++loopCounter < maxNumberOfLoops );  
  2759      if ( loopCounter >= maxNumberOfLoops ) {
  2760        #ifdef debugFTFmodel  2761        G4cout << 
"BAD situation: forced exit of the second while loop in G4FTFModel::GetResidual" << G4endl
  2762               << 
"\t return immediately from the method!" << 
G4endl;
  2769      while ( ( aNucleon = theProjectileNucleus->
GetNextNucleon() ) ) {  
  2780     #ifdef debugFTFmodel  2786     #ifdef debugFTFmodel  2787     G4cout << 
"Low energy interaction: Target nucleus --------------" << G4endl
  2788            << 
"Tr ResidualMassNumber Tr ResidualCharge Tr ResidualExcitationEnergy  "  2793     G4int NumberOfTargetParticipant( 0 );
  2803     if ( NumberOfTargetParticipant != 0 ) {
  2816         delete targetSplitable;  
  2817         targetSplitable = 0; 
  2818         aNucleon->
Hit( targetSplitable );
  2823     #ifdef debugFTFmodel  2824     G4cout << 
"NumberOfTargetParticipant " << NumberOfTargetParticipant << G4endl
  2830     #ifdef debugFTFmodel  2831     G4cout << 
"Low energy interaction: Projectile nucleus --------------" << G4endl
  2832            << 
"Pr ResidualMassNumber Pr ResidualCharge Pr ResidualExcitationEnergy "  2837     G4int NumberOfProjectileParticipant( 0 );
  2842         NumberOfProjectileParticipant++;
  2845       #ifdef debugFTFmodel  2849       DeltaExcitationE = 0.0;
  2852       if ( NumberOfProjectileParticipant != 0 ) {
  2854                            G4double( NumberOfProjectileParticipant );
  2856                                 G4double( NumberOfProjectileParticipant );
  2868           delete projectileSplitable;  
  2869           projectileSplitable = 0; 
  2870           aNucleon->
Hit( projectileSplitable );
  2875       #ifdef debugFTFmodel  2876       G4cout << 
"NumberOfProjectileParticipant " << NumberOfProjectileParticipant << G4endl
  2882     #ifdef debugFTFmodel  2883     G4cout << 
"End GetResiduals -----------------" << 
G4endl;
  2895   if ( AveragePt2 <= 0.0 ) {
  2899                                         ( 
G4Exp( -maxPtSquare/AveragePt2 ) -1.0 ) );
  2904   return G4ThreeVector( Pt*std::cos(phi), Pt*std::sin(phi), 0.0 );    
  2915                           G4double& residualExcitationEnergy,  
  2917                           G4int& residualMassNumber,           
  2918                           G4int& residualCharge ) {            
  2930   if ( ! nucleus ) 
return false;
  2932   G4double ExcitationEnergyPerWoundedNucleon = 
  2955       sumMasses += 20.0*
MeV;  
  2957       residualExcitationEnergy += -ExcitationEnergyPerWoundedNucleon*
  2959       residualMassNumber--;
  2966   #ifdef debugPutOnMassShell  2967   G4cout << 
"ExcitationEnergyPerWoundedNucleon " << ExcitationEnergyPerWoundedNucleon << 
G4endl  2968          << 
"\t Residual Charge, MassNumber " << residualCharge << 
" " << residualMassNumber
  2969          << 
G4endl << 
"\t Initial Momentum " << nucleusMomentum
  2970          << 
G4endl << 
"\t Residual Momentum   " << residualMomentum << 
G4endl;
  2972   residualMomentum.
setPz( 0.0 ); 
  2973   residualMomentum.
setE( 0.0 );
  2974   if ( residualMassNumber == 0 ) {
  2976     residualExcitationEnergy = 0.0;
  2979                      GetIonMass( residualCharge, residualMassNumber );
  2980     if ( residualMassNumber == 1 ) {
  2981       residualExcitationEnergy = 0.0;
  2983     residualMass += residualExcitationEnergy;       
  2985   sumMasses += std::sqrt( 
sqr( residualMass ) + residualMomentum.
perp2() );
  2994                      const G4int numberOfInvolvedNucleons,  
  3012   if ( sqrtS < 0.0  ||  numberOfInvolvedNucleons <= 0  ||  sumMasses < 0.0 ) 
return false;
  3016   const G4double probDeltaIsobar = 0.05;  
  3018   G4int maxNumberOfDeltas = 
G4int( (sqrtS - sumMasses)/(400.0*
MeV) );
  3019   G4int numberOfDeltas = 0;
  3021   for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3024     if ( 
G4UniformRand() < probDeltaIsobar  &&  numberOfDeltas < maxNumberOfDeltas ) {
  3026       if ( ! involvedNucleons[i] ) 
continue;
  3033       G4int newPdgCode = pdgCode/10; newPdgCode = newPdgCode*10 + 4; 
  3042       if ( sqrtS < sumMasses + massDelta - massNuc ) {  
  3046         sumMasses += ( massDelta - massNuc );        
  3065                            const G4int residualMassNumber,        
  3066                            const G4int numberOfInvolvedNucleons,  
  3080   if ( ! nucleus ) 
return false;
  3082   if ( residualMassNumber == 0  &&  numberOfInvolvedNucleons == 1 ) {
  3097   const G4int maxNumberOfLoops = 1000;
  3098   G4int loopCounter = 0;
  3105     for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3106       G4Nucleon* aNucleon = involvedNucleons[i];
  3107       if ( ! aNucleon ) 
continue;
  3115     G4double deltaPx = ( ptSum.
x() - pResidual.
x() ) / numberOfInvolvedNucleons;
  3116     G4double deltaPy = ( ptSum.
y() - pResidual.
y() ) / numberOfInvolvedNucleons;
  3118     SumMasses = residualMass;
  3119     for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3120       G4Nucleon* aNucleon = involvedNucleons[i];
  3121       if ( ! aNucleon ) 
continue;
  3125                               + 
sqr( px ) + 
sqr( py ) );
  3133     for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3134       G4Nucleon* aNucleon = involvedNucleons[i];
  3135       if ( ! aNucleon ) 
continue;
  3142       if ( x < 0.0  ||  x > 1.0 ) { 
  3154     if ( xSum < 0.0  ||  xSum > 1.0 ) success = 
false;
  3156     if ( ! success ) 
continue;
  3161     if ( residualMassNumber == 0 ) {
  3162       delta = ( xSum - 1.0 ) / numberOfInvolvedNucleons;
  3169     for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3170       G4Nucleon* aNucleon = involvedNucleons[i];
  3171       if ( ! aNucleon ) 
continue;
  3174       if ( residualMassNumber == 0 ) {
  3175         if ( x <= 0.0  ||  x > 1.0 ) {
  3180         if ( x <= 0.0  ||  x > 1.0  ||  xSum <= 0.0  ||  xSum > 1.0 ) {
  3197     if ( ! success ) 
continue;
  3199     if ( success  &&  residualMassNumber != 0 ) {
  3201       mass2 += 
sqr( residualMass ) / xSum;
  3204     #ifdef debugPutOnMassShell  3208   } 
while ( ( ! success ) &&
  3209             ++loopCounter < maxNumberOfLoops );  
  3210   if ( loopCounter >= maxNumberOfLoops ) {
  3226                  const G4bool isProjectileNucleus,      
  3227                  const G4int numberOfInvolvedNucleons,  
  3242   G4double decayMomentum2 = 
sqr( sValue ) + 
sqr( projectileMass2 ) + 
sqr( targetMass2 )
  3243                             - 2.0*sValue*projectileMass2 - 2.0*sValue*targetMass2 
  3244                             - 2.0*projectileMass2*targetMass2;
  3245   targetWminus = ( sValue - projectileMass2 + targetMass2 + std::sqrt( decayMomentum2 ) )
  3247   projectileWplus = sqrtS - targetMass2/targetWminus;
  3248   G4double projectilePz = projectileWplus/2.0 - projectileMass2/2.0/projectileWplus;
  3249   G4double projectileE  = projectileWplus/2.0 + projectileMass2/2.0/projectileWplus;
  3250   G4double projectileY  = 0.5 * 
G4Log( (projectileE + projectilePz)/
  3251                                        (projectileE - projectilePz) );
  3252   G4double targetPz = -targetWminus/2.0 + targetMass2/2.0/targetWminus;
  3253   G4double targetE  =  targetWminus/2.0 + targetMass2/2.0/targetWminus;
  3254   G4double targetY  = 0.5 * 
G4Log( (targetE + targetPz)/(targetE - targetPz) );
  3256   #ifdef debugPutOnMassShell  3257   G4cout << 
"decayMomentum2 " << decayMomentum2 << 
G4endl   3258          << 
"\t targetWminus projectileWplus " << targetWminus << 
" " << projectileWplus << 
G4endl  3259          << 
"\t projectileY targetY " << projectileY << 
" " << targetY << 
G4endl;
  3262   for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3263     G4Nucleon* aNucleon = involvedNucleons[i];
  3264     if ( ! aNucleon ) 
continue;
  3269     G4double pz = -targetWminus*x/2.0 + mt2/(2.0*targetWminus*
x);
  3270     G4double e =   targetWminus*x/2.0 + mt2/(2.0*targetWminus*
x);
  3271     if ( isProjectileNucleus ) {
  3272       pz = projectileWplus*x/2.0 - mt2/(2.0*projectileWplus*
x);
  3273       e =  projectileWplus*x/2.0 + mt2/(2.0*projectileWplus*
x);
  3277     #ifdef debugPutOnMassShell  3278     G4cout << 
"i nY pY nY-AY AY " << i << 
" " << nucleonY << 
" " << projectileY <<
G4endl;
  3281     if ( std::abs( nucleonY - nucleusY ) > 2  ||  
  3282          ( isProjectileNucleus  &&  targetY > nucleonY )  ||
  3283          ( ! isProjectileNucleus  &&  projectileY < nucleonY ) ) {
  3296                     const G4bool isProjectileNucleus,            
  3299                     const G4int residualMassNumber,              
  3300                     const G4int numberOfInvolvedNucleons,        
  3318   for ( 
G4int i = 0; i < numberOfInvolvedNucleons; i++ ) {
  3319     G4Nucleon* aNucleon = involvedNucleons[i];
  3320     if ( ! aNucleon ) 
continue;
  3322     residual3Momentum -= tmp.
vect();
  3326     G4double pz = -w * x / 2.0  +  mt2 / ( 2.0 * w * 
x );
  3327     G4double e  =  w * x / 2.0  +  mt2 / ( 2.0 * w * 
x );
  3329     if ( isProjectileNucleus ) pz *= -1.0;
  3338   G4double residualMt2 = 
sqr( residualMass ) + 
sqr( residual3Momentum.
x() )
  3339                        + 
sqr( residual3Momentum.
y() );
  3341   #ifdef debugPutOnMassShell  3342   G4cout << 
"w residual3Momentum.z() " << w << 
" " << residual3Momentum.
z() << 
G4endl;
  3347   if ( residualMassNumber != 0 ) {
  3348     residualPz = -w * residual3Momentum.
z() / 2.0 + 
  3349                   residualMt2 / ( 2.0 * w * residual3Momentum.
z() );
  3350     residualE  =  w * residual3Momentum.
z() / 2.0 + 
  3351                   residualMt2 / ( 2.0 * w * residual3Momentum.
z() );
  3353     if ( isProjectileNucleus ) residualPz *= -1.0;
  3356   residual4Momentum.
setPx( residual3Momentum.
x() );
  3357   residual4Momentum.
setPy( residual3Momentum.
y() );
  3358   residual4Momentum.
setPz( residualPz ); 
  3359   residual4Momentum.
setE( residualE );
  3368   desc << 
"                 FTF (Fritiof) Model               \n"   3369        << 
"The FTF model is based on the well-known FRITIOF   \n"  3370        << 
"model (B. Andersson et al., Nucl. Phys. B281, 289  \n"  3371        << 
"(1987)). Its first program implementation was given\n"  3372        << 
"by B. Nilsson-Almquist and E. Stenlund (Comp. Phys.\n"  3373        << 
"Comm. 43, 387 (1987)). The Fritiof model assumes   \n"  3374        << 
"that all hadron-hadron interactions are binary     \n"  3375        << 
"reactions, h_1+h_2->h_1'+h_2' where h_1' and h_2'  \n"  3376        << 
"are excited states of the hadrons with continuous  \n"  3377        << 
"mass spectra. The excited hadrons are considered as\n"  3378        << 
"QCD-strings, and the corresponding LUND-string     \n"  3379        << 
"fragmentation model is applied for a simulation of \n"  3380        << 
"their decays.                                      \n"  3381        << 
"   The Fritiof model assumes that in the course of \n"  3382        << 
"a hadron-nucleus interaction a string originated   \n"  3383        << 
"from the projectile can interact with various intra\n"  3384        << 
"nuclear nucleons and becomes into highly excited   \n"  3385        << 
"states. The probability of multiple interactions is\n"  3386        << 
"calculated in the Glauber approximation. A cascading\n"  3387        << 
"of secondary particles was neglected as a rule. Due\n"  3388        << 
"to these, the original Fritiof model fails to des- \n"  3389        << 
"cribe a nuclear destruction and slow particle spectra.\n"  3390        << 
"   In order to overcome the difficulties we enlarge\n"  3391        << 
"the model by the reggeon theory inspired model of  \n"  3392        << 
"nuclear desctruction (Kh. Abdel-Waged and V.V. Uzhi-\n"  3393        << 
"nsky, Phys. Atom. Nucl. 60, 828 (1997); Yad. Fiz. 60, 925\n"  3394        << 
"(1997)). Momenta of the nucleons ejected from a nuc-\n"  3395        << 
"leus in the reggeon cascading are sampled according\n"  3396        << 
"to a Fermi motion algorithm presented in (EMU-01   \n"  3397        << 
"Collaboration (M.I. Adamovich et al.) Zeit. fur Phys.\n"  3398        << 
"A358, 337 (1997)).                                 \n"  3399        << 
"   New features were also added to the Fritiof model\n"  3400        << 
"implemented in Geant4: a simulation of elastic had-\n"  3401        << 
"ron-nucleon scatterings, a simulation of binary \n"  3402        << 
"reactions like NN>NN* in hadron-nucleon interactions,\n"  3403        << 
"a separate simulation of single diffractive and non-\n"  3404        << 
" diffractive events. These allowed to describe after\n"  3405        << 
"model parameter tuning a wide set of experimental  \n" G4ElasticHNScattering * theElastic
 
G4Parton * GetLeftParton(void) const
 
void GetList(const G4ReactionProduct &thePrimary, G4FTFParameters *theParameters)
 
const G4ThreeVector & GetPosition() const
 
std::vector< G4ExcitedString * > G4ExcitedStringVector
 
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
 
virtual G4bool Annihilate(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4VSplitableHadron *&AdditionalString, G4FTFParameters *theParameters) const
 
virtual G4bool ExciteParticipants(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters, G4ElasticHNScattering *theElastic) const
 
void SetParticleType(G4Proton *aProton)
 
G4double GetProbabilityOfElasticScatt()
 
G4FTFModel(const G4String &modelName="FTF")
 
G4int GetBaryonNumber() const
 
void SetMomentum(G4LorentzVector &aMomentum)
 
CLHEP::Hep3Vector G4ThreeVector
 
void operator()(G4VSplitableHadron *aH)
 
G4VSplitableHadron * GetProjectile() const
 
virtual G4bool StartLoop()=0
 
G4int GetSoftCollisionCount()
 
virtual void CreateStrings(G4VSplitableHadron *aHadron, G4bool isProjectile, G4ExcitedString *&FirstString, G4ExcitedString *&SecondString, G4FTFParameters *theParameters) const
 
void SetMomentum(const G4double x, const G4double y, const G4double z)
 
G4ThreeVector GaussianPt(G4double AveragePt2, G4double maxPtSquare) const
 
G4bool AdjustNucleons(G4VSplitableHadron *SelectedAntiBaryon, G4Nucleon *ProjectileNucleon, G4VSplitableHadron *SelectedTargetNucleon, G4Nucleon *TargetNucleon, G4bool Annihilation)
 
virtual void DoLorentzContraction(const G4LorentzVector &theBoost)=0
 
virtual G4int GetMassNumber()=0
 
void SetTimeOfCreation(G4double aTime)
 
G4Nucleon * GetProjectileNucleon() const
 
G4ReactionProduct theProjectile
 
G4int TargetResidualMassNumber
 
void SetDefinition(const G4ParticleDefinition *aDefinition)
 
virtual void SetProjectileNucleus(G4V3DNucleus *aNucleus)
 
HepLorentzVector & rotateZ(double)
 
void SetStatus(const G4int aStatus)
 
G4FTFParameters * theParameters
 
G4FTFAnnihilation * theAnnihilation
 
virtual const G4LorentzVector & Get4Momentum() const
 
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const
 
G4bool ExciteParticipants()
 
virtual void ModelDescription(std::ostream &) const
 
void SetThisPointer(G4VPartonStringModel *aPointer)
 
G4double GetCofNuclearDestructionPr()
 
G4Nucleon * TheInvolvedNucleonsOfTarget[250]
 
std::vector< G4VSplitableHadron *> theAdditionalString
 
G4Parton * GetRightParton(void) const
 
G4InteractionContent & GetInteraction()
 
const G4String & GetParticleName() const
 
G4GLOB_DLL std::ostream G4cout
 
G4double GetMaxNumberOfCollisions()
 
virtual const G4ThreeVector & GetPosition() const
 
virtual const G4ParticleDefinition * GetDefinition() const
 
G4IonTable * GetIonTable() const
 
const G4LorentzVector & Get4Momentum() const
 
G4int GetPDGEncoding() const
 
virtual void Init(G4int theZ, G4int theA)
 
static G4AntiProton * AntiProton()
 
G4FTFParticipants theParticipants
 
void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double AbsoluteLevel)
 
G4int ProjectileResidualMassNumber
 
HepLorentzVector & boost(double, double, double)
 
G4DiffractiveExcitation * theExcitation
 
void SetTotalEnergy(const G4double en)
 
static const double twopi
 
G4double GetTimeOfCreation()
 
G4VSplitableHadron * GetSplitableHadron() const
 
G4ExcitedStringVector * BuildStrings()
 
G4V3DNucleus * theProjectileNucleus
 
static G4Proton * Proton()
 
HepLorentzRotation & transform(const HepBoost &b)
 
G4double GetMaxPt2ofNuclearDestruction()
 
G4VSplitableHadron * GetTarget() const
 
static const double perCent
 
G4bool ComputeNucleusProperties(G4V3DNucleus *nucleus, G4LorentzVector &nucleusMomentum, G4LorentzVector &residualMomentum, G4double &sumMasses, G4double &residualExcitationEnergy, G4double &residualMass, G4int &residualMassNumber, G4int &residualCharge)
 
G4Nucleon * TheInvolvedNucleonsOfProjectile[250]
 
static G4Neutron * Neutron()
 
G4V3DNucleus * GetProjectileNucleus() const
 
void SetBindingEnergy(G4double anEnergy)
 
Hep3Vector findBoostToCM() const
 
void Init(const G4Nucleus &aNucleus, const G4DynamicParticle &aProjectile)
 
G4double GetTotalMomentum() const
 
G4double G4Log(G4double x)
 
G4double G4Exp(G4double initial_x)
Exponential Function double precision. 
 
G4int ProjectileResidualCharge
 
virtual void InitProjectileNucleus(G4int theZ, G4int theA)
 
virtual void DoLorentzBoost(const G4LorentzVector &theBoost)=0
 
void SetStatus(G4int aValue)
 
static G4ParticleTable * GetParticleTable()
 
G4double GetPt2ofNuclearDestruction()
 
G4double GetBindingEnergy() const
 
G4bool CheckKinematics(const G4double sValue, const G4double sqrtS, const G4double projectileMass2, const G4double targetMass2, const G4double nucleusY, const G4bool isProjectileNucleus, const G4int numberOfInvolvedNucleons, G4Nucleon *involvedNucleons[], G4double &targetWminus, G4double &projectileWplus, G4bool &success)
 
G4double GetR2ofNuclearDestruction()
 
G4double GetPDGMass() const
 
G4Nucleon * GetTargetNucleon() const
 
G4int NumberOfInvolvedNucleonsOfProjectile
 
Hep3Vector boostVector() const
 
void StoreInvolvedNucleon()
 
const G4ParticleDefinition * GetDefinition() const
 
G4double GetTotalEnergy() const
 
G4double GetExcitationEnergyPerWoundedNucleon()
 
cout<< "-> Edep in the target
 
G4bool SamplingNucleonKinematics(G4double averagePt2, const G4double maxPt2, G4double dCor, G4V3DNucleus *nucleus, const G4LorentzVector &pResidual, const G4double residualMass, const G4int residualMassNumber, const G4int numberOfInvolvedNucleons, G4Nucleon *involvedNucleons[], G4double &mass2)
 
HepLorentzVector & rotateY(double)
 
G4bool GenerateDeltaIsobar(const G4double sqrtS, const G4int numberOfInvolvedNucleons, G4Nucleon *involvedNucleons[], G4double &sumMasses)
 
G4bool FinalizeKinematics(const G4double w, const G4bool isProjectileNucleus, const G4LorentzRotation &boostFromCmsToLab, const G4double residualMass, const G4int residualMassNumber, const G4int numberOfInvolvedNucleons, G4Nucleon *involvedNucleons[], G4LorentzVector &residual4Momentum)
 
G4int TargetResidualCharge
 
G4V3DNucleus * GetTargetNucleus() const
 
G4double GetCofNuclearDestruction()
 
HepLorentzVector & transform(const HepRotation &)
 
G4double GetProbabilityOfAnnihilation()
 
G4LorentzVector TargetResidual4Momentum
 
const G4ParticleDefinition * GetDefinition() const
 
virtual G4Nucleon * GetNextNucleon()=0
 
void Set4Momentum(const G4LorentzVector &a4Momentum)
 
void Hit(G4VSplitableHadron *aHit)
 
void setVect(const Hep3Vector &)
 
G4LorentzVector ProjectileResidual4Momentum
 
const G4ThreeVector & GetPosition() const
 
G4double GetPDGCharge() const
 
G4double ProjectileResidualExcitationEnergy
 
G4ExcitedStringVector * GetStrings()
 
virtual G4bool ElasticScattering(G4VSplitableHadron *aPartner, G4VSplitableHadron *bPartner, G4FTFParameters *theParameters) const
 
static G4AntiNeutron * AntiNeutron()
 
G4ThreeVector GetMomentum() const
 
G4int NumberOfInvolvedNucleonsOfTarget
 
G4double TargetResidualExcitationEnergy
 
CLHEP::HepLorentzVector G4LorentzVector
 
G4double GetDofNuclearDestruction()