How precise can we get the position of an energy deposition deposited due to a specific interaction?

I need to extract the position of energy depositions in a scintillator of few micrometers width, which is exposed to primary gammas. Specifically, I need to get the positions of the edeps that can produce optical photons and I have to do it as precise as possible. I noticed that in some Geant4-DNA examples, people get edep positions from the preStepPoints but I am worried that this way the results would very much depend on the chosen step lengths.
Am I worried rightly so, especially when dealing with a micrometer-sized detector?
Many thanks and appreciate any help!

I would not get Edep positions from preStep at all. For primary gammas, Edep only happens at postStep positions. For secondary electrons, Edep happens partially at the postStep position, but also continuously along the step (between preStep and postStep).

But you’re not asking about energy deposits, you’re asking about optical photon secondaries. If you have your physics list and material properties set up to produce the optical photons, then getting the positions is very easy. If you want to associate the photons with the steps of whatever is creating them, then in your SteppingAction or SD, do something like the following:

  • Is the particle the kind you’re interested in (electron or gamma)?
  • Did the particle create any secondaries?
  • Were those secondaries optical photons, or something else?
  • Record the postStep position (or average along the step, or whatever you choose).

If you don’t care about the parent particle, but just want to know where optical photons are being created it’s simpler. You can wait until the optical photon gets tracked:

  • Is the particle an optical photon?
  • Is this the first step (aTrack->GetCurrentStepNumber() == 1)?
  • Record the preStep position of the photon.

You could also do this method with a StackingAction, and just record the track position for new optical photons.

1 Like

Thank you very much for the comprehensive explanation! It gave me so much food for thought, indeed.

Just a follow-up question out of curiosity. Based on what you said, would that be fair to say that it is not entirely flawless to get the position of physical interactions from preStepPoint as it appears to be the suggestion in, for instance, the example \extended\medical\dna\dnadamage1, or for that matter other such examples?
Many thanks

For charged particles, there’s continuous energy loss (dE/dx) which is spread along the step from the preStep to the postStep point. Discrete processes can deposit energy, and they happen at the postStep point.

You do have to be a bit careful about the volume assignment – at the boundary where a particle is leaving the volume, the postStep point coordinate is on the boundary, but the volume (i.e., the touchable of the postStep point) will be the next volume, not the current volume.

Thank you so much indeed!

Speaking of dE/dx spreading along the step, I expected that for all particles the direction of the vector connecting preStepPoint to postStepPoint should be the same as preStepPoint->GetMomentumDirection() in the absence of magnetic fields. However, only for gammas (as opposed to electrons) do I get the same results.

For instance, comparing preStepPoint->GetMomentumDirection().z() and ((step->GetDeltaPosition()).z())/step->GetStepLength(), I get same values for gammas but not for the electrons.
Am I mistaken in my understanding of preStepPoint->GetMomentumDirection()?

preStepPoint->GetMomentumDirection() gives you a unit vector, with the direction the track was going at the start of the step. You should use GetMomentum() to get the full momentum vector, including magnitude. Similarly, postStepPoint->GetMomentum() will give you the momentum vector at the end of the step.

If the track is travelling in an electric or a magnetic field, it is possible for Transportation to turn the track around completely, such that the post-step momentum is opposite-ish the pre-step momentum. If that turn-around happened early enough along the step, then yes, the position change could be opposite the pre-step momentum.

I understand your point regarding the effect of external EM fields due to the along-step modifications of the track. Now, since I have no EM fields in my geometry and since for electrons I see that momentum vector at preStepPoint does not align with the vector that connects the two step points, is it correct to conclude that it is the effect of the combination of all AlongStepDoIt processes that ultimately determines where the postStepPoint should be located?

In other words, is the orientation of the momentum vector at preStepPoint independent from step->GetDeltaPosition(), in general?

Yes, the AlongStepDoIt processes – in particular, multiple scattering for charged particles – can change the momentum direction. The effect is usually small, but not zero.

Thank you so much for your time!