How to use Gain


What is Gain?

Gain(Geant4 adaptive interface for network) is a networked GUI tool based on GAG. It inherits almost all features of GAG and has new features to make use of Geant4 running at (a) remote machine(s).

Gain runs on a client machine (Windows or Linux), while Geant4 runs on a remote or local server (Linux or Solaris).

It provides two ways to connect to the remote server; SSH mode and Gain socket mode.

Gain SSH mode
Gain has a SSH client fuction and use it to connect to a remote server. Geant4 compiled with G4UIGAG class can be connected to Gain client. When a SSH connection is established after the authentication, Gain displays the remote file browser with which user can choose a Geant4 executable and make it run. Data are encrypted during their transfer and are decripted at both side. So, some CPU power is required for a client machine, if a large amount of data are transfered from the running Geant4 to Gain.
Output from the remote Geant4 are displayed on the Gain console. This console can be used as a normal SSH console and you can type in command directly.
Pluriel remote sessions can be accepted, each displayed in a separate tabbed pane. A console is attached to each pane/session.
Gain socket mode
Gain uses its own way of connecting to a remote server. Remote Geant4 must be compiled with G4UIGainServer class which is distributed in the standard Geant4 package. In this mode, user has to make a Geant4 executable run on the remote server, after having logged in to the remote machine. G4UIGainServer acts as a network server and tells the number of port available for the Gain client. Gain client, after specifying the server and port number, is allowed to connect to the Geant4. Geant4 output

How to use Gain

The figure shows a scene when Gain is running in Gain socket mode.

In this example, two tabbed panes are displayed to run remote Geant4s running on different servers.

  1. Gain is started on the Cygwin console. Gain can be started with Java Web Start.
  2. Top menu to connect to a server or close (kill) the running G4ant4 or finish Gain.
  3. The window to choose SSh or Gain socket; now SSHINTERFACE is focused
  4. After typing in the remote host name, SSH login window is shown.
  5. When SSH login is accepted, Gain shows the remore File Chooser. Geant4 with G4UIGAG interface can be started from this chooser.
  6. When Geant4 is started, Geant4 initialisation output are shown on the cygwin console.
  7. After the initialisation phase, command tree window is available on Gain.
  8. Then, the Gain console is shown below the command tree window. See the hardcopy of the whole Gain window. This console is the SSH console, so that you can type in Geant4 commands in stead of selecting them in the above command panel.
    You can shrink the console by single click on the triangle at the left border.
  9. Two ways of ending Geant4 execution are provided. The command tree provides "exit" command which is just the "exit" of Geant4. On the top menu, "Close one" menu is to send CTRL + C to the running Geant4 process. It can be sent at any moment.

Notices on Gain console


  • At present, Gain's console displays ecerything G4cout from Geant4 with G4UIGAG interface. So, strings employed for Gain protocols are displayed. Please ignore lines starting with @@.
  • Gain console demands heavy Windows (X or Windows) power. So, with old graphic accelerators like S3 etc. which are yet common on Linux platforms, speed of console may be very slow. In such cases, shrinking the console pane is a good way to speed up the execution.
  • We have tested Gain over the Internet for a session of more than 24 hours. On Windows XP, We observed some curious deformed tree icons during the session, but the functions were correct and they became normal after some elapsed time.
    Here is the copy of the long run.
  • The console provides a session of G4UIterminal, and NOT G4UItcsh, at present.
  • If you type "exit" on the console, the execution of Geant4 is stopped. The console is yet a usual ssh console, while the upper windows for the command tree is losing connection to Geant4. If you type in "exit" on the console, it end the ssh session and the whole Gain will be destroyed.

Inside Gain


In this manual, Gain and RGAG are described. But in the final form, they were merged and Gain is the name for it. "RGAG" represents the SSH mode of Gain now, while "Gain" in the avobe manual represents the own socket mode of the present Gain.
yoshida