Import Geant4 9.5.0 source tree
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
// G4 Low energy model: n-n or p-p scattering
|
||||
// F.W. Jones, L.G. Greeniaus, H.P. Wellisch
|
||||
|
||||
// FWJ 27-AUG-2010: extended Coulomb-suppressed data to 5 GeV
|
||||
|
||||
#include "G4LEpp.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -44,7 +45,7 @@ G4LEpp::G4LEpp():G4HadronicInteraction("G4LEpp")
|
||||
SetCoulombEffects(0);
|
||||
|
||||
SetMinEnergy(0.);
|
||||
SetMaxEnergy(1200.*GeV);
|
||||
SetMaxEnergy(5.*GeV);
|
||||
}
|
||||
|
||||
G4LEpp::~G4LEpp()
|
||||
@@ -62,6 +63,7 @@ G4LEpp::SetCoulombEffects(G4int State)
|
||||
sig[i] = SigCoul[i];
|
||||
}
|
||||
elab = ElabCoul;
|
||||
SetMaxEnergy(1.2*GeV);
|
||||
}
|
||||
else {
|
||||
for(G4int i=0; i<NANGLE; i++)
|
||||
@@ -69,6 +71,7 @@ G4LEpp::SetCoulombEffects(G4int State)
|
||||
sig[i] = Sig[i];
|
||||
}
|
||||
elab = Elab;
|
||||
SetMaxEnergy(5.*GeV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,13 +89,12 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
G4double ek = aParticle->GetKineticEnergy();
|
||||
G4ThreeVector theInitial = aParticle->Get4Momentum().vect();
|
||||
|
||||
// if (verboseLevel > 1)
|
||||
{
|
||||
if (verboseLevel > 1) {
|
||||
G4double E = aParticle->GetTotalEnergy();
|
||||
G4double E0 = aParticle->GetDefinition()->GetPDGMass();
|
||||
G4double Q = aParticle->GetDefinition()->GetPDGCharge();
|
||||
G4double N = targetNucleus.GetN();
|
||||
G4double Z = targetNucleus.GetZ();
|
||||
G4int A = targetNucleus.GetA_asInt();
|
||||
G4int Z = targetNucleus.GetZ_asInt();
|
||||
G4cout << "G4LEpp:ApplyYourself: incident particle: "
|
||||
<< aParticle->GetDefinition()->GetParticleName() << G4endl;
|
||||
G4cout << "P = " << P/GeV << " GeV/c"
|
||||
@@ -104,7 +106,7 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
<< ", mass = " << E0/GeV << " GeV"
|
||||
<< ", charge = " << Q << G4endl;
|
||||
G4cout << "G4LEpp:ApplyYourself: material:" << G4endl;
|
||||
G4cout << "A = " << N
|
||||
G4cout << "A = " << A
|
||||
<< ", Z = " << Z
|
||||
<< ", atomic mass "
|
||||
<< G4Proton::Proton()->GetPDGMass()/GeV << "GeV"
|
||||
@@ -112,9 +114,9 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
//
|
||||
// GHEISHA ADD operation to get total energy, mass, charge
|
||||
//
|
||||
E += G4Proton::Proton()->GetPDGMass();
|
||||
E += proton_mass_c2;
|
||||
G4double E02 = E*E - P*P;
|
||||
E0 = std::sqrt(std::abs(E02));
|
||||
E0 = std::sqrt(std::fabs(E02));
|
||||
if (E02 < 0)E0 *= -1;
|
||||
Q += Z;
|
||||
G4cout << "G4LEpp:ApplyYourself: total:" << G4endl;
|
||||
@@ -135,8 +137,6 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
else
|
||||
je1 = midBin;
|
||||
} while (je2 - je1 > 1);
|
||||
// G4int j;
|
||||
//std::abs(ek-elab[je1]) < std::abs(ek-elab[je2]) ? j = je1 : j = je2;
|
||||
G4double delab = elab[je2] - elab[je1];
|
||||
|
||||
// Sample the angle
|
||||
@@ -172,37 +172,19 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
<< sigint1 << " " << sigint2 << G4endl;
|
||||
} while (ke2 - ke1 > 1);
|
||||
|
||||
// sigint1 and sigint2 should be recoverable from above loop
|
||||
|
||||
// G4double dsig = sig[je2][ke1] - sig[je1][ke1];
|
||||
// G4double rc = dsig/delab;
|
||||
// G4double b = sig[je1][ke1] - rc*elab[je1];
|
||||
// G4double sigint1 = rc*ek + b;
|
||||
|
||||
// G4double dsig = sig[je2][ke2] - sig[je1][ke2];
|
||||
// G4double rc = dsig/delab;
|
||||
// G4double b = sig[je1][ke2] - rc*elab[je1];
|
||||
// G4double sigint2 = rc*ek + b;
|
||||
|
||||
dsig = sigint2 - sigint1;
|
||||
rc = 1./dsig;
|
||||
b = ke1 - rc*sigint1;
|
||||
G4double kint = rc*sample + b;
|
||||
G4double theta = (0.5 + kint)*pi/180.;
|
||||
if (theta < 0.) theta = 0.;
|
||||
|
||||
// G4int k;
|
||||
//std::abs(sample-sig[j][ke1]) < std::abs(sample-sig[j][ke2]) ? k = ke1 : k = ke2;
|
||||
// G4double theta = (0.5 + k)*pi/180.;
|
||||
if (theta < 0.) { theta = 0.; }
|
||||
|
||||
if (verboseLevel > 1) {
|
||||
G4cout << " energy bin " << je1 << " energy=" << elab[je1] << G4endl;
|
||||
G4cout << " angle bin " << kint << " angle=" << theta/degree << G4endl;
|
||||
}
|
||||
|
||||
|
||||
// Get the target particle
|
||||
|
||||
G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle();
|
||||
|
||||
G4double E1 = aParticle->GetTotalEnergy();
|
||||
@@ -211,7 +193,6 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
G4double M2 = targetParticle->GetDefinition()->GetPDGMass();
|
||||
G4double totalEnergy = E1 + E2;
|
||||
G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
|
||||
// pseudoMass also = std::sqrt(M1*M1 + M2*M2 + 2*M2*E1)
|
||||
|
||||
// Transform into centre of mass system
|
||||
|
||||
@@ -224,7 +205,7 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
G4cout << " E1, M1 (GeV) " << E1/GeV << " " << M1/GeV << G4endl;
|
||||
G4cout << " E2, M2 (GeV) " << E2/GeV << " " << M2/GeV << G4endl;
|
||||
G4cout << " particle 1 momentum in CM " << px/GeV << " " << py/GeV << " "
|
||||
<< pz/GeV << " " << p/GeV << G4endl;
|
||||
<< pz/GeV << " " << p/GeV << G4endl;
|
||||
}
|
||||
|
||||
// First scatter w.r.t. Z axis
|
||||
@@ -237,18 +218,14 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
if (px*px + py*py > 0) {
|
||||
G4double cost, sint, ph, cosp, sinp;
|
||||
cost = pz/p;
|
||||
sint = (std::sqrt(std::abs((1-cost)*(1+cost))) + std::sqrt(px*px+py*py)/p)/2;
|
||||
sint = (std::sqrt(std::fabs((1-cost)*(1+cost))) + std::sqrt(px*px+py*py)/p)/2;
|
||||
py < 0 ? ph = 3*halfpi : ph = halfpi;
|
||||
if (std::abs(px) > 0.000001*GeV) ph = std::atan2(py,px);
|
||||
if (std::fabs(px) > 0.000001*GeV) ph = std::atan2(py,px);
|
||||
cosp = std::cos(ph);
|
||||
sinp = std::sin(ph);
|
||||
px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
|
||||
py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
|
||||
pz = (-sint*pxnew + cost*pznew);
|
||||
// G4ThreeVector it(a,b,c);
|
||||
// p0->SetMomentum(it);
|
||||
// G4ThreeVector aTargetMom = theInitial - it;
|
||||
// targetParticle->SetMomentum(aTargetMom);
|
||||
}
|
||||
else {
|
||||
px = pxnew;
|
||||
@@ -304,7 +281,6 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
newP->SetDefinition(const_cast<G4ParticleDefinition *>(aParticle->GetDefinition()) );
|
||||
newP->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
|
||||
|
||||
|
||||
//The target particle...
|
||||
|
||||
PA[1] = -px;
|
||||
@@ -322,51 +298,26 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
|
||||
|
||||
targetParticle->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
|
||||
|
||||
// G4double ektotal = newP->GetKineticEnergy() +
|
||||
// targetParticle->GetKineticEnergy();
|
||||
|
||||
if (verboseLevel > 1) {
|
||||
G4cout << " particle 1 momentum in LAB "
|
||||
<< newP->GetMomentum()*(1./GeV)
|
||||
<< newP->GetMomentum()/GeV
|
||||
<< " " << newP->GetTotalMomentum()/GeV << G4endl;
|
||||
G4cout << " particle 2 momentum in LAB "
|
||||
<< targetParticle->GetMomentum()*(1./GeV)
|
||||
<< targetParticle->GetMomentum()/GeV
|
||||
<< " " << targetParticle->GetTotalMomentum()/GeV << G4endl;
|
||||
G4cout << " TOTAL momentum in LAB "
|
||||
<< (newP->GetMomentum()+targetParticle->GetMomentum())*(1./GeV)
|
||||
<< (newP->GetMomentum()+targetParticle->GetMomentum())/GeV
|
||||
<< " "
|
||||
<< (newP->GetMomentum()+targetParticle->GetMomentum()).mag()/GeV
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// if (theta < pi/2.) {
|
||||
// G4double p = newP->GetMomentum().mag();
|
||||
// G4ThreeVector m = newP->GetMomentum();
|
||||
// if (p > DBL_MIN)
|
||||
// theParticleChange.SetMomentumChange(m.x()/p, m.y()/p, m.z()/p);
|
||||
// else
|
||||
// theParticleChange.SetMomentumChange(0., 0., 0.);
|
||||
|
||||
theParticleChange.SetMomentumChange( newP->GetMomentumDirection());
|
||||
theParticleChange.SetEnergyChange(newP->GetKineticEnergy());
|
||||
delete newP;
|
||||
|
||||
// }
|
||||
// else {
|
||||
// // charge exchange
|
||||
// theParticleChange.SetNumberOfSecondaries(2);
|
||||
// theParticleChange.AddSecondary(newP);
|
||||
// theParticleChange.SetStatusChange(fStopAndKill);
|
||||
// // theParticleChange.SetEnergyChange(0.0);
|
||||
// }
|
||||
theParticleChange.SetMomentumChange( newP->GetMomentumDirection());
|
||||
theParticleChange.SetEnergyChange(newP->GetKineticEnergy());
|
||||
delete newP;
|
||||
|
||||
// Recoil particle
|
||||
G4DynamicParticle* p1 = new G4DynamicParticle;
|
||||
p1->SetDefinition(targetParticle->GetDefinition());
|
||||
p1->SetMomentum(targetParticle->GetMomentum());
|
||||
theParticleChange.AddSecondary(p1);
|
||||
|
||||
|
||||
theParticleChange.AddSecondary(targetParticle);
|
||||
return &theParticleChange;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user