G4beamlineVERSIONhttp://g4beamline.muonsinc.com |
G4beamline is a particle-at-a-time simulation program based on Geant4 [1] and optimized for the simulation of beamlines. See the G4beamline User's Guide at the above URL for a description of the program (it is also installed with this distribution).
This brief description only discusses how to use the program, it does not describe how to construct a simulation's input file; for that see the G4beamline User's Guide.
Select the input file using the "Browse" button above. The directory containing it will become the current directory, and the output file named above will receive the program output, as will this TextArea. Any additional Parameters used by the input file can be entered above. Pushing the "Run" button above will run the program, replacing this text with its output. While the program is running, the "Run" button above will change to "Abort" to permit you to stop the program immediately. Closing this window will also abort g4beamline. After running the simulation (with viewer=none), the simulation usually creates one or more Root files containing the NTuples. You can use the HistoRoot program to generate histograms from these files.
IMPORTANT NOTE: With a viewer selected, NTuple output files are not written. This includes both .root files and ASCII files from vitualdetector-s, zntuple-s, etc.
Several examples are provided in the distribution. They are located in the "examples" directory under the install directory. In Linux the install directory is usually in your HOME directory; in Mac OS X it is usually in /Applications; in Windows a Copy of "G4beamline examples" is placed into "My Documents" (Windows Xp) or "Documents" (Windows Vista).
viewer=best will visualize the system using OpenInventor; use its File/Escape to go to the next image (run). The OpenInventor viewer is part of the G4beamline program. For usage hints, see this Appendix.
The "Other" selection can be used to run any other viewer supported by G4beamline and installed on your system (if necessary). See the output from a G4beamline run with viewer=best to see the list of supported viewers.
viewer=Other:Wired will visualize the system using the Wired3 viewer [2]. The "Run" button will run the selected number of runs, each generating a .heprep file. When that is complete, the Wired viewer will be opened on the first file; it considers them "events". For usage hints in Wired, see this Appendix.
[1] http://geant4.cern.ch [2] http://www.slac.stanford.edu/BFROOT/www/Computing/Graphics/Wired/ [3] http://root.cern.ch
Like other X-windows programs, the OpenInventor driver of G4Beamline can operate in either local or remote (networked) mode. Both the X display client and server must have the 3-D display capabilities of OpenGL installed. Operation over a network can be slow, and a good network connection (>1 megabit/sec) is required for useful results.
The Rotx and Roty wheels at the lower left rotate the image relative to the viewer, and the Dolly wheel (Z) at the lower right moves in and out with a corresponding change of scale. The buttons along the right edge do the following:
Arrow | Select pick mode and cursor |
Hand | Select move mode and cursor (default) |
? | Help (not implemented) |
House | Restore display to Home position |
House with arrow | Set Home position to be the current display |
Eye | Zoom so everything is visible |
Gunsight | Not implemented |
Perspective box outline | Select isometric or projected display |
When the Hand cursor is active the mouse behaves like this:
Left Button | Click and drag to rotate the display. It acts as if there were an invisible sphere surrounding the image, and the mouse movements rotate that sphere in any direction. This is quite different from the Rotx and Roty wheels, and takes some getting used to. |
Middle Button | Click and drag to pan the display -- this moves the visible objects around without changing perspective. |
Right Button | Brings up a menu with various functions, Draw Styles, and other items. The most useful is DrawStyles/StillDrawStyle/Wireframe which will draw in the wireframe mode rather than as solid surfaces. This permits you to look inside objects, and is considerably faster drawing. NOTE: daughters are not necessarily visible in wireframe mode -- see the Etc. menu item that makes them visible. |
The File menu has several useful items:
PS (gl2ps) | Save the current image in PostScript (drawing) |
PS (pixmap) | Save the current image as PostScript (pixel map) |
IV | Save the current image as an OpenInventor file |
Escape | Exit the OpenInventor Viewer. This causes the program to simulate the next run and display the result. |
The Etc. menu has several useful items:
Set Solid | Set the G4 mode to Solid (default) |
Set (G4) reduced wire frame | Set the G4 mode to wireframe, real edges only |
Set (G4) full wire frame | Set the G4 mode to wireframe, including triangles to fill surfaces |
Visible mothers + invisible daughters | Daughter volumes are invisible (default) |
Visible mothers + visible daughters | Make all objects visible |
The key to understanding how objects are displayed is to know that Geant4 has a solid/wireframe choice, and OpenInventor has a solid/wireframe choice, and they are different:
G4 mode (Etc menu) | OI mode (Right click menu) | Description |
---|---|---|
Solid | Solid (as is) | Draw solid surfaces |
Solid | Wireframe | Draw wireframes with triangles filling visible surfaces |
Reduced Wireframe | Either | Draw reduced wireframes, showing only real edges |
Full Wireframe | Either | Draw wireframes with triangles filling visible surfaces |
The OpenInventor driver has many more features, but this should get you started. It will also do animation: with the hand cursor left click and drag the image, letting go of the button while moving -- the image will continue to rotate until you left click on it (works best locally).
On Windows, the Wired viewer is installed with G4beamline, and is used as the "best" viewer. On Linux and Mac OS, you must install it manually [2] and then make a symbolic link from its install directory to [g4beamline install directory]/Wired -- then you can set Other to Wired and use it.
When the Wired viewer comes up, it displays a few centimeters near the point x=0,y=0,z=0. It may happen that your system has no visible objects there and the display may look blank. On the lower left is a set of icons, and a click on the second one (a "plus sign" with 4 arrowheads) will zoom so that your entire system will be in the display.
The Wired viewer is started with the first image file loaded. At the top of the window is a toolbar with icons for "open", "reload", "previous event", "next event", "up (inactive)", "down (inactive)", "Toggle Automatic Updating (looks like a clock)", "Create New Window", and "Show/Hide Data Tree". On the right side of the window is a data visibility tree that permits you to select individual elements of the simulation and toggle their visibility.
At the bottom of the viewer subwindow are 8 icons and 2 sliders. The icons are:
R | Reset View |
+ with arrowheads | Fit in Window |
+ | Zoom In |
- | Zoom Out |
+ arrows pointing in | Reset Translation |
CCW arrow | Rotate Counter Clockwise |
CW arrow | Rotate Clockwise |
Circle | Reset Rotation |
Along the right edge of the viewer are two sliders. The upper one translates the image and the lower one rotates it. The same remarks apply to these.
A right-click on the viewer window brings up a context menu with several useful choices:
Orientation Actions | Perform the above icon actions, plus more. Includes OrientationActions such as TopView, SideView, CenterInWindow, etc. |
Orientation Toolbar | Turn the bottom icons on or off |
Projection | Select projection (Parallel is the default) |
Mouse Function | Select what mouse actions do |
Drawing Options | Various drawing options |