The SLIC full simulator program requires the setup of 8 different software packages, not counting the required build tools.
This guide provides a step-by-step walkthrough covering package and tool installation.
It presumes nothing except a working Windows machine (2000, XP) with internet access. Therefore, you may only need to use parts of this installation guide if you have some of the external dependencies already installed.
Standalone Windows Distribution
If you do not want to build SLIC yourself, there is a Windows executable available for download.
The current version is available as a ZIP file containing a static binary and the required DLLs.
Download the ZIP file using your browser and unzip the contents to C:. You should see the directory C:\slic_win32.
Test out the binary by running it in a console window.
- Start -> Run -> cmd.
- Press ENTER.
- Go to the SLIC directory.
C:\ cd slic_win32
- Execute SLIC from the command line.
slic
The Xerces and Cygwin DLLs are also included so that the package is standalone.
Preliminary Setup for Installation
Cygwin
The Cygwin Linux emulation package is a prerequisite for building on Windows.
Unfortunately, the support for native WIN32 using project files is lacking.
These are brief instructions for installing the necessary Cygwin packages.
- Download the Cygwin setup program.
- Double-click on it and click Next.
- Select Install from Internet and click Next.
- Enter your preferred Root Directory and click Next.
- Enter your preferred Local Package Directory, which can be the same as the Root Directory, and then click Next.
- Select Direct Connection and click Next.
- Select a site from the Available Download Sites. Servers inside your country will probably be fastest. I use ftp://ftp.sunsite.utk.edu.
- Click Next.
- In the Cygwin Setup - Select Packages window, you need to make sure that the following tools are selected by clicking in the corresponding box under the New column until you see a version number.
- Required packages.
- Devel -> cvs
- Devel -> gcc-core
- Devel -> gcc-g++
- Devel -> make
- Base -> gzip
- Base -> tar
- Tool for downloading package tarballs and zip files.
- Web -> wget
- Required packages.
- Click Next after you have selected the packages.
- Cygwin will now automatically download and install all the selected packages. It might take awhile, so now is the time to go get some coffee.
- If desired, select Create icon on Desktop or Add icon to Start Menu, and click Finish.
If you need additional information on this installation process, Norman Graf has more detailed Cygwin installation instructions.
Testing the Cygwin Command Line Tools
- Select Start -> Programs -> Cygwin -> Cygwin Bash Shell
- Check that the following commands do not result in a command not found message.
cvs gcc g++ tar wget make
- If a command was not found, rerun the Cygwin setup to select the missing package, making sure to select Keep on the Cygwin Setup - Select Packages screen so that all the packages are not reinstalled.
Throughout this guide, I assume you are using bash or at least another sh-compatible shell. I take no responsibility if you decide to use csh, tcsh, et al.
Work Area
The SLIC package and its dependencies will be installed into a common work area.
- From the Cygwin shell, create a work directory and go into it.
cd /cygdrive/c mkdir sim cd sim
- Create the file setup.sh with the following contents.
#!/bin/sh export sim_work=/cygdrive/c/sim
- Source the script to setup the work dir.
source setup.sh
The $sim_work/setup.sh script will henceforth be referred to as setup.sh. At the end, it will have all of the environment variables required by SLIC and its dependencies. Throughout the guide, any time a line is added to setup.sh, you should also execute this line in your current bash shell. Probably the easiest way to do this is by adding to the script first and then (re)sourcing it.
Java
Java is required for LCIO installation.
- Install an appropriate JRE from http://java.sun.com/ with a minimum version of 1.4.2.
- In your setup.sh, set JAVA_HOME and JDK_HOME to the Java installation area.
export JAVA_HOME=/cygdrive/c/java/jdk1.4.2/ export JDK_HOME=${JAVA_HOME} export PATH=$JDK_HOME:$JDK_HOME/bin
- To test the Java installation, try to run Java.
java
The above JAVA_HOME directory is an example only. You need to replace it with the correct path to your JDK.
Full installation of LCIO including Java libraries actually requires a Java JDK. The C++ libraries should only require a working java command in order to run ant.
Proceed to Package Installation!
You are now ready to install the simulation packages.
The same Cygwin window should be used throughout the installation process in order to preserve the environment variables.
Package Installations
CLHEP
CLHEP has installation instructions for version 1.9 and up. But you should not need them to setup the package.
- Create a working directory for CLHEP and go into it.
mkdir clhep cd clhep
- Download the CLHEP tarball.
wget http://cern.ch/clhep/clhep-1.9.2.0.tgz
- Unzip to your work directory.
tar -zxvf clhep-1.9.2.0.tgz
- Change to CLHEP directory.
cd 1.9.2.0/CLHEP
- Configure the build. (This took 15-20 minutes on my machine.)
./configure --prefix=`cd ../..; pwd` --disable-shared
- Build the library and install it. (Also takes a long time!)
make make install
- Add the following to setup.sh
export CLHEP_BASE_DIR=$sim_work/clhep
Now that the CLHEP dependency is satisfied, you should be able to install Geant4.
Geant4
Geant4 is probably the most difficult application to install of SLIC's dependencies, because there are a lot of options, it takes a long time, and it requires several different make commands. I will describe a minimal installation procedure with support for built-in UI and visualization drivers. You can always update the libraries later if you decide to change these settings.
The default Geant4 library settings for WIN32 are granular and static. You may choose other settings, but this could require changes in installation settings "down the line" that I may not mention.
- Return to the work dir, create a Geant4 subdir and go into it.
cd $sim_work mkdir geant4 cd geant4
- Download the Geant4 tarball.
wget http://geant4.cern.ch/geant4/source/source/geant4.7.0.p01.tar.gz
- Unzip it.
tar -zxvf geant4.7.0.p01.tar.gz
- Setting the following variables in setup.sh will allow you to compile without running Geant4's ./Configure script.
G4INSTALL=${sim_wrk}/geant4/geant4.7.0.p01 G4SYSTEM=WIN32-g++
- Go into the Geant4 base dir.
cd geant4.7.0.p01
- Build the libraries, which will be placed at $G4INSTALL/lib/WIN32-g++. (This could take up to a few hours depending on your machine.)
make
- Build the physics list libraries. These will go into $G4INSTALL/lib/plists/WIN32-g++.
cd ../physics_lists/hadronic make
- Install the headers into $G4INSTALL/include.
make includes
Hopefully, Geant4 has been installed successfully, and you don't have too many more gray hairs.
LCPhys
SLIC requires a special physics list written by Dennis Wright for Linear Collider physics.
- Go back to the work dir.
cd $sim_wrk
- Checkout the physics list from CVS.
cvs -d :pserver:anonymous@cvs.freehep.org:/cvs/lcd checkout LCPhys
- Assuming that the environment from the Geant4 installation is still in place, you can build this like any other physics list, and the library should be installed into $G4INSTALL/lib/plists/WIN32-g++.
cd LCPhys make
- Set the LCPhys variable in setup.sh.
LCPHYS_BASE=$sim_wrk/LCPhys
LCIO
LCIO provides binary output capabilities.
Installation requires a working Java runtime for ant support.
LCIO has a very nice manual with a whole section on installation. Thanks, Frank!
I will still walk you through the basic procedure.
- Go back to the work dir.
cd $sim_wrk
- Checkout LCIO from CVS.
cvs -d :pserver:anonymous@cvs.freehep.org:/cvs/lcio checkout lcio
- Add these lines to your setup.sh.
export LCIO=${sim_wrk}/lcio export PATH=$LCIO/tools:$LCIO/bin:$PATH
- Build the libraries using the bundled aid and ant tools.
ant aid cpp
Xerces-C++
- Go back to the work dir, create a subdir for Xerces-C++, and go into it.
cd $sim_wrk mkdir xercesc cd xercesc
- Download the Xerces tarball.
wget http://www.apache.org/dist/xml/xerces-c/xerces-c-src_2_6_0.tar.gz
- Unzip the tarball.
tar -zxvf xerces-c-src_2_6_0.tar.gz
- Set XERCESCROOT for the build in your environment, only.
export XERCESCROOT=${sim_work}/xerces-c-src_2_6_0
- Go into the Xerces-C++ build area.
cd xerces-c-src_2_6_0/src/xercesc
- Configure the build.
./runConfigure -pcygwin -cgcc -xg++ \ -minmem -nsocket -tnative -rpthread \ -P `cd ../../..; pwd`
- Build and install it.
make make install
- In setup.sh, set XERCESCROOT to the installation area and add the DLL location the PATH.
export XERCESCROOT=${sim_work}/xercesc export PATH=$XERCESCROOT/bin:$PATH
GDML
GDML's CVS is not directly accessible from the command line, but a tarball is available through a WWW interface.
- Download a snapshot of the current CVS head using this link in your browser: http://simu.cvs.cern.ch/cgi-bin/simu.cgi/simu/GDML2/GDML2.tar.gz?tarball=1.
- Save the tarball to sim_wrk, which should be C:\sim.
- Unzip the tarball.
tar -zxvf GDML2.tar.gz
- Change into the CPPGDML directory.
cd GDML2/CPPGDML
- Set GDML_BASE and PLATFORM in setup.sh.
export GDML_BASE=${sim_work}/GDML2/CPPGDML export PLATFORM=cygwin_g++
- Configure the build.
./configure --enable-geant4-vis --enable-geant4-ui --with-geant4-libtype=granular --with-platform=cygwin_g++
- Build it.
make
LCDD
- Go to the work dir and checkout LCDD.
cd ${sim_work} cvs -d CVSROOT=:pserver:anonymous@cvs.freehep.org:/cvs/lcd checkout lcdd
- Go into the LCDD dir.
cd lcdd
- Configure the build.
./configure
- Build the library.
make
- Set the LCDD_BASE variable in setup.sh.
export LCDD_BASE=${sim_work}/lcdd
SLIC
Finally, you are ready to install the simulation "hub" package. After this, you will have a fully-featured Geant4 simulator on your Windows machine.
- Go to the work dir and checkout SLIC.
cd ${sim_work} cvs -d CVSROOT=:pserver:anonymous@cvs.freehep.org:/cvs/lcd checkout slic
- Go into the SLIC dir.
cd slic
- Set the SLIC_BASE variable in setup.sh.
export SLIC_BASE=${sim_work}/slic
- Configure the build.
./configure
- Build the binary.
make all
If the build completes successfully, you should see SLIC's usage statement from the test run.
Running SLIC after Installation
When you want to run later in a Cygwin shell, $XERCESCROOT/bin should be in the PATH, so that Windows can find the DLL at runtime. Since the other applications were linked-in statically, this should be the only setup requirement at runtime.
- Start -> Cygwin -> Cygwin Bash Shell
- Add Xerces-C++ bin to the path.
export PATH=/cygdrive/c/sim/xerces/bin:$PATH
- Go to SLIC directory.
cd /cygdrive/c/sim/slic
- Run the executable.
bin/WIN32-g++/slic [options]
If you receive an error message about a missing DLL cygxerces-c26.dll, then make sure that the PATH is setup correctly and Xerces-C++ was properly installed.
Final Setup Script
The final version of setup.sh should look something like this.
#!/bin/sh # 1. work area export sim_work=/cygdrive/c/work/nsim # 2. java export JAVA_HOME=/cygdrive/c/Java/jdk1.4.2 export JDK_HOME=${JAVA_HOME} # 3. clhep installation area export CLHEP_BASE_DIR=${sim_work}/clhep # 4. geant4 export G4INSTALL=${sim_work}/geant4/geant4.7.0.p01 export G4SYSTEM=WIN32-g++ # 5. LCPhys export LCPHYS_BASE=${sim_work}/LCPhys # 6. LCIO export LCIO=${sim_work}/lcio export PATH=$LCIO/tools:$LCIO/bin:$PATH # 7. Xerces-C++ installation area export XERCESCROOT=${sim_work}/xercesc export PATH=$XERCESCROOT/bin:$PATH # 8. GDML export GDML_BASE=${sim_work}/GDML2/CPPGDML export PLATFORM=cygwin_g++ # 9. LCDD export LCDD_BASE=${sim_work}/lcdd # 10. SLIC export SLIC_BASE=${sim_work}/slic
The above should be sufficient to "bootstrap" any future (re)builds with the following caveats.
The G4WORKDIR directory should be set to LCDD_BASE when building LCDD and SLIC_BASE for SLIC, or your libs and binaries may end up in strange places.
When rebuilding Xerces-C++, which you will probably not need to do once you get it working, XERCESCROOT needs to be set back to the Xerces-C++ source area rather than the installation base.
Done!
That's it.
Happy simulating!
See links in the next section for more information.
If you think this guide could be improved in any way, then please contact the author