296 if (verboseLevel > 3)
297 G4cout <<
"Calling SampleSecondaries() of G4PenelopeComptonModel" <<
G4endl;
320 size_t numberOfOscillators = theTable->size();
321 size_t targetOscillator = 0;
338 if (photonEnergy0 > 5*
MeV)
347 TST = (1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
350 cosTheta = 1.0 - (1.0-tau)/(ek*tau);
354 targetOscillator = numberOfOscillators-1;
356 G4bool levelFound =
false;
357 for (
size_t j=0;j<numberOfOscillators && !levelFound; j++)
359 S += (*theTable)[j]->GetOscillatorStrength();
362 targetOscillator = j;
367 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
368 }
while((epsilon*photonEnergy0-photonEnergy0+ionEnergy) >0);
377 for (
size_t i=0;i<numberOfOscillators;i++)
379 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
380 if (photonEnergy0 > ionEnergy)
382 G4double aux2 = photonEnergy0*(photonEnergy0-ionEnergy)*2.0;
383 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
384 oscStren = (*theTable)[i]->GetOscillatorStrength();
388 rni = 1.0-0.5*
G4Exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
389 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
391 rni = 0.5*
G4Exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
392 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
404 cdt1 = (1.0-tau)/(ek*tau);
407 for (
size_t i=0;i<numberOfOscillators;i++)
409 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
410 if (photonEnergy0 > ionEnergy)
412 aux = photonEnergy0*(photonEnergy0-ionEnergy)*cdt1;
413 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
414 oscStren = (*theTable)[i]->GetOscillatorStrength();
418 rn[i] = 1.0-0.5*
G4Exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
419 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
421 rn[i] = 0.5*
G4Exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
422 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
430 TST = S*(1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
433 cosTheta = 1.0 - cdt1;
442 targetOscillator = numberOfOscillators-1;
443 G4bool levelFound =
false;
444 for (
size_t i=0;i<numberOfOscillators && !levelFound;i++)
448 targetOscillator = i;
453 hartreeFunc = (*theTable)[targetOscillator]->GetHartreeFactor();
454 oscStren = (*theTable)[targetOscillator]->GetOscillatorStrength();
456 pzomc = (std::sqrt(0.5)-std::sqrt(0.5-std::log(2.0*A)))/
457 (std::sqrt(2.0)*hartreeFunc);
459 pzomc = (std::sqrt(0.5-std::log(2.0-2.0*A))-std::sqrt(0.5))/
460 (std::sqrt(2.0)*hartreeFunc);
461 }
while (pzomc < -1);
464 G4double XQC = 1.0+tau*(tau-2.0*cosTheta);
465 G4double AF = std::sqrt(XQC)*(1.0+tau*(tau-cosTheta)/XQC);
478 epsilon = (tau/b1)*(b2+std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
480 epsilon = (tau/b1)*(b2-std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
484 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
486 G4double dirx = sinTheta * std::cos(phi);
487 G4double diry = sinTheta * std::sin(phi);
492 photonDirection1.rotateUz(photonDirection0);
495 G4double photonEnergy1 = epsilon * photonEnergy0;
497 if (photonEnergy1 > 0.)
507 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
510 photonEnergy0*photonEnergy0+photonEnergy1*(photonEnergy1-2.0*photonEnergy0*cosTheta);
514 cosThetaE = (photonEnergy0-photonEnergy1*cosTheta)/std::sqrt(Q2);
517 G4double sinThetaE = std::sqrt(1-cosThetaE*cosThetaE);
521 G4int shFlag = (*theTable)[targetOscillator]->GetShellFlag();
522 G4int Z = (
G4int) (*theTable)[targetOscillator]->GetParentZ();
529 if (Z > 0 && shFlag<30)
531 shell = fTransitionManager->
Shell(Z,shFlag-1);
535 G4double ionEnergyInPenelopeDatabase = ionEnergy;
537 ionEnergy =
std::max(bindingEnergy,ionEnergyInPenelopeDatabase);
541 G4double eKineticEnergy = diffEnergy - ionEnergy;
542 G4double localEnergyDeposit = ionEnergy;
546 if (eKineticEnergy < 0)
552 localEnergyDeposit = diffEnergy;
553 eKineticEnergy = 0.0;
559 if (fAtomDeexcitation && shell)
564 size_t nBefore = fvect->size();
566 size_t nAfter = fvect->size();
568 if (nAfter > nBefore)
570 for (
size_t j=nBefore;j<nAfter;j++)
572 G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
573 localEnergyDeposit -= itsEnergy;
575 energyInFluorescence += itsEnergy;
577 energyInAuger += itsEnergy;
660 eDirection.rotateUz(photonDirection0);
662 eDirection,eKineticEnergy) ;
663 fvect->push_back(electron);
666 if (localEnergyDeposit < 0)
669 <<
"G4PenelopeComptonModel::SampleSecondaries - Negative energy deposit"
671 localEnergyDeposit=0.;
677 electronEnergy = eKineticEnergy;
678 if (verboseLevel > 1)
680 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
681 G4cout <<
"Energy balance from G4PenelopeCompton" <<
G4endl;
682 G4cout <<
"Incoming photon energy: " << photonEnergy0/
keV <<
" keV" <<
G4endl;
683 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
684 G4cout <<
"Scattered photon: " << photonEnergy1/
keV <<
" keV" <<
G4endl;
685 G4cout <<
"Scattered electron " << electronEnergy/
keV <<
" keV" <<
G4endl;
686 if (energyInFluorescence)
687 G4cout <<
"Fluorescence x-rays: " << energyInFluorescence/
keV <<
" keV" <<
G4endl;
689 G4cout <<
"Auger electrons: " << energyInAuger/
keV <<
" keV" <<
G4endl;
690 G4cout <<
"Local energy deposit " << localEnergyDeposit/
keV <<
" keV" <<
G4endl;
691 G4cout <<
"Total final state: " << (photonEnergy1+electronEnergy+energyInFluorescence+
692 localEnergyDeposit+energyInAuger)/
keV <<
694 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
696 if (verboseLevel > 0)
698 G4double energyDiff = std::fabs(photonEnergy1+
699 electronEnergy+energyInFluorescence+
700 localEnergyDeposit+energyInAuger-photonEnergy0);
701 if (energyDiff > 0.05*
keV)
702 G4cout <<
"Warning from G4PenelopeCompton: problem with energy conservation: " <<
703 (photonEnergy1+electronEnergy+energyInFluorescence+energyInAuger+localEnergyDeposit)/
keV <<
704 " keV (final) vs. " <<
705 photonEnergy0/
keV <<
" keV (initial)" << G4endl;
G4double LowEnergyLimit() const
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
G4double GetKineticEnergy() const
static G4Electron * Definition()
G4double BindingEnergy() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4PenelopeOscillatorTable * GetOscillatorTableCompton(const G4Material *)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
const G4ThreeVector & GetMomentumDirection() const
static constexpr double eV
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ParticleChangeForGamma * fParticleChange
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
static constexpr double MeV
static constexpr double pi
void ProposeTrackStatus(G4TrackStatus status)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
G4double bindingEnergy(G4int A, G4int Z)
static constexpr double keV
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
G4double GetTotalZ(const G4Material *)
double epsilon(double density, double temperature)
static G4Gamma * Definition()
const G4Material * GetMaterial() const