66 :
G4VEmModel(nam),fParticleChange(nullptr),maxZ(99),
67 nShellLimit(100),fDeexcitationActive(false),isInitialised(false),
68 fAtomDeexcitation(nullptr)
85 G4cout <<
"Livermore PhotoElectric is constructed "
119 G4cout <<
"Calling G4LivermorePhotoElectricModel::Initialise()" <<
G4endl;
131 char* path = getenv(
"G4LEDATA");
137 for(
G4int i=0; i<numOfCouples; ++i) {
144 for (
G4int j=0; j<nelm; ++j) {
145 G4int Z = (
G4int)(*theElementVector)[j]->GetZ();
154 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
169 G4cout <<
"LivermorePhotoElectric model is initialized " <<
G4endl
212 G4cout <<
"G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom():"
213 <<
" Z= " << ZZ <<
" R(keV)= " << energy/
keV <<
G4endl;
217 if(Z < 1 || Z >=
maxZ) {
return cs; }
227 if (energy < (*(
fParam[Z]))[idx-1]) { energy = (*(
fParam[Z]))[idx-1]; }
234 if(energy >= (*(
fParam[Z]))[0]) {
238 + x4*(*(
fParam[Z]))[idx+4]);
240 }
else if(energy >= (*(
fParam[Z]))[1]) {
248 G4cout <<
"LivermorePhotoElectricModel: E(keV)= " << energy/
keV
249 <<
" Z= " << Z <<
" cross(barn)= " << cs/
barn <<
G4endl;
258 std::vector<G4DynamicParticle*>* fvect,
266 G4cout <<
"G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
309 if(gammaEnergy >= (*(
fParam[Z]))[0]) {
314 G4int idx = nn*6 - 4;
318 + x1*(*(
fParam[Z]))[idx+1]
319 + x2*(*(
fParam[Z]))[idx+2]
320 + x3*(*(
fParam[Z]))[idx+3]
321 + x4*(*(
fParam[Z]))[idx+4]);
322 for(shellIdx=0; shellIdx<
nn; ++shellIdx) {
323 idx = shellIdx*6 + 2;
324 if(gammaEnergy > (*(
fParam[Z]))[idx-1]) {
327 + x4*(*(
fParam[Z]))[idx+4];
328 if(cs >= cs0) {
break; }
331 if(shellIdx >= nn) { shellIdx = nn-1; }
339 if(gammaEnergy >= (*(
fParam[Z]))[1]) {
345 for(
size_t j=0; j<
nn; ++j) {
347 if(gammaEnergy > (*(
fParam[Z]))[6*shellIdx+1]) {
350 if(cs <= 0.0 || j+1 == nn) {
break; }
371 if(gammaEnergy < bindingEnergy) {
391 fvect->push_back(electron);
397 G4int nbefore = fvect->size();
400 G4int nafter = fvect->size();
401 if(nafter > nbefore) {
403 for (
G4int j=nbefore; j<nafter; ++j) {
405 G4double e = ((*fvect)[j])->GetKineticEnergy();
406 if(esec + e > edep) {
409 ((*fvect)[j])->SetKineticEnergy(e);
412 for (
G4int jj=nafter-1; jj>j; --jj) {
437 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
443 const char* datadir = path;
447 datadir = getenv(
"G4LEDATA");
450 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
452 "Environment variable G4LEDATA not defined");
461 std::ostringstream ost;
462 ost << datadir <<
"/livermore/phot/pe-cs-" << Z <<
".dat";
463 std::ifstream fin(ost.str().c_str());
464 if( !fin.is_open()) {
466 ed <<
"G4LivermorePhotoElectricModel data file <" << ost.str().c_str()
467 <<
"> is not opened!" <<
G4endl;
468 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
470 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
474 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;}
480 fParam[Z] =
new std::vector<G4double>;
486 std::ostringstream ost1;
487 ost1 << datadir <<
"/livermore/phot/pe-" << Z <<
".dat";
488 std::ifstream fin1(ost1.str().c_str());
489 if( !fin1.is_open()) {
491 ed <<
"G4LivermorePhotoElectricModel data file <" << ost1.str().c_str()
492 <<
"> is not opened!" <<
G4endl;
493 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
495 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
499 G4cout <<
"File " << ost1.str().c_str()
500 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
503 if(fin1.fail()) {
return; }
504 if(0 > n1 || n1 >=
INT_MAX) { n1 = 0; }
507 if(fin1.fail()) {
return; }
508 if(0 > n2 || n2 >=
INT_MAX) { n2 = 0; }
511 if(fin1.fail()) {
return; }
514 fParam[Z]->reserve(6*n1+1);
516 for(
G4int i=0; i<n1; ++i) {
517 for(
G4int j=0; j<6; ++j) {
519 if(0 == j) { x *=
MeV; }
532 std::ostringstream ost2;
533 ost2 << datadir <<
"/livermore/phot/pe-ss-cs-" << Z <<
".dat";
534 std::ifstream fin2(ost2.str().c_str());
535 if( !fin2.is_open()) {
537 ed <<
"G4LivermorePhotoElectricModel data file <" << ost2.str().c_str()
538 <<
"> is not opened!" <<
G4endl;
539 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
541 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
545 G4cout <<
"File " << ost2.str().c_str()
546 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
551 for(
G4int i=0; i<n2; ++i) {
552 fin2 >> x >> y >> n3 >> n4;
554 for(
G4int j=0; j<n3; ++j) {
568 std::ostringstream ost3;
569 ost3 << datadir <<
"/livermore/phot/pe-le-cs-" << Z <<
".dat";
570 std::ifstream fin3(ost3.str().c_str());
571 if( !fin3.is_open()) {
573 ed <<
"G4LivermorePhotoElectricModel data file <" << ost3.str().c_str()
574 <<
"> is not opened!" <<
G4endl;
575 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
577 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
581 G4cout <<
"File " << ost3.str().c_str()
582 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
599 G4AutoLock l(&LivermorePhotoElectricModelMutex);
void PutValues(size_t binNumber, G4double binValue, G4double dataValue)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
static G4LossTableManager * Instance()
G4bool IsFluoActive() const
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
std::vector< G4Element * > G4ElementVector
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
static G4Material * fWater
static G4double fWaterEnergyLimit
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
static G4int fNShellsUsed[99]
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
static std::vector< G4double > * fParam[99]
G4VEmAngularDistribution * GetAngularDistribution()
G4double GetDensity() const
static G4ElementData * fShellCrossSection
G4LivermorePhotoElectricModel(const G4String &nam="LivermorePhElectric")
G4ParticleDefinition * theGamma
static G4int fNShells[99]
void ReadData(G4int Z, const char *path=0)
const G4ElementVector * GetElementVector() const
#define G4MUTEX_INITIALIZER
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4SandiaTable * GetSandiaTable() const
G4ParticleDefinition * theElectron
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
G4int GetComponentID(G4int Z, size_t idx)
G4GLOB_DLL std::ostream G4cout
static G4LPhysicsFreeVector * fCrossSectionLE[99]
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, const G4Material *)=0
size_t GetTableSize() const
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double energy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
const G4ThreeVector & GetMomentumDirection() const
std::vector< G4double > fSandiaCof
virtual ~G4LivermorePhotoElectricModel()
virtual void ScaleVector(G4double factorE, G4double factorV)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double energy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4double energy(const ThreeVector &p, const G4double m)
static G4LPhysicsFreeVector * fCrossSection[99]
void SetAngularDistribution(G4VEmAngularDistribution *)
const G4double x[NPOINTSGL]
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
const G4Material * GetBaseMaterial() const
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
size_t GetNumberOfElements() const
G4VAtomDeexcitation * AtomDeexcitation()
void GetSandiaCofWater(G4double energy, std::vector< G4double > &coeff) const
G4VAtomDeexcitation * fAtomDeexcitation
void ProposeTrackStatus(G4TrackStatus status)
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
void SetDeexcitationFlag(G4bool val)
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4double bindingEnergy(G4int A, G4int Z)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
G4bool fDeexcitationActive
G4ParticleChangeForGamma * fParticleChange
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
const G4Material * GetMaterial() const