42:
G4VEmModel(nam),smallEnergy(2.*MeV),isInitialised(false),maxZ(99)
46 lowEnergyLimit = 2.0*electron_mass_c2;
47 data.resize(maxZ+1,0);
57 G4cout <<
"G4LivermoreGammaConversionModel is constructed " <<
G4endl;
65 for(
G4int i=0; i<=maxZ; ++i) {
delete data[i]; }
76 G4cout <<
"Calling Initialise() of G4LivermoreGammaConversionModel." <<
G4endl
89 char* path = getenv(
"G4LEDATA");
95 for(
G4int i=0; i<numOfCouples; ++i)
102 for (
G4int j=0; j<nelm; ++j)
105 G4int Z = (
G4int)(*theElementVector)[j]->GetZ();
107 else if(Z > maxZ) { Z = maxZ; }
108 if(!data[Z]) { ReadData(Z, path); }
113 if(isInitialised) {
return; }
115 isInitialised =
true;
120void G4LivermoreGammaConversionModel::ReadData(
size_t Z,
const char* path)
122 if (verboseLevel > 1)
124 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
128 if(data[Z]) {
return; }
130 const char* datadir = path;
134 datadir = getenv(
"G4LEDATA");
137 G4Exception(
"G4LivermoreGammaConversionModel::ReadData()",
139 "Environment variable G4LEDATA not defined");
149 data[Z] ->SetSpline(
true);
152 std::ostringstream ost;
153 ost << datadir <<
"/livermore/pair/pp-cs-" << Z <<
".dat";
154 std::ifstream fin(ost.str().c_str());
159 ed <<
"G4LivermoreGammaConversionModel data file <" << ost.str().c_str()
160 <<
"> is not opened!" <<
G4endl;
161 G4Exception(
"G4LivermoreGammaConversionModel::ReadData()",
163 ed,
"G4LEDATA version should be G4EMLOW6.27 or later.");
170 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str()
171 <<
" is opened by G4LivermoreGammaConversionModel" <<
G4endl;}
173 data[Z]->Retrieve(fin,
true);
187 if (verboseLevel > 1)
189 G4cout <<
"Calling ComputeCrossSectionPerAtom() of G4LivermoreGammaConversionModel"
193 if (GammaEnergy < lowEnergyLimit) {
return 0.0; }
199 if(intZ < 1 || intZ > maxZ) {
return xs; }
206 char* path = getenv(
"G4LEDATA");
207 ReadData(intZ, path);
209 if(!pv) {
return xs; }
212 xs = pv->
Value(GammaEnergy);
217 G4cout <<
"****** DEBUG: tcs value for Z=" << Z <<
" at energy (MeV)=" << GammaEnergy/MeV <<
G4endl;
218 G4cout <<
" cs (Geant4 internal unit)=" << xs <<
G4endl;
219 G4cout <<
" -> first cs value in EADL data file (iu) =" << (*pv)[0] <<
G4endl;
220 G4cout <<
" -> last cs value in EADL data file (iu) =" << (*pv)[n] <<
G4endl;
221 G4cout <<
"*********************************************************" <<
G4endl;
231 std::vector<G4DynamicParticle*>* fvect,
247 if (verboseLevel > 1)
248 G4cout <<
"Calling SampleSecondaries() of G4LivermoreGammaConversionModel" <<
G4endl;
254 G4double epsilon0Local = electron_mass_c2 / photonEnergy ;
257 if (photonEnergy < smallEnergy )
259 epsilon = epsilon0Local + (0.5 - epsilon0Local) *
G4UniformRand();
270 G4cout <<
"G4LivermoreGammaConversionModel::SampleSecondaries - element = 0"
277 G4cout <<
"G4LivermoreGammaConversionModel::SampleSecondaries - ionisation = 0"
284 if (photonEnergy > 50. * MeV) fZ += 8. * (element->
GetfCoulomb());
288 G4double screenMax = std::exp ((42.24 - fZ)/8.368) - 0.952 ;
289 G4double screenMin = std::min(4.*screenFactor,screenMax) ;
292 G4double epsilon1 = 0.5 - 0.5 * std::sqrt(1. - screenMin / screenMax) ;
293 G4double epsilonMin = std::max(epsilon0Local,epsilon1);
294 G4double epsilonRange = 0.5 - epsilonMin ;
300 G4double f10 = ScreenFunction1(screenMin) - fZ;
301 G4double f20 = ScreenFunction2(screenMin) - fZ;
302 G4double normF1 = std::max(f10 * epsilonRange * epsilonRange,0.);
303 G4double normF2 = std::max(1.5 * f20,0.);
309 epsilon = 0.5 - epsilonRange * std::pow(
G4UniformRand(), 0.333333) ;
310 screen = screenFactor / (epsilon * (1. - epsilon));
311 gReject = (ScreenFunction1(screen) - fZ) / f10 ;
316 screen = screenFactor / (epsilon * (1 - epsilon));
317 gReject = (ScreenFunction2(screen) - fZ) / f20 ;
330 electronTotEnergy = (1. - epsilon) * photonEnergy;
331 positronTotEnergy = epsilon * photonEnergy;
335 positronTotEnergy = (1. - epsilon) * photonEnergy;
336 electronTotEnergy = epsilon * photonEnergy;
358 G4double thetaEle = u*electron_mass_c2/electronTotEnergy;
359 G4double thetaPos = u*electron_mass_c2/positronTotEnergy;
362 G4double dxEle= std::sin(thetaEle)*std::cos(phi),dyEle= std::sin(thetaEle)*std::sin(phi),dzEle=std::cos(thetaEle);
363 G4double dxPos=-std::sin(thetaPos)*std::cos(phi),dyPos=-std::sin(thetaPos)*std::sin(phi),dzPos=std::cos(thetaPos);
370 G4double electronKineEnergy = std::max(0.,electronTotEnergy - electron_mass_c2) ;
373 electronDirection.
rotateUz(photonDirection);
380 G4double positronKineEnergy = std::max(0.,positronTotEnergy - electron_mass_c2) ;
383 positronDirection.
rotateUz(photonDirection);
390 fvect->push_back(particle1);
391 fvect->push_back(particle2);
402G4LivermoreGammaConversionModel::ScreenFunction1(
G4double screenVariable)
408 if (screenVariable > 1.)
409 value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
411 value = 42.392 - screenVariable * (7.796 - 1.961 * screenVariable);
419G4LivermoreGammaConversionModel::ScreenFunction2(
G4double screenVariable)
425 if (screenVariable > 1.)
426 value = 42.24 - 8.368 * std::log(screenVariable + 0.952);
428 value = 41.405 - screenVariable * (5.828 - 0.8945 * screenVariable);
std::vector< G4Element * > G4ElementVector
G4DLLIMPORT std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
G4double GetfCoulomb() const
G4IonisParamElm * GetIonisation() const
G4double GetlogZ3() const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
G4LivermoreGammaConversionModel(const G4ParticleDefinition *p=0, const G4String &nam="LivermoreConversion")
virtual ~G4LivermoreGammaConversionModel()
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
const G4Material * GetMaterial() const
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4double Value(G4double theEnergy)
size_t GetVectorLength() const
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void InitialiseElementSelectors(const G4ParticleDefinition *, const G4DataVector &)
void ProposeTrackStatus(G4TrackStatus status)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription