288{
290 if (verboseLevel > 3) {
291 G4cout <<
"G4LivermorePhotoElectricModel::SampleSecondaries() Egamma(keV)= "
292 << gammaEnergy / keV <<
G4endl;
293 }
294
295
298
299
300 const G4Material* material = couple->
GetMaterial();
301 if (fWater && (material == fWater || material->
GetBaseMaterial() == fWater)) {
302 if (gammaEnergy <= fWaterEnergyLimit) {
304 return;
305 }
306 }
307
308
310
311
314
315
316
317
318
319 if (Z >= ZMAXPE || fCrossSection->GetElementData(Z) == nullptr) {
321 return;
322 }
323
324
325 std::size_t shellIdx = 0;
326 std::size_t
nn = fNShellsUsed[Z];
327 if (nn > 1) {
328 if (gammaEnergy >= (*(fParamHigh[Z]))[0]) {
334 std::size_t idx =
nn * 7 - 5;
335
336
337
340 ((*(fParamHigh[Z]))[idx] + x1 * (*(fParamHigh[Z]))[idx + 1]
341 + x2 * (*(fParamHigh[Z]))[idx + 2] + x3 * (*(fParamHigh[Z]))[idx + 3]
342 + x4 * (*(fParamHigh[Z]))[idx + 4] + x5 * (*(fParamHigh[Z]))[idx + 5]);
343
344 for (shellIdx = 0; shellIdx <
nn; ++shellIdx) {
345 idx = shellIdx * 7 + 2;
346 if (gammaEnergy > (*(fParamHigh[Z]))[idx - 1]) {
347 G4double cs = (*(fParamHigh[Z]))[idx] + x1 * (*(fParamHigh[Z]))[idx + 1]
348 + x2 * (*(fParamHigh[Z]))[idx + 2] + x3 * (*(fParamHigh[Z]))[idx + 3]
349 + x4 * (*(fParamHigh[Z]))[idx + 4] + x5 * (*(fParamHigh[Z]))[idx + 5];
350
351 if (cs >= cs0) {
352 break;
353 }
354 }
355 }
356 if (shellIdx >= nn) {
358 }
359 }
360 else if (gammaEnergy >= (*(fParamLow[Z]))[0]) {
366 std::size_t idx =
nn * 7 - 5;
367
368
370 ((*(fParamLow[Z]))[idx] + x1 * (*(fParamLow[Z]))[idx + 1]
371 + x2 * (*(fParamLow[Z]))[idx + 2] + x3 * (*(fParamLow[Z]))[idx + 3]
372 + x4 * (*(fParamLow[Z]))[idx + 4] + x5 * (*(fParamLow[Z]))[idx + 5]);
373 for (shellIdx = 0; shellIdx <
nn; ++shellIdx) {
374 idx = shellIdx * 7 + 2;
375 if (gammaEnergy > (*(fParamLow[Z]))[idx - 1]) {
376 G4double cs = (*(fParamLow[Z]))[idx] + x1 * (*(fParamLow[Z]))[idx + 1]
377 + x2 * (*(fParamLow[Z]))[idx + 2] + x3 * (*(fParamLow[Z]))[idx + 3]
378 + x4 * (*(fParamLow[Z]))[idx + 4] + x5 * (*(fParamLow[Z]))[idx + 5];
379 if (cs >= cs0) {
380 break;
381 }
382 }
383 }
384 if (shellIdx >= nn) {
386 }
387 }
388 else {
389
390
392
393 if (gammaEnergy >= (*(fParamHigh[Z]))[1]) {
394
395 cs *= fCrossSection->GetElementData(Z)->Value(gammaEnergy);
396 }
397 else {
398
399 cs *= fCrossSectionLE->GetElementData(Z)->Value(gammaEnergy);
400 }
401
403 shellIdx = (std::size_t)fCrossSection->GetComponentID(Z, j);
404 if (gammaEnergy > (*(fParamLow[Z]))[7 * shellIdx + 1]) {
405 cs -= fCrossSection->GetValueForComponent(Z, j, gammaEnergy);
406 }
407 if (cs <= 0.0 || j + 1 == (
G4int)nn) {
408 break;
409 }
410 }
411 }
412 }
413
414
416 const G4AtomicShell*
shell =
nullptr;
417
418
419 if (fDeexcitationActive && shellIdx + 1 < nn) {
421 shell = fAtomDeexcitation->GetAtomicShell(Z, as);
422 }
423
424
425
426 if (gammaEnergy < bindingEnergy) {
428 return;
429 }
430
431
434
435
438
439
441 new G4DynamicParticle(theElectron, electronDirection, eKineticEnergy);
442 fvect->push_back(electron);
443
444
445 if (nullptr != shell) {
447 if (fAtomDeexcitation->CheckDeexcitationActiveRegion(index)) {
448 std::size_t nbefore = fvect->size();
449
450 fAtomDeexcitation->GenerateParticles(fvect, shell, Z, index);
451 std::size_t nafter = fvect->size();
452 if (nafter > nbefore) {
454 for (std::size_t j = nbefore; j < nafter; ++j) {
455 G4double e = ((*fvect)[j])->GetKineticEnergy();
456 if (esec + e > edep) {
457
458 e = edep - esec;
459 ((*fvect)[j])->SetKineticEnergy(e);
460 esec += e;
461
462 for (std::size_t jj = nafter - 1; jj > j; --jj) {
463 delete (*fvect)[jj];
464 fvect->pop_back();
465 }
466 break;
467 }
468 esec += e;
469 }
470 edep -= esec;
471 }
472 }
473 }
474
475 if (edep > 0.0) {
477 }
478}
CLHEP::Hep3Vector G4ThreeVector
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4Material * GetMaterial() const
virtual G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, const G4Material *)=0
G4VEmAngularDistribution * GetAngularDistribution()
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4double bindingEnergy(G4int A, G4int Z)