RAL GEANT4 Guide for LHCb (Dec 2001)

erectboboΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

155 εμφανίσεις

Version 1

G.N. Patrick


20.12.2001



LHCb EXPERIENCE WITH GEANT4 AT RAL



1.
Introduction


This note contains some background information on how GEANT4 has been installed and used in standalone
mode at RAL. This uses the LHCb software repository as well as

locally available libraries.



2.
Libraries


In addition to the LHCb software, a number of external libraries are needed to run GEANT4 and these have
been installed under the AFS cell:



/afs/rl.ac.uk/sw


2.1
Standard Libraries


The following standard lib
raries must be installed:

(a) CLHEP

This is the Class Library of High Energy Physics and was installed under:


/afs/rl.ac.uk/sw/contrib/lhcxx/specific/i386_linux22/CLHEP/


1.6.0


(b) STL

This is the Standard Template Library for classes like C++ container
s and strings. Originally, no compiler
provided a consistent set of classes, so Tools.h++ (Rogue Wave) was chosen for GEANT4 and an interface
provided for when STL became available. However, since GEANT4.1.0 the STL interface has become the
only supported
option. At RAL, the native STL support for the Linux gcc/egcs
-
2.91.66 compiler was used.


2.2
Visualisation Libraries


In addition to the standard libraries, a number of other packages were installed (sometimes by trial and error)
to provide visualisation

capability.


(a)

OPACS

This is a visualisation environment based on X
-
Windows and OpenGL.

Underneath this, there are a number of components found to be essential. These were installed under:


/afs/rl.ac.uk/sw/contrib/OPACS/


Co

Type manager


Glo

OpenGL implem
entation with X11


Go

graphic database over OpenGL


Ho

"o" histograms, tuples



HTMLo

HTML widget


Wo

Widget manager


W3o

www library from mosaic2.6


Xo

Widget set


Xx

Utilities




(b)

Mesa

This is a free 3D graphics library that is compatible with OpenGL and
is needed to use the OpenGL drivers
for visualisation. This was installed under:


/afs/rl.ac.uk/lhcb/Mesa/


3.2/lib



Note that in the Geant documentation you are warned not to use Mesa
-
3.1 with OpenGL.


(c)

HEPVis

HEPVis is a class library of OpenInventor obj
ects for use in particle physics experiments. This was installed
under:


/afs/rl.ac.uk/lhcb/sw/contrib/HEPVis/


v5r1p7



(d)

SoFree

This is a free implementation of Open Inventor. This was installed under:


/afs/rl.ac.uk/sw/contrib/SoFree/



(e) DAWN

Dawn is a

vectorised 3D postscript processor. This enables detailed detector geometries to be saved to an
eps file. This was installed under:


/rutherford/lhcb
-
soft1/DAWN/


dawn_3_81a



3.
Environment Variables


In order to pick up the necessary libraries, it is es
sential that the search path is set up correctly. First of all,
your current directory needs to be in the path when building/running the G4 executables:


setenv LD_LIBRARY_PATH .:${LD_LIBRARY_PATH}


In addition, the relevant G4 libraries need to be specifi
ed:


setenv LD_LIBRARY_PATH /afs/rl.ac.uk/sw/geant4/releases/specific/i386_redhat61/egcs
-
1.1.2/geant4.3.0/lib:${LD_LIBRARY_PATH}


The system (CERN versions) libraries need to be specified via


setenv LD_LIBRARY_PATH /usr/local/lib:${LD_LIBRARY_PATH}


and
the CLHEP libraries via


setenv LD_LIBRARY_PATH /afs/rl.ac.uk/sw/lhcxx/specific/i386_linux22/CLHEP/1.6.0.0/lib:${LD_LIBRARY_PATH}


The external libraries need to be made available with:


setenv LD_LIBRARY_PATH /afs/rl.ac.uk/sw/contrib/HEPVis/v5r1p7/i386_l
inux22:${LD_LIBRARY_PATH}

setenv LD_LIBRARY_PATH /afs/rl.ac.uk/lhcb/Mesa/3.2/lib:${LD_LIBRARY_PATH}

setenv LD_LIBRARY_PATH /afs/rl.ac.uk/sw/contrib/OPACS/v3/Linux:${LD_LIBRARY_PATH}


