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

None Re: How to get total energy for different particles? 

Forum: Event and Track Management
Re: Question How to get total energy for different particles? (gdss)
Re: Question Re: How to get total energy for different particles? (chunhui gong)
Date: Mar 01, 21:33
From: gdss <gdss>

Dear Chunhui,

Are you also simulating Cherenkov process? The reason why some secondary electrons have higher energy than their parent particles is that those parent particles have been tracked for many times, namely you may update the energy of some electrons more than once in PreUserTrackingAction. This is very strange, however it is true for Cherenkov process, because there may be too many optical photons generated even in a single step. Please refer to section 5.2.5.1 of Geant4 user documentation or just search SetTrackSecondariesFirst.

So before updating the energy of a trackID, you should check if it is the first time to be read:

    void AnaMgr::PreUserTrackingAction (const G4Track* aTrack)
     {
       ......

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

Hoping that is helpful to you!

Best wishes, gdss Mar. 02, 2019

 Add Message Add Message
to: "Re: 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 ]