MAQ – Mokka Asked Questions



General Sources of Information

  1. The official Mokka web pages (not complete in all parts yet)

  2. The previous version of the Mokka web pages before the migration to Plone (partially outdated)

  3. Mokka release notes: The Mokka release notes (can be found in the directory “Mokka/ReleaseNotes”) contain information about changes from version to version, but you will not always be able to get a coherent picture of the whole thing without reading a lot of information (some of which is outdated again, and so on). “grep” may help you …

  4. The Detector Model Database Browser, a benign web-based interface to the Mokka geometry management system, and the Mokka Geometry Database Cross-Reference

  5. The “ILC Soft” software portal provides links to all relevant software packages

  6. The LDC/ILD Optimisation web pages

  7. Responsible persons:

    1. Mokka development and functionality: Paulo Mora de Freitas, Gabriel Musat, Frank Gaede
    2. “ILC Soft” core software and software portal: Frank Gaede, Jan Engels
    3. LDC/ILD detector optimisation and coordination: Jenny List, Philip Bechtle, Mikael Berggren
  8. In case of more general questions, you can also post messages on the Linear Collider Forum, which has a section dedicated to Mokka

  9. The Geant4 User’s Guide for Application Developers provides detailed information about the underlying Geant4 framework and its usage in applications like Mokka

  10. The Geant4 HyperNews are a forum with several sections that cover various Geant4-related questions


Shell Command Line Arguments


Geant4 Command Line Help and Other Features


Visualisation of Detector Geometries


Inspecting the Geometry in Detail

  1. Using the built-in “ASCIITree” viewer can reproduce the full detector geometry tree as Geant4 sees it:

    /vis/scene/create
    /vis/scene/add/volume world
    /vis/open ATree
    /vis/ASCIITree/verbose verbosity # see the built-in help
    /vis/viewer/flush
  2. Using the “/Mokka/Visu/Detector/” commands will display Mokka’s opinion about what might be going on:

    /Mokka/Visu/Detector/ListGeometryTree

    Please have a look at the release notes for mokka-06-00 in oder to find out how to use these commands and how to show, hide, or colour certain subdetectors. Good candidates for subdetector names are “tube”, “vxd”, “tpc”, “ecal”, “hcal”, “coil”, “yoke”, and so on – but “ListGeometryTree” will tell you the details.

    If the “ASCIITree” or “ListGeometryTree” produce too much output, you may want to catch it with a tool like “less” – for example:

    ./bin/Linux-g++/Mokka ./mokka.steer << EOT | less
    /Mokka/Visu/Detector/ListGeometryTree
    exit
    EOT

    Make sure you don’t forget the “exit” command in that case.

  3. Picking in the viewer (only implemented for OpenGL and OpenInventor viewers up to now):

    /vis/scene/create
    /vis/open OGLIX
    /vis/viewer/set/picking true
    # adjust the view to your liking (zoom, rotate, pan, …)
    /vis/viewer/flush
    # left-click in the window and hope for the best …
    # middle-click in the window to get back to the prompt

    This feature is rather new and it’s possible that you get some strange effects every now and then. But anything is better than nothing! (Finally, Geant4 starts to acquire the functionality that GEANT3 had ages ago …)

  4. Displaying all volumes in the geometry, irrespective of their visibility setting (may take some time):

    /vis/viewer/set/culling global false
  5. Viewing only a section plane (i. e. a thin slice), going through point “X Y Z” with normal vector “NX NY NZ”:

    /vis/viewer/set/sectionPlane on X Y Z UNIT NX NY NZ
    /vis/viewer/set/sectionPlane off
  6. Applying one or more cutaway planes (i. e. removal of a half space), either in “union” or in “intersection” mode:

    /vis/viewer/addCutawayPlane X Y Z UNIT NX NY NZ
    /vis/viewer/set/cutawayMode union | intersection
    /vis/viewer/changeCutawayPlane INDEX X Y Z UNIT NX NY NZ
    /vis/viewer/clearCutawayPlanes
  7. Viewers for HepRep files and similar geometry formats may even have much more advanced capabilities – consult the documentation of the respective application to get the most out of it.


