The photoelectric effect happens, but can't find it

hello. everyone!
I study the interaction between gamma photons and NaI.
In my SteppingAction I want to print the physical process of gamma and the source of electrons.

  1. auto particleName = fParticleDef->GetParticleName();
  2. if (fParticleDef == G4Gamma::GammaDefinition())
  3. {
  4. const G4VProcess* process = step->GetPostStepPoint()->GetProcessDefinedStep();
  5. G4String processName = " UserLimit";
  6. if (process) { processName = process->GetProcessName(); }
  7.     G4cout << "*Gamma - Process:  " << processName  << G4endl;
    
  8. }
  9. else if (particleName == “e-”)
  10. {
  11. G4String creatorName = "User";
    
  12. auto CreatorProcess = step->GetTrack()->GetCreatorProcess();
    
  13. if (CreatorProcess) { creatorName = CreatorProcess->GetProcessName(); }
    
  14. G4cout << "* - ElectronProcess:  " << creatorName <<  G4endl;
    
  15. }

in the print results of "Gamma - Process " there are Transportation, compt, Rayl, but without “phot”.
However, in the print results of "
- ElectronProcess: " there are “phot”, “compt” and “eIoni”.

The photoelectric effect does happen, why can’t I get it through the physical process of gamma photon. :roll_eyes:

hm, that is weird. have you tried with enough sample size to be sure it does not occur?
quick test shows this:

...
G4WT0 > *Gamma - Process:  compt
G4WT2 > *Gamma - Process:  phot
G4WT0 > *Gamma - Process:  compt
G4WT2 > * - ElectronProcess:  phot
G4WT0 > *Gamma - Process:  compt
G4WT2 > * - ElectronProcess:  phot
G4WT0 > *Gamma - Process:  CoupledTransportation
G4WT2 > * - ElectronProcess:  phot
...

in particular, these two are in the same thread and right after another (so it presumably is the electron originating from the photoelectric effect, where the gamma is destroyed):

...
G4WT2 > *Gamma - Process:  phot
...
G4WT2 > * - ElectronProcess:  phot
...
Code Snippet
    G4Track *track = aStep->GetTrack();
    const G4ParticleDefinition* particleDefinition = track->GetParticleDefinition();
    if (particleDefinition == G4Gamma::GammaDefinition()) {
        const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
        G4String processName = " UserLimit";
        if (process) { processName = process->GetProcessName(); }
        G4cout << "*Gamma - Process:  " << processName  << G4endl;
    }
    else if (particleDefinition == G4Electron::ElectronDefinition())
    {
        G4String creatorName = "User";
        auto CreatorProcess = aStep->GetTrack()->GetCreatorProcess();
        if (CreatorProcess) { creatorName = CreatorProcess->GetProcessName(); }
        G4cout << "* - ElectronProcess:  " << creatorName <<  G4endl;
    }

Thank you for your reply!
I just tried changing the particle gun energy, changing the physics list, but “phot” still did not appear.
Maybe I should take another look at Geant4’s example and compare the difference between my project and the Geant4 example.

Thanks again!

I noticed that you filter for gamma by comparing fParticleDef == G4Gamma::GammaDefinition() but the electron with particleName == "e-"
→ could it be that fParticleDef was changed to be the electron already when the snippet is executet? In my tests I obtained the ParticleDefinition from the track directly!

Hi,weller. Thanks for your help. Finally, I found my mistake based on your reply.
Before this snippet, there was a sentence

  1. G4Track* aTrack = step->GetTrack();
  2. if (aTrack->GetTrackStatus() != fAlive) { return; }

It caused the problem, after removing it, the problem was solved.

Thanks again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.