Geant4-11
G4LivermorePhotoElectricModel.cc
Go to the documentation of this file.
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"
38#include "G4LossTableManager.hh"
39#include "G4Electron.hh"
40#include "G4Gamma.hh"
46#include "G4AtomicShell.hh"
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49
52std::vector<G4double>* G4LivermorePhotoElectricModel::fParamHigh[] = {nullptr};
53std::vector<G4double>* G4LivermorePhotoElectricModel::fParamLow[] = {nullptr};
60
61#ifdef G4MULTITHREADED
62 G4Mutex G4LivermorePhotoElectricModel::livPhotoeffMutex = G4MUTEX_INITIALIZER;
63#endif
64
65using namespace std;
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
68
70 : G4VEmModel(nam),fParticleChange(nullptr), fAtomDeexcitation(nullptr),
71 maxZ(100),nShellLimit(100),fDeexcitationActive(false),isInitialised(false)
72{
73 verboseLevel= 0;
74 // Verbosity scale:
75 // 0 = nothing
76 // 1 = warning for energy non-conservation
77 // 2 = details of energy budget
78 // 3 = calculation of cross sections, file openings, sampling of atoms
79 // 4 = entering in methods
80
83
84 // default generator
86
87 if(verboseLevel>0) {
88 G4cout << "Livermore PhotoElectric is constructed "
89 << " nShellLimit= " << nShellLimit << G4endl;
90 }
91
92 //Mark this model as "applicable" for atomic deexcitation
94 fSandiaCof.resize(4,0.0);
95 fCurrSection = 0.0;
96}
97
98//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
99
101{
102 if(IsMaster())
103 {
104 delete fShellCrossSection;
105 fShellCrossSection = nullptr;
106 for(G4int i = 0; i <= maxZ; ++i)
107 {
108 if(fParamHigh[i]){
109 delete fParamHigh[i];
110 fParamHigh[i] = nullptr;
111 }
112 if(fParamLow[i]){
113 delete fParamLow[i];
114 fParamLow[i] = nullptr;
115 }
116 if(fCrossSection[i]){
117 delete fCrossSection[i];
118 fCrossSection[i] = nullptr;
119 }
120 if(fCrossSectionLE[i]){
121 delete fCrossSectionLE[i];
122 fCrossSectionLE[i] = nullptr;
123 }
124
125 }
126 }
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
130
131void
133 const G4DataVector&)
134{
135 if (verboseLevel > 2) {
136 G4cout << "Calling G4LivermorePhotoElectricModel::Initialise() " << G4endl;
137 }
138
139 if(IsMaster()) {
140
141 if(fWater == nullptr) {
142 fWater = G4Material::GetMaterial("G4_WATER", false);
143 if(fWater == nullptr) { fWater = G4Material::GetMaterial("Water", false); }
144 if(fWater) { fWaterEnergyLimit = 13.6*eV; }
145 }
146
147 if(fShellCrossSection == nullptr) { fShellCrossSection = new G4ElementData(); }
148
149 const G4ElementTable* elemTable = G4Element::GetElementTable();
150 size_t numElems = (*elemTable).size();
151 for(size_t ie = 0; ie < numElems; ++ie)
152 {
153 const G4Element* elem = (*elemTable)[ie];
154 const G4int Z = std::min(maxZ, elem->GetZasInt());
155 if(fCrossSection[Z] == nullptr)
156 {
157 ReadData(Z);
158 }
159 }
160 }
161
162 if (verboseLevel > 2) {
163 G4cout << "Loaded cross section files for new LivermorePhotoElectric model"
164 << G4endl;
165 }
166 if(!isInitialised) {
167 isInitialised = true;
170 }
171
172 fDeexcitationActive = false;
175 }
176
177 if (verboseLevel > 0) {
178 G4cout << "LivermorePhotoElectric model is initialized " << G4endl
179 << G4endl;
180 }
181}
182
183//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184
186 const G4Material* material,
187 const G4ParticleDefinition* p,
190{
191 fCurrSection = 0.0;
192 if(fWater && (material == fWater ||
193 material->GetBaseMaterial() == fWater)) {
196
197 G4double energy2 = energy*energy;
198 G4double energy3 = energy*energy2;
199 G4double energy4 = energy2*energy2;
200
201 fCurrSection = material->GetDensity()*
202 (fSandiaCof[0]/energy + fSandiaCof[1]/energy2 +
203 fSandiaCof[2]/energy3 + fSandiaCof[3]/energy4);
204 }
205 }
206 if(0.0 == fCurrSection) {
208 }
209 return fCurrSection;
210}
211
212//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
213
217 G4double ZZ, G4double,
219{
220 if (verboseLevel > 3) {
221 G4cout << "\n G4LivermorePhotoElectricModel::ComputeCrossSectionPerAtom():"
222 << " Z= " << ZZ << " R(keV)= " << energy/keV << G4endl;
223 }
224 G4double cs = 0.0;
225 G4int Z = G4lrint(ZZ);
226 if(Z > maxZ) { return cs; }
227 // if element was not initialised
228
229 // do initialisation safely for MT mode
230 if(fCrossSection[Z] == nullptr) { InitialiseForElement(theGamma, Z); }
231
232 //7: rows in the parameterization file; 5: number of parameters
233 G4int idx = fNShells[Z]*7 - 5;
234
235 energy = std::max(energy, (*(fParamHigh[Z]))[idx-1]);
236
237 G4double x1 = 1.0/energy;
238 G4double x2 = x1*x1;
239 G4double x3 = x2*x1;
240
241 // high energy parameterisation
242 if(energy >= (*(fParamHigh[Z]))[0]) {
243
244 G4double x4 = x2*x2;
245 G4double x5 = x4*x1;
246
247 cs = x1*((*(fParamHigh[Z]))[idx] + x1*(*(fParamHigh[Z]))[idx+1]
248 + x2*(*(fParamHigh[Z]))[idx+2] + x3*(*(fParamHigh[Z]))[idx+3]
249 + x4*(*(fParamHigh[Z]))[idx+4]+ x5*(*(fParamHigh[Z]))[idx+5]);
250
251 }
252 // low energy parameterisation
253 else if(energy >= (*(fParamLow[Z]))[0]) {
254
255 G4double x4 = x2*x2;
256 G4double x5 = x4*x1; //this variable usage can probably be optimized
257 cs = x1*((*(fParamLow[Z]))[idx] + x1*(*(fParamLow[Z]))[idx+1]
258 + x2*(*(fParamLow[Z]))[idx+2] + x3*(*(fParamLow[Z]))[idx+3]
259 + x4*(*(fParamLow[Z]))[idx+4]+ x5*(*(fParamLow[Z]))[idx+5]);
260
261 }
262 // Tabulated values above k-shell ionization energy
263 else if(energy >= (*(fParamHigh[Z]))[1]) {
264 cs = x3*(fCrossSection[Z])->Value(energy);
265 }
266 // Tabulated values below k-shell ionization energy
267 else
268 {
269 cs = x3*(fCrossSectionLE[Z])->Value(energy);
270 }
271 if (verboseLevel > 1) {
272 G4cout << "G4LivermorePhotoElectricModel: E(keV)= " << energy/keV
273 << " Z= " << Z << " cross(barn)= " << cs/barn << G4endl;
274 }
275 return cs;
276}
277
278//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
279
280void
282 std::vector<G4DynamicParticle*>* fvect,
283 const G4MaterialCutsCouple* couple,
284 const G4DynamicParticle* aDynamicGamma,
286{
287 G4double gammaEnergy = aDynamicGamma->GetKineticEnergy();
288 if (verboseLevel > 3) {
289 G4cout << "G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
290 << gammaEnergy/keV << G4endl;
291 }
292
293 // kill incident photon
296
297 // low-energy photo-effect in water - full absorption
298 const G4Material* material = couple->GetMaterial();
299 if(fWater && (material == fWater ||
300 material->GetBaseMaterial() == fWater)) {
301 if(gammaEnergy <= fWaterEnergyLimit) {
303 return;
304 }
305 }
306
307 // Returns the normalized direction of the momentum
308 G4ThreeVector photonDirection = aDynamicGamma->GetMomentumDirection();
309
310 // Select randomly one element in the current material
311 const G4Element* elm = SelectRandomAtom(material, theGamma, gammaEnergy);
312 G4int Z = elm->GetZasInt();
313
314 // Select the ionised shell in the current atom according to shell
315 // cross sections
316 // G4cout << "Select random shell Z= " << Z << G4endl;
317 if(Z > maxZ) { Z = maxZ; }
318
319 // element was not initialised gamma should be absorbed
320 if(fCrossSection[Z] == nullptr) {
322 return;
323 }
324
325 // SAMPLING OF THE SHELL INDEX
326 size_t shellIdx = 0;
327 size_t nn = fNShellsUsed[Z];
328 if(nn > 1)
329 {
330 if(gammaEnergy >= (*(fParamHigh[Z]))[0])
331 {
332 G4double x1 = 1.0/gammaEnergy;
333 G4double x2 = x1*x1;
334 G4double x3 = x2*x1;
335 G4double x4 = x3*x1;
336 G4double x5 = x4*x1;
337 G4int idx = nn*7 - 5;
338 // when do sampling common factors are not taken into account
339 // so cross section is not real
340
341 G4double rand=G4UniformRand();
342 G4double cs0 = rand*( (*(fParamHigh[Z]))[idx]
343 + x1*(*(fParamHigh[Z]))[idx+1]
344 + x2*(*(fParamHigh[Z]))[idx+2]
345 + x3*(*(fParamHigh[Z]))[idx+3]
346 + x4*(*(fParamHigh[Z]))[idx+4]
347 + x5*(*(fParamHigh[Z]))[idx+5]);
348
349 for(shellIdx=0; shellIdx<nn; ++shellIdx)
350 {
351 idx = shellIdx*7 + 2;
352 if(gammaEnergy > (*(fParamHigh[Z]))[idx-1])
353 {
354 G4double cs =
355 (*(fParamHigh[Z]))[idx]
356 + x1*(*(fParamHigh[Z]))[idx+1]
357 + x2*(*(fParamHigh[Z]))[idx+2]
358 + x3*(*(fParamHigh[Z]))[idx+3]
359 + x4*(*(fParamHigh[Z]))[idx+4]
360 + x5*(*(fParamHigh[Z]))[idx+5];
361
362 if(cs >= cs0) { break; }
363 }
364 }
365 if(shellIdx >= nn) { shellIdx = nn-1; }
366 }
367 else if(gammaEnergy >= (*(fParamLow[Z]))[0])
368 {
369 G4double x1 = 1.0/gammaEnergy;
370 G4double x2 = x1*x1;
371 G4double x3 = x2*x1;
372 G4double x4 = x3*x1;
373 G4double x5 = x4*x1;
374 G4int idx = nn*7 - 5;
375 // when do sampling common factors are not taken into account
376 // so cross section is not real
377 G4double cs0 = G4UniformRand()*((*(fParamLow[Z]))[idx]
378 + x1*(*(fParamLow[Z]))[idx+1]
379 + x2*(*(fParamLow[Z]))[idx+2]
380 + x3*(*(fParamLow[Z]))[idx+3]
381 + x4*(*(fParamLow[Z]))[idx+4]
382 + x5*(*(fParamLow[Z]))[idx+5]);
383 for(shellIdx=0; shellIdx<nn; ++shellIdx)
384 {
385 idx = shellIdx*7 + 2;
386 if(gammaEnergy > (*(fParamLow[Z]))[idx-1])
387 {
388 G4double cs = (*(fParamLow[Z]))[idx] + x1*(*(fParamLow[Z]))[idx+1]
389 + x2*(*(fParamLow[Z]))[idx+2] + x3*(*(fParamLow[Z]))[idx+3]
390 + x4*(*(fParamLow[Z]))[idx+4]+ x5*(*(fParamLow[Z]))[idx+5];
391 if(cs >= cs0) { break; }
392 }
393 }
394 if(shellIdx >= nn) {shellIdx = nn-1;}
395 }
396 else
397 {
398 // when do sampling common factors are not taken into account
399 // so cross section is not real
400 G4double cs = G4UniformRand();
401
402 if(gammaEnergy >= (*(fParamHigh[Z]))[1]) {
403 //above K-shell binding energy
404 cs*= (fCrossSection[Z])->Value(gammaEnergy);
405 }
406 else
407 {
408 //below K-shell binding energy
409 cs *= (fCrossSectionLE[Z])->Value(gammaEnergy);
410 }
411
412 for(size_t j=0; j<nn; ++j) {
413
414 shellIdx = (size_t)fShellCrossSection->GetComponentID(Z, j);
415 if(gammaEnergy > (*(fParamLow[Z]))[7*shellIdx+1]) {
416 cs -= fShellCrossSection->GetValueForComponent(Z, j, gammaEnergy);
417 }
418 if(cs <= 0.0 || j+1 == nn) {break;}
419 }
420 }
421 }
422 // END: SAMPLING OF THE SHELL
423
424 G4double bindingEnergy = (*(fParamHigh[Z]))[shellIdx*7 + 1];
425 const G4AtomicShell* shell = nullptr;
426
427 // no de-excitation from the last shell
428 if(fDeexcitationActive && shellIdx + 1 < nn) {
430 shell = fAtomDeexcitation->GetAtomicShell(Z, as);
431 }
432
433 // If binding energy of the selected shell is larger than photon energy
434 // do not generate secondaries
435 if(gammaEnergy < bindingEnergy) {
437 return;
438 }
439
440 // Primary outcoming electron
441 G4double eKineticEnergy = gammaEnergy - bindingEnergy;
442 G4double edep = bindingEnergy;
443
444 // Calculate direction of the photoelectron
445 G4ThreeVector electronDirection =
447 eKineticEnergy,
448 shellIdx,
449 couple->GetMaterial());
450
451 // The electron is created
453 electronDirection,
454 eKineticEnergy);
455 fvect->push_back(electron);
456
457 // Sample deexcitation
458 if(shell) {
459 G4int index = couple->GetIndex();
461 G4int nbefore = fvect->size();
462
463 fAtomDeexcitation->GenerateParticles(fvect, shell, Z, index);
464 G4int nafter = fvect->size();
465 if(nafter > nbefore) {
466 G4double esec = 0.0;
467 for (G4int j=nbefore; j<nafter; ++j) {
468
469 G4double e = ((*fvect)[j])->GetKineticEnergy();
470 if(esec + e > edep) {
471 // correct energy in order to have energy balance
472 e = edep - esec;
473 ((*fvect)[j])->SetKineticEnergy(e);
474 esec += e;
475 // delete the rest of secondaries (should not happens)
476 for (G4int jj=nafter-1; jj>j; --jj) {
477 delete (*fvect)[jj];
478 fvect->pop_back();
479 }
480 break;
481 }
482 esec += e;
483 }
484 edep -= esec;
485 }
486 }
487 }
488 // energy balance - excitation energy left
489 if(edep > 0.0) {
491 }
492}
493
494//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
495
497{
498 // check environment variable
499 // build the complete string identifying the file with the data set
500 if(fDataDirectory.empty()) {
501 const char* path = std::getenv("G4LEDATA");
502 if (path) {
503 std::ostringstream ost;
504 if(G4EmParameters::Instance()->LivermoreDataDir() =="livermore"){
505 ost << path << "/livermore/phot_epics2014/";
506 }else{
507 ost << path << "/epics2017/phot/";
508 }
509
510 fDataDirectory = ost.str();
511 } else {
512 G4Exception("G4SeltzerBergerModel::FindDirectoryPath()","em0006",
514 "Environment variable G4LEDATA not defined");
515 }
516 }
517 return fDataDirectory;
518}
519
520//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
521
523{
524 if (verboseLevel > 1)
525 {
526 G4cout << "Calling ReadData() of G4LivermorePhotoElectricModel"
527 << G4endl;
528 }
529
530 if(fCrossSection[Z]!= nullptr) { return; }
531
532 // no spline for photoeffect total x-section above K-shell
533 // but below the parameterized ones
535 std::ostringstream ost;
536 ost << FindDirectoryPath() << "pe-cs-" << Z <<".dat";
537 std::ifstream fin(ost.str().c_str());
538 if( !fin.is_open()) {
540 ed << "G4LivermorePhotoElectricModel data file <" << ost.str().c_str()
541 << "> is not opened!" << G4endl;
542 G4Exception("G4LivermorePhotoElectricModel::ReadData()",
543 "em0003",FatalException,
544 ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
545 return;
546 }
547 if(verboseLevel > 3) {
548 G4cout << "File " << ost.str().c_str()
549 << " is opened by G4LivermorePhotoElectricModel" << G4endl;
550 }
551 fCrossSection[Z]->Retrieve(fin, true);
554 fin.close();
555
556 // read high-energy fit parameters
557 fParamHigh[Z] = new std::vector<G4double>;
558 G4int n1 = 0;
559 G4int n2 = 0;
560 G4double x;
561 std::ostringstream ost1;
562 ost1 << fDataDirectory << "pe-high-" << Z <<".dat";
563 std::ifstream fin1(ost1.str().c_str());
564 if( !fin1.is_open()) {
566 ed << "G4LivermorePhotoElectricModel data file <" << ost1.str().c_str()
567 << "> is not opened!" << G4endl;
568 G4Exception("G4LivermorePhotoElectricModel::ReadData()",
569 "em0003",FatalException,
570 ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
571 return;
572 }
573 if(verboseLevel > 3) {
574 G4cout << "File " << ost1.str().c_str()
575 << " is opened by G4LivermorePhotoElectricModel" << G4endl;
576 }
577 fin1 >> n1;
578 if(fin1.fail()) { return; }
579 if(0 > n1 || n1 >= INT_MAX) { n1 = 0; }
580
581 fin1 >> n2;
582 if(fin1.fail()) { return; }
583 if(0 > n2 || n2 >= INT_MAX) { n2 = 0; }
584
585 fin1 >> x;
586 if(fin1.fail()) { return; }
587
588 fNShells[Z] = n1;
589 fParamHigh[Z]->reserve(7*n1+1);
590 fParamHigh[Z]->push_back(x*MeV);
591 for(G4int i=0; i<n1; ++i) {
592 for(G4int j=0; j<7; ++j) {
593 fin1 >> x;
594 if(0 == j) { x *= MeV; }
595 else { x *= barn; }
596 fParamHigh[Z]->push_back(x);
597 }
598 }
599 fin1.close();
600
601 // read low-energy fit parameters
602 fParamLow[Z] = new std::vector<G4double>;
603 G4int n1_low = 0;
604 G4int n2_low = 0;
605 G4double x_low;
606 std::ostringstream ost1_low;
607 ost1_low << fDataDirectory << "pe-low-" << Z <<".dat";
608 std::ifstream fin1_low(ost1_low.str().c_str());
609 if( !fin1_low.is_open()) {
611 ed << "G4LivermorePhotoElectricModel data file <" << ost1_low.str().c_str()
612 << "> is not opened!" << G4endl;
613 G4Exception("G4LivermorePhotoElectricModel::ReadData()",
614 "em0003",FatalException,
615 ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
616 return;
617 }
618 if(verboseLevel > 3) {
619 G4cout << "File " << ost1_low.str().c_str()
620 << " is opened by G4LivermorePhotoElectricModel" << G4endl;
621 }
622 fin1_low >> n1_low;
623 if(fin1_low.fail()) { return; }
624 if(0 > n1_low || n1_low >= INT_MAX) { n1_low = 0; }
625
626 fin1_low >> n2_low;
627 if(fin1_low.fail()) { return; }
628 if(0 > n2_low || n2_low >= INT_MAX) { n2_low = 0; }
629
630 fin1_low >> x_low;
631 if(fin1_low.fail()) { return; }
632
633 fNShells[Z] = n1_low;
634 fParamLow[Z]->reserve(7*n1_low+1);
635 fParamLow[Z]->push_back(x_low*MeV);
636 for(G4int i=0; i<n1_low; ++i) {
637 for(G4int j=0; j<7; ++j) {
638 fin1_low >> x_low;
639 if(0 == j) { x_low *= MeV; }
640 else { x_low *= barn; }
641 fParamLow[Z]->push_back(x_low);
642 }
643 }
644 fin1_low.close();
645
646 // there is a possibility to use only main shells
647 if(nShellLimit < n2) { n2 = nShellLimit; }
648 fShellCrossSection->InitialiseForComponent(Z, n2);//number of shells
649 fNShellsUsed[Z] = n2;
650
651 if(1 < n2) {
652 std::ostringstream ost2;
653 ost2 << fDataDirectory << "pe-ss-cs-" << Z <<".dat";
654 std::ifstream fin2(ost2.str().c_str());
655 if( !fin2.is_open()) {
657 ed << "G4LivermorePhotoElectricModel data file <" << ost2.str().c_str()
658 << "> is not opened!" << G4endl;
659 G4Exception("G4LivermorePhotoElectricModel::ReadData()",
660 "em0003",FatalException,
661 ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
662 return;
663 }
664 if(verboseLevel > 3) {
665 G4cout << "File " << ost2.str().c_str()
666 << " is opened by G4LivermorePhotoElectricModel" << G4endl;
667 }
668
669 G4int n3, n4;
670 G4double y;
671 for(G4int i=0; i<n2; ++i) {
672 fin2 >> x >> y >> n3 >> n4;
673 G4PhysicsFreeVector* v = new G4PhysicsFreeVector(n3, x, y);
674 for(G4int j=0; j<n3; ++j) {
675 fin2 >> x >> y;
676 v->PutValues(j, x*MeV, y*barn);
677 }
679 }
680 fin2.close();
681 }
682
683 // no spline for photoeffect total x-section below K-shell
684 if(1 < fNShells[Z]) {
686 std::ostringstream ost3;
687 ost3 << fDataDirectory << "pe-le-cs-" << Z <<".dat";
688 std::ifstream fin3(ost3.str().c_str());
689 if( !fin3.is_open()) {
691 ed << "G4LivermorePhotoElectricModel data file <" << ost3.str().c_str()
692 << "> is not opened!" << G4endl;
693 G4Exception("G4LivermorePhotoElectricModel::ReadData()",
694 "em0003",FatalException,
695 ed,"G4LEDATA version should be G4EMLOW7.2 or later.");
696 return;
697 }
698 if(verboseLevel > 3) {
699 G4cout << "File " << ost3.str().c_str()
700 << " is opened by G4LivermorePhotoElectricModel" << G4endl;
701 }
702 fCrossSectionLE[Z]->Retrieve(fin3, true);
704 fin3.close();
705 }
706}
707
708//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
709
711{
712 if(Z < 1 || Z > maxZ) { return -1;} //If Z is out of the supported return 0
713 //If necessary load data for Z
715 if(fCrossSection[Z] == nullptr || shell < 0 || shell >= fNShellsUsed[Z]) { return -1; }
716
717 if(Z>2)
719 else
720 return fCrossSection[Z]->Energy(0);
721}
722
723//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
724
727{
728 if (fCrossSection[Z] == nullptr) {
729#ifdef G4MULTITHREADED
730 G4MUTEXLOCK(&livPhotoeffMutex);
731 if (fCrossSection[Z] == nullptr) {
732#endif
733 ReadData(Z);
734#ifdef G4MULTITHREADED
735 }
736 G4MUTEXUNLOCK(&livPhotoeffMutex);
737#endif
738 }
739}
740
741//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4AtomicShellEnumerator
std::vector< G4Element * > G4ElementTable
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static const G4int maxZ
#define elem(i, j)
static constexpr double barn
Definition: G4SIunits.hh:85
static constexpr double keV
Definition: G4SIunits.hh:202
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double MeV
Definition: G4SIunits.hh:200
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
std::mutex G4Mutex
Definition: G4Threading.hh:81
@ fStopAndKill
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * Electron()
Definition: G4Electron.cc:93
G4PhysicsVector * GetComponentDataByIndex(G4int Z, G4int idx)
void InitialiseForComponent(G4int Z, G4int nComponents=0)
G4double GetValueForComponent(G4int Z, G4int idx, G4double kinEnergy)
void AddComponent(G4int Z, G4int id, G4PhysicsVector *v)
G4int GetComponentID(G4int Z, G4int idx)
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397
G4int GetZasInt() const
Definition: G4Element.hh:132
static G4EmParameters * Instance()
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double energy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX) override
static G4PhysicsFreeVector * fCrossSectionLE[101]
G4ParticleChangeForGamma * fParticleChange
G4double GetBindingEnergy(G4int Z, G4int shell)
void InitialiseForElement(const G4ParticleDefinition *, G4int Z) override
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
static G4PhysicsFreeVector * fCrossSection[101]
const G4ParticleDefinition * theElectron
static std::vector< G4double > * fParamHigh[101]
static std::vector< G4double > * fParamLow[101]
G4LivermorePhotoElectricModel(const G4String &nam="LivermorePhElectric")
G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double energy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX) override
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4SandiaTable * GetSandiaTable() const
Definition: G4Material.hh:225
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:686
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void PutValues(const std::size_t index, const G4double energy, const G4double value)
void ScaleVector(const G4double factorE, const G4double factorV)
G4double Energy(const std::size_t index) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
void GetSandiaCofWater(G4double energy, std::vector< G4double > &coeff) const
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)
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, const G4Material *)=0
G4VEmAngularDistribution * GetAngularDistribution()
Definition: G4VEmModel.hh:621
G4ParticleChangeForGamma * GetParticleChangeForGamma()
Definition: G4VEmModel.cc:123
G4bool IsMaster() const
Definition: G4VEmModel.hh:746
virtual G4double CrossSectionPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:237
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
Definition: G4VEmModel.cc:406
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.hh:580
void SetDeexcitationFlag(G4bool val)
Definition: G4VEmModel.hh:823
void SetAngularDistribution(G4VEmAngularDistribution *)
Definition: G4VEmModel.hh:628
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double energy(const ThreeVector &p, const G4double m)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double bindingEnergy(G4int A, G4int Z)
string material
Definition: eplot.py:19
int G4lrint(double ad)
Definition: templates.hh:134
#define INT_MAX
Definition: templates.hh:90