| 1 | <!-- ******************************************************** -->
|
|---|
| 2 | <!-- -->
|
|---|
| 3 | <!-- [History] -->
|
|---|
| 4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
|
|---|
| 5 | <!-- -->
|
|---|
| 6 | <!-- ******************************************************** -->
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | <!-- ******************* Section (Level#1) ****************** -->
|
|---|
| 10 | <sect1 id="sect.HowToSetUpInter">
|
|---|
| 11 | <title>
|
|---|
| 12 | How to Set Up an Interactive Session
|
|---|
| 13 | </title>
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 17 | <sect2 id="sect.HowToSetUpInter.Intro">
|
|---|
| 18 | <title>
|
|---|
| 19 | Introduction
|
|---|
| 20 | </title>
|
|---|
| 21 |
|
|---|
| 22 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 23 | <sect3 id="sect.HowToSetUpInter.Intro.RolesIntercoms">
|
|---|
| 24 | <title>
|
|---|
| 25 | Roles of the "intercoms" category
|
|---|
| 26 | </title>
|
|---|
| 27 |
|
|---|
| 28 | <para>
|
|---|
| 29 | The "intercoms" category
|
|---|
| 30 | provides an expandable command interpreter. It is the key mechanism
|
|---|
| 31 | of Geant4 to realize user interactions of all categories without
|
|---|
| 32 | being annoyed by the dependencies among categories. The direct use
|
|---|
| 33 | of Geant4 classes in a C++ program offers a first ground level of
|
|---|
| 34 | interactivity, i.e., the batch session. As seen in the
|
|---|
| 35 | examples/novice/N01, Geant4 commands and macros are to be
|
|---|
| 36 | hard-coded in the program.
|
|---|
| 37 | </para>
|
|---|
| 38 |
|
|---|
| 39 | </sect3>
|
|---|
| 40 |
|
|---|
| 41 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 42 | <sect3 id="sect.HowToSetUpInter.Intro.UserInterfaces">
|
|---|
| 43 | <title>
|
|---|
| 44 | User Interfaces to steer the simulation
|
|---|
| 45 | </title>
|
|---|
| 46 |
|
|---|
| 47 | <para>
|
|---|
| 48 | To avoid too much programming, the
|
|---|
| 49 | "intercoms" category provides the abstract class <emphasis>G4UIsession</emphasis>
|
|---|
| 50 | that captures interactive commands . The concrete implementation of
|
|---|
| 51 | the user interface and Graphical User Interfaces (GUI) is left to
|
|---|
| 52 | the interfaces category. This interfacing strategy opens an
|
|---|
| 53 | important door towards various user interface tools and allows
|
|---|
| 54 | Geant4 to utilize the state-of-the-art GUI tools such as Motif and
|
|---|
| 55 | Java, etc..The richness of the collaboration has permitted for
|
|---|
| 56 | different groups to offer various user interfaces to the Geant4
|
|---|
| 57 | command system. Currently available are the following;
|
|---|
| 58 |
|
|---|
| 59 | <orderedlist spacing="compact">
|
|---|
| 60 | <listitem><para>
|
|---|
| 61 | Character terminal (dumb terminal and tcsh(bash)-like terminal),
|
|---|
| 62 | the default user interface of Geant4,
|
|---|
| 63 | </para></listitem>
|
|---|
| 64 | <listitem><para>
|
|---|
| 65 | Xm, Xaw, Win32, variations of the upper terminal by using a
|
|---|
| 66 | Motif, Athena or Windows widget to retrieve commands, and
|
|---|
| 67 | </para></listitem>
|
|---|
| 68 | <listitem><para>
|
|---|
| 69 | GAG, a fully Graphical User Interface and its extension
|
|---|
| 70 | GainServer of the client/server type.
|
|---|
| 71 | </para></listitem>
|
|---|
| 72 | </orderedlist>
|
|---|
| 73 | </para>
|
|---|
| 74 |
|
|---|
| 75 | <para>
|
|---|
| 76 | Full implementation of the character
|
|---|
| 77 | terminals (1 and 2) is included in the standard Geant4 distribution
|
|---|
| 78 | in the <literal>source/interfaces/basic</literal> directory. As for GAG
|
|---|
| 79 | with rich GUI functionalities, its front-end classes are included
|
|---|
| 80 | in the Geant4 distribution in the source/interfaces/GAG directory.
|
|---|
| 81 | The corresponding GUI package is available either from the author's
|
|---|
| 82 | Web pages (see URL below) or in the distributed package under the
|
|---|
| 83 | <literal>environments/MOMO</literal> directory.
|
|---|
| 84 | </para>
|
|---|
| 85 |
|
|---|
| 86 | <para>
|
|---|
| 87 | GAG, GainServer's client GUI Gain:
|
|---|
| 88 | <ulink url="http://erpc1.naruto-u.ac.jp/~geant4">
|
|---|
| 89 | http://erpc1.naruto-u.ac.jp/~geant4
|
|---|
| 90 | </ulink>
|
|---|
| 91 | </para>
|
|---|
| 92 |
|
|---|
| 93 | </sect3>
|
|---|
| 94 | </sect2>
|
|---|
| 95 |
|
|---|
| 96 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 97 | <sect2 id="sect.HowToSetUpInter.DescInter">
|
|---|
| 98 | <title>
|
|---|
| 99 | A Short Description of Available Interface Classes
|
|---|
| 100 | </title>
|
|---|
| 101 |
|
|---|
| 102 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 103 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UI">
|
|---|
| 104 | <title>
|
|---|
| 105 | <emphasis>G4UIterminal</emphasis> and <emphasis>G4UItcsh</emphasis> classes
|
|---|
| 106 | </title>
|
|---|
| 107 |
|
|---|
| 108 | <para>
|
|---|
| 109 | These interfaces open a session on the character terminal.
|
|---|
| 110 | <emphasis>G4UIterminal</emphasis> runs on all platform supported by Geant4,
|
|---|
| 111 | including <emphasis>cygwin</emphasis> on Windows,
|
|---|
| 112 | while <emphasis>G4UItcsh</emphasis> runs on Solaris and Linux. G4UItcsh
|
|---|
| 113 | supports user-friendly key bindings a-la-tcsh (or bash);
|
|---|
| 114 |
|
|---|
| 115 | <variablelist>
|
|---|
| 116 | <varlistentry>
|
|---|
| 117 | <term>^A</term>
|
|---|
| 118 | <listitem>
|
|---|
| 119 | move cursor to the top
|
|---|
| 120 | </listitem>
|
|---|
| 121 | </varlistentry>
|
|---|
| 122 | <varlistentry>
|
|---|
| 123 | <term>^B</term>
|
|---|
| 124 | <listitem>
|
|---|
| 125 | backward cursor ([LEFT] cursor)
|
|---|
| 126 | </listitem>
|
|---|
| 127 | </varlistentry>
|
|---|
| 128 | <varlistentry>
|
|---|
| 129 | <term>^C (except Windows terminal)</term>
|
|---|
| 130 | <listitem>
|
|---|
| 131 | abort a run (<emphasis>soft abort</emphasis>) during event processing.
|
|---|
| 132 | A program will be terminated while accepting a user command.
|
|---|
| 133 | </listitem>
|
|---|
| 134 | </varlistentry>
|
|---|
| 135 | <varlistentry>
|
|---|
| 136 | <term>^D</term>
|
|---|
| 137 | <listitem>
|
|---|
| 138 | delete/exit/show matched list
|
|---|
| 139 | </listitem>
|
|---|
| 140 | </varlistentry>
|
|---|
| 141 | <varlistentry>
|
|---|
| 142 | <term>^E</term>
|
|---|
| 143 | <listitem>
|
|---|
| 144 | move cursor to the end
|
|---|
| 145 | </listitem>
|
|---|
| 146 | </varlistentry>
|
|---|
| 147 | <varlistentry>
|
|---|
| 148 | <term>^F</term>
|
|---|
| 149 | <listitem>
|
|---|
| 150 | forward cursor ([RIGHT] cursor)
|
|---|
| 151 | </listitem>
|
|---|
| 152 | </varlistentry>
|
|---|
| 153 | <varlistentry>
|
|---|
| 154 | <term>^K</term>
|
|---|
| 155 | <listitem>
|
|---|
| 156 | clear after the cursor
|
|---|
| 157 | </listitem>
|
|---|
| 158 | </varlistentry>
|
|---|
| 159 | <varlistentry>
|
|---|
| 160 | <term>^N</term>
|
|---|
| 161 | <listitem>
|
|---|
| 162 | next command ([DOWN] cursor)
|
|---|
| 163 | </listitem>
|
|---|
| 164 | </varlistentry>
|
|---|
| 165 | <varlistentry>
|
|---|
| 166 | <term>^P</term>
|
|---|
| 167 | <listitem>
|
|---|
| 168 | previous command ([UP] cursor)
|
|---|
| 169 | </listitem>
|
|---|
| 170 | </varlistentry>
|
|---|
| 171 | <varlistentry>
|
|---|
| 172 | <term>TAB</term>
|
|---|
| 173 | <listitem>
|
|---|
| 174 | command completion
|
|---|
| 175 | </listitem>
|
|---|
| 176 | </varlistentry>
|
|---|
| 177 | <varlistentry>
|
|---|
| 178 | <term>DEL</term>
|
|---|
| 179 | <listitem>
|
|---|
| 180 | backspace
|
|---|
| 181 | </listitem>
|
|---|
| 182 | </varlistentry>
|
|---|
| 183 | <varlistentry>
|
|---|
| 184 | <term>BS</term>
|
|---|
| 185 | <listitem>
|
|---|
| 186 | backspace
|
|---|
| 187 | </listitem>
|
|---|
| 188 | </varlistentry>
|
|---|
| 189 | </variablelist>
|
|---|
| 190 | </para>
|
|---|
| 191 |
|
|---|
| 192 | <para>
|
|---|
| 193 | In addition, the following string substitutions are supported;
|
|---|
| 194 |
|
|---|
| 195 | <variablelist>
|
|---|
| 196 | <varlistentry>
|
|---|
| 197 | <term>%s</term>
|
|---|
| 198 | <listitem>
|
|---|
| 199 | current application status
|
|---|
| 200 | </listitem>
|
|---|
| 201 | </varlistentry>
|
|---|
| 202 | <varlistentry>
|
|---|
| 203 | <term>%/</term>
|
|---|
| 204 | <listitem>
|
|---|
| 205 | current working directory
|
|---|
| 206 | </listitem>
|
|---|
| 207 | </varlistentry>
|
|---|
| 208 | <varlistentry>
|
|---|
| 209 | <term>%h</term>
|
|---|
| 210 | <listitem>
|
|---|
| 211 | history number
|
|---|
| 212 | </listitem>
|
|---|
| 213 | </varlistentry>
|
|---|
| 214 | </variablelist>
|
|---|
| 215 | </para>
|
|---|
| 216 |
|
|---|
| 217 | </sect3>
|
|---|
| 218 |
|
|---|
| 219 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 220 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UIXm">
|
|---|
| 221 | <title>
|
|---|
| 222 | <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis> and
|
|---|
| 223 | <emphasis>G4UIWin32</emphasis> classes
|
|---|
| 224 | </title>
|
|---|
| 225 |
|
|---|
| 226 | <para>
|
|---|
| 227 | These interfaces are versions of <emphasis>G4UIterminal</emphasis>
|
|---|
| 228 | implemented over libraries Motif, Athena and WIN32 respectively.
|
|---|
| 229 | <emphasis>G4UIXm</emphasis> uses the Motif XmCommand widget,
|
|---|
| 230 | <emphasis>G4UIXaw</emphasis> the Athena dialog
|
|---|
| 231 | widget, and <emphasis>G4UIWin32</emphasis> the Windows "edit" component to do the
|
|---|
| 232 | command capturing. These interfaces are useful if working in
|
|---|
| 233 | conjunction with visualization drivers that use the Xt library or
|
|---|
| 234 | the WIN32 one.
|
|---|
| 235 | </para>
|
|---|
| 236 |
|
|---|
| 237 | <para>
|
|---|
| 238 | A command box is at disposal for entering or recalling Geant4 commands.
|
|---|
| 239 | Command completion by typing &ldquo;TAB&rdquo; key is
|
|---|
| 240 | available on the command line. The shellcommands "exit, cont,
|
|---|
| 241 | help, ls, cd..." are also supported. A menu bar could be customized
|
|---|
| 242 | through the <emphasis>AddMenu</emphasis> and
|
|---|
| 243 | <emphasis>AddButton</emphasis> method. Ex:
|
|---|
| 244 |
|
|---|
| 245 | <variablelist>
|
|---|
| 246 | <varlistentry>
|
|---|
| 247 | <term>/gui/addMenu</term>
|
|---|
| 248 | <listitem>
|
|---|
| 249 | test Test
|
|---|
| 250 | </listitem>
|
|---|
| 251 | </varlistentry>
|
|---|
| 252 | <varlistentry>
|
|---|
| 253 | <term>/gui/addButton</term>
|
|---|
| 254 | <listitem>
|
|---|
| 255 | test Init /run/initialize
|
|---|
| 256 | </listitem>
|
|---|
| 257 | </varlistentry>
|
|---|
| 258 | <varlistentry>
|
|---|
| 259 | <term>/gui/addButton</term>
|
|---|
| 260 | <listitem>
|
|---|
| 261 | test "Set gun" "/control/execute gun.g4m"
|
|---|
| 262 | </listitem>
|
|---|
| 263 | </varlistentry>
|
|---|
| 264 | <varlistentry>
|
|---|
| 265 | <term>/gui/addButton</term>
|
|---|
| 266 | <listitem>
|
|---|
| 267 | test "Run one event" "/run/beamOn 1"
|
|---|
| 268 | </listitem>
|
|---|
| 269 | </varlistentry>
|
|---|
| 270 | </variablelist>
|
|---|
| 271 | </para>
|
|---|
| 272 |
|
|---|
| 273 | <para>
|
|---|
| 274 | <emphasis>G4UIXm</emphasis> runs on Unix/Linux with Motif. <emphasis>G4UIXaw</emphasis>,
|
|---|
| 275 | less user friendly, runs on Unix with Athena widgets.
|
|---|
| 276 | <emphasis>G4UIWin32</emphasis> runs on Windows.
|
|---|
| 277 | </para>
|
|---|
| 278 |
|
|---|
| 279 | </sect3>
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 | <!-- ******************* Section (Level#3) ****************** -->
|
|---|
| 283 | <sect3 id="sect.HowToSetUpInter.DescInter.G4UIGAG">
|
|---|
| 284 | <title>
|
|---|
| 285 | <emphasis>G4UIGAG</emphasis> and <emphasis>G4UIGainServer</emphasis> classes
|
|---|
| 286 | </title>
|
|---|
| 287 |
|
|---|
| 288 | <para>
|
|---|
| 289 | They are the front-end classes of Geant4 which interface with their
|
|---|
| 290 | respective graphical user interfaces, GAG (Geant4 Adaptive GUI) and Gain
|
|---|
| 291 | (Geant4 adaptive interface for network). While GAG must run on the same
|
|---|
| 292 | system (Windows or Unixen) as a Geant4 application, Gain can run on a
|
|---|
| 293 | remote system (Windows, Linux, etc.) to which JVM (Java Virtual
|
|---|
| 294 | Machine) is installed. A Geant4 application is invoked on a Unix
|
|---|
| 295 | (Linux) system and behaves as a network server. It opens a port,
|
|---|
| 296 | waiting the connection from the Gain. Gain is capable to connect to
|
|---|
| 297 | multiple Geant4 "servers" on Unixen systems at different
|
|---|
| 298 | institutes.
|
|---|
| 299 | </para>
|
|---|
| 300 |
|
|---|
| 301 | <para>
|
|---|
| 302 | Client GUI, GAG and Gain have almost similar look-and-feel. So,
|
|---|
| 303 | GAG's functionalities are briefly introduced here. Please refer to
|
|---|
| 304 | the above URL for details and to download the client GUIs.
|
|---|
| 305 | </para>
|
|---|
| 306 |
|
|---|
| 307 | <para>
|
|---|
| 308 | GAG is a Graphical User Interface tool with which user
|
|---|
| 309 | can set parameters and execute commands. It is adaptive, since GAG
|
|---|
| 310 | reflects the internal states of Geant4 that is a state machine. GAG
|
|---|
| 311 | is based on the server-client model; GAG is the server, while
|
|---|
| 312 | Geant4 executables are clients. Hence, GAG does nothing by itself
|
|---|
| 313 | and it must invoke an executable simulation program. Geant4's
|
|---|
| 314 | front-end class <emphasis>G4UIGAG</emphasis> must be instantiated to
|
|---|
| 315 | communicate with GAG. This runs on Linux and Windows 2000.
|
|---|
| 316 | GAG is written in Java and
|
|---|
| 317 | its Jar (Java Archive) file is available from the above URL. See
|
|---|
| 318 | the same pages to know how to install and run Java programs.
|
|---|
| 319 | </para>
|
|---|
| 320 |
|
|---|
| 321 | <para>
|
|---|
| 322 | GAG has following functions.
|
|---|
| 323 |
|
|---|
| 324 | <variablelist>
|
|---|
| 325 | <varlistentry>
|
|---|
| 326 | <term>GAG Menu:</term>
|
|---|
| 327 | <listitem>
|
|---|
| 328 | The menus are to choose and run a GEANT4 executable file, to kill or exit
|
|---|
| 329 | a GEANT4 process and to exit GAG. Upon the normal exit or an
|
|---|
| 330 | unexpected death of the Geant4 process, GAG window are
|
|---|
| 331 | automatically reset to accept another GEANT4 executable.
|
|---|
| 332 | </listitem>
|
|---|
| 333 | </varlistentry>
|
|---|
| 334 | <varlistentry>
|
|---|
| 335 | <term>GEANT4 Command tree:</term>
|
|---|
| 336 | <listitem>
|
|---|
| 337 | Upon the establishment of the pipe with the GEANT4 process, GAG displays
|
|---|
| 338 | the command menu tree whose look and feel is quite similar to
|
|---|
| 339 | Windows' file browser. Disabled commands are shown opaque. GAG
|
|---|
| 340 | doesn &rsquo;t display commands that are just below the root of
|
|---|
| 341 | the command hierarchy. Direct type-in field is available for such
|
|---|
| 342 | input. Guidance of command categories and commands are displayed
|
|---|
| 343 | upon focusing. GAG has a command history function. User can
|
|---|
| 344 | re-execute a command with old parameters, edit the history, or save
|
|---|
| 345 | the history to create a macro file.
|
|---|
| 346 | </listitem>
|
|---|
| 347 | </varlistentry>
|
|---|
| 348 | <varlistentry>
|
|---|
| 349 | <term>Command Parameter panel:</term>
|
|---|
| 350 | <listitem>
|
|---|
| 351 | GAG's parameter panel is the user-friendliest part. It displays parameter
|
|---|
| 352 | name, its guidance, its type(s) (integer, double, Boolean or string),
|
|---|
| 353 | omittable, default value(s), expression(s) of its range and candidate list(s)
|
|---|
| 354 | (for example, of units). Range check is done by intercoms and
|
|---|
| 355 | the error message from it is shown in the pop-up dialog box. When a
|
|---|
| 356 | parameter component has a candidate list, a list box is
|
|---|
| 357 | automatically displayed . When a file is requested by a command,
|
|---|
| 358 | the file chooser is available.
|
|---|
| 359 | </listitem>
|
|---|
| 360 | </varlistentry>
|
|---|
| 361 | <varlistentry>
|
|---|
| 362 | <term>Logging:</term>
|
|---|
| 363 | <listitem>
|
|---|
| 364 | Log can be redirected to the terminal (xterm or cygwin
|
|---|
| 365 | window) from which GAG is invoked. It can be interrupted as will,
|
|---|
| 366 | in the middle of long session of execution. Log can be saved to a
|
|---|
| 367 | file independent of the above redirection . GAG displays warning or
|
|---|
| 368 | error messages from GEANT4 in a pop-up warning widget.
|
|---|
| 369 | </listitem>
|
|---|
| 370 | </varlistentry>
|
|---|
| 371 | </variablelist>
|
|---|
| 372 | </para>
|
|---|
| 373 |
|
|---|
| 374 | </sect3>
|
|---|
| 375 | </sect2>
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 379 | <sect2 id="sect.HowToSetUpInter.BuildLib">
|
|---|
| 380 | <title>
|
|---|
| 381 | Building the Interface Libraries
|
|---|
| 382 | </title>
|
|---|
| 383 |
|
|---|
| 384 | <para>
|
|---|
| 385 | The libraries that don't depend on external packages are made by default.
|
|---|
| 386 | They include <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis>
|
|---|
| 387 | and <emphasis>G4UIGAG</emphasis> in libraries <emphasis>libG4UIbasic.a/so</emphasis> and
|
|---|
| 388 | <emphasis>libG4UIGAG.a/so</emphasis>. <emphasis>G4UIGainServer.o</emphasis> is packed in
|
|---|
| 389 | the <emphasis>libG4UIGAG</emphasis>.
|
|---|
| 390 | </para>
|
|---|
| 391 |
|
|---|
| 392 | <para>
|
|---|
| 393 | To make the libraries of <emphasis>G4UIXm</emphasis>, <emphasis>G4UIXaw</emphasis> and
|
|---|
| 394 | <emphasis>G4UIWin32</emphasis> , respective environment variables
|
|---|
| 395 | <emphasis role="bold">G4UI_BUILD_XM_SESSION</emphasis>,
|
|---|
| 396 | <emphasis role="bold">G4UI_BUILD_XAW_SESSION</emphasis> or
|
|---|
| 397 | <emphasis role="bold">G4UI_BUILD_WIN32_SESSION</emphasis> must be set
|
|---|
| 398 | explicitly.
|
|---|
| 399 | </para>
|
|---|
| 400 |
|
|---|
| 401 | <para>
|
|---|
| 402 | However, if the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
|
|---|
| 403 | set, no interface libraries are built at all.
|
|---|
| 404 | </para>
|
|---|
| 405 |
|
|---|
| 406 | <para>
|
|---|
| 407 | Build scheme of the user interface libraries is
|
|---|
| 408 | specified in "$G4INSTALL/config/G4UI_BUILD.gmk" makefile and the
|
|---|
| 409 | dependencies on the external packages are specified in
|
|---|
| 410 | "$G4INSTALL/config/interactivity.gmk".
|
|---|
| 411 | </para>
|
|---|
| 412 |
|
|---|
| 413 | </sect2>
|
|---|
| 414 |
|
|---|
| 415 | <!-- ******************* Section (Level#2) ****************** -->
|
|---|
| 416 | <sect2 id="sect.HowToSetUpInter.HowToUseInter">
|
|---|
| 417 | <title>
|
|---|
| 418 | How to Use the Interface
|
|---|
| 419 | </title>
|
|---|
| 420 |
|
|---|
| 421 | <para>
|
|---|
| 422 | To use a given interface
|
|---|
| 423 | (<literal>G4UIxxx</literal> where <literal>xxx = terminal,Xm, Xaw, Win32,
|
|---|
| 424 | GAG, GainServer</literal>) in a user's program, he has the following
|
|---|
| 425 | lines in his main program;
|
|---|
| 426 |
|
|---|
| 427 | <informalexample>
|
|---|
| 428 | <programlisting>
|
|---|
| 429 | // to include the class definition in his main program:
|
|---|
| 430 | #include "G4Uixxx.hh"
|
|---|
| 431 | // to instantiate a session of his choice and start the session
|
|---|
| 432 | G4UIsession* session = new G4UIxxx;
|
|---|
| 433 | session->SessionStart();
|
|---|
| 434 | // the line next to the "SessionStart" is usually to finish the session
|
|---|
| 435 | delete session;
|
|---|
| 436 | </programlisting>
|
|---|
| 437 | </informalexample>
|
|---|
| 438 | </para>
|
|---|
| 439 |
|
|---|
| 440 | <para>
|
|---|
| 441 | For a tcsh session, the second line must be :
|
|---|
| 442 |
|
|---|
| 443 | <informalexample>
|
|---|
| 444 | <programlisting>
|
|---|
| 445 | G4UIsession* session = new G4UIterminal(new G4UItcsh);
|
|---|
| 446 | </programlisting>
|
|---|
| 447 | </informalexample>
|
|---|
| 448 | </para>
|
|---|
| 449 |
|
|---|
| 450 | <para>
|
|---|
| 451 | See the examples in "examples/novice/N0x" in which the terminal session
|
|---|
| 452 | is used.
|
|---|
| 453 | </para>
|
|---|
| 454 |
|
|---|
| 455 | <para>
|
|---|
| 456 | If the user wants to deactivate the default signal handler (soft abort)
|
|---|
| 457 | raised by "Ctr-C", the false flag can be set in the second argument
|
|---|
| 458 | of the <emphasis>G4UIterminal</emphasis> constructor like;
|
|---|
| 459 |
|
|---|
| 460 | <informalexample>
|
|---|
| 461 | <programlisting>
|
|---|
| 462 | G4UIsession* session = new G4UIterminal(new G4UItcsh, false).
|
|---|
| 463 | </programlisting>
|
|---|
| 464 | </informalexample>
|
|---|
| 465 | </para>
|
|---|
| 466 |
|
|---|
| 467 | <para>
|
|---|
| 468 | Again, environment variable selects a given interface. But for your
|
|---|
| 469 | convenience, some of them are set defaults.
|
|---|
| 470 |
|
|---|
| 471 | <itemizedlist spacing="compact">
|
|---|
| 472 | <listitem><para>
|
|---|
| 473 | <emphasis>G4UIterminal</emphasis>, <emphasis>G4UItcsh</emphasis>,
|
|---|
| 474 | <emphasis>G4UIGAG</emphasis> and <emphasis>G4UIGainServer</emphasis>
|
|---|
| 475 | can be used without any environment
|
|---|
| 476 | variables. Sessions not needing external packages or libraries are
|
|---|
| 477 | always built (see "G4UI_BUILD.gmk") and linked, so the user can
|
|---|
| 478 | instantiate one of these sessions without rebuilding the libraries
|
|---|
| 479 | and without setting any environment variables. For backwards
|
|---|
| 480 | compatibility with user code, as typified by geant4/examples main
|
|---|
| 481 | programs, the C-pre-processor variables corresponding to the
|
|---|
| 482 | original environment variables for the above three (i.e.,
|
|---|
| 483 | <emphasis role="bold">G4UI_USE_TERMINAL</emphasis>,
|
|---|
| 484 | <emphasis role="bold">G4UI_USE_TCSH</emphasis> and
|
|---|
| 485 | <emphasis role="bold">G4UI_USE_GAG</emphasis> ) are set. However,
|
|---|
| 486 | if he/she sets no environment variables, then the C-pre-processor variable
|
|---|
| 487 | <emphasis role="bold">G4UI_USE_TERMINAL</emphasis> is set by default,
|
|---|
| 488 | although there is no need to use it.
|
|---|
| 489 | </para></listitem>
|
|---|
| 490 | <listitem><para>
|
|---|
| 491 | The environment variable <emphasis role="bold">G4UI_USE_XM</emphasis>,
|
|---|
| 492 | <emphasis role="bold">G4UI_USE_XAW</emphasis> or
|
|---|
| 493 | <emphasis role="bold">G4UI_USE_WIN32</emphasis> must be set to use the
|
|---|
| 494 | respective interface. The file "$G4INSTALL/config/interactivity.gmk"
|
|---|
| 495 | resolves their dependencies on external packages.
|
|---|
| 496 | </para></listitem>
|
|---|
| 497 | <listitem><para>
|
|---|
| 498 | If the environment variable <emphasis role="bold">G4UI_NONE</emphasis> is
|
|---|
| 499 | set, no externa ibraries are selected. Also, for your convenience, if any
|
|---|
| 500 | <emphasis role="bold">G4UI_USE_XXX</emphasis> environment variable is set,
|
|---|
| 501 | then the corresponding C-pre-processor flag is also set. However, if the
|
|---|
| 502 | environment variable <emphasis role="bold">G4UI_NONE</emphasis> is set,
|
|---|
| 503 | no C-pre-processor flags are set.
|
|---|
| 504 | </para></listitem>
|
|---|
| 505 | </itemizedlist>
|
|---|
| 506 | </para>
|
|---|
| 507 |
|
|---|
| 508 | </sect2>
|
|---|
| 509 | </sect1>
|
|---|