43 G4int G4LivermoreGammaConversionModel::maxZ = 99;
50 fParticleChange =
nullptr;
62 G4cout <<
"G4LivermoreGammaConversionModel is constructed " <<
G4endl;
71 for(
G4int i=0; i<maxZ; ++i) {
88 G4cout <<
"Calling Initialise() of G4LivermoreGammaConversionModel."
91 << LowEnergyLimit() /
MeV <<
" MeV - "
92 << HighEnergyLimit() /
GeV <<
" GeV"
99 InitialiseElementSelectors(particle, cuts);
102 char* path = getenv(
"G4LEDATA");
109 for(
G4int i=0; i<numOfCouples; ++i)
116 for (
G4int j=0; j<nelm; ++j)
120 else if(Z > maxZ) { Z = maxZ; }
121 if(!
data[Z]) { ReadData(Z, path); }
125 if(isInitialised) {
return; }
126 fParticleChange = GetParticleChangeForGamma();
127 isInitialised =
true;
145 return lowEnergyLimit;
150 void G4LivermoreGammaConversionModel::ReadData(
size_t Z,
const char* path)
152 if (verboseLevel > 1)
154 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
158 if(
data[Z]) {
return; }
160 const char* datadir = path;
164 datadir = getenv(
"G4LEDATA");
167 G4Exception(
"G4LivermoreGammaConversionModel::ReadData()",
169 "Environment variable G4LEDATA not defined");
180 std::ostringstream ost;
181 ost << datadir <<
"/livermore/pair/pp-cs-" << Z <<
".dat";
182 std::ifstream fin(ost.str().c_str());
187 ed <<
"G4LivermoreGammaConversionModel data file <" << ost.str().c_str()
188 <<
"> is not opened!" <<
G4endl;
189 G4Exception(
"G4LivermoreGammaConversionModel::ReadData()",
191 ed,
"G4LEDATA version should be G4EMLOW6.27 or later.");
198 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str()
199 <<
" is opened by G4LivermoreGammaConversionModel" <<
G4endl;}
201 data[
Z]->Retrieve(fin,
true);
205 data[
Z] ->SetSpline(
true);
217 if (verboseLevel > 1)
219 G4cout <<
"Calling ComputeCrossSectionPerAtom() of G4LivermoreGammaConversionModel"
223 if (GammaEnergy < lowEnergyLimit) {
return 0.0; }
229 if(intZ < 1 || intZ > maxZ) {
return xs; }
237 InitialiseForElement(0, intZ);
239 if(!pv) {
return xs; }
242 xs = pv->
Value(GammaEnergy);
247 G4cout <<
"****** DEBUG: tcs value for Z=" << Z <<
" at energy (MeV)="
249 G4cout <<
" cs (Geant4 internal unit)=" << xs <<
G4endl;
250 G4cout <<
" -> first cs value in EADL data file (iu) =" << (*pv)[0] <<
G4endl;
251 G4cout <<
" -> last cs value in EADL data file (iu) =" << (*pv)[
n] <<
G4endl;
252 G4cout <<
"*********************************************************" <<
G4endl;
262 std::vector<G4DynamicParticle*>* fvect,
278 if (verboseLevel > 1) {
279 G4cout <<
"Calling SampleSecondaries() of G4LivermoreGammaConversionModel"
290 if (photonEnergy < smallEnergy )
292 epsilon = epsilon0Local + (0.5 - epsilon0Local) *
G4UniformRand();
299 const G4Element* element = SelectRandomAtom(couple,particle,photonEnergy);
303 G4cout <<
"G4LivermoreGammaConversionModel::SampleSecondaries - element = 0"
310 G4cout <<
"G4LivermoreGammaConversionModel::SampleSecondaries - ionisation = 0"
317 if (photonEnergy > 50. *
MeV) fZ += 8. * (element->
GetfCoulomb());
325 G4double epsilon1 = 0.5 - 0.5 * std::sqrt(1. - screenMin / screenMax) ;
327 G4double epsilonRange = 0.5 - epsilonMin ;
333 G4double f10 = ScreenFunction1(screenMin) - fZ;
334 G4double f20 = ScreenFunction2(screenMin) - fZ;
342 epsilon = 0.5 - epsilonRange * std::pow(
G4UniformRand(), 0.333333) ;
343 screen = screenFactor / (epsilon * (1. -
epsilon));
344 gReject = (ScreenFunction1(screen) - fZ) / f10 ;
349 screen = screenFactor / (epsilon * (1 -
epsilon));
350 gReject = (ScreenFunction2(screen) - fZ) / f20 ;
363 electronTotEnergy = (1. -
epsilon) * photonEnergy;
364 positronTotEnergy = epsilon * photonEnergy;
368 positronTotEnergy = (1. -
epsilon) * photonEnergy;
369 electronTotEnergy = epsilon * photonEnergy;
395 G4double dxEle= std::sin(thetaEle)*std::cos(phi),dyEle= std::sin(thetaEle)*std::sin(phi),dzEle=std::cos(thetaEle);
396 G4double dxPos=-std::sin(thetaPos)*std::cos(phi),dyPos=-std::sin(thetaPos)*std::sin(phi),dzPos=std::cos(thetaPos);
406 electronDirection.
rotateUz(photonDirection);
416 positronDirection.
rotateUz(photonDirection);
423 fvect->push_back(particle1);
424 fvect->push_back(particle2);
427 fParticleChange->SetProposedKineticEnergy(0.);
435 G4LivermoreGammaConversionModel::ScreenFunction1(
G4double screenVariable)
441 if (screenVariable > 1.)
442 value = 42.24 - 8.368 *
G4Log(screenVariable + 0.952);
444 value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
452 G4LivermoreGammaConversionModel::ScreenFunction2(
G4double screenVariable)
458 if (screenVariable > 1.)
459 value = 42.24 - 8.368 *
G4Log(screenVariable + 0.952);
461 value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
475 G4AutoLock l(&LivermoreGammaConversionModelMutex);
478 if(!
data[Z]) { ReadData(Z); }
virtual G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double)
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
std::vector< G4Element * > G4ElementVector
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
G4double GetfCoulomb() const
G4ParticleDefinition * GetDefinition() const
size_t GetVectorLength() const
const G4ElementVector * GetElementVector() const
#define G4MUTEX_INITIALIZER
static constexpr double twopi
static constexpr double electron_mass_c2
const XML_Char const XML_Char * data
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
size_t GetTableSize() const
G4LivermoreGammaConversionModel(const G4ParticleDefinition *p=0, const G4String &nam="LivermoreConversion")
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
virtual ~G4LivermoreGammaConversionModel()
std::vector< G4EmElementSelector * > * GetElementSelectors()
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double GetlogZ3() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4IonisParamElm * GetIonisation() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
static constexpr double GeV
static G4Electron * Electron()
static constexpr double MeV
size_t GetNumberOfElements() const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
double epsilon(double density, double temperature)
const G4Material * GetMaterial() const