52 std::vector<G4double>* G4LivermorePhotoElectricModel::fParam[] = {0};
53 G4int G4LivermorePhotoElectricModel::fNShells[] = {0};
54 G4int G4LivermorePhotoElectricModel::fNShellsUsed[] = {0};
55 G4ElementData* G4LivermorePhotoElectricModel::fShellCrossSection = 0;
64 nShellLimit(100),fDeexcitationActive(false),isInitialised(false),
82 G4cout <<
"Livermore PhotoElectric is constructed "
83 <<
" nShellLimit= " << nShellLimit <<
G4endl;
95 delete fShellCrossSection;
96 for(
G4int i=0; i<maxZ; ++i) {
108 if (verboseLevel > 2) {
109 G4cout <<
"Calling G4LivermorePhotoElectricModel::Initialise()" <<
G4endl;
114 if(!fShellCrossSection) { fShellCrossSection =
new G4ElementData(); }
116 char* path = getenv(
"G4LEDATA");
122 for(
G4int i=0; i<numOfCouples; ++i) {
129 for (
G4int j=0; j<nelm; ++j) {
132 else if(Z > maxZ) { Z = maxZ; }
133 if(!fCrossSection[Z]) { ReadData(Z, path); }
138 if (verboseLevel > 2) {
139 G4cout <<
"Loaded cross section files for LivermorePhotoElectric model"
143 isInitialised =
true;
148 fDeexcitationActive =
false;
149 if(fAtomDeexcitation) {
150 fDeexcitationActive = fAtomDeexcitation->
IsFluoActive();
153 if (verboseLevel > 0) {
154 G4cout <<
"LivermorePhotoElectric model is initialized " <<
G4endl
167 if (verboseLevel > 3) {
168 G4cout <<
"G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom():"
169 <<
" Z= " << ZZ <<
" R(keV)= " << energy/
keV <<
G4endl;
175 if(Z < 1 || Z >= maxZ) {
return cs; }
179 if(!fCrossSection[Z]) {
181 if(!fCrossSection[Z]) {
return cs; }
184 G4int idx = fNShells[
Z]*6 - 4;
185 if (gammaEnergy <= (*(fParam[Z]))[idx-1]) {
return cs; }
192 if(gammaEnergy >= (*(fParam[Z]))[0]) {
194 cs = x1*((*(fParam[
Z]))[idx] + x1*(*(fParam[
Z]))[idx+1]
195 + x2*(*(fParam[
Z]))[idx+2] + x3*(*(fParam[
Z]))[idx+3]
196 + x4*(*(fParam[
Z]))[idx+4]);
198 }
else if(gammaEnergy >= (*(fParam[Z]))[1]) {
199 cs = x3*(fCrossSection[
Z])->
Value(gammaEnergy);
203 cs = x3*(fCrossSectionLE[
Z])->
Value(gammaEnergy);
205 if (verboseLevel > 1) {
206 G4cout <<
"LivermorePhotoElectricModel: E(keV)= " << gammaEnergy/
keV
207 <<
" Z= " << Z <<
" cross(barn)= " << cs/
barn <<
G4endl;
216 std::vector<G4DynamicParticle*>* fvect,
223 if (verboseLevel > 3) {
224 G4cout <<
"G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
245 if(Z >= maxZ) { Z = maxZ-1; }
248 if(!fCrossSection[Z]) {
255 size_t nn = fNShellsUsed[
Z];
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]) {
274 G4double cs = (*(fParam[
Z]))[idx] + x1*(*(fParam[
Z]))[idx+1]
275 + x2*(*(fParam[
Z]))[idx+2] + x3*(*(fParam[
Z]))[idx+3]
276 + x4*(*(fParam[
Z]))[idx+4];
277 if(cs >= cs0) {
break; }
280 if(shellIdx >= nn) { shellIdx = nn-1; }
288 if(gammaEnergy >= (*(fParam[Z]))[1]) {
289 cs *= (fCrossSection[
Z])->
Value(gammaEnergy);
291 cs *= (fCrossSectionLE[
Z])->
Value(gammaEnergy);
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; }
313 if(fDeexcitationActive && shellIdx + 1 < nn) {
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();
366 G4LivermorePhotoElectricModel::ReadData(
G4int Z,
const char* path)
368 if (verboseLevel > 1)
370 G4cout <<
"Calling ReadData() of G4LivermoreGammaConversionModel"
374 if(fCrossSection[Z]) {
return; }
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.");
406 if(verboseLevel > 3) {
G4cout <<
"File " << ost.str().c_str()
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.");
431 if(verboseLevel > 3) {
432 G4cout <<
"File " << ost1.str().c_str()
433 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
436 if(fin1.fail()) {
return; }
437 if(0 > n1) { n1 = 0; }
440 if(fin1.fail()) {
return; }
441 if(0 > n2) { n2 = 0; }
444 if(fin1.fail()) {
return; }
447 fParam[
Z]->reserve(6*n1+1);
448 fParam[
Z]->push_back(x*
MeV);
449 for(
G4int i=0; i<n1; ++i) {
450 for(
G4int j=0; j<6; ++j) {
452 if(0 == j) { x *=
MeV; }
454 fParam[
Z]->push_back(x);
460 if(nShellLimit < n2) { n2 = nShellLimit; }
462 fNShellsUsed[
Z] = n2;
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.");
477 if(verboseLevel > 3) {
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) {
498 if(1 < fNShells[Z]) {
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.");
513 if(verboseLevel > 3) {
514 G4cout <<
"File " << ost3.str().c_str()
515 <<
" is opened by G4LivermorePhotoElectricModel" <<
G4endl;
517 fCrossSectionLE[
Z]->
Retrieve(fin3,
true);
532 G4AutoLock l(&LivermorePhotoElectricModelMutex);
535 if(!fCrossSection[Z]) { ReadData(Z); }
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
virtual void InitialiseForElement(const G4ParticleDefinition *, G4int Z)
G4VEmAngularDistribution * GetAngularDistribution()
G4LivermorePhotoElectricModel(const G4String &nam="LivermorePhElectric")
const G4ElementVector * GetElementVector() const
#define G4MUTEX_INITIALIZER
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
G4int GetComponentID(G4int Z, size_t idx)
G4GLOB_DLL std::ostream G4cout
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
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()
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)
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