Timing information of energy deposition

Hi Geant4 users, I am seeking the information about particle energy deposition time.I want to make energy deposition histogram in a detector based on time.And So I can easily get the amount of energy deposited in a given time interval. I guess I have to use GetGlobalTime method of G4Track/StepPoint class. Is there any example in basis/extended/advance examples of Geant4?

What you are looking for might be:

step->GetPreStepPoint()->GetGlobalTime();

This you need to use during the

 G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)

method of the sensitive detector called as a stepping action. With this you get a time and also the energy deposition during a step inside a sensitive detector.