ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4LivermorePhotoElectricModel.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4LivermorePhotoElectricModel.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // Author: Sebastien Incerti
28 // 30 October 2008
29 // on base of G4LowEnergyPhotoElectric developed by A.Forti and M.G.Pia
30 //
31 // 22 Oct 2012 A & V Ivanchenko Migration data structure to G4PhysicsVector
32 // 1 June 2017 M Bandieramonte: New model based on livermore/epics2014
33 // evaluated data - parameterization fits in two ranges
34 
36 #include "G4SystemOfUnits.hh"
37 #include "G4PhysicalConstants.hh"
38 #include "G4LossTableManager.hh"
39 #include "G4Electron.hh"
40 #include "G4Gamma.hh"
42 #include "G4CrossSectionHandler.hh"
43 #include "G4LPhysicsFreeVector.hh"
44 #include "G4VAtomDeexcitation.hh"
46 #include "G4AtomicShell.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
52 std::vector<G4double>* G4LivermorePhotoElectricModel::fParamHigh[] = {nullptr};
53 std::vector<G4double>* G4LivermorePhotoElectricModel::fParamLow[] = {nullptr};
60 
61 #ifdef G4MULTITHREADED
62  G4Mutex G4LivermorePhotoElectricModel::livPhotoeffMutex = G4MUTEX_INITIALIZER;
63 #endif
64 
65 using namespace std;
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68 
70  : G4VEmModel(nam),fParticleChange(nullptr),maxZ(99),
71  nShellLimit(100),fDeexcitationActive(false),isInitialised(false),
72  fAtomDeexcitation(nullptr)
73 {
74  verboseLevel= 0;
75  // Verbosity scale:
76  // 0 = nothing
77  // 1 = warning for energy non-conservation
78  // 2 = details of energy budget
79  // 3 = calculation of cross sections, file openings, sampling of atoms
80  // 4 = entering in methods
81 
84 
85  // default generator
87 
88  if(verboseLevel>0) {
89  G4cout << "Livermore PhotoElectric is constructed "
90  << " nShellLimit= " << nShellLimit << G4endl;
91  }
92 
93  //Mark this model as "applicable" for atomic deexcitation
94  SetDeexcitationFlag(true);
95  fSandiaCof.resize(4,0.0);
96  fCurrSection = 0.0;
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
100 
102 {
103  if(IsMaster()) {
104  delete fShellCrossSection;
105  fShellCrossSection = nullptr;
106  for(G4int i=0; i<maxZ; ++i) {
107  delete fParamHigh[i];
108  fParamHigh[i] = nullptr;
109  delete fParamLow[i];
110  fParamLow[i] = nullptr;
111  delete fCrossSection[i];
112  fCrossSection[i] = nullptr;
113  delete fCrossSectionLE[i];
114  fCrossSectionLE[i] = nullptr;
115  }
116  }
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
120 
121 void
123  const G4DataVector&)
124 {
125  if (verboseLevel > 2) {
126  G4cout << "Calling G4LivermorePhotoElectricModel::Initialise() " << G4endl;
127  }
128 
129  if(IsMaster()) {
130 
131  if(!fWater) {
132  fWater = G4Material::GetMaterial("G4_WATER", false);
133  if(fWater) { fWaterEnergyLimit = 13.6*eV; }
134  }
135 
137 
138  G4ProductionCutsTable* theCoupleTable =
140  G4int numOfCouples = theCoupleTable->GetTableSize();
141 
142  for(G4int i=0; i<numOfCouples; ++i) {
143  const G4MaterialCutsCouple* couple =
144  theCoupleTable->GetMaterialCutsCouple(i);
145  const G4Material* material = couple->GetMaterial();
146  const G4ElementVector* theElementVector = material->GetElementVector();
147  G4int nelm = material->GetNumberOfElements();
148 
149  for (G4int j=0; j<nelm; ++j) {
150  G4int Z = std::min(maxZ, (*theElementVector)[j]->GetZasInt());
151  if(!fCrossSection[Z]) { ReadData(Z); }
152  }
153  }
154  }
155 
156  if (verboseLevel > 2) {
157  G4cout << "Loaded cross section files for new LivermorePhotoElectric model"
158  << G4endl;
159  }
160  if(!isInitialised) {
161  isInitialised = true;
163 
165  }
166  fDeexcitationActive = false;
167  if(fAtomDeexcitation) {
169  }
170 
171  if (verboseLevel > 0) {
172  G4cout << "LivermorePhotoElectric model is initialized " << G4endl
173  << G4endl;
174  }
175 }
176 
177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
178 
180  const G4Material* material,
181  const G4ParticleDefinition* p,
184 {
185  fCurrSection = 0.0;
186  if(fWater && (material == fWater ||
187  material->GetBaseMaterial() == fWater)) {
188  if(energy <= fWaterEnergyLimit) {
190 
191  G4double energy2 = energy*energy;
192  G4double energy3 = energy*energy2;
193  G4double energy4 = energy2*energy2;
194 
195  fCurrSection = material->GetDensity()*
196  (fSandiaCof[0]/energy + fSandiaCof[1]/energy2 +
197  fSandiaCof[2]/energy3 + fSandiaCof[3]/energy4);
198  }
199  }
200  if(0.0 == fCurrSection) {
201  fCurrSection = G4VEmModel::CrossSectionPerVolume(material, p, energy);
202  }
203  return fCurrSection;
204 }
205 
206 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
207 
209  const G4ParticleDefinition*,
211  G4double ZZ, G4double,
213 {
214  if (verboseLevel > 3) {
215  G4cout << "\n G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom():"
216  << " Z= " << ZZ << " R(keV)= " << energy/keV << G4endl;
217  }
218  G4double cs = 0.0;
219  G4int Z = G4lrint(ZZ);
220  if(Z >= maxZ) { return cs; }
221  // if element was not initialised
222 
223  // do initialisation safely for MT mode
225 
226  //7: rows in the parameterization file; 5: number of parameters
227  G4int idx = fNShells[Z]*7 - 5;
228 
229  energy = std::max(energy, (*(fParamHigh[Z]))[idx-1]);
230 
231  G4double x1 = 1.0/energy;
232  G4double x2 = x1*x1;
233  G4double x3 = x2*x1;
234 
235  // high energy parameterisation
236  if(energy >= (*(fParamHigh[Z]))[0]) {
237 
238  G4double x4 = x2*x2;
239  G4double x5 = x4*x1;
240 
241  cs = x1*((*(fParamHigh[Z]))[idx] + x1*(*(fParamHigh[Z]))[idx+1]
242  + x2*(*(fParamHigh[Z]))[idx+2] + x3*(*(fParamHigh[Z]))[idx+3]
243  + x4*(*(fParamHigh[Z]))[idx+4]+ x5*(*(fParamHigh[Z]))[idx+5]);
244 
245  }
246  // low energy parameterisation
247  else if(energy >= (*(fParamLow[Z]))[0]) {
248 
249  G4double x4 = x2*x2;
250  G4double x5 = x4*x1; //this variable usage can probably be optimized
251  cs = x1*((*(fParamLow[Z]))[idx] + x1*(*(fParamLow[Z]))[idx+1]
252  + x2*(*(fParamLow[Z]))[idx+2] + x3*(*(fParamLow[Z]))[idx+3]
253  + x4*(*(fParamLow[Z]))[idx+4]+ x5*(*(fParamLow[Z]))[idx+5]);
254 
255  }
256  // Tabulated values above k-shell ionization energy
257  else if(energy >= (*(fParamHigh[Z]))[1]) {
258  cs = x3*(fCrossSection[Z])->Value(energy);
259  }
260  // Tabulated values below k-shell ionization energy
261  else
262  {
263  cs = x3*(fCrossSectionLE[Z])->Value(energy);
264  }
265  if (verboseLevel > 1) {
266  G4cout << "G4LivermorePhotoElectricModel: E(keV)= " << energy/keV
267  << " Z= " << Z << " cross(barn)= " << cs/barn << G4endl;
268  }
269  return cs;
270 }
271 
272 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
273 
274 void
276  std::vector<G4DynamicParticle*>* fvect,
277  const G4MaterialCutsCouple* couple,
278  const G4DynamicParticle* aDynamicGamma,
280 {
281  G4double gammaEnergy = aDynamicGamma->GetKineticEnergy();
282  if (verboseLevel > 3) {
283  G4cout << "G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
284  << gammaEnergy/keV << G4endl;
285  }
286 
287  // kill incident photon
290 
291  // low-energy photo-effect in water - full absorption
292  const G4Material* material = couple->GetMaterial();
293  if(fWater && (material == fWater ||
294  material->GetBaseMaterial() == fWater)) {
295  if(gammaEnergy <= fWaterEnergyLimit) {
297  return;
298  }
299  }
300 
301  // Returns the normalized direction of the momentum
302  G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
303 
304  // Select randomly one element in the current material
305  //G4cout << "Select random atom Egamma(keV)= " << gammaEnergy/keV << G4endl;
306  const G4Element* elm = SelectRandomAtom(material, theGamma, gammaEnergy);
307  G4int Z = elm->GetZasInt();
308 
309  // Select the ionised shell in the current atom according to shell
310  // cross sections
311  // G4cout << "Select random shell Z= " << Z << G4endl;
312 
313  if(Z >= maxZ) { Z = maxZ-1; }
314 
315  // element was not initialised gamma should be absorbed
316  if(!fCrossSection[Z]) {
318  return;
319  }
320 
321  // SAMPLING OF THE SHELL INDEX
322  size_t shellIdx = 0;
323  size_t nn = fNShellsUsed[Z];
324  if(nn > 1)
325  {
326  if(gammaEnergy >= (*(fParamHigh[Z]))[0])
327  {
328  G4double x1 = 1.0/gammaEnergy;
329  G4double x2 = x1*x1;
330  G4double x3 = x2*x1;
331  G4double x4 = x3*x1;
332  G4double x5 = x4*x1;
333  G4int idx = nn*7 - 5;
334  // when do sampling common factors are not taken into account
335  // so cross section is not real
336 
337  G4double rand=G4UniformRand();
338  G4double cs0 = rand*( (*(fParamHigh[Z]))[idx]
339  + x1*(*(fParamHigh[Z]))[idx+1]
340  + x2*(*(fParamHigh[Z]))[idx+2]
341  + x3*(*(fParamHigh[Z]))[idx+3]
342  + x4*(*(fParamHigh[Z]))[idx+4]
343  + x5*(*(fParamHigh[Z]))[idx+5]);
344 
345  for(shellIdx=0; shellIdx<nn; ++shellIdx)
346  {
347  idx = shellIdx*7 + 2;
348  if(gammaEnergy > (*(fParamHigh[Z]))[idx-1])
349  {
350  G4double cs =
351  (*(fParamHigh[Z]))[idx]
352  + x1*(*(fParamHigh[Z]))[idx+1]
353  + x2*(*(fParamHigh[Z]))[idx+2]
354  + x3*(*(fParamHigh[Z]))[idx+3]
355  + x4*(*(fParamHigh[Z]))[idx+4]
356  + x5*(*(fParamHigh[Z]))[idx+5];
357 
358  if(cs >= cs0) { break; }
359  }
360  }
361  if(shellIdx >= nn) { shellIdx = nn-1; }
362  }
363  else if(gammaEnergy >= (*(fParamLow[Z]))[0])
364  {
365  G4double x1 = 1.0/gammaEnergy;
366  G4double x2 = x1*x1;
367  G4double x3 = x2*x1;
368  G4double x4 = x3*x1;
369  G4double x5 = x4*x1;
370  G4int idx = nn*7 - 5;
371  // when do sampling common factors are not taken into account
372  // so cross section is not real
373  G4double cs0 = G4UniformRand()*((*(fParamLow[Z]))[idx]
374  + x1*(*(fParamLow[Z]))[idx+1]
375  + x2*(*(fParamLow[Z]))[idx+2]
376  + x3*(*(fParamLow[Z]))[idx+3]
377  + x4*(*(fParamLow[Z]))[idx+4]
378  + x5*(*(fParamLow[Z]))[idx+5]);
379  for(shellIdx=0; shellIdx<nn; ++shellIdx)
380  {
381  idx = shellIdx*7 + 2;
382  if(gammaEnergy > (*(fParamLow[Z]))[idx-1])
383  {
384  G4double cs = (*(fParamLow[Z]))[idx] + x1*(*(fParamLow[Z]))[idx+1]
385  + x2*(*(fParamLow[Z]))[idx+2] + x3*(*(fParamLow[Z]))[idx+3]
386  + x4*(*(fParamLow[Z]))[idx+4]+ x5*(*(fParamLow[Z]))[idx+5];
387  if(cs >= cs0) { break; }
388  }
389  }
390  if(shellIdx >= nn) {shellIdx = nn-1;}
391  }
392  else
393  {
394  // when do sampling common factors are not taken into account
395  // so cross section is not real
396  G4double cs = G4UniformRand();
397 
398  if(gammaEnergy >= (*(fParamHigh[Z]))[1]) {
399  //above K-shell binding energy
400  cs*= (fCrossSection[Z])->Value(gammaEnergy);
401  }
402  else
403  {
404  //below K-shell binding energy
405  cs *= (fCrossSectionLE[Z])->Value(gammaEnergy);
406  }
407 
408  for(size_t j=0; j<nn; ++j) {
409 
410  shellIdx = (size_t)fShellCrossSection->GetComponentID(Z, j);
411  if(gammaEnergy > (*(fParamLow[Z]))[7*shellIdx+1]) {
412  cs -= fShellCrossSection->GetValueForComponent(Z, j, gammaEnergy);
413  }
414  if(cs <= 0.0 || j+1 == nn) {break;}
415  }
416  }
417  }
418  // END: SAMPLING OF THE SHELL
419 
420  G4double bindingEnergy = (*(fParamHigh[Z]))[shellIdx*7 + 1];
421  //G4cout << "Z= " << Z << " shellIdx= " << shellIdx
422  // << " nShells= " << fNShells[Z]
423  // << " Ebind(keV)= " << bindingEnergy/keV
424  // << " Egamma(keV)= " << gammaEnergy/keV << G4endl;
425 
426  const G4AtomicShell* shell = 0;
427 
428  // no de-excitation from the last shell
429  if(fDeexcitationActive && shellIdx + 1 < nn) {
431  shell = fAtomDeexcitation->GetAtomicShell(Z, as);
432  }
433 
434  // If binding energy of the selected shell is larger than photon energy
435  // do not generate secondaries
436  if(gammaEnergy < bindingEnergy) {
438  return;
439  }
440 
441  // Primary outcoming electron
442  G4double eKineticEnergy = gammaEnergy - bindingEnergy;
444 
445  // Calculate direction of the photoelectron
446  G4ThreeVector electronDirection =
447  GetAngularDistribution()->SampleDirection(aDynamicGamma,
448  eKineticEnergy,
449  shellIdx,
450  couple->GetMaterial());
451 
452  // The electron is created
454  electronDirection,
455  eKineticEnergy);
456  fvect->push_back(electron);
457 
458  // Sample deexcitation
459  if(shell) {
460  G4int index = couple->GetIndex();
462  G4int nbefore = fvect->size();
463 
464  fAtomDeexcitation->GenerateParticles(fvect, shell, Z, index);
465  G4int nafter = fvect->size();
466  if(nafter > nbefore) {
467  G4double esec = 0.0;
468  for (G4int j=nbefore; j<nafter; ++j) {
469 
470  G4double e = ((*fvect)[j])->GetKineticEnergy();
471  if(esec + e > edep) {
472  // correct energy in order to have energy balance
473  e = edep - esec;
474  ((*fvect)[j])->SetKineticEnergy(e);
475  esec += e;
476  // delete the rest of secondaries (should not happens)
477  for (G4int jj=nafter-1; jj>j; --jj) {
478  delete (*fvect)[jj];
479  fvect->pop_back();
480  }
481  break;
482  }
483  esec += e;
484  }
485  edep -= esec;
486  }
487  }
488  }
489  // energy balance - excitation energy left
490  if(edep > 0.0) {
492  }
493 }
494 
495 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
496 
498 {
499  // check environment variable
500  // build the complete string identifying the file with the data set
501  if(fDataDirectory.empty()) {
502  const char* path = std::getenv("G4LEDATA");
503  if (path) {
504  std::ostringstream ost;
505  ost << path << "/livermore/phot_epics2014/";
506  fDataDirectory = ost.str();
507  } else {
508  G4Exception("G4SeltzerBergerModel::FindDirectoryPath()","em0006",
510  "Environment variable G4LEDATA not defined");
511  }
512  }
513  return fDataDirectory;
514 }
515 
516 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
517 
519 {
520  if (verboseLevel > 1)
521  {
522  G4cout << "Calling ReadData() of G4LivermorePhotoElectricModel"
523  << G4endl;
524  }
525 
526  if(fCrossSection[Z]) { return; }
527 
528  // spline for photoeffect total x-section above K-shell
529  // but below the parameterized ones
531  fCrossSection[Z]->SetSpline(true);
532  std::ostringstream ost;
533  ost << FindDirectoryPath() << "pe-cs-" << Z <<".dat";
534  std::ifstream fin(ost.str().c_str());
535  if( !fin.is_open()) {
537  ed << "G4LivermorePhotoElectricModel data file <" << ost.str().c_str()
538  << "> is not opened!" << G4endl;
539  G4Exception("G4LivermorePhotoElectricModel::ReadData()",
540  "em0003",FatalException,
541  ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
542  return;
543  }
544  if(verboseLevel > 3) {
545  G4cout << "File " << ost.str().c_str()
546  << " is opened by G4LivermorePhotoElectricModel" << G4endl;
547  }
548  fCrossSection[Z]->Retrieve(fin, true);
550  fin.close();
551 
552  // read high-energy fit parameters
553  fParamHigh[Z] = new std::vector<G4double>;
554  G4int n1 = 0;
555  G4int n2 = 0;
556  G4double x;
557  std::ostringstream ost1;
558  ost1 << fDataDirectory << "pe-high-" << Z <<".dat";
559  std::ifstream fin1(ost1.str().c_str());
560  if( !fin1.is_open()) {
562  ed << "G4LivermorePhotoElectricModel data file <" << ost1.str().c_str()
563  << "> is not opened!" << G4endl;
564  G4Exception("G4LivermorePhotoElectricModel::ReadData()",
565  "em0003",FatalException,
566  ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
567  return;
568  }
569  if(verboseLevel > 3) {
570  G4cout << "File " << ost1.str().c_str()
571  << " is opened by G4LivermorePhotoElectricModel" << G4endl;
572  }
573  fin1 >> n1;
574  if(fin1.fail()) { return; }
575  if(0 > n1 || n1 >= INT_MAX) { n1 = 0; }
576 
577  fin1 >> n2;
578  if(fin1.fail()) { return; }
579  if(0 > n2 || n2 >= INT_MAX) { n2 = 0; }
580 
581  fin1 >> x;
582  if(fin1.fail()) { return; }
583 
584  fNShells[Z] = n1;
585  fParamHigh[Z]->reserve(7*n1+1);
586  fParamHigh[Z]->push_back(x*MeV);
587  for(G4int i=0; i<n1; ++i) {
588  for(G4int j=0; j<7; ++j) {
589  fin1 >> x;
590  if(0 == j) { x *= MeV; }
591  else { x *= barn; }
592  fParamHigh[Z]->push_back(x);
593  }
594  }
595  fin1.close();
596 
597  // read low-energy fit parameters
598  fParamLow[Z] = new std::vector<G4double>;
599  G4int n1_low = 0;
600  G4int n2_low = 0;
601  G4double x_low;
602  std::ostringstream ost1_low;
603  ost1_low << fDataDirectory << "pe-low-" << Z <<".dat";
604  std::ifstream fin1_low(ost1_low.str().c_str());
605  if( !fin1_low.is_open()) {
607  ed << "G4LivermorePhotoElectricModel data file <" << ost1_low.str().c_str()
608  << "> is not opened!" << G4endl;
609  G4Exception("G4LivermorePhotoElectricModel::ReadData()",
610  "em0003",FatalException,
611  ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
612  return;
613  }
614  if(verboseLevel > 3) {
615  G4cout << "File " << ost1_low.str().c_str()
616  << " is opened by G4LivermorePhotoElectricModel" << G4endl;
617  }
618  fin1_low >> n1_low;
619  if(fin1_low.fail()) { return; }
620  if(0 > n1_low || n1_low >= INT_MAX) { n1_low = 0; }
621 
622  fin1_low >> n2_low;
623  if(fin1_low.fail()) { return; }
624  if(0 > n2_low || n2_low >= INT_MAX) { n2_low = 0; }
625 
626  fin1_low >> x_low;
627  if(fin1_low.fail()) { return; }
628 
629  fNShells[Z] = n1_low;
630  fParamLow[Z]->reserve(7*n1_low+1);
631  fParamLow[Z]->push_back(x_low*MeV);
632  for(G4int i=0; i<n1_low; ++i) {
633  for(G4int j=0; j<7; ++j) {
634  fin1_low >> x_low;
635  if(0 == j) { x_low *= MeV; }
636  else { x_low *= barn; }
637  fParamLow[Z]->push_back(x_low);
638  }
639  }
640  fin1_low.close();
641 
642  // there is a possibility to use only main shells
643  if(nShellLimit < n2) { n2 = nShellLimit; }
644  fShellCrossSection->InitialiseForComponent(Z, n2);//number of shells
645  fNShellsUsed[Z] = n2;
646 
647  if(1 < n2) {
648  std::ostringstream ost2;
649  ost2 << fDataDirectory << "pe-ss-cs-" << Z <<".dat";
650  std::ifstream fin2(ost2.str().c_str());
651  if( !fin2.is_open()) {
653  ed << "G4LivermorePhotoElectricModel data file <" << ost2.str().c_str()
654  << "> is not opened!" << G4endl;
655  G4Exception("G4LivermorePhotoElectricModel::ReadData()",
656  "em0003",FatalException,
657  ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
658  return;
659  }
660  if(verboseLevel > 3) {
661  G4cout << "File " << ost2.str().c_str()
662  << " is opened by G4LivermorePhotoElectricModel" << G4endl;
663  }
664 
665  G4int n3, n4;
666  G4double y;
667  for(G4int i=0; i<n2; ++i) {
668  fin2 >> x >> y >> n3 >> n4;
670  for(G4int j=0; j<n3; ++j) {
671  fin2 >> x >> y;
672  v->PutValues(j, x*MeV, y*barn);
673  }
674  fShellCrossSection->AddComponent(Z, n4, v);
675  }
676  fin2.close();
677  }
678 
679  // no spline for photoeffect total x-section below K-shell
680  if(1 < fNShells[Z]) {
682  std::ostringstream ost3;
683  ost3 << fDataDirectory << "pe-le-cs-" << Z <<".dat";
684  std::ifstream fin3(ost3.str().c_str());
685  if( !fin3.is_open()) {
687  ed << "G4LivermorePhotoElectricModel data file <" << ost3.str().c_str()
688  << "> is not opened!" << G4endl;
689  G4Exception("G4LivermorePhotoElectricModel::ReadData()",
690  "em0003",FatalException,
691  ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
692  return;
693  }
694  if(verboseLevel > 3) {
695  G4cout << "File " << ost3.str().c_str()
696  << " is opened by G4LivermorePhotoElectricModel" << G4endl;
697  }
698  fCrossSectionLE[Z]->Retrieve(fin3, true);
700  fin3.close();
701  }
702 }
703 
704 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
705 
707 {
708  if(Z < 1 || Z >= maxZ) { return -1;} //If Z is out of the supported return 0
709  //If necessary load data for Z
711  if(!fCrossSection[Z] || shell < 0 || shell >= fNShellsUsed[Z]) { return -1; }
712 
713  if(Z>2)
714  return fShellCrossSection->GetComponentDataByIndex(Z, shell)->Energy(0);
715  else
716  return fCrossSection[Z]->Energy(0);
717 }
718 
719 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
720 
722  const G4ParticleDefinition*, G4int Z)
723 {
724  if (!fCrossSection[Z]) {
725 #ifdef G4MULTITHREADED
726  G4MUTEXLOCK(&livPhotoeffMutex);
727  if (!fCrossSection[Z]) {
728 #endif
729  ReadData(Z);
730 #ifdef G4MULTITHREADED
731  }
732  G4MUTEXUNLOCK(&livPhotoeffMutex);
733 #endif
734  }
735 }
736 
737 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....