Message: Re: Time/distance of particle in the current volume Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Time/distance of particle in the current volume 

Forum: Event and Track Management
Re: Question Time/distance of particle in the current volume (Angela Lucaci-Timoce)
Date: 13 Nov, 2008
From: Gumplinger Peter <Gumplinger Peter>

The track's velocity is calculated in G4Track::GetVelocity() for a massive particle as follows:

G4double T = fpDynamicParticle->GetKineticEnergy(); velocity = c_light*std::sqrt(T*(T+2.*mass))/(T+mass);

I don't see where the step length comes in(?)

The time spent in a volume is not something G4 keeps track off. You need to calculate it yourself and keep track of it in, for example, your UserSteppingAction. You can identify the step arriving at a volume named 'name' with:

if (pPostStepPoint->GetStepStatus() == fGeomBoundary) {
   if(pTrack->GetNextVolume)pTrack->GetNextVolume()->GetName() == "name") {
   // enter named volume
     time1 = pTrack->GetLocalTime();

also see:

http://geant4.web.cern.ch/geant4/support/faq.shtml#TRACK-1

You need the time from this (previous) step and not from the first step in your named volume, because the time will have been incremented for the distance/time traveled during the first step.

Get LocalTime is the time since the track is created, while GlobalTime is the time since the beginning of the event. An electron from muon decay will have significantly different Local and Global times, for example.

Steps are not persistent and you cannot loop over (find) previous steps at any time of the tracking. You can get at this information if you have created 'trajectories' and have access to its 'trajectory points'.

 Add Message Add Message
to: "Re: Time/distance of particle in the current volume"

 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 ]