Geant4-11
G4MuPairProductionModel.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: G4MuPairProductionModel
33//
34// Author: Vladimir Ivanchenko on base of Laszlo Urban code
35//
36// Creation date: 24.06.2002
37//
38// Modifications:
39//
40// 04-12-02 Change G4DynamicParticle constructor in PostStep (V.Ivanchenko)
41// 23-12-02 Change interface in order to move to cut per region (V.Ivanchenko)
42// 24-01-03 Fix for compounds (V.Ivanchenko)
43// 27-01-03 Make models region aware (V.Ivanchenko)
44// 13-02-03 Add model (V.Ivanchenko)
45// 06-06-03 Fix in cross section calculation for high energy (V.Ivanchenko)
46// 20-10-03 2*xi in ComputeDDMicroscopicCrossSection (R.Kokoulin)
47// 8 integration points in ComputeDMicroscopicCrossSection
48// 12-01-04 Take min cut of e- and e+ not its sum (V.Ivanchenko)
49// 10-02-04 Update parameterisation using R.Kokoulin model (V.Ivanchenko)
50// 28-04-04 For complex materials repeat calculation of max energy for each
51// material (V.Ivanchenko)
52// 01-11-04 Fix bug inside ComputeDMicroscopicCrossSection (R.Kokoulin)
53// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
54// 03-08-05 Add SetParticle method (V.Ivantchenko)
55// 23-10-05 Add protection in sampling of e+e- pair energy needed for
56// low cuts (V.Ivantchenko)
57// 13-02-06 Add ComputeCrossSectionPerAtom (mma)
58// 24-04-07 Add protection in SelectRandomAtom method (V.Ivantchenko)
59// 12-05-06 Updated sampling (use cut) in SelectRandomAtom (A.Bogdanov)
60// 11-10-07 Add ignoreCut flag (V.Ivanchenko)
61
62//
63// Class Description:
64//
65//
66// -------------------------------------------------------------------
67//
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
73#include "G4SystemOfUnits.hh"
74#include "G4EmParameters.hh"
75#include "G4Electron.hh"
76#include "G4Positron.hh"
77#include "G4MuonMinus.hh"
78#include "G4MuonPlus.hh"
79#include "Randomize.hh"
80#include "G4Material.hh"
81#include "G4Element.hh"
82#include "G4ElementVector.hh"
85#include "G4ModifiedMephi.hh"
86#include "G4Log.hh"
87#include "G4Exp.hh"
88#include <iostream>
89#include <fstream>
90
91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92
93// static members
94//
95static const G4double ak1 = 6.9;
96static const G4double ak2 = 1.0;
97static const G4int nzdat = 5;
98static const G4int zdat[5] = {1, 4, 13, 29, 92};
99
100static const G4double xgi[] =
101{ 0.0198550717512320, 0.1016667612931865, 0.2372337950418355, 0.4082826787521750,
102 0.5917173212478250, 0.7627662049581645, 0.8983332387068135, 0.9801449282487680 };
103
104static const G4double wgi[] =
105{ 0.0506142681451880, 0.1111905172266870, 0.1568533229389435, 0.1813418916891810,
106 0.1813418916891810, 0.1568533229389435, 0.1111905172266870, 0.0506142681451880 };
107
108//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109
110using namespace std;
111
113 const G4String& nam)
114 : G4VEmModel(nam),
117 4./(3.*CLHEP::pi)),
118 sqrte(sqrt(G4Exp(1.))),
119 minPairEnergy(4.*CLHEP::electron_mass_c2),
120 lowestKinEnergy(1.0*CLHEP::GeV)
121{
123
126
127 if(nullptr != p) {
128 SetParticle(p);
130 }
132 emax = 10.*TeV;
134}
135
136//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137
139{}
140
141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
142
145 G4double cut)
146{
147 return std::max(lowestKinEnergy,cut);
148}
149
150//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151
153 const G4DataVector& cuts)
154{
155 SetParticle(p);
156
157 if(nullptr == fParticleChange) {
159 }
160
161 // for low-energy application this process should not work
162 if(lowestKinEnergy >= HighEnergyLimit()) { return; }
163
164 // define scale of internal table for each thread only once
165 if(0 == nbine) {
168 nbine = size_t(nYBinPerDecade*std::log10(emax/emin));
169 if(nbine < 3) { nbine = 3; }
170
172 dy = -ymin/G4double(nbiny);
173 }
174
175 if(IsMaster() && p == particle) {
176 if(nullptr == fElementData) {
179 if(dataFile) { dataFile = RetrieveTables(); }
180 if(!dataFile) { MakeSamplingTables(); }
181 if(fTableToFile) { StoreTables(); }
182 }
184 }
185}
186
187//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
188
190 G4VEmModel* masterModel)
191{
194 fElementData = masterModel->GetElementData();
195 }
196}
197
198//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199
201 const G4Material* material,
203 G4double kineticEnergy,
204 G4double cutEnergy)
205{
206 G4double dedx = 0.0;
207 if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy)
208 { return dedx; }
209
210 const G4ElementVector* theElementVector = material->GetElementVector();
211 const G4double* theAtomicNumDensityVector =
212 material->GetAtomicNumDensityVector();
213
214 // loop for elements in the material
215 for (size_t i=0; i<material->GetNumberOfElements(); ++i) {
216 G4double Z = (*theElementVector)[i]->GetZ();
217 G4double tmax = MaxSecondaryEnergyForElement(kineticEnergy, Z);
218 G4double loss = ComputMuPairLoss(Z, kineticEnergy, cutEnergy, tmax);
219 dedx += loss*theAtomicNumDensityVector[i];
220 }
221 dedx = std::max(dedx, 0.0);
222 return dedx;
223}
224
225//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
226
228 G4double tkin,
229 G4double cutEnergy,
230 G4double tmax)
231{
232 G4double loss = 0.0;
233
234 G4double cut = std::min(cutEnergy,tmax);
235 if(cut <= minPairEnergy) { return loss; }
236
237 // calculate the rectricted loss
238 // numerical integration in log(PairEnergy)
240 G4double bbb = G4Log(cut);
241
242 G4int kkk = (G4int)((bbb-aaa)/ak1+ak2);
243 if (kkk > 8) { kkk = 8; }
244 else if (kkk < 1) { kkk = 1; }
245
246 G4double hhh = (bbb-aaa)/(G4double)kkk;
247 G4double x = aaa;
248
249 for (G4int l=0 ; l<kkk; ++l) {
250 for (G4int ll=0; ll<8; ++ll)
251 {
252 G4double ep = G4Exp(x+xgi[ll]*hhh);
253 loss += wgi[ll]*ep*ep*ComputeDMicroscopicCrossSection(tkin, Z, ep);
254 }
255 x += hhh;
256 }
257 loss *= hhh;
258 loss = std::max(loss, 0.0);
259 return loss;
260}
261
262//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
263
265 G4double tkin,
266 G4double Z,
267 G4double cutEnergy)
268{
269 G4double cross = 0.;
271 G4double cut = std::max(cutEnergy, minPairEnergy);
272 if (tmax <= cut) { return cross; }
273
274 G4double aaa = G4Log(cut);
275 G4double bbb = G4Log(tmax);
276 G4int kkk = (G4int)((bbb-aaa)/ak1 + ak2);
277 if(kkk > 8) { kkk = 8; }
278 else if (kkk < 1) { kkk = 1; }
279
280 G4double hhh = (bbb-aaa)/G4double(kkk);
281 G4double x = aaa;
282
283 for(G4int l=0; l<kkk; ++l)
284 {
285 for(G4int i=0; i<8; ++i)
286 {
287 G4double ep = G4Exp(x + xgi[i]*hhh);
288 cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
289 }
290 x += hhh;
291 }
292
293 cross *= hhh;
294 cross = std::max(cross, 0.0);
295 return cross;
296}
297
298//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
299
301 G4double tkin,
302 G4double Z,
303 G4double pairEnergy)
304// Calculates the differential (D) microscopic cross section
305// using the cross section formula of R.P. Kokoulin (18/01/98)
306// Code modified by R.P. Kokoulin, V.N. Ivanchenko (27/01/04)
307{
308 static const G4double bbbtf= 183. ;
309 static const G4double bbbh = 202.4 ;
310 static const G4double g1tf = 1.95e-5 ;
311 static const G4double g2tf = 5.3e-5 ;
312 static const G4double g1h = 4.4e-5 ;
313 static const G4double g2h = 4.8e-5 ;
314
315 if (pairEnergy <= 4.0 * electron_mass_c2)
316 return 0.0;
317
318 G4double totalEnergy = tkin + particleMass;
319 G4double residEnergy = totalEnergy - pairEnergy;
320
321 if (residEnergy <= 0.75*sqrte*z13*particleMass)
322 return 0.0;
323
324 G4double a0 = 1.0 / (totalEnergy * residEnergy);
325 G4double alf = 4.0 * electron_mass_c2 / pairEnergy;
326 G4double rt = sqrt(1.0 - alf);
327 G4double delta = 6.0 * particleMass * particleMass * a0;
328 G4double tmnexp = alf/(1.0 + rt) + delta*rt;
329
330 if(tmnexp >= 1.0) { return 0.0; }
331
332 G4double tmn = G4Log(tmnexp);
333
335 G4double massratio2 = massratio*massratio;
336 G4double inv_massratio2 = 1.0 / massratio2;
337
338 // zeta calculation
339 G4double bbb,g1,g2;
340 if( Z < 1.5 ) { bbb = bbbh ; g1 = g1h ; g2 = g2h ; }
341 else { bbb = bbbtf; g1 = g1tf; g2 = g2tf; }
342
343 G4double zeta = 0.0;
344 G4double z1exp = totalEnergy / (particleMass + g1*z23*totalEnergy);
345
346 // 35.221047195922 is the root of zeta1(x) = 0.073 * log(x) - 0.26, so the
347 // condition below is the same as zeta1 > 0.0, but without calling log(x)
348 if (z1exp > 35.221047195922)
349 {
350 G4double z2exp = totalEnergy / (particleMass + g2*z13*totalEnergy);
351 zeta = (0.073 * G4Log(z1exp) - 0.26) / (0.058 * G4Log(z2exp) - 0.14);
352 }
353
354 G4double z2 = Z*(Z+zeta);
355 G4double screen0 = 2.*electron_mass_c2*sqrte*bbb/(z13*pairEnergy);
356 G4double beta = 0.5*pairEnergy*pairEnergy*a0;
357 G4double xi0 = 0.5*massratio2*beta;
358
359 // Gaussian integration in ln(1-ro) ( with 8 points)
360 G4double rho[8];
361 G4double rho2[8];
362 G4double xi[8];
363 G4double xi1[8];
364 G4double xii[8];
365
366 for (G4int i = 0; i < 8; ++i)
367 {
368 rho[i] = G4Exp(tmn*xgi[i]) - 1.0; // rho = -asymmetry
369 rho2[i] = rho[i] * rho[i];
370 xi[i] = xi0*(1.0-rho2[i]);
371 xi1[i] = 1.0 + xi[i];
372 xii[i] = 1.0 / xi[i];
373 }
374
375 G4double ye1[8];
376 G4double ym1[8];
377
378 G4double b40 = 4.0 * beta;
379 G4double b62 = 6.0 * beta + 2.0;
380
381 for (G4int i = 0; i < 8; ++i)
382 {
383 G4double yeu = (b40 + 5.0) + (b40 - 1.0) * rho2[i];
384 G4double yed = b62 * G4Log(3.0 + xii[i]) + (2.0 * beta - 1.0) * rho2[i] - b40;
385
386 G4double ymu = b62 * (1.0 + rho2[i]) + 6.0;
387 G4double ymd = (b40 + 3.0) * (1.0 + rho2[i]) * G4Log(3.0 + xi[i]) + 2.0 - 3.0 * rho2[i];
388
389 ye1[i] = 1.0 + yeu / yed;
390 ym1[i] = 1.0 + ymu / ymd;
391 }
392
393 G4double be[8];
394 G4double bm[8];
395
396 for(G4int i = 0; i < 8; ++i)
397 {
398 if(xi[i] <= 1000.0) {
399 be[i] = ((2.0 + rho2[i]) * (1.0 + beta) + xi[i] * (3.0 + rho2[i])) *
400 G4Log(1.0 + xii[i]) + (1.0 - rho2[i] - beta) / xi1[i] - (3.0 + rho2[i]);
401 } else {
402 be[i] = 0.5 * (3.0 - rho2[i] + 2.0 * beta * (1.0 + rho2[i])) * xii[i];
403 }
404
405 if(xi[i] >= 0.001) {
406 G4double a10 = (1.0 + 2.0 * beta) * (1.0 - rho2[i]);
407 bm[i] = ((1.0 + rho2[i]) * (1.0 + 1.5 * beta) - a10 * xii[i]) * G4Log(xi1[i]) +
408 xi[i] * (1.0 - rho2[i] - beta) / xi1[i] + a10;
409 } else {
410 bm[i] = 0.5 * (5.0 - rho2[i] + beta * (3.0 + rho2[i])) * xi[i];
411 }
412 }
413
414 G4double sum = 0.0;
415
416 for (G4int i = 0; i < 8; ++i)
417 {
418 G4double screen = screen0*xi1[i]/(1.0-rho2[i]) ;
419 G4double ale = G4Log(bbb/z13*sqrt(xi1[i]*ye1[i])/(1.+screen*ye1[i])) ;
420 G4double cre = 0.5*G4Log(1.+2.25*z23*xi1[i]*ye1[i]*inv_massratio2) ;
421
422 G4double fe = (ale-cre)*be[i];
423 fe *= (fe > 0.0);
424
425 G4double alm_crm = G4Log(bbb*massratio/(1.5*z23*(1.+screen*ym1[i])));
426 G4double fm = alm_crm*bm[i];
427 fm *= (fm > 0.0) * inv_massratio2;
428
429 sum += wgi[i]*(1.0 + rho[i])*(fe+fm);
430 }
431
432 return -tmn*sum*factorForCross*z2*residEnergy/(totalEnergy*pairEnergy);
433}
434
435//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
436
439 G4double kineticEnergy,
441 G4double cutEnergy,
442 G4double maxEnergy)
443{
444 G4double cross = 0.0;
445 if (kineticEnergy <= lowestKinEnergy) { return cross; }
446
447 G4double maxPairEnergy = MaxSecondaryEnergyForElement(kineticEnergy, Z);
448 G4double tmax = std::min(maxEnergy, maxPairEnergy);
449 G4double cut = std::max(cutEnergy, minPairEnergy);
450 if (cut >= tmax) { return cross; }
451
452 cross = ComputeMicroscopicCrossSection(kineticEnergy, Z, cut);
453 if(tmax < kineticEnergy) {
454 cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
455 }
456 return cross;
457}
458
459//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
460
462{
464
465 for (G4int iz=0; iz<nzdat; ++iz) {
466
467 G4double Z = zdat[iz];
469 G4double kinEnergy = emin;
470
471 for (size_t it=0; it<=nbine; ++it) {
472
473 pv->PutY(it, G4Log(kinEnergy/CLHEP::MeV));
474 G4double maxPairEnergy = MaxSecondaryEnergyForElement(kinEnergy, Z);
475 /*
476 G4cout << "it= " << it << " E= " << kinEnergy
477 << " " << particle->GetParticleName()
478 << " maxE= " << maxPairEnergy << " minE= " << minPairEnergy
479 << " ymin= " << ymin << G4endl;
480 */
481 G4double coef = G4Log(minPairEnergy/kinEnergy)/ymin;
482 G4double ymax = G4Log(maxPairEnergy/kinEnergy)/coef;
483 G4double fac = (ymax - ymin)/dy;
484 size_t imax = (size_t)fac;
485 fac -= (G4double)imax;
486
487 G4double xSec = 0.0;
488 G4double x = ymin;
489 /*
490 G4cout << "Z= " << currentZ << " z13= " << z13
491 << " mE= " << maxPairEnergy << " ymin= " << ymin
492 << " dy= " << dy << " c= " << coef << G4endl;
493 */
494 // start from zero
495 pv->PutValue(0, it, 0.0);
496 if(0 == it) { pv->PutX(nbiny, 0.0); }
497
498 for (size_t i=0; i<nbiny; ++i) {
499
500 if(0 == it) { pv->PutX(i, x); }
501
502 if(i < imax) {
503 G4double ep = kinEnergy*G4Exp(coef*(x + dy*0.5));
504
505 // not multiplied by interval, because table
506 // will be used only for sampling
507 //G4cout << "i= " << i << " x= " << x << "E= " << kinEnergy
508 // << " Egamma= " << ep << G4endl;
509 xSec += ep*ComputeDMicroscopicCrossSection(kinEnergy, Z, ep);
510
511 // last bin before the kinematic limit
512 } else if(i == imax) {
513 G4double ep = kinEnergy*G4Exp(coef*(x + fac*dy*0.5));
514 xSec += ep*fac*ComputeDMicroscopicCrossSection(kinEnergy, Z, ep);
515 }
516 pv->PutValue(i + 1, it, xSec);
517 x += dy;
518 }
519 kinEnergy *= factore;
520
521 // to avoid precision lost
522 if(it+1 == nbine) { kinEnergy = emax; }
523 }
525 }
526}
527
528//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
529
531 std::vector<G4DynamicParticle*>* vdp,
532 const G4MaterialCutsCouple* couple,
533 const G4DynamicParticle* aDynamicParticle,
534 G4double tmin,
535 G4double tmax)
536{
537 G4double kinEnergy = aDynamicParticle->GetKineticEnergy();
538 //G4cout << "------- G4MuPairProductionModel::SampleSecondaries E(MeV)= "
539 // << kinEnergy << " "
540 // << aDynamicParticle->GetDefinition()->GetParticleName() << G4endl;
541 G4double totalEnergy = kinEnergy + particleMass;
542 G4double totalMomentum =
543 sqrt(kinEnergy*(kinEnergy + 2.0*particleMass));
544
545 G4ThreeVector partDirection = aDynamicParticle->GetMomentumDirection();
546
547 // select randomly one element constituing the material
548 const G4Element* anElement = SelectRandomAtom(couple,particle,kinEnergy);
549
550 // define interval of energy transfer
551 G4double maxPairEnergy = MaxSecondaryEnergyForElement(kinEnergy,
552 anElement->GetZ());
553 G4double maxEnergy = std::min(tmax, maxPairEnergy);
554 G4double minEnergy = std::max(tmin, minPairEnergy);
555
556 if(minEnergy >= maxEnergy) { return; }
557 //G4cout << "emin= " << minEnergy << " emax= " << maxEnergy
558 // << " minPair= " << minPairEnergy << " maxpair= " << maxPairEnergy
559 // << " ymin= " << ymin << " dy= " << dy << G4endl;
560
561 G4double coeff = G4Log(minPairEnergy/kinEnergy)/ymin;
562
563 // compute limits
564 G4double yymin = G4Log(minEnergy/kinEnergy)/coeff;
565 G4double yymax = G4Log(maxEnergy/kinEnergy)/coeff;
566
567 //G4cout << "yymin= " << yymin << " yymax= " << yymax << G4endl;
568
569 // units should not be used, bacause table was built without
570 G4double logTkin = G4Log(kinEnergy/CLHEP::MeV);
571
572 // sample e-e+ energy, pair energy first
573
574 // select sample table via Z
575 G4int iz1(0), iz2(0);
576 for(G4int iz=0; iz<nzdat; ++iz) {
577 if(currentZ == zdat[iz]) {
578 iz1 = iz2 = currentZ;
579 break;
580 } else if(currentZ < zdat[iz]) {
581 iz2 = zdat[iz];
582 if(iz > 0) { iz1 = zdat[iz-1]; }
583 else { iz1 = iz2; }
584 break;
585 }
586 }
587 if(0 == iz1) { iz1 = iz2 = zdat[nzdat-1]; }
588
589 G4double pairEnergy = 0.0;
590 G4int count = 0;
591 //G4cout << "start loop Z1= " << iz1 << " Z2= " << iz2 << G4endl;
592 do {
593 ++count;
594 // sampling using only one random number
595 G4double rand = G4UniformRand();
596
597 G4double x = FindScaledEnergy(iz1, rand, logTkin, yymin, yymax);
598 if(iz1 != iz2) {
599 G4double x2 = FindScaledEnergy(iz2, rand, logTkin, yymin, yymax);
600 G4double lz1= nist->GetLOGZ(iz1);
601 G4double lz2= nist->GetLOGZ(iz2);
602 //G4cout << count << ". x= " << x << " x2= " << x2
603 // << " Z1= " << iz1 << " Z2= " << iz2 << G4endl;
604 x += (x2 - x)*(lnZ - lz1)/(lz2 - lz1);
605 }
606 //G4cout << "x= " << x << " coeff= " << coeff << G4endl;
607 pairEnergy = kinEnergy*G4Exp(x*coeff);
608
609 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
610 } while((pairEnergy < minEnergy || pairEnergy > maxEnergy) && 10 > count);
611
612 //G4cout << "## pairEnergy(GeV)= " << pairEnergy/GeV
613 // << " Etot(GeV)= " << totalEnergy/GeV << G4endl;
614
615 // sample r=(E+-E-)/pairEnergy ( uniformly .....)
616 G4double rmax =
617 (1.-6.*particleMass*particleMass/(totalEnergy*(totalEnergy-pairEnergy)))
618 *sqrt(1.-minPairEnergy/pairEnergy);
619 G4double r = rmax * (-1.+2.*G4UniformRand()) ;
620
621 // compute energies from pairEnergy,r
622 G4double eEnergy = (1.-r)*pairEnergy*0.5;
623 G4double pEnergy = pairEnergy - eEnergy;
624
625 // Sample angles
626 G4ThreeVector eDirection, pDirection;
627 //
628 GetAngularDistribution()->SamplePairDirections(aDynamicParticle,
629 eEnergy, pEnergy,
630 eDirection, pDirection);
631 // create G4DynamicParticle object for e+e-
632 eEnergy = std::max(eEnergy - CLHEP::electron_mass_c2, 0.0);
633 pEnergy = std::max(pEnergy - CLHEP::electron_mass_c2, 0.0);
634 G4DynamicParticle* aParticle1 =
635 new G4DynamicParticle(theElectron,eDirection,eEnergy);
636 G4DynamicParticle* aParticle2 =
637 new G4DynamicParticle(thePositron,pDirection,pEnergy);
638 // Fill output vector
639 vdp->push_back(aParticle1);
640 vdp->push_back(aParticle2);
641
642 // primary change
643 kinEnergy -= pairEnergy;
644 partDirection *= totalMomentum;
645 partDirection -= (aParticle1->GetMomentum() + aParticle2->GetMomentum());
646 partDirection = partDirection.unit();
647
648 // if energy transfer is higher than threshold (very high by default)
649 // then stop tracking the primary particle and create a new secondary
650 if (pairEnergy > SecondaryThreshold()) {
653 G4DynamicParticle* newdp =
654 new G4DynamicParticle(particle, partDirection, kinEnergy);
655 vdp->push_back(newdp);
656 } else { // continue tracking the primary e-/e+ otherwise
659 }
660 //G4cout << "-- G4MuPairProductionModel::SampleSecondaries done" << G4endl;
661}
662
663//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
664
666{
668 ed << "G4ElementData is not properly initialized Z= " << Z
669 << " Ekin(MeV)= " << G4Exp(logTkin)
670 << " IsMasterThread= " << IsMaster()
671 << " Model " << GetName();
672 G4Exception("G4MuPairProductionModel::()","em0033",FatalException,
673 ed,"");
674}
675
676//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
677
679{
680 for (G4int iz=0; iz<nzdat; ++iz) {
681 G4int Z = zdat[iz];
683 if(!pv) {
684 DataCorrupted(Z, 1.0);
685 return;
686 }
687 std::ostringstream ss;
688 ss << "mupair/" << particle->GetParticleName() << Z << ".dat";
689 std::ofstream outfile(ss.str());
690 pv->Store(outfile);
691 }
692}
693
694//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
695
697{
698 char* path = std::getenv("G4LEDATA");
699 G4String dir("");
700 if (path) {
701 std::ostringstream ost;
702 ost << path << "/mupair/";
703 dir = ost.str();
704 } else {
705 dir = "./mupair/";
706 }
707
708 for (G4int iz=0; iz<nzdat; ++iz) {
709 G4double Z = zdat[iz];
711 std::ostringstream ss;
712 ss << dir << particle->GetParticleName() << Z << ".dat";
713 std::ifstream infile(ss.str(), std::ios::in);
714 if(!pv->Retrieve(infile)) {
715 delete pv;
716 return false;
717 }
719 }
720 return true;
721}
722
723//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static const G4int imax
std::vector< const G4Element * > G4ElementVector
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
static const G4double sqrte
const G4double a0
G4fissionEvent * fe
G4double G4Log(G4double x)
Definition: G4Log.hh:226
static const G4double ak2
static const G4double xgi[]
static const G4int zdat[5]
static const G4double wgi[]
static const G4int nzdat
static const G4double ak1
static const G4double fac
static constexpr double GeV
Definition: G4SIunits.hh:203
static constexpr double pi
Definition: G4SIunits.hh:55
static constexpr double TeV
Definition: G4SIunits.hh:204
@ fStopAndKill
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4ThreeVector GetMomentum() const
static G4Electron * Electron()
Definition: G4Electron.cc:93
void InitialiseForElement(G4int Z, G4PhysicsVector *v)
G4Physics2DVector * GetElement2DData(G4int Z)
G4double GetZ() const
Definition: G4Element.hh:131
static G4EmParameters * Instance()
G4bool RetrieveMuDataFromFile() const
G4double ComputeMicroscopicCrossSection(G4double tkin, G4double Z, G4double cut)
void SetParticle(const G4ParticleDefinition *)
G4ParticleDefinition * thePositron
void DataCorrupted(G4int Z, G4double logTkin) const
G4double ComputMuPairLoss(G4double Z, G4double tkin, G4double cut, G4double tmax)
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kineticEnergy, G4double Z, G4double A, G4double cutEnergy, G4double maxEnergy) override
G4MuPairProductionModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="muPairProd")
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy) override
void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel) override
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double FindScaledEnergy(G4int Z, G4double rand, G4double logTkin, G4double yymin, G4double yymax)
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin, G4double Z, G4double pairEnergy)
virtual ~G4MuPairProductionModel() override
const G4ParticleDefinition * particle
G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double) override
G4ParticleChangeForLoss * fParticleChange
G4double MaxSecondaryEnergyForElement(G4double kineticEnergy, G4double Z)
G4ParticleDefinition * theElectron
G4double GetLOGZ(G4int Z) const
static G4NistManager * Instance()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void SetProposedMomentumDirection(const G4ThreeVector &dir)
const G4String & GetParticleName() const
G4bool Retrieve(std::ifstream &fIn)
void PutY(std::size_t idy, G4double value)
void Store(std::ofstream &fOut) const
void PutValue(std::size_t idx, std::size_t idy, G4double value)
void PutX(std::size_t idx, G4double value)
static G4Positron * Positron()
Definition: G4Positron.cc:93
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 * > *)
Definition: G4VEmModel.hh:852
G4VEmAngularDistribution * GetAngularDistribution()
Definition: G4VEmModel.hh:621
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:662
std::vector< G4EmElementSelector * > * GetElementSelectors()
Definition: G4VEmModel.hh:844
G4bool IsMaster() const
Definition: G4VEmModel.hh:746
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:655
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.hh:580
G4ElementData * fElementData
Definition: G4VEmModel.hh:424
void SetAngularDistribution(G4VEmAngularDistribution *)
Definition: G4VEmModel.hh:628
const G4String & GetName() const
Definition: G4VEmModel.hh:837
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
Definition: G4VEmModel.cc:138
G4double SecondaryThreshold() const
Definition: G4VEmModel.hh:690
G4ElementData * GetElementData()
Definition: G4VEmModel.hh:863
G4ParticleChangeForLoss * GetParticleChangeForLoss()
Definition: G4VEmModel.cc:108
void ProposeTrackStatus(G4TrackStatus status)
Definition: DoubConv.h:17
static constexpr double electron_mass_c2
static constexpr double MeV
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
string material
Definition: eplot.py:19
float electron_mass_c2
Definition: hepunit.py:273
int classic_electr_radius
Definition: hepunit.py:287
int fine_structure_const
Definition: hepunit.py:286