How to setup interactive visualization?

Hello,

I am working on the detector simulation development based on Geant4.
I have a question that how can I use/setup interactive visualization?

I installed X11 OpenGL and it shows detector visualizations, but it is not interactive.
In the past, I could do zooming, rotation, and add/remove logical volumes, run events by GUI, but I forget which is the one and how to install/setup that.
Now I am running visualization as
/vis/open OGL

It is appreciated if you tell me which visualization option is the one and how to setup it.
Thanks!

The best option is to use the Qt user interface toolkit. You will need to install it from https://www.qt.io or use homebrew. Once installed you can add the CMake option GEANT4_USE_QT=ON. You will also probably need to provide a CMAKE_PREFIX_PATH - see Installation Guide.

Hi,

Thank you for your help!
And sorry for the late reply, once I gave up it, but now I need to implement magnetic field that I would like to check if it is ok by eye, so I came back to install of visualization.

I ran on centos8, and I installed qt5 following the page below.
https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code
yum install libXmu-devel
yum install mesa-libGLU-devel

and then I put qt5 software under /usr/llvm, and then installed geant4 as

cmake -DOPENGL_INCLUDE_DIR=/usr/include/GL -DX11_INCLUDE_DIR=/usr/include/X11 -DOPENGL_glx_LIBRARY=/usr/lib64/libGLX_mesa.so.0 -DOPENGL_opengl_LIBRARY=/usr/lib64/libGL.so.1 -DGEANT4_USE_OPENGL_X11=ON .
cmake -DGEANT4_USE_QT=ON -DCMAKE_PREFIX_PATH=/usr/llvm/qt5-build/qtbase/lib/cmake/ .
make -j8 && make install

Then compiling and installation of Geant4 were succeeded.
But if I try to run visualization job of Geant4, it stops with the following errors.

qt.qpa.plugin: Could not find the Qt platform plugin “xcb” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl.

CAUGHT SIGNAL: 6 ### address: 0x3e8000102fb, signal = SIGABRT, value = 6, description = abort program (formerly SIGIOT).

Do yo have some suggestion what I should do to fix this?

Best Regards,
Tomoya

Hi Tomoya

All looks OK, so I do not know what’s wrong. It is unusual to need OPENGL_INCLUDE_DIR, etc. - cmake is usually capable of finding OpenGL and X11 itself. Where did you get the idea to use those options from?

I have seen cases where Qt and X11 do not mix well. Try building with Qt alone.

Let us know how you get on.

John

Hi John,

Thank you for your advice!
Hmm, I tried to run cmake, and then error is shown that e.g. OPENGL_INCLUDE_DIR is not defined.
So I include these following the error message and searched on google.

Do you mean make clean on Geant4, and then try cmake with Qt alone?

Best Regards,
Tomoya

Always make clean and cmake again and make again. A pain, I know.

I tried make clean and remove everything in geant4.11.0.3-build and geant4.11.0.3-install, and then

cmake -DGEANT4_INSTALL_DATA=ON -DCMAKE_INSTALL_PREFIX=/usr/local/share/Geant4_test/geant4.11.0.3-install/ /usr/local/share/Geant4_test/geant4-11.0.3
make -j8 && make install
cmake -DGEANT4_USE_QT=ON -DCMAKE_PREFIX_PATH=/usr/llvm/qt5-build/qtbase/lib/cmake/ .
make -j8 && make install

and tried to use this one, but same error is shown as before…

Tomoya

Hi Tomoya

CMake keeps a cache CMakeCache.txt, i.e., it remembers options from previous invocations. To be sure you are getting the options you require you should, perhaps, delete that file before running cmake. Alternatively, you can inspect and change options with ccmake. So maybe your X11 options are still in operation?

Do you know what sub-version of Qt5 you are using?

John

Hi,

Thank you!
I deleted all the files in build and install directories.
Maybe I will try ccmake option.
I installed qt5.15.

Best,
Tomoya