Trajectory Visualization: Make a movie in batch mode

Howdy,

This is my first topic on the forum. I am here to ask for advice.

I wish to create a movie of particle trajectories in time, but without drawing anything to the screen. I only want to save the visualization output to disk. The reason I wish to do it this way is that I work remotely over ssh on a cluster such that drawing to the screen is very, very slow (LIBGL_ALWAYS_INDIRECT=1). For example, after I run my simulation, drawing all my trajectories to the screen with OGL takes something like an hour, whereas saving to disk with DAWNFILE takes only a few seconds.

I am able to make a simple movie using OGL and looping the printEPS function, as the documentation suggests. This works great for a single trajectory, but for multiple trajectories it slows to a crawl during the draw to screen at the end of run. I can’t figure out how to stop that from happening. If I turn off the viewer, the trajectories don’t seem to be stored.

I can imagine several potential solutions; presented here in order from most to least preferred

  1. Preventing OGL from drawing to the screen but while still storing the trajectories

  2. Asking DAWNFILE (or another viewer) to draw time-sliced trajectories

  3. Write the rich trajectories to disk in plain text format and render the movie myself

  4. Modify the cluster I work on to support local-only OGL rendering

  5. Create a custom viewer

  6. Install Geant4 etc on a personal machine

My workflow comes in the form of a compiled executable that interprets geant4 macro statements. I don’t believe it is possible to start the interpreter interactively, but it may be possible to modify the application source code.

Thank you in advance for your thoughts.

  • Richard Lawrence
    Texas A&M University

Hi Richard

There seem to be several issues here. Let me take them one at a time. We may need your help in trying a few things.

  1. Writing with /vis/ogl/printEPS: nowadays /vis/ogl/export is recommended (we need to bring the documentation up to date).

  2. Maybe /vis/viewer/interpolate would be a good way to go. Again, we need to improve the documentation. But since Geant4 10.5, here is a prescription:

o See guidance on /vis/viewer/set/timeWindow/ commands. Briefly:
/vis/scene/add/trajectories rich
/vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.01 ns
then typically
/vis/viewer/set/timeWindow/displayLightFront true 0 0 -50 cm -0.5 ns
/vis/viewer/set/timeWindow/displayHeadTime true
/vis/viewer/set/timeWindow/fadeFactor 1
/run/beamOn # or several until you get a good event or events
/vis/viewer/set/timeWindow/startTime 0 ns 1 ns
/vis/viewer/save
/vis/viewer/set/timeWindow/startTime 1 ns 1 ns
then zoom, pan etc to a view of interest and
/vis/viewer/save
then repeat with next start time, another view and a save, then try
/vis/viewer/interpolate

Note that /vis/viewer/interpolate takes an argument export (use help /vis/viewer/interpolate).

  1. Running Geant4 on a remote server without graphics but being able to write images to file. I have not tried this myself but if you can build Geant4 with OPENGL_X11 against Xvfb, it should be possible to use macros involving /vis/ogl/printEPS, /vis/ogl/export and /vis/viewer/interpolate (with the export argument).
    Xvfb, according to Wikipedia:

Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol. In contrast to other display servers, Xvfb performs all graphical operations in virtual memory without showing any screen output. From the point of view of the client, it acts exactly like any other X display server, serving requests and sending events and errors as appropriate. However, no output is shown. This virtual server does not require the computer it is running on to have any kind of graphics adapter, a screen or any input device. Only a network layer is necessary.

I use a Mac. Xvfb seems to be available (man Xvfb responds positively). Try it on your computer.

  1. Multiple events. Making a movie has alway implied, for me, looking at one event at a time. If you have /vis/scene/endOfEventAction accumulate and attempt to draw at end of run, you will get multiple events. Not quite sure how this will respond to time-lapse drawing. At end of run you can /vis/reviewKeptEvents one at a time. In fact, you can switch vis off (/vis/disable), /run/beamOn nnn, then at end of run /vis/reviewKeptEvents one at a time (you may have to /vis/enable). You can even program your stepping action or similar to keep special events (your criteria) and only they will be kept for reviewing. You can also `/vis/drawOnlyToBeKeptEvents’. Trajectories should continue to be stored.

Of your “potential solutions” I hope I have addressed (1), maybe (4). I recommend (6) for G4 application development.

Have a go and let us know how you get on. Good luck.

John

Hi John,

Thank you for your reply. You have given me a lot of information to digest. I will get back to you.

Richard