Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -42,7 +42,7 @@
//
// Class Description:
//
// Generates the conversion of a high-energy photon to an e+e- pair, either in the field of an
// Generates the conversion of a high-energy photon to an e+e- pair, either in the field of an
// atomic electron (triplet) or nucleus (nuclear).
// Samples the five-dimensional (5D) differential cross-section analytical expression:
// . Non polarized conversion:
@@ -59,30 +59,30 @@
// and for high-energy triplet conversion.
//
// Only the linear polarisation of the incoming photon takes part in these expressions.
// The circular polarisation of the incoming photon does not (take part) and no polarisation
// The circular polarisation of the incoming photon does not (take part) and no polarisation
// is transfered to the final leptons.
//
// In case conversion takes place in the field of an isolated nucleus or electron, the bare
// In case conversion takes place in the field of an isolated nucleus or electron, the bare
// Bethe-Heitler expression is used.
//
// In case the nucleus or the electron are part of an atom, the screening of the target field
// In case the nucleus or the electron are part of an atom, the screening of the target field
// by the other electrons of the atom is described by a simple form factor, function of q2:
// . nuclear: N.F. Mott, H.S.W. Massey, The Theory of Atomic Collisions, 1934.
// . triplet: J.A. Wheeler and W.E. Lamb, Phys. Rev. 55 (1939) 858.
//
// The nuclear form factor that affects the probability of very large-q2 events, is not considered.
//
// In principle the code is valid from threshold, that is from 2 * m_e c^2 for nuclear and from
// 4 * m_e c^2 for triplet, up to infinity, while in pratice the divergence of the differential
// cross section at small q2 and, at high-energy, at small polar angle, make it break down at
// In principle the code is valid from threshold, that is from 2 * m_e c^2 for nuclear and from
// 4 * m_e c^2 for triplet, up to infinity, while in pratice the divergence of the differential
// cross section at small q2 and, at high-energy, at small polar angle, make it break down at
// some point that depends on machine precision.
//
// Very-high-energy (above a few tens of TeV) LPM suppression effects in the normalized differential
// cross-section are not considered.
//
// The 5D differential cross section is sampled without any high-energy nor small
// The 5D differential cross section is sampled without any high-energy nor small
// angle approximation(s).
// The generation is strictly energy-momentum conserving when all particles in the final state
// The generation is strictly energy-momentum conserving when all particles in the final state
// are taken into account, that is, including the recoiling target.
// (In contrast with the BH expressions taken at face values, for which the electron energy is
// taken to be EMinus = GammaEnergy - EPlus)
@@ -92,7 +92,7 @@
// Total cross sections are not computed (we inherit from other classes).
// We just convert a photon on a target when asked to do so.
//
// Pure nuclear, pure triplet and 1/Z triplet/nuclear mixture can be generated.
// Pure nuclear, pure triplet and 1/Z triplet/nuclear mixture can be generated.
//
// -------------------------------------------------------------------
@@ -115,6 +115,8 @@
#include "G4LorentzVector.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -122,13 +124,8 @@ G4BetheHeitler5DModel::G4BetheHeitler5DModel(const G4ParticleDefinition* pd,
const G4String& nam)
: G4BetheHeitlerModel(pd, nam), fVerbose(1), fConversionType(0), iraw(false)
{
SetLowEnergyLimit(2*CLHEP::electron_mass_c2);
SetLowEnergyLimit(2*CLHEP::electron_mass_c2);
theIonTable = G4IonTable::GetIonTable();
// Verbosity levels: ( Can redefine as needed, but some consideration )
// 0 = nothing
// > 2 print results
// > 3 print rejection warning from transformation (fix bug from gammaray .. )
// > 4 print photon direction & polarisation
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -145,6 +142,11 @@ void G4BetheHeitler5DModel::Initialise(const G4ParticleDefinition* part,
G4EmParameters* theManager = G4EmParameters::Instance();
// place to initialise model parameters
// Verbosity levels: ( Can redefine as needed, but some consideration )
// 0 = nothing
// > 2 print results
// > 3 print rejection warning from transformation (fix bug from gammaray .. )
// > 4 print photon direction & polarisation
fVerbose = theManager->Verbose();
fConversionType = theManager->GetConversionType();
//////////////////////////////////////////////////////////////
@@ -158,57 +160,9 @@ void G4BetheHeitler5DModel::Initialise(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// Converting from pair coordinate
//
void
G4BetheHeitler5DModel::BoostG4LorentzVector(const G4LorentzVector& p,
const G4LorentzVector& q,
G4LorentzVector& res) const
{
// p : 4-vector which will be boosted
// q : 4-vector of new origin in the old coordinates
const G4double pq = p.x()*q.x() + p.y()*q.y() + p.z()*q.z();
const G4double qq = q.x()*q.x() + q.y()*q.y() + q.z()*q.z();
const G4double mass2 = q.t()*q.t()-qq;
if ( mass2 > 0.0 ) {
const G4double mass = std::sqrt(q.t()*q.t()-qq);
const G4double lf = ((q.t()-mass)*pq/qq+p.t())/mass;
res.set( (p.x()+q.x()*lf), (p.y()+q.y()*lf), (p.z()+q.z()*lf),
((p.t()*q.t()+pq)/mass) );
} else {
res = p;
if ( fVerbose > 3 ) {
G4cout << "G4BetheHeitler5DModel::BoostG4LorentzVector Warning point not converted"
<< G4endl << "secondary in " << p
<< G4endl << "Pair1 " << q << G4endl;
}
}
}
// assuming that q.x=q.y=0.0
void
G4BetheHeitler5DModel::BoostG4LorentzVector(const G4LorentzVector& p,
const G4double qz,
const G4double qt,
const G4double lffac,
const G4double imass,
G4LorentzVector& res) const
{
// p : 4-vector which will be boosted
// q : 4-vector of new origin in the old coordinates
const G4double pq = p.z()*qz;
const G4double lf = (lffac*pq+p.t())*imass;
res.setZ(p.z()+qz*lf);
res.setT((p.t()*qt+pq)*imass);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4BetheHeitler5DModel::MaxDiffCrossSection(const G4double* par,
G4double Z,
G4double e,
G4double G4BetheHeitler5DModel::MaxDiffCrossSection(const G4double* par,
G4double Z,
G4double e,
G4double loge) const
{
const G4double Q = e/par[9];
@@ -219,7 +173,7 @@ G4double G4BetheHeitler5DModel::MaxDiffCrossSection(const G4double* par,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
void
G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDynamicGamma,
@@ -229,7 +183,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
static const G4double ElectronMass = CLHEP::electron_mass_c2;
static const G4double ElectronMass2 = ElectronMass*ElectronMass;
static const G4double alpha0 = CLHEP::fine_structure_const;
// mm
// mm
static const G4double r0 = CLHEP::classic_electr_radius;
// mbarn
static const G4double r02 = r0*r0*1.e+25;
@@ -240,13 +194,13 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
//
static const G4double PairInvMassMin = 2.*ElectronMass;
//
static const G4double nu[10] = { 0.0227436, 0.0582046, 3.0322675, 2.8275065,
-0.0034004, 1.1212766, 1.8989468, 68.3492750,
static const G4double nu[10] = { 0.0227436, 0.0582046, 3.0322675, 2.8275065,
-0.0034004, 1.1212766, 1.8989468, 68.3492750,
0.0211186, 14.4 };
static const G4double tr[10] = { 0.0332350, 4.3942537, 2.8515925, 2.6351695,
static const G4double tr[10] = { 0.0332350, 4.3942537, 2.8515925, 2.6351695,
-0.0031510, 1.5737305, 1.8104647, 20.6434021,
-0.0272586, 28.9};
//
//
static const G4double para[3][2] = { {11., -16.},{-1.17, -2.95},{-2., -0.5} };
//
static const G4double correctionIndex = 1.4;
@@ -272,7 +226,8 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
//////////////////////////////////////////////////////////////
// target element
// select randomly one element constituting the material
const G4Element* anElement = SelectRandomAtom(couple, fTheGamma, GammaEnergy);
const G4Element* anElement = SelectTargetAtom(couple, fTheGamma, GammaEnergy,
aDynamicGamma->GetLogKineticEnergy() );
// Atomic number
const G4int Z = anElement->GetZasInt();
const G4int A = SelectIsotopeNumber(anElement);
@@ -309,13 +264,9 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double lnPairInvMassRange = G4Log(PairInvMassRange);
// initial state. Defines z axis of "0" frame as along photon propagation.
// create 4-vectors: gamma0 + target0 and CMS=gamma0+target0
// Since CMS(0., 0., GammaEnergy, GammaEnergy+RecoilMass) set some constants
// for the special boost that makes use of the form of CMS 4-vector
const G4double CMSqz = GammaEnergy;
const G4double CMSt = GammaEnergy+RecoilMass;
const G4double iCMSmass = 1./std::sqrt(RecoilMass*(RecoilMass+2.*GammaEnergy));
const G4double CMSfact = (CMSt-1./iCMSmass)/(CMSqz*CMSqz);
// Since CMS(0., 0., GammaEnergy, GammaEnergy+RecoilMass) set some constants
const G4double betaCMS = G4LorentzVector(0.0,0.0,GammaEnergy,GammaEnergy+RecoilMass).beta();
// maximum value of pdf
const G4double EffectiveZ = iraw ? 0.5 : Z;
const G4double Threshold = itriplet ? 4.*ElectronMass : 2.*ElectronMass;
@@ -336,146 +287,128 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
? para[0][1] + para[1][1]*LogAvailableEnergy
: para[0][1] + para[2][1]*para[1][1];
//
G4LorentzVector Recoil0;
G4LorentzVector Positron0;
G4LorentzVector Electron0;
G4LorentzVector Recoil;
G4LorentzVector Positron;
G4LorentzVector Electron;
G4double pdf = 0.;
G4double rndmv6[6];
// START Sampling
do {
//////////////////////////////////////////////////
rndmEngine->flatArray(6, rndmv6);
//////////////////////////////////////////////////
// pdf pow(x,c) with c = 1.4
// integral y = pow(x,(c+1))/(c+1) @ x = 1 => y = 1 /(1+c)
// invCdf exp( log(y /* *( c + 1.0 )/ (c + 1.0 ) */ ) /( c + 1.0) )
//////////////////////////////////////////////////
//////////////////////////////////////////////////
const G4double X1 =
G4Exp(G4Log(rndmEngine->flat())/(correctionIndex + 1.0));
const G4double x0 = G4Exp(xl1 + (xu1 - xl1)*rndmEngine->flat());
G4Exp(G4Log(rndmv6[0])/(correctionIndex + 1.0));
const G4double x0 = G4Exp(xl1 + (xu1 - xl1)*rndmv6[1]);
const G4double dum0 = 1./(1.+x0);
const G4double cosTheta = (x0-1.)*dum0;
const G4double sinTheta = std::sqrt(4.*x0)*dum0;
const G4double PairInvMass = PairInvMassMin*G4Exp(X1*X1*lnPairInvMassRange);
G4double rndmv3[3];
rndmEngine->flatArray(3, rndmv3);
//--------------------------------------------------------------------------
// const G4double ThetaLept = pi*rndmv3[0];
// const G4double cosThetaLept = std::cos(ThetaLept);
// const G4double sinThetaLept = std::sin(ThetaLept);
//
// const G4double PhiLept = twoPi*rndmv3[1]-pi;
// const G4double cosPhiLept = std::cos(PhiLept);
// const G4double sinPhiLept = std::sin(PhiLept);
//
// const G4double Phi = twoPi*rndmv3[2]-pi;
// const G4double cosPhi = std::cos(Phi);
// const G4double sinPhi = std::sin(Phi);
//---------------------------------------------------------------------------
// G4double rndmv3[3];
// rndmEngine->flatArray(3, rndmv3);
// cos and sin theta-lepton
const G4double cosThetaLept = std::cos(pi*rndmv3[0]);
const G4double cosThetaLept = std::cos(pi*rndmv6[2]);
// sin(ThetaLept) is always in [0,+1] if ThetaLept is in [0,pi]
const G4double sinThetaLept = std::sqrt((1.-cosThetaLept)*(1.+cosThetaLept));
const G4double sinThetaLept = std::sqrt((1.-cosThetaLept)*(1.+cosThetaLept));
// cos and sin phi-lepton
const G4double cosPhiLept = std::cos(twoPi*rndmv3[1]-pi);
const G4double cosPhiLept = std::cos(twoPi*rndmv6[3]-pi);
// sin(PhiLept) is in [-1,0] if PhiLept in [-pi,0) and
// is in [0,+1] if PhiLept in [0,+pi]
const G4double sinPhiLept = std::copysign(std::sqrt((1.-cosPhiLept)*(1.+cosPhiLept)),rndmv3[1]-0.5);
const G4double sinPhiLept = std::copysign(std::sqrt((1.-cosPhiLept)*(1.+cosPhiLept)),rndmv6[3]-0.5);
// cos and sin phi
const G4double cosPhi = std::cos(twoPi*rndmv3[2]-pi);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv3[2]-0.5);
const G4double cosPhi = std::cos(twoPi*rndmv6[4]-pi);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv6[4]-0.5);
//////////////////////////////////////////////////
// frames:
// 3 : the laboratory Lorentz frame, Geant4 axes definition
// 0 : the laboratory Lorentz frame, axes along photon direction and polarisation
// 1 : the center-of-mass Lorentz frame
// 2 : the pair Lorentz frame
// 3 : the laboratory Lorentz frame, Geant4 axes definition
//////////////////////////////////////////////////
// in the center-of-mass frame
const G4double RecEnergyCMS = (sCMSPlusRM2-PairInvMass*PairInvMass)*isqrts2;
const G4double LeptonEnergy2 = PairInvMass*0.5;
// Denis ** correction
// const G4double thePRecoil = std::sqrt( (RecEnergyCMS-RecoilMass)
// *(RecEnergyCMS+RecoilMass));
// New way of calucaltion thePRecoil to avoid underflow
const G4double ap1 = 2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass + 2.0*PairInvMass*RecoilMass;
const G4double bp1 = 2.0*GammaEnergy*RecoilMass -
PairInvMass*PairInvMass - 2.0*PairInvMass*RecoilMass;
if (bp1 <= 0.0 ) {
if ( fVerbose > 3 ) {
G4cout
<< "G4BetheHeitler5DModel::SampleSecondaries Warning bp1 "
<< bp1 << "point rejected" << G4endl
<< "GammaEnergy " << GammaEnergy << G4endl
<< "PairInvMass " << PairInvMass << G4endl;
}
pdf = -1.0; // force next iteration
continue;
}
const G4double thePRecoil = std::sqrt(ap1 * bp1) * isqrts2;
// Denis ** correction
// back to the center-of-mass frame
const G4LorentzVector Recoil1( thePRecoil*sinTheta*cosPhi,
Recoil.set( thePRecoil*sinTheta*cosPhi,
thePRecoil*sinTheta*sinPhi,
thePRecoil*cosTheta,
RecEnergyCMS);
const G4LorentzVector Pair1(-Recoil1.x(),
-Recoil1.y(),
-Recoil1.z(),
sqrts-RecEnergyCMS);
// const G4LorentzVector Pair(-Recoil.x(),
// -Recoil.y(),
// -Recoil.z(),
// sqrts-RecEnergyCMS);
// in the pair frame
const G4double thePLepton = std::sqrt( (LeptonEnergy2-ElectronMass)
*(LeptonEnergy2+ElectronMass));
const G4LorentzVector Positron2( thePLepton*sinThetaLept*cosPhiLept,
thePLepton*sinThetaLept*sinPhiLept,
thePLepton*cosThetaLept,
LeptonEnergy2);
const G4LorentzVector Electron2(-Positron2.x(),
-Positron2.y(),
-Positron2.z(),
LeptonEnergy2);
Positron.set(thePLepton*sinThetaLept*cosPhiLept,
thePLepton*sinThetaLept*sinPhiLept,
thePLepton*cosThetaLept,
LeptonEnergy2);
Electron.set(-Positron.x(),
-Positron.y(),
-Positron.z(),
LeptonEnergy2);
// Normalisation of final state phase space:
// Section 47 of Particle Data Group, Chin. Phys. C, 40, 100001 (2016)
const G4double Norme = Recoil1.vect().mag() * Positron2.vect().mag();
//
G4LorentzVector Positron1;
G4LorentzVector Electron1;
BoostG4LorentzVector(Positron2, Pair1, Positron1);
BoostG4LorentzVector(Electron2, Pair1, Electron1);
// const G4double Norme = Recoil1.vect().mag() * Positron2.vect().mag();
const G4double Norme = Recoil.vect().mag() * Positron.vect().mag();
// e+, e- to CMS frame from pair frame
// boost vector from Pair to CMS
const G4ThreeVector pair2cms =
G4LorentzVector( -Recoil.x(), -Recoil.y(), -Recoil.z(),
sqrts-RecEnergyCMS).boostVector();
Positron.boost(pair2cms);
Electron.boost(pair2cms);
// back to the laboratory frame (make use of the CMS(0,0,Eg,Eg+RM)) form
Recoil0.setX(Recoil1.x());
Recoil0.setY(Recoil1.y());
BoostG4LorentzVector(Recoil1 , CMSqz, CMSt, CMSfact, iCMSmass, Recoil0);
Positron0.setX(Positron1.x());
Positron0.setY(Positron1.y());
BoostG4LorentzVector(Positron1, CMSqz, CMSt, CMSfact, iCMSmass, Positron0);
Electron0.setX(Electron1.x());
Electron0.setY(Electron1.y());
BoostG4LorentzVector(Electron1, CMSqz, CMSt, CMSfact, iCMSmass, Electron0);
Recoil.boostZ(betaCMS);
Positron.boostZ(betaCMS);
Electron.boostZ(betaCMS);
// Jacobian factors
const G4double Jacob0 = x0*dum0*dum0;
const G4double Jacob1 = 2.*X1*lnPairInvMassRange*PairInvMass;
const G4double Jacob2 = std::abs(sinThetaLept);
const G4double EPlus = Positron0.t();
const G4double PPlus = Positron0.vect().mag();
const G4double sinThetaPlus = Positron0.vect().perp()/PPlus;
const G4double cosThetaPlus = Positron0.vect().cosTheta();
const G4double EPlus = Positron.t();
const G4double PPlus = Positron.vect().mag();
const G4double sinThetaPlus = Positron.vect().perp()/PPlus;
const G4double cosThetaPlus = Positron.vect().cosTheta();
const G4double pPX = Positron0.x();
const G4double pPY = Positron0.y();
const G4double pPX = Positron.x();
const G4double pPY = Positron.y();
const G4double dum1 = 1./std::sqrt( pPX*pPX + pPY*pPY );
const G4double cosPhiPlus = pPX*dum1;
const G4double sinPhiPlus = pPY*dum1;
@@ -483,29 +416,29 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
// denominators:
// the two cancelling leading terms for forward emission at high energy, removed
const G4double elMassCTP = ElectronMass*cosThetaPlus;
const G4double ePlusSTP = EPlus*sinThetaPlus;
const G4double ePlusSTP = EPlus*sinThetaPlus;
const G4double DPlus = (elMassCTP*elMassCTP + ePlusSTP*ePlusSTP)
/(EPlus + PPlus*cosThetaPlus);
const G4double EMinus = Electron0.t();
const G4double PMinus = Electron0.vect().mag();
const G4double sinThetaMinus = Electron0.vect().perp()/PMinus;
const G4double cosThetaMinus = Electron0.vect().cosTheta();
const G4double EMinus = Electron.t();
const G4double PMinus = Electron.vect().mag();
const G4double sinThetaMinus = Electron.vect().perp()/PMinus;
const G4double cosThetaMinus = Electron.vect().cosTheta();
const G4double ePX = Electron0.x();
const G4double ePY = Electron0.y();
const G4double dum2 = 1./std::sqrt( ePX*ePX + ePY*ePY );
const G4double ePX = Electron.x();
const G4double ePY = Electron.y();
const G4double dum2 = 1./std::sqrt( ePX*ePX + ePY*ePY );
const G4double cosPhiMinus = ePX*dum2;
const G4double sinPhiMinus = ePY*dum2;
const G4double elMassCTM = ElectronMass*cosThetaMinus;
const G4double eMinSTM = EMinus*sinThetaMinus;
const G4double DMinus = (elMassCTM*elMassCTM + eMinSTM*eMinSTM)
const G4double eMinSTM = EMinus*sinThetaMinus;
const G4double DMinus = (elMassCTM*elMassCTM + eMinSTM*eMinSTM)
/(EMinus + PMinus*cosThetaMinus);
// cos(phiMinus-PhiPlus)
const G4double cosdPhi = cosPhiPlus*cosPhiMinus + sinPhiPlus*sinPhiMinus;
const G4double PRec = Recoil0.vect().mag();
const G4double PRec = Recoil.vect().mag();
const G4double q2 = PRec*PRec;
const G4double BigPhi = -ElectronMass2 / (GammaEnergy*GammaEnergy2 * q2*q2);
@@ -515,8 +448,8 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double qun = factor1*iZ13*iZ13;
const G4double nun = qun * PRec;
if (nun < 1.) {
FormFactor = (nun < 0.01) ? (13.8-55.4*std::sqrt(nun))*nun
: std::sqrt(1-(nun-1)*(nun-1));
FormFactor = (nun < 0.01) ? (13.8-55.4*std::sqrt(nun))*nun
: std::sqrt(1-(nun-1)*(nun-1));
} // else FormFactor = 1 by default
} else {
const G4double dum3 = 217.*PRec*iZ13;
@@ -531,7 +464,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double pMinusSTM = PMinus*sinThetaMinus;
const G4double pPlusSTPperDP = pPlusSTP/DPlus;
const G4double pMinusSTMperDM = pMinusSTM/DMinus;
const G4double dunpol = BigPhi*(
const G4double dunpol = BigPhi*(
pPlusSTPperDP *pPlusSTPperDP *(4.*EMinus*EMinus-q2)
+ pMinusSTMperDM*pMinusSTMperDM*(4.*EPlus*EPlus - q2)
+ 2.*pPlusSTPperDP*pMinusSTMperDM*cosdPhi
@@ -545,26 +478,26 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double pMinusSTMCPMperDM = pMinusSTM*cosPhiMinus/DMinus;
const G4double caa = 2.*(EPlus*pMinusSTMCPMperDM+EMinus*pPlusSTPCPPperDP);
const G4double cbb = pMinusSTMCPMperDM-pPlusSTPCPPperDP;
const G4double ccc = (pPlusSTP*pPlusSTP + pMinusSTM*pMinusSTM
const G4double ccc = (pPlusSTP*pPlusSTP + pMinusSTM*pMinusSTM
+2.*pPlusSTP*pMinusSTM*cosdPhi)/ (DMinus*DPlus);
const G4double dtot= 2.*BigPhi*( caa*caa - q2*cbb*cbb - GammaEnergy2*ccc);
betheheitler = dtot * factor;
}
//
const G4double cross = Norme * Jacob0 * Jacob1 * Jacob2 * betheheitler
const G4double cross = Norme * Jacob0 * Jacob1 * Jacob2 * betheheitler
* FormFactor * RecoilMass / sqrts;
pdf = cross * (xu1 - xl1) / G4Exp(correctionIndex*G4Log(X1)); // cond1;
} while ( pdf < ymax * rndmEngine->flat() );
} while ( pdf < ymax * rndmv6[5] );
// END of Sampling
if ( fVerbose > 2 ) {
G4double recul = std::sqrt(Recoil0.x()*Recoil0.x()+Recoil0.y()*Recoil0.y()
+Recoil0.z()*Recoil0.z());
G4double recul = std::sqrt(Recoil.x()*Recoil.x()+Recoil.y()*Recoil.y()
+Recoil.z()*Recoil.z());
G4cout << "BetheHeitler5DModel GammaEnergy= " << GammaEnergy
<< " PDF= " << pdf << " ymax= " << ymax
<< " PDF= " << pdf << " ymax= " << ymax
<< " recul= " << recul << G4endl;
}
// back to Geant4 system
if ( fVerbose > 4 ) {
@@ -585,32 +518,29 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
// The unit norm vector that is orthogonal to the two others
G4ThreeVector yGrec = GammaDirection.cross(GammaPolarization);
// rotation
G4ThreeVector Rot = Recoil0.x()*GammaPolarization + Recoil0.y()*yGrec
+ Recoil0.z()*GammaDirection;
Recoil0.setVect(Rot);
Rot = Positron0.x()*GammaPolarization + Positron0.y()*yGrec
+ Positron0.z()*GammaDirection;
Positron0.setVect(Rot);
Rot = Electron0.x()*GammaPolarization + Electron0.y()*yGrec
+ Electron0.z()*GammaDirection;
Electron0.setVect(Rot);
//
// rotation from gamma ref. sys. to World
G4RotationMatrix GtoW(GammaPolarization,yGrec,GammaDirection);
Recoil.transform(GtoW);
Positron.transform(GtoW);
Electron.transform(GtoW);
if ( fVerbose > 2 ) {
G4cout << "BetheHeitler5DModel Recoil0 " << Recoil0.x() << " " << Recoil0.y() << " " << Recoil0.z()
<< " " << Recoil0.t() << " " << G4endl;
G4cout << "BetheHeitler5DModel Positron0 " << Positron0.x() << " " << Positron0.y() << " "
<< Positron0.z() << " " << Positron0.t() << " " << G4endl;
G4cout << "BetheHeitler5DModel Electron0 " << Electron0.x() << " " << Electron0.y() << " "
<< Electron0.z() << " " << Electron0.t() << " " << G4endl;
G4cout << "BetheHeitler5DModel Recoil " << Recoil.x() << " " << Recoil.y() << " " << Recoil.z()
<< " " << Recoil.t() << " " << G4endl;
G4cout << "BetheHeitler5DModel Positron " << Positron.x() << " " << Positron.y() << " "
<< Positron.z() << " " << Positron.t() << " " << G4endl;
G4cout << "BetheHeitler5DModel Electron " << Electron.x() << " " << Electron.y() << " "
<< Electron.z() << " " << Electron.t() << " " << G4endl;
}
// Create secondaries
// electron
G4DynamicParticle* aParticle1 = new G4DynamicParticle(fTheElectron,Electron0);
G4DynamicParticle* aParticle1 = new G4DynamicParticle(fTheElectron,Electron);
// positron
G4DynamicParticle* aParticle2 = new G4DynamicParticle(fThePositron,Positron0);
G4DynamicParticle* aParticle2 = new G4DynamicParticle(fThePositron,Positron);
// create G4DynamicParticle object for the particle3 ( recoil )
G4ParticleDefinition* RecoilPart;
if (itriplet) {
@@ -619,8 +549,8 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
} else{
RecoilPart = theIonTable->GetIon(Z, A, 0);
}
G4DynamicParticle* aParticle3 = new G4DynamicParticle(RecoilPart,Recoil0);
G4DynamicParticle* aParticle3 = new G4DynamicParticle(RecoilPart,Recoil);
// Fill output vector
fvect->push_back(aParticle1);
fvect->push_back(aParticle2);
@@ -185,7 +185,9 @@ void G4BetheHeitlerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
if (eps0 > 0.5) { return; }
//
// select target element of the material (probs. are based on partial x-secs)
const G4Element* anElement = SelectRandomAtom(couple,fTheGamma,gammaEnergy);
const G4Element* anElement = SelectTargetAtom(couple, fTheGamma, gammaEnergy,
aDynamicGamma->GetLogKineticEnergy());
//
// get the random engine
CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
@@ -480,7 +480,8 @@ G4double G4GoudsmitSaundersonMscModel::ComputeTruePathLengthLimit(const G4Track&
SetCurrentCouple(currentCouple);
currentMaterialIndex = currentCouple->GetMaterial()->GetIndex();
currentKinEnergy = dp->GetKineticEnergy();
currentRange = GetRange(particle,currentKinEnergy,currentCouple);
currentRange = GetRange(particle,currentKinEnergy,currentCouple,
dp->GetLogKineticEnergy());
// elastic and first transport mfp, screening parameter and G1 are also set
// (Mott-correction will be used if it was requested by the user)
fLambda1 = GetTransportMeanFreePath(particle,currentKinEnergy);
@@ -160,7 +160,8 @@ void G4IonCoulombScatteringModel::SampleSecondaries(
SetupParticle(dp->GetDefinition());
// Choose nucleus
currentElement = SelectRandomAtom(couple, particle, kinEnergy);
currentElement = SelectTargetAtom(couple, particle, kinEnergy,
dp->GetLogKineticEnergy());
G4int iz = currentElement->GetZasInt();
G4int ia = SelectIsotopeNumber(currentElement);
@@ -338,7 +338,7 @@ void G4KleinNishinaModel::SampleSecondaries(
if(fAtomDeexcitation) {
G4int index = couple->GetIndex();
if(fAtomDeexcitation->CheckDeexcitationActiveRegion(index)) {
G4int Z = G4lrint(elm->GetZ());
G4int Z = elm->GetZasInt();
G4AtomicShellEnumerator as = G4AtomicShellEnumerator(i);
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
G4int nbefore = fvect->size();
@@ -300,7 +300,9 @@ void G4PAIModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
if( deltaTkin > tmax) { deltaTkin = tmax; }
const G4Element* anElement = SelectRandomAtom(matCC,fParticle,kineticEnergy);
const G4Element* anElement = SelectTargetAtom(matCC, fParticle, kineticEnergy,
dp->GetLogKineticEnergy());
G4int Z = G4lrint(anElement->GetZ());
G4DynamicParticle* deltaRay = new G4DynamicParticle(fElectron,
@@ -283,7 +283,8 @@ void G4PAIPhotModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
if( deltaTkin > tmax) deltaTkin = tmax;
const G4Element* anElement = SelectRandomAtom(matCC,fParticle,kineticEnergy);
const G4Element* anElement = SelectTargetAtom(matCC,fParticle,kineticEnergy,
dp->GetLogKineticEnergy());
G4int Z = G4lrint(anElement->GetZ());
G4DynamicParticle* deltaRay = new G4DynamicParticle(fElectron,
@@ -356,7 +356,8 @@ G4PairProductionRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
if (eps0 > 0.5) { return; }
//
// select target atom of the material
const G4Element* anElement = SelectRandomAtom(couple, fTheGamma, gammaEnergy);
const G4Element* anElement = SelectTargetAtom(couple, fTheGamma, gammaEnergy,
aDynamicGamma->GetLogKineticEnergy());
CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
//
// 'eps' is the total energy transferred to one of the e-/e+ pair in initial
@@ -154,12 +154,11 @@ void G4ScreeningMottCrossSection::SetScreeningCoefficient()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4double Z )
void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4int Z )
{
//...Target
G4int iz = std::min(92, G4lrint(Z));
G4double A = fNistManager->GetAtomicMassAmu(iz);
G4int ia = G4lrint(A);
G4int iz = std::min(92, Z);
G4int ia = G4lrint(fNistManager->GetAtomicMassAmu(iz));
G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz);
targetZ = iz;
@@ -118,8 +118,8 @@ void G4SeltzerBergerModel::Initialise(const G4ParticleDefinition* p,
const G4ElementTable* theElemTable = G4Element::GetElementTable();
size_t numOfElem = G4Element::GetNumberOfElements();
for (size_t ie = 0; ie < numOfElem; ++ie) {
G4int izet = std::min(G4lrint(((*theElemTable)[ie])->GetZ()), gMaxZet-1);
izet = std::max(1, izet);
G4int izet =
std::max(1,std::min(((*theElemTable)[ie])->GetZasInt(), gMaxZet-1));
// load SB-DCS data for this atomic number if it has not been loaded yet
if (!gSBDCSData[izet]) {
ReadData(izet, path);
@@ -253,8 +253,7 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
{
static const G4double kMC2 = CLHEP::electron_mass_c2;
const G4double kinEnergy = dp->GetKineticEnergy();
// const G4double logKinEnergy = dp->GetLogKineticEnergy();
const G4double logKinEnergy = G4Log(kinEnergy); // WILL BE REMOVED
const G4double logKinEnergy = dp->GetLogKineticEnergy();
const G4double tmin = std::min(cutEnergy, kinEnergy);
const G4double tmax = std::min(maxEnergy, kinEnergy);
if (tmin >= tmax) {
@@ -262,11 +261,8 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
}
// set local variables and select target element
SetupForMaterial(fPrimaryParticle, couple->GetMaterial(), kinEnergy);
const G4Element* elm = SelectRandomAtom(couple, fPrimaryParticle, kinEnergy,
tmin, tmax);
// const G4Element* elm = SelectTargetAtom(couple, fPrimaryParticle, kinEnergy,
// logKinEnergy, fElemSelectorEkinIndx,
// tmin, tmax);
const G4Element* elm = SelectTargetAtom(couple, fPrimaryParticle, kinEnergy,
logKinEnergy, tmin, tmax);
fCurrentIZ = std::max(std::min(elm->GetZasInt(),gMaxZet-1), 1);
//
const G4double totMomentum = std::sqrt(kinEnergy*(fPrimaryTotalEnergy+kMC2));
@@ -278,10 +274,9 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
*/
// sample emitted photon energy either by rejection or from samplign tables
const G4double gammaEnergy = !fIsUseSamplingTables
? SampleEnergyTransfer(kinEnergy, tmin, tmax)
: gSBSamplingTable->SampleEnergyTransfer(kinEnergy,
logKinEnergy, tmin, fDensityCorr, fCurrentIZ,
couple->GetIndex(), fIsElectron);
? SampleEnergyTransfer(kinEnergy, logKinEnergy, tmin, tmax)
: gSBSamplingTable->SampleEnergyTransfer(kinEnergy, logKinEnergy, tmin,
fDensityCorr, fCurrentIZ, couple->GetIndex(), fIsElectron);
// should never happen under normal conditions but protect it
if (gammaEnergy <= 0.) {
return;
@@ -324,8 +319,9 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
// sample emitted photon energy by usign rejection
G4double
G4SeltzerBergerModel::SampleEnergyTransfer(const G4double kinEnergy,
const G4double tmin,
const G4double tmax)
const G4double logKinEnergy,
const G4double tmin,
const G4double tmax)
{
static const G4double kMC2 = CLHEP::electron_mass_c2;
static const G4double kAlpha = CLHEP::twopi*CLHEP::fine_structure_const;
@@ -333,7 +329,7 @@ G4SeltzerBergerModel::SampleEnergyTransfer(const G4double kinEnergy,
// [ln(k_c^2+k_p^2), ln(E_k^2+k_p^2)]
const G4double xmin = G4Log(tmin*tmin+fDensityCorr);
const G4double xrange = G4Log(tmax*tmax+fDensityCorr)-xmin;
const G4double y = G4Log(kinEnergy/CLHEP::MeV);
const G4double y = logKinEnergy;
// majoranta
const G4double x0 = tmin/kinEnergy;
G4double vmax;
File diff suppressed because it is too large Load Diff
@@ -137,6 +137,11 @@ void G4WentzelOKandVIxSection::Initialise(const G4ParticleDefinition* p,
fMottXSection = new G4ScreeningMottCrossSection();
fMottXSection->Initialise(p, 1.0);
}
/*
G4cout << "G4WentzelOKandVIxSection::Initialise for "
<< p->GetParticleName() << " cosThetaMax= " << cosThetaMax
<< " " << ScreenRSquare[0] << " coeff= " << coeff << G4endl;
*/
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -181,11 +186,6 @@ void G4WentzelOKandVIxSection::InitialiseA()
void G4WentzelOKandVIxSection::SetupParticle(const G4ParticleDefinition* p)
{
/*
G4cout << "G4WentzelOKandVIxSection::SetupParticle " << p
<< " " << particle << " " << this << G4endl;
G4cout << this << " " << p->GetParticleName() << G4endl;
*/
particle = p;
mass = particle->GetPDGMass();
spin = particle->GetPDGSpin();
@@ -253,6 +253,8 @@ G4WentzelOKandVIxSection::SetupTarget(G4int Z, G4double cut)
cosTetMaxElec = 1.0;
ComputeMaxElectronScattering(cut);
}
//G4cout << "SetupTarget: Z= " << targetZ << " kinFactor= " << kinFactor
// << " fMottFactor= " << fMottFactor << " screenZ= " << screenZ <<G4endl;
return cosTetMaxNuc2;
}
@@ -278,11 +278,12 @@ G4double G4WentzelVIModel::ComputeTruePathLengthLimit(
// << G4endl;
// initialisation for each step, lambda may be computed from scratch
preKinEnergy = dp->GetKineticEnergy();
effKinEnergy = preKinEnergy;
preKinEnergy = dp->GetKineticEnergy();
effKinEnergy = preKinEnergy;
DefineMaterial(track.GetMaterialCutsCouple());
lambdaeff = GetTransportMeanFreePath(particle,preKinEnergy);
currentRange = GetRange(particle,preKinEnergy,currentCouple);
const G4double logPreKinEnergy = dp->GetLogKineticEnergy();
lambdaeff = GetTransportMeanFreePath(particle,preKinEnergy,logPreKinEnergy);
currentRange = GetRange(particle,preKinEnergy,currentCouple,logPreKinEnergy);
cosTetMaxNuc = wokvi->SetupKinematic(preKinEnergy, currentMaterial);
//G4cout << "lambdaeff= " << lambdaeff << " Range= " << currentRange
@@ -152,19 +152,19 @@ G4double G4XrayRayleighModel::ComputeCrossSectionPerAtom(
///////////////////////////////////////////////////////////////////////////////////
void G4XrayRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDynamicGamma,
G4double,
G4double)
void G4XrayRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* aDPGamma,
G4double,
G4double)
{
if ( verboseLevel > 3)
{
G4cout << "Calling SampleSecondaries() of G4XrayRayleighModel" << G4endl;
}
G4double photonEnergy0 = aDynamicGamma->GetKineticEnergy();
G4double photonEnergy0 = aDPGamma->GetKineticEnergy();
G4ParticleMomentum photonDirection0 = aDynamicGamma->GetMomentumDirection();
G4ParticleMomentum photonDirection0 = aDPGamma->GetMomentumDirection();
// Sample the angle of the scattered photon
@@ -188,7 +188,8 @@ void G4XrayRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*f
cosDipole = cofA - 1./cofA;
// select atom
const G4Element* elm = SelectRandomAtom(couple, aDynamicGamma->GetParticleDefinition(), photonEnergy0);
const G4Element* elm = SelectTargetAtom(couple, aDPGamma->GetParticleDefinition(),
photonEnergy0,aDPGamma->GetLogKineticEnergy());
G4double Z = elm->GetZ();
G4double k = photonEnergy0/hbarc;
@@ -484,8 +484,8 @@ void G4eBremParametrizedModel::SampleSecondaries(
SetupForMaterial(particle, couple->GetMaterial(),kineticEnergy);
const G4Element* elm =
SelectRandomAtom(couple,particle,kineticEnergy,cut,emax);
const G4Element* elm = SelectTargetAtom(couple,particle,kineticEnergy,
dp->GetLogKineticEnergy(),cut,emax);
SetCurrentElement(elm->GetZ());
kinEnergy = kineticEnergy;
@@ -561,13 +561,10 @@ G4eBremsstrahlungRelModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vd
}
//
SetupForMaterial(fPrimaryParticle, couple->GetMaterial(), kineticEnergy);
const G4Element* elem = SelectRandomAtom(couple, fPrimaryParticle, kineticEnergy,
tmin, tmax);
// const G4Element* elem = SelectTargetAtom(couple,fPrimaryParticle,kineticEnergy,
// logKineticEnergy, fElemSelectorEkinIndx,
// tmin,tmax);
const G4Element* elm = SelectTargetAtom(couple,fPrimaryParticle,kineticEnergy,
dp->GetLogKineticEnergy(),tmin,tmax);
//
fCurrentIZ = elem->GetZasInt();
fCurrentIZ = elm->GetZasInt();
const ElementData* elDat = gElementData[fCurrentIZ];
const G4double funcMax = elDat->fZFactor1+elDat->fZFactor2;
// get the random engine
@@ -35,17 +35,8 @@
//
// Creation date: 22.08.2005
//
// Modifications:
// Modifications: V.Ivanchenko
//
// 01.08.06 V.Ivanchenko extend upper limit of table to TeV and review the
// logic of building - only elements from G4ElementTable
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
// 19.08.06 V.Ivanchenko add inline function ScreeningParameter
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
// 09.06.08 V.Ivanchenko add SelectIsotope and sampling of the recoil ion
// 16.06.09 C.Consolandi fixed computation of effective mass
// 27.05.10 V.Ivanchenko added G4WentzelOKandVIxSection class to
// compute cross sections and sample scattering angle
//
//
// Class Description:
@@ -95,7 +86,8 @@ G4eCoulombScatteringModel::G4eCoulombScatteringModel(G4bool combined)
particle = nullptr;
currentCouple = nullptr;
wokvi = nullptr;
wokvi = new G4WentzelOKandVIxSection(isCombined);
currentMaterialIndex = 0;
mass = CLHEP::proton_mass_c2;
@@ -114,8 +106,6 @@ G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
const G4DataVector& cuts)
{
if(!wokvi) { wokvi = new G4WentzelOKandVIxSection(); }
SetupParticle(part);
currentCouple = nullptr;
@@ -128,19 +118,12 @@ void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* part,
}
wokvi->Initialise(part, cosThetaMin);
/*
G4cout << "G4eCoulombScatteringModel: " << particle->GetParticleName()
<< " 1-cos(ThetaLimit)= " << 1 - cosThetaMin
<< " cos(thetaMax)= " << cosThetaMax
<< G4endl;
*/
pCuts = &cuts;
//G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(3);
/*
G4cout << "!!! G4eCoulombScatteringModel::Initialise for "
<< part->GetParticleName() << " cos(TetMin)= " << cosThetaMin
<< " cos(TetMax)= " << cosThetaMax <<G4endl;
G4cout << "cut= " << (*pCuts)[0] << " cut1= " << (*pCuts)[1] << G4endl;
G4cout << "G4eCoulombScatteringModel::Initialise for "
<< part->GetParticleName() << " 1-cos(TetMin)= " << 1.0 - cosThetaMin
<< " 1-cos(TetMax)= " << 1. - cosThetaMax << G4endl;
G4cout << "cut[0]= " << (*pCuts)[0] << G4endl;
*/
if(!fParticleChange) {
fParticleChange = GetParticleChangeForGamma();
@@ -195,8 +178,11 @@ G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
G4double Z, G4double,
G4double cutEnergy, G4double)
{
//G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for "
//<< p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV << G4endl;
/*
G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for "
<< p->GetParticleName()<<" Z= "<<Z<<" e(MeV)= "<< kinEnergy/MeV
<< G4endl;
*/
G4double cross = 0.0;
elecRatio = 0.0;
if(p != particle) { SetupParticle(p); }
@@ -206,18 +192,22 @@ G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
DefineMaterial(CurrentCouple());
G4double costmin = wokvi->SetupKinematic(kinEnergy, currentMaterial);
//G4cout << "cosThetaMax= "<<cosThetaMax<<" costmin= "<<costmin<< G4endl;
if(cosThetaMax < costmin) {
G4int iz = G4lrint(Z);
G4double cut = (0.0 < fixedCut) ? fixedCut : cutEnergy;
costmin = wokvi->SetupTarget(iz, cut);
//G4cout << "SetupTarget: Z= " << iz << " cut= " << cut << " "
// << costmin << G4endl;
G4double costmax = (1 == iz && particle == theProton && cosThetaMax < 0.0)
? 0.0 : cosThetaMax;
if(costmin > costmax) {
cross = wokvi->ComputeNuclearCrossSection(costmin, costmax)
+ wokvi->ComputeElectronCrossSection(costmin, costmax);
+ wokvi->ComputeElectronCrossSection(costmin, costmax);
}
/*
if(p->GetParticleName() == "e-")
if(p->GetParticleName() == "e-")
G4cout << "Z= " << Z << " e(MeV)= " << kinEnergy/MeV
<< " cross(b)= " << cross/barn << " 1-costmin= " << 1-costmin
<< " 1-costmax= " << 1-costmax
@@ -226,6 +216,7 @@ G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
<< G4endl;
*/
}
//G4cout << "====== cross= " << cross << G4endl;
return cross;
}
@@ -251,9 +242,8 @@ void G4eCoulombScatteringModel::SampleSecondaries(
wokvi->SetupKinematic(kinEnergy, currentMaterial);
const G4Element* currentElement =
SelectRandomAtom(couple,particle,kinEnergy,cut,kinEnergy);
const G4Element* currentElement = SelectTargetAtom(couple,particle,kinEnergy,
dp->GetLogKineticEnergy(),cut,kinEnergy);
G4int iz = currentElement->GetZasInt();
G4double costmin = wokvi->SetupTarget(iz, cut);
@@ -292,7 +282,7 @@ void G4eCoulombScatteringModel::SampleSecondaries(
/(targetMass + (mass + kinEnergy)*(1.0 - cost));
// the check likely not needed
if(trec > kinEnergy) { trec = kinEnergy; }
trec = std::min(trec, kinEnergy);
G4double finalT = kinEnergy - trec;
G4double edep = 0.0;
/*
@@ -206,16 +206,15 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
// Choose nucleus
//last two :cutEnergy= min e kinEnergy=max
currentElement = SelectRandomAtom(couple, particle, kinEnergy,
cutEnergy, kinEnergy);
G4double Z = currentElement->GetZ();
G4int iz = G4int(Z);
currentElement = SelectTargetAtom(couple, particle, kinEnergy,
dp->GetLogKineticEnergy(), cutEnergy, kinEnergy);
G4int iz = currentElement->GetZasInt();
G4int ia = SelectIsotopeNumber(currentElement);
G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz);
//G4cout<<"..Z: "<<Z<<" ..iz: "<<iz<<" ..ia: "<<ia<<" ..mass2: "<<mass2<<G4endl;
Mottcross->SetupKinematic(kinEnergy, Z);
Mottcross->SetupKinematic(kinEnergy, iz);
G4double cross= Mottcross->NuclearCrossSection(FormFactor,XSectionModel);
if(cross == 0.0) { return; }
//cout<< "Energy: "<<kinEnergy/MeV<<" Z: "<<Z<<"....cross "<<G4BestUnit(cross,"Surface") << " cm2 "<< cross/cm2 <<endl;