57 nShellLimit(100),fDeexcitationActive(false),isInitialised(false),
74 for(
G4int i=0; i<maxZ; ++i) {
76 fCrossSectionLE[i] = 0;
82 G4cout <<
"Livermore PhotoElectric is constructed "
83 <<
" nShellLimit= " << nShellLimit <<
G4endl;
94 for(
G4int i=0; i<maxZ; ++i) {
95 delete fCrossSection[i];
96 delete fCrossSectionLE[i];
106 if (verboseLevel > 2) {
107 G4cout <<
"Calling G4LivermorePhotoElectricModel::Initialise()" <<
G4endl;
110 char* path = getenv(
"G4LEDATA");
116 for(
G4int i=0; i<numOfCouples; ++i)
123 for (
G4int j=0; j<nelm; ++j)
125 G4int Z = (
G4int)(*theElementVector)[j]->GetZ();
127 else if(Z > maxZ) { Z = maxZ; }
128 if(!fCrossSection[Z]) { ReadData(Z, path); }
132 if (verboseLevel > 2) {
133 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
137 isInitialised =
true;
142 fDeexcitationActive =
false;
143 if(fAtomDeexcitation) {
144 fDeexcitationActive = fAtomDeexcitation->
IsFluoActive();
147 if (verboseLevel > 0) {
148 G4cout <<
"LivermorePhotoElectric model is initialized " <<
G4endl
161 if (verboseLevel > 3) {
162 G4cout <<
"G4LivermorePhotoElectricModel::Calling ComputeCrossSectionPerAtom()"
163 <<
" Z= " << ZZ <<
" R(keV)= " << energy/keV <<
G4endl;
169 if(Z < 1 || Z >= maxZ) {
return cs; }
172 if(!fCrossSection[Z]) {
173 char* path = getenv(
"G4LEDATA");
175 if(!fCrossSection[Z]) {
return cs; }
178 G4int idx = fNShells[Z]*6 - 4;
179 if (gammaEnergy <= (fParam[Z])[idx-1]) {
return cs; }
186 if(gammaEnergy >= (fParam[Z])[0]) {
188 cs = x1*((fParam[Z])[idx] + x1*(fParam[Z])[idx+1]
189 + x2*(fParam[Z])[idx+2] + x3*(fParam[Z])[idx+3]
190 + x4*(fParam[Z])[idx+4]);
192 }
else if(gammaEnergy >= (fParam[Z])[1]) {
193 cs = x3*(fCrossSection[Z])->
Value(gammaEnergy);
197 cs = x3*(fCrossSectionLE[Z])->
Value(gammaEnergy);
199 if (verboseLevel > 1) {
200 G4cout <<
"LivermorePhotoElectricModel: E(keV)= " << gammaEnergy/keV
201 <<
" Z= " << Z <<
" cross(barn)= " << cs/barn <<
G4endl;
210 std::vector<G4DynamicParticle*>* fvect,
217 if (verboseLevel > 3) {
218 G4cout <<
"G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
219 << gammaEnergy/keV <<
G4endl;
239 if(Z >= maxZ) { Z = maxZ-1; }
242 if(!fCrossSection[Z]) {
243 char* path = getenv(
"G4LEDATA");
245 if(!fCrossSection[Z]) {
253 size_t nn = fNShellsUsed[Z];
256 if(gammaEnergy >= (fParam[Z])[0]) {
261 G4int idx = nn*6 - 4;
265 + x2*(fParam[Z])[idx+2]
266 + x3*(fParam[Z])[idx+3]
267 + x4*(fParam[Z])[idx+4]);
268 for(shellIdx=0; shellIdx<nn; ++shellIdx) {
269 idx = shellIdx*6 + 2;
270 if(gammaEnergy > (fParam[Z])[idx-1]) {
271 G4double cs = (fParam[Z])[idx] + x1*(fParam[Z])[idx+1]
272 + x2*(fParam[Z])[idx+2] + x3*(fParam[Z])[idx+3]
273 + x4*(fParam[Z])[idx+4];
274 if(cs >= cs0) {
break; }
277 if(shellIdx >= nn) { shellIdx = nn-1; }
285 if(gammaEnergy >= (fParam[Z])[1]) {
286 cs *= (fCrossSection[Z])->
Value(gammaEnergy);
288 cs *= (fCrossSectionLE[Z])->
Value(gammaEnergy);
291 for(
size_t j=0; j<nn; ++j) {
293 if(gammaEnergy > (fParam[Z])[6*shellIdx+1]) {
296 if(cs <= 0.0 || j+1 == nn) {
break; }
301 G4double bindingEnergy = (fParam[Z])[shellIdx*6 + 1];
310 if(fDeexcitationActive && shellIdx + 1 == nn) {
317 if(gammaEnergy < bindingEnergy) {
323 G4double eKineticEnergy = gammaEnergy - bindingEnergy;
337 fvect->push_back(electron);
343 size_t nbefore = fvect->size();
346 size_t nafter = fvect->size();
347 if(nafter > nbefore) {
348 for (
size_t j=nbefore; j<nafter; ++j) {
349 edep -= ((*fvect)[j])->GetKineticEnergy();
363G4LivermorePhotoElectricModel::ReadData(
G4int Z,
const char* path)
365 if (verboseLevel > 1)
367 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
371 if(fCrossSection[Z]) {
return; }
373 const char* datadir = path;
377 datadir = getenv(
"G4LEDATA");
380 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
382 "Environment variable G4LEDATA not defined");
391 std::ostringstream ost;
392 ost << datadir <<
"/livermore/phot/pe-cs-" << Z <<
".dat";
393 std::ifstream fin(ost.str().c_str());
394 if( !fin.is_open()) {
396 ed <<
"G4LivermorePhotoElectricModel data file <" << ost.str().c_str()
397 <<
"> is not opened!" <<
G4endl;
398 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
400 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
403 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str().c_str()
404 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;}
405 fCrossSection[Z]->
Retrieve(fin,
true);
414 std::ostringstream ost1;
415 ost1 << datadir <<
"/livermore/phot/pe-" << Z <<
".dat";
416 std::ifstream fin1(ost1.str().c_str());
417 if( !fin1.is_open()) {
419 ed <<
"G4LivermorePhotoElectricModel data file <" << ost1.str().c_str()
420 <<
"> is not opened!" <<
G4endl;
421 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
423 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
426 if(verboseLevel > 3) {
427 G4cout <<
"File " << ost1.str().c_str()
428 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
430 fin1 >> n1 >> n2 >> x;
432 (fParam[Z]).reserve(6*n1+1);
433 (fParam[Z]).push_back(x*MeV);
434 for(
G4int i=0; i<n1; ++i) {
435 for(
G4int j=0; j<6; ++j) {
437 if(0 == j) { x *= MeV; }
439 (fParam[Z]).push_back(x);
445 if(nShellLimit < n2) { n2 = nShellLimit; }
447 fNShellsUsed[Z] = n2;
450 std::ostringstream ost2;
451 ost2 << datadir <<
"/livermore/phot/pe-ss-cs-" << Z <<
".dat";
452 std::ifstream fin2(ost2.str().c_str());
453 if( !fin2.is_open()) {
455 ed <<
"G4LivermorePhotoElectricModel data file <" << ost2.str().c_str()
456 <<
"> is not opened!" <<
G4endl;
457 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
459 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
462 if(verboseLevel > 3) {
463 G4cout <<
"File " << ost2.str().c_str()
464 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
469 for(
G4int i=0; i<n2; ++i) {
470 fin2 >> x >> y >> n3 >> n4;
472 for(
G4int j=0; j<n3; ++j) {
483 if(1 < fNShells[Z]) {
486 std::ostringstream ost3;
487 ost3 << datadir <<
"/livermore/phot/pe-le-cs-" << Z <<
".dat";
488 std::ifstream fin3(ost3.str().c_str());
489 if( !fin3.is_open()) {
491 ed <<
"G4LivermorePhotoElectricModel data file <" << ost3.str().c_str()
492 <<
"> is not opened!" <<
G4endl;
493 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
495 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
498 if(verboseLevel > 3) {
499 G4cout <<
"File " << ost3.str().c_str()
500 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
502 fCrossSectionLE[Z]->
Retrieve(fin3,
true);
std::vector< G4Element * > G4ElementVector
G4DLLIMPORT std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
void InitialiseForComponent(G4int Z, G4int nComponents=0)
G4int GetComponentID(G4int Z, size_t idx)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
void PutValues(size_t binNumber, G4double binValue, G4double dataValue)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
G4ParticleChangeForGamma * fParticleChange
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual ~G4LivermorePhotoElectricModel()
G4LivermorePhotoElectricModel(const G4String &nam="LivermorePhElectric")
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
const G4ElementVector * GetElementVector() const
size_t GetNumberOfElements() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
virtual void ScaleVector(G4double factorE, G4double factorV)
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
G4bool IsFluoActive() const
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, const G4Material *)=0
G4VEmAngularDistribution * GetAngularDistribution()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void SetDeexcitationFlag(G4bool val)
void SetAngularDistribution(G4VEmAngularDistribution *)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription