Boolean solids and precision

I am trying to define a simple boolean union solid made of a parallelepiped and a trapezoid. The code looks like this:

G4Box *box = new G4Box("box", 5., 50., 50.);
G4Trd *trap = new G4Trd("trap", 5., 5., 50., 20., 30.);
G4UnionSolid *solid = 
  new G4UnionSolid("solid", box, trap, nullptr, G4ThreeVector(0., 0., 80.));

Placing a volume, it looks like this in the OpenGL visualizer:
Screenshot_20230516_190439
At first sight it’s ok, but zooming near to the contact surface I get this:
Screenshot_20230516_190518
The trapezoid seems displaced along Z (vertical direction on the bottom figure) and Y (horizontal). Could this be due to rounding errors? It seems strange to me given the actual numbers in the code, but I’m not an expert. Or could this be just a visualization error? Generally speaking, is this something to be worried about relatively to the correctness of the simulation?
Thanks in advance for any help.

OpenGL visualization driver may not correctly visualize a boolean solid. You may use RayTracer(X) to visualize it. Else, you may shoot a particle (e.g. geantino) with the tracking verbose 1. The track should not make a step at the connected location of the box and trapezoid.

@makotoasai Thanks for your suggestion, with the RayTracer visualization everything seems fine:
Screenshot_20230517_084033

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