| 1 | <!-- ******************************************************** -->
|
|---|
| 2 | <!-- -->
|
|---|
| 3 | <!-- [History] -->
|
|---|
| 4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
|
|---|
| 5 | <!-- Update G4UIExecutive : Laurent Garnier, Dec-2009 -->
|
|---|
| 6 | <!-- Reviced : Koichi Murakami, Dec-2009 -->
|
|---|
| 7 | <!-- -->
|
|---|
| 8 | <!-- ******************************************************** -->
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | <!-- ******************* Section (Level#1) ****************** -->
|
|---|
| 12 | <sect1 id="sect.HowToSetUpInter">
|
|---|
| 13 | <title>
|
|---|
| 14 | How to Set Up an Interactive Session
|
|---|
| 15 | </title>
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 19 | <sect2 id="sect.HowToSetUpInter.Intro">
|
|---|
| 20 | <title>
|
|---|
| 21 | Introduction
|
|---|
| 22 | </title>
|
|---|
| 23 |
|
|---|
| 24 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 25 | <sect3 id="sect.HowToSetUpInter.Intro.RolesIntercoms">
|
|---|
| 26 | <title>
|
|---|
| 27 | Roles of the "intercoms" category
|
|---|
| 28 | </title>
|
|---|
| 29 |
|
|---|
| 30 | <para>
|
|---|
| 31 | The "intercoms" category provides an expandable command interpreter.
|
|---|
| 32 | It is the key mechanism of Geant4 to realize secure user interactions
|
|---|
| 33 | in all categories without being annoyed by the dependencies among categories.
|
|---|
| 34 | <!--
|
|---|
| 35 | The direct use
|
|---|
| 36 | of Geant4 classes in a C++ program offers a first ground level of
|
|---|
| 37 | interactivity, i.e., the batch session. As seen in the
|
|---|
| 38 | examples/novice/N01, Geant4 commands and macros are to be
|
|---|
| 39 | hard-coded in the program.-->
|
|---|
| 40 | The Geant4 commands can be used both in a interactive terminal session and
|
|---|
| 41 | in a batch mode with a maco file or a direct C++ call.
|
|---|
| 42 | </para>
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | </sect3>
|
|---|
| 46 |
|
|---|
| 47 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 48 | <sect3 id="sect.HowToSetUpInter.Intro.UserInterfaces">
|
|---|
| 49 | <title>
|
|---|
| 50 | User Interfaces to steer the simulation
|
|---|
| 51 | </title>
|
|---|
| 52 |
|
|---|
| 53 | <para>
|
|---|
| 54 | Geant4 can be controllled by a seriese of Geant4 UI commands.
|
|---|
| 55 | The "intercoms" category provides the abstract class
|
|---|
| 56 | <emphasis>G4UIsession</emphasis> that processes interactive commands.
|
|---|
| 57 | The concrete implementation of (graphical) user interfaceis is located
|
|---|
| 58 | in the "interfaces" category. This interfacing strategy opens an
|
|---|
| 59 | important door towards various user interface tools,
|
|---|
| 60 | and allows Geant4 to utilize the state-of-the-art GUI tools
|
|---|
| 61 | such as Motif, Qt, and Java etc.
|
|---|
| 62 | The richness of the collaboration realizes
|
|---|
| 63 | various user interfaces to the Geant4 command system.
|
|---|
| 64 | The following interfaces is currently available;
|
|---|
| 65 |
|
|---|
| 66 | <orderedlist spacing="compact">
|
|---|
| 67 | <listitem><para>
|
|---|
| 68 | Character terminal (dumb terminal and tcsh-like terminal),
|
|---|
| 69 | that is the default user interface of Geant4
|
|---|
| 70 | </para></listitem>
|
|---|
| 71 | <listitem><para>
|
|---|
| 72 | Xm, Xaw, Win32, Qt variations of the above terminal by using a
|
|---|
| 73 | Motif, Athena, Qt or Windows widget
|
|---|
| 74 | </para></listitem>
|
|---|
| 75 | <listitem><para>
|
|---|
| 76 | GAG, a fully graphical user interface and its network extension
|
|---|
| 77 | GainServer of the client/server type.
|
|---|
| 78 | </para></listitem>
|
|---|
| 79 | </orderedlist>
|
|---|
| 80 | </para>
|
|---|
| 81 |
|
|---|
| 82 | <para>
|
|---|
| 83 | Implementation of the user sesssions (1 and 2) is included
|
|---|
| 84 | in the <literal>source/interfaces/basic</literal> directory.
|
|---|
| 85 | As for GAG, the front-end class is included
|
|---|
| 86 | in the source/interfaces/GAG directory,
|
|---|
| 87 | while its partner GUI package MOMO.jar is available
|
|---|
| 88 | under the <literal>environments/MOMO</literal> directory.
|
|---|
| 89 | MOMO.jar, Java archive file, contains
|
|---|
| 90 | not only GAG, but also GGE and other helper packages.
|
|---|
| 91 | Supplementary information is available
|
|---|
| 92 | from the author's web page (see URL below).
|
|---|
| 93 | </para>
|
|---|
| 94 |
|
|---|
| 95 | <para>
|
|---|
| 96 | GAG, GainServer's client GUI Gain:
|
|---|
| 97 | <ulink url="http://www-geant4.kek.jp/~yoshidah">
|
|---|
| 98 | http://www-geant4.kek.jp/~yoshidah
|
|---|
| 99 | </ulink>
|
|---|
| 100 | </para>
|
|---|
| 101 |
|
|---|
| 102 | </sect3>
|
|---|
| 103 | </sect2>
|
|---|
| 104 |
|
|---|
| 105 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 106 | <sect2 id="sect.HowToSetUpInter.DescInter">
|
|---|
| 107 | <title>
|
|---|
| 108 | A Short Description of Available Interface Classes
|
|---|
| 109 | </title>
|
|---|
| 110 |
|
|---|
| 111 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 112 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UI">
|
|---|
| 113 | <title>
|
|---|
| 114 | <emphasis>G4UIterminal</emphasis> and <emphasis>G4UItcsh</emphasis> classes
|
|---|
| 115 | </title>
|
|---|
| 116 |
|
|---|
| 117 | <para>
|
|---|
| 118 | These interfaces open a session on the character terminal.
|
|---|
| 119 | <emphasis>G4UIterminal</emphasis> runs on all platforms supported by Geant4,
|
|---|
| 120 | including <emphasis>cygwin</emphasis> on Windows.
|
|---|
| 121 |
|
|---|
| 122 | The following built-in commands are available in
|
|---|
| 123 | <emphasis>G4UIterminal</emphasis>;
|
|---|
| 124 |
|
|---|
| 125 | <variablelist>
|
|---|
| 126 | <varlistentry>
|
|---|
| 127 | <term>cd, pwd</term>
|
|---|
| 128 | <listitem>
|
|---|
| 129 | change, display the current command directory.
|
|---|
| 130 | </listitem>
|
|---|
| 131 | </varlistentry>
|
|---|
| 132 |
|
|---|
| 133 | <varlistentry>
|
|---|
| 134 | <term>ls, lc</term>
|
|---|
| 135 | <listitem>
|
|---|
| 136 | list commands and subdirectories in the current directory.
|
|---|
| 137 | </listitem>
|
|---|
| 138 | </varlistentry>
|
|---|
| 139 |
|
|---|
| 140 | <varlistentry>
|
|---|
| 141 | <term>history</term>
|
|---|
| 142 | <listitem>
|
|---|
| 143 | show previous commands.
|
|---|
| 144 | </listitem>
|
|---|
| 145 | </varlistentry>
|
|---|
| 146 |
|
|---|
| 147 | <varlistentry>
|
|---|
| 148 | <term>!historyID</term>
|
|---|
| 149 | <listitem>
|
|---|
| 150 | reissue previous command.
|
|---|
| 151 | </listitem>
|
|---|
| 152 | </varlistentry>
|
|---|
| 153 |
|
|---|
| 154 | <varlistentry>
|
|---|
| 155 | <term>?command</term>
|
|---|
| 156 | <listitem>
|
|---|
| 157 | show current parameter values of the command.
|
|---|
| 158 | </listitem>
|
|---|
| 159 | </varlistentry>
|
|---|
| 160 |
|
|---|
| 161 | <varlistentry>
|
|---|
| 162 | <term>help command</term>
|
|---|
| 163 | <listitem>
|
|---|
| 164 | show command help.
|
|---|
| 165 | </listitem>
|
|---|
| 166 | </varlistentry>
|
|---|
| 167 |
|
|---|
| 168 | <varlistentry>
|
|---|
| 169 | <term>exit</term>
|
|---|
| 170 | <listitem>
|
|---|
| 171 | terminate the session.
|
|---|
| 172 | </listitem>
|
|---|
| 173 | </varlistentry>
|
|---|
| 174 | </variablelist>
|
|---|
| 175 |
|
|---|
| 176 | G4UItcsh supports user-friendly key bindings a-la-tcsh.
|
|---|
| 177 | <emphasis>G4UItcsh</emphasis> runs on Solaris and Linux.
|
|---|
| 178 | The following keybindings are supported;
|
|---|
| 179 |
|
|---|
| 180 | <variablelist>
|
|---|
| 181 | <varlistentry>
|
|---|
| 182 | <term>^A</term>
|
|---|
| 183 | <listitem>
|
|---|
| 184 | move cursor to the top
|
|---|
| 185 | </listitem>
|
|---|
| 186 | </varlistentry>
|
|---|
| 187 | <varlistentry>
|
|---|
| 188 | <term>^B</term>
|
|---|
| 189 | <listitem>
|
|---|
| 190 | backward cursor ([LEFT] cursor)
|
|---|
| 191 | </listitem>
|
|---|
| 192 | </varlistentry>
|
|---|
| 193 | <varlistentry>
|
|---|
| 194 | <term>^C (except Windows terminal)</term>
|
|---|
| 195 | <listitem>
|
|---|
| 196 | abort a run (<emphasis>soft abort</emphasis>) during event processing.
|
|---|
| 197 | A program will be terminated while accepting a user command.
|
|---|
| 198 | </listitem>
|
|---|
| 199 | </varlistentry>
|
|---|
| 200 | <varlistentry>
|
|---|
| 201 | <term>^D</term>
|
|---|
| 202 | <listitem>
|
|---|
| 203 | delete/exit/show matched list
|
|---|
| 204 | </listitem>
|
|---|
| 205 | </varlistentry>
|
|---|
| 206 | <varlistentry>
|
|---|
| 207 | <term>^E</term>
|
|---|
| 208 | <listitem>
|
|---|
| 209 | move cursor to the end
|
|---|
| 210 | </listitem>
|
|---|
| 211 | </varlistentry>
|
|---|
| 212 | <varlistentry>
|
|---|
| 213 | <term>^F</term>
|
|---|
| 214 | <listitem>
|
|---|
| 215 | forward cursor ([RIGHT] cursor)
|
|---|
| 216 | </listitem>
|
|---|
| 217 | </varlistentry>
|
|---|
| 218 | <varlistentry>
|
|---|
| 219 | <term>^K</term>
|
|---|
| 220 | <listitem>
|
|---|
| 221 | clear after the cursor
|
|---|
| 222 | </listitem>
|
|---|
| 223 | </varlistentry>
|
|---|
| 224 | <varlistentry>
|
|---|
| 225 | <term>^N</term>
|
|---|
| 226 | <listitem>
|
|---|
| 227 | next command ([DOWN] cursor)
|
|---|
| 228 | </listitem>
|
|---|
| 229 | </varlistentry>
|
|---|
| 230 | <varlistentry>
|
|---|
| 231 | <term>^P</term>
|
|---|
| 232 | <listitem>
|
|---|
| 233 | previous command ([UP] cursor)
|
|---|
| 234 | </listitem>
|
|---|
| 235 | </varlistentry>
|
|---|
| 236 | <varlistentry>
|
|---|
| 237 | <term>TAB</term>
|
|---|
| 238 | <listitem>
|
|---|
| 239 | command completion
|
|---|
| 240 | </listitem>
|
|---|
| 241 | </varlistentry>
|
|---|
| 242 | <varlistentry>
|
|---|
| 243 | <term>DEL</term>
|
|---|
| 244 | <listitem>
|
|---|
| 245 | backspace
|
|---|
| 246 | </listitem>
|
|---|
| 247 | </varlistentry>
|
|---|
| 248 | <varlistentry>
|
|---|
| 249 | <term>BS</term>
|
|---|
| 250 | <listitem>
|
|---|
| 251 | backspace
|
|---|
| 252 | </listitem>
|
|---|
| 253 | </varlistentry>
|
|---|
| 254 | </variablelist>
|
|---|
| 255 | </para>
|
|---|
| 256 |
|
|---|
| 257 | <para>
|
|---|
| 258 | The example below shows how to set a user's prompt.
|
|---|
| 259 | <informalexample>
|
|---|
| 260 | <programlisting>
|
|---|
| 261 | G4UItcsh* tcsh = new G4UItcsh();
|
|---|
| 262 | tcsh-> SetPrompt("%s>");
|
|---|
| 263 | </programlisting>
|
|---|
| 264 | </informalexample>
|
|---|
| 265 |
|
|---|
| 266 | The following strings are supported as substitutions in a prompt string.
|
|---|
| 267 | <variablelist>
|
|---|
| 268 | <varlistentry>
|
|---|
| 269 | <term>%s</term>
|
|---|
| 270 | <listitem>
|
|---|
| 271 | current application status
|
|---|
| 272 | </listitem>
|
|---|
| 273 | </varlistentry>
|
|---|
| 274 | <varlistentry>
|
|---|
| 275 | <term>%/</term>
|
|---|
| 276 | <listitem>
|
|---|
| 277 | current working directory
|
|---|
| 278 | </listitem>
|
|---|
| 279 | </varlistentry>
|
|---|
| 280 | <varlistentry>
|
|---|
| 281 | <term>%h</term>
|
|---|
| 282 | <listitem>
|
|---|
| 283 | history number
|
|---|
| 284 | </listitem>
|
|---|
| 285 | </varlistentry>
|
|---|
| 286 | </variablelist>
|
|---|
| 287 | </para>
|
|---|
| 288 |
|
|---|
| 289 | <para>
|
|---|
| 290 | Command history in a user's session is saved
|
|---|
| 291 | in a file <literal>$(HOME)/.g4_hist</literal>
|
|---|
| 292 | that is automatically read at the next session,
|
|---|
| 293 | so that command history is available across sessions.
|
|---|
| 294 | </para>
|
|---|
| 295 |
|
|---|
| 296 | </sect3>
|
|---|
| 297 |
|
|---|
| 298 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 299 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UIXm">
|
|---|
| 300 | <title>
|
|---|
| 301 | <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>, <emphasis>G4UIQt</emphasis> and
|
|---|
| 302 | <emphasis>G4UIWin32</emphasis> classes
|
|---|
| 303 | </title>
|
|---|
| 304 |
|
|---|
| 305 | <para>
|
|---|
| 306 | These interfaces are versions of <emphasis>G4UIterminal</emphasis>
|
|---|
| 307 | implemented over libraries Motif, Athena, Qt and WIN32 respectively.
|
|---|
| 308 | <emphasis>G4UIXm</emphasis> uses the Motif XmCommand widget,
|
|---|
| 309 | <emphasis>G4UIXaw</emphasis> the Athena dialog
|
|---|
| 310 | widget, <emphasis>G4UIQt</emphasis> the Qt dialog widget,
|
|---|
| 311 | and <emphasis>G4UIWin32</emphasis> the Windows "edit" component to do the
|
|---|
| 312 | command capturing. These interfaces are useful if working in
|
|---|
| 313 | conjunction with visualization drivers that use the Xt library, Qt library or
|
|---|
| 314 | the WIN32 one.
|
|---|
| 315 | </para>
|
|---|
| 316 |
|
|---|
| 317 | <para>
|
|---|
| 318 | A command box is at disposal for entering or recalling Geant4 commands.
|
|---|
| 319 | Command completion by typing "TAB" key is
|
|---|
| 320 | available in the command box. The shell commands "exit, cont,
|
|---|
| 321 | help, ls, cd..." are also supported. A menu bar can be customized
|
|---|
| 322 | through the <emphasis>AddMenu</emphasis> and
|
|---|
| 323 | <emphasis>AddButton</emphasis> method. Ex:
|
|---|
| 324 |
|
|---|
| 325 | <variablelist>
|
|---|
| 326 | <varlistentry>
|
|---|
| 327 | <term>/gui/addMenu</term>
|
|---|
| 328 | <listitem>
|
|---|
| 329 | test Test
|
|---|
| 330 | </listitem>
|
|---|
| 331 | </varlistentry>
|
|---|
| 332 | <varlistentry>
|
|---|
| 333 | <term>/gui/addButton</term>
|
|---|
| 334 | <listitem>
|
|---|
| 335 | test Init /run/initialize
|
|---|
| 336 | </listitem>
|
|---|
| 337 | </varlistentry>
|
|---|
| 338 | <varlistentry>
|
|---|
| 339 | <term>/gui/addButton</term>
|
|---|
| 340 | <listitem>
|
|---|
| 341 | test "Set gun" "/control/execute gun.g4m"
|
|---|
| 342 | </listitem>
|
|---|
| 343 | </varlistentry>
|
|---|
| 344 | <varlistentry>
|
|---|
| 345 | <term>/gui/addButton</term>
|
|---|
| 346 | <listitem>
|
|---|
| 347 | test "Run one event" "/run/beamOn 1"
|
|---|
| 348 | </listitem>
|
|---|
| 349 | </varlistentry>
|
|---|
| 350 | </variablelist>
|
|---|
| 351 | </para>
|
|---|
| 352 |
|
|---|
| 353 | <para>
|
|---|
| 354 | <emphasis>G4UIXm</emphasis> runs on Unix/Linux with Motif. <emphasis>G4UIXaw</emphasis>,
|
|---|
| 355 | less user friendly, runs on Unix with Athena widgets. <emphasis>G4UIQt</emphasis> run
|
|---|
| 356 | everywhere with Qt.
|
|---|
| 357 | <emphasis>G4UIWin32</emphasis> runs on Windows.
|
|---|
| 358 | </para>
|
|---|
| 359 |
|
|---|
| 360 | </sect3>
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 364 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UIGAG">
|
|---|
| 365 | <title>
|
|---|
| 366 | <emphasis>G4UIGAG</emphasis> and <emphasis>G4UIGainServer</emphasis> classes
|
|---|
| 367 | </title>
|
|---|
| 368 |
|
|---|
| 369 | <para>
|
|---|
| 370 | They are the front-end classes of Geant4 which make connection with their
|
|---|
| 371 | respective graphical user interfaces, GAG (Geant4 Adaptive GUI) via pipe, and Gain
|
|---|
| 372 | (Geant4 adaptive interface for network) via sockets. While GAG must run on the same
|
|---|
| 373 | system (Windows or Unixen) as a Geant4 application, Gain can run on a
|
|---|
| 374 | remote system (Windows, Linux, etc.) in which JRE (Java Runtime
|
|---|
| 375 | Environment) is installed. A Geant4 application is invoked on a Unix
|
|---|
| 376 | (Linux) system and behaves as a network server. It opens a port,
|
|---|
| 377 | waiting the connection from the Gain. Gain is capable to connect to
|
|---|
| 378 | multiple Geant4 "servers" on Unixen systems at different
|
|---|
| 379 | institutes.
|
|---|
| 380 | </para>
|
|---|
| 381 |
|
|---|
| 382 | <para>
|
|---|
| 383 | Client GUIs, GAG and Gain have almost similar look-and-feel. So,
|
|---|
| 384 | GAG's functionalities are briefly explained here.
|
|---|
| 385 | Please refer to the URL previously mentioned for details.
|
|---|
| 386 | </para>
|
|---|
| 387 |
|
|---|
| 388 | <para>
|
|---|
| 389 | Using GAG, user
|
|---|
| 390 | can select a command, set its parameters and execute it. It is adaptive, in the sense that it
|
|---|
| 391 | reflects the internal states of Geant4 that is a state machine. So, GAG always provides users with
|
|---|
| 392 | the Geant4 commands which may be added, deleted, enabled or disabled during a session. GAG does nothing by itself but to play an intermediate between user and
|
|---|
| 393 | an executable simulation program via pipes. Geant4's
|
|---|
| 394 | front-end class <emphasis>G4UIGAG</emphasis> must be instantiated to
|
|---|
| 395 | communicate with GAG. GAG runs on Linux and Windows. MOMO.jar can be run by a command;
|
|---|
| 396 | </para>
|
|---|
| 397 |
|
|---|
| 398 | <informalexample>
|
|---|
| 399 | <programlisting>
|
|---|
| 400 | %java -jar $G4INSTALL/environments/MOMO/MOMO.jar
|
|---|
| 401 | </programlisting>
|
|---|
| 402 | </informalexample>
|
|---|
| 403 |
|
|---|
| 404 | <para>
|
|---|
| 405 | GAG has following functions.
|
|---|
| 406 |
|
|---|
| 407 | <variablelist>
|
|---|
| 408 | <varlistentry>
|
|---|
| 409 | <term>GAG Menu:</term>
|
|---|
| 410 | <listitem>
|
|---|
| 411 | The menus are to choose and run a Geant4 executable file, to kill or exit
|
|---|
| 412 | a Geant4 process and to exit GAG. Upon the normal exit or an
|
|---|
| 413 | unexpected death of the Geant4 process, GAG window are
|
|---|
| 414 | automatically reset to run another Geant4 executable.
|
|---|
| 415 | </listitem>
|
|---|
| 416 | </varlistentry>
|
|---|
| 417 | <varlistentry>
|
|---|
| 418 | <term>Geant4 Command tree:</term>
|
|---|
| 419 | <listitem>
|
|---|
| 420 | Upon the establishment of the pipe connection with the Geant4 process, GAG displays
|
|---|
| 421 | the command menu, using expandable tree browser whose look and feel is similar to
|
|---|
| 422 | a file browser. Disabled commands are shown in opaque. GAG
|
|---|
| 423 | doesn't display commands that are just below the root of
|
|---|
| 424 | the command hierarchy. Direct type-in field is available for such
|
|---|
| 425 | input. Guidance of command categories and commands are displayed
|
|---|
| 426 | upon focusing. GAG has a command history function. User can
|
|---|
| 427 | re-execute a command with old parameters, edit the history, or save
|
|---|
| 428 | the history to create a macro file.
|
|---|
| 429 | </listitem>
|
|---|
| 430 | </varlistentry>
|
|---|
| 431 | <varlistentry>
|
|---|
| 432 | <term>Command Parameter panel:</term>
|
|---|
| 433 | <listitem>
|
|---|
| 434 | GAG's parameter panel is the user-friendliest part. It displays parameter
|
|---|
| 435 | name, its guidance, its type(s) (integer, double, Boolean or string),
|
|---|
| 436 | omittable, default value(s), expression(s) of its range and candidate list(s)
|
|---|
| 437 | (for example, of units). Range check is done by intercoms and
|
|---|
| 438 | the error message from it is shown in the pop-up dialog box. When a
|
|---|
| 439 | parameter component has a candidate list, a list box is
|
|---|
| 440 | automatically displayed . When a file is requested by a command,
|
|---|
| 441 | the file chooser is available.
|
|---|
| 442 | </listitem>
|
|---|
| 443 | </varlistentry>
|
|---|
| 444 | <varlistentry>
|
|---|
| 445 | <term>Logging:</term>
|
|---|
| 446 | <listitem>
|
|---|
| 447 | Log can be redirected to the terminal (xterm or cygwin
|
|---|
| 448 | window) from which GAG is invoked. It can be interrupted as will,
|
|---|
| 449 | in the middle of a long session of execution. Log can be saved to a
|
|---|
| 450 | file independent of the above redirection . GAG displays warning or
|
|---|
| 451 | error messages from Geant4 in a pop-up warning widget.
|
|---|
| 452 | </listitem>
|
|---|
| 453 | </varlistentry>
|
|---|
| 454 | </variablelist>
|
|---|
| 455 | </para>
|
|---|
| 456 |
|
|---|
| 457 | </sect3>
|
|---|
| 458 | </sect2>
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 462 | <sect2 id="sect.HowToSetUpInter.BuildLib">
|
|---|
| 463 | <title>
|
|---|
| 464 | Building the Interface Libraries
|
|---|
| 465 | </title>
|
|---|
| 466 |
|
|---|
| 467 | <para>
|
|---|
| 468 | The libraries that do not depend on external packages are created by default,
|
|---|
| 469 | using Geant4 configure scripts.
|
|---|
| 470 | They include <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis>
|
|---|
| 471 | and <emphasis>G4UIGAG</emphasis> in libraries <emphasis>libG4UIbasic.a/so</emphasis> and
|
|---|
| 472 | <emphasis>libG4UIGAG.a/so</emphasis>. <emphasis>G4UIGainServer.o</emphasis> is packed in
|
|---|
| 473 | the <emphasis>libG4UIGAG</emphasis>.
|
|---|
| 474 | </para>
|
|---|
| 475 |
|
|---|
| 476 | <para>
|
|---|
| 477 | To make the libraries of <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis>,
|
|---|
| 478 | <emphasis>G4UIQt</emphasis> and
|
|---|
| 479 | <emphasis>G4UIWin32</emphasis> , respective environment variables
|
|---|
| 480 | <emphasis role="bold">G4UI_BUILD_XM_SESSION</emphasis>,
|
|---|
| 481 | <emphasis role="bold">G4UI_BUILD_XAW_SESSION</emphasis>,
|
|---|
| 482 | <emphasis role="bold">G4UI_BUILD_QT_SESSION</emphasis> and
|
|---|
| 483 | <emphasis role="bold">G4UI_BUILD_WIN32_SESSION</emphasis> must be set
|
|---|
| 484 | explicitly before creating libraries.
|
|---|
| 485 | </para>
|
|---|
| 486 |
|
|---|
| 487 | <para>
|
|---|
| 488 | If the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
|
|---|
| 489 | set, no interface libraries are built at all.
|
|---|
| 490 | </para>
|
|---|
| 491 |
|
|---|
| 492 | <para>
|
|---|
| 493 | The scheme of building the user interface libraries is
|
|---|
| 494 | specified in "$G4INSTALL/config/G4UI_BUILD.gmk" makefile and the
|
|---|
| 495 | dependencies on the external packages are specified in
|
|---|
| 496 | "$G4INSTALL/config/interactivity.gmk".
|
|---|
| 497 | </para>
|
|---|
| 498 |
|
|---|
| 499 | </sect2>
|
|---|
| 500 |
|
|---|
| 501 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 502 | <sect2 id="sect.HowToSetUpInter.HowToUseInter">
|
|---|
| 503 | <title>
|
|---|
| 504 | How to Use the Interface in Your Application
|
|---|
| 505 | </title>
|
|---|
| 506 |
|
|---|
| 507 | <para>
|
|---|
| 508 | To use a given interface
|
|---|
| 509 | (<literal>G4UIxxx</literal> where <literal>xxx = terminal,Xm, Xaw, Win32, Qt,
|
|---|
| 510 | GAG, GainServer</literal>) in your program, there are two ways.
|
|---|
| 511 |
|
|---|
| 512 | <itemizedlist spacing="compact">
|
|---|
| 513 | <listitem> Calling G4UIxxx directly :
|
|---|
| 514 | <informalexample>
|
|---|
| 515 | <programlisting>
|
|---|
| 516 | #include "G4Uixxx.hh"
|
|---|
| 517 | // to instantiate a session of your choice and start the session
|
|---|
| 518 | G4UIsession* session = new G4UIxxx;
|
|---|
| 519 | session->SessionStart();
|
|---|
| 520 | // the line next to the "SessionStart" is necessary to finish the session
|
|---|
| 521 | delete session;
|
|---|
| 522 | </programlisting>
|
|---|
| 523 | </informalexample>
|
|---|
| 524 |
|
|---|
| 525 | If you want to select a session type according to your environment variable,
|
|---|
| 526 | the code can be:
|
|---|
| 527 |
|
|---|
| 528 | <informalexample>
|
|---|
| 529 | <programlisting>
|
|---|
| 530 | // to include the class definition in the main program:
|
|---|
| 531 | #if defined(G4UI_USE_TCSH)
|
|---|
| 532 | #include "G4UIterminal.hh"
|
|---|
| 533 | #include "G4UItcsh.hh"
|
|---|
| 534 | #elif defined(G4UI_USE_XM)
|
|---|
| 535 | #include "G4UIXm.hh"
|
|---|
| 536 | ....
|
|---|
| 537 | #endif
|
|---|
| 538 |
|
|---|
| 539 | #if defined(G4UI_USE_TCSH)
|
|---|
| 540 | session = new G4UITerminal(new G4UItcsh);
|
|---|
| 541 | #elif defined(G4UI_USE_XM)
|
|---|
| 542 | session = new G4UIXm(argc,argv);
|
|---|
| 543 | #elif ...
|
|---|
| 544 | </programlisting>
|
|---|
| 545 | </informalexample>
|
|---|
| 546 |
|
|---|
| 547 | Note : For a tcsh session, the second line must be
|
|---|
| 548 | <informalexample>
|
|---|
| 549 | <programlisting>
|
|---|
| 550 | G4UIsession* session = new G4UIterminal(new G4UItcsh);
|
|---|
| 551 | </programlisting>
|
|---|
| 552 | </informalexample>
|
|---|
| 553 |
|
|---|
| 554 | If the user wants to deactivate the default signal handler (soft abort)
|
|---|
| 555 | raised by "Ctr-C", the false flag can be set in the second argument
|
|---|
| 556 | of the <emphasis>G4UIterminal</emphasis> constructor like;
|
|---|
| 557 |
|
|---|
| 558 | <informalexample>
|
|---|
| 559 | <programlisting>
|
|---|
| 560 | G4UIsession* session = new G4UIterminal(new G4UItcsh, false).
|
|---|
| 561 | </programlisting>
|
|---|
| 562 | </informalexample>
|
|---|
| 563 | </listitem>
|
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 | <listitem>Using <emphasis>G4UIExecutive</emphasis>
|
|---|
| 567 | (implemented in all novice examples) :
|
|---|
| 568 |
|
|---|
| 569 | The above code is rather troublesome.
|
|---|
| 570 | This is more convenient way for choosing a session type.
|
|---|
| 571 | <informalexample>
|
|---|
| 572 | <programlisting>
|
|---|
| 573 | // to include the class definition in the main program:
|
|---|
| 574 | #ifdef G4UI_USE
|
|---|
| 575 | #include "G4UIExecutive.hh"
|
|---|
| 576 | #endif
|
|---|
| 577 | // to instantiate a session of your choice and start the session
|
|---|
| 578 | #ifdef G4UI_USE
|
|---|
| 579 | G4UIExecutive* ui = new G4UIExecutive(argc,argv);
|
|---|
| 580 | ui->SessionStart();
|
|---|
| 581 | // the line next to the "SessionStart" is necessary to finish the session
|
|---|
| 582 | delete ui;
|
|---|
| 583 | #endif
|
|---|
| 584 | </programlisting>
|
|---|
| 585 | </informalexample>
|
|---|
| 586 | </listitem>
|
|---|
| 587 | </itemizedlist>
|
|---|
| 588 | </para>
|
|---|
| 589 |
|
|---|
| 590 |
|
|---|
| 591 | <para>
|
|---|
| 592 | A corresponding environment variable must be preset
|
|---|
| 593 | to select a given interface.
|
|---|
| 594 | But some of them are set by defaults for your convenience.
|
|---|
| 595 |
|
|---|
| 596 | <itemizedlist spacing="compact">
|
|---|
| 597 | <listitem><para>
|
|---|
| 598 | <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis>,
|
|---|
| 599 | <emphasis>G4UIGAG</emphasis> and <emphasis>G4UIGainServer</emphasis>
|
|---|
| 600 | can be used without setting any environment
|
|---|
| 601 | variables. Sessions not needing external packages or libraries are
|
|---|
| 602 | always built (see "G4UI_BUILD.gmk") and linked, so the user can
|
|---|
| 603 | instantiate one of these sessions without rebuilding the libraries
|
|---|
| 604 | and without setting any environment variables.
|
|---|
| 605 | <!--For backwards
|
|---|
| 606 | compatibility with user code, as typified by geant4/examples main
|
|---|
| 607 | programs, the C-pre-processor variables corresponding to the
|
|---|
| 608 | original environment variables for the above three (i.e.,
|
|---|
| 609 | <emphasis role="bold">G4UI_USE_TERMINAL</emphasis>,
|
|---|
| 610 | <emphasis role="bold">G4UI_USE_TCSH</emphasis> and
|
|---|
| 611 | <emphasis role="bold">G4UI_USE_GAG</emphasis> ) are set. However,
|
|---|
| 612 | if he/she sets no environment variables, then the C-pre-processor variable
|
|---|
| 613 | <emphasis role="bold">G4UI_USE_TERMINAL</emphasis> is set by default,
|
|---|
| 614 | although there is no need to use it.-->
|
|---|
| 615 | </para></listitem>
|
|---|
| 616 | <listitem><para>
|
|---|
| 617 | The environment variable <emphasis role="bold">G4UI_USE_XM</emphasis>,
|
|---|
| 618 | <emphasis role="bold">G4UI_USE_QT</emphasis>, <emphasis role="bold">G4UI_USE_XAW</emphasis> or
|
|---|
| 619 | <emphasis role="bold">G4UI_USE_WIN32</emphasis> must be set to use the
|
|---|
| 620 | respective interface. The file "$G4INSTALL/config/G4UI_USE.gmk"
|
|---|
| 621 | resolves their dependencies on external packages.
|
|---|
| 622 | </para></listitem>
|
|---|
| 623 | <listitem><para>
|
|---|
| 624 | If the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
|
|---|
| 625 | set, no external libraries are selected. Also, for your convenience, if any
|
|---|
| 626 | <emphasis role="bold">G4UI_USE_XXX</emphasis> environment variable is set,
|
|---|
| 627 | then the corresponding C-pre-processor flag is also set. However, if the
|
|---|
| 628 | environment variable <emphasis role="bold">G4UI_NONE</emphasis> is set,
|
|---|
| 629 | no C-pre-processor flags are set.
|
|---|
| 630 | </para></listitem>
|
|---|
| 631 | </itemizedlist>
|
|---|
| 632 | </para>
|
|---|
| 633 |
|
|---|
| 634 | </sect2>
|
|---|
| 635 | </sect1>
|
|---|