Message: Re: full track info Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: full track info  

Forum: Processes Involving Optical Photons
Re: Question full track info
Date: 24 Jun, 2013
From: Gumplinger Peter <Gumplinger Peter>

Hi Baptiste,

> In my
> stepping action, as soon as one of my photons hit a particular volume, I
> would like to recover the track info (GetPosition() and GetTrackLength()
> mainly) for all the steps from the beginning to the last step
> (corresponding to the case where the photon is absorbed within a
> particular volume). In other words, knowing that my photon has ended up
> in a particular volume, I would like to get back his track history.

The concept of G4VTrajectory (and Point) is something that Geant4 (and G4 users/examples) use only at the EndOfEvent level. I can't find an example where it's used at the Stepping and/or Hit level. The reason is probably because there is no direct link between the G4Track object and the corresponding G4VTrajectory. The only correlation that exist is the TrackID. Moreover, there is another concept, the UserTrackInformation, that is better suited for your purposes. You fill your derived UserTrackInformation with the information you want at every step and when the track arrives at your destination you simply recover its UserTrackInformation and process it.

Your code snippet has at least one error:

>     for (G4int i=0; i<n_trajectories; i++){ 
>           G4Trajectory* trj = (G4Trajectory*)((*(My_evt->GetTrajectoryContainer()))[i]);
>           G4VTrajectoryPoint* TrajectoryPoint= trj->GetPoint(i); 

BINGO .. you are looping over trajectories and not over the points in them. For that you need another loop, npoints = trj->GetPointEntries(). You also need to confirm the correlation between your current G4Track with trj->GetTrackID().

Note, this all assumes (I don't know) that the G4Trajectory is already filled as far as you need it by the time you execute this logic in your SteppingAction.

Peter

 Add Message Add Message
to: "Re: full track info "

 Subscribe Subscribe

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