Getting hold of a mesh for a TGeoComposite

Hi,

I’ve got a detector geometry defined using a few basic shapes, translations and boolean volumes. In a near future I might try to calculate the eletric field inside this detector and since the application is sensitive to the shape of this field close to the not so regular edges of this detector, I think that the best approach for calculating this field would be using FEM. However, for doing this I need a good mesh, with points on the surfaces of my detector. I have the feeling, rather than anything else, that this, or something similar, is also needed by different visualisation methods used by root.

First, I’m at all right? (never really looked into visualisation of things)
Second, is there an easy way to get a hold of such a mesh, defining points on the edges of some part of a geometry?

kind regards

Joa

Hi Joa,

You are partially right, every shape in TGeo (except composite shapes…) fill a mesh that is used for visualisation and overlap checking (TGeoShape::SetPoints()). However, this mesh is not that dense and uniform as you may need it since it does not generate points on surfaces, but only on vertices and/or edges (e.g. for boxes you get 8 vertices).

If you want to generate a personalized mesh for a shape, you should use the navigation functionality. I can briefly explain how to do this:

  • shoot a uniform grid of parallel rays from OUTSIDE your shape (e.g. define a unique direction and several x,y,z positions - in the reference frame of the shape)
  • use TGeoShape::DistFromOutside() and propagate every ray that gives a distance<1E30. This will give you an entry mesh point that you can store in a container of your choice. To get the rest of the crossing points of each ray with the shape, you should propagate again with a small distance (1E-6) from the surface and than use TGeoShape::DistFromInside() to get the ray exit point. You may need to repeat the procedure until DistFromOutside() returns a big number (several crossings of the same ray).

In this way you can get a reasonable precise mesh depending on how you use your grid of rays.

Cheers,

Thanks for the answer.

If I get around to do this, I’ll try to write some fairly generic class using a standard ouput for the mesh, i.e. some kind of interface between root geom. and FEM programs. However, this is not on the top of my have-to-do list so…

cheers