Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes
G4PenelopeGammaConversionModel Class Reference

#include <G4PenelopeGammaConversionModel.hh>

Inheritance diagram for G4PenelopeGammaConversionModel:
G4VEmModel

Public Member Functions

 G4PenelopeGammaConversionModel (const G4ParticleDefinition *p=0, const G4String &processName="PenConversion")
 
virtual ~G4PenelopeGammaConversionModel ()
 
virtual void Initialise (const G4ParticleDefinition *, const G4DataVector &)
 
virtual void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *)
 
virtual G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
 
virtual void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
 
void SetVerbosityLevel (G4int lev)
 
G4int GetVerbosityLevel ()
 
- Public Member Functions inherited from G4VEmModel
 G4VEmModel (const G4String &nam)
 
virtual ~G4VEmModel ()
 
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 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 *, G4double &eloss, G4double &niel, G4double length)
 
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 *)
 
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)
 
G4int SelectIsotopeNumber (const G4Element *)
 
const G4ElementSelectRandomAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectRandomAtomNumber (const G4Material *)
 
void SetParticleChange (G4VParticleChange *, G4VEmFluctuationModel *f=0)
 
void SetCrossSectionTable (G4PhysicsTable *, G4bool isLocal)
 
G4ElementDataGetElementData ()
 
G4PhysicsTableGetCrossSectionTable ()
 
G4VEmFluctuationModelGetModelOfFluctuations ()
 
G4VEmAngularDistributionGetAngularDistribution ()
 
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)
 
void SetPolarAngleLimit (G4double)
 
void SetSecondaryThreshold (G4double)
 
void SetLPMFlag (G4bool val)
 
void SetDeexcitationFlag (G4bool val)
 
void SetForceBuildTable (G4bool val)
 
void SetMasterThread (G4bool val)
 
G4bool IsMaster () const
 
G4double MaxSecondaryKinEnergy (const G4DynamicParticle *dynParticle)
 
const G4StringGetName () const
 
void SetCurrentCouple (const G4MaterialCutsCouple *)
 
const G4ElementGetCurrentElement () const
 

Protected Attributes

G4ParticleChangeForGammafParticleChange
 
const G4ParticleDefinitionfParticle
 
- Protected Attributes inherited from G4VEmModel
G4ElementDatafElementData
 
G4VParticleChangepParticleChange
 
G4PhysicsTablexSectionTable
 
const std::vector< G4double > * theDensityFactor
 
const std::vector< G4int > * theDensityIdx
 
size_t idxTable
 

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 57 of file G4PenelopeGammaConversionModel.hh.

Constructor & Destructor Documentation

G4PenelopeGammaConversionModel::G4PenelopeGammaConversionModel ( const G4ParticleDefinition p = 0,
const G4String processName = "PenConversion" 
)

Definition at line 55 of file G4PenelopeGammaConversionModel.cc.

References python.hepunit::electron_mass_c2, python.hepunit::GeV, python.hepunit::MeV, and G4VEmModel::SetHighEnergyLimit().

58  logAtomicCrossSection(0),
59  fEffectiveCharge(0),fMaterialInvScreeningRadius(0),
60  fScreeningFunction(0),isInitialised(false),fLocalTable(false)
61 
62 {
63  fIntrinsicLowEnergyLimit = 2.0*electron_mass_c2;
64  fIntrinsicHighEnergyLimit = 100.0*GeV;
65  fSmallEnergy = 1.1*MeV;
66 
67  InitializeScreeningRadii();
68 
69  if (part)
70  SetParticle(part);
71 
72  // SetLowEnergyLimit(fIntrinsicLowEnergyLimit);
73  SetHighEnergyLimit(fIntrinsicHighEnergyLimit);
74  //
75  verboseLevel= 0;
76  // Verbosity scale:
77  // 0 = nothing
78  // 1 = warning for energy non-conservation
79  // 2 = details of energy budget
80  // 3 = calculation of cross sections, file openings, sampling of atoms
81  // 4 = entering in methods
82 }
G4VEmModel(const G4String &nam)
Definition: G4VEmModel.cc:65
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:683
float electron_mass_c2
Definition: hepunit.py:274
G4PenelopeGammaConversionModel::~G4PenelopeGammaConversionModel ( )
virtual

