How to visualized the geometry

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

Geant4 Version: 11.3.1
_Operating System:_Ubuntu 24.04
Compiler/Version:
_CMake Version:_3.16


I have used the above versions and try to compile the basic example B1 of the geant4. However, rather than showing the geometry it gives me the result below. Would you please help me how can adjust in order to make my geometry visualized?
Available UI session types: [ tcsh, csh ]


Geant4 version Name: geant4-11-03 [MT] (6-December-2024)
<< in Multi-threaded mode >>
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


<<< Reference Physics List QBBC
Accumulable registered as “accumulable_0”
Accumulable registered as “accumulable_1”
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE, TSG)
RayTracerX (RayTracerX)
You may choose a graphics system (driver) with a parameter of
the command “/vis/open” or “/vis/sceneHandler/create”,
or you may omit the driver parameter and choose at run time:

  • by argument in the construction of G4VisExecutive;
  • by environment variable “G4VIS_DEFAULT_DRIVER”;
  • by entry in “~/.g4session”;
  • by build flags.
  • Note: This feature is not allowed in batch mode.
    For further information see “examples/basic/B1/exampleB1.cc”
    and “vis.mac”.

Registering model factories…

You have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

Registered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

Registered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
“/vis/list” to see available colours.
/control/saveHistory
/run/verbose 2

Change the default number of threads (in multi-threaded mode)

#/run/numberOfThreads 4

Initialize kernel

/run/initialize

==========================================================================================
G4TaskRunManager :: Using G4ThreadPool…

userDetector->Construct() start.
Checking overlaps for volume Envelope:0 (G4Box) … OK!
Checking overlaps for volume Shape1:0 (G4Cons) … OK!
Checking overlaps for volume Shape2:0 (G4Trd) … OK!
World is registered to the default region.
physicsList->Construct() start.

HadronInelasticQBBC Construct Process:

Emin(FTFP)= 3 GeV; Emax(FTFP)= 100000 GeV
Emin(BERT)= 1 GeV; Emax(BERT)= 6 GeV; Emax(BERTpions)= 12 GeV;
Emin(BIC) = 0 GeV; Emax(BIC)= 1.5 GeV.

physicsList->CheckParticleList() start.
physicsList->setCut() start.
/run/physicsModified

Hi Halait Ge

The following output (near the start of output) tells me you have not built Geant4 with any visualising graphics driver (except, curiously, RayTracerX - that may be our bug). The others are what we call file-writing drivers.

You have to specify some graphics systems at build time, e.g., GEANT4_USE_OPENGL_X11=ON - see Building and Installing from Source — Geant4 Installation Guide 11.3 documentation. Actually we recommend Qt as a Graphical User Interface (GUI), although that requires you to install Qt on your computer. (I’ve forgotten the name of the package installer on Linux - something like apt? - but it should be straightforward with a command such as apt install qt.) The specify GEANT4_USE_QT=ON when building with cmake.

(Qt and X11 should coexist, but it might be safer just to us one of the above options rather than both.)

Hope this helps. Let us know how you get on.

John

Dear John,
Thank you so much
I follow your recommendation and get the result given below but after it opened on the terminal the geometry I cant move I dont the reason.

Hi Halait

Great. That’s great progress. You are exploiting the basic graphics capability of the Ubuntu system, namely the built-in OpenGL graphics and X11 windowing system. Unfortunately, it is very basic. As you observe, there is no interaction. You can change the viewpoint, zoom, etc., with /vis/viewer/... commands - that’s all. (Use ls or help to see available commands and their guidance, or consult https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Control/commands.html.)

So that’s why we recommend Qt. Do have a go at installing it and specify GEANT4_USE_QT=ON when building with cmake. You will get a much better user experience.

Let us know how you get on.

John

Dear John,
Still I have not fixed the problem how to move the geometry, Now I understand the problem is
on the Qt6. The Problem here to fix the Qt6, Would you please suggest to me how I can fix the problem the Qt?

cmake … -DCMAKE_INSTALL_PREFIX=~/geant4-install
-DGEANT4_USE_QT6=ON

This should be -DGEANT4_USE_QT=ON -DGEANT4_USE_QT_QT6=ON.

Thank very much now the Qt is stored on the OpenGL but the geometry is not visualized may be I missed installing the preGeant4 accessories?

Click on the tab “viewer-0 (OpenGLStoredQt)”.

(Strange that it was not the active tab by default.)

It some times vibrating and empty as shown below.

Mmm. Users have seen this issue with Unbuntu. Search the Forum for related posts.

Make sure your graphics card driver is up to date. Download from the manufacturers web site specific to your operating system and version number. That sometimes fixes it.