Finding Geometry Overlaps

  1. A straightforward, yet effective way to find geometry overlaps is by eye. Use an online visualisation driver (e. g. one of the OpenGL drivers), apply a section cut through the geometry (“/vis/viewer/set/sectionPlane”), zoom in (“/vis/viewer/zoomTo” or the corresponding slider in the dialog box) and pan around (“/vis/viewer/panTo” or the corresponding buttons in the dialog box) to find overlapping volumes. It may help to select wireframe mode (“/vis/geometry/set/forceWireframe”) or to display all volumes including invisible ones (“/vis/geometry/set/visibility” or “/vis/viewer/set/culling”). Picking (“/vis/viewer/set/picking”) or the “ATree” driver can help you to identify single volumes and to understand the volume hierarchy.

    This approach is of course not absolutely safe: You cannot directly see the volume hierarchy, which means you’ll typically only recognise partial overlaps. Furthermore, you need to have some suspicion where geometry errors might be in order to place your section plane sensibly. Lastly, some constellations may lead to artifacts in the viewer that can look like a geometry error, but they aren’t. Nevertheless, looking at the geometry closely will catch the most common errors.

  2. Produce an output file with the “DAWNFILE” driver and run it through DAVID to check the geometry for overlaps. DAVID will output errors on the terminal and it will also produce a second DAWN file where overlapping volumes are marked in red colour. DAVID works wonderfully for relatively simple shapes, but it is known to have some problems for volumes with more complicated shapes or placements. In any case, DAVID should provide very valuable help – even though its output may not be fool-proof, it can at least tell you where to look more closely.

  3. The commands in the command directory “/geometry/test/” are specifically designed for geometry tests – read the Geant4 built-in help to learn what they do. Remember to use the “recursionFlag” to check more than one single level of the volume hierarchy. The built-in grid test and the cylinder test may not always be the optimal choice because they will either need a very long time (for small cells) or they may miss critical details of the geometry (for large cells). Sometimes it could be just the right choice to do some line tests in places where you suspect possible problems. You can also use a small shell script to output a series of line test commands that does a semi-automatic scan through parts of the geometry. Note that the command “/geometry/test/direction” does not strictly take a direction, but a momentum vector: The predefined value is 1 MeV, but may also want to try different orders of magnitude here.

    Unfortunately, the results of the built-in geometry checks are not completely reliable, either: You may get false positives as well as false negatives, which means that you can neither be sure that your geometry is correct nor that there is an error. Try different tolerances and momenta. In case of doubt, use a viewer for visualisation or read the source code that constructs the geometry.

  4. There is a plugin for Mokka that makes the built-in geometry checking of Geant4 available on the command line. See the corresponding readme file under “Mokka/source/Plugin/OverlapPlugin” for details, and keep in mind that the checking heuristics is not infallible.

  5. External viewers for data formats like HepRep or VRML may have much more advanced possibilities of geometry checking. Consult the documentation of your favourite tool.

  6. Ages ago there have been rumours about a ROOT-based geometry checker for GEANT (probably still version 3). However, nobody has ever seen it since, and there is no suitable interface between Geant4 and ROOT, anyway.


Displaying Events in the Viewer


