63 :
G4VEmModel(nam),fParticleChange(0),isInitialised(false),fAtomDeexcitation(0),
66 fIntrinsicLowEnergyLimit = 100.0*eV;
67 fIntrinsicHighEnergyLimit = 100.0*GeV;
98 G4cout <<
"Calling G4PenelopeComptonModel::Initialise()" <<
G4endl;
102 if (!fAtomDeexcitation)
105 G4cout <<
"WARNING from G4PenelopeComptonModel " <<
G4endl;
106 G4cout <<
"Atomic de-excitation module is not instantiated, so there will not be ";
108 G4cout <<
"Please make sure this is intended" <<
G4endl;
112 if (verboseLevel > 0)
114 G4cout <<
"Penelope Compton model v2008 is initialized " <<
G4endl
120 if(isInitialised)
return;
122 isInitialised =
true;
145 if (verboseLevel > 3)
146 G4cout <<
"Calling CrossSectionPerVolume() of G4PenelopeComptonModel" <<
G4endl;
156 size_t numberOfOscillators = theTable->size();
157 for (
size_t i=0;i<numberOfOscillators;i++)
161 cs += OscillatorTotalCrossSection(energy,theOsc);
165 cs = KleinNishinaCrossSection(energy,material);
168 cs *= pi*classic_electr_radius*classic_electr_radius;
176 if (verboseLevel > 3)
177 G4cout <<
"Material " << material->
GetName() <<
" has " << atPerMol <<
178 "atoms per molecule" <<
G4endl;
183 moleculeDensity = atomDensity/atPerMol;
185 G4double csvolume = cs*moleculeDensity;
187 if (verboseLevel > 2)
188 G4cout <<
"Compton mean free path at " << energy/keV <<
" keV for material " <<
189 material->
GetName() <<
" = " << (1./csvolume)/mm <<
" mm" <<
G4endl;
205 G4cout <<
"*** G4PenelopeComptonModel -- WARNING ***" <<
G4endl;
206 G4cout <<
"Penelope Compton model v2008 does not calculate cross section _per atom_ " <<
G4endl;
207 G4cout <<
"so the result is always zero. For physics values, please invoke " <<
G4endl;
208 G4cout <<
"GetCrossSectionPerVolume() or GetMeanFreePath() via the G4EmCalculator" <<
G4endl;
241 if (verboseLevel > 3)
242 G4cout <<
"Calling SampleSecondaries() of G4PenelopeComptonModel" <<
G4endl;
246 if (photonEnergy0 <= fIntrinsicLowEnergyLimit)
259 const G4int nmax = 64;
268 size_t numberOfOscillators = theTable->size();
269 size_t targetOscillator = 0;
272 G4double ek = photonEnergy0/electron_mass_c2;
279 G4double a2 = a1+2.0*ek*(1.0+ek)/(ek2*ek2);
286 if (photonEnergy0 > 5*MeV)
295 TST = (1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
298 cosTheta = 1.0 - (1.0-tau)/(ek*tau);
302 targetOscillator = numberOfOscillators-1;
304 G4bool levelFound =
false;
305 for (
size_t j=0;j<numberOfOscillators && !levelFound; j++)
307 S += (*theTable)[j]->GetOscillatorStrength();
310 targetOscillator = j;
315 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
316 }
while((epsilon*photonEnergy0-photonEnergy0+ionEnergy) >0);
325 for (
size_t i=0;i<numberOfOscillators;i++)
327 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
328 if (photonEnergy0 > ionEnergy)
330 G4double aux2 = photonEnergy0*(photonEnergy0-ionEnergy)*2.0;
331 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
332 oscStren = (*theTable)[i]->GetOscillatorStrength();
333 pzomc = hartreeFunc*(aux2-electron_mass_c2*ionEnergy)/
334 (electron_mass_c2*std::sqrt(2.0*aux2+ionEnergy*ionEnergy));
336 rni = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
337 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
339 rni = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
340 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
352 cdt1 = (1.0-tau)/(ek*tau);
355 for (
size_t i=0;i<numberOfOscillators;i++)
357 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
358 if (photonEnergy0 > ionEnergy)
360 aux = photonEnergy0*(photonEnergy0-ionEnergy)*cdt1;
361 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
362 oscStren = (*theTable)[i]->GetOscillatorStrength();
363 pzomc = hartreeFunc*(aux-electron_mass_c2*ionEnergy)/
364 (electron_mass_c2*std::sqrt(2.0*aux+ionEnergy*ionEnergy));
366 rn[i] = 1.0-0.5*std::exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
367 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
369 rn[i] = 0.5*std::exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
370 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
378 TST = S*(1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
381 cosTheta = 1.0 - cdt1;
390 targetOscillator = numberOfOscillators-1;
391 G4bool levelFound =
false;
392 for (
size_t i=0;i<numberOfOscillators && !levelFound;i++)
396 targetOscillator = i;
401 hartreeFunc = (*theTable)[targetOscillator]->GetHartreeFactor();
402 oscStren = (*theTable)[targetOscillator]->GetOscillatorStrength();
404 pzomc = (std::sqrt(0.5)-std::sqrt(0.5-std::log(2.0*A)))/
405 (std::sqrt(2.0)*hartreeFunc);
407 pzomc = (std::sqrt(0.5-std::log(2.0-2.0*A))-std::sqrt(0.5))/
408 (std::sqrt(2.0)*hartreeFunc);
409 }
while (pzomc < -1);
412 G4double XQC = 1.0+tau*(tau-2.0*cosTheta);
413 G4double AF = std::sqrt(XQC)*(1.0+tau*(tau-cosTheta)/XQC);
418 fpz = 1.0+AF*std::max(std::min(pzomc,0.2),-0.2);
426 epsilon = (tau/b1)*(b2+std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
428 epsilon = (tau/b1)*(b2-std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
432 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
434 G4double dirx = sinTheta * std::cos(phi);
435 G4double diry = sinTheta * std::sin(phi);
440 photonDirection1.
rotateUz(photonDirection0);
443 G4double photonEnergy1 = epsilon * photonEnergy0;
445 if (photonEnergy1 > 0.)
454 G4double diffEnergy = photonEnergy0*(1-epsilon);
455 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
458 photonEnergy0*photonEnergy0+photonEnergy1*(photonEnergy1-2.0*photonEnergy0*cosTheta);
462 cosThetaE = (photonEnergy0-photonEnergy1*cosTheta)/std::sqrt(Q2);
465 G4double sinThetaE = std::sqrt(1-cosThetaE*cosThetaE);
469 G4int shFlag = (*theTable)[targetOscillator]->GetShellFlag();
470 G4int Z = (
G4int) (*theTable)[targetOscillator]->GetParentZ();
477 if (Z > 0 && shFlag<30)
479 shell = fTransitionManager->
Shell(Z,shFlag-1);
483 G4double ionEnergyInPenelopeDatabase = ionEnergy;
485 ionEnergy = std::max(bindingEnergy,ionEnergyInPenelopeDatabase);
489 G4double eKineticEnergy = diffEnergy - ionEnergy;
490 G4double localEnergyDeposit = ionEnergy;
494 if (eKineticEnergy < 0)
500 localEnergyDeposit = diffEnergy;
501 eKineticEnergy = 0.0;
507 if (fAtomDeexcitation && shell)
512 size_t nBefore = fvect->size();
514 size_t nAfter = fvect->size();
516 if (nAfter > nBefore)
518 for (
size_t j=nBefore;j<nAfter;j++)
520 G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
521 localEnergyDeposit -= itsEnergy;
523 energyInFluorescence += itsEnergy;
525 energyInAuger += itsEnergy;
604 G4double xEl = sinThetaE * std::cos(phi+pi);
605 G4double yEl = sinThetaE * std::sin(phi+pi);
608 eDirection.
rotateUz(photonDirection0);
610 eDirection,eKineticEnergy) ;
611 fvect->push_back(electron);
614 if (localEnergyDeposit < 0)
617 <<
"G4PenelopeComptonModel::SampleSecondaries - Negative energy deposit"
619 localEnergyDeposit=0.;
625 electronEnergy = eKineticEnergy;
626 if (verboseLevel > 1)
628 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
629 G4cout <<
"Energy balance from G4PenelopeCompton" <<
G4endl;
630 G4cout <<
"Incoming photon energy: " << photonEnergy0/keV <<
" keV" <<
G4endl;
631 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
632 G4cout <<
"Scattered photon: " << photonEnergy1/keV <<
" keV" <<
G4endl;
633 G4cout <<
"Scattered electron " << electronEnergy/keV <<
" keV" <<
G4endl;
634 if (energyInFluorescence)
635 G4cout <<
"Fluorescence x-rays: " << energyInFluorescence/keV <<
" keV" <<
G4endl;
637 G4cout <<
"Auger electrons: " << energyInAuger/keV <<
" keV" <<
G4endl;
638 G4cout <<
"Local energy deposit " << localEnergyDeposit/keV <<
" keV" <<
G4endl;
639 G4cout <<
"Total final state: " << (photonEnergy1+electronEnergy+energyInFluorescence+
640 localEnergyDeposit+energyInAuger)/keV <<
642 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
644 if (verboseLevel > 0)
646 G4double energyDiff = std::fabs(photonEnergy1+
647 electronEnergy+energyInFluorescence+
648 localEnergyDeposit+energyInAuger-photonEnergy0);
649 if (energyDiff > 0.05*keV)
650 G4cout <<
"Warning from G4PenelopeCompton: problem with energy conservation: " <<
651 (photonEnergy1+electronEnergy+energyInFluorescence+energyInAuger+localEnergyDeposit)/keV <<
652 " keV (final) vs. " <<
653 photonEnergy0/keV <<
" keV (initial)" <<
G4endl;
679 if (energy < ionEnergy)
684 G4double EOEC = 1.0+(energy/electron_mass_c2)*cdt1;
688 G4double aux = energy*(energy-ionEnergy)*cdt1;
690 (aux - electron_mass_c2*ionEnergy)/(electron_mass_c2*std::sqrt(2*aux+ionEnergy*ionEnergy));
694 sia = 1.0-0.5*std::exp(0.5-(k1+k2*x)*(k1+k2*x));
696 sia = 0.5*std::exp(0.5-(k1-k2*x)*(k1-k2*x));
701 if (std::fabs(Pzimax) < pf)
703 G4double QCOE2 = 1.0+ECOE*ECOE-2.0*ECOE*cosTheta;
706 (1.0+ECOE*(ECOE-cosTheta)/QCOE2)*harFunc
707 *0.25*(2*p2-(p2*p2)/(pf*pf)-(pf*pf));
708 sia += std::max(dspz,-1.0*sia);
711 G4double XKN = EOEC+ECOE-1.0+cosTheta*cosTheta;
714 G4double diffCS = ECOE*ECOE*XKN*sia;
731 const G4int npoints=10;
732 const G4int ncallsmax=20000;
734 static G4double Abscissas[10] = {7.652651133497334e-02,2.2778585114164508e-01,3.7370608871541956e-01,
735 5.1086700195082710e-01,6.3605368072651503e-01,7.4633190646015079e-01,
736 8.3911697182221882e-01,9.1223442825132591e-01,9.6397192727791379e-01,
737 9.9312859918509492e-01};
738 static G4double Weights[10] = {1.5275338713072585e-01,1.4917298647260375e-01,1.4209610931838205e-01,
739 1.3168863844917663e-01,1.1819453196151842e-01,1.0193011981724044e-01,
740 8.3276741576704749e-02,6.2672048334109064e-02,4.0601429800386941e-02,
741 1.7614007139152118e-02};
745 G4double Ctol = std::min(std::max(MaxError,1e-13),1e-02);
755 G4double a=0.5*(HighPoint-LowPoint);
756 G4double b=0.5*(HighPoint+LowPoint);
759 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
760 for (
G4int i=2;i<=npoints;i++)
764 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
766 G4int icall = 2*npoints;
768 G4double S[nst],x[nst],sn[nst],xrn[nst];
781 for (
G4int i=1;i<=LH;i++){
790 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
792 for (
G4int j=1;j<npoints;j++)
795 dLocal += Weights[j]*
796 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
803 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
805 for (
G4int j=1;j<npoints;j++)
808 dLocal += Weights[j]*
809 (DifferentialCrossSection(b+c,energy,osc)+DifferentialCrossSection(b-c,energy,osc));
812 icall=icall+4*npoints;
814 if (std::abs(s12-si)<std::max(Ptol*std::abs(s12),1e-35))
826 if (icall>ncallsmax || LHN>nst)
829 G4cout <<
"LowPoint: " << LowPoint <<
", High Point: " << HighPoint <<
G4endl;
831 G4cout <<
"Calls: " << icall <<
", Integral: " << sumga <<
", Error: " << Err <<
G4endl;
832 G4cout <<
"Number of open subintervals: " << LHN <<
G4endl;
833 G4cout <<
"WARNING: the required accuracy has not been attained" <<
G4endl;
837 Err=std::abs(sumr)/std::max(std::abs(sumr+sumga),1e-35);
838 if (Err < Ctol || LHN == 0)
841 for (
G4int i=0;i<LH;i++)
846 }
while(Ctol < 1.0 && loopAgain);
864 G4double ek =energy/electron_mass_c2;
870 G4double csl = 0.5*eks*t0*t0+ek2*t0+ek1*std::log(t0)-(1.0/t0);
874 for (
size_t i=0;i<theTable->size();i++)
878 G4double tau=(energy-ionEnergy)/energy;
881 G4double csu = 0.5*eks*tau*tau+ek2*tau+ek1*std::log(tau)-(1.0/tau);
884 cs += stre*(csu-csl);
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
G4DLLIMPORT std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
G4double BindingEnergy() const
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
static G4AtomicTransitionManager * Instance()
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * Definition()
static G4Electron * Electron()
static G4Gamma * Definition()
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4double GetTotNbOfAtomsPerVolume() const
const G4String & GetName() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual ~G4PenelopeComptonModel()
G4ParticleChangeForGamma * fParticleChange
G4PenelopeComptonModel(const G4ParticleDefinition *p=0, const G4String &processName="PenCompton")
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4PenelopeOscillatorTable * GetOscillatorTableCompton(const G4Material *)
static G4PenelopeOscillatorManager * GetOscillatorManager()
G4double GetTotalZ(const G4Material *)
G4double GetIonisationEnergy()
G4double GetHartreeFactor()
G4double GetOscillatorStrength()
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
void SetDeexcitationFlag(G4bool val)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)