302{
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
319
320 if (verboseLevel > 3) {
321 G4cout <<
"G4LowEPComptonModel::SampleSecondaries() E(MeV)= "
324 }
325
326
328 return ;
329
330 G4double e0m = photonEnergy0 / electron_mass_c2 ;
332
333
337
338 G4double LowEPCepsilon0 = 1. / (1. + 2. * e0m);
339 G4double LowEPCepsilon0Sq = LowEPCepsilon0 * LowEPCepsilon0;
340 G4double alpha1 = -std::log(LowEPCepsilon0);
342
343 G4double wlPhoton = h_Planck*c_light/photonEnergy0;
344
345
351
352 if (verboseLevel > 3) {
353 G4cout <<
"Started loop to sample gamma energy" <<
G4endl;
354 }
355
356 do
357 {
359 {
361 LowEPCepsilonSq = LowEPCepsilon * LowEPCepsilon;
362 }
363 else
364 {
365 LowEPCepsilonSq = LowEPCepsilon0Sq + (1. - LowEPCepsilon0Sq) *
G4UniformRand();
366 LowEPCepsilon = std::sqrt(LowEPCepsilonSq);
367 }
368
369 oneCosT = (1. - LowEPCepsilon) / ( LowEPCepsilon * e0m);
370 sinT2 = oneCosT * (2. - oneCosT);
371 G4double x = std::sqrt(oneCosT/2.) / (wlPhoton/cm);
372 G4double scatteringFunction = ComputeScatteringFunction(x,
Z);
373 gReject = (1. - LowEPCepsilon * sinT2 / (1. + LowEPCepsilonSq)) * scatteringFunction;
374
376
378 G4double sinTheta = std::sqrt(sinT2);
380 G4double dirx = sinTheta * std::cos(phi);
381 G4double diry = sinTheta * std::sin(phi);
383
384
385
386
387
388
389
390 const G4double vel_c = c_light / (m/s);
391 const G4double momentum_au_to_nat = halfpi* hbar_Planck / Bohr_radius / (kg*m/s);
392 const G4double e_mass_kg = electron_mass_c2 / c_squared / kg ;
393
394 const G4int maxDopplerIterations = 1000;
396 G4double pEIncident = photonEnergy0 ;
401
410
411 if (verboseLevel > 3) {
412 G4cout <<
"Started loop to sample photon energy and electron direction" <<
G4endl;
413 }
414
415 do{
416
417
418
419 do
420 {
421 iteration++;
422
423
424
425
426
429
430
432
433
434 G4double ePSI = ePAU * momentum_au_to_nat;
435
436
437 u_temp = sqrt( ((ePSI*ePSI)*(vel_c*vel_c)) / ((e_mass_kg*e_mass_kg)*(vel_c*vel_c)+(ePSI*ePSI)) )/vel_c;
438
439
442
443
444
445 G4double eEIncident = electron_mass_c2 / sqrt( 1 - (u_temp*u_temp));
446 G4double systemE = eEIncident + pEIncident;
447 G4double gamma_temp = 1.0 / sqrt( 1 - (u_temp*u_temp));
448 G4double numerator = gamma_temp*electron_mass_c2*(1 - u_temp * std::cos(e_alpha));
449 G4double subdenom1 = u_temp*cosTheta*std::cos(e_alpha);
450 G4double subdenom2 = u_temp*sinTheta*std::sin(e_alpha)*std::cos(e_beta);
451 G4double denominator = (1.0 - cosTheta) + (gamma_temp*electron_mass_c2*(1 - subdenom1 - subdenom2) / pEIncident);
452 pERecoil = (numerator/denominator);
453 eERecoil = systemE - pERecoil;
454 CE_emission_flag = pEIncident - pERecoil;
455 } while ( (iteration <= maxDopplerIterations) && (CE_emission_flag < bindingE));
456
457
458
459
460
461
462
463
464
465 G4double a_temp = eERecoil / electron_mass_c2;
466 G4double u_p_temp = sqrt(1 - (1 / (a_temp*a_temp)));
467
468
469 G4double sinAlpha = std::sin(e_alpha);
470 G4double cosAlpha = std::cos(e_alpha);
471 G4double sinBeta = std::sin(e_beta);
472 G4double cosBeta = std::cos(e_beta);
473
474 G4double gamma = 1.0 / sqrt(1 - (u_temp*u_temp));
475 G4double gamma_p = 1.0 / sqrt(1 - (u_p_temp*u_p_temp));
476
477 G4double var_A = pERecoil*u_p_temp*sinTheta;
478 G4double var_B = u_p_temp* (pERecoil*cosTheta-pEIncident);
479 G4double var_C = (pERecoil-pEIncident) - ( (pERecoil*pEIncident) / (gamma_p*electron_mass_c2))*(1 - cosTheta);
480
481 G4double var_D1 = gamma*electron_mass_c2*pERecoil;
482 G4double var_D2 = (1 - (u_temp*cosTheta*cosAlpha) - (u_temp*sinTheta*cosBeta*sinAlpha));
483 G4double var_D3 = ((electron_mass_c2*electron_mass_c2)*(gamma*gamma_p - 1)) - (gamma_p*electron_mass_c2*pERecoil);
484 G4double var_D = var_D1*var_D2 + var_D3;
485
486 G4double var_E1 = ((gamma*gamma_p)*(electron_mass_c2*electron_mass_c2)*(u_temp*u_p_temp)*cosAlpha);
487 G4double var_E2 = gamma_p*electron_mass_c2*pERecoil*u_p_temp*cosTheta;
489
490 G4double var_F1 = ((gamma*gamma_p)*(electron_mass_c2*electron_mass_c2)*(u_temp*u_p_temp)*cosBeta*sinAlpha);
491 G4double var_F2 = (gamma_p*electron_mass_c2*pERecoil*u_p_temp*sinTheta);
493
494 G4double var_G = (gamma*gamma_p)*(electron_mass_c2*electron_mass_c2)*(u_temp*u_p_temp)*sinBeta*sinAlpha;
495
496
497
498 G4double var_W1 = (var_F*var_B - var_E*var_A)*(var_F*var_B - var_E*var_A);
499 G4double var_W2 = (var_G*var_G)*(var_A*var_A) + (var_G*var_G)*(var_B*var_B);
501
502 G4double var_Y = 2.0*(((var_A*var_D-var_F*var_C)*(var_F*var_B-var_E*var_A)) - ((var_G*var_G)*var_B*var_C));
503
504 G4double var_Z1 = (var_A*var_D - var_F*var_C)*(var_A*var_D - var_F*var_C);
505 G4double var_Z2 = (var_G*var_G)*(var_C*var_C) - (var_G*var_G)*(var_A*var_A);
510
511
512
514 G4double g4d_limit = std::pow(10.,-g4d_order);
515
516
517
518 if ((diff < 0.0) && (abs(diff / diff1) < g4d_limit) && (abs(diff / diff2) < g4d_limit) )
519 {
520 diff = 0.0;
521 }
522
523
524
525 G4double X_p = (-var_Y + sqrt (diff))/(2*var_W);
526 G4double X_m = (-var_Y - sqrt (diff))/(2*var_W);
527
528
529
530
531 if(X_p >1){X_p=1;} if(X_p<-1){X_p=-1;}
532 if(X_m >1){X_m=1;} if(X_m<-1){X_m=-1;}
533
534
536
538
539 if (sol_select < 0.5)
540 {
541 ThetaE = std::acos(X_p);
542 }
543 if (sol_select > 0.5)
544 {
545 ThetaE = std::acos(X_m);
546 }
547 cosThetaE = std::cos(ThetaE);
548 sinThetaE = std::sin(ThetaE);
549 G4double Theta = std::acos(cosTheta);
550
551
552 G4double iSinThetaE = std::sqrt(1+std::tan((pi/2.0)-ThetaE)*std::tan((pi/2.0)-ThetaE));
553 G4double iSinTheta = std::sqrt(1+std::tan((pi/2.0)-Theta)*std::tan((pi/2.0)-Theta));
554 G4double ivar_A = iSinTheta/ (pERecoil*u_p_temp);
555
556 cosPhiE = (var_C - var_B*cosThetaE)*(ivar_A*iSinThetaE);
557
558
559
560
561 } while ( (iteration <= maxDopplerIterations) && (abs(cosPhiE) > 1));
562
563
564 if (iteration >= maxDopplerIterations)
565 {
566 pERecoil = photonEnergy0 ;
567 bindingE = 0.;
568 dirx=0.0;
569 diry=0.0;
570 dirz=1.0;
571 }
572
573
575 photonDirection1.rotateUz(photonDirection0);
577
578 if (pERecoil > 0.)
579 {
581
582
584 G4double eDirX = sinThetaE * std::cos(phi+PhiE);
585 G4double eDirY = sinThetaE * std::sin(phi+PhiE);
587
588 G4double eKineticEnergy = pEIncident - pERecoil - bindingE;
589
591 eDirection.rotateUz(photonDirection0);
593 eDirection,eKineticEnergy) ;
594 fvect->push_back(dp);
595
596 }
597 else
598 {
601 }
602
603
604
605 if (verboseLevel > 3) {
606 G4cout <<
"Started atomic de-excitation " << fAtomDeexcitation <<
G4endl;
607 }
608
609 if(fAtomDeexcitation && iteration < maxDopplerIterations) {
612 std::size_t nbefore = fvect->size();
616 std::size_t nafter = fvect->size();
617 if(nafter > nbefore) {
618 for (std::size_t i=nbefore; i<nafter; ++i) {
619
620 if (bindingE >= ((*fvect)[i])->GetKineticEnergy())
621 {
622
623 bindingE -= ((*fvect)[i])->GetKineticEnergy();
624 }
625 else
626 {
627
628
629 delete (*fvect)[i];
630 (*fvect)[i]=nullptr;
631 }
632 }
633 }
634 }
635 }
636
637
638 if(bindingE < 0.0)
639 G4Exception(
"G4LowEPComptonModel::SampleSecondaries()",
641
643}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double RandomSelectMomentum(G4int Z, G4int shellIndex) const
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
const G4String & GetName() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
G4double BindingEnergy(G4int Z, G4int shellIndex) const
G4int SelectRandomShell(G4int Z) const
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)