Set Up Root and Geant4 On Ubuntu
Set Up Root and Geant4 On Ubuntu
Set Up Root and Geant4 On Ubuntu
• libX11-dev
• g++
• libxft-dev
• libxpm-dev
• libxt-dev
• freeglut3
• freeglut3-dev
• libglut3
• libglut3-dev
• libmotif3
• libmotif-dev
• x11proto-print-dev
• libxaw7-dev
• libmudflap0
• libmudflap0-dev
• po-debconf
• intltool-debian
• subversion
• libusb-dev
• libboost-dev
• libmysql++-dev
• autoconf
• automake
• libtool
•
libc6-dev-i386
• graphviz and graphviz-dev for GraphViz software
• libcxx
• libxerces28
• libxerces28-dev
• cppunit-dev
1) Set up Root
Obtain the latest Root from http://root.cern.ch. I used Root version 5.18.
Unzip the Root package to the location of choice, say ~/mt-sys. After unzipping, there will be a
“root” directory in ~/dev. We will come back in the later step to set up root configuration.
To build Root from source, download the source ball, unzip it, then change to the source
directory
#cd ~/SetUpZip
#tar -zxvpf <root_src>.tar.gz
#cd <root_src>
#./configure –-prefix=~/install/root --enable-mysql --enable-opengl --enable-python
# make
# make install
CURCWD=`pwd`
cd ~/dev/root
source bin/thisroot.sh
cd $CURCWD
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ROOTSYS}/lib/root
export PATH=$ROOTSYS/bin:$PATH
2) Set up CLHEP
Save the tar ball in a directory of choice, say ~/install. Then unzip and then do configure, make,
and make install in the unzipped directory. Note that by default, the CLHEP is installed in /usr/
local. I set the installation path to /home/username/dev/CLHEP by doing “./configure –-prefix=/
home/username/dev/CLHEP”.
cd ~/SetUpZip
tar -zxvpf clhep-<version>.tar
cd <version>/CLHEP
./configure –-prefix=/home/username/dev/CLHEP
make
make install
export CLHEP_BASE_DIR=/home/username/dev/CLHEP
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CLHEP_BASE_DIR/lib
3) Set up Geant4
Unzip the tar ball to your directory of choice, say ~/geant4. Unzip and then change directory to
~/geant4/geant4.8.2.p01 to run the “Configure” script.
cd ~/SetUpZip
tar -zxvpf geant<version>.tar.gz
cd geant<version>
mkdir data
./Configure -build
Extra actions:
Add /home/jessica/SetUpZip/geant4.8.2.p01/data
You will be asked a series of question and most of them can be answered with a default answer.
The questions you need to answer carefully are
Once geant4 has been installed, you need to create a script named “env.sh” to set the Geant4
environment variables. To create “env.sh” automatically:
cd ~/SetUpZip/geant4.8.2.p01
./Configure
cp: overwrite `./env.csh` (enter y)
cp: overwrite `./env.sh`
Two files will be created: “env.sh” and “env.csh”. Next step is to modify the .bashrc script so
that this environment variables for CLHEP, Root, and Geant4 will all be set up correctly. I added
the following line to ~/.bashrc:
source ~/SetUpZip/geant4.8.2.p01/env.sh
export G4WORKDIR=~/g4work
Log out and log back in to your account, then a slew of log messages from running "env.sh"
should be printed to the screen.
Optionally, for remote access, install PHPMYADMIN, a web-based MySQL query browser, as
followed:
You wi
phpmyadmin is installed under /var/www, and we need to set phpmyadmin as the default
document root in Apache2. To do so
sudo vi /etc/apache2/apache2.conf
To enabled remote access to the MySQL Database server, read this nixCraft page.
But the essence is to add a line to my.cnf (in Ubuntu, /etc/mysql/my.cnf), and make sure "skip-
networking" line is commented out.
#skip-networking
ServerName server-name or IP
Also, to set the firewall so the server can accept remote connections, follow this Ubuntu doc.
First create a local sandbox and check out the trunk from the svn repository as followed:
cd
mkdir sandbox
cd sandbox
svn co svn+ssh://subversion.dsccorp.com/home/svn/repository/g-mt g-mt
cd ~/sandbox/trunk/DataService/db
svn update
./init-db.sh
./resetdb.sh
5.2) Build and Install smDAQ
cd ~/sandbox/g-mt/trunk/smDAQ/src/main/c++
svn update
build/bucket.sh
make install
The build script specifies that smDAQ will be installed in ${HOME} or ~/. The smDAQ
installation will install "bin" and "lib" in ${HOME} according to the release.sh script content
shown above. To change the installation location, change the "--prefix=${HOME}" to desirable
location such as "--prefix=${HOME}/smdaq-test".
If initiating from the flat file, set the SMDAQ_TUBE_FILE envrionment variable to the flat file
path, or make sure that there is ${HOME}/lib/sm0-tube-positions.dat.
For smDAQ:
export SMDAQ_TUBE_FILE=/home/jessica/sandbox/lmt-trunk/smDAQ/data/sm0-tube-info-scint.dat
For mtbucket:
export SM0_TUBE_DATA_FILE=/home/jessica/sandbox/lmt-trunk/smDAQ/data/
sm0-tube-info-scint-sm-positions.dat
export SM1_TUBE_DATA_FILE=/home/jessica/sandbox/lmt-trunk/smDAQ/data/
sm1-tube-info-scint-sm-positions.dat
export SM2_TUBE_DATA_FILE=/home/jessica/sandbox/lmt-trunk/smDAQ/data/
sm2-tube-info-scint-sm-positions.dat
export SM3_TUBE_DATA_FILE=/home/jessica/sandbox/lmt-trunk/smDAQ/data/
sm3-tube-info-scint-sm-positions.dat
./build.sh
cd ~/SetUpZip
tar xvf vtk-<version>.tar.gz
tar xvf vtkdata-<version>.tar.gz
tar xvf vtkmpeg2encode.tar.gz
cd ~/mt-sys
First build and install vtkmpeg2encode. NOTE: Please build vtkmpeg2encode BEFORE building
VTK, so that the VTK's configure script can detect vtkmpeg2encode, which is required for a
successful VTK source build.
cd vtkmpeg2encode
ccmake .
Leave it unchanged and enter [c] to configure. Then you would see:
CMAKE_BUILD_TYPE *
CMAKE_INSTAL_PREFIX */usr/local
EXECUTABLE_OUTPUT_PATH /home/jessica/mt-sys/vtk/bin
LIBRARY_OUTPUT_PATH /home/jessica/mt-sys/vtk/lib
CMAKE_BACKWARDS_COMPATIBILITY 2.4
Toggle 't' to turn on the Advanced mode and add "-fPIC" at both CMAKE_CXX_FLAGS and
CMAKE_C_FLAGS flags
...
CMAKE_CXX_FLAGS -fPIC
...
CMAKE_C_FLAGS -fPIC
Then press 'c' to configure, then 'g' to generate make file. After makefile is generated, make
vtkmpeg2encode.
make
cd ~/SetUpZip
cd VTK
ccmake .
BUILD_EXAMPLES ON
BUILD_SHARED_LIBS ON
vtkMPEG2Encode_INCLUDE_PATH /home/jessica/SetUpZip/vtkmpeg2encode
vtkMPEG2Encode_LIBRARIES /home/jessica/SetUpZip/vtkmpeg2encode/libvtkMPEG2Encode.a
make
Press 'g' to generate and exit. Then "make" to compile. I've added a VOXViewer folder under
VTK/Examples, modified VTK/Examples/CMakeLists.txt to include VOXViewer in the build.
Therefore, when the build completes, there should be a "voxview" binary in VTK/bin. The
voxview needs to read from a vox file, which is located in VTK/Examples/VOXViewer. To run
voxviewer and read from a vox file:
#bin/voxview Examples/VOXViewer/mutom_vansim_Wobj_medreg_1m.vox
cd ${TRUNK}/vtkviewer
ccmake .
Move blinking box to the VTK_DIR line, then hit enter. Enter the path to the VTK directory.
Then hit enter, and click 'g' to regenerate the build script.
make
I am using Netbean6.5 and for most of my back-end python development and Glade Interface
Designer for front-end development. I also like IDLE because it provides python session and can
easily indent and dedent but occasionally it crashes.