64 nShellLimit(100),fDeexcitationActive(false),isInitialised(false),
82 G4cout <<
"Livermore PhotoElectric is constructed "
109 G4cout <<
"Calling G4LivermorePhotoElectricModel::Initialise()" <<
G4endl;
116 char* path = getenv(
"G4LEDATA");
122 for(
G4int i=0; i<numOfCouples; ++i) {
129 for (
G4int j=0; j<nelm; ++j) {
130 G4int Z = (
G4int)(*theElementVector)[j]->GetZ();
139 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
154 G4cout <<
"LivermorePhotoElectric model is initialized " <<
G4endl
168 G4cout <<
"G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom():"
169 <<
" Z= " << ZZ <<
" R(keV)= " << energy/
keV <<
G4endl;
175 if(Z < 1 || Z >=
maxZ) {
return cs; }
185 if (gammaEnergy <= (*(
fParam[Z]))[idx-1]) {
return cs; }
192 if(gammaEnergy >= (*(
fParam[Z]))[0]) {
196 + x4*(*(
fParam[Z]))[idx+4]);
198 }
else if(gammaEnergy >= (*(
fParam[Z]))[1]) {
206 G4cout <<
"LivermorePhotoElectricModel: E(keV)= " << gammaEnergy/
keV
207 <<
" Z= " << Z <<
" cross(barn)= " << cs/
barn <<
G4endl;
216 std::vector<G4DynamicParticle*>* fvect,
224 G4cout <<
"G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
258 if(gammaEnergy >= (*(
fParam[Z]))[0]) {
263 G4int idx = nn*6 - 4;
267 + x1*(*(
fParam[Z]))[idx+1]
268 + x2*(*(
fParam[Z]))[idx+2]
269 + x3*(*(
fParam[Z]))[idx+3]
270 + x4*(*(
fParam[Z]))[idx+4]);
271 for(shellIdx=0; shellIdx<
nn; ++shellIdx) {
272 idx = shellIdx*6 + 2;
273 if(gammaEnergy > (*(
fParam[Z]))[idx-1]) {
276 + x4*(*(
fParam[Z]))[idx+4];
277 if(cs >= cs0) {
break; }
280 if(shellIdx >= nn) { shellIdx = nn-1; }
288 if(gammaEnergy >= (*(
fParam[Z]))[1]) {
294 for(
size_t j=0; j<
nn; ++j) {
296 if(gammaEnergy > (*(
fParam[Z]))[6*shellIdx+1]) {
299 if(cs <= 0.0 || j+1 == nn) {
break; }
320 if(gammaEnergy < bindingEnergy) {
340 fvect->push_back(electron);
346 size_t nbefore = fvect->size();
349 size_t nafter = fvect->size();
350 if(nafter > nbefore) {
351 for (
size_t j=nbefore; j<nafter; ++j) {
352 edep -= ((*fvect)[j])->GetKineticEnergy();
370 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
376 const char* datadir = path;
380 datadir = getenv(
"G4LEDATA");
383 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
385 "Environment variable G4LEDATA not defined");
394 std::ostringstream ost;
395 ost << datadir <<
"/livermore/phot/pe-cs-" << Z <<
".dat";
396 std::ifstream fin(ost.str().c_str());
397 if( !fin.is_open()) {
399 ed <<
"G4LivermorePhotoElectricModel data file <" << ost.str().c_str()
400 <<
"> is not opened!" <<
G4endl;
401 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
403 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
407 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;}
413 fParam[Z] =
new std::vector<G4double>;
419 std::ostringstream ost1;
420 ost1 << datadir <<
"/livermore/phot/pe-" << Z <<
".dat";
421 std::ifstream fin1(ost1.str().c_str());
422 if( !fin1.is_open()) {
424 ed <<
"G4LivermorePhotoElectricModel data file <" << ost1.str().c_str()
425 <<
"> is not opened!" <<
G4endl;
426 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
428 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
432 G4cout <<
"File " << ost1.str().c_str()
433 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
436 if(fin1.fail()) {
return; }
437 if(0 > n1 || n1 >=
INT_MAX) { n1 = 0; }
440 if(fin1.fail()) {
return; }
441 if(0 > n2 || n2 >=
INT_MAX) { n2 = 0; }
444 if(fin1.fail()) {
return; }
447 fParam[Z]->reserve(6*n1+1);
449 for(
G4int i=0; i<n1; ++i) {
450 for(
G4int j=0; j<6; ++j) {
452 if(0 == j) { x *=
MeV; }
465 std::ostringstream ost2;
466 ost2 << datadir <<
"/livermore/phot/pe-ss-cs-" << Z <<
".dat";
467 std::ifstream fin2(ost2.str().c_str());
468 if( !fin2.is_open()) {
470 ed <<
"G4LivermorePhotoElectricModel data file <" << ost2.str().c_str()
471 <<
"> is not opened!" <<
G4endl;
472 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
474 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
478 G4cout <<
"File " << ost2.str().c_str()
479 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
484 for(
G4int i=0; i<n2; ++i) {
485 fin2 >> x >> y >> n3 >> n4;
487 for(
G4int j=0; j<n3; ++j) {
501 std::ostringstream ost3;
502 ost3 << datadir <<
"/livermore/phot/pe-le-cs-" << Z <<
".dat";
503 std::ifstream fin3(ost3.str().c_str());
504 if( !fin3.is_open()) {
506 ed <<
"G4LivermorePhotoElectricModel data file <" << ost3.str().c_str()
507 <<
"> is not opened!" <<
G4endl;
508 G4Exception(
"G4LivermorePhotoElectricModel::ReadData()",
510 ed,
"G4LEDATA version should be G4EMLOW6.32 or later.");
514 G4cout <<
"File " << ost3.str().c_str()
515 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
532 G4AutoLock l(&LivermorePhotoElectricModelMutex);
void PutValues(size_t binNumber, G4double binValue, G4double dataValue)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
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 G4int fNShellsUsed[99]
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
static std::vector< G4double > * fParam[99]
G4VEmAngularDistribution * GetAngularDistribution()
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)
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
const G4ThreeVector & GetMomentumDirection() const
virtual ~G4LivermorePhotoElectricModel()
virtual void ScaleVector(G4double factorE, G4double factorV)
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]
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
void SetAngularDistribution(G4VEmAngularDistribution *)
virtual G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
G4double GetValueForComponent(G4int Z, size_t idx, G4double kinEnergy)
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
size_t GetNumberOfElements() const
G4VAtomDeexcitation * AtomDeexcitation()
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