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.2 Operating System: macOS Tahoe (26.3.1) Compiler/Version: Apple clang version 21.0.0
*CMake Version: 4.1.2
Hi,
I have Geant4 11.3.2 installed with Qt5. If in a Qt session
auto* ui = new G4UIExecutive(argc, argv, "Qt");
and executing
/control/execute vis.mac
the detector is displayed correctly in the Qt visualization window.
However, when running with a tcsh session:
auto* ui = new G4UIExecutive(argc, argv, "tcsh");
and executing the same macro, the visualization window briefly appears and then closes with the following error:
Idle> /control/execute vis.mac
Default graphics system is: OGL (based on build flags).
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
Note: Parameters specified on the command line will override these defaults.
Use "vis/open" without parameters to get these defaults.
WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:
Using fallback graphics system: OpenGLStoredX (OGLSX)
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 129 (Apple-DRI)
Minor opcode of failed request: 2 ()
Value in failed request: 0x600002
Serial number of failed request: 35
Current serial number in output stream: 35
I must be missing something here…shouldn’t the behaviour be the same ? Or a different driver is used under a Qt session ? I also tried with
If you ask for UI session tcsh, G4VisExecutive assumes you do not want the Qt UI session, the Qt window. It then looks for “fallback” systems, in this case an X11-based system, and it is this that fails.
There is some incompatibility between Qt and X11 on Mac. We have not been able to find a way around this. You have to choose either X11 and Qt at build time. But I can’t imagine this is what you want.
What exactly are you trying to do? Why do you want to use a tcsh session? Normally, if you want graphics, use Qt. If you don’t want graphics, don’t instantiate G4VisExecutive. See example/base/B1/exampleB1.cc.
Incidentally, note, as it says, Use "vis/open" without parameters to get these defaults. The default system is ToolsSG nowadays. However, that won’t get around the X11 issue.
You can also choose the UI session at run time with ~/.g4session, i.e., you don’t need to recompile. Earlier in the output you will see the advice below.
Good luck.
John
You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
RayTracer (RT)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGLS)
RayTracerQt (RTQt)
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG, OGL)
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB, TSGZB)
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".
Thanks for the quick feedback. I was actually trying to do something slightly different: I was setting up my own Qt window (independent of G4UIQT) to provide a more user-friendly way to configure the simulation, but without using the native Geant4 Qt visualization window (mainly because I was trying a quick, dirt ?, solution). For visualization, I was simply executing ```vis.mac`` via G4UImanager—probably not the best approach.
In any case, I’ve now realized that I can configure the native Geant4 Qt window to suit my needs, so this resolves my issue.
Thanks! At the moment I’m mainly adding a few buttons to enable real-time configuration of the geometry, but these are quite specific to my particular simulation.
I’ll certainly let you know if I come up with any suggestions that could be useful for the general G4 Qt GUI.