Compiling Mokka (Not Only) at DESY

  1. Setting up the environment for Geant4:

    export G4WORKDIR=/path/to/local/mokka/installation
    export G4INSTALL=/afs/desy.de/group/it/ilcsoft/geant4/9.0.p01
    source $G4INSTALL/env.sh # this sets a lot of further variables
  2. Additional settings for Geant4 that you may find convenient (may already be contained in “env.sh”, depending on the Geant4 installation):

    export G4UI_USE_TCSH=1 # smarter command line
    unset G4UI_USE_XM # no Motif user interface
    unset G4UI_USE_XAW # no Athena user interface
    #export G4DEBUG=1 # if you want to enable debugging support
    #export G4UI_NONE=1 # if you want to disable any kind of user interface
    #export G4VIS_NONE=1 # if you want to disable any kind of visualisation
    # (but keep in mind the comment on possible linking problems below)

    If you want to enable/disable certain Geant4 visualisation drivers, user interfaces, or library extensions, keep in mind that the environment variables “G4VIS_BUILD_*_DRIVER”, “G4UI_BUILD_*_SESSION”, and “G4LIB_BUILD_*” are only taken into account while building the Geant4 toolkit itself, whereas “G4VIS_USE_*”, “G4UI_USE_*”, and “G4LIB_USE_*” will be evaluated while building a Geant4-dependent application like Mokka. If you try to “use” a feature in your application that has not been “built” into your specific Geant4 installation, you’ll get linker errors.

  3. External ILC software packages (strictly speaking not required, but strongly recommended):

    export LCIO=/afs/desy.de/group/it/ilcsoft/lcio/v01-10
    export GEAR=/afs/desy.de/group/it/ilcsoft/gear/v00-08
  4. MySQL client software: “mysql_config” must be reachable through your “PATH” (but it may already be available locally under “/usr/bin”)

    #export PATH=/afs/desy.de/group/it/ilcsoft/mysql/5.0.26/bin:$PATH
    #export MANPATH=/afs/desy.de/group/it/ilcsoft/mysql/5.0.26/man:$MANPATH
  5. AIDA support: “aida-config” must be reachable through your “PATH” (optional)

    #export RAIDA_HOME=/afs/desy.de/group/it/ilcsoft/v01-03/RAIDA/v01-03
    #source $RAIDA_HOME/bin/aida-setup.sh
    #export G4ANALYSIS_USE=1 # if you want to enable AIDA support
  6. You can of course choose different versions or local installations of Geant4, LCIO, Gear, MySQL, or any AIDA implementation.


Running Mokka (Not Only) at DESY


Running Mokka Without User Intervention

  1. Using appropriate commands from “/Mokka/init/” in the steering file (preferred):

    /Mokka/init/initialMacroFile macro.g4
    # executes the commands in the file “macro.g4” after startup
    /Mokka/init/BatchMode true
    # immediately quits Mokka afterwards without issuing an “Idle>” prompt
  2. Specifying an “initialMacroFile” in the steering file and exiting from the prompt with the help of a “here string” (works with “bash” and “zsh”):

    ./bin/Linux-g++/Mokka ./mokka.steer <<< exit
  3. Specifying an “initialMacroFile” in the steering file and exiting from the prompt with the help of a pipeline:

    echo exit | ./bin/Linux-g++/Mokka ./mokka.steer
  4. Providing all (or some) commands (including a trailing “exit”) with the help of a “here document”:

    ./bin/Linux-g++/Mokka ./mokka.steer << EOT
    /generator/generator ttbar.stdhep
    /run/beamOn 15862674
    exit
    EOT
  5. Providing all (or some) commands (including a trailing “exit”) via standard input redirection (with the respective commands in the file “std.in”):

    ./bin/Linux-g++/Mokka ./mokka.steer < std.in
  6. Including a trailing “exit” command in the macro file itself will not solve the problem because this will only exit the macro, but not Mokka as a whole.


Mokka Plugins


A Comment on Possible Linking Problems


Communicating With the MySQL Server


StdHep Event Record Files in Mokka


The Random Generator Seed


Customising the Geometry Database


Geometry Management


Hits in Sensitive Detectors


Writing Out the Full Information for Tracker Hits


CGA – The Common Geometry Access



This page is valid XHTML — Last change: 2010-06-08 by Adrian Vogel <adrian.vogel@desy.de>