Tracking problem with TGeoCompositeShape

Hello All,

I have been trying to construct a model of bent superconducting solenoid using two TGeoCtub combined into a single volume via a TGeoCompositeShape. One TGeoCtub is at an angle with respect to the other, creating essentially a tube with a 9.5 degree bend some distance along. I have two of these TGeoCompositeShapes, one nested inside the other, representing the “in_bore” vacuum region and the other representing the “bore” walls. I want to know when a particle has left what I’ve called the “in_bore” volume and hits the wall of the “bore” volume.

Sometimes when I track a particle from the “straight” part of the tube into the “bent” part of the tube the tracker thinks that it has left that volume completely, even though it has never left the “in_bore” volume.

I’m somewhat confused about why this is happening. I"ve attached a simplified script showing what I mean. Is this the expected behavior?

I’m running Root 5.10-00 on Fedora Core 3 using the Intel icc compiler version 9.0 20060120

Thank you for any help you may have!
fisher-test.C (6.16 KB)


Your example is very interesting as it points to an important issue related to transport inside composite shapes. I attached your macro with a small modification that fixes the problem.
The problem is the following:
In your example you make composites as a union of 2 bodies (cut tubes) which are supposed to be perfectly tangent on one edge. Well, they are, but only mathematically… When the common edge is a result of sines/cosines-based operations, it may happen that numerically it becomes not so common anymore. The result is that from numerical point of view you get 2 distinct surfaces that may or may not lead to a very thin layer in between your 2 solids. Depends on your luck - which is bad in this example. The layer is there and your “track” immediately notices it: the layer obviously belongs to your “universe” volume.

The ‘rule of thumb’ coming out of all this is: if you need to make a union of 2 solids that touch each other, make an intended small overlap of ~1e-10/1.E-10. This is too small to affect your geometry but it will prevent getting the thin layer artefact. This is what I did with your example: I added a tolerance of 1e-12 in the translation of the second cut tube.

fisher-test.C (6.33 KB)

Ahh… that makes sense. I did a few tests with an even simplier geometry: two identical TTubes stuck together and shot particles along the z-axis and only some fraction (~ 75%) made it through both.

I tweaked several of my (more complicated) TCompositeShapes and things seem to behaving as expected. Thank you very much!