Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PenelopeComptonModel Class Reference

#include <G4PenelopeComptonModel.hh>

+ Inheritance diagram for G4PenelopeComptonModel:

Public Member Functions

 G4PenelopeComptonModel (const G4ParticleDefinition *p=nullptr, const G4String &processName="PenCompton")
 
virtual ~G4PenelopeComptonModel ()
 
void Initialise (const G4ParticleDefinition *, const G4DataVector &) override
 
void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *masterModel) override
 
G4double CrossSectionPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX) override
 
G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double) override
 
void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
 
void SetVerbosityLevel (G4int lev)
 
G4int GetVerbosityLevel ()
 
G4PenelopeComptonModeloperator= (const G4PenelopeComptonModel &right)=delete
 
 G4PenelopeComptonModel (const G4PenelopeComptonModel &)=delete
 
- Public Member Functions inherited from G4VEmModel
 G4VEmModel (const G4String &nam)
 
virtual ~G4VEmModel ()
 
virtual void Initialise (const G4ParticleDefinition *, const G4DataVector &)=0
 
virtual void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin=0.0, G4double tmax=DBL_MAX)=0
 
virtual void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *masterModel)
 
virtual void InitialiseForMaterial (const G4ParticleDefinition *, const G4Material *)
 
virtual void InitialiseForElement (const G4ParticleDefinition *, G4int Z)
 
virtual G4double ComputeDEDXPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
virtual G4double CrossSectionPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
virtual G4double GetPartialCrossSection (const G4Material *, G4int level, const G4ParticleDefinition *, G4double kineticEnergy)
 
