00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #include "G4WentzelVIRelXSection.hh"
00050 #include "G4PhysicalConstants.hh"
00051 #include "G4SystemOfUnits.hh"
00052 #include "Randomize.hh"
00053 #include "G4Electron.hh"
00054 #include "G4Positron.hh"
00055 #include "G4Proton.hh"
00056 #include "G4LossTableManager.hh"
00057
00058
00059
00060 G4double G4WentzelVIRelXSection::ScreenRSquare[] = {0.0};
00061 G4double G4WentzelVIRelXSection::FormFactor[] = {0.0};
00062
00063 using namespace std;
00064
00065 G4WentzelVIRelXSection::G4WentzelVIRelXSection() :
00066 numlimit(0.1),
00067 nwarnings(0),
00068 nwarnlimit(50),
00069 alpha2(fine_structure_const*fine_structure_const)
00070 {
00071 fNistManager = G4NistManager::Instance();
00072 fG4pow = G4Pow::GetInstance();
00073 theElectron = G4Electron::Electron();
00074 thePositron = G4Positron::Positron();
00075 theProton = G4Proton::Proton();
00076 lowEnergyLimit = 1.0*eV;
00077 G4double p0 = electron_mass_c2*classic_electr_radius;
00078 coeff = twopi*p0*p0;
00079 particle = 0;
00080
00081
00082
00083
00084 if(0.0 == ScreenRSquare[0]) {
00085 G4double a0 = electron_mass_c2/0.88534;
00086 G4double constn = 6.937e-6/(MeV*MeV);
00087
00088 ScreenRSquare[0] = alpha2*a0*a0;
00089 for(G4int j=1; j<100; ++j) {
00090 G4double x = a0*fG4pow->Z13(j);
00091
00092 ScreenRSquare[j] = 0.5*alpha2*x*x;
00093 x = fNistManager->GetA27(j);
00094 FormFactor[j] = constn*x*x;
00095 }
00096 }
00097 currentMaterial = 0;
00098 elecXSRatio = factB = factD = formfactA = screenZ = 0.0;
00099 cosTetMaxElec = cosTetMaxNuc = invbeta2 = kinFactor = gam0pcmp = pcmp2 = 1.0;
00100
00101 factB1= 0.5*CLHEP::pi*fine_structure_const;
00102
00103 Initialise(theElectron, 1.0);
00104 targetMass = proton_mass_c2;
00105 }
00106
00107
00108
00109 G4WentzelVIRelXSection::~G4WentzelVIRelXSection()
00110 {}
00111
00112
00113
00114 void G4WentzelVIRelXSection::Initialise(const G4ParticleDefinition* p,
00115 G4double CosThetaLim)
00116 {
00117 SetupParticle(p);
00118 tkin = mom2 = momCM2 = 0.0;
00119 ecut = etag = DBL_MAX;
00120 targetZ = 0;
00121 cosThetaMax = CosThetaLim;
00122 G4double a =
00123 G4LossTableManager::Instance()->FactorForAngleLimit()*CLHEP::hbarc/CLHEP::fermi;
00124 factorA2 = 0.5*a*a;
00125 currentMaterial = 0;
00126 }
00127
00128
00129
00130 void G4WentzelVIRelXSection::SetupParticle(const G4ParticleDefinition* p)
00131 {
00132 particle = p;
00133 mass = particle->GetPDGMass();
00134 spin = particle->GetPDGSpin();
00135 if(0.0 != spin) { spin = 0.5; }
00136 G4double q = std::fabs(particle->GetPDGCharge()/eplus);
00137 chargeSquare = q*q;
00138 charge3 = chargeSquare*q;
00139 tkin = 0.0;
00140 currentMaterial = 0;
00141 targetZ = 0;
00142 }
00143
00144
00145
00146 G4double
00147 G4WentzelVIRelXSection::SetupTarget(G4int Z, G4double cut)
00148 {
00149 G4double cosTetMaxNuc2 = cosTetMaxNuc;
00150 if(Z != targetZ || tkin != etag) {
00151 etag = tkin;
00152 targetZ = Z;
00153 if(targetZ > 99) { targetZ = 99; }
00154 SetTargetMass(fNistManager->GetAtomicMassAmu(targetZ)*CLHEP::amu_c2);
00155
00156
00157
00158
00159
00160
00161
00162 kinFactor = coeff*targetZ*chargeSquare*invbeta2/mom2;
00163
00164 screenZ = ScreenRSquare[targetZ]/mom2;
00165 if(Z > 1) {
00166 screenZ *= std::min(Z*1.13,1.13 +3.76*Z*Z*invbeta2*alpha2*chargeSquare);
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 }
00178 if(targetZ == 1 && cosTetMaxNuc2 < 0.0 && particle == theProton) {
00179 cosTetMaxNuc2 = 0.0;
00180 }
00181 formfactA = FormFactor[targetZ]*mom2;
00182
00183 cosTetMaxElec = 1.0;
00184 ComputeMaxElectronScattering(cut);
00185 }
00186 return cosTetMaxNuc2;
00187 }
00188
00189
00190
00191 G4double
00192 G4WentzelVIRelXSection::ComputeTransportCrossSectionPerAtom(G4double cosTMax)
00193 {
00194 G4double xsec = 0.0;
00195 if(cosTMax >= 1.0) { return xsec; }
00196
00197 G4double xSection = 0.0;
00198 G4double x = 0;
00199 G4double y = 0;
00200 G4double x1= 0;
00201 G4double x2= 0;
00202 G4double xlog = 0.0;
00203
00204 G4double costm = std::max(cosTMax,cosTetMaxElec);
00205 G4double fb = screenZ*factB;
00206
00207
00208 if(costm < 1.0) {
00209 x = (1.0 - costm)/screenZ;
00210 if(x < numlimit) {
00211 x2 = 0.5*x*x;
00212 y = x2*(1.0 - 1.3333333*x + 3*x2);
00213 if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
00214 } else {
00215 x1= x/(1 + x);
00216 xlog = log(1.0 + x);
00217 y = xlog - x1;
00218 if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
00219 }
00220
00221 if(y < 0.0) {
00222 ++nwarnings;
00223 if(nwarnings < nwarnlimit) {
00224 G4cout << "G4WentzelVIRelXSection::ComputeTransportCrossSectionPerAtom scattering on e- <0"
00225 << G4endl;
00226 G4cout << "y= " << y
00227 << " e(MeV)= " << tkin << " p(MeV/c)= " << sqrt(mom2)
00228 << " Z= " << targetZ << " "
00229 << particle->GetParticleName() << G4endl;
00230 G4cout << " 1-costm= " << 1.0-costm << " screenZ= " << screenZ
00231 << " x= " << x << G4endl;
00232 }
00233 y = 0.0;
00234 }
00235 xSection = y;
00236 }
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 if(cosTMax < 1.0) {
00247 x = (1.0 - cosTMax)/screenZ;
00248 if(x < numlimit) {
00249 x2 = 0.5*x*x;
00250 y = x2*(1.0 - 1.3333333*x + 3*x2);
00251 if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
00252 } else {
00253 x1= x/(1 + x);
00254 xlog = log(1.0 + x);
00255 y = xlog - x1;
00256 if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
00257 }
00258
00259 if(y < 0.0) {
00260 ++nwarnings;
00261 if(nwarnings < nwarnlimit) {
00262 G4cout << "G4WentzelVIRelXSection::ComputeTransportCrossSectionPerAtom scattering on e- <0"
00263 << G4endl;
00264 G4cout << "y= " << y
00265 << " e(MeV)= " << tkin << " Z= " << targetZ << " "
00266 << particle->GetParticleName() << G4endl;
00267 G4cout << " formfactA= " << formfactA << " screenZ= " << screenZ
00268 << " x= " << " x1= " << x1 <<G4endl;
00269 }
00270 y = 0.0;
00271 }
00272 xSection += y*targetZ;
00273 }
00274 xSection *= kinFactor;
00275
00276
00277
00278
00279
00280
00281
00282
00283 return xSection;
00284 }
00285
00286
00287
00288 G4ThreeVector
00289 G4WentzelVIRelXSection::SampleSingleScattering(G4double cosTMin,
00290 G4double cosTMax,
00291 G4double elecRatio)
00292 {
00293 G4ThreeVector v(0.0,0.0,1.0);
00294
00295 G4double formf = formfactA;
00296 G4double cost1 = cosTMin;
00297 G4double cost2 = cosTMax;
00298 if(elecRatio > 0.0) {
00299 if(G4UniformRand() <= elecRatio) {
00300 formf = 0.0;
00301 cost1 = std::max(cost1,cosTetMaxElec);
00302 cost2 = std::max(cost2,cosTetMaxElec);
00303 }
00304 }
00305 if(cost1 < cost2) { return v; }
00306
00307 G4double w1 = 1. - cost1 + screenZ;
00308 G4double w2 = 1. - cost2 + screenZ;
00309 G4double z1 = w1*w2/(w1 + G4UniformRand()*(w2 - w1)) - screenZ;
00310
00311
00312 G4double fm = 1.0 + formf*z1;
00313
00314 G4double grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2 - z1))/( (1.0 + z1*factD)*fm*fm );
00315
00316 if( G4UniformRand() > grej ) { return v; }
00317
00318 G4double cost = 1.0 - z1;
00319
00320 if(cost > 1.0) { cost = 1.0; }
00321 else if(cost < -1.0) { cost =-1.0; }
00322 G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
00323
00324 G4double phi = twopi*G4UniformRand();
00325 G4double vx1 = sint*cos(phi);
00326 G4double vy1 = sint*sin(phi);
00327
00328
00329 v.set(vx1,vy1,cost);
00330 return v;
00331 }
00332
00333
00334
00335 void
00336 G4WentzelVIRelXSection::ComputeMaxElectronScattering(G4double cutEnergy)
00337 {
00338 if(mass > MeV) {
00339 G4double ratio = electron_mass_c2/mass;
00340 G4double tau = tkin/mass;
00341 G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
00342 (1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
00343
00344 cosTetMaxElec = 1.0 - std::min(cutEnergy, tmax)*electron_mass_c2/mom2;
00345 } else {
00346
00347 G4double tmax = tkin;
00348 if(particle == theElectron) { tmax *= 0.5; }
00349
00350 G4double t = std::min(cutEnergy, tmax);
00351 G4double mom21 = t*(t + 2.0*electron_mass_c2);
00352 G4double t1 = tkin - t;
00353
00354
00355 if(t1 > 0.0) {
00356 G4double mom22 = t1*(t1 + 2.0*mass);
00357 G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
00358 if(ctm < 1.0) { cosTetMaxElec = ctm; }
00359 if(particle == theElectron && cosTetMaxElec < 0.0) { cosTetMaxElec = 0.0; }
00360 }
00361 }
00362 }
00363
00364