Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4BetheHeitlerModel.cc 100399 2016-10-20 07:38:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -76,7 +76,7 @@ G4BetheHeitlerModel::G4BetheHeitlerModel(const G4ParticleDefinition*,
theGamma = G4Gamma::Gamma();
thePositron = G4Positron::Positron();
theElectron = G4Electron::Electron();
g4pow = G4Pow::GetInstance();
g4calc = G4Pow::GetInstance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -222,7 +222,7 @@ void G4BetheHeitlerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fve
do {
if ( NormF1/(NormF1+NormF2) > rndmEngine->flat()) {
epsil = 0.5 - epsilrange*g4pow->A13(rndmEngine->flat());
epsil = 0.5 - epsilrange*g4calc->A13(rndmEngine->flat());
screenvar = screenfac/(epsil*(1-epsil));
greject = (ScreenFunction1(screenvar) - FZ)/F10;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GoudsmitSaundersonMscModel.cc 96561 2016-04-22 14:24:58Z gcosmo $
// $Id: G4GoudsmitSaundersonMscModel.cc 100399 2016-10-20 07:38:12Z gcosmo $
//
// ----------------------------------------------------------------------------
//
@@ -748,8 +748,8 @@ G4double G4GoudsmitSaundersonMscModel::ComputeGeomPathLength(G4double)
par1 = (fLambda1-lambda1)/(fLambda1*fTheTrueStepLenght); // alpha
par2 = 1./(par1*fLambda1);
par3 = 1.+par2 ;
G4Pow *g4pow = G4Pow::GetInstance();
fTheZPathLenght = 1./(par1*par3) * (1.-g4pow->powA(1.-par1*fTheTrueStepLenght,par3));
G4Pow *g4calc = G4Pow::GetInstance();
fTheZPathLenght = 1./(par1*par3) * (1.-g4calc->powA(1.-par1*fTheTrueStepLenght,par3));
}
}
fTheZPathLenght = std::min(fTheZPathLenght, fLambda1);
@@ -792,8 +792,8 @@ G4double G4GoudsmitSaundersonMscModel::ComputeTrueStepLength(G4double geomStepLe
tlength = -fLambda1*G4Log(1.-geomStepLength/fLambda1) ;
} else {
if(par1*par3*geomStepLength < 1.) {
G4Pow *g4pow = G4Pow::GetInstance();
tlength = (1.-g4pow->powA( 1.-par1*par3*geomStepLength,1./par3))/par1;
G4Pow *g4calc = G4Pow::GetInstance();
tlength = (1.-g4calc->powA( 1.-par1*par3*geomStepLength,1./par3))/par1;
} else {
tlength = currentRange;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ICRU49NuclearStoppingModel.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4ICRU49NuclearStoppingModel.cc 100399 2016-10-20 07:38:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -68,7 +68,7 @@ G4ICRU49NuclearStoppingModel::G4ICRU49NuclearStoppingModel(const G4String& nam)
: G4VEmModel(nam),lossFlucFlag(false)
{
theZieglerFactor = eV*cm2*1.0e-15;
g4pow = G4Pow::GetInstance();
g4calc = G4Pow::GetInstance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -143,8 +143,8 @@ G4ICRU49NuclearStoppingModel::NuclearStoppingPower(G4double kineticEnergy,
G4int iz2 = G4lrint(z2);
G4double rm;
if(iz1 > 1) { rm = (mass1 + mass2)*(g4pow->Z23(iz1) + g4pow->Z23(iz2)); }
else { rm = (mass1 + mass2)*g4pow->Z13(iz2); }
if(iz1 > 1) { rm = (mass1 + mass2)*(g4calc->Z23(iz1) + g4calc->Z23(iz2)); }
else { rm = (mass1 + mass2)*g4calc->Z13(iz2); }
G4double er = 32.536 * mass2 * energy / ( z12 * rm ) ; // reduced energy
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IonFluctuations.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4IonFluctuations.cc 100399 2016-10-20 07:38:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -85,7 +85,7 @@ G4IonFluctuations::G4IonFluctuations(const G4String& nam)
{
kineticEnergy = 0.0;
beta2 = 0.0;
g4pow = G4Pow::GetInstance();
g4calc = G4Pow::GetInstance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -352,8 +352,8 @@ G4double G4IonFluctuations::Factor(const G4Material* material, G4double Z)
// G4double ss = 1.0 + a[iz][0]*pow(energy,a[iz][1])+
// + a[iz][2]*pow(energy,a[iz][3]);
G4double ss = 1.0 + a[iz][0]*g4pow->powA(energy,a[iz][1])+
+ a[iz][2]*g4pow->powA(energy,a[iz][3]);
G4double ss = 1.0 + a[iz][0]*g4calc->powA(energy,a[iz][1])+
+ a[iz][2]*g4calc->powA(energy,a[iz][3]);
// protection for the validity range for low beta
static const G4double slim = 0.001;
@@ -384,7 +384,7 @@ G4double G4IonFluctuations::Factor(const G4Material* material, G4double Z)
// ions
} else {
factor = charge * g4pow->A13(charge/Z);
factor = charge * g4calc->A13(charge/Z);
if( kStateGas == material->GetState() ) {
energy /= (charge * sqrt(charge)) ;
@@ -404,7 +404,7 @@ G4double G4IonFluctuations::Factor(const G4Material* material, G4double Z)
G4double x = b[i][2];
G4double y = energy * b[i][3];
if(y <= 0.2) x *= (y*(1.0 - 0.5*y));
else x *= (1.0 - g4pow->expA(-y));
else x *= (1.0 - g4calc->expA(-y));
// else x *= (1.0 - exp(-y));
y = energy - b[i][1];
@@ -32,8 +32,8 @@
//
// Author: Cristina Consolandi
//
// Creation date: 27.05.2012
//
// Creation date: 27.05.2012
//
// Class Description:
//
// Mott Coulomb Cross section coefficients:
@@ -41,18 +41,18 @@
// Reference:
// M.J. Boschini et al.
// "Non Ionizing Energy Loss induced by Electrons in the Space Environment"
// Proc. of the 13th International Conference on Particle Physics and Advanced Technology
// Proc. of the 13th International Conference on Particle Physics and Advanced Technology
// (13th ICPPAT, Como 3-7/10/2011), World Scientific (Singapore).
//
//
// Available at: http://arxiv.org/abs/1111.4042v4
// coeffb of par. 2.1 , eq. (17) were recalculated by M. Tacconi
// following the same procedur as:
//
// T. Lijian et al. "Analytic Fitting to the Mott Cross Section of Electrons"
// following the same procedur as:
//
// T. Lijian et al. "Analytic Fitting to the Mott Cross Section of Electrons"
// Radiat. Phys. Chem. 45 (1995), 235245.
//
//
//
//
//
//
//
// -------------------------------------------------------------------------------------
@@ -60,6 +60,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4MottCoefficients.hh"
#include "G4Pow.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -68,6 +69,7 @@ using namespace std;
G4MottCoefficients::G4MottCoefficients()
{
fG4pow = G4Pow::GetInstance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -32,7 +32,7 @@
//
// Author: Cristina Consolandi
//
// Creation date: 20.10.2011
// Creation date: 20.10.2011
//
// Modifications:
// 27-05-2012 Added Analytic Fitting to the Mott Cross Section by means of G4MottCoefficients class.
@@ -40,24 +40,24 @@
//
// Class Description:
// Computation of electron Coulomb Scattering Cross Section.
// Suitable for high energy electrons and light target materials.
// Suitable for high energy electrons and light target materials.
//
// Reference:
// M.J. Boschini et al.
// "Non Ionizing Energy Loss induced by Electrons in the Space Environment"
// Proc. of the 13th International Conference on Particle Physics and Advanced Technology
// Proc. of the 13th International Conference on Particle Physics and Advanced Technology
// (13th ICPPAT, Como 3-7/10/2011), World Scientific (Singapore).
// Available at: http://arxiv.org/abs/1111.4042v4
//
// 1) Mott Differential Cross Section Approximation:
// 1) Mott Differential Cross Section Approximation:
// For Target material up to Z=92 (U):
// As described in http://arxiv.org/abs/1111.4042v4
// As described in http://arxiv.org/abs/1111.4042v4
// par. 2.1 , eq. (16)-(17)
// Else (Z>92):
// W. A. McKinley and H. Fashbach, Phys. Rev. 74, (1948) 1759.
// 2) Screening coefficient:
// 2) Screening coefficient:
// vomn G. Moliere, Z. Naturforsh A2 (1947), 133-145; A3 (1948), 78.
// 3) Nuclear Form Factor:
// 3) Nuclear Form Factor:
// A.V. Butkevich et al. Nucl. Instr. and Meth. in Phys. Res. A 488 (2002), 282-294.
//
// -------------------------------------------------------------------------------------
@@ -88,21 +88,21 @@ G4ScreeningMottCrossSection::G4ScreeningMottCrossSection():
cosThetaMax(-1.0),
alpha(fine_structure_const),
htc2(hbarc_squared),
e2(electron_mass_c2*classic_electr_radius)
e2(electron_mass_c2*classic_electr_radius)
{
TotalCross=0;
fNistManager = G4NistManager::Instance();
fG4pow = G4Pow::GetInstance();
particle=0;
particle=nullptr;
spin = mass = mu_rel=0;
tkinLab = momLab2 = invbetaLab2=0;
tkin = mom2 = invbeta2=beta=gamma=0;
spin = mass = mu_rel=0.0;
tkinLab = momLab2 = invbetaLab2=0.0;
tkin = mom2 = invbeta2=beta=gamma=0.0;
Trec = targetMass = As = etag = ecut = 0.0;
Trec=targetZ = targetMass = As =0.0;
etag = ecut = 0.0;
targetZ = 0;
targetA = 0;
cosTetMinNuc=0;
@@ -117,8 +117,6 @@ G4ScreeningMottCrossSection::G4ScreeningMottCrossSection():
for(G4int i=0; i<DIM; ++i){
cross[i]=0;
}
}
mottcoeff = new G4MottCoefficients();
@@ -136,18 +134,17 @@ void G4ScreeningMottCrossSection::Initialise(const G4ParticleDefinition* p,
G4double CosThetaLim)
{
SetupParticle(p);
targetZ = 0;
tkin = mom2 = 0.0;
tkin = targetZ = mom2 = 0.0;
ecut = etag = DBL_MAX;
particle = p;
cosThetaMin = CosThetaLim;
cosThetaMin = CosThetaLim;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ScreeningMottCrossSection::SetScreeningCoefficient()
{
G4double alpha2=alpha*alpha;
//Bohr radius
//Bohr radius
G4double a0= Bohr_radius ;//0.529e-8*cm;
//Thomas-Fermi screening length
G4double aU=0.88534*a0/fG4pow->Z13(targetZ);
@@ -167,18 +164,20 @@ G4double G4ScreeningMottCrossSection::GetScreeningAngle()
G4double screenangle=2.*asin(sqrt(As));
// cout<<" screenangle "<< screenangle <<endl;
if(screenangle>=pi) screenangle=pi;
return screenangle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4int iz)
void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4double Z )
{
//...Target
G4int ia = G4lrint(fNistManager->GetAtomicMassAmu(iz));
G4int iz = G4lrint(Z);
G4double A = fNistManager->GetAtomicMassAmu(iz);
G4int ia = G4lrint(A);
G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz);
targetZ = iz;
targetZ = Z;
targetA = fNistManager->GetAtomicMassAmu(iz);
targetMass= mass2;
@@ -195,26 +194,26 @@ void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4int iz)
G4double etot = tkinLab + mass;
G4double ptot = sqrt(momLab2);
G4double m12 = mass*mass;
// relativistic reduced mass from publucation
// A.P. Martynenko, R.N. Faustov, Teoret. mat. Fiz. 64 (1985) 179
//incident particle & target nucleus
G4double Ecm=sqrt(m12 + mass2*mass2 + 2.0*etot*mass2);
mu_rel=mass*mass2/Ecm;
G4double momCM= ptot*mass2/Ecm;
// relative system
mom2 = momCM*momCM;
invbeta2 = 1.0 + mu_rel*mu_rel/mom2;
G4double x = mu_rel*mu_rel/mom2;
invbeta2 = 1.0 + x;
tkin = momCM*sqrt(invbeta2) - mu_rel;//Ekin of mu_rel
G4double beta2=1./invbeta2;
beta=std::sqrt(beta2) ;
G4double gamma2= 1./(1.-beta2);
G4double gamma2= invbeta2/x;
gamma=std::sqrt(gamma2);
//.........................................................
SetScreeningCoefficient();
//Integration Angles definition
@@ -231,7 +230,7 @@ void G4ScreeningMottCrossSection::SetupKinematic(G4double ekin, G4int iz)
G4double G4ScreeningMottCrossSection::FormFactor2ExpHof(G4double angles)
{
G4double M=targetMass;
G4double M=targetMass;
G4double E=tkinLab;
G4double Etot=E+mass;
G4double Tmax=2.*M*E*(E+2.*mass)/(mass*mass+M*M+2.*M*Etot);
@@ -251,6 +250,63 @@ G4double G4ScreeningMottCrossSection::FormFactor2ExpHof(G4double angles)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::FormFactor2Gauss(G4double angles)
{
G4double M=targetMass;
G4double E=tkinLab;
G4double Etot=E+mass;
G4double Tmax=2.*M*E*(E+2.*mass)/(mass*mass+M*M+2.*M*Etot);
G4double T=Tmax*fG4pow->powN(sin(angles*0.5), 2);
G4double q2=T*(T+2.*M);
q2/=htc2;//1/cm2
G4double RN=1.27e-13*G4Exp(G4Log(targetA)*0.27)*cm;
G4double xN= (RN*RN*q2);
G4double expo=(-xN/6.);
G4double FN=G4Exp(expo);
G4double form2=(FN*FN);
return form2;
//cout<<"..................... form2 "<< form2<<endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::FormFactor2UniformHelm(G4double angles)
{
G4double M=targetMass;
G4double E=tkinLab;
G4double Etot=E+mass;
G4double Tmax=2.*M*E*(E+2.*mass)/(mass*mass+M*M+2.*M*Etot);
G4double T=Tmax*fG4pow->powN(sin(angles*0.5), 2);
G4double q2=T*(T+2.*M);
q2=q2/(htc2*0.01);//1/cm2
G4double q=G4Exp(G4Log(q2)*0.5);;
G4double R0=1.2E-13*G4Exp(G4Log(targetA)/3.);
G4double R1=2.0E-13;
G4double x0=q*R0;
G4double F0=(3./fG4pow->powN(x0,3))*(sin(x0)-x0*cos(x0));
G4double x1=q*R1;
G4double F1=(3./fG4pow->powN(x1,3))*(sin(x1)-x1*cos(x1));
G4double F=F0*F1;
G4double form2=(F*F);
//cout<<"htc: "<<sqrt(htc2)<<" R0: "<<R0<<" F0: "<<F0<<" F1: "<<F1<<" Targer Mass: "<<targetMass<<" Energy: "<<tkinLab<<" ANGLE: "<<angles<<" FORM: "<<form2<<endl;
return form2;
//cout<<"..................... form2 "<< form2<<endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::McFcorrection(G4double angles )
{
G4double beta2=1./invbeta2;
@@ -273,7 +329,7 @@ G4double G4ScreeningMottCrossSection::RatioMottRutherford(G4double angles)
}
for(G4int j=0 ;j<=4;j++){
for(G4int k=0;k<=5;k++ ){
for(G4int k=0;k<=5;k++ ){
a[j]+=coeffb[j][k]*fG4pow->powN(beta0,k);
}
}
@@ -286,7 +342,7 @@ G4double G4ScreeningMottCrossSection::RatioMottRutherford(G4double angles)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::NuclearCrossSection()
G4double G4ScreeningMottCrossSection::NuclearCrossSection(G4int form)
{
if(cosTetMaxNuc >= cosTetMinNuc) return 0.0;
@@ -294,10 +350,16 @@ G4double G4ScreeningMottCrossSection::NuclearCrossSection()
for(G4int i=0; i<DIM; ++i){
G4double R=0;
G4double F2=FormFactor2ExpHof(tet[i]);
G4double F2=0;
if(form==0){F2=1;}
if(form==1){F2=FormFactor2ExpHof(tet[i]);}
if(form==2){F2=FormFactor2Gauss(tet[i]);}
if(form==3){F2=FormFactor2UniformHelm(tet[i]);}
if (coeffb[0][0]!=0){
//cout<<" Mott....targetZ "<< targetZ<<endl;
//cout<<" Mott....targetZ "<< targetZ<<endl;
R=RatioMottRutherford(tet[i]);
} else if (coeffb[0][0]==0){
// cout<<" McF.... targetZ "<< targetZ<<endl;
@@ -307,16 +369,17 @@ G4double G4ScreeningMottCrossSection::NuclearCrossSection()
//cout<<"----------------- R "<<R<<" F2 "<<F2<<endl;
// cout<<"angle "<<tet[i] << " F2 "<<F2<<endl;
G4double e4=e2*e2;
G4double den=2.*As+2.*fG4pow->powN(sin(tet[i]*0.5),2);
G4double func=1./(den*den);
G4double fatt= targetZ/(mu_rel*gamma*beta*beta);
G4double sigma=e4*fatt*fatt*func;
cross[i]=F2*R*sigma;
G4double sigma=e2*e2*fatt*fatt*func;
G4double pi2sintet=twopi*sin(tet[i]);
TotalCross+=pi2sintet*cross[i]*dangle[i];
cross[i]=pi2sintet*F2*R*sigma*dangle[i];
//cout<<i<<" Angle: "<<angle[i]<<" tet: "<<tet[i]<<" Cross: "<<cross[i]<<endl;
if(cross[i]<0){cross[i]=0;};
TotalCross+=cross[i];
}//end integral
//cout<< "ok ......... TotalCross "<<TotalCross<<endl;
@@ -325,80 +388,29 @@ G4double G4ScreeningMottCrossSection::NuclearCrossSection()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::AngleDistribution(G4double anglein)
{
G4double total=TotalCross ;
G4double fatt= e2*targetZ/(mu_rel*gamma*beta*beta);
G4double fatt2=fatt*fatt;
total/=fatt2;
G4double R=0;
if (coeffb[0][0]!=0){
// cout<<" Mott....targetZ "<< targetZ<<endl;
R=RatioMottRutherford(anglein);
} else if (coeffb[0][0]==0){
// cout<<" McF.... targetZ "<< targetZ<<endl;
R=McFcorrection(anglein);
}
G4double y=twopi*sin(anglein)*R*FormFactor2ExpHof(anglein)/
( (2*As+2.*fG4pow->powN(sin(anglein*0.5),2))*(2.*As+2.*fG4pow->powN(sin(anglein*0.5),2)) );
//G4cout<<"AngleDistribution Total Cross: "<<TotalCross<<" y: "<<y<<G4endl;//TO REMOVE
return y/total;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ScreeningMottCrossSection::GetScatteringAngle()
{
//cout<<"Z: "<<targetZ<<" Energy: "<<tkinLab/MeV<<endl;
// cout<<"................ tkinLab "<< G4BestUnit(tkinLab,"Energy") << " anglemin= "<<anglemin<<endl;
//cout<<"anglemax= "<<anglemax<<endl;
G4double r =G4UniformRand();
//G4double r =3e-6*G4UniformRand();
//G4double r=1e-12*G4UniformRand();
G4double r=G4UniformRand();
G4double scattangle=0;
G4double y=0;
G4double dy=0;
G4double area=0;
G4double step=0;
for(G4int i=0; i<DIM; ++i){
y+=AngleDistribution(tet[i])*dangle[i];
dy= y-area ;
area=y;
if(r >=y-dy && r<y ){
for(G4int i=DIM-1; i>=0; --i){
step=(1./TotalCross)*cross[i];
y+=step;
if(r >=y-step && r<y ){
scattangle= angle[i] +G4UniformRand()*dangle[i];
//G4cout<<"Energy: "<<tkinLab/MeV<<" Random: "<<r<<" y: "<<y<<" Scattangle: "<<scattangle<<" Angle: "<<angle[i]<<" dAngle: "<<dangle[i]<<G4endl; //TO REMOVE
break;
}
}
}
//cout<<"Energy: "<<tkinLab/MeV<<" SCATTANGLE: "<<scattangle<<endl;
return scattangle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreeVector G4ScreeningMottCrossSection::GetNewDirection(){
G4ThreeVector dir(0.0,0.0,1.0);
G4double z1=GetScatteringAngle();
G4double sint = sin(z1);
G4double cost = sqrt(1.0 - sint*sint);
G4double phi = twopi* G4UniformRand();
G4double dirx = sint*cos(phi);
G4double diry = sint*sin(phi);
G4double dirz = cost;
//.......set Trc
G4double etot=tkinLab+mass;
G4double mass2=targetMass;
Trec=(1.0 - cost)* mass2*(etot*etot - mass*mass )/
(mass*mass + mass2*mass2+ 2.*mass2*etot);
dir.set(dirx,diry,dirz);
return dir;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4SeltzerBergerModel.cc 97798 2016-06-13 12:10:14Z gcosmo $
// $Id: G4SeltzerBergerModel.cc 98737 2016-08-09 12:51:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -75,11 +75,6 @@ G4Physics2DVector* G4SeltzerBergerModel::dataSB[] = {nullptr};
G4double G4SeltzerBergerModel::ylimit[] = {0.0};
G4double G4SeltzerBergerModel::expnumlim = -12.;
static const G4double emaxlog = 4*G4Log(10.);
static const G4double alpha = CLHEP::twopi*CLHEP::fine_structure_const;
static const G4double epeaklimit= 300*CLHEP::MeV;
static const G4double elowlimit = 20*CLHEP::keV;
G4SeltzerBergerModel::G4SeltzerBergerModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4eBremsstrahlungRelModel(p,nam),useBicubicInterpolation(false)
@@ -176,6 +171,7 @@ void G4SeltzerBergerModel::ReadData(G4int Z, const char* path)
if(v->Retrieve(fin)) {
if(useBicubicInterpolation) { v->SetBicubicInterpolation(true); }
dataSB[Z] = v;
static const G4double emaxlog = 4*G4Log(10.);
ylimit[Z] = v->Value(0.97, emaxlog, idx, idy);
} else {
G4ExceptionDescription ed;
@@ -219,6 +215,7 @@ G4double G4SeltzerBergerModel::ComputeDXSectionPerAtom(G4double gammaEnergy)
G4double e2 = kinEnergy - gammaEnergy;
if(e2 > 0.0) {
G4double invbeta2 = (e2 + particleMass)/sqrt(e2*(e2 + 2*particleMass));
static const G4double alpha = CLHEP::twopi*CLHEP::fine_structure_const;
G4double xxx = alpha*currentZ*(invbeta1 - invbeta2);
if(xxx < expnumlim) { cross = 0.0; }
else { cross *= G4Exp(xxx); }
@@ -248,8 +245,7 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
const G4Element* elm =
SelectRandomAtom(couple,particle,kineticEnergy,cut,emax);
SetCurrentElement(elm->GetZ());
G4int Z = G4int(currentZ);
SetCurrentElement(elm->GetZasInt());
totalEnergy = kineticEnergy + particleMass;
densityCorr = densityFactor*totalEnergy*totalEnergy;
@@ -269,17 +265,20 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
// majoranta
G4double x0 = cut/kineticEnergy;
G4double vmax;
if(Z <= 92) {
vmax = dataSB[Z]->Value(x0, y, idx, idy)*1.02;
if(currentZ <= 92) {
vmax = dataSB[currentZ]->Value(x0, y, idx, idy)*1.02;
} else {
idx = idy = 0;
vmax = dataSB[Z]->Value(x0, y, idx, idy)*1.2;
vmax = dataSB[currentZ]->Value(x0, y, idx, idy)*1.2;
}
static const G4double epeaklimit= 300*CLHEP::MeV;
static const G4double elowlimit = 20*CLHEP::keV;
// majoranta corrected for e-
if(isElectron && x0 < 0.97 &&
((kineticEnergy > epeaklimit) || (kineticEnergy < elowlimit))) {
G4double ylim = std::min(ylimit[Z],1.1*dataSB[Z]->Value(0.97,y,idx,idy));
G4double ylim = std::min(ylimit[currentZ],1.1*dataSB[currentZ]->Value(0.97,y,idx,idy));
if(ylim > vmax) { vmax = ylim; }
}
if(x0 < 0.05) { vmax *= 1.2; }
@@ -296,7 +295,7 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
if(x < 0.0) { x = 0.0; }
gammaEnergy = sqrt(x);
G4double x1 = gammaEnergy/kineticEnergy;
v = dataSB[Z]->Value(x1, y, idx, idy);
v = dataSB[currentZ]->Value(x1, y, idx, idy);
// correction for positrons
if(!isElectron) {
@@ -318,7 +317,7 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
<< " Niter= " << nn
<< " Egamma(MeV)= " << gammaEnergy
<< " Ee(MeV)= " << kineticEnergy
<< " Z= " << Z << " " << particle->GetParticleName();
<< " Z= " << currentZ << " " << particle->GetParticleName();
if ( 20 == nwarn ) {
ed << "\n ### G4SeltzerBergerModel Warnings stopped";
@@ -337,7 +336,7 @@ G4SeltzerBergerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
G4ThreeVector gammaDirection =
GetAngularDistribution()->SampleDirection(dp, totalEnergy-gammaEnergy,
Z, couple->GetMaterial());
currentZ, couple->GetMaterial());
// create G4DynamicParticle object for the Gamma
G4DynamicParticle* gamma =
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.cc 95832 2016-02-26 11:12:31Z gcosmo $
// $Id: G4UniversalFluctuation.cc 98942 2016-08-22 14:46:10Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WentzelOKandVIxSection.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4WentzelOKandVIxSection.cc 98737 2016-08-09 12:51:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -82,6 +82,8 @@ G4WentzelOKandVIxSection::G4WentzelOKandVIxSection(G4bool combined) :
coeff = twopi*p0*p0;
particle = nullptr;
fNucFormfactor = fExponentialNF;
// Thomas-Fermi screening radii
// Formfactors from A.V. Butkevich et al., NIM A 488 (2002) 282
@@ -137,6 +139,8 @@ void G4WentzelOKandVIxSection::Initialise(const G4ParticleDefinition* p,
*CLHEP::hbarc/CLHEP::fermi;
factorA2 = 0.5*a*a;
currentMaterial = nullptr;
fNucFormfactor = G4EmParameters::Instance()->NuclearFormfactorType();
//G4cout << "G4WentzelOKandVIxSection::Initialise mass= " << mass
// << " " << p->GetParticleName()
@@ -324,9 +328,22 @@ G4WentzelOKandVIxSection::SampleSingleScattering(G4double cosTMin,
G4double w2 = 1. - cost2 + screenZ;
G4double z1 = w1*w2/(w1 + rndmEngineMod->flat()*(w2 - w1)) - screenZ;
G4double fm = 1.0 + formf*z1;
G4double grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2 - z1))
/((1.0 + z1*factD)*fm*fm);
G4double fm = 1.0;
if(fNucFormfactor == fExponentialNF) {
fm += formf*z1;
fm = 1.0/(fm*fm);
} else if(fNucFormfactor == fGaussianNF) {
fm = G4Exp(-2*formf*z1);
} else if(fNucFormfactor == fFlatNF) {
static const G4double ccoef = 0.00508/MeV;
G4double x = std::sqrt(2.*mom2*z1)*ccoef*2.;
fm = FlatFormfactor(x);
fm *= FlatFormfactor(x*0.6
*fG4pow->A13(fNistManager->GetAtomicMassAmu(targetZ) ) );
}
G4double grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2. - z1))
*fm*fm/(1.0 + z1*factD);
if(rndmEngineMod->flat() <= grej) {
// exclude "false" scattering due to formfactor and spin effect
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlung.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4eBremsstrahlung.cc 98737 2016-08-09 12:51:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -154,7 +154,7 @@ void G4eBremsstrahlung::PrintInfo()
G4cout << " LPM flag: " << param->LPM() << " for E > "
<< EmModel(1)->HighEnergyLimit()/GeV << " GeV";
if(eth < DBL_MAX) {
G4cout << ", HighEnergyThreshold(GeV)= " << eth/GeV;
G4cout << ", VertexHighEnergyTh(GeV)= " << eth/GeV;
}
G4cout << G4endl;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlungRelModel.cc 97273 2016-05-31 14:16:47Z gcosmo $
// $Id: G4eBremsstrahlungRelModel.cc 98737 2016-08-09 12:51:38Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -95,10 +95,9 @@ G4eBremsstrahlungRelModel::G4eBremsstrahlungRelModel(
isElectron(true),
fMigdalConstant(classic_electr_radius*electron_Compton_length*electron_Compton_length*4.0*pi),
fLPMconstant(fine_structure_const*electron_mass_c2*electron_mass_c2/(4.*pi*hbarc)),
fXiLPM(0), fPhiLPM(0), fGLPM(0),
use_completescreening(false)
{
fParticleChange = 0;
fParticleChange = nullptr;
theGamma = G4Gamma::Gamma();
lowestKinEnergy = 1.0*MeV;
@@ -110,10 +109,10 @@ G4eBremsstrahlungRelModel::G4eBremsstrahlungRelModel(
//SetAngularDistribution(new G4ModifiedTsai());
SetAngularDistribution(new G4DipBustGenerator());
particleMass = kinEnergy = totalEnergy = currentZ = z13 = z23 = lnZ = Fel
particleMass = kinEnergy = totalEnergy = z13 = z23 = lnZ = Fel
= Finel = fCoulomb = fMax = densityFactor = densityCorr = lpmEnergy
= xiLPM = phiLPM = gLPM = klpm = kp = 0.0;
currentZ = 0;
energyThresholdLPM = 1.e39;
InitialiseConstants();
@@ -179,7 +178,7 @@ void G4eBremsstrahlungRelModel::Initialise(const G4ParticleDefinition* p,
{
if(p) { SetParticle(p); }
currentZ = 0.;
currentZ = 0;
if(IsMaster() && LowEnergyLimit() < HighEnergyLimit()) {
InitialiseElementSelectors(p, cuts);
@@ -232,9 +231,9 @@ G4double G4eBremsstrahlungRelModel::ComputeDEDXPerVolume(
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4VEmModel::SetCurrentElement((*theElementVector)[i]);
SetCurrentElement((*theElementVector)[i]->GetZ());
SetCurrentElement((*theElementVector)[i]->GetZasInt());
dedx += theAtomicNumDensityVector[i]*currentZ*currentZ*ComputeBremLoss(cut);
dedx += theAtomicNumDensityVector[i]*(currentZ*currentZ)*ComputeBremLoss(cut);
}
dedx *= bremFactor;
@@ -294,7 +293,7 @@ G4double G4eBremsstrahlungRelModel::ComputeCrossSectionPerAtom(
if(cut >= tmax) { return 0.0; }
SetCurrentElement(Z);
SetCurrentElement(G4lrint(Z));
G4double cross = ComputeXSectionPerAtom(cut);
@@ -440,8 +439,9 @@ G4double G4eBremsstrahlungRelModel::ComputeRelDXSectionPerAtom(G4double gammaEne
// G4double xiLPM, gLPM, phiLPM; // to be made member variables !!!
CalcLPMFunctions(gammaEnergy);
G4double mainLPM = xiLPM*(y2 * gLPM + yone2*phiLPM) * ( (Fel-fCoulomb) + Finel/currentZ );
G4double secondTerm = (1.-y)/12.*(1.+1./currentZ);
G4double xz = 1.0/(G4double)currentZ;
G4double mainLPM = xiLPM*(y2 * gLPM + yone2*phiLPM) * ( (Fel-fCoulomb) + Finel*xz );
G4double secondTerm = (1.-y)/12.*(1. + xz);
G4double cross = mainLPM+secondTerm;
return cross;
@@ -462,21 +462,23 @@ G4double G4eBremsstrahlungRelModel::ComputeDXSectionPerAtom(G4double gammaEnergy
G4double main=0.,secondTerm=0.;
G4double currZ = (G4double)currentZ;
if (use_completescreening|| currentZ<5) {
// ** form factors complete screening case **
main = (3./4.*y*y - y + 1.) * ( (Fel-fCoulomb) + Finel/currentZ );
secondTerm = (1.-y)/12.*(1.+1./currentZ);
main = (3./4.*y*y - y + 1.) * ( (Fel-fCoulomb) + Finel/currZ );
secondTerm = (1.-y)/12.*(1.+1./currZ);
}
else {
// ** intermediate screening using Thomas-Fermi FF from Tsai only valid for Z>=5**
G4double dd=100.*electron_mass_c2*y/(totalEnergy-gammaEnergy);
G4double gg=dd/z13;
G4double eps=dd/z23;
G4double phi1=Phi1(gg,currentZ), phi1m2=Phi1M2(gg,currentZ);
G4double psi1=Psi1(eps,currentZ), psi1m2=Psi1M2(eps,currentZ);
G4double phi1=Phi1(gg,currZ), phi1m2=Phi1M2(gg,currZ);
G4double psi1=Psi1(eps,currZ), psi1m2=Psi1M2(eps,currZ);
main = (3./4.*y*y - y + 1.) * ( (0.25*phi1-1./3.*lnZ-fCoulomb) + (0.25*psi1-2./3.*lnZ)/currentZ );
secondTerm = (1.-y)/8.*(phi1m2+psi1m2/currentZ);
main = (3./4.*y*y - y + 1.) *
( (0.25*phi1-1./3.*lnZ-fCoulomb) + (0.25*psi1-2./3.*lnZ)/currZ );
secondTerm = (1.-y)/8.*(phi1m2+psi1m2/currZ);
}
G4double cross = main+secondTerm;
return cross;
@@ -501,7 +503,7 @@ void G4eBremsstrahlungRelModel::SampleSecondaries(
const G4Element* elm =
SelectRandomAtom(couple,particle,kineticEnergy,cut,emax);
SetCurrentElement(elm->GetZ());
SetCurrentElement(elm->GetZasInt());
kinEnergy = kineticEnergy;
totalEnergy = kineticEnergy + particleMass;
@@ -543,7 +545,7 @@ void G4eBremsstrahlungRelModel::SampleSecondaries(
G4ThreeVector gammaDirection =
GetAngularDistribution()->SampleDirection(dp, totalEnergy-gammaEnergy,
G4lrint(currentZ),
currentZ,
couple->GetMaterial());
// create G4DynamicParticle object for the Gamma
@@ -32,17 +32,17 @@
//
// Author: Cristina Consolandi
//
// Creation date: 20.10.2012
//
// Creation date: 20.10.2012
//
// Class Description:
// Single Scattering model for electron-nuclei interaction.
// Suitable for high energy electrons and low scattering angles.
//
//
// Reference:
// M.J. Boschini et al. "Non Ionizing Energy Loss induced by Electrons
// in the Space Environment" Proc. of the 13th International Conference
// on Particle Physics and Advanced Technology
// M.J. Boschini et al. "Non Ionizing Energy Loss induced by Electrons
// in the Space Environment" Proc. of the 13th International Conference
// on Particle Physics and Advanced Technology
//
// (13th ICPPAT, Como 3-7/10/2011), World Scientific (Singapore).
// Available at: http://arxiv.org/abs/1111.4042v4
@@ -66,7 +66,7 @@
#include "G4IonTable.hh"
#include "G4UnitsTable.hh"
#include "G4EmParameters.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -87,17 +87,18 @@ G4eSingleCoulombScatteringModel::G4eSingleCoulombScatteringModel(const G4String&
lowEnergyLimit = 0*keV;
recoilThreshold = 0.*eV;
FormFactor = 0;
particle = nullptr;
mass=0;
mass=0.0;
currentMaterialIndex = -1;
Mottcross = new G4ScreeningMottCrossSection();
Mottcross = new G4ScreeningMottCrossSection();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4eSingleCoulombScatteringModel::~G4eSingleCoulombScatteringModel()
{
{
delete Mottcross;
}
@@ -106,22 +107,24 @@ G4eSingleCoulombScatteringModel::~G4eSingleCoulombScatteringModel()
void G4eSingleCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
G4EmParameters* param = G4EmParameters::Instance();
SetupParticle(p);
currentCouple = nullptr;
currentMaterialIndex = -1;
//cosThetaMin = cos(PolarAngleLimit());
Mottcross->Initialise(p,cosThetaMin);
pCuts = &cuts;
pCuts = &cuts;
//G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(3);
/*
G4cout << "!!! G4eSingleCoulombScatteringModel::Initialise for "
<< part->GetParticleName() << " cos(TetMin)= " << cosThetaMin
G4cout << "!!! G4eSingleCoulombScatteringModel::Initialise for "
<< part->GetParticleName() << " cos(TetMin)= " << cosThetaMin
<< " cos(TetMax)= " << cosThetaMax <<G4endl;
G4cout << "cut= " << (*pCuts)[0] << " cut1= " << (*pCuts)[1] << G4endl;
*/
if(!fParticleChange) {
fParticleChange = GetParticleChangeForGamma();
}
@@ -129,6 +132,10 @@ void G4eSingleCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
if(IsMaster()) {
InitialiseElementSelectors(p,cuts);
}
FormFactor=param->NuclearFormfactorType();
//G4cout<<"NUCLEAR FORM FACTOR: "<<FormFactor<<G4endl;
}
void G4eSingleCoulombScatteringModel::InitialiseLocal(const G4ParticleDefinition*,
@@ -140,22 +147,22 @@ void G4eSingleCoulombScatteringModel::InitialiseLocal(const G4ParticleDefinition
G4double G4eSingleCoulombScatteringModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z,
G4double ,
G4double,
G4double kinEnergy,
G4double Z,
G4double ,
G4double,
G4double )
{
SetupParticle(p);
G4double cross =0.0;
if(kinEnergy < lowEnergyLimit) return cross;
DefineMaterial(CurrentCouple());
//Total Cross section
Mottcross->SetupKinematic(kinEnergy, G4lrint(Z));
cross = Mottcross->NuclearCrossSection();
Mottcross->SetupKinematic(kinEnergy, Z);
cross = Mottcross->NuclearCrossSection(FormFactor);
//cout<< "Compute Cross Section....cross "<<G4BestUnit(cross,"Surface") << " cm2 "<< cross/cm2 <<" Z: "<<Z<<" kinEnergy: "<<kinEnergy<<endl;
return cross;
@@ -167,14 +174,14 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double cutEnergy,
G4double cutEnergy,
G4double)
{
G4double kinEnergy = dp->GetKineticEnergy();
//cout<<"--- kinEnergy "<<kinEnergy<<endl;
if(kinEnergy < lowEnergyLimit) return;
DefineMaterial(couple);
SetupParticle(dp->GetDefinition());
@@ -183,14 +190,15 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
currentElement = SelectRandomAtom(couple,particle,
kinEnergy,cutEnergy,kinEnergy);
G4int iz = currentElement->GetZasInt();
G4double Z = currentElement->GetZ();
G4int iz = G4int(Z);
G4int ia = SelectIsotopeNumber(currentElement);
G4double mass2 = G4NucleiProperties::GetNuclearMass(ia, iz);
//G4cout<<"..Z: "<<Z<<" ..iz: "<<iz<<" ..ia: "<<ia<<" ..mass2: "<<mass2<<G4endl;
Mottcross->SetupKinematic(kinEnergy, iz);
G4double cross= Mottcross->NuclearCrossSection(); //MODIFY TO LOAD TABLE
Mottcross->SetupKinematic(kinEnergy, Z);
G4double cross= Mottcross->NuclearCrossSection(FormFactor); //MODIFY TO LOAD TABLE
if(cross == 0.0) { return; }
//cout<< "Energy: "<<kinEnergy/MeV<<" Z: "<<Z<<"....cross "<<G4BestUnit(cross,"Surface") << " cm2 "<< cross/cm2 <<endl;
@@ -207,9 +215,9 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
G4double bet = ptot/(v0.e() + mass2);
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
//CM Projectile
G4double momCM = gam*(ptot - bet*e1);
G4double eCM = gam*(e1 - bet*ptot);
//CM Projectile
G4double momCM = gam*(ptot - bet*e1);
G4double eCM = gam*(e1 - bet*ptot);
//energy & momentum after scattering of incident particle
G4double pxCM = momCM*sint*cos(phi);
G4double pyCM = momCM*sint*sin(phi);
@@ -217,13 +225,13 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
//CM--->Lab
G4LorentzVector v1(pxCM , pyCM, gam*(pzCM + bet*eCM), gam*(eCM + bet*pzCM));
// Rotate to global system
G4ThreeVector dir = dp->GetMomentumDirection();
G4ThreeVector dir = dp->GetMomentumDirection();
G4ThreeVector newDirection = v1.vect().unit();
newDirection.rotateUz(dir);
fParticleChange->ProposeMomentumDirection(newDirection);
fParticleChange->ProposeMomentumDirection(newDirection);
// recoil
v0 -= v1;
@@ -233,9 +241,9 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
G4double tcut = recoilThreshold;
//G4cout<<" Energy Transfered: "<<trec/eV<<G4endl;
if(pCuts) {
tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]);
if(pCuts) {
tcut= std::max(tcut,(*pCuts)[currentMaterialIndex]);
}
if(trec > tcut) {
@@ -248,14 +256,14 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
edep = trec;
fParticleChange->ProposeNonIonizingEnergyDeposit(edep);
}
// finelize primary energy and energy balance
G4double finalT = v1.e() - mass;
//G4cout<<"Final Energy: "<<finalT/eV<<G4endl;
if(finalT <= lowEnergyLimit) {
edep += finalT;
if(finalT <= lowEnergyLimit) {
edep += finalT;
finalT = 0.0;
}
}
edep = std::max(edep, 0.0);
fParticleChange->SetProposedKineticEnergy(finalT);
fParticleChange->ProposeLocalEnergyDeposit(edep);
@@ -263,4 +271,3 @@ void G4eSingleCoulombScatteringModel::SampleSecondaries(
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eeToTwoGammaModel.cc 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4eeToTwoGammaModel.cc 101198 2016-11-09 09:34:52Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -162,6 +162,9 @@ G4double G4eeToTwoGammaModel::CrossSectionPerVolume(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Polarisation of gamma according to M.H.L.Pryce and J.C.Ward,
// Nature 4065 (1947) 435.
void G4eeToTwoGammaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple*,
const G4DynamicParticle* dp,
@@ -180,12 +183,16 @@ void G4eeToTwoGammaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double phi = twopi * rndmEngine->flat();
G4ThreeVector dir(sint*cos(phi), sint*sin(phi), cost);
phi = twopi * rndmEngine->flat();
G4ThreeVector pol(cos(phi), sin(phi), 0.0);
G4double cosphi = cos(phi);
G4double sinphi = sin(phi);
G4ThreeVector pol(cosphi, sinphi, 0.0);
pol.rotateUz(dir);
aGamma1 = new G4DynamicParticle(theGamma, dir, electron_mass_c2);
aGamma1->SetPolarization(pol.x(),pol.y(),pol.z());
aGamma2 = new G4DynamicParticle(theGamma,-dir, electron_mass_c2);
aGamma1->SetPolarization(-pol.x(),-pol.y(),-pol.z());
pol.set(-sinphi, cosphi, 0.0);
pol.rotateUz(dir);
aGamma2->SetPolarization(pol.x(),pol.y(),pol.z());
} else {
@@ -240,9 +247,11 @@ void G4eeToTwoGammaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
Phot1Direction.rotateUz(PositDirection);
aGamma1 = new G4DynamicParticle (theGamma,Phot1Direction, Phot1Energy);
phi = twopi * rndmEngine->flat();
G4ThreeVector pol1(cos(phi), sin(phi), 0.0);
pol1.rotateUz(Phot1Direction);
aGamma1->SetPolarization(pol1.x(),pol1.y(),pol1.z());
G4double cosphi = cos(phi);
G4double sinphi = sin(phi);
G4ThreeVector pol(cosphi, sinphi, 0.0);
pol.rotateUz(Phot1Direction);
aGamma1->SetPolarization(pol.x(),pol.y(),pol.z());
G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
G4double PositP= sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
@@ -253,7 +262,12 @@ void G4eeToTwoGammaModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
aGamma2 = new G4DynamicParticle (theGamma,Phot2Direction, Phot2Energy);
//!!! likely problematic direction to be checked
aGamma2->SetPolarization(-pol1.x(),-pol1.y(),-pol1.z());
pol.set(-sinphi, cosphi, 0.0);
pol.rotateUz(Phot1Direction);
cost = pol*Phot2Direction;
pol -= cost*Phot2Direction;
pol = pol.unit();
aGamma2->SetPolarization(pol.x(),pol.y(),pol.z());
}
/*
G4cout << "Annihilation in fly: e0= " << PositKinEnergy
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eplusAnnihilation.cc 68797 2013-04-05 13:27:11Z gcosmo $
// $Id: G4eplusAnnihilation.cc 101249 2016-11-10 08:52:15Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -128,15 +128,18 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& aTrack,
// Note : Effects due to binding of atomic electrons are negliged.
{
fParticleChange.InitializeForPostStep(aTrack);
CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
G4double cosTeta = 2.*G4UniformRand()-1.;
G4double cosTeta = 2.*rndmEngine->flat()-1.;
G4double sinTeta = sqrt((1.-cosTeta)*(1.0 + cosTeta));
G4double phi = twopi * G4UniformRand();
G4double phi = twopi * rndmEngine->flat();
G4ThreeVector dir(sinTeta*cos(phi), sinTeta*sin(phi), cosTeta);
phi = twopi * G4UniformRand();
G4ThreeVector pol(cos(phi), sin(phi), 0.0);
phi = twopi * rndmEngine->flat();
G4double cosphi = cos(phi);
G4double sinphi = sin(phi);
G4ThreeVector pol(cosphi, sinphi, 0.0);
pol.rotateUz(dir);
// e+ parameters
G4double weight = aTrack.GetWeight();
G4double time = aTrack.GetGlobalTime();
@@ -152,7 +155,9 @@ G4VParticleChange* G4eplusAnnihilation::AtRestDoIt(const G4Track& aTrack,
pParticleChange->AddSecondary(track);
dp = new G4DynamicParticle(theGamma,-dir, electron_mass_c2);
dp->SetPolarization(-pol.x(),-pol.y(),-pol.z());
pol.set(-sinphi, cosphi, 0.0);
pol.rotateUz(dir);
dp->SetPolarization(pol.x(),pol.y(),pol.z());
track = new G4Track(dp, time, aTrack.GetPosition());
track->SetTouchableHandle(aTrack.GetTouchableHandle());
track->SetWeight(weight);