How to visualize the geometry seen by Geant4 in Gauss


It is possible to run Gauss by using the interactive visualization of Geant4. This may be useful to check if the geometry has been transmitted correctly to Geant4 as well as to check overlap. A description on how to check overlaps with Gauss can be found as How to check Overlaps seen by Geant4 in Gauss.

Here you will find a description, on which type of visualization of the LHCb geometry as seen by GEANT4 can be used in Gauss and how to do so.

As the default Gauss environment does not include neither the GEANT4 UI nor its visualization it is necessary to set it up with the following:

SetupProject Gauss v41r0 --build-env
getpack Sim/Gauss v41r0
SetupProject --tag_add=Vis Gauss v41r0

To start Gauss and access the interactive GEANT4 visualization there is a special steering option file called GaussVis.opts. Start Gauss issuing the the following instruction: (it is better to do it with a particle gun and use the latest DDDB and SIMCONDDB tags ):

cd Sim/Gauss/options
cmt run $GAUSSOPTS/ $GAUSSOPTS/ $DECFILESROOT/options/52210010.opts  $LBPGUNSROOT/options/ --post-option='importOptions("$GAUSSOPTS/GaussVis.opts")'

Once Gauss (and GEANT4) is initialized, the following GEANT4 prompt will appear on the console:

GeomClosed >

The visualization can be performed in Gauss with two of the drivers available in GEANT4: DAWNFILE or OpenGL (1). The geometry view is directly obtained from GEANT4 with the use of OpenGL, while the use of DAWNFILE results in a file containing the geometrical information that is then rendered by another application that reads in the file, although the two work togheter and it is possible to switch between the Geant4 command line and DAWN. At the moment the DAWNFILE driver in Gauss works only on SLC3 linux platforms due to unavailability of the graphical libraries, whereas OpenGL can be used with on both the SLC3 and SLC4 platforms.

Use of the DAWNFILE driver

Two different application packages can be used with the DAWNFILE driver, the Fukui Renderer DAWN (Drawer for Academic WritiNgs) (2) or the visual intersection debugger DAVID (DAwns Visual Intersection Debugger) (3) , that is described in How to check Overlaps seen by Geant4 in Gauss.

The size of the LHCb complete detector description is too big to be contained in the DAWNFILE produced, for this reason the whole downstream detectors (Calorimeters, Muon System and beam pipe in this region) are switched off in GaussVis.opts. You can customized the file to select the detector you want, keeping in mind the limitation in size for the DAWNFILE. Each time you draw a new picture a new file will be created, so be careful how much available space you have!

DAWN Display

To start the DAWN Display, enter the following commands :

GeomClosed  > /vis/open DAWNFILE (open the driver)
GeomClosed  > /vis/drawVolume
GeomClosed  > /vis/viewer/flush (open the window of the visual driver)

A window appears (see below) where you can set the z coordinate at the value of the position of the subdetector you are interested in, for example to check overlaps, and press OK.


Window controlling the DAWN Event Display.

Graphic files with the .prim file format are produced in the current directory (job file). As the .prim files are large, few minutes can be used by DAWN to process during which you will see messages on the console such as :

***** 250  primitive are processed
***** 500  primitive are processed
***** 750  primitive are processed
***** 1000  primitive are processed
***** 1250  primitive are processed

Finally, you get the picture of the geometry :

LHCb complete geometry for theta=90 and phi=180 viewed with the DAWN Event Display.

The created .prim file contains a full 3D description of the detector and visualisation attributes. Please note that by default the .prim file is created in a directory "../job" location, failure to have this in place beforehand means the command will fail. The detector geometry can be re-visualized outside Gauss in the current directory by using the command :

dawn g4_00.prim

Detector tree structure "visualization" and information

In GEANT4, the names of the structures of the sub-detectors are not the same as the ones of the logical volumes in the LHCb software. In order to focuse on the analysis of a precise subdetector, it can be useful to execute the following command that gives the list of the names in GEANT4 of all the subdetectors structures :


You obtain a list like this:


Then, you can add the address to the command that draw the volume and you obtain only the visualization of the the desired substructures :

/vis/drawVolume /dd/Structure/LHCb/AfterMagnetRegion/T

T Stations geometry for theta=90 and phi=180 viewed with the DAWN Event Display.

You can also change the level to display details :

/vis/ASCIITree/verbose n

n>=10 : Print all the physical volumes
n<10 : does not print daughters of repeated logical volumes and does not repeat replicas

For level of detail add :
n>=0 : prints physical volume name.
n>=1 : prints logical volume name (and names of sensitive detector and readout geometry, if any).
n>=2 : prints solid name and type.
n>=3 : volume and density.
n>=5 : daughter-subtracted volume and mass.

And in the summary at the end of printing :
n>=4 : daughter-included mass of top physical volume(s) in scene to depth specified.

Use of the OpenGL driver

You can also use the OpenGL (4) driver to draw the geometry. Its disadvantage is that the DAVID intersection debugger cannot be used with it. To open the driver and obtain the drawing, insert the following commands:

GeomClosed > /vis/open OGLSXm
GeomClosed > /vis/viewer/set/viewpointThetaPhi 90 90 (set view angles)
GeomClosed > /vis/drawVolume /dd/Structure/LHCb/BeforeMagnetRegion/Velo

And you obtain the following window :

Velo geometry for theta=90 and phi=90 viewed with the OpenGL driver.

Different options can be chosen for the view angles :

/vis/viewer/set/viewpointThetaPhi  0  90 (X-Y plane)
/vis/viewer/set/viewpointThetaPhi 90  90 (X-Z plane)
/vis/viewer/set/viewpointThetaPhi 90 180 (Y-Z plane)

Note that the detection in GEANT4 is tougher than the one in the LHCb software. Round-off errors coming from volumes that lie tightly up against the outside of their mother car be detected. To avoid this, a rather generous tolerance of 0.1microm is used by default, but can be readjusted by :

geometry/test/tolerance <new-value>

To quit GEANT4, insert the following command :

GeomClosed > exit

References :

(1) Visualization section in the Getting Started chapter of the Geant4 User Guide
  Geant4 Visualization Tutorial

(2) The DAWN driver section in the Visualization chapter of the Geant4 User Guide
  G4 Dawn tutorial
  DAWN web page

(3) DAVID web page

(4) The OpenGl driver section in the Visualization chapter of the Geant4 User Guide
  G4 OpenGL tutorial

-- GeraldineConti and GloriaCorti - 17 Sep 2007 -- Last modified on 10 Oct 2007

Topic attachments
I Attachment History Action Size Date Who Comment
PNGtiff DAVID_LHCb.tiff r2 r1 manage 4.1 K 2007-10-09 - 19:47 GloriaCorti In reality lhcb_90_180
GIFgif DAWN1.gif r1 manage 15.4 K 2007-09-19 - 13:44 GeraldineConti Dawn panel
GIFgif LHCb_90_180.gif r1 manage 4.1 K 2007-10-09 - 19:52 GloriaCorti LHCb view
GIFgif LHCb_90_180_bis.gif r1 manage 10.4 K 2009-02-14 - 11:03 MarcoPappagallo  
GIFgif OpenGL_Velo.gif r1 manage 8.8 K 2007-10-09 - 19:53 GloriaCorti View of Velo
GIFgif OpenGL_Velo_bis.gif r1 manage 15.3 K 2009-02-14 - 11:32 MarcoPappagallo  
GIFgif Tstation_90_180.gif r2 r1 manage 8.8 K 2009-02-14 - 11:09 MarcoPappagallo  
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r18 - 2012-08-13 - MatthewReid
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb/FAQ All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback