Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 98737 2016-08-09 12:51:38Z 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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48 #include "G4PhysicalConstants.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "Randomize.hh"
51 #include "G4Electron.hh"
52 #include "G4Positron.hh"
53 #include "G4Proton.hh"
54 #include "G4EmParameters.hh"
55 #include "G4Log.hh"
56 #include "G4Exp.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
60 G4double G4WentzelOKandVIxSection::ScreenRSquareElec[] = {0.0};
61 G4double G4WentzelOKandVIxSection::ScreenRSquare[] = {0.0};
62 G4double G4WentzelOKandVIxSection::FormFactor[] = {0.0};
63 
64 using namespace std;
65 
67  temp(0.,0.,0.),
68  numlimit(0.1),
69  nwarnings(0),
70  nwarnlimit(50),
71  isCombined(combined),
72  cosThetaMax(-1.0),
74 {
75  fNistManager = G4NistManager::Instance();
76  fG4pow = G4Pow::GetInstance();
77  theElectron = G4Electron::Electron();
78  thePositron = G4Positron::Positron();
79  theProton = G4Proton::Proton();
80  lowEnergyLimit = 1.0*eV;
82  coeff = twopi*p0*p0;
83  particle = nullptr;
84 
85  fNucFormfactor = fExponentialNF;
86 
87  // Thomas-Fermi screening radii
88  // Formfactors from A.V. Butkevich et al., NIM A 488 (2002) 282
89 
90  if(0.0 == ScreenRSquare[0]) {
91  G4double a0 = electron_mass_c2/0.88534;
92  G4double constn = 6.937e-6/(MeV*MeV);
93 
94  ScreenRSquare[0] = alpha2*a0*a0;
95  ScreenRSquareElec[0] = ScreenRSquare[0];
96  for(G4int j=1; j<100; ++j) {
97  G4double x = a0*fG4pow->Z13(j);
98  if(1 == j) { ScreenRSquare[j] = 0.5*alpha2*a0*a0; }
99  else {
100  ScreenRSquare[j] = 0.5*(1 + G4Exp(-j*j*0.001))*alpha2*x*x;
101  ScreenRSquareElec[j] = 0.5*alpha2*x*x;
102  }
103  x = fNistManager->GetA27(j);
104  FormFactor[j] = constn*x*x;
105  }
106  }
107  currentMaterial = 0;
108  factB = factD = formfactA = screenZ = 0.0;
109  cosTetMaxElec = cosTetMaxNuc = invbeta2 = kinFactor = gam0pcmp = pcmp2 = 1.0;
110 
111  factB1= 0.5*CLHEP::pi*fine_structure_const;
112 
113  tkin = mom2 = momCM2 = factorA2 = mass = spin = chargeSquare = charge3 = 0.0;
114  ecut = etag = DBL_MAX;
115  targetZ = 0;
116  targetMass = proton_mass_c2;
117  particle = nullptr;
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121 
123 {}
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
126 
128  G4double cosThetaLim)
129 {
130  SetupParticle(p);
131  tkin = mom2 = momCM2 = 0.0;
132  ecut = etag = DBL_MAX;
133  targetZ = 0;
134 
135  // cosThetaMax is below 1.0 only when MSC is combined with SS
136  if(isCombined) { cosThetaMax = cosThetaLim; }
137 
140  factorA2 = 0.5*a*a;
141  currentMaterial = nullptr;
142 
143  fNucFormfactor = G4EmParameters::Instance()->NuclearFormfactorType();
144 
145  //G4cout << "G4WentzelOKandVIxSection::Initialise mass= " << mass
146  // << " " << p->GetParticleName()
147  // << " cosThetaMax= " << cosThetaMax << G4endl;
148 
149 }
150 
151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
152 
154 {
155  particle = p;
156  mass = particle->GetPDGMass();
157  spin = particle->GetPDGSpin();
158  if(0.0 != spin) { spin = 0.5; }
159  G4double q = std::fabs(particle->GetPDGCharge()/eplus);
160  chargeSquare = q*q;
161  charge3 = chargeSquare*q;
162  tkin = 0.0;
163  currentMaterial = 0;
164  targetZ = 0;
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168 
169 G4double
171 {
172  G4double cosTetMaxNuc2 = cosTetMaxNuc;
173  if(Z != targetZ || tkin != etag) {
174  etag = tkin;
175  targetZ = Z;
176  if(targetZ > 99) { targetZ = 99; }
177  G4double massT = proton_mass_c2;
178  if(targetZ > 1) {
179  massT = fNistManager->GetAtomicMassAmu(targetZ)*CLHEP::amu_c2;
180  }
181  SetTargetMass(massT);
182 
183  kinFactor = coeff*Z*chargeSquare*invbeta2/mom2;
184 
185  if(1 == Z) {
186  screenZ = ScreenRSquare[targetZ]/mom2;
187  } else if(mass > MeV) {
188  screenZ = std::min(Z*1.13,1.13 +3.76*Z*Z*invbeta2*alpha2*chargeSquare)*
189  ScreenRSquare[targetZ]/mom2;
190  } else {
191  G4double tau = tkin/mass;
192  screenZ = std::min(Z*1.13,(1.13 +3.76*Z*Z
193  *invbeta2*alpha2*std::sqrt(tau/(tau + fG4pow->Z23(targetZ)))))*
194  ScreenRSquareElec[targetZ]/mom2;
195  }
196  if(targetZ == 1 && cosTetMaxNuc2 < 0.0 && particle == theProton) {
197  cosTetMaxNuc2 = 0.0;
198  }
199  formfactA = FormFactor[targetZ]*mom2;
200 
201  cosTetMaxElec = 1.0;
202  ComputeMaxElectronScattering(cut);
203  }
204  return cosTetMaxNuc2;
205 }
206 
207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
208 
209 G4double
211 {
212  G4double xSection = 0.0;
213  if(cosTMax >= 1.0) { return xSection; }
214 
215  G4double x = 0;
216  G4double y = 0;
217  G4double x1= 0;
218  G4double x2= 0;
219  G4double xlog = 0.0;
220 
221  G4double costm = std::max(cosTMax,cosTetMaxElec);
222  G4double fb = screenZ*factB;
223 
224  // scattering off electrons
225  if(costm < 1.0) {
226  x = (1.0 - costm)/screenZ;
227  if(x < numlimit) {
228  x2 = 0.5*x*x;
229  y = x2*(1.0 - 1.3333333*x + 3*x2);
230  if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
231  } else {
232  x1= x/(1 + x);
233  xlog = G4Log(1.0 + x);
234  y = xlog - x1;
235  if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
236  }
237 
238  if(y < 0.0) {
239  ++nwarnings;
240  if(nwarnings < nwarnlimit) {
241  G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom"
242  << " scattering on e- <0"
243  << G4endl;
244  G4cout << "y= " << y
245  << " e(MeV)= " << tkin << " p(MeV/c)= " << sqrt(mom2)
246  << " Z= " << targetZ << " "
247  << particle->GetParticleName() << G4endl;
248  G4cout << " 1-costm= " << 1.0-costm << " screenZ= " << screenZ
249  << " x= " << x << G4endl;
250  }
251  y = 0.0;
252  }
253  xSection = y;
254  }
255  /*
256  G4cout << "G4WentzelVI:XS per A " << " Z= " << targetZ
257  << " e(MeV)= " << tkin/MeV << " XSel= " << xSection
258  << " cut(MeV)= " << ecut/MeV
259  << " zmaxE= " << (1.0 - cosTetMaxElec)/screenZ
260  << " zmaxN= " << (1.0 - cosThetaMax)/screenZ
261  << " 1-costm= " << 1.0 - cosThetaMax << G4endl;
262  */
263  // scattering off nucleus
264  if(cosTMax < 1.0) {
265  x = (1.0 - cosTMax)/screenZ;
266  if(x < numlimit) {
267  x2 = 0.5*x*x;
268  y = x2*(1.0 - 1.3333333*x + 3*x2);
269  if(0.0 < factB) { y -= fb*x2*x*(0.6666667 - x); }
270  } else {
271  x1= x/(1 + x);
272  xlog = G4Log(1.0 + x);
273  y = xlog - x1;
274  if(0.0 < factB) { y -= fb*(x + x1 - 2*xlog); }
275  }
276 
277  if(y < 0.0) {
278  ++nwarnings;
279  if(nwarnings < nwarnlimit) {
280  G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom"
281  << " scattering on nucleus <0"
282  << G4endl;
283  G4cout << "y= " << y
284  << " e(MeV)= " << tkin << " Z= " << targetZ << " "
285  << particle->GetParticleName() << G4endl;
286  G4cout << " formfactA= " << formfactA << " screenZ= " << screenZ
287  << " x= " << " x1= " << x1 <<G4endl;
288  }
289  y = 0.0;
290  }
291  xSection += y*targetZ;
292  }
293  xSection *= kinFactor;
294 
295  /*
296  G4cout << "Z= " << targetZ << " XStot= " << xSection/barn
297  << " screenZ= " << screenZ << " formF= " << formfactA
298  << " for " << particle->GetParticleName()
299  << " m= " << mass << " 1/v= " << sqrt(invbeta2) << " p= " << sqrt(mom2)
300  << " x= " << x
301  << G4endl;
302  */
303  return xSection;
304 }
305 
306 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
307 
310  G4double cosTMax,
311  G4double elecRatio)
312 {
313  temp.set(0.0,0.0,1.0);
314  CLHEP::HepRandomEngine* rndmEngineMod = G4Random::getTheEngine();
315 
316  G4double formf = formfactA;
317  G4double cost1 = cosTMin;
318  G4double cost2 = cosTMax;
319  if(elecRatio > 0.0) {
320  if(rndmEngineMod->flat() <= elecRatio) {
321  formf = 0.0;
322  cost1 = std::max(cost1,cosTetMaxElec);
323  cost2 = std::max(cost2,cosTetMaxElec);
324  }
325  }
326  if(cost1 > cost2) {
327  G4double w1 = 1. - cost1 + screenZ;
328  G4double w2 = 1. - cost2 + screenZ;
329  G4double z1 = w1*w2/(w1 + rndmEngineMod->flat()*(w2 - w1)) - screenZ;
330 
331  G4double fm = 1.0;
332  if(fNucFormfactor == fExponentialNF) {
333  fm += formf*z1;
334  fm = 1.0/(fm*fm);
335  } else if(fNucFormfactor == fGaussianNF) {
336  fm = G4Exp(-2*formf*z1);
337  } else if(fNucFormfactor == fFlatNF) {
338  static const G4double ccoef = 0.00508/MeV;
339  G4double x = std::sqrt(2.*mom2*z1)*ccoef*2.;
340  fm = FlatFormfactor(x);
341  fm *= FlatFormfactor(x*0.6
342  *fG4pow->A13(fNistManager->GetAtomicMassAmu(targetZ) ) );
343  }
344 
345  G4double grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2. - z1))
346  *fm*fm/(1.0 + z1*factD);
347 
348  if(rndmEngineMod->flat() <= grej) {
349  // exclude "false" scattering due to formfactor and spin effect
350  G4double cost = 1.0 - z1;
351  if(cost > 1.0) { cost = 1.0; }
352  else if(cost < -1.0) { cost =-1.0; }
353  G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
354  //G4cout << "sint= " << sint << G4endl;
355  G4double phi = twopi*rndmEngineMod->flat();
356  temp.set(sint*cos(phi),sint*sin(phi),cost);
357  }
358  }
359  return temp;
360 }
361 
362 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
363 
364 void
365 G4WentzelOKandVIxSection::ComputeMaxElectronScattering(G4double cutEnergy)
366 {
367  if(mass > MeV) {
368  G4double ratio = electron_mass_c2/mass;
369  G4double tau = tkin/mass;
370  G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
371  (1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
372  //tmax = std::min(tmax, targetZ*targetZ*10*eV);
373  cosTetMaxElec = 1.0 - std::min(cutEnergy, tmax)*electron_mass_c2/mom2;
374  } else {
375 
376  G4double tmax = tkin;
377  if(particle == theElectron) { tmax *= 0.5; }
378  //tmax = std::min(tmax, targetZ*targetZ*10*eV);
379  G4double t = std::min(cutEnergy, tmax);
380  G4double mom21 = t*(t + 2.0*electron_mass_c2);
381  G4double t1 = tkin - t;
382  //G4cout <<"tkin=" <<tkin<<" tmax= "<<tmax<<" t= "
383  //<<t<< " t1= "<<t1<<" cut= "<<ecut<<G4endl;
384  if(t1 > 0.0) {
385  G4double mom22 = t1*(t1 + 2.0*mass);
386  G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
387  if(ctm < 1.0) { cosTetMaxElec = ctm; }
388  if(particle == theElectron && cosTetMaxElec < 0.0) {
389  cosTetMaxElec = 0.0;
390  }
391  }
392  }
393 }
394 
395 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
396 
397 G4double
399 {
400  return 0.0;
401 }
402 
403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void set(double x, double y, double z)
const G4double a0
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
void SetupParticle(const G4ParticleDefinition *)
G4WentzelOKandVIxSection(G4bool combined=true)
static constexpr double proton_mass_c2
static constexpr double hbarc
const char * p
Definition: xmltok.h:285
G4double ComputeSecondTransportMoment(G4double CosThetaMax)
G4double GetA27(G4int Z) const
virtual double flat()=0
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4double SetupTarget(G4int Z, G4double cut=DBL_MAX)
const G4String & GetParticleName() const
static constexpr double twopi
Definition: G4SIunits.hh:76
static constexpr double electron_mass_c2
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax)
G4GLOB_DLL std::ostream G4cout
G4double Z13(G4int Z) const
Definition: G4Pow.hh:127
bool G4bool
Definition: G4Types.hh:79
static constexpr double classic_electr_radius
static constexpr double eplus
Definition: G4SIunits.hh:199
static G4Proton * Proton()
Definition: G4Proton.cc:93
static constexpr double eV
Definition: G4SIunits.hh:215
static constexpr double amu_c2
G4double G4Log(G4double x)
Definition: G4Log.hh:230
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
G4NuclearFormfactorType NuclearFormfactorType() const
static G4Positron * Positron()
Definition: G4Positron.cc:94
G4double GetPDGMass() const
G4double A13(G4double A) const
Definition: G4Pow.hh:132
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static G4EmParameters * Instance()
static constexpr double fermi
Definition: SystemOfUnits.h:83
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:154
G4double GetPDGSpin() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
static constexpr double fine_structure_const
G4double GetPDGCharge() const
#define DBL_MAX
Definition: templates.hh:83
static constexpr double pi
Definition: SystemOfUnits.h:54
void Initialise(const G4ParticleDefinition *, G4double CosThetaLim)
G4double FactorForAngleLimit() const
G4ThreeVector & SampleSingleScattering(G4double CosThetaMin, G4double CosThetaMax, G4double elecRatio=0.0)