Visualizing the geometry with more precision

Hi Geant4 devs!
We are using Geant4 for simulations of silicon detectors where the detector shape is obtained as the intersection of two tube sections (G4IntersectionSolid from two G4Tubs solids). This is what the detector should look like (left) and what the result is in the Qt visualization engine (right), where the shapes are approximated by trapezoids:

I noticed this related topic on the forums

where it is explained why that is so, but is there any way to make the visualization be more precise and less approximative (a specific visualization engine, some settings)? We are trying to stack such detectors very close to each other, so being able to see the actual rounded edges would be very helpful.

Thank you for your help.

Radek

I guess that those must be fairly small angle segments of cylinders. The visualization uses the full circle to decide how long each polygon segments should be, so you might try increasing that:

/vis/viewer/set/lineSegmentsPerCircle 24

or 30 or 40 or whatever gets you what you need. Note that if you make the number of segments too large, you may run into “too many polygons” errors.

1 Like

Hi Radek

It’s a visualisation issue - tracking should be fine. When there are coincident or nearly coincident surfaces in Boolean operations the visualisation can be patchy.

Solutions:

  • adjust the volumes by a small amount (that is physically insignificant for you, say, 1*um);
  • use RayTracer or RayTracerX (/vis/open RayTracerX), which use the tracking algorithms so you see exactly what G4 tracking is seeing;
  • increase the “number of lines per circle” (I leave you to search for the command under /vis/viewer/set) to get a closer approximation of the polygonal representation of the solids.

Hope this helps
John

1 Like

Thank you both very much for your suggestions, I’ll try them out.

Radek

Hi,
setting the lineSegmentsPerCircle parameter to a higher value did the trick, thanks again for your help.

Radek

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.