Message: how to trace back a track Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question how to trace back a track 

Forum: Event and Track Management
Date: 26 Jul, 2016
From: Maura E.M. <Maura E.M.>

I am simulating a monoenergetic photons source in water. My goal is to score a phase space file that contains only the secondary particles generated by the 1st interation. Therefore discarding primary photons as well as particles produced by two or more interactions. I read the sections about Tracks and Steps in the Application User Guide. I saw the G4Track contains the current Track ID number and the Track ID number of the parent. This is all what I need. I think I can get the Track ID number of the parent through

G4int parentID = (aStep->GetTrack()->GetParentID());

I tried to use the method SetTrackID to trace back the history up to the primary track whose parentID is equal to zero while counting the number of interactions. The following loop does not compile even if I have included G4Track.hh

      G4int numHits = 0;
      G4int parentID = (aStep->GetTrack()->GetParentID());
      while (parentID) {
        numHits = numHits + 1;
        G4Track* newhit = SetTrackID(parentID);
        parentID = newhit->GetTrack()->GetParentID();
     if (numHits == 1) {  
       fNtuple->Fill();     // Append particle to phase space
       return true;

Is there any example showing how to navigate upwards a history ? Thank you so much for any help Regards, mauede


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: how to trace back a track   (Gumplinger Peter - 27 Jul, 2016)
(_ Question: Re: how to trace back a track   (Maura E.M. - 28 Jul, 2016)
 Add Message Add Message
to: "how to trace back a track"

 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 ]