Slic simulations on Linux computers (SL6 and Ubuntu)

Introduction

The following page will help installing slic on a 64-bits SL6 machine, assuming that there is no development software of any kind installed. For other Linux versions, you need to adapt the instructions accordingly. The GNU gcc compiler v. 4.4.7 is assumed throughout the instructions. If you have a different version installed, you should modify them accordingly. The Netbeans IDE version currently supported is the 8.0 (either 8.0.1 and 8.0.2).

Prerequisites

Developer tools

You need the development tools and some utility software installed on your machine, to be able to build and run the software. The commands to install it (as superuser) on SL6 are :

wget -O /etc/yum.repos.d/slc6-devtoolset.repo
yum install kernel-devel-2.6.32-642.el6.x86_64
yum install devtoolset-2
yum install gcc
yum install g++
yum install cmake
yum install svn

On Ubuntu, the commands to set-up the development environment are :

sudo apt-get install build-essential
sudo apt-get install subversion

The installation of svn is needed to stay connected with the REDTOP software repository.

Netbeans and C++ plugin

  • If Netbeans 8.02 is not installed yet on your computer, follow these instructions to do so. You also need the C++ plugin module, which can be installed from within Netbeans IDE with the following menu steps:

> Tools->plugins

  • From the “Available plugins” tab, select “C/C++” and hit the button “Install“. If the configuration menu pops-up, select the gcc/g++ configuration you have already installed on your computer. Then, name the building tools appropriately: from the Netbeans IDE:

>Tools->Options and select the menu “C/C++” and the tab “Build Tools“.

  • On the left pane named “Tool collection” select the default collection (Usually: “GNU”) and push the Add button.
  • In the “Add New Tool Collection” window which pops-up fill the base directory textbox with the directory containing your gcc installation (usually: /usr/bin) and the “Tool Collection Name” textbox with: sl6-gcc4.4.7
  • Hit the OK button
  • Again, on the left pane named “Tool collection” select the collection you have just entered (namely: “sl6-gcc4.4.7”) and push the Default button.
  • Make sure that the path to the building tools in the  (C and C++ compilers, make, debug, etc.) point to the correct installation of gcc on your computer (usually: /usr/bin).
  • Then, near the “Build Host” text box (in the top part of the page) hit the button: “Edit…
  • A new pop-up windows appear named: “Build Hosts Manager“.
  • Hit the button: “Add
  • In the “Select Host” window which appear, enter: “localhost” in the “Host name” text-box.
  • Hit the next button and continue to provide the login information requested.
  • In the last window of the sequence, in the “Display name” text-box, enter: “sl6-gcc4.4.7”
  • Click OK. The “Build Hosts Manager” window now has the Host you have just entered (namely: “sl6-gcc4.4.7”)
  • Select that and hit the “Set As Default” button. Click the OK button.
  • Close the Option window by clicking the OK button. You are set up to build slic using netbeans.

The instructions for setting up the Netbeans IDE on Ubuntu are identical, except that the Build Hosts Manager and the toolset are named: “ubuntu-gcc5.4.0-Linux-x86”.

 

Installing the slic project in Netbeans

  1. Download the slic tarball from the REDTOP server and unpack it into an empty directory. The following folders will be contain the libraries yo have to load and compile in the Netbeans IDE:
  • xerces-c-3.1.4-SL6
  • CLHEP-gcc5/2.1.3.1
  • gdml_3_1_1-gcc5
  • lcdd_3_0_2-gcc5
  • zlib-gcc53
  • lcio_2_4_3-gcc5 (contains the lcio and  sio)
  • geant4_9_6_p03-gcc5 (contains the geant4 and  geant4-external libraries)
  • HepPDT-3.04.01-gcc5
  • HepMC-2.06.05-gcc5

The main slic executable project is in the slic_3_1_6-gcc5 folder under the name: /dist/Debug/GNU_4.4.7-Linux-x86/slic-d_3_1_6.

2. You need to import each project inside the Netbean IDE, before being able to build the entire package. In order to do that, use the following menu sequence from inside Netbeans:

> File->Open project

3. Browse into each of the directory and select the project.be aware that each directory contains several projects corresponding to other operating system. Please, make sure that you select the project whose name ends with SL6 (the others are for different OS).More specifically, the Netbeans project you have to open on Scientific Linux 6 are:

  • xerces-c-3.1.4-SL6
  • CLHEP-d-2_1_3_1-SL6
  • gdml-d_3_1_1-SL6
  • lcdd-d_3_0_2_1-SL6
  • zlib-d-SL6
  • lcio-d_2_4_3-SL6
  • sio-d_2_4_3-SL6
  • geant4_9_6_p03-d-SL6
  • G4_9_6_p03-external-d-SL6
  • HepPDT-d-3_04_01-SL6
  • HepMC-d-2_06_05-SL6
  • slic-d_3_1_6-SL6

4. The directory for geant4 contains two projects: geant4 9.6.3 and geant4-external. Import both into Netbeans.

