Message: How to get total energy for different particles? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to get total energy for different particles? 

Forum: Event and Track Management
Date: 19 Apr, 2017
From: gdss <gdss>


Recently I tried to get track ID, parent ID and energy for all secondary particles in one simulation. Primary particle was electrons (kinetic energy: 1~8 MeV) and sensitive material was liquid scintillator. Process involved mainly included ionization, Compton scattering, photoelectric effect, bremsstrahlung, scintillation etc.

At first, I read total energy by the following codes:

    void AnaMgr::PreUserTrackingAction (const G4Track* aTrack)

      G4double edep = 0;
      G4int id = aTrack->GetTrackID();
      if (aTrack->GetDefinition()->GetParticleName() == "e-"){
        edep = aTrack->GetKineticEnergy();
      } else {
        edep = aTrack->GetTotalEnergy();
      Second_Energy[id] = edep;

But it very strange that some electrons has higher energies than their parent particles. Please refer to the attached picture. In the picture, Type 0 and type 1 represent electrons produced by Compton scattering and ionization respectively, and type 6 stands for gamma produced by bremsstrahlung. Energies are in the unit of keV.

Now I used the following new codes to read total energy and the strange proble described above disappeared:

    void AnaMgr::UserSteppingAction (const G4Step* step)
      G4int id = step->GetTrack()->GetTrackID();
      G4double deltaE = step->GetDeltaEnergy();
      if (deltaE < 0) deltaE = -1*deltaE;
      Second_Energy[id] += deltaE;

In both codes, std::map<int,float> Second_Energy was defined somewhere else.

Could somebody tell me what is the difference between those two codes block above and which is the right one to get total energy of any secondary particles?

I used Geant4.9.4.p04. Any help will be greatly appreciated.


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Question: Re: How to get total energy for different particles?   (chunhui gong - Feb 28, 03:09)
(_ None: Re: How to get total energy for different particles?   (gdss - Mar 01, 21:33)
 Add Message Add Message
to: "How to get total energy for different particles?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]