| Getting Started with SLIC and LCDD for ILC Detector Simulation | ||
|---|---|---|
| <<< Previous | Next >>> | |
It is assumed in this section that the command slic actually refers to the system-specific location of the SLIC binary, which should be at $SLIC_BASE/bin/$G4SYSTEM/slic if you followed the previous installation instructions.
If you built the applications statically where possible, the only runtime dependency is Xerces.
Unless it is in a standard area, you will likely need to set the LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=$XERCESCROOT/lib |
If you chose to use all shared libraries for some reason, then you may need to add these additional paths.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$G4LIB/$G4SYSTEM export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$G4LIB/plists/$G4SYSTEM export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CLHEP_LIB_DIR export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LCDD_BASE/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SLIC_BASE/lib |
Of course, this requires that these variables are actually set in your environment at runtime, and this is why I prefer the static configuration. It requires much less setup at runtime. Plus, purely static binaries are much friendlier in a Grid/batch setting.
Type slic -h or just slic to see possible command line switches. SLIC's macro commands are also printed by this command.
Geant4 interactive help, i.e. help [command], will print the details about macro commands and their arguments. You can access the command tree by starting an interactive session with slic -n.
Here is a quick guide to the various ways you can run slic from the command line.
Run a single macro file.
slic [macro] |
Run several macro files.
slic -m macro1 -m macro2 ... |
Run with command options.
slic [options] |
Immediately start an interactive session at the PreInit> prompt.
slic -n |
There are two ways of running Geant4 macros from the command line using SLIC.
You can specifiy a single macro argument with no command switches, similar to the Mokka "steering file" concept.
slic macros/sdjan03_dbg.mac |
In this case, your macro needs to initialize the simulator at the appropriate place using the /run/initialize command.
Or you can specifiy any number of macros with the -m switch. These are executed in order, and each macro needs its own switch.
You are encouraged to break up control logic into different small macros, as it makes them more reusable than one big macro. For instance, you might separate commands into files for initialization, generator selection and visualization.
slic -m macros/mandatory.mac -m macros/gps.mac -m macros/vis_gl.mac |
The macro $SLIC_BASE/macros/sdjan03_dbg.mac illustrates many of the possible macro commands.
It is possible to run SLIC using only the command line without any Geant4 macro.
Here is an example of selecting a geometry file and then initializing the simulator with -z This represents the minimalist "pure command line" method of running the simulator. It simply loads the geometry, checking its validity, and exits.
slic -g examples/template.lcdd -z |
You can perform a simple batch job using only the command line. This runs the SDJan03.lcdd geometry, initializes the simulator, sets up GPS parameters and runs a single event, writing it to SDJan03_gps.slcio.
slic -g examples/sdjan03/SDJan03.lcdd -z -m macros/gps.mac -o SDJan03_gps -r 1 |
Unlike most other applications, the ordering of command line arguments matters in SLIC, because, for instance, the -z command initializes the simulator, which needs to happen in a specific order, i.e. before you try to start the visualization for that run.
There is a helper script in SLIC_BASE/scripts to run a job and create a log file.
./scripts/run-log.sh macros/sdjan03_dbg.mac |
The helper script run-log.sh loads SLIC, executes a macro, writing std::cout and std::cerr to the text file logfile, and sends the exit command once the macro has completed.
The easiest way to explain the complete command line interface is with an example.
This command sets the input geometry, selects a Geant4 physics list, sets the StdHep input file, sets the LCIO output path, sets the LCIO file output file name, executes a user macro, skips some StdHep events, initializes the simulator and then starts an interactive session.
slic \ (1) -g ./examples/sdjan03/SDJan03.lcdd \ (2) -l LHEP \ (3) -i stdhep_inputfile \ (4) -p lcio_files \ (5) -o output_file \ (6) -m user_settings.mac \ (7) -s 100 \ (8) -z \ (9) -r 1 \ (10) -n (11) |
Figure 1. Command Line Example
SLIC can also be run in a purely interactive mode using the -n switch. Available commands are the same as when running from a Geant4 macro file.
slic -n |
![]() |
You should see the Geant4 PreInit> prompt, where you can type macro commands. |
The only mandatory setting without a default is the selection of a valid LCDD input geometry file.
For instance, you can set it to the SDJan03 detector from the examples directory.
/lcdd/setURI examples/sdjan03/SDJan03.lcdd |
The default physics list is LCPhys, but you can select a different one.
/physics_list/select LHEP |
By default, SLIC uses the General Particle Source (GPS) as its input method. You can select the generation parameters using the commands in the /gps directory. Once the simulator is initialized, you cannot change the input method.
The other input method is using binary StdHep files from event generators. You can select this input method in a Geant4 macro.
/stdhep/setFile /path/to/stdhep/file |
With these mandatory actions executed, you can initialize the simulator.
/run/initialize |
An OpenGL event display can show you the detector plus hits and trajectories.
/control/execute macros/vis_gl.mac |
Now start the simulation with the beamOn command.
/run/beamOn 1 |
After the simulation has completed, you can dump a HepRep that is viewable using the WIRED event display.
/control/execute macros/heprep2.mac |
Exit once it is done.
exit |
You can look at the hit data using the dumpevent command from the LCIO distribution that you installed previously. At your system prompt, execute the following.
$LCIO/bin/dumpevent outfile.slcio 0 0 |
This command tells dumpevent to print out information from the output file outfile.slcio on run number 0 and event number 0. If you run multiple events, then the second number should be used to specify which event to dump, starting from 0 as the first event in the run.
If you have a SLAC Unix account, then you're in luck as SLIC has a common installation installed. You just need login rights to the noric-new Linux cluster plus NFS access.
From the system prompt, here is the simplest way to run the simulator using this common installation:
ssh noric-new [login] bash source /nfs/slac/g/lcd/mc/prj/scripts/prj.sh slic [arguments] |
You will probably still want to checkout SLIC in order to have a working directory with the macros, examples and scripts plus an area to write LCIO files, hepreps, etc.
| <<< Previous | Home | Next >>> |
| Package Setup and Installation | LCDD XML Format |