43 G4int G4LivermoreNuclearGammaConversionModel::maxZ = 100;
62 G4cout <<
"G4LivermoreNuclearGammaConversionModel is constructed " <<
G4endl;
71 for(
G4int i=0; i<maxZ; ++i) {
89 G4cout <<
"Calling Initialise() of G4LivermoreNuclearGammaConversionModel."
92 << LowEnergyLimit() /
MeV <<
" MeV - "
93 << HighEnergyLimit() /
GeV <<
" GeV"
102 InitialiseElementSelectors(particle, cuts);
106 char* path = getenv(
"G4LEDATA");
113 for(
G4int i=0; i<numOfCouples; ++i)
120 for (
G4int j=0; j<nelm; ++j)
124 else if(Z > maxZ) { Z = maxZ; }
125 if(!
data[Z]) { ReadData(Z, path); }
129 if(isInitialised) {
return; }
130 fParticleChange = GetParticleChangeForGamma();
131 isInitialised =
true;
149 return lowEnergyLimit;
154 void G4LivermoreNuclearGammaConversionModel::ReadData(
size_t Z,
const char* path)
156 if (verboseLevel > 1)
158 G4cout <<
"Calling ReadData() of G4LivermoreNuclearGammaConversionModel"
163 if(
data[Z]) {
return; }
165 const char* datadir = path;
169 datadir = getenv(
"G4LEDATA");
172 G4Exception(
"G4LivermoreNuclearGammaConversionModel::ReadData()",
174 "Environment variable G4LEDATA not defined");
185 std::ostringstream ost;
186 ost << datadir <<
"livermore/pairdata/pp-pair-cs-" << Z <<
".dat";
187 std::ifstream fin(ost.str().c_str());
192 ed <<
"G4LivermoreNuclearGammaConversionModel data file <" << ost.str().c_str()
193 <<
"> is not opened!" <<
G4endl;
194 G4Exception(
"G4LivermoreNuclearGammaConversionModel::ReadData()",
196 ed,
"G4LEDATA version should be G4EMLOW6.27 or later.");
203 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str()
204 <<
" is opened by G4LivermoreNuclearGammaConversionModel" <<
G4endl;}
206 data[
Z]->Retrieve(fin,
true);
210 data[
Z] ->SetSpline(
true);
222 if (verboseLevel > 1)
224 G4cout <<
"Calling ComputeCrossSectionPerAtom() of G4LivermoreNuclearGammaConversionModel"
228 if (GammaEnergy < lowEnergyLimit) {
return 0.0; }
234 if(intZ < 1 || intZ > maxZ) {
return xs; }
242 InitialiseForElement(0, intZ);
244 if(!pv) {
return xs; }
247 xs = pv->
Value(GammaEnergy);
252 G4cout <<
"****** DEBUG: tcs value for Z=" << Z <<
" at energy (MeV)="
254 G4cout <<
" cs (Geant4 internal unit)=" << xs <<
G4endl;
255 G4cout <<
" -> first cs value in EADL data file (iu) =" << (*pv)[0] <<
G4endl;
256 G4cout <<
" -> last cs value in EADL data file (iu) =" << (*pv)[
n] <<
G4endl;
257 G4cout <<
"*********************************************************" <<
G4endl;
267 std::vector<G4DynamicParticle*>* fvect,
283 if (verboseLevel > 1) {
284 G4cout <<
"Calling SampleSecondaries() of G4LivermoreNuclearGammaConversionModel"
295 if (photonEnergy < smallEnergy )
297 epsilon = epsilon0Local + (0.5 - epsilon0Local) *
G4UniformRand();
304 const G4Element* element = SelectRandomAtom(couple,particle,photonEnergy);
308 G4cout <<
"G4LivermoreNuclearGammaConversionModel::SampleSecondaries - element = 0"
315 G4cout <<
"G4LivermoreNuclearGammaConversionModel::SampleSecondaries - ionisation = 0"
322 if (photonEnergy > 50. *
MeV) fZ += 8. * (element->
GetfCoulomb());
330 G4double epsilon1 = 0.5 - 0.5 * std::sqrt(1. - screenMin / screenMax) ;
332 G4double epsilonRange = 0.5 - epsilonMin ;
338 G4double f10 = ScreenFunction1(screenMin) - fZ;
339 G4double f20 = ScreenFunction2(screenMin) - fZ;
347 epsilon = 0.5 - epsilonRange * std::pow(
G4UniformRand(), 0.333333) ;
348 screen = screenFactor / (epsilon * (1. -
epsilon));
349 gReject = (ScreenFunction1(screen) - fZ) / f10 ;
354 screen = screenFactor / (epsilon * (1 -
epsilon));
355 gReject = (ScreenFunction2(screen) - fZ) / f20 ;
368 electronTotEnergy = (1. -
epsilon) * photonEnergy;
369 positronTotEnergy = epsilon * photonEnergy;
373 positronTotEnergy = (1. -
epsilon) * photonEnergy;
374 electronTotEnergy = epsilon * photonEnergy;
400 G4double dxEle= std::sin(thetaEle)*std::cos(phi),dyEle= std::sin(thetaEle)*std::sin(phi),dzEle=std::cos(thetaEle);
401 G4double dxPos=-std::sin(thetaPos)*std::cos(phi),dyPos=-std::sin(thetaPos)*std::sin(phi),dzPos=std::cos(thetaPos);
411 electronDirection.
rotateUz(photonDirection);
421 positronDirection.
rotateUz(photonDirection);
428 fvect->push_back(particle1);
429 fvect->push_back(particle2);
432 fParticleChange->SetProposedKineticEnergy(0.);
440 G4LivermoreNuclearGammaConversionModel::ScreenFunction1(
G4double screenVariable)
446 if (screenVariable > 1.)
447 value = 42.24 - 8.368 *
G4Log(screenVariable + 0.952);
449 value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
457 G4LivermoreNuclearGammaConversionModel::ScreenFunction2(
G4double screenVariable)
463 if (screenVariable > 1.)
464 value = 42.24 - 8.368 *
G4Log(screenVariable + 0.952);
466 value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
480 G4AutoLock l(&LivermoreNuclearGammaConversionModelMutex);
483 if(!
data[Z]) { ReadData(Z); }
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
virtual ~G4LivermoreNuclearGammaConversionModel()
std::vector< G4Element * > G4ElementVector
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
G4LivermoreNuclearGammaConversionModel(const G4ParticleDefinition *p=0, const G4String &nam="LivermoreNuclearConversion")
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
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
size_t GetTableSize() const
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
std::vector< G4EmElementSelector * > * GetElementSelectors()
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double GetlogZ3() const
virtual G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double G4Log(G4double x)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
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
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
static constexpr double GeV
static G4Electron * Electron()
static constexpr double MeV
size_t GetNumberOfElements() const
double epsilon(double density, double temperature)
const G4Material * GetMaterial() const