94 #ifdef debugFTFexictation
117 common.
S = Psum.
mag2();
118 common.
SqrtS = std::sqrt( common.
S );
121 G4bool toBePutOnMassShell =
true;
162 #ifdef debugFTFexictation
164 <<
"Mprojectile Y " << common.
Pprojectile.
mag() <<
" " << ProjectileRapidity << G4endl
166 G4cout <<
"Mtarget Y " << common.
Ptarget.
mag() <<
" " << TargetRapidity << G4endl
167 <<
"M0target Y " << common.
M0target <<
" " << TargetRapidity <<
G4endl;
174 if ( Ptmp.pz() <= 0.0 )
return false;
182 #ifdef debugFTFexictation
186 if ( common.
SqrtS < SumMasses )
return false;
191 #ifdef debugFTFexictation
192 G4cout <<
"PZcms2 after toBePutOnMassShell " << common.
PZcms2 << G4endl;
194 if ( common.
PZcms2 < 0.0 )
return false;
197 if ( toBePutOnMassShell ) {
214 #ifdef debugFTFexictation
215 G4cout <<
"Start --------------------" << G4endl <<
"Proj M0 Mdif Mndif " << common.
M0projectile
228 theParameters->
GetProcProb( 4, ProjectileRapidity - TargetRapidity );
230 theParameters->
GetProcProb( 2, ProjectileRapidity - TargetRapidity );
232 theParameters->
GetProcProb( 3, ProjectileRapidity - TargetRapidity );
234 #ifdef debugFTFexictation
235 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
237 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
243 if ( QeExc + QeNoExc != 0.0 ) {
244 common.
ProbExc = QeExc / ( QeExc + QeNoExc );
246 if ( 1.0 - QeExc - QeNoExc > 0.0 ) {
250 #ifdef debugFTFexictation
251 G4cout <<
"Proc Probs " << QeNoExc <<
" " << QeExc <<
" "
253 <<
"ProjectileRapidity " << ProjectileRapidity <<
G4endl;
257 G4int returnCode = 1;
260 theElastic, common );
263 G4bool returnResult =
false;
264 if ( returnCode == 0 ) {
266 }
else if ( returnCode == 1 ) {
269 #ifdef debugFTFexictation
270 G4cout <<
"Excitation --------------------" << G4endl
271 <<
"Proj M0 MdMin MndMin " << common.
M0projectile <<
" "
285 #ifdef debugFTFexictation
303 if ( returnResult ) {
309 #ifdef debugFTFexictation
337 G4int returnCode = 99;
341 G4double MtestPr = 0.0, MtestTr = 0.0;
343 #ifdef debugFTFexictation
344 G4cout <<
"Q exchange --------------------------" <<
G4endl;
346 G4int NewProjCode = 0, NewTargCode = 0, ProjQ1 = 0, ProjQ2 = 0, ProjQ3 = 0;
354 G4int TargQ1 = 0, TargQ2 = 0, TargQ3 = 0;
356 #ifdef debugFTFexictation
357 G4cout <<
"Proj Quarks " << ProjQ1 <<
" " << ProjQ2 <<
" " << ProjQ3 << G4endl
358 <<
"Targ Quarks " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 <<
G4endl;
362 G4int ProjExchangeQ = 0, TargExchangeQ = 0;
365 G4bool isProjQ1Quark =
false;
366 ProjExchangeQ = ProjQ2;
368 isProjQ1Quark =
true;
369 ProjExchangeQ = ProjQ1;
372 G4int NpossibleStates = 0;
373 if ( ProjExchangeQ != TargQ1 ) NpossibleStates++;
374 if ( ProjExchangeQ != TargQ2 ) NpossibleStates++;
375 if ( ProjExchangeQ != TargQ3 ) NpossibleStates++;
376 G4int Nsampled = G4RandFlat::shootInt(
G4long( NpossibleStates ) ) + 1;
378 if ( ProjExchangeQ != TargQ1 ) {
379 if ( ++NpossibleStates == Nsampled ) {
380 TargExchangeQ = TargQ1; TargQ1 = ProjExchangeQ;
381 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
384 if ( ProjExchangeQ != TargQ2 ) {
385 if ( ++NpossibleStates == Nsampled ) {
386 TargExchangeQ = TargQ2; TargQ2 = ProjExchangeQ;
387 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
390 if ( ProjExchangeQ != TargQ3 ) {
391 if ( ++NpossibleStates == Nsampled ) {
392 TargExchangeQ = TargQ3; TargQ3 = ProjExchangeQ;
393 isProjQ1Quark ? ProjQ1 = TargExchangeQ : ProjQ2 = TargExchangeQ;
396 #ifdef debugFTFexictation
397 G4cout <<
"Exchanged Qs in Pr Tr " << ProjExchangeQ <<
" " << TargExchangeQ <<
G4endl;
401 G4bool ProjExcited =
false;
402 const G4int maxNumberOfAttempts = 50;
404 while ( attempts++ < maxNumberOfAttempts ) {
408 if ( aProjQ1 == aProjQ2 ) {
409 if ( aProjQ1 != 3 ) {
424 if ( aProjQ1 > aProjQ2 ) {
425 NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
427 NewProjCode = aProjQ2*100 + aProjQ1*10 + 1;
430 #ifdef debugFTFexictation
440 G4int value = ProjQ1, absValue = aProjQ1, Qquarks = 0;
441 for (
G4int iQuark = 0; iQuark < 2; iQuark++ ) {
443 value = ProjQ2; absValue = aProjQ2;
445 if ( absValue == 2 ) {
448 Qquarks -= value/absValue;
451 if ( Qquarks < 0 ) NewProjCode *= -1;
452 #ifdef debugFTFexictation
453 G4cout <<
"NewProjCode +2 or 0 " << NewProjCode <<
G4endl;
454 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
456 G4cout<<
"+++++++++++++++++++++++++++++++++++++++"<<
G4endl;
461 if ( ! TestParticle )
continue;
466 #ifdef debugFTFexictation
469 <<
"MtestPart MtestPart0 "<<MtestPr<<
" "<<TestParticle->
GetPDGMass()<<G4endl
470 <<
"M0projectile projectile PDGMass " << common.
M0projectile <<
" "
476 #ifdef debugFTFexictation
477 G4cout <<
"New TrQ " << TargQ1 <<
" " << TargQ2 <<
" " << TargQ3 << G4endl
478 <<
"NewTargCode " << NewTargCode <<
G4endl;
480 if ( TargQ1 != TargQ2 && TargQ1 != TargQ3 && TargQ2 != TargQ3 ) {
486 }
else if ( TargQ1 == TargQ2 && TargQ1 == TargQ3 ) {
487 NewTargCode += 2; ProjExcited =
true;
490 NewTargCode += 2; ProjExcited =
true;
492 }
else if ( ! ProjExcited &&
499 if ( ! TestParticle )
continue;
500 #ifdef debugFTFexictation
507 if ( common.
SqrtS > MtestPr + MtestTr )
break;
510 if ( attempts >= maxNumberOfAttempts )
return returnCode;
515 #ifdef debugFTFexictation
525 #ifdef debugFTFexictation
535 G4bool isProjectileExchangedQ =
false;
536 G4int firstQ = TargQ1, secondQ = TargQ2, thirdQ = TargQ3;
537 G4int otherFirstQ = ProjQ1, otherSecondQ = ProjQ2, otherThirdQ = ProjQ3;
539 isProjectileExchangedQ =
true;
540 firstQ = ProjQ1; secondQ = ProjQ2; thirdQ = ProjQ3;
541 otherFirstQ = TargQ1; otherSecondQ = TargQ2; otherThirdQ = TargQ3;
545 G4int exchangedQ = 0;
547 if ( Ksi < 0.333333 ) {
549 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
550 exchangedQ = secondQ;
554 #ifdef debugFTFexictation
555 G4cout <<
"Exchange Qs isProjectile Q " << isProjectileExchangedQ <<
" " << exchangedQ <<
" ";
561 const G4int MaxCount = 100;
562 G4int count = 0, otherExchangedQ = 0;
564 if ( exchangedQ != otherFirstQ ||
G4UniformRand() < probSame ) {
565 otherExchangedQ = otherFirstQ; otherFirstQ = exchangedQ; exchangedQ = otherExchangedQ;
567 if ( exchangedQ != otherSecondQ ||
G4UniformRand() < probSame ) {
568 otherExchangedQ = otherSecondQ; otherSecondQ = exchangedQ; exchangedQ = otherExchangedQ;
571 otherExchangedQ = otherThirdQ; otherThirdQ = exchangedQ; exchangedQ = otherExchangedQ;
575 }
while ( otherExchangedQ == 0 && ++count < MaxCount );
576 if ( count >= MaxCount )
return returnCode;
579 if ( Ksi < 0.333333 ) {
581 }
else if ( 0.333333 <= Ksi && Ksi < 0.666667 ) {
582 secondQ = exchangedQ;
586 if ( isProjectileExchangedQ ) {
587 ProjQ1 = firstQ; ProjQ2 = secondQ; ProjQ3 = thirdQ;
588 TargQ1 = otherFirstQ; TargQ2 = otherSecondQ; TargQ3 = otherThirdQ;
590 TargQ1 = firstQ; TargQ2 = secondQ; TargQ3 = thirdQ;
591 ProjQ1 = otherFirstQ; ProjQ2 = otherSecondQ; ProjQ3 = otherThirdQ;
593 #ifdef debugFTFexictation
594 G4cout <<
"Exchange Qs Pr Tr " << ( isProjectileExchangedQ ? exchangedQ : otherExchangedQ )
595 <<
" " << ( isProjectileExchangedQ ? otherExchangedQ : exchangedQ ) <<
G4endl;
604 for (
G4int iHadron = 0; iHadron < 2; iHadron++ ) {
606 G4int codeQ1 = ProjQ1, codeQ2 = ProjQ2, codeQ3 = ProjQ3, newHadCode = NewProjCode;
609 if ( iHadron == 1 ) {
610 codeQ1 = TargQ1, codeQ2 = TargQ2, codeQ3 = TargQ3, newHadCode = NewTargCode;
614 if ( codeQ1 == codeQ2 && codeQ1 == codeQ3 ) {
616 }
else if ( isHadronADelta ) {
631 if ( iHadron == 0 ) {
632 NewProjCode = newHadCode;
634 NewTargCode = newHadCode;
637 #ifdef debugFTFexictation
638 G4cout <<
"NewProjCode NewTargCode " << NewProjCode <<
" " << NewTargCode <<
G4endl;
651 G4int firstHadronCode = NewTargCode, secondHadronCode = NewProjCode;
653 G4bool isFirstTarget =
true;
656 firstHadron = projectile; secondHadron =
target;
657 firstHadronCode = NewProjCode; secondHadronCode = NewTargCode;
659 isFirstTarget =
false;
661 G4double Mtest1st = 0.0, Mtest2nd = 0.0, Mmin1st = 0.0, Mmin2nd = 0.0;
662 for (
int iSamplingCase = 0; iSamplingCase < 2; iSamplingCase++ ) {
664 G4int aHadronCode = firstHadronCode;
665 if ( iSamplingCase == 1 ) {
666 aHadron = secondHadron; aHadronCode = secondHadronCode; massConstraint = Mtest1st;
668 G4double MtestHadron = 0.0, MminHadron = 0.0;
671 if ( ! TestParticle )
return returnCode;
673 if ( common.
SqrtS - massConstraint < MminHadron )
return returnCode;
677 const G4int maxNumberOfAttempts = 50;
679 while ( attempts < maxNumberOfAttempts ) {
683 if ( common.
SqrtS < MtestHadron + massConstraint ) {
689 if ( attempts >= maxNumberOfAttempts )
return returnCode;
692 if ( iSamplingCase == 0 ) {
693 Mtest1st = MtestHadron; Mmin1st = MminHadron;
695 Mtest2nd = MtestHadron; Mmin2nd = MminHadron;
698 if ( isFirstTarget ) {
699 MtestTr = Mtest1st; MtestPr = Mtest2nd;
702 MtestTr = Mtest2nd; MtestPr = Mtest1st;
706 if ( MtestPr != 0.0 ) {
712 if ( MtestTr != 0.0 ) {
728 #ifdef debugFTFexictation
729 G4cout <<
"At the end// NewProjCode " << NewProjCode << G4endl
730 <<
"At the end// NewTargCode " << NewTargCode << G4endl
732 << common.
SqrtS << G4endl
734 << common.
SqrtS << G4endl
735 <<
"PZcms2 after the change " << common.
PZcms2 << G4endl << G4endl;
737 if ( common.
PZcms2 < 0.0 )
return returnCode;
746 #ifdef debugFTFexictation
747 G4cout <<
"Proj Targ and Proj+Targ in CMS" << G4endl << common.
Pprojectile << G4endl
760 #ifdef debugFTFexictation
761 G4cout <<
"Make elastic scattering of new hadrons" <<
G4endl;
768 #ifdef debugFTFexictation
769 G4cout <<
"Result of el. scatt " << Result << G4endl <<
"Proj Targ and Proj+Targ in Lab"
774 if ( Result ) returnCode = 0;
778 #ifdef debugFTFexictation
789 return returnCode = 1;
801 G4bool isProjectileDiffraction =
false;
803 isProjectileDiffraction =
true;
804 #ifdef debugFTFexictation
812 #ifdef debugFTFexictation
822 G4bool loopCondition =
true;
823 G4int whilecount = 0;
827 if ( whilecount > 1000 ) {
838 if ( common.
PZcms2 < 0.0 )
return false;
843 if ( isProjectileDiffraction ) {
857 if ( common.
PZcms2 < 0.0 )
continue;
860 if ( isProjectileDiffraction ) {
886 }
while ( loopCondition );
889 if ( isProjectileDiffraction ) {
910 #ifdef debugFTFexictation
913 G4int whilecount = 0;
917 if ( whilecount > 1000 ) {
932 if ( common.
PZcms2 < 0.0 )
return false;
947 if ( common.
PZcms2 < 0.0 )
continue;
968 #ifdef debugFTFexictation
969 G4cout <<
"Sampled: Mpr, MdifPr, Mtr, MdifTr "<<G4endl
1002 if ( start == NULL ) {
1003 G4cout <<
" G4FTFModel::String() Error: No start parton found" <<
G4endl;
1004 FirstString = 0; SecondString = 0;
1009 if ( end == NULL ) {
1010 G4cout <<
" G4FTFModel::String() Error: No end parton found" <<
G4endl;
1011 FirstString = 0; SecondString = 0;
1032 if ( isProjectile ) {
1063 if ( Pt > 500.0*
MeV ) {
1067 x3 = 1.0 - Pt/W *
G4Exp(-Y );
1071 if ( PDGcode_startQ < 3 ) Mass_startQ = 325.0*
MeV;
1072 if ( PDGcode_startQ == 3 ) Mass_startQ = 500.0*
MeV;
1073 if ( PDGcode_startQ == 4 ) Mass_startQ = 1600.0*
MeV;
1075 if ( PDGcode_endQ < 3 ) Mass_endQ = 325.0*
MeV;
1076 if ( PDGcode_endQ == 3 ) Mass_endQ = 500.0*
MeV;
1077 if ( PDGcode_endQ == 4 ) Mass_endQ = 1600.0*
MeV;
1079 G4double P2_1 = W2*x1*x1/4.0 - Mass_endQ*Mass_endQ;
1080 G4double P2_3 = W2*x3*x3/4.0 - Mass_startQ*Mass_startQ;
1082 if ( P2_1 <= 0.0 || P2_3 <= 0.0 ) {
1088 G4double CosT12 = ( P2_3 - P2_1 - P2_2 ) / (2.0*P_1*P_2);
1089 G4double CosT13 = ( P2_2 - P2_1 - P2_3 ) / (2.0*P_1*P_3);
1095 Pt = P_2 * std::sqrt( 1.0 - CosT12*CosT12 );
1099 Pstart.
setE( x3*W/2.0 );
1101 Pend.
setE( x1*W/2.0 );
1104 if ( Pkink.
getZ() > 0.0 ) {
1106 PkinkQ1 = XkQ*Pkink;
1108 PkinkQ1 = (1.0 - XkQ)*Pkink;
1112 PkinkQ1 = (1.0 - XkQ)*Pkink;
1114 PkinkQ1 = XkQ*Pkink;
1118 PkinkQ2 = Pkink - PkinkQ1;
1121 std::sqrt(
sqr(
sqr(x1) -
sqr(x3) ) +
sqr( 2.0*x1*x3*CosT13 ) );
1122 G4double Psi = std::acos( Cos2Psi );
1125 if ( isProjectile ) {
1145 std::vector< G4double > QuarkProbabilitiesAtGluonSplitUp =
1149 for (
unsigned int Iq = 0; Iq < 3; Iq++ ) {
1151 if ( Ksi > QuarkProbabilitiesAtGluonSplitUp[Iq] ) QuarkInGluon++;
1176 G4int absPDGcode = 1500;
1183 if ( absPDGcode < 1000 ) {
1184 if ( isProjectile ) {
1213 if ( isProjectile ) {
1265 if ( Momentum > 0.0 ) {
1271 tmp.
set( 0.0, 0.0, 1.0 );
1275 if ( isProjectile ) {
1276 Pstart1 *= (-1.0)*Minus/2.0;
1277 Pend1 *= (+1.0)*Plus /2.0;
1279 Pstart1 *= (+1.0)*Plus/ 2.0;
1280 Pend1 *= (-1.0)*Minus/2.0;
1283 Momentum = Pstart1.
vect().
mag();
1285 Pstart1.
setT( Momentum );
1287 Momentum = Pend1.
vect().
mag();
1289 Pend1.
setT( Momentum );
1304 <<
" generated string momenta: Diquark " << end->
Get4Momentum() <<
"mass : "
1306 << Pstart + Pend <<
G4endl <<
" Original "
1320 if ( Pmin <= 0.0 || range <= 0.0 ) {
1321 G4cout <<
" Pmin, range : " << Pmin <<
" , " << range <<
G4endl;
1323 "G4DiffractiveExcitation::ChooseP : Invalid arguments " );
1336 if ( AveragePt2 <= 0.0 ) {
1340 (
G4Exp( -maxPtSquare/AveragePt2 ) - 1.0 ) );
1344 return G4ThreeVector( Pt * std::cos( phi ), Pt * std::sin( phi ), 0.0 );
1352 const G4int maxNumberOfLoops = 10000;
1353 G4int loopCounter = 0;
1356 yf = z*z +
sqr(1.0 - z);
1358 ++loopCounter < maxNumberOfLoops );
1359 if ( loopCounter >= maxNumberOfLoops ) {
1360 z = 0.5*(zmin + zmax);
1370 if ( ! ( absIdPDG == 111 || absIdPDG == 221 || absIdPDG == 331 ) ) {
1372 Q1 = absIdPDG / 100;
1373 Q2 = (absIdPDG % 100) / 10;
1375 if ( IdPDG < 0 ) anti *= -1;
1381 else { Q1 = 2; Q2 = -2; }
1392 Q2 = (IdPDG % 1000) / 100;
1393 Q3 = (IdPDG % 100) / 10;
1406 }
else if ( Q3 > Q1 ) {
1416 G4int NewCode = Q1*1000 + Q2*100 + Q3*10 + 2;
1425 "G4DiffractiveExcitation copy constructor not meant to be called" );
1433 "G4DiffractiveExcitation = operator not meant to be called" );
1442 "G4DiffractiveExcitation == operator not meant to be called" );
1450 "G4DiffractiveExcitation != operator not meant to be called" );