Set Up Root And Geant4 On Ubuntu

  • Uploaded by: Jessica Chiang
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Set Up Root And Geant4 On Ubuntu as PDF for free.

More details

  • Words: 1,429
  • Pages: 12
Jessica Chiang

Set up Geant and Root Development Environment On 64 bits Ubuntu 8.0.4 AMD 64 bits machine

0.1) Install Ubuntu 8.0.4 Install Ubuntu 8.0.4 and complete basic setup such as networking.

0.2) Install Necessary Package Installed the following packages using "apt-get install" command. • • • • • • • • • • • • • • • • • • • • • • • • • • •

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 .tar.gz #cd #./configure –-prefix=~/install/root --enable-mysql --enable-opengl --enable-python # make # make install

Notes on tar options used above • -z : unzip the file first • -x : extract the files from the tarball • -v : "verbose" (i.e tar tells you what files it's extracting) • -p : preserves dates, permissions of the original files • -f : use the file in question (if you don't specify this, tar just sort of sits around doing nothing) Add the following lines to your ~/.bashrc file 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 To build CLHEP, you need gcc-3.2.3 or higher. Obtain CLHEP source package from http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/ clhep.html. I used version 2.0.3.1 ( http://proj-clhep.web.cern.ch/projclhep/DISTRIBUTION/distributions/clhep-2.0.3.1.tgz) 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-.tar cd /CLHEP ./configure –-prefix=/home/username/dev/CLHEP make make install

Add the following lines to /home/jessica/.bashrc file export CLHEP_BASE_DIR=/home/username/dev/CLHEP export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CLHEP_BASE_DIR/lib

3) Set up Geant4 Obtain the source package from Geant4 site http://geant4.web.cern.ch/geant4/. I used Geant4.8.2.p01 (http://geant4.web.cern.ch/geant4/support/source/geant4.8.2.p01.tar.gz). 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.tar.gz cd geant mkdir data

./Configure -build

Extra actions: Add /home/jessica/SetUpZip/geant4.8.2.p01/data Entered the CLHEP_BASE_DIR CLHEP_BASE_DIR: /home/jessica/mt-sys/CLHEP 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 • the path to your CLHEP install (from step 2) • whether to install certain libraries NOT OPTION NAME

VALUE

G4UI_NONE

NO

G4UI_BUILD_XAW

YES

G4UI_USE_XM

YES

G4UI_BUILD_QT

NO

G4VIS_NONE

NO

G4VIS_USE_OPENGLX

YES

G4VIS_USE_OPENGLXM

YES

G4VIS_USE_DAWN

NO

G4VIS_USE_OIX

NO

G4VIS_USE_RAYTRACERX

YES

G4VIS_USE_VRML

NO

G4VIS_BUILD_OPENGLQT

NO

G4LIB_BUILD_GDML

NO

G4LIB_BUILD_G3TOG4

NO

G4LIB_BUILD_ZLIB

YES

G4ANALYSIS_USE (NO)

NO

NOTE: Instead of libX11-devel, use libX11-dev 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.

4) Install MySQL Databaser Server

sudo apt-get install mysql-server Optionally, for remote access, install PHPMYADMIN, a web-based MySQL query browser, as followed: sudo apt-get install apache2 sudo apt-get install php5 libapache2-mod-php5 sudo apt-get install phpmyadmin 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 cp /etc/apache2/sites-available/default /etc/apache2/sites-available/phpmyadmin sudo vi /etc/apache2/sites-available/phpmyadmin

Then search for "DocumentRoot" in "/etc/apache2/sites/available/phpmyadmin", when found, change that line from ... DocumentRoot /var/www ... ... to be consistent with the phpmyadmin site path: ... DocumentRoot /usr/share/phpmyadmin Ser... ... ...

Then disable default site and enable phpmyadmin site as followed: sudo a2dissite default sudo a2ensite phpmyadmin sudo /etc/init.d/apache2 restart

Now you should be able to browse phpmyadmin site by opening http://. Also, to have Apache2 recognize a host name, instead of just IP, sudo vi /etc/apache2/apache2.conf

Then add the following line at the top of apache2.conf. ServerName server-name Restart Apache2 HTTP server sudo /etc/init.d/apache2 restart

Now you should be able to browse phpmyadmin site by opening http://server-name. 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 "skipnetworking" 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.

5) Set up G-MT Specific Components 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

5.1) Schema and Data in MySQL Database

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 content of build/release.sh is as followed: #!/bin/sh CPPFLAGS="-O0 -Wall -fPIC" ./configure --prefix=${HOME} --enable-mtbucket && make && echo "Type \"make install\" to 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.

5) Set up Analysis Engine (mtbucket)

Set SM0_TUBE_DATA_FILE point to ~/mt-sys/smDAQ/data/sm0-tube-info.dat and SM1_TUBE_DATA_FILE to ~/mt-sys/smDAQ/data/sm1-tube-info.dat 1. Set environment variables 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 For showing tubes export MTB_SHOW_TUBES=1 2. Build analysis engine cd ~/mt-sys svn --username USERNAME co svn+ssh://<muon_ip>/scratch/svn/mt/mtbucket mtbucket cd mtbucket ./build.sh

6) Install VTKViewer (Optional) First we need to install VTK (The Visualization Toolkit) from source. Install cmake if not already installed: sudo apt-get install cmake

Go to VTK site (http://www.vtk.org/index.php) and download VTK source tar ball, vtk-.tar.gz, VTK data tar ball, vtkdata-.tar.gz, VTK MPeg encoder, vtkmpeg2encode.tar.gz. Extract the all three tar ball: cd ~/SetUpZip tar xvf vtk-.tar.gz tar xvf vtkdata-.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 . You would see the selection as followed: CMAKE_BACKWARDS_COMPATIBILITY 2.4 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

To build Visual Tool Kit SDK from source, 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

Press [c] to configure and then [g] to generate makefile. 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

7) Set up Python Development Environment The list of python modules to install (use apt-get) • • • • • • • • • • •

python2.5 python2.5-dev python-glade2 python-gtk2 python-gtkmvc python-imaging python-mysqldb python-paramiko python-reportlab python-vtk python-vte

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.

Related Documents


More Documents from "Jessica Chiang"