Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PairProductionRelModel.hh 106628 2017-10-17 06:25:38Z gcosmo $
// $Id: G4PairProductionRelModel.hh 110527 2018-05-29 06:09:58Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -37,6 +37,10 @@
// Creation date: 02.04.2009
//
// Modifications:
// 28-05-18 New version with improved screening function approximation, improved
// LPM function approximation, efficiency, documentation and cleanup.
// Corrected call to selecting target atom in the final state sampling.
// (M. Novak)
//
// Class Description:
//
@@ -53,11 +57,12 @@
#include <CLHEP/Units/PhysicalConstants.h>
#include "G4VEmModel.hh"
#include "G4PhysicsTable.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
#include "G4Pow.hh"
#include <vector>
class G4ParticleChangeForGamma;
class G4PairProductionRelModel : public G4VEmModel
@@ -66,15 +71,15 @@ class G4PairProductionRelModel : public G4VEmModel
public:
explicit G4PairProductionRelModel(const G4ParticleDefinition* p = nullptr,
const G4String& nam = "BetheHeitlerLPM");
const G4String& nam = "BetheHeitlerLPM");
virtual ~G4PairProductionRelModel();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector&) override;
const G4DataVector&) override;
virtual void InitialiseLocal(const G4ParticleDefinition*,
G4VEmModel* masterModel) override;
G4VEmModel* masterModel) override;
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
@@ -85,182 +90,160 @@ public:
G4double emax=DBL_MAX) override;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy) override;
virtual void SetupForMaterial(const G4ParticleDefinition*,
const G4Material*,G4double) override;
// * fast inline functions *
inline void SetCurrentElement(G4double Z);
// set / get methods
inline void SetLPMconstant(G4double val);
inline G4double LPMconstant() const;
inline void SetLPMflag(G4bool);
inline G4bool LPMflag() const;
inline void SetLPMflag(G4bool val) { fIsUseLPMCorrection = val; }
inline G4bool LPMflag() const { return fIsUseLPMCorrection; }
protected:
// screening functions
inline G4double Phi1(G4double delta) const;
inline G4double Phi2(G4double delta) const;
inline G4double ScreenFunction1(G4double ScreenVariable);
inline G4double ScreenFunction2(G4double ScreenVariable);
inline G4double DeltaMax() const;
inline G4double DeltaMin(G4double) const;
// for evaluating screening related functions
inline void ComputePhi12(const G4double delta, G4double &phi1, G4double &phi2);
inline G4double ScreenFunction1(const G4double delta);
inline G4double ScreenFunction2(const G4double delta);
inline void ScreenFunction12(const G4double delta, G4double &f1, G4double &f2);
// helper methods for cross-section computation under different approximations
G4double ComputeXSectionPerAtom(G4double gammaEnergy, G4double Z);
G4double ComputeDXSectionPerAtom(G4double eplusEnergy, G4double gammaEnergy,
G4double Z);
G4double ComputeRelDXSectionPerAtom(G4double eplusEnergy, G4double gammaEnergy,
G4double Z);
// lpm functions
void CalcLPMFunctions(G4double k, G4double eplus);
G4double ComputeXSectionPerAtom(G4double totalEnergy, G4double Z);
private:
G4double ComputeDXSectionPerAtom(G4double eplusEnergy, G4double totalEnergy, G4double Z);
G4double ComputeRelDXSectionPerAtom(G4double eplusEnergy, G4double totalEnergy, G4double Z);
// for creating some data structure per Z with often used comp. intensive data
void InitialiseElementData();
struct ElementData {
G4double fLogZ13;
G4double fCoulomb;
G4double fLradEl;
G4double fDeltaFactor;
G4double fDeltaMax;
G4double fEtaValue;
G4double fLPMVarS1Cond;
G4double fLPMILVarS1Cond;
};
// for precomputing comp. intensive parts of LPM suppression functions and
// using them at run-time
void InitLPMFunctions();
void ComputeLPMGsPhis(G4double &funcGS, G4double &funcPhiS,
const G4double varShat);
void GetLPMFunctions(G4double &lpmGs, G4double &lpmPhis, const G4double sval);
void ComputeLPMfunctions(G4double &fXiS, G4double &fGS, G4double &fPhiS,
const G4double eps, const G4double egamma,
const G4int izet);
struct LPMFuncs {
LPMFuncs() : fIsInitialized(false), fISDelta(100.), fSLimit(2.) {}
G4bool fIsInitialized;
G4double fISDelta;
G4double fSLimit;
std::vector<G4double> fLPMFuncG;
std::vector<G4double> fLPMFuncPhi;
};
private:
// hide assignment operator
G4PairProductionRelModel & operator=
(const G4PairProductionRelModel &right) = delete;
G4PairProductionRelModel(const G4PairProductionRelModel&) = delete;
G4Pow* g4calc;
G4ParticleDefinition* theGamma;
G4ParticleDefinition* theElectron;
G4ParticleDefinition* thePositron;
G4ParticleChangeForGamma* fParticleChange;
G4double fLPMconstant;
G4bool fLPMflag;
// cash
G4double z13, z23, lnZ;
G4double Fel, Finel, fCoulomb;
G4double currentZ;
// LPM effect
G4double lpmEnergy;
G4double xiLPM, phiLPM, gLPM;
// consts
G4bool use_completescreening;
static const G4double xgi[8], wgi[8];
static const G4double Fel_light[5];
static const G4double Finel_light[5];
static const G4double facFel;
static const G4double facFinel;
static const G4double preS1, logTwo, xsfactor, Egsmall, Eghigh;
protected:
static const G4int gMaxZet;
//
static const G4double gLPMconstant;
//
static const G4double gXGL[8];
static const G4double gWGL[8];
static const G4double gFelLowZet[8];
static const G4double gFinelLowZet[8];
//
static const G4double gXSecFactor;
static const G4double gEgLPMActivation;
//
static std::vector<ElementData*> gElementData;
static LPMFuncs gLPMFuncs;
//
G4bool fIsUseLPMCorrection;
G4bool fIsUseCompleteScreening;
//
G4double fLPMEnergy;
//
G4Pow* fG4Calc;
G4ParticleDefinition* fTheGamma;
G4ParticleDefinition* fTheElectron;
G4ParticleDefinition* fThePositron;
G4ParticleChangeForGamma* fParticleChange;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// Bethe screening functions for the elastic (coherent) scattering:
// Bethe's phi1, phi2 coherent screening functions were computed numerically
// by using (the universal) atomic form factors computed based on the Thomas-
// Fermi model of the atom (using numerical solution of the Thomas-Fermi
// screening function instead of Moliere's analytical approximation). The
// numerical results can be well approximated (better than Butcher & Messel
// especially near the delta=1 limit) by:
// ## if delta <= 1.4
// phi1(delta) = 20.806 - delta*(3.190 - 0.5710*delta)
// phi2(delta) = 20.234 - delta*(2.126 - 0.0903*delta)
// ## if delta > 1.4
// phi1(delta) = phi2(delta) = 21.0190 - 4.145*ln(delta + 0.958)
// with delta = 136mc^2kZ^{-1/3}/[E(Eg-E)] = 136Z^{-1/3}eps0/[eps(1-eps)] where
// Eg is the initial photon energy, E is the total energy transferred to one of
// the e-/e+ pair, eps0 = mc^2/Eg and eps = E/Eg.
inline
void G4PairProductionRelModel::SetLPMconstant(G4double val)
void G4PairProductionRelModel::ComputePhi12(const G4double delta, G4double &phi1,
G4double &phi2)
{
fLPMconstant = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4double G4PairProductionRelModel::LPMconstant() const
{
return fLPMconstant;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void G4PairProductionRelModel::SetLPMflag(G4bool val)
{
fLPMflag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
G4bool G4PairProductionRelModel::LPMflag() const
{
return fLPMflag;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4PairProductionRelModel::SetCurrentElement(G4double Z)
{
if(Z != currentZ) {
currentZ = Z;
G4int iz = G4lrint(Z);
z13 = g4calc->Z13(iz);
z23 = z13*z13;
lnZ = g4calc->logZ(iz);
if (iz <= 4) {
Fel = Fel_light[iz];
Finel = Finel_light[iz] ;
if (delta > 1.4) {
phi1 = 21.0190 - 4.145*G4Log(delta + 0.958);
phi2 = phi1;
} else {
phi1 = 20.806 - delta*(3.190 - 0.5710*delta);
phi2 = 20.234 - delta*(2.126 - 0.0903*delta);
}
else {
Fel = facFel - lnZ/3. ;
Finel = facFinel - 2.*lnZ/3. ;
}
fCoulomb=GetCurrentElement()->GetfCoulomb();
}
// Compute the value of the screening function 3*PHI1(delta) - PHI2(delta):
inline G4double G4PairProductionRelModel::ScreenFunction1(const G4double delta)
{
return (delta > 1.4) ? 42.038 - 8.29*G4Log(delta + 0.958)
: 42.184 - delta*(7.444 - 1.623*delta);
}
// Compute the value of the screening function 1.5*PHI1(delta) +0.5*PHI2(delta):
inline G4double G4PairProductionRelModel::ScreenFunction2(const G4double delta)
{
return (delta > 1.4) ? 42.038 - 8.29*G4Log(delta + 0.958)
: 41.326 - delta*(5.848 - 0.902*delta);
}
// Same as ScreenFunction1 and ScreenFunction2 but computes them at once
inline void G4PairProductionRelModel::ScreenFunction12(const G4double delta,
G4double &f1, G4double &f2)
{
if (delta > 1.4) {
f1 = 42.038 - 8.29*G4Log(delta + 0.958);
f2 = f1;
} else {
f1 = 42.184 - delta*(7.444 - 1.623*delta);
f2 = 41.326 - delta*(5.848 - 0.902*delta);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4PairProductionRelModel::Phi1(G4double delta) const
{
return (delta > 1.)
? 21.12 - 4.184*G4Log(delta+0.952)
: 20.868 - delta*(3.242 - 0.625*delta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4PairProductionRelModel::Phi2(G4double delta) const
{
return (delta > 1.)
? 21.12 - 4.184*G4Log(delta+0.952)
: 20.209 - delta*(1.930 + 0.086*delta);
}
inline G4double G4PairProductionRelModel::ScreenFunction1(G4double ScreenVariable)
// compute the value of the screening function 3*PHI1 - PHI2
{
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 42.392 - ScreenVariable*(7.796 - 1.961*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4PairProductionRelModel::ScreenFunction2(G4double ScreenVariable)
// compute the value of the screening function 1.5*PHI1 + 0.5*PHI2
{
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 41.405 - ScreenVariable*(5.828 - 0.8945*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4PairProductionRelModel::DeltaMax() const
{
// k > 50 MeV
G4double FZ = 8.*(lnZ/3. + fCoulomb);
return G4Exp( (42.24-FZ)/8.368 ) + 0.952;
}
inline G4double G4PairProductionRelModel::DeltaMin(G4double k) const
{
return 544.*CLHEP::electron_mass_c2/(z13*k);
}
#endif