Message: Re: retrieve the kinetic energy of parent particles Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: retrieve the kinetic energy of parent particles 

Forum: Analysis
Re: Question retrieve the kinetic energy of parent particles (andrea gelmi)
Date: 12 Jul, 2017
From: Michael H. Kelsey <Michael H. Kelsey>

On Wed, 12 Jul 2017 08:00:56 GMT, andrea gelmi wrote:
> Dears, I would like retrieve the kinetic energy of the parent particles,
> like a GetParentID.. there is a way? thanks a lot in advance :)

Not directly. G4Track objects are not preserved through an event: as soon as a track is killed, the object is deleted and its memory freed up for later use.

What you can do is make use of either a SteppingAction or a TrackingAction to capture the information before a track is deleted: In your SteppingAction::ProcessHits() function, check the status of the G4Step; if it is fStopAndKill, then get the list of secondaries for the track, and save (however you like) the associated between those secondaries and the track's energy.

In a TrackingAction, use PostUserTrackingAction similarly (you don't have to check the status here, since it's called at the fStopAndKill point).

  -- Michael Kelsey

 Add Message Add Message
to: "Re: retrieve the kinetic energy of parent 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 ]