Strange hit distribution when 2 equal solids are considered

Dear users, i have observed a strange hits position distribution when using 2 equal solids, belonging to the same logical volume, i.e., the same material and “glued” to each other. The material is tungsten and the Z-dimension is 20cm. I notice a peak at the boundaries of the solids that i was not expecting. To clarify, i run the same simulation of a single solid with 40*cm dimension where the effect is not observed. I am shooting pions and plotting the histogram of the Z position for each hit. How can i cure this?


Dear Carlos,
I suggest to cross-post (or post again) in the category of EM processes or hits and digitisation.
There are two effects which typically show something like this. The first is related to the code which records an energy deposition. If the location of a ‘hit’ is recorded as the start of the current step, then something like this is a likely result. Steps which end up at the boundary are shorter, and have less (‘along-step’) energy deposition - when you have the extra boundary.

If instead the position of a hit / energy deposit is chosen randomly within the step, then this effect is smoothed out. I am not suggesting that this is an ideal way to score the energy deposition … but it is better than attributing it to the location of the start of the step.

If you decide that you want a more precise energy deposition then you can limit the step size ( see G4UserLimits ) in order to deposit the energy within this distance. I fully expect that you will see a smooth distribution and the same one whether or not you have introduced the boundary. It will be slow, but this is the simplest way to check that the geometry is not affecting your energy deposition. In this case if you want accuracy of 2.5 cm, you limit the step size to 2.5 cm.

A second way could be to use the User Limits to ensure that the track stops at least a few times in the smaller volume. If I recall correctly the recommendation is 5 steps in each volume - but you can try 3 or 10 steps and check the smoothness. You can do this with different ways of assigning the energy deposition to a location / bin. But this way you could limit the step size to 4 cm or better just a bit less than 4 cm (enforcing 6 steps in the smaller volume.)

Please look at the Geant4 Application Developers guide and the extended / electromagnetic examples in the Geant4 distribution for additional ways to handle this.

Best regards,

Hi John. Thanks for your suggestion. I will cross-post as you suggested.
Also, i had tested previously your suggestion of limiting the step size. I have done it for 5mm, and no difference was observed. Your first suggestion of the steps on the boundaries makes sense. I will check…

Thank you: