Trajectory of positron in a scintillator

Hi. I am trying to get the trajectory (i.e., the 3D coordinates of track points) of a positron in a scintillator. Only the position information is needed, and nothing else. No other particles need to be tracked. The positron is incident onto the scintillator from outside. There are other volumes next to the scintillator.

I am currently getting the position information using ‘step->GetPreStepPoint()->GetPosition()’ in mySteppingAction::UserSteppingAction() function, then summarize and export the result in the myEventAction::EndOfEventAction() function. I am looking for a more efficient way.

In particular,

  • would it be a good idea to use a sensitive detector? My concern is that ProcessHits() may be invoked when other trajectories, not the one being tracked, make steps in the volume assigned to a sensitive detector.
  • how about using G4TrackingManager::SetStoreTrajectory in myTrackingAction?
  • how about redicting the output of SteppingVerbose, which prints the step information to G4cout, to a file?

Thank you.

You can do direct comparisons of the particle type with the geant4 positron definition:

if (track->GetDefinition() == G4Positron::Definition()) {
          # Do things
    } else {
         # return early 
    }

If your positron energies are in the MeVs range then you can also set production and range cuts of all other charged particles to zero and/or kill particles that aren’t positrons in the tracking or stepping action.

Create an n-tuple with the event id, x, y, and z recorded for each position for later processing. Set the positron range cut ever lower for higher resolution at the expense of speed.

You can also create a vector (stack) of the 3d positions in the TrackingActions and make it accessible from outside the class. This way, no output is involved. The std::vector should be faster.

Thank you for the suggestion. Just to make sure I understood correctly, would you “Create an n-tuple with the event id, x, y, and z recorded for each position for later processing.”, in myEventAction::EndOfEventAction()?

Thank you for the suggestion. Would it also work if I use G4TrackingManager::SetStoreTrajectory in myTrackingAction, then store the positions in myEventAction::EndOfEventAction() using G4TrajectoryContainer* trajCont = event->GetTrajectoryContainer()?

You can either populate the ntuples in your stepping action or group all the variables into sets that you then populate in the end of event action (and then clear the set for the next event).

@phirippu has the cleaner approach of just doing it in the tracking action which would be faster.

Thanks much again.

Could you please explain a little more how to do it in the tracking action?
My understanding is that the tracking action is invoked only at the beginning or the end of a track. To access the step information or the step points along the path followed by the track, I need to use G4TrackingManager and turn on G4TrackingManager::SetStoreTrajectory(G4bool). I haven’t done this myself. I am just guessing based on several pieces of information.