Visualization on MacOSX

Dear Community,

I am very knew to Geant-4, less than 2 weeks of experience. So I only have “stupid” question (sorry).

I installed Geant-4 on MacOSX. It seems working correctly (run B1, B2, B4A, B5). I was able to modify the geometry and modify the radioactive source, etc.

But I am not able to visualize anything, any geometry. It seems that it does not find OpenGL.

/vis/open OGL, /vis/open/OGLIX … fail

and when I run vis.mac, I got,

-------- WWWW ------- G4Exception-START -------- WWWW -------

***** G4Exception : UIMAN0123**

issued by : G4UImanager::ApplyCommand

Candidates are: ATree DAWNFILE HepRepFile HepRepXML RayTracer VRML1FILE VRML2FILE gMocrenFile

Error code : 1

***** This is just a warning message. *****

-------- WWWW -------- G4Exception-END --------- WWWW -------

******* Illegal parameter (1) </vis/open OGL 600x600-0+0> *******

******* Batch is interrupted!! *******

-------- WWWW ------- G4Exception-START -------- WWWW -------

***** G4Exception : UIMAN0123**

issued by : G4UImanager::ApplyCommand

Command aborted (1)

Error code : 1

***** This is just a warning message. *****

-------- WWWW -------- G4Exception-END --------- WWWW -------

******* Illegal parameter (1) </control/execute vis.mac> *******

******* Batch is interrupted!! *******

-------- WWWW ------- G4Exception-START -------- WWWW -------

***** G4Exception : UIMAN0123**

issued by : G4UImanager::ApplyCommand

Command aborted (1)

Error code : 1

***** This is just a warning message. *****

-------- WWWW -------- G4Exception-END --------- WWWW -------

Graphics systems deleted.

Visualization Manager deleting…

G4 kernel has come to Quit state.

UserDetectorConstruction deleted.

UserPhysicsList deleted.

UserActionInitialization deleted.

UserRunAction deleted.

UserPrimaryGenerator deleted.

RunManager is deleting RunManagerKernel.

EventManager deleted.

Units table cleared.

TransportationManager deleted.

Total navigation history collections cleaned: 2

================== Deleting memory pools ===================

Pool ID ‘20G4NavigationLevelRep’, size : 0.00288 MB

Pool ID ‘24G4ReferenceCountedHandleIvE’, size : 0.000961 MB

Pool ID ‘15G4CountedObjectIvE’, size : 0.000961 MB

Number of memory pools allocated: 3; of which, static: 0

Dynamic pools deleted: 3 / Total memory freed: 0.0048 MB

============================================================

G4Allocator objects are deleted.

UImanager deleted.

StateManager deleted.

RunManagerKernel is deleted. Good bye :slight_smile:

Note: OpenGL seems installed but I don’t know how to be sure that G4 reads correctly the path.

Note: I have tried other visualisation methods based on the suggestions ATree DAWNFILE HepRepFile HepRepXML RayTracer VRML1FILE VRML2FILE gMocrenFile. I still far from getting what I want.

Any help please.

Thank you for your time.

You need to build Geant4 with OpenGL - see Installation Guide, Geant4 Build Options. For example, on the cmake command line, -DGEANT4_USE_OPENGL_X11=ON.

Thank you so much for your response.

I have seen this suggestion in another similar post. After your message, I have also read what is written on the Installation Guide, Geant4 Build Options.

For me this still not working.

In …/…/geant4.10.07-build,
I mentioned the source.
Then I entered cmake -DGEANT4_USE_OPENGL_X11=ON .

I got


CMake Error at /usr/local/Cellar/cmake/3.19.1/share/cmake/Modules/CMakeCXXInformation.cmake:89 (include):
include could not find load file:

/MyPath/Compiler/geant4.10.07/cmake/Modules/G4MakeRules_cxx.cmake

Call Stack (most recent call first):
CMakeLists.txt:33 (project)

CMake Error at CMakeLists.txt:51 (include):
include could not find load file:

G4CMakeMain

– Configuring incomplete, errors occurred!
See also “/MyPath/Compiler/geant4.10.07-build/CMakeFiles/CMakeOutput.log”.
See also “/MyPath/Compiler/geant4.10.07-build/CMakeFiles/CMakeError.log”.


I tried other investigations but it did not work for my case. So, probably, I have problems with installation and paths (little bit lost).

Thank you!

Have. you fully followed the instructions? You need more than

cmake -DGEANT4_USE_OPENGL_X11=ON

You need something like (to quote from the Installation Guide, and adding the above):

$ cd /path/to/geant4.10.07-build
$ cmake -DGEANT4_USE_OPENGL_X11=ON -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.07-install /path/to/geant4.10.07

Thank you so much @allison.

Your last suggestion finally works when I re-installed Geant4 from scratch and used

cd /path/to/geant4.10.07-build ; cmake -DGEANT4_USE_OPENGL_X11=ON -DCMAKE_INSTALL_PREFIX=/path/to/geant4.10.07-install /path/to/geant4.10.07

This says that one should not run it on the pre-installed version. This is in contradiction with what is written in the installation manual:

If you have already created a build directory and used CMake to configure the build, you can always rerun CMake in that directory with new options to regenerate the buildscripts.

All in all, re-intalling geant-4 from scratch with your suggestion works perfectly.

Thank you.

Good news.

Could you please point out where, exactly, in the Installation Guide we give a misleading impression? This will help us improve our documentation.

1 Like

Yes, I think that several equivalent passages lead to this confusion. I may have misunderstood. Here are two examples from G4InstallationGuide.pdf.

Page-17:

If you have already created a build directory and used CMake to configure the build, you can always rerun CMake in that directory with new options to regenerate the buildscripts.

Page-9:

If you run CMake and decide afterwards you want to activate additional options, simply rerun CMake in the build directory, passing it the extra options plus the build directory path.

As discussed, after testing it a multitude of times, this does not work with OpenGL on MacOs, one should re-install Geant, and use your suggestion for cmake.

Thanks @allison.

Of course you have to rebuild after running CMake. Do we need to make that explicit?

Yes, I think that. It will helps beginners with Geant-4.

Thanks. We have made some improvements to the documentation.

John