Problem Visualization OGL in hadrontherapy example

Dear all,

I tried to visualize the geometry and the particle track in the “hadrontherapy” example. By running the macro “defaultMacro_vis.mac”, the visualization in OGL is present during the simulation but not at the end of the simulation. I tried to comment /run/beamOn inside the macro. In addition, I changed the following line /vis/open OGLI 600x600-0+0 to /vis/open OGL 600x600-0+0 but the problem persists. Any suggestion, please?
Thanks in advance for your time.
Best regards,


1 Like

Hi Christian

I am not familiar with the hadrontherapy example but your post caught my because of the word “Visualization”. I have had a long association with the Visualisation Group.

It seems to me that there is a fundamental error or misunderstanding in the logic of reading macro files. If there is no argument, it invokes a user interface but then executes defaultMacro.mac, which does not have any vis commands. If you supply an argument `macro/defaultMacro_vis.mac’ it fails to open a UI session. It opens a default vis window but never gives you an opportunity to interact - or just to see the result - because it hasn’t opened a UI interactive session. So the app simply exits when the macro is done. That’s why the graphics window disappears.

I invite someone who is responsible for this example to contact me to discuss this.

I got it to work with the following change:

--- a/examples/advanced/hadrontherapy/
+++ b/examples/advanced/hadrontherapy/
@@ -194 +194 @@ int main(int argc ,char ** argv)
-        UImanager -> ApplyCommand("/control/execute macro/defaultMacro.mac");
+        UImanager -> ApplyCommand("/control/execute macro/defaultMacro_vis.mac");

and, for a reason I do not understand, I had to force the viewer type. In defaultMacro_vis.mac, replace

/vis/open OGL


/vis/open OGLSX

This might be something to do with the Qt GUI. If you are not using Qt you might not have this problem.

Good luck

1 Like

Unfortunately, I couldn’t solve the problem also with this suggestion. Anyway, thanks for your reply.