-
Notifications
You must be signed in to change notification settings - Fork 313
/
G4WentzelOKandVIxSection.cc
427 lines (380 loc) · 14.1 KB
/
G4WentzelOKandVIxSection.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4WentzelOKandVIxSection
//
// Author: V.Ivanchenko
//
// Creation date: 09.04.2008 from G4MuMscModel
//
// Modifications:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4WentzelOKandVIxSection.hh"
#include "G4ScreeningMottCrossSection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Proton.hh"
#include "G4EmParameters.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4AutoLock.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4WentzelOKandVIxSection::ScreenRSquareElec[] = {0.0};
G4double G4WentzelOKandVIxSection::ScreenRSquare[] = {0.0};
G4double G4WentzelOKandVIxSection::FormFactor[] = {0.0};
namespace
{
G4Mutex theWOKVIMutex = G4MUTEX_INITIALIZER;
}
const G4double alpha2 = CLHEP::fine_structure_const*CLHEP::fine_structure_const;
const G4double factB1= 0.5*CLHEP::pi*CLHEP::fine_structure_const;
const G4double numlimit = 0.1;
const G4int nwarnlimit = 50;
using namespace std;
G4WentzelOKandVIxSection::G4WentzelOKandVIxSection(G4bool comb) :
temp(0.,0.,0.),
isCombined(comb)
{
fNistManager = G4NistManager::Instance();
fG4pow = G4Pow::GetInstance();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
theProton = G4Proton::Proton();
G4double p0 = CLHEP::electron_mass_c2*CLHEP::classic_electr_radius;
coeff = CLHEP::twopi*p0*p0;
targetMass = CLHEP::proton_mass_c2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4WentzelOKandVIxSection::~G4WentzelOKandVIxSection()
{
delete fMottXSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4WentzelOKandVIxSection::Initialise(const G4ParticleDefinition* p,
G4double cosThetaLim)
{
SetupParticle(p);
tkin = mom2 = momCM2 = 0.0;
ecut = etag = DBL_MAX;
targetZ = 0;
// cosThetaMax is below 1.0 only when MSC is combined with SS
if(isCombined) { cosThetaMax = cosThetaLim; }
G4EmParameters* param = G4EmParameters::Instance();
G4double a = param->FactorForAngleLimit()*CLHEP::hbarc/CLHEP::fermi;
factorA2 = 0.5*a*a;
currentMaterial = nullptr;
fNucFormfactor = param->NuclearFormfactorType();
if(0.0 == ScreenRSquare[0]) { InitialiseA(); }
// Mott corrections always added
if((p == theElectron || p == thePositron) && !fMottXSection) {
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....
void G4WentzelOKandVIxSection::InitialiseA()
{
// Thomas-Fermi screening radii
// Formfactors from A.V. Butkevich et al., NIM A 488 (2002) 282
if(0.0 != ScreenRSquare[0]) { return; }
G4AutoLock l(&theWOKVIMutex);
if(0.0 == ScreenRSquare[0]) {
const G4double invmev2 = 1./(CLHEP::MeV*CLHEP::MeV);
G4double a0 = CLHEP::electron_mass_c2/0.88534;
G4double constn = 6.937e-6*invmev2;
G4double fct = G4EmParameters::Instance()->ScreeningFactor();
G4double afact = 0.5*fct*alpha2*a0*a0;
ScreenRSquare[0] = afact;
ScreenRSquare[1] = afact;
ScreenRSquareElec[1] = afact;
FormFactor[1] = 3.097e-6*invmev2;
for(G4int j=2; j<100; ++j) {
G4double x = fG4pow->Z13(j);
ScreenRSquare[j] = afact*(1 + G4Exp(-j*j*0.001))*x*x;
ScreenRSquareElec[j] = afact*x*x;
x = fNistManager->GetA27(j);
FormFactor[j] = constn*x*x;
}
}
l.unlock();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4WentzelOKandVIxSection::SetupParticle(const G4ParticleDefinition* p)
{
particle = p;
mass = particle->GetPDGMass();
spin = particle->GetPDGSpin();
if(0.0 != spin) { spin = 0.5; }
G4double q = std::abs(particle->GetPDGCharge()/eplus);
chargeSquare = q*q;
charge3 = chargeSquare*q;
tkin = 0.0;
currentMaterial = nullptr;
targetZ = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4WentzelOKandVIxSection::SetupKinematic(G4double ekin, const G4Material* mat)
{
if(ekin != tkin || mat != currentMaterial) {
currentMaterial = mat;
tkin = ekin;
mom2 = tkin*(tkin + 2.0*mass);
invbeta2 = 1.0 + mass*mass/mom2;
factB = spin/invbeta2;
cosTetMaxNuc = isCombined ?
std::max(cosThetaMax, 1.-factorA2*mat->GetIonisation()->GetInvA23()/mom2)
: cosThetaMax;
}
return cosTetMaxNuc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4WentzelOKandVIxSection::SetupTarget(G4int Z, G4double cut)
{
G4double cosTetMaxNuc2 = cosTetMaxNuc;
if(Z != targetZ || tkin != etag) {
etag = tkin;
targetZ = std::min(Z, 99);
G4double massT = (1 == Z) ? CLHEP::proton_mass_c2 :
fNistManager->GetAtomicMassAmu(Z)*CLHEP::amu_c2;
SetTargetMass(massT);
kinFactor = coeff*Z*chargeSquare*invbeta2/mom2;
if(particle == theElectron && fMottXSection) {
fMottFactor = (1.0 + 2.0e-4*Z*Z);
}
if(1 == Z) {
screenZ = ScreenRSquare[targetZ]/mom2;
} else if(mass > MeV) {
screenZ = std::min(Z*1.13,1.13 +3.76*Z*Z*invbeta2*alpha2*chargeSquare)*
ScreenRSquare[targetZ]/mom2;
} else {
G4double tau = tkin/mass;
screenZ = std::min(Z*1.13,(1.13 +3.76*Z*Z
*invbeta2*alpha2*std::sqrt(tau/(tau + fG4pow->Z23(targetZ)))))*
ScreenRSquareElec[targetZ]/mom2;
}
if(targetZ == 1 && particle == theProton && cosTetMaxNuc2 < 0.0) {
cosTetMaxNuc2 = 0.0;
}
formfactA = FormFactor[targetZ]*mom2;
cosTetMaxElec = 1.0;
ComputeMaxElectronScattering(cut);
}
//G4cout << "SetupTarget: Z= " << targetZ << " kinFactor= " << kinFactor
// << " fMottFactor= " << fMottFactor << " screenZ= " << screenZ <<G4endl;
return cosTetMaxNuc2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom(G4double cosTMax)
{
G4double xSection = 0.0;
if(cosTMax >= 1.0) { return xSection; }
G4double costm = std::max(cosTMax,cosTetMaxElec);
G4double fb = screenZ*factB;
// scattering off electrons
if(costm < 1.0) {
G4double x = (1.0 - costm)/screenZ;
if(x < numlimit) {
G4double x2 = 0.5*x*x;
xSection = x2*((1.0 - 1.3333333*x + 3*x2) - fb*x*(0.6666667 - x));
} else {
G4double x1= x/(1 + x);
G4double xlog = G4Log(1.0 + x);
xSection = xlog - x1 - fb*(x + x1 - 2*xlog);
}
if(xSection < 0.0) {
++nwarnings;
if(nwarnings < nwarnlimit) {
G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom"
<< " scattering on e- <0"
<< G4endl;
G4cout << "cross= " << xSection
<< " e(MeV)= " << tkin << " p(MeV/c)= " << sqrt(mom2)
<< " Z= " << targetZ << " "
<< particle->GetParticleName() << G4endl;
G4cout << " 1-costm= " << 1.0-costm << " screenZ= " << screenZ
<< " x= " << x << G4endl;
}
xSection = 0.0;
}
}
/*
G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom: \n"
<< " Z= " << targetZ
<< " e(MeV)= " << tkin/MeV << " XSel= " << xSection
<< " zmaxE= " << (1.0 - cosTetMaxElec)/screenZ
<< " zmaxN= " << (1.0 - cosThetaMax)/screenZ
<< " 1-costm= " << 1.0 - cosThetaMax << G4endl;
*/
// scattering off nucleus
if(cosTMax < 1.0) {
G4double x = (1.0 - cosTMax)/screenZ;
G4double y;
if(x < numlimit) {
G4double x2 = 0.5*x*x;
y = x2*((1.0 - 1.3333333*x + 3*x2) - fb*x*(0.6666667 - x));
} else {
G4double x1= x/(1 + x);
G4double xlog = G4Log(1.0 + x);
y = xlog - x1 - fb*(x + x1 - 2*xlog);
}
if(y < 0.0) {
++nwarnings;
if(nwarnings < nwarnlimit) {
G4cout << "G4WentzelOKandVIxSection::ComputeTransportCrossSectionPerAtom"
<< " scattering on nucleus <0"
<< G4endl;
G4cout << "y= " << y
<< " e(MeV)= " << tkin << " Z= " << targetZ << " "
<< particle->GetParticleName() << G4endl;
G4cout << " formfactA= " << formfactA << " screenZ= " << screenZ
<< " x= " << x <<G4endl;
}
y = 0.0;
}
xSection += y*targetZ;
}
xSection *= kinFactor;
/*
G4cout << "Z= " << targetZ << " XStot= " << xSection/barn
<< " screenZ= " << screenZ << " formF= " << formfactA
<< " for " << particle->GetParticleName()
<< " m= " << mass << " 1/v= " << sqrt(invbeta2)
<< " p= " << sqrt(mom2)
<< " x= " << x << G4endl;
*/
return xSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ThreeVector&
G4WentzelOKandVIxSection::SampleSingleScattering(G4double cosTMin,
G4double cosTMax,
G4double elecRatio)
{
temp.set(0.0,0.0,1.0);
CLHEP::HepRandomEngine* rndmEngineMod = G4Random::getTheEngine();
G4double formf = formfactA;
G4double cost1 = cosTMin;
G4double cost2 = cosTMax;
if(elecRatio > 0.0) {
if(rndmEngineMod->flat() <= elecRatio) {
formf = 0.0;
cost1 = std::max(cost1,cosTetMaxElec);
cost2 = std::max(cost2,cosTetMaxElec);
}
}
if(cost1 > cost2) {
G4double w1 = 1. - cost1;
G4double w2 = 1. - cost2;
G4double w3 = rndmEngineMod->flat()*(w2 - w1);
G4double z1 = ((w2 - w3)*screenZ + w1*w2)/(screenZ + w1 + w3);
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/CLHEP::MeV;
G4double x = std::sqrt(2.*mom2*z1)*ccoef*2.;
fm = FlatFormfactor(x);
fm *= FlatFormfactor(x*0.6*fG4pow->A13(fNistManager->GetAtomicMassAmu(targetZ)));
}
// G4cout << " fm=" << fm << " " << fMottXSection << G4endl;
G4double grej;
if(nullptr != fMottXSection) {
fMottXSection->SetupKinematic(tkin, targetZ);
grej = fMottXSection->RatioMottRutherfordCosT(std::sqrt(z1))*fm*fm;
} else {
grej = (1. - z1*factB + factB1*targetZ*sqrt(z1*factB)*(2. - z1))
*fm*fm/(1.0 + z1*factD);
}
if(fMottFactor*rndmEngineMod->flat() <= grej ) {
// exclude "false" scattering due to formfactor and spin effect
G4double cost = 1.0 - z1;
if(cost > 1.0) { cost = 1.0; }
else if(cost < -1.0) { cost =-1.0; }
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
//G4cout << "sint= " << sint << G4endl;
G4double phi = twopi*rndmEngineMod->flat();
temp.set(sint*cos(phi),sint*sin(phi),cost);
}
}
return temp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
G4WentzelOKandVIxSection::ComputeMaxElectronScattering(G4double cutEnergy)
{
if(mass > MeV) {
G4double ratio = electron_mass_c2/mass;
G4double tau = tkin/mass;
G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
(1.0 + 2.0*ratio*(tau + 1.0) + ratio*ratio);
cosTetMaxElec = 1.0 - std::min(cutEnergy, tmax)*electron_mass_c2/mom2;
} else {
G4double tmax = (particle == theElectron) ? 0.5*tkin : tkin;
G4double t = std::min(cutEnergy, tmax);
G4double mom21 = t*(t + 2.0*electron_mass_c2);
G4double t1 = tkin - t;
//G4cout <<"tkin=" <<tkin<<" tmax= "<<tmax<<" t= "
//<<t<< " t1= "<<t1<<" cut= "<<ecut<<G4endl;
if(t1 > 0.0) {
G4double mom22 = t1*(t1 + 2.0*mass);
G4double ctm = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
if(ctm < 1.0) { cosTetMaxElec = ctm; }
if(particle == theElectron && cosTetMaxElec < 0.0) {
cosTetMaxElec = 0.0;
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
G4WentzelOKandVIxSection::ComputeSecondTransportMoment(G4double /*CosThetaMax*/)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......