virtual G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
virtual G4double ComputeCrossSectionPerShell (const G4ParticleDefinition *, G4int Z, G4int shellIdx, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
virtual G4double ChargeSquareRatio (const G4Track &)
 
virtual G4double GetChargeSquareRatio (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual G4double GetParticleCharge (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void StartTracking (G4Track *)
 
virtual void CorrectionsAlongStep (const G4MaterialCutsCouple *, const G4DynamicParticle *, const G4double &length, G4double &eloss)
 
virtual G4double Value (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
 
virtual G4double MinPrimaryEnergy (const G4Material *, const G4ParticleDefinition *, G4double cut=0.0)
 
virtual G4double MinEnergyCut (const G4ParticleDefinition *, const G4MaterialCutsCouple *)
 
virtual void SetupForMaterial (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void DefineForRegion (const G4Region *)
 
virtual void FillNumberOfSecondaries (G4int &numberOfTriplets, G4int &numberOfRecoil)
 
virtual void ModelDescription (std::ostream &outFile) const
 
void InitialiseElementSelectors (const G4ParticleDefinition *, const G4DataVector &)
 
std::vector< G4EmElementSelector * > * GetElementSelectors ()
 
void SetElementSelectors (std::vector< G4EmElementSelector * > *)
 
G4double ComputeDEDX (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
G4double CrossSection (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeMeanFreePath (const G4ParticleDefinition *, G4double kineticEnergy, const G4Material *, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, const G4Element *, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectTargetAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double logKineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementGetCurrentElement (const G4Material *mat=nullptr) const
 
G4int SelectRandomAtomNumber (const G4Material *) const
 
const G4IsotopeGetCurrentIsotope (const G4Element *elm=nullptr) const
 
G4int SelectIsotopeNumber (const G4Element *) const
 
void SetParticleChange (G4VParticleChange *, G4VEmFluctuationModel *f=nullptr)
 
void SetCrossSectionTable (G4PhysicsTable *, G4bool isLocal)
 
G4ElementDataGetElementData ()
 
G4PhysicsTableGetCrossSectionTable ()
 
G4VEmFluctuationModelGetModelOfFluctuations ()
 
G4VEmAngularDistributionGetAngularDistribution ()
 
G4VEmModelGetTripletModel ()
 
void SetTripletModel (G4VEmModel *)
 
void SetAngularDistribution (G4VEmAngularDistribution *)
 
G4double HighEnergyLimit () const
 
G4double LowEnergyLimit () const
 
G4double HighEnergyActivationLimit () const
 
G4double LowEnergyActivationLimit () const
 
G4double PolarAngleLimit () const
 
G4double SecondaryThreshold () const
 
G4bool LPMFlag () const
 
G4bool DeexcitationFlag () const
 
G4bool ForceBuildTableFlag () const
 
G4bool UseAngularGeneratorFlag () const
 
void SetAngularGeneratorFlag (G4bool)
 
void SetHighEnergyLimit (G4double)
 
void SetLowEnergyLimit (G4double)
 
void SetActivationHighEnergyLimit (G4double)
 
void SetActivationLowEnergyLimit (G4double)
 
G4bool IsActive (G4double kinEnergy) const
 
void SetPolarAngleLimit (G4double)
 
void SetSecondaryThreshold (G4double)
 
void SetLPMFlag (G4bool val)
 
void SetDeexcitationFlag (G4bool val)
 
void SetForceBuildTable (G4bool val)
 
void SetFluctuationFlag (G4bool val)
 
void SetMasterThread (G4bool val)
 
G4bool IsMaster () const
 
void SetUseBaseMaterials (G4bool val)
 
G4bool UseBaseMaterials () const
 
G4double MaxSecondaryKinEnergy (const G4DynamicParticle *dynParticle)
 
const G4StringGetName () const
 
void SetCurrentCouple (const G4MaterialCutsCouple *)
 
G4bool IsLocked () const
 
void SetLocked (G4bool)
 
G4VEmModeloperator= (const G4VEmModel &right)=delete
 
 G4VEmModel (const G4VEmModel &)=delete
 

Protected Attributes

G4ParticleChangeForGammafParticleChange
 
const G4ParticleDefinitionfParticle
 
- Protected Attributes inherited from G4VEmModel
G4ElementDatafElementData = nullptr
 
G4VParticleChangepParticleChange = nullptr
 
G4PhysicsTablexSectionTable = nullptr
 
const G4MaterialpBaseMaterial = nullptr
 
const std::vector< G4double > * theDensityFactor = nullptr
 
const std::vector< G4int > * theDensityIdx = nullptr
 
G4double inveplus
 
G4double pFactor = 1.0
 
size_t currentCoupleIndex = 0
 
size_t basedCoupleIndex = 0
 
G4bool lossFlucFlag = true
 

Additional Inherited Members

- Protected Member Functions inherited from G4VEmModel
G4ParticleChangeForLossGetParticleChangeForLoss ()
 
G4ParticleChangeForGammaGetParticleChangeForGamma ()
 
virtual G4double MaxSecondaryEnergy (const G4ParticleDefinition *, G4double kineticEnergy)
 
const G4MaterialCutsCoupleCurrentCouple () const
 
void SetCurrentElement (const G4Element *)
 

Detailed Description

Definition at line 62 of file G4PenelopeComptonModel.hh.

Constructor & Destructor Documentation

◆ G4PenelopeComptonModel() [1/2]

G4PenelopeComptonModel::G4PenelopeComptonModel ( const G4ParticleDefinition p = nullptr,
const G4String processName = "PenCompton" 
)
explicit

Definition at line 62 of file G4PenelopeComptonModel.cc.

64 :G4VEmModel(nam),fParticleChange(nullptr),fParticle(nullptr),
65 fAtomDeexcitation(nullptr),
66 fOscManager(nullptr),fIsInitialised(false)
67{
68 fIntrinsicLowEnergyLimit = 100.0*eV;
69 fIntrinsicHighEnergyLimit = 100.0*GeV;
70 SetHighEnergyLimit(fIntrinsicHighEnergyLimit);
71 //
73
74 if (part)
75 SetParticle(part);
76
77 fVerboseLevel= 0;
78 // Verbosity scale:
79 // 0 = nothing
80 // 1 = warning for energy non-conservation
81 // 2 = details of energy budget
82 // 3 = calculation of cross sections, file openings, sampling of atoms
83 // 4 = entering in methods
84
85 //Mark this model as "applicable" for atomic deexcitation
87
88 fTransitionManager = G4AtomicTransitionManager::Instance();
89}
static G4AtomicTransitionManager * Instance()
G4ParticleChangeForGamma * fParticleChange
const G4ParticleDefinition * fParticle
static G4PenelopeOscillatorManager * GetOscillatorManager()
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:746
void SetDeexcitationFlag(G4bool val)
Definition: G4VEmModel.hh:802

◆ ~G4PenelopeComptonModel()

G4PenelopeComptonModel::~G4PenelopeComptonModel ( )
virtual

Definition at line 93 of file G4PenelopeComptonModel.cc.

94{;}

◆ G4PenelopeComptonModel() [2/2]

G4PenelopeComptonModel::G4PenelopeComptonModel ( const G4PenelopeComptonModel )
delete

Member Function Documentation

◆ ComputeCrossSectionPerAtom()

G4double G4PenelopeComptonModel::ComputeCrossSectionPerAtom ( const G4ParticleDefinition ,
G4double  ,
G4double  ,
G4double  ,
G4double  ,
G4double   
)
overridevirtual

Reimplemented from G4VEmModel.

Definition at line 247 of file G4PenelopeComptonModel.cc.

253{
254 G4cout << "*** G4PenelopeComptonModel -- WARNING ***" << G4endl;
255 G4cout << "Penelope Compton model v2008 does not calculate cross section _per atom_ " << G4endl;
256 G4cout << "so the result is always zero. For physics values, please invoke " << G4endl;
257 G4cout << "GetCrossSectionPerVolume() or GetMeanFreePath() via the G4EmCalculator" << G4endl;
258 return 0;
259}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

◆ CrossSectionPerVolume()

G4double G4PenelopeComptonModel::CrossSectionPerVolume ( const G4Material material,
const G4ParticleDefinition p,
G4double  kineticEnergy,
G4double  cutEnergy = 0.0,
G4double  maxEnergy = DBL_MAX 
)
overridevirtual

Reimplemented from G4VEmModel.

Definition at line 175 of file G4PenelopeComptonModel.cc.

180{
181 // Penelope model v2008 to calculate the Compton scattering cross section:
182 // D. Brusa et al., Nucl. Instrum. Meth. A 379 (1996) 167
183 //
184 // The cross section for Compton scattering is calculated according to the Klein-Nishina
185 // formula for energy > 5 MeV.
186 // For E < 5 MeV it is used a parametrization for the differential cross-section dSigma/dOmega,
187 // which is integrated numerically in cos(theta), G4PenelopeComptonModel::DifferentialCrossSection().
188 // The parametrization includes the J(p)
189 // distribution profiles for the atomic shells, that are tabulated from Hartree-Fock calculations
190 // from F. Biggs et al., At. Data Nucl. Data Tables 16 (1975) 201
191 //
192 if (fVerboseLevel > 3)
193 G4cout << "Calling CrossSectionPerVolume() of G4PenelopeComptonModel" << G4endl;
194 SetupForMaterial(p, material, energy);
195
196 G4double cs = 0;
197 //Force null cross-section if below the low-energy edge of the table
198 if (energy < LowEnergyLimit())
199 return cs;
200
201 //Retrieve the oscillator table for this material
202 G4PenelopeOscillatorTable* theTable = fOscManager->GetOscillatorTableCompton(material);
203
204 if (energy < 5*MeV) //explicit calculation for E < 5 MeV
205 {
206 size_t numberOfOscillators = theTable->size();
207 for (size_t i=0;i<numberOfOscillators;i++)
208 {
209 G4PenelopeOscillator* theOsc = (*theTable)[i];
210 //sum contributions coming from each oscillator
211 cs += OscillatorTotalCrossSection(energy,theOsc);
212 }
213 }
214 else //use Klein-Nishina for E>5 MeV
215 cs = KleinNishinaCrossSection(energy,material);
216
217 //cross sections are in units of pi*classic_electr_radius^2
218 cs *= pi*classic_electr_radius*classic_electr_radius;
219
220 //Now, cs is the cross section *per molecule*, let's calculate the
221 //cross section per volume
222 G4double atomDensity = material->GetTotNbOfAtomsPerVolume();
223 G4double atPerMol = fOscManager->GetAtomsPerMolecule(material);
224
225 if (fVerboseLevel > 3)
226 G4cout << "Material " << material->GetName() << " has " << atPerMol <<
227 "atoms per molecule" << G4endl;
228
229 G4double moleculeDensity = 0.;
230
231 if (atPerMol)
232 moleculeDensity = atomDensity/atPerMol;
233
234 G4double csvolume = cs*moleculeDensity;
235
236 if (fVerboseLevel > 2)
237 G4cout << "Compton mean free path at " << energy/keV << " keV for material " <<
238 material->GetName() << " = " << (1./csvolume)/mm << " mm" << G4endl;
239 return csvolume;
240}
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
double G4double
Definition: G4Types.hh:83
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:204
const G4String & GetName() const
Definition: G4Material.hh:172
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4PenelopeOscillatorTable * GetOscillatorTableCompton(const G4Material *)
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:641
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
Definition: G4VEmModel.cc:383
G4double energy(const ThreeVector &p, const G4double m)
const G4double pi

◆ GetVerbosityLevel()

G4int G4PenelopeComptonModel::GetVerbosityLevel ( )
inline

Definition at line 97 of file G4PenelopeComptonModel.hh.

97{return fVerboseLevel;};

◆ Initialise()

void G4PenelopeComptonModel::Initialise ( const G4ParticleDefinition part,
const G4DataVector  
)
overridevirtual

Implements G4VEmModel.

Definition at line 98 of file G4PenelopeComptonModel.cc.

100{
101 if (fVerboseLevel > 3)
102 G4cout << "Calling G4PenelopeComptonModel::Initialise()" << G4endl;
103
104 fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
105 //Issue warning if the AtomicDeexcitation has not been declared
106 if (!fAtomDeexcitation)
107 {
108 G4cout << G4endl;
109 G4cout << "WARNING from G4PenelopeComptonModel " << G4endl;
110 G4cout << "Atomic de-excitation module is not instantiated, so there will not be ";
111 G4cout << "any fluorescence/Auger emission." << G4endl;
112 G4cout << "Please make sure this is intended" << G4endl;
113 }
114
115 SetParticle(part);
116
117 if (IsMaster() && part == fParticle)
118 {
119
120 if (fVerboseLevel > 0)
121 {
122 G4cout << "Penelope Compton model v2008 is initialized " << G4endl
123 << "Energy range: "
124 << LowEnergyLimit() / keV << " keV - "
125 << HighEnergyLimit() / GeV << " GeV";
126 }
127 //Issue a warning, if the model is going to be used down to a
128 //energy which is outside the validity of the model itself
129 if (LowEnergyLimit() < fIntrinsicLowEnergyLimit)
130 {
132 ed << "Using the Penelope Compton model outside its intrinsic validity range. "
133 << G4endl;
134 ed << "-> LowEnergyLimit() in process = " << LowEnergyLimit()/keV << "keV " << G4endl;
135 ed << "-> Instrinsic low-energy limit = " << fIntrinsicLowEnergyLimit/keV << "keV "
136 << G4endl;
137 ed << "Result of the simulation have to be taken with care" << G4endl;
138 G4Exception("G4PenelopeComptonModel::Initialise()",
139 "em2100",JustWarning,ed);
140 }
141 }
142
143 if(fIsInitialised) return;
145 fIsInitialised = true;
146
147}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
Definition: G4VEmModel.cc:124
G4bool IsMaster() const
Definition: G4VEmModel.hh:725
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:634

◆ InitialiseLocal()

void G4PenelopeComptonModel::InitialiseLocal ( const G4ParticleDefinition part,
G4VEmModel masterModel 
)
overridevirtual

Reimplemented from G4VEmModel.

Definition at line 151 of file G4PenelopeComptonModel.cc.

153{
154 if (fVerboseLevel > 3)
155 G4cout << "Calling G4PenelopeComptonModel::InitialiseLocal()" << G4endl;
156 //
157 //Check that particle matches: one might have multiple master models (e.g.
158 //for e+ and e-).
159 //
160 if (part == fParticle)
161 {
162 //Get the const table pointers from the master to the workers
163 const G4PenelopeComptonModel* theModel =
164 static_cast<G4PenelopeComptonModel*> (masterModel);
165
166 //Same verbosity for all workers, as the master
167 fVerboseLevel = theModel->fVerboseLevel;
168 }
169 return;
170}

◆ operator=()

G4PenelopeComptonModel & G4PenelopeComptonModel::operator= ( const G4PenelopeComptonModel right)
delete

◆ SampleSecondaries()

void G4PenelopeComptonModel::SampleSecondaries ( std::vector< G4DynamicParticle * > *  fvect,
const G4MaterialCutsCouple couple,
const G4DynamicParticle aDynamicGamma,
G4double  tmin,
G4double  maxEnergy 
)
overridevirtual

Implements G4VEmModel.

Definition at line 263 of file G4PenelopeComptonModel.cc.

268{
269 // Penelope model v2008 to sample the Compton scattering final state.
270 // D. Brusa et al., Nucl. Instrum. Meth. A 379 (1996) 167
271 // The model determines also the original shell from which the electron is expelled,
272 // in order to produce fluorescence de-excitation (from G4DeexcitationManager)
273 //
274 // The final state for Compton scattering is calculated according to the Klein-Nishina
275 // formula for energy > 5 MeV. In this case, the Doppler broadening is negligible and
276 // one can assume that the target electron is at rest.
277 // For E < 5 MeV it is used the parametrization for the differential cross-section dSigma/dOmega,
278 // to sample the scattering angle and the energy of the emerging electron, which is
279 // G4PenelopeComptonModel::DifferentialCrossSection(). The rejection method is
280 // used to sample cos(theta). The efficiency increases monotonically with photon energy and is
281 // nearly independent on the Z; typical values are 35%, 80% and 95% for 1 keV, 1 MeV and 10 MeV,
282 // respectively.
283 // The parametrization includes the J(p) distribution profiles for the atomic shells, that are
284 // tabulated
285 // from Hartree-Fock calculations from F. Biggs et al., At. Data Nucl. Data Tables 16 (1975) 201.
286 // Doppler broadening is included.
287 //
288
289 if (fVerboseLevel > 3)
290 G4cout << "Calling SampleSecondaries() of G4PenelopeComptonModel" << G4endl;
291
292 G4double photonEnergy0 = aDynamicGamma->GetKineticEnergy();
293
294 // do nothing below the threshold
295 // should never get here because the XS is zero below the limit
296 if(photonEnergy0 < LowEnergyLimit())
297 return;
298
299 G4ParticleMomentum photonDirection0 = aDynamicGamma->GetMomentumDirection();
300 const G4Material* material = couple->GetMaterial();
301
302 G4PenelopeOscillatorTable* theTable = fOscManager->GetOscillatorTableCompton(material);
303
304 const G4int nmax = 64;
305 G4double rn[nmax]={0.0};
306 G4double pac[nmax]={0.0};
307
308 G4double S=0.0;
309 G4double epsilon = 0.0;
310 G4double cosTheta = 1.0;
311 G4double hartreeFunc = 0.0;
312 G4double oscStren = 0.0;
313 size_t numberOfOscillators = theTable->size();
314 size_t targetOscillator = 0;
315 G4double ionEnergy = 0.0*eV;
316
317 G4double ek = photonEnergy0/electron_mass_c2;
318 G4double ek2 = 2.*ek+1.0;
319 G4double eks = ek*ek;
320 G4double ek1 = eks-ek2-1.0;
321
322 G4double taumin = 1.0/ek2;
323 G4double a1 = G4Log(ek2);
324 G4double a2 = a1+2.0*ek*(1.0+ek)/(ek2*ek2);
325
326 G4double TST = 0;
327 G4double tau = 0.;
328
329 //If the incoming photon is above 5 MeV, the quicker approach based on the
330 //pure Klein-Nishina formula is used
331 if (photonEnergy0 > 5*MeV)
332 {
333 do{
334 do{
335 if ((a2*G4UniformRand()) < a1)
336 tau = std::pow(taumin,G4UniformRand());
337 else
338 tau = std::sqrt(1.0+G4UniformRand()*(taumin*taumin-1.0));
339 //rejection function
340 TST = (1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
341 }while (G4UniformRand()> TST);
342 epsilon=tau;
343 cosTheta = 1.0 - (1.0-tau)/(ek*tau);
344
345 //Target shell electrons
346 TST = fOscManager->GetTotalZ(material)*G4UniformRand();
347 targetOscillator = numberOfOscillators-1; //last level
348 S=0.0;
349 G4bool levelFound = false;
350 for (size_t j=0;j<numberOfOscillators && !levelFound; j++)
351 {
352 S += (*theTable)[j]->GetOscillatorStrength();
353 if (S > TST)
354 {
355 targetOscillator = j;
356 levelFound = true;
357 }
358 }
359 //check whether the level is valid
360 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
361 }while((epsilon*photonEnergy0-photonEnergy0+ionEnergy) >0);
362 }
363 else //photonEnergy0 < 5 MeV
364 {
365 //Incoherent scattering function for theta=PI
366 G4double s0=0.0;
367 G4double pzomc=0.0;
368 G4double rni=0.0;
369 G4double aux=0.0;
370 for (size_t i=0;i<numberOfOscillators;i++)
371 {
372 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
373 if (photonEnergy0 > ionEnergy)
374 {
375 G4double aux2 = photonEnergy0*(photonEnergy0-ionEnergy)*2.0;
376 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
377 oscStren = (*theTable)[i]->GetOscillatorStrength();
378 pzomc = hartreeFunc*(aux2-electron_mass_c2*ionEnergy)/
379 (electron_mass_c2*std::sqrt(2.0*aux2+ionEnergy*ionEnergy));
380 if (pzomc > 0)
381 rni = 1.0-0.5*G4Exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
382 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
383 else
384 rni = 0.5*G4Exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
385 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
386 s0 += oscStren*rni;
387 }
388 }
389 //Sampling tau
390 G4double cdt1 = 0.;
391 do
392 {
393 if ((G4UniformRand()*a2) < a1)
394 tau = std::pow(taumin,G4UniformRand());
395 else
396 tau = std::sqrt(1.0+G4UniformRand()*(taumin*taumin-1.0));
397 cdt1 = (1.0-tau)/(ek*tau);
398 //Incoherent scattering function
399 S = 0.;
400 for (size_t i=0;i<numberOfOscillators;i++)
401 {
402 ionEnergy = (*theTable)[i]->GetIonisationEnergy();
403 if (photonEnergy0 > ionEnergy) //sum only on excitable levels
404 {
405 aux = photonEnergy0*(photonEnergy0-ionEnergy)*cdt1;
406 hartreeFunc = (*theTable)[i]->GetHartreeFactor();
407 oscStren = (*theTable)[i]->GetOscillatorStrength();
408 pzomc = hartreeFunc*(aux-electron_mass_c2*ionEnergy)/
409 (electron_mass_c2*std::sqrt(2.0*aux+ionEnergy*ionEnergy));
410 if (pzomc > 0)
411 rn[i] = 1.0-0.5*G4Exp(0.5-(std::sqrt(0.5)+std::sqrt(2.0)*pzomc)*
412 (std::sqrt(0.5)+std::sqrt(2.0)*pzomc));
413 else
414 rn[i] = 0.5*G4Exp(0.5-(std::sqrt(0.5)-std::sqrt(2.0)*pzomc)*
415 (std::sqrt(0.5)-std::sqrt(2.0)*pzomc));
416 S += oscStren*rn[i];
417 pac[i] = S;
418 }
419 else
420 pac[i] = S-1e-6;
421 }
422 //Rejection function
423 TST = S*(1.0+tau*(ek1+tau*(ek2+tau*eks)))/(eks*tau*(1.0+tau*tau));
424 }while ((G4UniformRand()*s0) > TST);
425
426 cosTheta = 1.0 - cdt1;
427 G4double fpzmax=0.0,fpz=0.0;
428 G4double A=0.0;
429 //Target electron shell
430 do
431 {
432 do
433 {
434 TST = S*G4UniformRand();
435 targetOscillator = numberOfOscillators-1; //last level
436 G4bool levelFound = false;
437 for (size_t i=0;i<numberOfOscillators && !levelFound;i++)
438 {
439 if (pac[i]>TST)
440 {
441 targetOscillator = i;
442 levelFound = true;
443 }
444 }
445 A = G4UniformRand()*rn[targetOscillator];
446 hartreeFunc = (*theTable)[targetOscillator]->GetHartreeFactor();
447 oscStren = (*theTable)[targetOscillator]->GetOscillatorStrength();
448 if (A < 0.5)
449 pzomc = (std::sqrt(0.5)-std::sqrt(0.5-G4Log(2.0*A)))/
450 (std::sqrt(2.0)*hartreeFunc);
451 else
452 pzomc = (std::sqrt(0.5-G4Log(2.0-2.0*A))-std::sqrt(0.5))/
453 (std::sqrt(2.0)*hartreeFunc);
454 } while (pzomc < -1);
455
456 // F(EP) rejection
457 G4double XQC = 1.0+tau*(tau-2.0*cosTheta);
458 G4double AF = std::sqrt(XQC)*(1.0+tau*(tau-cosTheta)/XQC);
459 if (AF > 0)
460 fpzmax = 1.0+AF*0.2;
461 else
462 fpzmax = 1.0-AF*0.2;
463 fpz = 1.0+AF*std::max(std::min(pzomc,0.2),-0.2);
464 }while ((fpzmax*G4UniformRand())>fpz);
465
466 //Energy of the scattered photon
467 G4double T = pzomc*pzomc;
468 G4double b1 = 1.0-T*tau*tau;
469 G4double b2 = 1.0-T*tau*cosTheta;
470 if (pzomc > 0.0)
471 epsilon = (tau/b1)*(b2+std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
472 else
473 epsilon = (tau/b1)*(b2-std::sqrt(std::abs(b2*b2-b1*(1.0-T))));
474 } //energy < 5 MeV
475
476 //Ok, the kinematics has been calculated.
477 G4double sinTheta = std::sqrt(1-cosTheta*cosTheta);
478 G4double phi = twopi * G4UniformRand() ;
479 G4double dirx = sinTheta * std::cos(phi);
480 G4double diry = sinTheta * std::sin(phi);
481 G4double dirz = cosTheta ;
482
483 // Update G4VParticleChange for the scattered photon
484 G4ThreeVector photonDirection1(dirx,diry,dirz);
485 photonDirection1.rotateUz(photonDirection0);
486 fParticleChange->ProposeMomentumDirection(photonDirection1) ;
487
488 G4double photonEnergy1 = epsilon * photonEnergy0;
489
490 if (photonEnergy1 > 0.)
492 else
493 {
496 }
497
498 //Create scattered electron
499 G4double diffEnergy = photonEnergy0*(1-epsilon);
500 ionEnergy = (*theTable)[targetOscillator]->GetIonisationEnergy();
501
502 G4double Q2 =
503 photonEnergy0*photonEnergy0+photonEnergy1*(photonEnergy1-2.0*photonEnergy0*cosTheta);
504 G4double cosThetaE = 0.; //scattering angle for the electron
505
506 if (Q2 > 1.0e-12)
507 cosThetaE = (photonEnergy0-photonEnergy1*cosTheta)/std::sqrt(Q2);
508 else
509 cosThetaE = 1.0;
510 G4double sinThetaE = std::sqrt(1-cosThetaE*cosThetaE);
511
512 //Now, try to handle fluorescence
513 //Notice: merged levels are indicated with Z=0 and flag=30
514 G4int shFlag = (*theTable)[targetOscillator]->GetShellFlag();
515 G4int Z = (G4int) (*theTable)[targetOscillator]->GetParentZ();
516
517 //initialize here, then check photons created by Atomic-Deexcitation, and the final state e-
518 G4double bindingEnergy = 0.*eV;
519 const G4AtomicShell* shell = 0;
520
521 //Real level
522 if (Z > 0 && shFlag<30)
523 {
524 shell = fTransitionManager->Shell(Z,shFlag-1);
525 bindingEnergy = shell->BindingEnergy();
526 }
527
528 G4double ionEnergyInPenelopeDatabase = ionEnergy;
529 //protection against energy non-conservation
530 ionEnergy = std::max(bindingEnergy,ionEnergyInPenelopeDatabase);
531
532 //subtract the excitation energy. If not emitted by fluorescence
533 //the ionization energy is deposited as local energy deposition
534 G4double eKineticEnergy = diffEnergy - ionEnergy;
535 G4double localEnergyDeposit = ionEnergy;
536 G4double energyInFluorescence = 0.; //testing purposes only
537 G4double energyInAuger = 0; //testing purposes
538
539 if (eKineticEnergy < 0)
540 {
541 //It means that there was some problem/mismatch between the two databases.
542 //Try to make it work
543 //In this case available Energy (diffEnergy) < ionEnergy
544 //Full residual energy is deposited locally
545 localEnergyDeposit = diffEnergy;
546 eKineticEnergy = 0.0;
547 }
548
549 //the local energy deposit is what remains: part of this may be spent for fluorescence.
550 //Notice: shell might be nullptr (invalid!) if shFlag=30. Must be protected
551 //Now, take care of fluorescence, if required
552 if (fAtomDeexcitation && shell)
553 {
554 G4int index = couple->GetIndex();
555 if (fAtomDeexcitation->CheckDeexcitationActiveRegion(index))
556 {
557 size_t nBefore = fvect->size();
558 fAtomDeexcitation->GenerateParticles(fvect,shell,Z,index);
559 size_t nAfter = fvect->size();
560
561 if (nAfter > nBefore) //actual production of fluorescence
562 {
563 for (size_t j=nBefore;j<nAfter;j++) //loop on products
564 {
565 G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
566 if (itsEnergy < localEnergyDeposit) // valid secondary, generate it
567 {
568 localEnergyDeposit -= itsEnergy;
569 if (((*fvect)[j])->GetParticleDefinition() == G4Gamma::Definition())
570 energyInFluorescence += itsEnergy;
571 else if (((*fvect)[j])->GetParticleDefinition() ==
573 energyInAuger += itsEnergy;
574 }
575 else //invalid secondary: takes more than the available energy: delete it
576 {
577 delete (*fvect)[j];
578 (*fvect)[j] = nullptr;
579 }
580 }
581 }
582
583 }
584 }
585
586 //Always produce explicitly the electron
588
589 G4double xEl = sinThetaE * std::cos(phi+pi);
590 G4double yEl = sinThetaE * std::sin(phi+pi);
591 G4double zEl = cosThetaE;
592 G4ThreeVector eDirection(xEl,yEl,zEl); //electron direction
593 eDirection.rotateUz(photonDirection0);
595 eDirection,eKineticEnergy) ;
596 fvect->push_back(electron);
597
598 if (localEnergyDeposit < 0) //Should not be: issue a G4Exception (warning)
599 {
600 G4Exception("G4PenelopeComptonModel::SampleSecondaries()",
601 "em2099",JustWarning,"WARNING: Negative local energy deposit");
602 localEnergyDeposit=0.;
603 }
604 fParticleChange->ProposeLocalEnergyDeposit(localEnergyDeposit);
605
606 G4double electronEnergy = 0.;
607 if (electron)
608 electronEnergy = eKineticEnergy;
609 if (fVerboseLevel > 1)
610 {
611 G4cout << "-----------------------------------------------------------" << G4endl;
612 G4cout << "Energy balance from G4PenelopeCompton" << G4endl;
613 G4cout << "Incoming photon energy: " << photonEnergy0/keV << " keV" << G4endl;
614 G4cout << "-----------------------------------------------------------" << G4endl;
615 G4cout << "Scattered photon: " << photonEnergy1/keV << " keV" << G4endl;
616 G4cout << "Scattered electron " << electronEnergy/keV << " keV" << G4endl;
617 if (energyInFluorescence)
618 G4cout << "Fluorescence x-rays: " << energyInFluorescence/keV << " keV" << G4endl;
619 if (energyInAuger)
620 G4cout << "Auger electrons: " << energyInAuger/keV << " keV" << G4endl;
621 G4cout << "Local energy deposit " << localEnergyDeposit/keV << " keV" << G4endl;
622 G4cout << "Total final state: " << (photonEnergy1+electronEnergy+energyInFluorescence+
623 localEnergyDeposit+energyInAuger)/keV <<
624 " keV" << G4endl;
625 G4cout << "-----------------------------------------------------------" << G4endl;
626 }
627 if (fVerboseLevel > 0)
628 {
629 G4double energyDiff = std::fabs(photonEnergy1+
630 electronEnergy+energyInFluorescence+
631 localEnergyDeposit+energyInAuger-photonEnergy0);
632 if (energyDiff > 0.05*keV)
633 G4cout << "Warning from G4PenelopeCompton: problem with energy conservation: " <<
634 (photonEnergy1+electronEnergy+energyInFluorescence+energyInAuger+localEnergyDeposit)/keV <<
635 " keV (final) vs. " <<
636 photonEnergy0/keV << " keV (initial)" << G4endl;
637 }
638}
G4double epsilon(G4double density, G4double temperature)
G4double S(G4double temp)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180
G4double G4Log(G4double x)
Definition: G4Log.hh:227
@ fStopAndKill
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
#define G4UniformRand()
Definition: Randomize.hh:52
G4double BindingEnergy() const
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * Definition()
Definition: G4Electron.cc:48
static G4Electron * Electron()
Definition: G4Electron.cc:93
static G4Gamma * Definition()
Definition: G4Gamma.cc:48
const G4Material * GetMaterial() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
G4double GetTotalZ(const G4Material *)
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double bindingEnergy(G4int A, G4int Z)

◆ SetVerbosityLevel()

void G4PenelopeComptonModel::SetVerbosityLevel ( G4int  lev)
inline

Definition at line 96 of file G4PenelopeComptonModel.hh.

96{fVerboseLevel = lev;};

Member Data Documentation

◆ fParticle

const G4ParticleDefinition* G4PenelopeComptonModel::fParticle
protected

Definition at line 104 of file G4PenelopeComptonModel.hh.

Referenced by Initialise(), and InitialiseLocal().

◆ fParticleChange

G4ParticleChangeForGamma* G4PenelopeComptonModel::fParticleChange
protected

Definition at line 103 of file G4PenelopeComptonModel.hh.

Referenced by Initialise(), and SampleSecondaries().


The documentation for this class was generated from the following files: