Error running visualization

Hello,
I am running a Geant4 code for the simulation of a HPGe array for gamma-ray spectroscopy. I want to see if the array is built correctly, therefore I want a visualization.
I use a macro and I receive the following error:

***** COMMAND NOT FOUND </vis/open OGL 600x600-0+0> *****
***** Batch is interrupted!! *****
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (100)
Error code : 100

In the Geant4 forum I found that I have to build Geant4 with -DGEANT4_USE_OPENGL_X11=ON and so I did, indeed I have “GEANT4_USE_OPENGL_X11:BOOL=ON” in CMakeCache.txt

I tried also to use B1 example and there the visualization works properly.

Do you have any suggestions?

I use “geant4-10-06-patch-02”.

Thank you.

1 Like

exampleB1 works - so what is different? Looks like you might not be instantiating a vis manager, e.g., G4VisExecutive? Look at exampleB1.cc.

In exampleB1.cc there is
#include “G4VisExecutive.hh”
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();

and in my .cc
#include “G4VisExecutive.hh”
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();

Therefore it is the same.

Another thought…

Do you UImanager->ApplyCommand("/control/execute xxx.mac") before or after instantiating the vis manager? (By xxx.mac, I mean the macro that includes /vis/open or includes another file that does it. In exampleB1.cc it’s init_vis.mac.)

Thank you for the answer.

My .cc has this sequence:

 G4VisManager* visManager = new G4VisExecutive; 
  visManager->Initialize();

 if(argc != 1) { // batch mode
	 G4String command = "/control/execute ";
	 G4String fileName = argv[1]; //name of the macro.mac
	 G4String outfileName = argv[2]; //without .root extension
	 RunAction* run_action = new RunAction(outfileName);

	 runManager->SetUserAction(run_action);
	 UImanager->ApplyCommand(command+fileName);

 } 

And while executing I write ./name macro.mac rootfile, where name is the executable, macro.mac the macro in which there is /vis/open, and rootfile is the name of an output file for histo.

Mmm. More and more mysterious.

Are you running on a Unix system or on Microsoft Windows?

I am running on a Unix system

There’s something funny here. You are running in “batch mode”, yet you want graphics? Graphics is usually in “interactive mode”. What does your code do if argc==1? Following exampleB1, you should open a session, and you can type in the /control/execute command. (You would also have to instantiate your RunAction somehow.)

In “batch mode”, i.e., without an interactive session, you may have graphics but the window would simply close at end of job. Or you could write to a file-writing driver - e.g., DAWNFILE, VRML2FILE, HepRepFile - and view offline.

You are right!

Checking the main.cc I found that the problem is #ifdef G4UI_USE and #ifdef G4VIS_USE, because they are not used in Geant4.10.6.

Simply deleting them the visualization works in interactive mode.

Thank you for the help.

2 Likes

Ah, yes. I should have thought of that - G4UI_USE and G4VIS_USE no longer set in 10.6.

Glad you’re up and running

John