Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BetheHeitlerModel.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//
27// -------------------------------------------------------------------
28//
29// GEANT4 Class file
30//
31//
32// File name: G4BetheHeitlerModel
33//
34// Author: Vladimir Ivanchenko on base of Michel Maire code
35//
36// Creation date: 15.03.2005
37//
38// Modifications by Vladimir Ivanchenko, Michel Maire, Mihaly Novak
39//
40// Class Description:
41//
42// -------------------------------------------------------------------
43//
44
47#include "G4SystemOfUnits.hh"
48#include "G4Electron.hh"
49#include "G4Positron.hh"
50#include "G4Gamma.hh"
51#include "Randomize.hh"
53#include "G4Pow.hh"
54#include "G4Exp.hh"
55#include "G4ModifiedTsai.hh"
56#include "G4AutoLock.hh"
57
59std::vector<G4BetheHeitlerModel::ElementData*> G4BetheHeitlerModel::gElementData;
60
61namespace
62{
63 G4Mutex theBetheHMutex = G4MUTEX_INITIALIZER;
64}
65
67 const G4String& nam)
68: G4VEmModel(nam),
69 fG4Calc(G4Pow::GetInstance()), fTheGamma(G4Gamma::Gamma()),
70 fTheElectron(G4Electron::Electron()), fThePositron(G4Positron::Positron()),
71 fParticleChange(nullptr)
72{
74}
75
77{
78 if (isFirstInstance) {
79 for (auto const & ptr : gElementData) { delete ptr; }
80 gElementData.clear();
81 }
82}
83
85 const G4DataVector& cuts)
86{
88
89 if (isFirstInstance || gElementData.empty()) {
90 G4AutoLock l(&theBetheHMutex);
91 if (gElementData.empty()) {
92 isFirstInstance = true;
93 gElementData.resize(gMaxZet+1, nullptr);
94 }
95 // static data should be initialised only in the one instance
97 l.unlock();
98 }
99 // element selectors should be initialised in the master thread
100 if(IsMaster()) {
102 }
103}
104
110
111// Calculates the microscopic cross section in GEANT4 internal units.
112// A parametrized formula from L. Urban is used to estimate
113// the total cross section.
114// It gives a good description of the data from 1.5 MeV to 100 GeV.
115// below 1.5 MeV: sigma=sigma(1.5MeV)*(GammaEnergy-2electronmass)
116// *(GammaEnergy-2electronmass)
119 G4double gammaEnergy, G4double Z,
121{
122 G4double xSection = 0.0 ;
123 // short versions
124 static const G4double kMC2 = CLHEP::electron_mass_c2;
125 // zero cross section below the kinematical limit: Eg<2mc^2
126 if (Z < 0.9 || gammaEnergy <= 2.0*kMC2) { return xSection; }
127 //
128 static const G4double gammaEnergyLimit = 1.5*CLHEP::MeV;
129 // set coefficients a, b c
130 static const G4double a0 = 8.7842e+2*CLHEP::microbarn;
131 static const G4double a1 = -1.9625e+3*CLHEP::microbarn;
132 static const G4double a2 = 1.2949e+3*CLHEP::microbarn;
133 static const G4double a3 = -2.0028e+2*CLHEP::microbarn;
134 static const G4double a4 = 1.2575e+1*CLHEP::microbarn;
135 static const G4double a5 = -2.8333e-1*CLHEP::microbarn;
136
137 static const G4double b0 = -1.0342e+1*CLHEP::microbarn;
138 static const G4double b1 = 1.7692e+1*CLHEP::microbarn;
139 static const G4double b2 = -8.2381 *CLHEP::microbarn;
140 static const G4double b3 = 1.3063 *CLHEP::microbarn;
141 static const G4double b4 = -9.0815e-2*CLHEP::microbarn;
142 static const G4double b5 = 2.3586e-3*CLHEP::microbarn;
143
144 static const G4double c0 = -4.5263e+2*CLHEP::microbarn;
145 static const G4double c1 = 1.1161e+3*CLHEP::microbarn;
146 static const G4double c2 = -8.6749e+2*CLHEP::microbarn;
147 static const G4double c3 = 2.1773e+2*CLHEP::microbarn;
148 static const G4double c4 = -2.0467e+1*CLHEP::microbarn;
149 static const G4double c5 = 6.5372e-1*CLHEP::microbarn;
150 // check low energy limit of the approximation (1.5 MeV)
151 G4double gammaEnergyOrg = gammaEnergy;
152 if (gammaEnergy < gammaEnergyLimit) { gammaEnergy = gammaEnergyLimit; }
153 // compute gamma energy variables
154 const G4double x = G4Log(gammaEnergy/kMC2);
155 const G4double x2 = x *x;
156 const G4double x3 = x2*x;
157 const G4double x4 = x3*x;
158 const G4double x5 = x4*x;
159 //
160 const G4double F1 = a0 + a1*x + a2*x2 + a3*x3 + a4*x4 + a5*x5;
161 const G4double F2 = b0 + b1*x + b2*x2 + b3*x3 + b4*x4 + b5*x5;
162 const G4double F3 = c0 + c1*x + c2*x2 + c3*x3 + c4*x4 + c5*x5;
163 // compute the approximated cross section
164 xSection = (Z + 1.)*(F1*Z + F2*Z*Z + F3);
165 // check if we are below the limit of the approximation and apply correction
166 if (gammaEnergyOrg < gammaEnergyLimit) {
167 const G4double dum = (gammaEnergyOrg-2.*kMC2)/(gammaEnergyLimit-2.*kMC2);
168 xSection *= dum*dum;
169 }
170 // make sure that the cross section is never negative
171 xSection = std::max(xSection, 0.);
172 return xSection;
173}
174
175// The secondaries e+e- energies are sampled using the Bethe - Heitler
176// cross sections with Coulomb correction.
177// A modified version of the random number techniques of Butcher & Messel
178// is used (Nuc Phys 20(1960),15).
179//
180// GEANT4 internal units.
181//
182// Note 1 : Effects due to the breakdown of the Born approximation at
183// low energy are ignored.
184// Note 2 : The differential cross section implicitly takes account of
185// pair creation in both nuclear and atomic electron fields.
186// However triplet prodution is not generated.
187void G4BetheHeitlerModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
188 const G4MaterialCutsCouple* couple,
189 const G4DynamicParticle* aDynamicGamma,
191{
192 // set some constant values
193 const G4double gammaEnergy = aDynamicGamma->GetKineticEnergy();
194 const G4double eps0 = CLHEP::electron_mass_c2/gammaEnergy;
195 //
196 // check kinematical limit: gamma energy(Eg) must be at least 2 e- rest mass
197 if (eps0 > 0.5) { return; }
198 //
199 // select target element of the material (probs. are based on partial x-secs)
200 const G4Element* anElement = SelectTargetAtom(couple, fTheGamma, gammaEnergy,
201 aDynamicGamma->GetLogKineticEnergy());
202
203 //
204 // get the random engine
205 CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
206 //
207 // 'eps' is the total energy transferred to one of the e-/e+ pair in initial
208 // gamma energy units Eg. Since the corresponding DCS is symmetric on eps=0.5,
209 // the kinematical limits for eps0=mc^2/Eg <= eps <= 0.5
210 // 1. 'eps' is sampled uniformly on the [eps0, 0.5] inteval if Eg<Egsmall
211 // 2. otherwise, on the [eps_min, 0.5] interval according to the DCS (case 2.)
212 G4double eps;
213 // case 1.
214 static const G4double Egsmall = 2.*CLHEP::MeV;
215 if (gammaEnergy < Egsmall) {
216 eps = eps0 + (0.5-eps0)*rndmEngine->flat();
217 } else {
218 // case 2.
219 // get the Coulomb factor for the target element (Z) and gamma energy (Eg)
220 // F(Z) = 8*ln(Z)/3 if Eg <= 50 [MeV] => no Coulomb correction
221 // F(Z) = 8*ln(Z)/3 + 8*fc(Z) if Eg > 50 [MeV] => fc(Z) is the Coulomb cor.
222 //
223 // The screening variable 'delta(eps)' = 136*Z^{-1/3}*eps0/[eps(1-eps)]
224 // Due to the Coulomb correction, the DCS can go below zero even at
225 // kinematicaly allowed eps > eps0 values. In order to exclude this eps
226 // range with negative DCS, the minimum eps value will be set to eps_min =
227 // max[eps0, epsp] with epsp is the solution of SF(delta(epsp)) - F(Z)/2 = 0
228 // with SF being the screening function (SF1=SF2 at high value of delta).
229 // The solution is epsp = 0.5 - 0.5*sqrt[ 1 - 4*136*Z^{-1/3}eps0/deltap]
230 // with deltap = Exp[(42.038-F(Z))/8.29]-0.958. So the limits are:
231 // - when eps=eps_max = 0.5 => delta_min = 136*Z^{-1/3}*eps0/4
232 // - epsp = 0.5 - 0.5*sqrt[ 1 - delta_min/deltap]
233 // - and eps_min = max[eps0, epsp]
234 static const G4double midEnergy = 50.*CLHEP::MeV;
235 const G4int iZet = std::min(gMaxZet, anElement->GetZasInt());
236 const G4double deltaFactor = 136.*eps0/anElement->GetIonisation()->GetZ3();
237 G4double deltaMax = gElementData[iZet]->fDeltaMaxLow;
238 G4double FZ = 8.*anElement->GetIonisation()->GetlogZ3();
239 if (gammaEnergy > midEnergy) {
240 FZ += 8.*(anElement->GetfCoulomb());
241 deltaMax = gElementData[iZet]->fDeltaMaxHigh;
242 }
243 const G4double deltaMin = 4.*deltaFactor;
244 //
245 // compute the limits of eps
246 const G4double epsp = 0.5 - 0.5*std::sqrt(1. - deltaMin/deltaMax) ;
247 const G4double epsMin = std::max(eps0,epsp);
248 const G4double epsRange = 0.5 - epsMin;
249 //
250 // sample the energy rate (eps) of the created electron (or positron)
252 ScreenFunction12(deltaMin, F10, F20);
253 F10 -= FZ;
254 F20 -= FZ;
255 const G4double NormF1 = std::max(F10 * epsRange * epsRange, 0.);
256 const G4double NormF2 = std::max(1.5 * F20 , 0.);
257 const G4double NormCond = NormF1/(NormF1 + NormF2);
258 // we will need 3 uniform random number for each trial of sampling
259 G4double rndmv[3];
260 G4double greject = 0.;
261 do {
262 rndmEngine->flatArray(3, rndmv);
263 if (NormCond > rndmv[0]) {
264 eps = 0.5 - epsRange * fG4Calc->A13(rndmv[1]);
265 const G4double delta = deltaFactor/(eps*(1.-eps));
266 greject = (ScreenFunction1(delta)-FZ)/F10;
267 } else {
268 eps = epsMin + epsRange*rndmv[1];
269 const G4double delta = deltaFactor/(eps*(1.-eps));
270 greject = (ScreenFunction2(delta)-FZ)/F20;
271 }
272 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
273 } while (greject < rndmv[2]);
274 } // end of eps sampling
275 //
276 // select charges randomly
277 G4double eTotEnergy, pTotEnergy;
278 if (rndmEngine->flat() > 0.5) {
279 eTotEnergy = (1.-eps)*gammaEnergy;
280 pTotEnergy = eps*gammaEnergy;
281 } else {
282 pTotEnergy = (1.-eps)*gammaEnergy;
283 eTotEnergy = eps*gammaEnergy;
284 }
285 //
286 // sample pair kinematics
287 const G4double eKinEnergy = std::max(0.,eTotEnergy - CLHEP::electron_mass_c2);
288 const G4double pKinEnergy = std::max(0.,pTotEnergy - CLHEP::electron_mass_c2);
289 //
290 G4ThreeVector eDirection, pDirection;
291 //
293 eKinEnergy, pKinEnergy,
294 eDirection, pDirection);
295 // create G4DynamicParticle object for the particle1
296 auto aParticle1= new G4DynamicParticle(fTheElectron,eDirection,eKinEnergy);
297 // create G4DynamicParticle object for the particle2
298 auto aParticle2= new G4DynamicParticle(fThePositron,pDirection,pKinEnergy);
299 // Fill output vector
300 fvect->push_back(aParticle1);
301 fvect->push_back(aParticle2);
302 // kill incident photon
305}
306
307// should be called only by the master and at initialisation
309{
310 // create for all elements that are in the detector
311 auto elemTable = G4Element::GetElementTable();
312 for (auto const & elem : *elemTable) {
313 const G4int iz = std::min(gMaxZet, elem->GetZasInt());
314 if (nullptr == gElementData[iz]) { // create it if doesn't exist yet
315 G4double FZLow = 8.*elem->GetIonisation()->GetlogZ3();
316 G4double FZHigh = FZLow + 8.*elem->GetfCoulomb();
317 auto elD = new ElementData();
318 elD->fDeltaMaxLow = G4Exp((42.038 - FZLow )/8.29) - 0.958;
319 elD->fDeltaMaxHigh = G4Exp((42.038 - FZHigh)/8.29) - 0.958;
320 gElementData[iz] = elD;
321 }
322 }
323}
324
#define F10
#define F20
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:180
const G4double a0
G4double G4Log(G4double x)
Definition G4Log.hh:227
#define elem(i, j)
#define G4MUTEX_INITIALIZER
std::mutex G4Mutex
@ fStopAndKill
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
virtual double flat()=0
virtual void flatArray(const int size, double *vect)=0
G4ParticleChangeForGamma * fParticleChange
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4BetheHeitlerModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="BetheHeitler")
const G4ParticleDefinition * fTheElectron
void ScreenFunction12(const G4double delta, G4double &f1, G4double &f2)
G4double ScreenFunction1(const G4double delta)
static const G4int gMaxZet
static std::vector< ElementData * > gElementData
const G4ParticleDefinition * fTheGamma
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cut=0., G4double emax=DBL_MAX) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
const G4ParticleDefinition * fThePositron
G4double ScreenFunction2(const G4double delta)
void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel) override
G4double GetLogKineticEnergy() const
G4double GetKineticEnergy() const
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389
G4double GetfCoulomb() const
Definition G4Element.hh:165
G4IonisParamElm * GetIonisation() const
Definition G4Element.hh:171
G4int GetZasInt() const
Definition G4Element.hh:120
G4double GetlogZ3() const
G4double GetZ3() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
Definition G4Pow.hh:49
G4double A13(G4double A) const
Definition G4Pow.cc:116
virtual void SamplePairDirections(const G4DynamicParticle *dp, G4double elecKinEnergy, G4double posiKinEnergy, G4ThreeVector &dirElectron, G4ThreeVector &dirPositron, G4int Z=0, const G4Material *mat=nullptr)
void SetElementSelectors(std::vector< G4EmElementSelector * > *)
G4VEmAngularDistribution * GetAngularDistribution()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
std::vector< G4EmElementSelector * > * GetElementSelectors()
G4bool IsMaster() const
void SetAngularDistribution(G4VEmAngularDistribution *)
const G4Element * SelectTargetAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double logKineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
void ProposeTrackStatus(G4TrackStatus status)