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

Hi
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!

1 Like

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.

2 Likes

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!

Hello I have been searching a method to collect the position of hit collection method using sensitive detector and I have come across your posting which is well explained.

I was thinking as same as you said by using stepping action but you also said using sensitive detector? Could you explain to me how to work on that?
do you create separate function or within the endofevent then call G4Step to do?

I really appreciate if you have any example that I could learn from. Thank you so much for your help in advance.

Please open a new question, rather than posting a follow up to an old thread. You can link to the old thread from your question if you think it’s relevant.

Hi, mkelsey
I obtained momentum using two different methods, but I found that their values are slightly different.
The one is:
G4ThreeVector mom1 = step → GetPreStepPoint() → GetMomentumDirection()

and another is calculated according to the pre- and pos- step point position:
First the pre and pos position were obtainted:
G4ThreeVector prepos = step ->GetPreStepPoint() ->GetPosition();
G4ThreeVector postpos = step → GetPostStepPoint() → GetPosition();
Then a momentum obtained uisng these two point coordinates, and normalized to its length.

For first method, the momentum value is: (-0.01469,-0.01770, 0.99974)
For second method, the value is: (-0.01077, -0.02192, 0.99970)

I am very confused about the differences in these two results. Do you know what the reason is?

A G4Step has a finite length. The pre-step and post-step have different coordinates (obviously), both of which are doubles (so your printed out values are already rounded off).

If you want to know the position of an interaction you know is “pointlike” (specifically, when you know inherits from G4VDiscreteProcess), then you should use the post-step position, and all the related post-step parameters.

If you want to know the position of an “along-step” interaction, like dE/dx, then that question is unanswerable. Along-step (inheritance from G4VContinuousProcess) happend continuously along the entire line segment between pre-step and post-step, and does not have a well-defined position.