RayTracerX not available

I built G4 11.0.2 enabling the RayTracerX visualization; here’s the configuration taken from the output of ccmake:

 GEANT4_INSTALL_DATA              ON
 GEANT4_USE_G3TOG4                OFF
 GEANT4_USE_GDML                  ON
 GEANT4_USE_OPENGL_X11            OFF
 GEANT4_USE_PYTHON                OFF
 GEANT4_USE_QT                    ON
 GEANT4_USE_TBB                   OFF
 GEANT4_USE_TOOLSSG               OFF
 GEANT4_USE_XM                    OFF

I guess it’s ok since GEANT4_USE_RAYTRACER_X11 is ON. The installed library seems to effectively contain the RayTracerX stuff:

$ nm /home/mori/software/install/GEANT4_11.0.2/lib/libG4RayTracer.so | grep RayTracerX
6:0000000000022390 T G4RayTracerXScannerWaitForNotify
42:0000000000013aa0 t _GLOBAL__sub_I_G4RayTracerX.cc
43:0000000000013b70 t _GLOBAL__sub_I_G4RayTracerXViewer.cc
169:0000000000021f30 T _ZN12G4RayTracerX12CreateViewerER15G4VSceneHandlerRK8G4String
170:0000000000012cbc t _ZN12G4RayTracerX12CreateViewerER15G4VSceneHandlerRK8G4String.cold
171:0000000000021ef0 T _ZN12G4RayTracerX18CreateSceneHandlerERK8G4String
172:0000000000012ca6 t _ZN12G4RayTracerX18CreateSceneHandlerERK8G4String.cold
173:0000000000022010 T _ZN12G4RayTracerXC1Ev
. . .

and it is correctly linked to my executable:

$ ldd `which GGSPenny` | grep RayTracer
19:     libG4RayTracer.so => /home/mori/software/install/GEANT4_11.0.2/lib/libG4RayTracer.so (0x00007fd7ac3eb000)

Still I cannot start the RayTracerX visualizer: when issuing the /vis/open RayTracerX command I get this error:

parameter value (RayTracerX) is not listed in the candidate List.
  Candidates are: ASCIITree ATree DAWNFILE G4HepRepFile HepRepFile RayTracer VRML2FILE gMocrenFile OpenGLImmediateQt OGLIQt OGLI OpenGLStoredQt OGLSQt OGL OGLS

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
      issued by : G4UImanager::ApplyCommand
Invoked command has failed - see above. Available graphics systems are (short names):
Error code : 500
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

command refused (500):"/vis/open RayTracerX"

I never used the RayTracerX before and I didn’t modify my code to make use of it, since as far as I understand no viewer-specific code paths are needed in user software.
Am I missing something?

Could you try rebuilding your executable and check that the compile commands include the -DG4VIS_USE_RAYTRACERX flag please? If you’re using G4VisExecutive, that flag is needed to enable the use of RayTracerX. The flag should be added automatically by CMake etc, but it’s worth checking as the libraries are clearly built with RayTracerX support.

I didn’t have the vis_raytracer_x11 component specified in the optional components list of find_package, adding it and rebuilding my application the error vanished and the RayTracerX window shows as expected. Thanks @bmorgan !

I have another problem now: I get these errors in the console:

WARNING: G4RayTracerViewer::DrawView: true orthogonal projection
  not yet implemented.  Doing a "long shot", i.e., a perspective
  projection with a half field angle of 1e-06 radians.

and a garbage detector image. I tried to change the viewpoint with:

/vis/viewer/set/viewpointVector 1 1 0

but this didn’t help. So how can I fix the warning?

Hi, The WARNING is nothing to worry about. But in what sense “garbage detector image”? How?

Hi John, this is the detector image produced by the OGL visualizer:

The black element is a tray imported from a GDML file and filled with cubic gray cubes. This same geometry is rendered by RayTracerX as:

During the rendering the X window shows something like this:

which turns to the flat gray image at the end. This is the visualization macro I am using for both images:

/tracking/storeTrajectory 1
/vis/open RayTracerX 600x600-0+0
#/vis/open OGL 600x600-0+0
/vis/verbose errors

/vis/viewer/set/upVector 0 0 1
/vis/viewer/set/viewpointVector 1 -1 0
/vis/viewer/zoom 20


Maybe there is something wrong with it?


Be aware RayTracer will render surfaces. It does not recognise wireframe.

I don’t see anything “garbage” about the OGL image. Could you be a little more precise about your problem?

Cheers, John


my problem is that I’d like to render the detector with RayTracer(X) since OGL produces this kind of artifacts. These artifacts are not visible in the OGL image posted above, but become visible when incrteasing the zoom level to very high values.
“Garbage” was not relative to the OGL image but to the RayTracer one, which is a flat gray field. But I understand that it could be the outcome of the geometry being a tessellated solid imported from GDML, right? I didn’t imagine RayTracer had problems with that since I read that it “can render any geometry that Geant4 can handle” (see this presentation, slide 60).

The top level shape can be defined without using union, see G4ExtrudedSolid.

Thank you, I’ll look into it and use the extruded solid instead of the boolean.

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