Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -384,7 +384,7 @@ ExciteParticipants_doChargeExchange( G4VSplitableHadron* projectile,
if ( ProjExchangeQ != TargQ1 ) NpossibleStates++;
if ( ProjExchangeQ != TargQ2 ) NpossibleStates++;
if ( ProjExchangeQ != TargQ3 ) NpossibleStates++;
G4int Nsampled = G4RandFlat::shootInt( G4long( NpossibleStates ) ) + 1;
G4int Nsampled = (G4int)G4RandFlat::shootInt( G4long( NpossibleStates ) )+1;
NpossibleStates = 0;
if ( ProjExchangeQ != TargQ1 ) {
if ( ++NpossibleStates == Nsampled ) {
@@ -415,26 +415,42 @@ ExciteParticipants_doChargeExchange( G4VSplitableHadron* projectile,
while ( attempts++ < maxNumberOfAttempts ) { /* Loop checking, 10.08.2015, A.Ribon */
// Determination of a new projectile ID which satisfies energy-momentum conservation
G4double ProbSpin0 = 0.5;
G4double Ksi = G4UniformRand();
if ( aProjQ1 == aProjQ2 ) {
if ( aProjQ1 < 3 ) {
NewProjCode = 111; // Pi0-meson
if ( Ksi < 0.5 ) {
NewProjCode = 221; // Eta-meson
if ( Ksi < 0.25 ) {
NewProjCode = 331; // Eta'-meson
}
}
} else if ( aProjQ1 == 3 ) {
NewProjCode = 221; // Eta-meson
if ( Ksi < 0.5 ) {
NewProjCode = 331; // Eta'-meson
}
} else if ( aProjQ1 == 4 ) {
NewProjCode = 441; // Eta_c
} else if ( aProjQ1 == 5 ) {
NewProjCode = 553; // Upsilon
}
if ( G4UniformRand() < ProbSpin0 ) { // Meson spin = 0 (pseudo-scalar)
if ( aProjQ1 < 3 ) {
NewProjCode = 111; // pi0
if ( Ksi < 0.5 ) {
NewProjCode = 221; // eta
if ( Ksi < 0.25 ) {
NewProjCode = 331; // eta'
}
}
} else if ( aProjQ1 == 3 ) {
NewProjCode = 221; // eta
if ( Ksi < 0.5 ) {
NewProjCode = 331; // eta'
}
} else if ( aProjQ1 == 4 ) {
NewProjCode = 441; // eta_c(1S)
} else if ( aProjQ1 == 5 ) {
NewProjCode = 551; // eta_b(1S)
}
} else { // Meson spin = 1 (vector meson)
if ( aProjQ1 < 3 ) {
NewProjCode = 113; // rho0
if ( Ksi < 0.5 ) {
NewProjCode = 223; // omega
}
} else if ( aProjQ1 == 3 ) {
NewProjCode = 333; // phi
} else if ( aProjQ1 == 4 ) {
NewProjCode = 443; // J/psi(1S)
} else if ( aProjQ1 == 5 ) {
NewProjCode = 553; // Upsilon(1S)
}
}
} else {
if ( aProjQ1 > aProjQ2 ) {
NewProjCode = aProjQ1*100 + aProjQ2*10 + 1;
@@ -202,6 +202,16 @@ void G4DiffractiveSplitableHadron::ChooseStringEnds( G4int PDGcode, G4int* aEnd,
G4int j100 = (PDGcode % 1000)/100;
G4int j10 = (PDGcode % 100)/10;
if ( absPDGcode > 4000 ) {
*aEnd = j10;
if ( G4UniformRand() > 0.25 ) {
*bEnd = Diquark( j1000, j100, 0 );
} else {
*bEnd = Diquark( j1000, j100, 1 );
}
return;
}
G4double SuppresUUDDSS=1.0/2.0;
if ((j1000 == j100) && (j1000 == j10)) SuppresUUDDSS=1.;
@@ -292,8 +292,99 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
G4cout << "Process a, 3 shirt diagram" << G4endl;
#endif
// Sampling kinematical properties of quark. It can be done before string's creation
const G4int maxNumberOfLoops = 1000;
G4double MassQ2 = 0.0; // Simplest case is considered with Mass_Q = 0.0
// In principle, this must work with Mass_Q != 0.0
G4double Quark_Xs[6];
G4ThreeVector Quark_Mom[6];
G4double Alfa_R = 0.5;
G4double AveragePt2 = 200.0*200.0, maxPtSquare = common.S;
G4double ScaleFactor = 1.0;
G4double Alfa = 0.0, Beta = 0.0;
G4int NumberOfTries = 0, loopCounter = 0;
do {
// Sampling X's of anti-baryon and baryon
G4double x1 = 0.0, x2 = 0.0, x3 = 0.0;
G4double Product = 1.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // anti-baryon (1st case), baryon (2nd case)
G4double r1 = G4UniformRand(), r2 = G4UniformRand();
if ( Alfa_R == 1.0 ) {
x1 = 1.0 - std::sqrt( r1 );
x2 = (1.0 - x1) * r2;
} else {
x1 = sqr( r1 );
x2 = (1.0 - x1) * sqr( std::sin( pi/2.0*r2 ) );
}
x3 = 1.0 - x1 - x2;
G4int index = iCase*3; // 0 for anti-baryon, 3 for baryon
Quark_Xs[index] = x1; Quark_Xs[index+1] = x2; Quark_Xs[index+2] = x3;
Product *= (x1*x2*x3);
}
if ( Product == 0.0 ) continue;
++NumberOfTries;
if ( NumberOfTries == 100*(NumberOfTries/100) ) {
// After a large number of tries, it is better to reduce the values of <Pt^2>
ScaleFactor /= 2.0;
AveragePt2 *= ScaleFactor;
}
G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
for ( G4int i = 0; i < 6; ++i ) {
Quark_Mom [i] = GaussianPt( AveragePt2, maxPtSquare );
PtSum += Quark_Mom[i];
}
PtSum /= 6.0;
Alfa = 0.0; Beta = 0.0;
for ( G4int i = 0; i < 6; ++i ) { // Loop over the quarks and (anti-)quarks
Quark_Mom[i] -= PtSum;
G4double val = ( Quark_Mom[i].mag2() + MassQ2 ) / Quark_Xs[i];
if ( i < 3 ) { // anti-baryon
Alfa += val;
} else { // baryon (iCase == 1)
Beta += val;
}
}
} while ( ( std::sqrt( Alfa ) + std::sqrt( Beta ) > common.SqrtS ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return false;
}
G4double DecayMomentum2 = sqr(common.S) + sqr(Alfa) + sqr(Beta)
- 2.0*( common.S*(Alfa + Beta) + Alfa*Beta );
G4double WminusTarget = 0.0, WplusProjectile = 0.0;
WminusTarget = ( common.S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / common.SqrtS;
WplusProjectile = common.SqrtS - Beta/WminusTarget;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // anti-baryon (1st case), baryon (2nd case)
G4int index = iCase*3; // 0 for anti-baryon, 3 for baryon
G4double w = WplusProjectile; // for anti-baryon
if ( iCase == 1 ) w = - WminusTarget; // for baryon
for ( G4int i = 0; i < 3; ++i ) {
G4double Pz = w * Quark_Xs[index+i] / 2.0 -
( Quark_Mom[index+i].mag2() + MassQ2 ) /
( 2.0 * w * Quark_Xs[index+i] );
Quark_Mom[index+i].setZ( Pz );
}
}
// Sampling of anti-quark order in projectile
G4int SampledCase = G4RandFlat::shootInt( G4long( 6 ) );
G4int SampledCase = (G4int)G4RandFlat::shootInt( 6 );
G4int Tmp1 = 0, Tmp2 = 0;
switch ( SampledCase ) {
case 1 : Tmp1 = common.AQ[1]; common.AQ[1] = common.AQ[2]; common.AQ[2] = Tmp1; break;
@@ -329,7 +420,7 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
G4int absAntiQuark = std::abs( antiQuark ), absQuark = std::abs( quark );
G4double aKsi = G4UniformRand();
if ( absAntiQuark == absQuark ) {
if ( absAntiQuark != 3 ) {
if ( absAntiQuark != 3 ) { // Not yet considered the case absAntiQuark 4 (charm) and 5 (bottom)
NewCode = 111; // Pi0-meson
if ( aKsi < 0.5 ) {
NewCode = 221; // Eta -meson
@@ -343,7 +434,7 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
NewCode = 331; // Eta'-meson
}
}
} else {
} else { // Vector mesons - rho, omega, phi (not yet considered the analogous cases for charm and bottom)
if ( absAntiQuark > absQuark ) {
NewCode = absAntiQuark*100 + absQuark*10 + 1; NewCode *= absAntiQuark/antiQuark;
} else {
@@ -355,8 +446,8 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
if ( ! TestParticle ) return false;
if ( iString == 0 ) {
projectile->SetDefinition( TestParticle );
theParameters->SetProjMinDiffMass( 0.5 );
theParameters->SetProjMinNonDiffMass( 0.5 );
theParameters->SetProjMinDiffMass( 0.5 ); // 0.5 GeV : Min diffractive mass of pi-meson
theParameters->SetProjMinNonDiffMass( 0.5 ); // It must be self-consistent with Parameters
} else if ( iString == 1 ) {
target->SetDefinition( TestParticle );
theParameters->SetTarMinDiffMass( 0.5 );
@@ -369,106 +460,8 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
}
} // End of the for loop over the 3 string cases
// Sampling kinematical properties:
// 1st string AQ[0]-Q[0], 2nd string AQ[1]-Q[1], 3rd string AQ[2]-Q[2]
G4ThreeVector Quark_Mom[6];
G4double ModMom2[6];
G4double AveragePt2 = 200.0*200.0, maxPtSquare = common.S, SumMt = 0.0, MassQ2 = 0.0,
ScaleFactor = 1.0;
G4int NumberOfTries = 0, loopCounter = 0;
const G4int maxNumberOfLoops = 1000;
do {
++NumberOfTries;
if ( NumberOfTries == 100*(NumberOfTries/100) ) {
// At large number of tries it would be better to reduce the values of <Pt^2>
ScaleFactor /= 2.0;
AveragePt2 *= ScaleFactor;
}
G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
for ( G4int i = 0; i < 6; ++i ) {
Quark_Mom [i] = GaussianPt( AveragePt2, maxPtSquare );
PtSum += Quark_Mom[i];
}
PtSum /= 6.0;
SumMt = 0.0;
for ( G4int i = 0; i < 6; ++i ) {
Quark_Mom[i] -= PtSum;
ModMom2[i] = Quark_Mom[i].mag2();
SumMt += std::sqrt( ModMom2[i] + MassQ2 );
}
} while ( ( SumMt > common.SqrtS ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return false;
}
// Sampling X's of anti-baryon and baryon
G4double WminusTarget = 0.0, WplusProjectile = 0.0;
G4double Alfa_R = 0.5;
G4bool Success = true;
NumberOfTries = 0; loopCounter = 0;
do {
Success = true;
++NumberOfTries;
G4double Alfa = 0.0, Beta = 0.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // anti-baryon (1st case), baryon (2nd case)
G4double x1 = 0.0, x2 = 0.0;
G4double r1 = G4UniformRand(), r2 = G4UniformRand();
if ( Alfa_R == 1.0 ) {
x1 = 1.0 - std::sqrt( r1 );
x2 = (1.0 - x1) * r2;
} else {
x1 = sqr( r1 );
x2 = (1.0 - x1) * sqr( std::sin( pi/2.0*r2 ) );
}
G4double x3 = 1.0 - x1 - x2;
G4int index = iCase*3; // 0 for anti-baryon, 3 for baryon
Quark_Mom[index].setZ( x1 ); Quark_Mom[index+1].setZ( x2 ); Quark_Mom[index+2].setZ( x3 );
for ( G4int i = 0; i < 3; ++i ) { // Loop over the 3 (anti-)quarks
if ( Quark_Mom[index+i].getZ() != 0.0 ) {
G4double val = ( ModMom2[index+i] + MassQ2 ) / Quark_Mom[index+i].getZ();
if ( iCase == 0 ) { // anti-baryon
Alfa += val;
} else { // baryon (iCase == 1)
Beta += val;
}
} else {
Success = false;
}
}
}
if ( ! Success ) continue;
if ( std::sqrt( Alfa ) + std::sqrt( Beta ) > common.SqrtS ) {
Success = false;
continue;
}
G4double DecayMomentum2 = sqr(common.S) + sqr(Alfa) + sqr(Beta)
- 2.0*( common.S*(Alfa + Beta) + Alfa*Beta );
WminusTarget = ( common.S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / common.SqrtS;
WplusProjectile = common.SqrtS - Beta/WminusTarget;
} while ( ( ! Success ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return false;
}
G4double SqrtScaleF = 1.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // anti-baryon (1st case), baryon (2nd case)
G4int index = iCase*3; // 0 for anti-baryon, 3 for baryon
G4double w = WplusProjectile; // for anti-baryon
if ( iCase == 1 ) w = - WminusTarget; // for baryon
for ( G4int i = 0; i < 3; ++i ) {
G4double Pz = w * Quark_Mom[index+i].getZ() / 2.0 -
( ScaleFactor * ModMom2[index+i] + MassQ2 ) /
( 2.0 * w * Quark_Mom[index+i].getZ() );
Quark_Mom[index+i].setZ( Pz );
if ( ScaleFactor != 1.0 ) {
Quark_Mom[index+i].setX( SqrtScaleF * Quark_Mom[index+i].getX() );
Quark_Mom[index+i].setY( SqrtScaleF * Quark_Mom[index+i].getY() );
}
}
}
G4LorentzVector Pstring1, Pstring2, Pstring3;
G4int QuarkOrder[3] = { 0 };
G4double YstringMax = 0.0, YstringMin = 0.0;
@@ -542,6 +535,16 @@ Create3QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
common.Ptarget = Pstring3; // Lowest rapidity
G4LorentzVector LeftString( Pstring2 ); // Middle rapidity
if ( common.RotateStrings ) {
common.Pprojectile *= common.RandomRotation;
common.Ptarget *= common.RandomRotation;
LeftString *= common.RandomRotation;
}
common.Pprojectile.transform( common.toLab );
common.Ptarget.transform( common.toLab );
LeftString.transform( common.toLab );
// Calculation of the creation time
// Creation time and position of target nucleon were determined in ReggeonCascade() of G4FTFModel
projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
@@ -579,7 +582,7 @@ Create1DiquarkAntiDiquarkString( G4VSplitableHadron* projectile,
G4int CandidatsN = 0, CandAQ[9][2] = {}, CandQ[9][2] = {};
for ( G4int iAQ = 0; iAQ < 3; ++iAQ ) { // index of the 3 constituent anti-quarks of the antibaryon projectile
for ( G4int iQ = 0; iQ < 3; ++iQ ) { // index of the 3 constituent quarks of the nucleon target
for ( G4int iQ = 0; iQ < 3; ++iQ ) { // index of the 3 constituent quarks of the target nucleon
if ( -common.AQ[iAQ] == common.Q[iQ] ) { // antiquark - quark that can annihilate
// Here "0", "1", "2" means, respectively, "first", "second" and "third" constituent
// of the (anti-baryon) projectile or (nucleon) target.
@@ -597,7 +600,7 @@ Create1DiquarkAntiDiquarkString( G4VSplitableHadron* projectile,
// Remaining two (anti-)quarks that form the (anti-)diquark
G4int LeftAQ1 = 0, LeftAQ2 = 0, LeftQ1 = 0, LeftQ2 = 0;
if ( CandidatsN != 0 ) {
G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
G4int SampledCase = (G4int)G4RandFlat::shootInt( CandidatsN );
LeftAQ1 = common.AQ[ CandAQ[SampledCase][0] ];
LeftAQ2 = common.AQ[ CandAQ[SampledCase][1] ];
LeftQ1 = common.Q[ CandQ[SampledCase][0] ];
@@ -622,8 +625,9 @@ Create1DiquarkAntiDiquarkString( G4VSplitableHadron* projectile,
projectile->SetFirstParton( DQ );
projectile->SetSecondParton( Anti_DQ );
G4LorentzVector Pquark = G4LorentzVector( 0.0, 0.0, common.SqrtS/2.0, common.SqrtS/2.0 );
G4LorentzVector Paquark = G4LorentzVector( 0.0, 0.0, -common.SqrtS/2.0, common.SqrtS/2.0 );
// It is assumed that quark and di-quark masses are 0.
G4LorentzVector Pquark = G4LorentzVector( 0.0, 0.0, -common.SqrtS/2.0, common.SqrtS/2.0 );
G4LorentzVector Paquark = G4LorentzVector( 0.0, 0.0, common.SqrtS/2.0, common.SqrtS/2.0 );
if ( common.RotateStrings ) {
Pquark *= common.RandomRotation;
@@ -658,6 +662,9 @@ Create1DiquarkAntiDiquarkString( G4VSplitableHadron* projectile,
return 0; // Completed successfully: nothing else to be done
} // End of if ( CandidatsN != 0 )
// If we allow the string to interact with other nuclear nucleons, we have to
// set up MinDiffrMass in Parameters, and ascribe a PDGEncoding. To be done yet!
return 1; // Successfully ended, but the work is not over
}
@@ -680,6 +687,91 @@ Create2QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
<< G4endl;
#endif
// Sampling kinematical properties: 1st string LeftAQ1-LeftQ1, 2nd string LeftAQ2-LeftQ2
G4ThreeVector Quark_Mom[4];
G4double Quark_Xs[4];
G4double AveragePt2 = 200.0*200.0, maxPtSquare = common.S, MassQ2 = 0.0, ScaleFactor = 1.0;
G4int NumberOfTries = 0, loopCounter = 0;
const G4int maxNumberOfLoops = 1000;
G4double Alfa = 0.0, Beta = 0.0;
G4double WminusTarget = 0.0, WplusProjectile = 0.0, Alfa_R = 0.5;
do {
// Sampling X's of the 2 quarks and 2 anti-quarks
G4double Product = 1.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // Loop over the two strings
G4double x = 0.0, r = G4UniformRand();
if ( Alfa_R == 1.0 ) {
if ( iCase == 0 ) { // first string
x = std::sqrt( r );
} else { // second string
x = 1.0 - std::sqrt( r );
}
} else {
x = sqr( std::sin( pi/2.0*r ) );
}
G4int index = iCase*2; // 0 for the first string, 2 for the second string
Quark_Xs[index] = x ; Quark_Xs[index+1] = 1.0 - x ;
Product *= x*(1.0-x);
}
if ( Product == 0.0 ) continue;
++NumberOfTries;
if ( NumberOfTries == 100*(NumberOfTries/100) ) {
// After a large number of tries, it is better to reduce the values of <Pt^2>
ScaleFactor /= 2.0;
AveragePt2 *= ScaleFactor;
}
G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
for( G4int i = 0; i < 4; ++i ) {
Quark_Mom[i] = GaussianPt( AveragePt2, maxPtSquare );
PtSum += Quark_Mom[i];
}
PtSum /= 4.0;
for ( G4int i = 0; i < 4; ++i ) {
Quark_Mom[i] -= PtSum;
}
Alfa = 0.0; Beta = 0.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) {
G4int index = iCase * 2;
for ( G4int i = 0; i < 2; ++i ) {
G4double val = ( Quark_Mom[index+i].mag2() + MassQ2 ) / Quark_Xs[index+i];
if ( iCase == 0 ) { // first string
Alfa += val;
} else { // second string
Beta += val;
}
}
}
} while ( ( std::sqrt( Alfa ) + std::sqrt( Beta ) > common.SqrtS ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return 99; // unsuccessfully ended, nothing else can be done
}
G4double DecayMomentum2 = sqr(common.S) + sqr(Alfa) + sqr(Beta)
- 2.0*( common.S*(Alfa + Beta) + Alfa*Beta );
WminusTarget = ( common.S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / common.SqrtS;
WplusProjectile = common.SqrtS - Beta/WminusTarget;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // Loop over the two strings
G4int index = iCase*2; // 0 for the first string, 2 for the second string
for ( G4int i = 0; i < 2; ++i ) {
G4double w = WplusProjectile; // For the first string
if ( iCase == 1 ) w = - WminusTarget; // For the second string
G4double Pz = w * Quark_Xs[index+i] / 2.0
- ( Quark_Mom[index+i].mag2() + MassQ2 ) /
( 2.0 * w * Quark_Xs[index+i] );
Quark_Mom[index+i].setZ( Pz );
}
}
G4int CandidatsN = 0, CandAQ[9][2] = {}, CandQ[9][2] = {};
G4int LeftAQ1 = 0, LeftAQ2 = 0, LeftQ1 = 0, LeftQ2 = 0;
for ( G4int iAQ = 0; iAQ < 3; ++iAQ ) { // index of the 3 constituent anti-quarks of the antibaryon projectile
@@ -699,7 +791,7 @@ Create2QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
}
if ( CandidatsN != 0 ) {
G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
G4int SampledCase = (G4int)G4RandFlat::shootInt( CandidatsN );
LeftAQ1 = common.AQ[ CandAQ[SampledCase][0] ];
LeftAQ2 = common.AQ[ CandAQ[SampledCase][1] ];
if ( G4UniformRand() < 0.5 ) {
@@ -765,104 +857,6 @@ Create2QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
}
} // End of loop over the 2 string cases
// Sampling kinematical properties: 1st string LeftAQ1-LeftQ1, 2nd string LeftAQ2-LeftQ2
G4ThreeVector Quark_Mom[4];
G4double ModMom2[4];
G4double AveragePt2 = 200.0*200.0, maxPtSquare = common.S, SumMt = 0.0, MassQ2 = 0.0,
ScaleFactor = 1.0;
G4int NumberOfTries = 0, loopCounter = 0;
const G4int maxNumberOfLoops = 1000;
do {
++NumberOfTries;
if ( NumberOfTries == 100*(NumberOfTries/100) ) {
// At large number of tries it would be better to reduce the values of <Pt^2>
ScaleFactor /= 2.0;
AveragePt2 *= ScaleFactor;
}
G4ThreeVector PtSum( 0.0, 0.0, 0.0 );
for( G4int i = 0; i < 4; ++i ) {
Quark_Mom[i] = GaussianPt( AveragePt2, maxPtSquare );
PtSum += Quark_Mom[i];
}
PtSum /= 4.0;
SumMt = 0.0;
for ( G4int i = 0; i < 4; ++i ) {
Quark_Mom[i] -= PtSum;
ModMom2[i] = Quark_Mom[i].mag2();
SumMt += std::sqrt( ModMom2[i] + MassQ2 );
}
} while ( ( SumMt > common.SqrtS ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return 99; // unsuccessfully ended, nothing else can be done
}
// Sampling X's of the two strings
G4double WminusTarget = 0.0, WplusProjectile = 0.0, Alfa_R = 0.5; ScaleFactor = 1.0;
G4bool Success = true;
NumberOfTries = 0, loopCounter = 0;
do {
Success = true;
++NumberOfTries;
G4double Alfa = 0.0, Beta = 0.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // Loop over the two strings
G4double x = 0.0, r = G4UniformRand();
if ( Alfa_R == 1.0 ) {
if ( iCase == 0 ) { // first string
x = std::sqrt( r );
} else { // second string
x = 1.0 - std::sqrt( r);
}
} else {
x = sqr( std::sin( pi/2.0*r ) );
}
G4int index = iCase*2; // 0 for the first string, 2 for the second string
Quark_Mom[index].setZ( x ); Quark_Mom[index+1].setZ( 1.0 - x );
for ( G4int i = 0; i < 2; ++i ) {
if ( Quark_Mom[i].getZ() != 0.0 ) {
G4double val = ( ModMom2[index+i] + MassQ2 ) / Quark_Mom[index+i].getZ();
if ( iCase == 0 ) { // first string
Alfa += val;
} else { // second string
Beta += val;
}
} else {
Success = false;
}
}
}
if ( ! Success ) continue;
if ( std::sqrt( Alfa ) + std::sqrt( Beta ) > common.SqrtS ) {
Success = false;
continue;
}
G4double DecayMomentum2 = sqr(common.S) + sqr(Alfa) + sqr(Beta)
- 2.0*( common.S*(Alfa + Beta) + Alfa*Beta );
WminusTarget = ( common.S - Alfa + Beta + std::sqrt( DecayMomentum2 ) ) / 2.0 / common.SqrtS;
WplusProjectile = common.SqrtS - Beta/WminusTarget;
} while ( ( ! Success ) &&
++loopCounter < maxNumberOfLoops ); /* Loop checking, 10.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
return 99; // unsuccessfully ended, nothing else can be done
}
G4double SqrtScaleF = 1.0;
for ( G4int iCase = 0; iCase < 2; ++iCase ) { // Loop over the two strings
G4int index = iCase*2; // 0 for the first string, 2 for the second string
for ( G4int i = 0; i < 2; ++i ) {
G4double w = WplusProjectile; // For the first string
if ( iCase == 1 ) w = - WminusTarget; // For the second string
G4double Pz = w * Quark_Mom[index+i].getZ() / 2.0
- ( ScaleFactor * ModMom2[index+i] + MassQ2 ) /
( 2.0 * w * Quark_Mom[index+i].getZ() );
Quark_Mom[index+i].setZ( Pz );
if ( ScaleFactor != 1.0 ) {
Quark_Mom[index+i].setX( SqrtScaleF * Quark_Mom[index+i].getX() );
Quark_Mom[index+i].setY( SqrtScaleF * Quark_Mom[index+i].getY() );
}
}
}
G4int QuarkOrder[2];
G4LorentzVector Pstring1, Pstring2;
G4double Ystring1 = 0.0, Ystring2 = 0.0;
@@ -897,6 +891,14 @@ Create2QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
QuarkOrder[0] = 1; QuarkOrder[1] = 0;
}
if ( common.RotateStrings ) {
common.Pprojectile *= common.RandomRotation;
common.Ptarget *= common.RandomRotation;
}
common.Pprojectile.transform( common.toLab );
common.Ptarget.transform( common.toLab );
G4LorentzVector Quark_4Mom[4];
for ( G4int i = 0; i < 4; ++i ) {
Quark_4Mom[i] = G4LorentzVector( Quark_Mom[i], std::sqrt( Quark_Mom[i].mag2() + MassQ2 ) );
@@ -912,14 +914,6 @@ Create2QuarkAntiQuarkStrings( G4VSplitableHadron* projectile,
target->GetNextParton()->Set4Momentum( Quark_4Mom[QuarkOrder[1]] );
target->GetNextAntiParton()->Set4Momentum( Quark_4Mom[QuarkOrder[1]+2] );
if ( common.RotateStrings ) {
common.Pprojectile *= common.RandomRotation;
common.Ptarget *= common.RandomRotation;
}
common.Pprojectile.transform( common.toLab );
common.Ptarget.transform( common.toLab );
// Calculation of the creation time
// Creation time and position of target nucleon were determined in ReggeonCascade() of G4FTFModel
projectile->SetTimeOfCreation( target->GetTimeOfCreation() );
@@ -986,7 +980,7 @@ Create1QuarkAntiQuarkString( G4VSplitableHadron* projectile,
}
if ( CandidatsN != 0 ) {
G4int SampledCase = G4RandFlat::shootInt( G4long( CandidatsN ) );
G4int SampledCase = (G4int)G4RandFlat::shootInt( CandidatsN );
LeftAQ = common.AQ[ CandAQ[SampledCase] ];
LeftQ = common.Q[ CandQ[SampledCase] ];
@@ -1034,8 +1028,11 @@ Create1QuarkAntiQuarkString( G4VSplitableHadron* projectile,
common.Pprojectile.setPz( 0.0 );
common.Pprojectile.setE( common.SqrtS );
G4LorentzVector Pquark = G4LorentzVector( 0.0, 0.0, common.SqrtS/2.0, common.SqrtS/2.0 );
G4LorentzVector Paquark = G4LorentzVector( 0.0, 0.0, -common.SqrtS/2.0, common.SqrtS/2.0 );
common.Pprojectile.transform( common.toLab );
G4LorentzVector Pquark = G4LorentzVector( 0.0, 0.0, -common.SqrtS/2.0, common.SqrtS/2.0 );
G4LorentzVector Paquark = G4LorentzVector( 0.0, 0.0, +common.SqrtS/2.0, common.SqrtS/2.0 );
if ( common.RotateStrings ) {
Pquark *= common.RandomRotation; Paquark *= common.RandomRotation;
}
@@ -704,7 +704,7 @@ G4bool G4FTFModel::PutOnMassShell() {
G4double M2target = 0.0;
G4double WminusTarget = 0.0;
G4int NumberOfTries = 0;
G4double ScaleFactor = 1.0;
G4double ScaleFactor = 2.0;
G4bool OuterSuccess = true;
const G4int maxNumberOfLoops = 1000;
@@ -958,29 +958,14 @@ G4bool G4FTFModel::ExciteParticipants() {
G4cout << "Annihilation" << G4endl;
#endif
NumberOfNNcollisions++;
// Skipping possible interactions of the annihilated nucleons
while ( theParticipants.Next() ) { /* Loop checking, 10.08.2015, A.Ribon */
G4InteractionContent& acollision = theParticipants.GetInteraction();
G4VSplitableHadron* NextProjectileNucleon = acollision.GetProjectile();
G4VSplitableHadron* NextTargetNucleon = acollision.GetTarget();
if ( projectile == NextProjectileNucleon || target == NextTargetNucleon ) {
acollision.SetStatus( 0 );
}
}
// Return to the annihilation
theParticipants.StartLoop();
for ( G4int I = 0; I < CurrentInteraction; ++I ) theParticipants.Next();
// At last, annihilation
if ( ! HighEnergyInter ) {
G4bool Annihilation = true;
G4bool Result = AdjustNucleons( projectile, ProjectileNucleon, target,
TargetNucleon, Annihilation );
if ( ! Result ) continue;
}
}
G4VSplitableHadron* AdditionalString = 0;
if ( theAnnihilation->Annihilate( projectile, target, AdditionalString, theParameters ) ) {
InnerSuccess = true;
@@ -993,6 +978,22 @@ G4bool G4FTFModel::ExciteParticipants() {
if ( AdditionalString != 0 ) theAdditionalString.push_back( AdditionalString );
NumberOfNNcollisions++;
// Skipping possible interactions of the annihilated nucleons
while ( theParticipants.Next() ) { /* Loop checking, 10.08.2015, A.Ribon */
G4InteractionContent& acollision = theParticipants.GetInteraction();
G4VSplitableHadron* NextProjectileNucleon = acollision.GetProjectile();
G4VSplitableHadron* NextTargetNucleon = acollision.GetTarget();
if ( projectile == NextProjectileNucleon || target == NextTargetNucleon ) {
acollision.SetStatus( 0 );
}
}
// Continue the interactions
theParticipants.StartLoop();
for ( G4int i = 0; i < CurrentInteraction; ++i ) theParticipants.Next();
/*
if ( target->GetStatus() == 4 ) {
// Skipping possible interactions of the annihilated nucleons
@@ -1046,7 +1047,7 @@ G4bool G4FTFModel::AdjustNucleons( G4VSplitableHadron* SelectedAntiBaryon,
<< "Tr ResidualMassNumber Tr ResidualCharge Tr ResidualExcitationEnergy "
<< TargetResidualMassNumber << " " << TargetResidualCharge << " "
<< TargetResidualExcitationEnergy << G4endl
<< "Collis. pr tr " << SelectedAntiBaryon->GetSoftCollisionCount()
<< "Collis. pr tr " << SelectedAntiBaryon->GetSoftCollisionCount() << " "
<< SelectedTargetNucleon->GetSoftCollisionCount() << G4endl;
#endif
@@ -1245,13 +1246,34 @@ G4int G4FTFModel::AdjustNucleonsAlgorithm_beforeSampling( G4int interactionCase,
common.PResidualExcitationEnergy = 0.0;
}
if ( common.PResidualMassNumber != 0 ) {
if ( common.PResidualLambdaNumber > 0 ) {
common.PResidualMass = G4HyperNucleiProperties::GetNuclearMass( common.PResidualMassNumber,
common.PResidualCharge,
common.PResidualLambdaNumber );
if ( common.PResidualMassNumber == 1 ) {
if ( std::abs( common.PResidualCharge ) == 1 ) {
common.PResidualMass = G4Proton::Definition()->GetPDGMass();
} else if ( common.PResidualLambdaNumber == 1 ) {
common.PResidualMass = G4Lambda::Definition()->GetPDGMass();
} else {
common.PResidualMass = G4Neutron::Definition()->GetPDGMass();
}
} else {
common.PResidualMass = G4ParticleTable::GetParticleTable()->GetIonTable()
->GetIonMass( common.PResidualCharge, common.PResidualMassNumber );
if ( common.PResidualLambdaNumber > 0 ) {
if ( common.PResidualMassNumber == 2 ) {
common.PResidualMass = G4Lambda::Definition()->GetPDGMass();
if ( std::abs( common.PResidualCharge ) == 1 ) { // lambda + proton
common.PResidualMass += G4Proton::Definition()->GetPDGMass();
} else if ( common.PResidualLambdaNumber == 1 ) { // lambda + neutron
common.PResidualMass += G4Neutron::Definition()->GetPDGMass();
} else { // lambda + lambda
common.PResidualMass += G4Lambda::Definition()->GetPDGMass();
}
} else {
common.PResidualMass = G4HyperNucleiProperties::GetNuclearMass( common.PResidualMassNumber,
std::abs( common.PResidualCharge ),
common.PResidualLambdaNumber );
}
} else {
common.PResidualMass = G4ParticleTable::GetParticleTable()->GetIonTable()->
GetIonMass( std::abs( common.PResidualCharge ), common.PResidualMassNumber );
}
}
}
common.PNucleonMass = ProjectileNucleon->GetDefinition()->GetPDGMass(); // On-shell (anti-)nucleon mass
@@ -1264,8 +1286,8 @@ G4int G4FTFModel::AdjustNucleonsAlgorithm_beforeSampling( G4int interactionCase,
common.TResidualExcitationEnergy = 0.0;
}
if ( common.TResidualMassNumber != 0 ) {
common.TResidualMass = G4ParticleTable::GetParticleTable()->GetIonTable()
->GetIonMass( common.TResidualCharge, common.TResidualMassNumber );
common.TResidualMass = G4ParticleTable::GetParticleTable()->GetIonTable()->
GetIonMass( common.TResidualCharge, common.TResidualMassNumber );
}
common.TNucleonMass = TargetNucleon->GetDefinition()->GetPDGMass(); // On-shell nucleon mass
common.SumMasses = common.PNucleonMass + common.PResidualMass + common.TNucleonMass
@@ -1930,14 +1952,17 @@ void G4FTFModel::AdjustNucleonsAlgorithm_afterSampling( G4int interactionCase,
ProjectileResidualMassNumber = common.TResidualMassNumber;
ProjectileResidualCharge = common.TResidualCharge;
ProjectileResidualExcitationEnergy = common.TResidualExcitationEnergy;
ProjectileResidualLambdaNumber = common.PResidualLambdaNumber;
} else { // interactionCase == 3
ProjectileResidualMassNumber = common.PResidualMassNumber;
ProjectileResidualCharge = common.PResidualCharge;
ProjectileResidualExcitationEnergy = common.PResidualExcitationEnergy;
ProjectileResidualLambdaNumber = common.PResidualLambdaNumber;
}
#ifdef debugAdjust
G4cout << "ProjectileResidualMassNumber ProjectileResidualCharge ProjectileResidualExcitationEnergy "
G4cout << "ProjectileResidualMassNumber ProjectileResidualCharge Lambdas ProjectileResidualExcitationEnergy "
<< ProjectileResidualMassNumber << " " << ProjectileResidualCharge << " "
<< ProjectileResidualLambdaNumber << " "
<< ProjectileResidualExcitationEnergy << G4endl;
#endif
if ( ProjectileResidualMassNumber != 0 ) {
@@ -2311,7 +2336,7 @@ void G4FTFModel::GetResiduals() {
#ifdef debugFTFmodel
G4VSplitableHadron* targetSplitable = aNucleon->GetSplitableHadron();
G4cout << i << " Hit? " << aNucleon->AreYouHit() << " " << targetSplitable << G4endl;
G4cout << i << " Hit? " << aNucleon->AreYouHit() << " pointer " << targetSplitable << G4endl;
if ( targetSplitable ) G4cout << i << "Status " << targetSplitable->GetStatus() << G4endl;
#endif
@@ -2413,7 +2438,7 @@ void G4FTFModel::GetResiduals() {
#ifdef debugFTFmodel
G4VSplitableHadron* projSplitable = aNucleon->GetSplitableHadron();
G4cout << i << " Hit? " << aNucleon->AreYouHit() << " " << projSplitable << G4endl;
G4cout << i << " Hit? " << aNucleon->AreYouHit() << " pointer " << projSplitable << G4endl;
if ( projSplitable ) G4cout << i << "Status " << projSplitable->GetStatus() << G4endl;
#endif
@@ -2691,7 +2716,7 @@ ComputeNucleusProperties( G4V3DNucleus* nucleus, // input paramete
}
#ifdef debugPutOnMassShell
G4cout << "ExcitationEnergyPerWoundedNucleon " << ExcitationEnergyPerWoundedNucleon << G4endl
<< "\t Residual Charge, MassNumber (LambdaNumber" << residualCharge << " "
<< "\t Residual Charge, MassNumber (Number of Lambdas)" << residualCharge << " "
<< residualMassNumber << " (" << residualNumberOfLambdas << ") "
<< G4endl << "\t Initial Momentum " << nucleusMomentum
<< G4endl << "\t Residual Momentum " << residualMomentum << G4endl;
@@ -2702,15 +2727,34 @@ ComputeNucleusProperties( G4V3DNucleus* nucleus, // input paramete
residualMass = 0.0;
residualExcitationEnergy = 0.0;
} else {
if ( residualNumberOfLambdas > 0 ) {
residualMass = G4HyperNucleiProperties::GetNuclearMass( residualMassNumber, residualCharge,
residualNumberOfLambdas );
} else {
residualMass = G4ParticleTable::GetParticleTable()->GetIonTable()->
GetIonMass( residualCharge, residualMassNumber );
}
if ( residualMassNumber == 1 ) {
if ( std::abs( residualCharge ) == 1 ) {
residualMass = G4Proton::Definition()->GetPDGMass();
} else if ( residualNumberOfLambdas == 1 ) {
residualMass = G4Lambda::Definition()->GetPDGMass();
} else {
residualMass = G4Neutron::Definition()->GetPDGMass();
}
residualExcitationEnergy = 0.0;
} else {
if ( residualNumberOfLambdas > 0 ) {
if ( residualMassNumber == 2 ) {
residualMass = G4Lambda::Definition()->GetPDGMass();
if ( std::abs( residualCharge ) == 1 ) { // lambda + proton
residualMass += G4Proton::Definition()->GetPDGMass();
} else if ( residualNumberOfLambdas == 1 ) { // lambda + neutron
residualMass += G4Neutron::Definition()->GetPDGMass();
} else { // lambda + lambda
residualMass += G4Lambda::Definition()->GetPDGMass();
}
} else {
residualMass = G4HyperNucleiProperties::GetNuclearMass( residualMassNumber, std::abs( residualCharge ),
residualNumberOfLambdas );
}
} else {
residualMass = G4ParticleTable::GetParticleTable()->GetIonTable()->
GetIonMass( std::abs( residualCharge ), residualMassNumber );
}
}
residualMass += residualExcitationEnergy;
}
@@ -2982,8 +3026,14 @@ CheckKinematics( const G4double sValue, // input parameter
G4cout << "decayMomentum2 " << decayMomentum2 << G4endl
<< "\t targetWminus projectileWplus " << targetWminus << " " << projectileWplus << G4endl
<< "\t projectileY targetY " << projectileY << " " << targetY << G4endl;
if ( isProjectileNucleus ) {
G4cout << "Order# of Wounded nucleon i, nucleon Y proj Y nuclY - proj Y " << G4endl;
} else {
G4cout << "Order# of Wounded nucleon i, nucleon Y targ Y nuclY - targ Y " << G4endl;
}
G4cout << G4endl;
#endif
for ( G4int i = 0; i < numberOfInvolvedNucleons; ++i ) {
G4Nucleon* aNucleon = involvedNucleons[i];
if ( ! aNucleon ) continue;
@@ -3000,7 +3050,12 @@ CheckKinematics( const G4double sValue, // input parameter
G4double nucleonY = 0.5 * G4Log( (e + pz)/(e - pz) );
#ifdef debugPutOnMassShell
G4cout << "i nY pY nY-AY AY " << i << " " << nucleonY << " " << projectileY <<G4endl;
if( isProjectileNucleus ) {
G4cout << " " << i << " " << nucleonY << " " << projectileY << " " <<nucleonY - projectileY << G4endl;
} else {
G4cout << " " << i << " " << nucleonY << " " << targetY << " " <<nucleonY - targetY << G4endl;
}
G4cout << G4endl;
#endif
if ( std::abs( nucleonY - nucleusY ) > 2 ||
@@ -3064,7 +3119,11 @@ FinalizeKinematics( const G4double w, // input parame
+ sqr( residual3Momentum.y() );
#ifdef debugPutOnMassShell
G4cout << "w residual3Momentum.z() " << w << " " << residual3Momentum.z() << G4endl;
if ( isProjectileNucleus ) {
G4cout << "Wminus Proj and residual3Momentum.z() " << w << " " << residual3Momentum.z() << G4endl;
} else {
G4cout << "Wplus Targ and residual3Momentum.z() " << w << " " << residual3Momentum.z() << G4endl;
}
#endif
G4double residualPz = 0.0;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//---------------------------------------------------------------------------
// ClassName: G4FTFTuningsMessenger
// Author: Alberto Ribon
// Date: August 2022
//---------------------------------------------------------------------------
#include "G4FTFTuningsMessenger.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4FTFTunings.hh"
G4FTFTuningsMessenger::G4FTFTuningsMessenger() {
// These two commands select an alternative set of FTF parameters (called "tune"):
// either via its integer index
theFTFTuneIndexCmd = new G4UIcmdWithAnInteger( "/process/had/models/ftf/selectTuneByIndex", this );
theFTFTuneIndexCmd->SetGuidance( "Select one FTF set of parameters (tune) via its index: 0 (default), 1, 2, ..." );
theFTFTuneIndexCmd->SetParameterName( "indexFTFTune", true );
theFTFTuneIndexCmd->SetDefaultValue( 0 );
theFTFTuneIndexCmd->SetRange( "indexFTFTune>=0" );
theFTFTuneIndexCmd->AvailableForStates( G4State_PreInit );
// or via its string name
theFTFTuneNameCmd = new G4UIcmdWithAString( "/process/had/models/ftf/selectTuneByName", this );
theFTFTuneNameCmd->SetGuidance( "Select one FTF set of parametes (tune) via its name (string)." );
theFTFTuneNameCmd->SetGuidance( " (default) is the default." );
theFTFTuneNameCmd->SetParameterName( "nameFTFTune", true );
theFTFTuneNameCmd->SetDefaultValue( "default" );
theFTFTuneNameCmd->AvailableForStates( G4State_PreInit );
}
G4FTFTuningsMessenger::~G4FTFTuningsMessenger() {
delete theFTFTuneIndexCmd;
delete theFTFTuneNameCmd;
}
void G4FTFTuningsMessenger::SetNewValue( G4UIcommand *command, G4String newValues ) {
if ( command == theFTFTuneIndexCmd || command == theFTFTuneNameCmd ) {
G4int index = -999;
if ( command == theFTFTuneIndexCmd ) {
G4int value = theFTFTuneIndexCmd->GetNewIntValue( newValues );
if ( value >= 0 && value < G4FTFTunings::sNumberOfTunes ) {
index = value;
} else {
G4ExceptionDescription ed;
ed << "The FTF tune index=" << value << " value is wrong!";
command->CommandFailed( ed );
}
} else {
for ( G4int i = 0; i < G4FTFTunings::sNumberOfTunes; ++i ) {
if ( newValues == G4FTFTunings::Instance()->GetTuneName(i) ) {
index = i;
break;
}
}
if ( index < 0 ) {
G4ExceptionDescription ed;
ed << "The FTF tune name=" << newValues << " is not found!";
command->CommandFailed( ed );
}
}
if ( index >= 0 ) {
// Tune applicability state: 0 means switched off; 1 means switched on.
G4FTFTunings::Instance()->SetTuneApplicabilityState(index, 1);
}
}
}