In addition, numerous environment variables need to be set up for visual
isation by the user. This is best done
within a .cshrc file or by writing a special GEANT4 environment script as shown in Figure 1.


The user customisation of the graphics can be tricky, but further information on the options can be obtained
from John Alli
son or Satoshi Tanoka.






#####################################################

# Sample .cshrc script for GEANT4 visualisation on Linux

#

# Author: G.N. Patrick

#


# Date : 10.08.2001

# Updates:

#####################################################


############## DAWN (Fukui) Renderer

setenv G4VIS_BUILD_DAWN_DRIVER 1

setenv G
4VIS_BUILD_DAWNFILE_DRIVER 1

setenv G4VIS_USE_DAWN 1

setenv G4VIS_USE_DAWNFILE 1

setenv G4DAWN_MULTI_WINDOWS 1

setenv DAWN_BSD_UNIX_DOMAIN 1

setenv DAWN_GUI_ALWAYS 1

setenv G4DAWN_HOME /rutherford/lhcb
-
soft1/DAWN/dawn_3_81a/Linux
-
g++

setenv G4DAWNFILE_VIEW
ER 1

setenv PATH ${PATH}:${G4DAWN_HOME}

setenv G4DAWNFILE_MAX_FILE_NUM 50

setenv G4DAWNFILE_DEST_DIR /home/csf/gpatrick/DAWN/temp


############## Ray Tracer

setenv G4VIS_BUILD_RAYTRACER_DRIVER 1

setenv G4VIS_USE_RAYTRACER 1


############## OPACS

#setenv G4
VIS_BUILD_OPENGLX_DRIVER 1

#setenv G4VIS_USE_OPACS 1

#setenv OPACS_VERSION v3

#setenv OPACS_SYSTEM Linux
-
gxx


############## OpenGL

setenv G4VIS_BUILD_OPENGLX_DRIVER 1

setenv G4VIS_USE_OPENGLX 1

setenv G4VIS_BUILD_OPENGLXM_DRIVER 1

setenv G4VIS_USE_OPENGLX
M 1

setenv XKEYSYMDB /usr/lib/X11/XKeysymDB

setenv OGLHOME /usr/X11



############## OpenInventor

setenv G4VIS_BUILD_OPENGLX
-
DRIVER 1

setenv G4VIS_USE_OIX 1


############## VRML

setenv G4VIS_BUILD_VRML_DRIVER 1

setenv G4VIS_USE_VRML 1

setenv G4VIS_BUILD_VR
MLFILE_DRIVER 1

setenv G4VIS_USE_VRMLFILE


Figure 1: Sample initialisation script for GEANT4 visualisation



4.
Source Code


The LHCb version (geant4.3.0) of GEANT4 is stored as a dummy package in CMT. This can be retrieved in
the usual way, but to run th
e standard examples both GEANT4 and G4Examples need to be booked out as
follows:


>cd newmycmt

>cd newmycmt

>getpack Sim/GEANT4 v3r0

>getpack Sim/G4Examples v3r0

>cd Sim/GEANT4/v3r0/cmt


>source setup.csh


>gmake




5.
Building GEANT4 "Example" Executables


The user examples are stored under the
G4Examples
sub
-
directory. These can be compiled to build
executables as follows:


>cd ~newmycmt/Sim/G4Examples/v3r0/cmt

>source setup.csh

>gmake


Note that it is necessary to edit the
"requirements
" file to specify

which of the six examples you wish to run.


This creates an executable (assuming
ExampleN01
) under

~/newmycmt/Sim/G4Examples/v3r0/i386_linux22/ExampleN01.exe


which can be run by:


>ExampleN01.exe

interactive session

or

>qsub ExampleN01.exe

PBS batch job



6.
Adapting GEANT4 Examples


The GEANT4 visualisation can be tested by building and executing the file called:




ExampleN03.exe


In this example, the default visualisation driver (eg. OGLIX) can be selected by editing the macro file:



prerunN03.mac
.


D
uring an interactive session, a number of sample macro files called



exN03Vis0.mac
-

exN03Vis6.mac


can then be executed to investigate the different graphical options.


A summer student (K. Laihem) took this work forward by adapting
ExampleN03

to constru
ct the LHCb RICH2
geometry. This was done by modifying the source files of the example, such as:



ExN07DetectorConstruction.cc


The details of this work need to be documented separately.