linux下面安装geant4,Ubuntu 12.04 下Geant4的安装

系统Ubuntu 12.04 32位版,gcc 4.6,Geant 4.9.5p1,CLHEP

2.1.2.2

参考

Installing Geant4 Release 4.9.4.p02 on Linux

http://geant4.slac.stanford.edu/tutorial/installation/Geant4.9.4.p02/Linux/Geant4_9_4_p02_Linux_Installation.htm#_What_are_the

准备编译环境:

sudo apt-get install build-essential cmake

cmake版本2.8.7

1)安装CLHEP

由于新版CLHEP采用cmake方式编译,原教程不适用,参考cmake/INSTALL安装方法如下:

mkdir ~/build

cd ~/build

cmake /home/tyllr/CLHEP/2.1.2.2/CLHEP

make

make test

sudo make install

在/usr/local/lib下得到编译好的多个库,成功!

2)安装Geant4

添加低能电磁作用数据包,data files for low

energyelectromagnetic processes

解压到Geant4目录新建的 data 文件夹下。

tyllr@tyllr-MXC061:~/geant4_9_5_p01$ mkdir ~/geant4build

tyllr@tyllr-MXC061:~/geant4_9_5_p01$ cd ~/geant4build/

tyllr@tyllr-MXC061:~/geant4build$ cmake ../geant4_9_5_p01

-- The C compiler identification is GNU

-- The CXX compiler identification is GNU

-- Check for working C compiler: /usr/bin/gcc

-- Check for working C compiler: /usr/bin/gcc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- setting default compiler flags for CXX

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Could NOT find EXPAT (missing: EXPAT_LIBRARY

EXPAT_INCLUDE_DIR)

-- The following Geant4 features are enabled:

-- Configuring done

-- Generating done

-- Build files have been written to: /home/tyllr/geant4build

找不到 EXPAT,尝试:

sudo apt-get install libexpat-dev

cmake ../geant4_9_5_p01

结果如下:

-- setting default compiler flags for CXX

-- Found EXPAT: /usr/lib/i386-linux-gnu/libexpat.so

-- The following Geant4 features are enabled:

GEANT4_USE_SYSTEM_EXPAT: Using system install of EXPAT

-- Configuring done

-- Generating done

-- Build files have been written to: /home/tyllr/geant4build

tyllr@tyllr-MXC061:~/geant4build$ make

-j2

我是core 2

duo的cpu,所以用双核选项。编译很漫长,喝杯咖啡慢慢等。。。

完成后 sudo make

install,结束安装。

3)测试例子

mkdir ~/g4examplebuild

cd ~/g4examplebuild

cmake ../geant4_9_5_p01/examples/novice

make

运行可执行文件:

tyllr@tyllr-MXC061:~/g4examplebuild$ cd N01

tyllr@tyllr-MXC061:~/g4examplebuild/N01$ ./exampleN01

*************************************************************

Geant4 version Name:

geant4-09-05-patch-01 (20-March-2012)

Copyright : Geant4 Collaboration

Reference : NIM A 506 (2003), 250-303

WWW : http://cern.ch/geant4

*************************************************************

========= Table of registered couples

==============================

Index :

0 used in the geometry :

Yes recalculation needed : No

Material : ArgonGas

Range

cuts : gamma 1

mm e- 1

mm e+ 1 mm proton 1 mm

Energy thresholds : gamma -1

MeV e- -1

MeV e+ -1 MeV proton -1 MeV

Region(s) which use this couple :

DefaultRegionForTheWorldIndex :

1 used in the geometry :

Yes recalculation needed : No

Material : Aluminum

Range

cuts : gamma 1

mm e- 1

mm e+ 1 mm proton 1 mm

Energy thresholds : gamma -1

MeV e- -1

MeV e+ -1 MeV proton -1 MeV

Region(s) which use this couple :

DefaultRegionForTheWorldIndex :

2 used in the geometry :

Yes recalculation needed : No

Material : Lead

Range

cuts : gamma 1

mm e- 1

mm e+ 1 mm proton 1 mm

Energy thresholds : gamma -1

MeV e- -1

MeV e+ -1 MeV proton -1 MeV

Region(s) which use this couple :

DefaultRegionForTheWorld====================================================================

Start Run processing.

=====================================

G4EventManager::ProcessOneEvent() =====================================

G4PrimaryTransformer::PrimaryVertex

(-2000(mm),0(mm),0(mm),0(nsec))

1 primaries are passed from G4EventTransformer.

!!!!!!! Now start processing an event !!!!!!!

*********************************************************************************************************

* G4Track Information: Particle

= geantino, Track ID =

1, Parent ID = 0

*********************************************************************************************************

Step# X(mm) Y(mm) Z(mm)

KinE(MeV) dE(MeV) StepLeng

TrackLeng NextVolume ProcName

0 -2e+03 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值