Definition at line 86 of file G4PenelopeGammaConversionModel.cc.

References G4VEmModel::IsMaster().

87 {
88  //Delete shared tables, they exist only in the master model
89  if (IsMaster() || fLocalTable)
90  {
91  if (logAtomicCrossSection)
92  {
93  /*
94  std::map <G4int,G4PhysicsFreeVector*>::iterator i;
95  for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
96  if (i->second) delete i->second;
97  */
98  delete logAtomicCrossSection;
99  }
100  if (fEffectiveCharge)
101  delete fEffectiveCharge;
102  if (fMaterialInvScreeningRadius)
103  delete fMaterialInvScreeningRadius;
104  if (fScreeningFunction)
105  delete fScreeningFunction;
106  }
107 }
G4bool IsMaster() const
Definition: G4VEmModel.hh:676

Member Function Documentation

G4double G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom ( const G4ParticleDefinition ,
G4double  kinEnergy,
G4double  Z,
G4double  A = 0,
G4double  cut = 0,
G4double  emax = DBL_MAX 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 221 of file G4PenelopeGammaConversionModel.cc.

References python.hepunit::barn, G4cout, G4endl, G4Exception(), JustWarning, python.hepunit::MeV, G4TemplateAutoLock< M, L, U >::unlock(), and G4PhysicsVector::Value().

226 {
227  //
228  // Penelope model v2008.
229  // Cross section (including triplet production) read from database and managed
230  // through the G4CrossSectionHandler utility. Cross section data are from
231  // M.J. Berger and J.H. Hubbel (XCOM), Report NBSIR 887-3598
232  //
233 
234  if (energy < fIntrinsicLowEnergyLimit)
235  return 0;
236 
237  G4int iZ = (G4int) Z;
238 
239  //Either Initialize() was not called, or we are in a slave and InitializeLocal() was
240  //not invoked
241  if (!logAtomicCrossSection)
242  {
243  //create a **thread-local** version of the table. Used only for G4EmCalculator and
244  //Unit Tests
245  fLocalTable = true;
246  logAtomicCrossSection = new std::map<G4int,G4PhysicsFreeVector*>;
247  }
248  //now it should be ok
249  if (!logAtomicCrossSection->count(iZ))
250  {
251  //If we are here, it means that Initialize() was inkoved, but the MaterialTable was
252  //not filled up. This can happen in a UnitTest or via G4EmCalculator
253  if (verboseLevel > 0)
254  {
255  //Issue a G4Exception (warning) only in verbose mode
257  ed << "Unable to retrieve the cross section table for Z=" << iZ << G4endl;
258  ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
259  G4Exception("G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom()",
260  "em2018",JustWarning,ed);
261  }
262  //protect file reading via autolock
263  G4AutoLock lock(&PenelopeGammaConversionModelMutex);
264  ReadDataFile(iZ);
265  lock.unlock();
266  }
267 
268  G4double cs = 0;
269  G4double logene = std::log(energy);
270 
271  G4PhysicsFreeVector* theVec = logAtomicCrossSection->find(iZ)->second;
272 
273  G4double logXS = theVec->Value(logene);
274  cs = std::exp(logXS);
275 
276  if (verboseLevel > 2)
277  G4cout << "Gamma conversion cross section at " << energy/MeV << " MeV for Z=" << Z <<
278  " = " << cs/barn << " barn" << G4endl;
279  return cs;
280 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
int G4int
Definition: G4Types.hh:78
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
G4double Value(G4double theEnergy, size_t &lastidx) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4int G4PenelopeGammaConversionModel::GetVerbosityLevel ( )
inline

Definition at line 84 of file G4PenelopeGammaConversionModel.hh.

84 {return verboseLevel;};
void G4PenelopeGammaConversionModel::Initialise ( const G4ParticleDefinition part,
const G4DataVector  
)
virtual

Implements G4VEmModel.

Definition at line 112 of file G4PenelopeGammaConversionModel.cc.

References fParticle, fParticleChange, G4cout, G4endl, G4Material::GetElementVector(), G4MaterialCutsCouple::GetMaterial(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4Material::GetNumberOfElements(), G4VEmModel::GetParticleChangeForGamma(), G4ProductionCutsTable::GetProductionCutsTable(), G4ProductionCutsTable::GetTableSize(), python.hepunit::GeV, G4VEmModel::HighEnergyLimit(), G4VEmModel::IsMaster(), G4VEmModel::LowEnergyLimit(), eplot::material, and python.hepunit::MeV.

114 {
115  if (verboseLevel > 3)
116  G4cout << "Calling G4PenelopeGammaConversionModel::Initialise()" << G4endl;
117 
118  SetParticle(part);
119 
120  //Only the master model creates/fills/destroys the tables
121  if (IsMaster() && part == fParticle)
122  {
123  // logAtomicCrossSection is created only once, since it is never cleared
124  if (!logAtomicCrossSection)
125  logAtomicCrossSection = new std::map<G4int,G4PhysicsFreeVector*>;
126 
127  //delete old material data...
128  if (fEffectiveCharge)
129  {
130  delete fEffectiveCharge;
131  fEffectiveCharge = 0;
132  }
133  if (fMaterialInvScreeningRadius)
134  {
135  delete fMaterialInvScreeningRadius;
136  fMaterialInvScreeningRadius = 0;
137  }
138  if (fScreeningFunction)
139  {
140  delete fScreeningFunction;
141  fScreeningFunction = 0;
142  }
143  //and create new ones
144  fEffectiveCharge = new std::map<const G4Material*,G4double>;
145  fMaterialInvScreeningRadius = new std::map<const G4Material*,G4double>;
146  fScreeningFunction = new std::map<const G4Material*,std::pair<G4double,G4double> >;
147 
148  G4ProductionCutsTable* theCoupleTable =
150 
151  for (size_t i=0;i<theCoupleTable->GetTableSize();i++)
152  {
153  const G4Material* material =
154  theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
155  const G4ElementVector* theElementVector = material->GetElementVector();
156 
157  for (size_t j=0;j<material->GetNumberOfElements();j++)
158  {
159  G4int iZ = (G4int) theElementVector->at(j)->GetZ();
160  //read data files only in the master
161  if (!logAtomicCrossSection->count(iZ))
162  ReadDataFile(iZ);
163  }
164 
165  //check if material data are available
166  if (!fEffectiveCharge->count(material))
167  InitializeScreeningFunctions(material);
168  }
169 
170 
171  if (verboseLevel > 0) {
172  G4cout << "Penelope Gamma Conversion model v2008 is initialized " << G4endl
173  << "Energy range: "
174  << LowEnergyLimit() / MeV << " MeV - "
175  << HighEnergyLimit() / GeV << " GeV"
176  << G4endl;
177  }
178 
179  }
180 
181 
182  if(isInitialised) return;
184  isInitialised = true;
185 }
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:599
std::vector< G4Element * > G4ElementVector
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:592
G4bool IsMaster() const
Definition: G4VEmModel.hh:676
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
G4ParticleChangeForGamma * GetParticleChangeForGamma()
Definition: G4VEmModel.cc:121
const G4Material * GetMaterial() const
void G4PenelopeGammaConversionModel::InitialiseLocal ( const G4ParticleDefinition part,
G4VEmModel masterModel 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 189 of file G4PenelopeGammaConversionModel.cc.

References fParticle, G4cout, and G4endl.

191 {
192  if (verboseLevel > 3)
193  G4cout << "Calling G4PenelopeGammaConversionModel::InitialiseLocal()" << G4endl;
194 
195  //
196  //Check that particle matches: one might have multiple master models (e.g.
197  //for e+ and e-).
198  //
199  if (part == fParticle)
200  {
201  //Get the const table pointers from the master to the workers
202  const G4PenelopeGammaConversionModel* theModel =
203  static_cast<G4PenelopeGammaConversionModel*> (masterModel);
204 
205  //Copy pointers to the data tables
206  fEffectiveCharge = theModel->fEffectiveCharge;
207  fMaterialInvScreeningRadius = theModel->fMaterialInvScreeningRadius;
208  fScreeningFunction = theModel->fScreeningFunction;
209  logAtomicCrossSection = theModel->logAtomicCrossSection;
210 
211  //Same verbosity for all workers, as the master
212  verboseLevel = theModel->verboseLevel;
213  }
214 
215  return;
216 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4PenelopeGammaConversionModel::SampleSecondaries ( std::vector< G4DynamicParticle * > *  fvect,
const G4MaterialCutsCouple couple,
const G4DynamicParticle aDynamicGamma,
G4double  tmin,
G4double  maxEnergy 
)
virtual

Implements G4VEmModel.

Definition at line 285 of file G4PenelopeGammaConversionModel.cc.

References G4InuclParticleNames::electron, G4Electron::Electron(), python.hepunit::electron_mass_c2, F00, python.hepunit::fine_structure_const, fParticleChange, fStopAndKill, G4cout, G4endl, G4Exception(), G4UniformRand, G4DynamicParticle::GetKineticEnergy(), G4MaterialCutsCouple::GetMaterial(), G4DynamicParticle::GetMomentumDirection(), G4Material::GetName(), JustWarning, python.hepunit::keV, G4INCL::Math::max(), G4InuclParticleNames::positron, G4Positron::Positron(), G4VParticleChange::ProposeLocalEnergyDeposit(), G4VParticleChange::ProposeTrackStatus(), CLHEP::Hep3Vector::rotateUz(), G4ParticleChangeForGamma::SetProposedKineticEnergy(), python.hepunit::twopi, and G4TemplateAutoLock< M, L, U >::unlock().

290 {
291  //
292  // Penelope model v2008.
293  // Final state is sampled according to the Bethe-Heitler model with Coulomb
294  // corrections, according to the semi-empirical model of
295  // J. Baro' et al., Radiat. Phys. Chem. 44 (1994) 531.
296  //
297  // The model uses the high energy Coulomb correction from
298  // H. Davies et al., Phys. Rev. 93 (1954) 788
299  // and atomic screening radii tabulated from
300  // J.H. Hubbel et al., J. Phys. Chem. Ref. Data 9 (1980) 1023
301  // for Z= 1 to 92.
302  //
303  if (verboseLevel > 3)
304  G4cout << "Calling SamplingSecondaries() of G4PenelopeGammaConversionModel" << G4endl;
305 
306  G4double photonEnergy = aDynamicGamma->GetKineticEnergy();
307 
308  // Always kill primary
311 
312  if (photonEnergy <= fIntrinsicLowEnergyLimit)
313  {
315  return ;
316  }
317 
318  G4ParticleMomentum photonDirection = aDynamicGamma->GetMomentumDirection();
319  const G4Material* mat = couple->GetMaterial();
320 
321  //Either Initialize() was not called, or we are in a slave and InitializeLocal() was
322  //not invoked
323  if (!fEffectiveCharge)
324  {
325  //create a **thread-local** version of the table. Used only for G4EmCalculator and
326  //Unit Tests
327  fLocalTable = true;
328  fEffectiveCharge = new std::map<const G4Material*,G4double>;
329  fMaterialInvScreeningRadius = new std::map<const G4Material*,G4double>;
330  fScreeningFunction = new std::map<const G4Material*,std::pair<G4double,G4double> >;
331  }
332 
333  if (!fEffectiveCharge->count(mat))
334  {
335  //If we are here, it means that Initialize() was inkoved, but the MaterialTable was
336  //not filled up. This can happen in a UnitTest or via G4EmCalculator
337  if (verboseLevel > 0)
338  {
339  //Issue a G4Exception (warning) only in verbose mode
341  ed << "Unable to allocate the EffectiveCharge data for " <<
342  mat->GetName() << G4endl;
343  ed << "This can happen only in Unit Tests" << G4endl;
344  G4Exception("G4PenelopeGammaConversionModel::SampleSecondaries()",
345  "em2019",JustWarning,ed);
346  }
347  //protect file reading via autolock
348  G4AutoLock lock(&PenelopeGammaConversionModelMutex);
349  InitializeScreeningFunctions(mat);
350  lock.unlock();
351  }
352 
353  // eps is the fraction of the photon energy assigned to e- (including rest mass)
354  G4double eps = 0;
355  G4double eki = electron_mass_c2/photonEnergy;
356 
357  //Do it fast for photon energy < 1.1 MeV (close to threshold)
358  if (photonEnergy < fSmallEnergy)
359  eps = eki + (1.0-2.0*eki)*G4UniformRand();
360  else
361  {
362  //Complete calculation
363  G4double effC = fEffectiveCharge->find(mat)->second;
364  G4double alz = effC*fine_structure_const;
365  G4double T = std::sqrt(2.0*eki);
366  G4double F00=(-1.774-1.210e1*alz+1.118e1*alz*alz)*T
367  +(8.523+7.326e1*alz-4.441e1*alz*alz)*T*T
368  -(1.352e1+1.211e2*alz-9.641e1*alz*alz)*T*T*T
369  +(8.946+6.205e1*alz-6.341e1*alz*alz)*T*T*T*T;
370 
371  G4double F0b = fScreeningFunction->find(mat)->second.second;
372  G4double g0 = F0b + F00;
373  G4double invRad = fMaterialInvScreeningRadius->find(mat)->second;
374  G4double bmin = 4.0*eki/invRad;
375  std::pair<G4double,G4double> scree = GetScreeningFunctions(bmin);
376  G4double g1 = scree.first;
377  G4double g2 = scree.second;
378  G4double g1min = g1+g0;
379  G4double g2min = g2+g0;
380  G4double xr = 0.5-eki;
381  G4double a1 = 2.*g1min*xr*xr/3.;
382  G4double p1 = a1/(a1+g2min);
383 
384  G4bool loopAgain = false;
385  //Random sampling of eps
386  do{
387  loopAgain = false;
388  if (G4UniformRand() <= p1)
389  {
390  G4double ru2m1 = 2.0*G4UniformRand()-1.0;
391  if (ru2m1 < 0)
392  eps = 0.5-xr*std::pow(std::abs(ru2m1),1./3.);
393  else
394  eps = 0.5+xr*std::pow(ru2m1,1./3.);
395  G4double B = eki/(invRad*eps*(1.0-eps));
396  scree = GetScreeningFunctions(B);
397  g1 = scree.first;
398  g1 = std::max(g1+g0,0.);
399  if (G4UniformRand()*g1min > g1)
400  loopAgain = true;
401  }
402  else
403  {
404  eps = eki+2.0*xr*G4UniformRand();
405  G4double B = eki/(invRad*eps*(1.0-eps));
406  scree = GetScreeningFunctions(B);
407  g2 = scree.second;
408  g2 = std::max(g2+g0,0.);
409  if (G4UniformRand()*g2min > g2)
410  loopAgain = true;
411  }
412  }while(loopAgain);
413 
414  }
415  if (verboseLevel > 4)
416  G4cout << "Sampled eps = " << eps << G4endl;
417 
418  G4double electronTotEnergy = eps*photonEnergy;
419  G4double positronTotEnergy = (1.0-eps)*photonEnergy;
420 
421  // Scattered electron (positron) angles. ( Z - axis along the parent photon)
422 
423  //electron kinematics
424  G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
425  G4double costheta_el = G4UniformRand()*2.0-1.0;
426  G4double kk = std::sqrt(electronKineEnergy*(electronKineEnergy+2.*electron_mass_c2));
427  costheta_el = (costheta_el*electronTotEnergy+kk)/(electronTotEnergy+costheta_el*kk);
428  G4double phi_el = twopi * G4UniformRand() ;
429  G4double dirX_el = std::sqrt(1.-costheta_el*costheta_el) * std::cos(phi_el);
430  G4double dirY_el = std::sqrt(1.-costheta_el*costheta_el) * std::sin(phi_el);
431  G4double dirZ_el = costheta_el;
432 
433  //positron kinematics
434  G4double positronKineEnergy = std::max(0.,positronTotEnergy - electron_mass_c2) ;
435  G4double costheta_po = G4UniformRand()*2.0-1.0;
436  kk = std::sqrt(positronKineEnergy*(positronKineEnergy+2.*electron_mass_c2));
437  costheta_po = (costheta_po*positronTotEnergy+kk)/(positronTotEnergy+costheta_po*kk);
438  G4double phi_po = twopi * G4UniformRand() ;
439  G4double dirX_po = std::sqrt(1.-costheta_po*costheta_po) * std::cos(phi_po);
440  G4double dirY_po = std::sqrt(1.-costheta_po*costheta_po) * std::sin(phi_po);
441  G4double dirZ_po = costheta_po;
442 
443  // Kinematics of the created pair:
444  // the electron and positron are assumed to have a symetric angular
445  // distribution with respect to the Z axis along the parent photon
446  G4double localEnergyDeposit = 0. ;
447 
448  if (electronKineEnergy > 0.0)
449  {
450  G4ThreeVector electronDirection ( dirX_el, dirY_el, dirZ_el);
451  electronDirection.rotateUz(photonDirection);
453  electronDirection,
454  electronKineEnergy);
455  fvect->push_back(electron);
456  }
457  else
458  {
459  localEnergyDeposit += electronKineEnergy;
460  electronKineEnergy = 0;
461  }
462 
463  //Generate the positron. Real particle in any case, because it will annihilate. If below
464  //threshold, produce it at rest
465  if (positronKineEnergy < 0.0)
466  {
467  localEnergyDeposit += positronKineEnergy;
468  positronKineEnergy = 0; //produce it at rest
469  }
470  G4ThreeVector positronDirection(dirX_po,dirY_po,dirZ_po);
471  positronDirection.rotateUz(photonDirection);
473  positronDirection, positronKineEnergy);
474  fvect->push_back(positron);
475 
476  //Add rest of energy to the local energy deposit
477  fParticleChange->ProposeLocalEnergyDeposit(localEnergyDeposit);
478 
479  if (verboseLevel > 1)
480  {
481  G4cout << "-----------------------------------------------------------" << G4endl;
482  G4cout << "Energy balance from G4PenelopeGammaConversion" << G4endl;
483  G4cout << "Incoming photon energy: " << photonEnergy/keV << " keV" << G4endl;
484  G4cout << "-----------------------------------------------------------" << G4endl;
485  if (electronKineEnergy)
486  G4cout << "Electron (explicitely produced) " << electronKineEnergy/keV << " keV"
487  << G4endl;
488  if (positronKineEnergy)
489  G4cout << "Positron (not at rest) " << positronKineEnergy/keV << " keV" << G4endl;
490  G4cout << "Rest masses of e+/- " << 2.0*electron_mass_c2/keV << " keV" << G4endl;
491  if (localEnergyDeposit)
492  G4cout << "Local energy deposit " << localEnergyDeposit/keV << " keV" << G4endl;
493  G4cout << "Total final state: " << (electronKineEnergy+positronKineEnergy+
494  localEnergyDeposit+2.0*electron_mass_c2)/keV <<
495  " keV" << G4endl;
496  G4cout << "-----------------------------------------------------------" << G4endl;
497  }
498  if (verboseLevel > 0)
499  {
500  G4double energyDiff = std::fabs(electronKineEnergy+positronKineEnergy+
501  localEnergyDeposit+2.0*electron_mass_c2-photonEnergy);
502  if (energyDiff > 0.05*keV)
503  G4cout << "Warning from G4PenelopeGammaConversion: problem with energy conservation: "
504  << (electronKineEnergy+positronKineEnergy+
505  localEnergyDeposit+2.0*electron_mass_c2)/keV
506  << " keV (final) vs. " << photonEnergy/keV << " keV (initial)" << G4endl;
507  }
508 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetKineticEnergy() const
#define F00
const G4String & GetName() const
Definition: G4Material.hh:176
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4ThreeVector & GetMomentumDirection() const
float electron_mass_c2
Definition: hepunit.py:274
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4Positron * Positron()
Definition: G4Positron.cc:94
T max(const T t1, const T t2)
brief Return the largest of the two arguments
static G4Electron * Electron()
Definition: G4Electron.cc:94
void SetProposedKineticEnergy(G4double proposedKinEnergy)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
const G4Material * GetMaterial() const
void G4PenelopeGammaConversionModel::SetVerbosityLevel ( G4int  lev)
inline

Definition at line 83 of file G4PenelopeGammaConversionModel.hh.

83 {verboseLevel = lev;};

Field Documentation

const G4ParticleDefinition* G4PenelopeGammaConversionModel::fParticle
protected

Definition at line 88 of file G4PenelopeGammaConversionModel.hh.

Referenced by Initialise(), and InitialiseLocal().

G4ParticleChangeForGamma* G4PenelopeGammaConversionModel::fParticleChange
protected

Definition at line 84 of file G4PenelopeGammaConversionModel.hh.

Referenced by Initialise(), and SampleSecondaries().


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