5  The directory for lcio contains two projects: lcio and sio. Import both into Netbeans.

6. Select each project in the “Project” panel. Then:

right click -> clean and build

Make sure that order of building is that indicated in point 1. above. Most specifically:

  • gdml depends on XercesC
  • lcio depends on zlib
  • slic depends on all the libraries listed at 1.

If the slic project build successfully, the main executable slic-d_3_1_6 is built into the  /slic_3_1_6-gcc5/dist/Debug/GNU_4.4.7-Linux-x86 directory, while the individual libraries are built into their own /dist/Debug/\GNU_4.4.7-Linux-x86 directories.

The instructions for setting up the projects in Ubuntu are identical, except that the project names end with the word “UBUNTU” rather than SL6.

Running  slic-d_3_1_6 from the command line

A simple running script: run-SL6.sh is available in the slic_3_1_6-gcc5 directory. To run it:

  1.  Open run-SL6.sh and edit the environment variable WORKDIR_BASE so that it points to the directory where the tarbal has been unzipped
  2. Also, edit the last line of the script so that the argument points to the mac file you want to run:
    1. time $cmd $SLIC_BASE/macros/gREDTOP.mac $@
  3. Two mac files are available for testing:
    1. macros/gREDTOP.mac
    2. macros/gREDTOP_stdhep.mac

The first run geant4 internal generator while the second reads the primary generated event from a .stdhep file.  To run slic, cd into the installation directory and, then, launch the script.

For example:

cd slic_3_1_6-gcc5
./run-SL6.sh

On Ubuntu:

cd slic_3_1_6-gcc5
./run-UB16.sh

If the run completes successfully, a .lcio file is produced in the /LCIO directory.

Running/debugging  slic-d_3_1_6 from the Netbeans’s IDE

In order to run and/or debug slic from within the Netbeans IDE, you first need to set-up the environment variable to make sure that the executable can access the shared libraries. in order to do that:

  1.  In the project pane of the IDE, select  the slic-d_3_1_6-SL6 project. Then: right click-> Set  as Main Project;
  2. In the project pane of the IDE, select  the slic-d_3_1_6-SL6 project. Then: right click-> Properties
  3. A window pops-up named: Project properties – slic-d_3_1_6-SL6. On the left pane, named “Categories” select “Run”
  4. On the right panel, under the General menu, make sure that  “Run Command” textbox is filled with a command that slic understand. For example: “${OUTPUT_PATH}” ./macros/gREDTOP_stdhep.mac (where the argument is the name of a .mac macro file for geant4). In the example above, such macro is:  ./macros/gREDTOP_stdhep.mac
  5. On the same window, edit the “Run Directory” textbox so it points to the folder where the slic project is installed on your computer. In the present distribution, that direcory is set to /media/sf_linux/slic_3_1_6-gcc5/.
  6. On the same window, edit the “Environnement” text-box so that all the environnment variable correspond to your slic installation. In the distribution, the slic installation is in the /media/sf_linux directory. replace that with your path.
  7. On the left pane, named “Categories” select “Debug”.  Make sure that the  “Debug Commandtextbox on the right pane is filled with the same command  specified for Run Commandtextbox of the Run category (see point 4. above). In the present example, that would be  “${OUTPUT_PATH}” ./macros/gREDTOP_stdhep.mac
  8. In the same pane,  make sure that   the  “Working dir” textbox points to the same directory as for the Run tab, namely directory containing the slic project. In the present example, that would be: “/media/sf_linux/slic_3_1_6-gcc5/. “
  9. Click OK. The Project properties window will disappear.

To debug the slic program, first set a breakpoint at the line in the source code where you want the execution to stop. Then from the netbeans IDE, select the Menu sequence:
> Debug -> Debug main project

Alternatively, hit F5 or the pink and green icon of the IDE toolbar.

To run slic without debugging,  from the netbeans IDE, select the Menu sequence:
> Run-> Run main project

Alternatively, hit F6 or the green arrow icon of the IDE toolbar. In this case, the progral will run without stopping at the breakpoints you have set.

 

Troubleshooting

Of course, a number of things can go wrong during the setup. The most obvious being that the compiling toolset is not found on you computer. There are usually two solutions to that:

  1. Create and rename the toolset used to build slic in Netbeans, using the Tools->Options->C/C++ and making sure that there is a toolset named GNU_4.4.7
  2. Alternatively, right click on the projects open in Netbeans, and right-click->Properties. In the left pane, select “Build” and on the right pane, select the toolset you want to use in the textbox: “Tool collection“. You have to do that for each project you are building (namely, for all twelve projects that slic is comprised of.

If you choose the second method (more cumbersome) all you builds will be in a different subdirectory of ./dist/Debug (reflecting the name of your own toolset).  Therefore, you have to change accordingly the environment the script you are using to launch the main program.

 

For other troubleshooting, please, contact: gatto_at_na.infn.it