Geant4_10
G4WentzelOKandVIxSection.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4WentzelOKandVIxSection.cc 74309 2013-10-03 06:42:30Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4WentzelOKandVIxSection
34 //
35 // Author: V.Ivanchenko
36 //
37 // Creation date: 09.04.2008 from G4MuMscModel
38 //
39 // Modifications:
40 //
41 //
42 
43 // -------------------------------------------------------------------
44 //
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 #include "G4PhysicalConstants.hh"
51 #include "G4SystemOfUnits.hh"
52 #include "Randomize.hh"
53 #include "G4Electron.hh"
54 #include "G4Positron.hh"
55 #include "G4Proton.hh"
56 #include "G4LossTableManager.hh"
57 #include "G4Log.hh"
58 #include "G4Exp.hh"
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
62 G4double G4WentzelOKandVIxSection::ScreenRSquareElec[] = {0.0};
63 G4double G4WentzelOKandVIxSection::ScreenRSquare[] = {0.0};
64 G4double G4WentzelOKandVIxSection::FormFactor[] = {0.0};
65 
66 using namespace std;
67 
69  numlimit(0.1),
70  nwarnings(0),
71  nwarnlimit(50),
73 {
74  fNistManager = G4NistManager::Instance();
75  fG4pow = G4Pow::GetInstance();
76  theElectron = G4Electron::Electron();
77  thePositron = G4Positron::Positron();
78  theProton = G4Proton::Proton();
79  lowEnergyLimit = 1.0*eV;
81  coeff = twopi*p0*p0;
82  particle = 0;
83 
84  // Thomas-Fermi screening radii
85  // Formfactors from A.V. Butkevich et al., NIM A 488 (2002) 282
86 
87  if(0.0 == ScreenRSquare[0]) {
88  G4double a0 = electron_mass_c2/0.88534;
89  G4double constn = 6.937e-6/(MeV*MeV);
90 
91  ScreenRSquare[0] = alpha2*a0*a0;
92  ScreenRSquareElec[0] = ScreenRSquare[0];
93  for(G4int j=1; j<100; ++j) {
94  G4double x = a0*fG4pow->Z13(j);
95  if(1 == j) { ScreenRSquare[j] = 0.5*alpha2*a0*a0; }
96  else {
97  ScreenRSquare[j] = 0.5*(1 + G4Exp(-j*j*0.001))*alpha2*x*x;
98  ScreenRSquareElec[j] = 0.5*alpha2*x*x;
99  }
100  x = fNistManager->GetA27(j);
101  FormFactor[j] = constn*x*x;
102  }
103  }
104  currentMaterial = 0;
105  elecXSRatio = factB = factD = formfactA = screenZ = 0.0;
106  cosTetMaxElec = cosTetMaxNuc = invbeta2 = kinFactor = gam0pcmp = pcmp2 = 1.0;
107 
108  factB1= 0.5*CLHEP::pi*fine_structure_const;
109 
110  tkin = mom2 = momCM2 = factorA2 = mass = spin = chargeSquare = charge3 = 0.0;
111  ecut = etag = DBL_MAX;
112  targetZ = 0;
113  cosThetaMax = 1.0;
114  targetMass = proton_mass_c2;
115  particle = 0;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {}
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
124 
126  G4double CosThetaLim)
127 {
128  SetupParticle(p);
129  tkin = mom2 = momCM2 = 0.0;
130  ecut = etag = DBL_MAX;
131  targetZ = 0;
132  cosThetaMax = CosThetaLim;
134  *CLHEP::hbarc/CLHEP::fermi;
135  factorA2 = 0.5*a*a;
136  currentMaterial = 0;
137 
138  //G4cout << "G4WentzelOKandVIxSection::Initialise mass= " << mass
139  // << " " << p->GetParticleName() << G4endl;
140 
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
144 
146 {
147  particle = p;
148  mass = particle->GetPDGMass();
149  spin = particle->GetPDGSpin();
150  if(0.0 != spin) { spin = 0.5; }
151  G4double q = std::fabs(particle->GetPDGCharge()/eplus);
152  chargeSquare = q*q;
153  charge3 = chargeSquare*q;
154  tkin = 0.0;
155  currentMaterial = 0;
156  targetZ = 0;
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
160 
161 G4double
163 {
164  G4double cosTetMaxNuc2 = cosTetMaxNuc;
165  if(Z != targetZ || tkin != etag) {
166  etag = tkin;
167  targetZ = Z;
168  if(targetZ > 99) { targetZ = 99; }
169  SetTargetMass(fNistManager->GetAtomicMassAmu(targetZ)*CLHEP::amu_c2);
170  //G4double tmass2 = targetMass*targetMass;
171  //G4double etot = tkin + mass;
172  //G4double invmass2 = mass*mass + tmass2 + 2*etot*targetMass;
173  //momCM2 = mom2*tmass2/invmass2;
174  //gam0pcmp = (etot + targetMass)*targetMass/invmass2;
175  //pcmp2 = tmass2/invmass2;
176 
177  kinFactor = coeff*Z*chargeSquare*invbeta2/mom2;
178 
179  if(1 == Z) {
180  screenZ = ScreenRSquare[targetZ]/mom2;
181  } else if(mass > MeV) {
182  screenZ = std::min(Z*1.13,1.13 +3.76*Z*Z*invbeta2*alpha2*chargeSquare)*
183  ScreenRSquare[targetZ]/mom2;
184  } else {
185  G4double tau = tkin/mass;
186  screenZ = std::min(Z*1.13,(1.13 +3.76*Z*Z
187  *invbeta2*alpha2*std::sqrt(tau/(tau + fG4pow->Z23(targetZ)))))*
188  ScreenRSquareElec[targetZ]/mom2;
189  }
190  if(targetZ == 1 && cosTetMaxNuc2 < 0.0 && particle == theProton) {
191  cosTetMaxNuc2 = 0.0;
192  }
193  formfactA = FormFactor[targetZ]*mom2;
194 
195  cosTetMaxElec = 1.0;
196  ComputeMaxElectronScattering(cut);
197  }
198  return cosTetMaxNuc2;
199 }
200 
201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
202 
203 G4double
205 {
206  G4double xsec = 0.0;
207  if(cosTMax >= 1.0) { return xsec; }
208 
209  G4double xSection = 0.0;
210  G4double x = 0;
211  G4double y = 0;
212  G4double x1= 0;
213  G4double x2= 0;
214  G4double xlog = 0.0;
215 
216  G4double costm = std::max(cosTMax,cosTetMaxElec);
217  G4double fb = screenZ*factB;
218 
219  // scattering off electrons
220  if(costm < 1.0) {
221  x = (1.0 - costm)/screenZ;
222  if(x < numlimit) {
223  x2 = 0.5*x*x;
224  y = x2*(1.0 - 1.3333333*x + 3*x2);
225  if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
226  } else {
227  x1= x/(1 + x);
228  xlog = G4Log(1.0 + x);
229  y = xlog - x1;
230  if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
231  }
232 
233  if(y < 0.0) {
234  ++nwarnings;
235  if(nwarnings < nwarnlimit) {
236  G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom scattering on e- <0"
237  << G4endl;
238  G4cout << "y= " << y
239  << " e(MeV)= " << tkin << " p(MeV/c)= " << sqrt(mom2)
240  << " Z= " << targetZ << " "
241  << particle->GetParticleName() << G4endl;
242  G4cout << " 1-costm= " << 1.0-costm << " screenZ= " << screenZ
243  << " x= " << x << G4endl;
244  }
245  y = 0.0;
246  }
247  xSection = y;
248  }
249  /*
250  G4cout << "G4WentzelVI:XS per A " << " Z= " << targetZ
251  << " e(MeV)= " << tkin/MeV << " XSel= " << xSection
252  << " cut(MeV)= " << ecut/MeV
253  << " zmaxE= " << (1.0 - cosTetMaxElec)/screenZ
254  << " zmaxN= " << (1.0 - cosThetaMax)/screenZ
255  << " 1-costm= " << 1.0 - cosThetaMax << G4endl;
256  */
257  // scattering off nucleus
258  if(cosTMax < 1.0) {
259  x = (1.0 - cosTMax)/screenZ;
260  if(x < numlimit) {
261  x2 = 0.5*x*x;
262  y = x2*(1.0 - 1.3333333*x + 3*x2);
263  if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
264  } else {
265  x1= x/(1 + x);
266  xlog = G4Log(1.0 + x);
267  y = xlog - x1;
268  if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
269  }
270 
271  if(y < 0.0) {
272  ++nwarnings;
273  if(nwarnings < nwarnlimit) {
274  G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom scattering on e- <0"
275  << G4endl;
276  G4cout << "y= " << y
277  << " e(MeV)= " << tkin << " Z= " << targetZ << " "
278  << particle->GetParticleName() << G4endl;
279  G4cout << " formfactA= " << formfactA << " screenZ= " << screenZ
280  << " x= " << " x1= " << x1 <<G4endl;
281  }
282  y = 0.0;
283  }
284  xSection += y*targetZ;
285  }
286  xSection *= kinFactor;
287  /*
288  G4cout << "Z= " << targetZ << " XStot= " << xSection/barn
289  << " screenZ= " << screenZ << " formF= " << formfactA
290  << " for " << particle->GetParticleName()
291  << " m= " << mass << " 1/v= " << sqrt(invbeta2) << " p= " << sqrt(mom2)
292  << " x= " << x
293  << G4endl;
294  */
295  return xSection;
296 }
297 
298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
299 
302  G4double cosTMax,
303  G4double elecRatio)
304 {
305  G4ThreeVector v(0.0,0.0,1.0);
306 
307  G4double formf = formfactA;
308  G4double cost1 = cosTMin;
309  G4double cost2 = cosTMax;
310  if(elecRatio > 0.0) {
311  if(G4UniformRand() <= elecRatio) {
312  formf = 0.0;
313  cost1 = std::max(cost1,cosTetMaxElec);
314  cost2 = std::max(cost2,cosTetMaxElec);
315  }
316  }
317  if(cost1 < cost2) { return v; }
318 
319  G4double w1 = 1. - cost1 + screenZ;
320  G4double w2 = 1. - cost2 + screenZ;
321  G4double z1 = w1*w2/(w1 + G4UniformRand()*(w2 - w1)) - screenZ;
322 
323  //G4double fm = 1.0 + formf*z1/(1.0 + (mass + tkin)*z1/targetMass);
324  G4double fm = 1.0 + formf*z1;
325  //G4double grej = (1. - z1*factB)/( (1.0 + z1*factD)*fm*fm );
326  G4double grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2 - z1))/( (1.0 + z1*factD)*fm*fm );
327  // "false" scattering
328  if( G4UniformRand() > grej ) { return v; }
329  // }
330  G4double cost = 1.0 - z1;
331 
332  if(cost > 1.0) { cost = 1.0; }
333  else if(cost < -1.0) { cost =-1.0; }
334  G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
335  //G4cout << "sint= " << sint << G4endl;
336  G4double phi = twopi*G4UniformRand();
337  G4double vx1 = sint*cos(phi);
338  G4double vy1 = sint*sin(phi);
339 
340  // only direction is changed
341  v.set(vx1,vy1,cost);
342  return v;
343 }
344 
345 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
346 
347 void
348 G4WentzelOKandVIxSection::ComputeMaxElectronScattering(G4double cutEnergy)
349 {
350  if(mass > MeV) {
351  G4double ratio = electron_mass_c2/mass;
352  G4double tau = tkin/mass;
353  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
354  (1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
355  //tmax = std::min(tmax, targetZ*targetZ*10*eV);
356  cosTetMaxElec = 1.0 - std::min(cutEnergy, tmax)*electron_mass_c2/mom2;
357  } else {
358 
359  G4double tmax = tkin;
360  if(particle == theElectron) { tmax *= 0.5; }
361  //tmax = std::min(tmax, targetZ*targetZ*10*eV);
362  G4double t = std::min(cutEnergy, tmax);
363  G4double mom21 = t*(t + 2.0*electron_mass_c2);
364  G4double t1 = tkin - t;
365  //G4cout <<"tkin=" <<tkin<<" tmax= "<<tmax<<" t= "
366  //<<t<< " t1= "<<t1<<" cut= "<<ecut<<G4endl;
367  if(t1 > 0.0) {
368  G4double mom22 = t1*(t1 + 2.0*mass);
369  G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
370  if(ctm < 1.0) { cosTetMaxElec = ctm; }
371  if(particle == theElectron && cosTetMaxElec < 0.0) { cosTetMaxElec = 0.0; }
372  }
373  }
374 }
375 
376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void set(double x, double y, double z)
static G4Pow * GetInstance()
Definition: G4Pow.cc:53
void SetupParticle(const G4ParticleDefinition *)
TTree * t1
Definition: plottest35.C:26
static G4LossTableManager * Instance()
Double_t x2[nxs]
Definition: Style.C:19
tuple a
Definition: test.py:11
G4ThreeVector SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)
const char * p
Definition: xmltok.h:285
G4double FactorForAngleLimit() const
G4double GetA27(G4int Z)
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
const G4String & GetParticleName() const
Double_t y
Definition: plot.C:279
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
G4double Z13(G4int Z) const
Definition: G4Pow.hh:129
Float_t Z
Definition: plot.C:39
Double_t x1[nxs]
Definition: Style.C:18
static G4Proton * Proton()
Definition: G4Proton.cc:93
float proton_mass_c2
Definition: hepunit.py:275
float electron_mass_c2
Definition: hepunit.py:274
tuple v
Definition: test.py:18
G4double G4Log(G4double x)
Definition: G4Log.hh:227
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
#define fm
static G4Positron * Positron()
Definition: G4Positron.cc:94
G4double GetPDGMass() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double GetAtomicMassAmu(const G4String &symb) const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double Z23(G4int Z) const
Definition: G4Pow.hh:153
G4double GetPDGSpin() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
#define DBL_MAX
Definition: templates.hh:83
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)