Geant4 Monte Carlo simulation

From Hchkswiki
Jump to: navigation, search

How-to Documents

First, install Geant4 in your machine. Please refer cern webpage (http://geant4.web.cern.ch/geant4/) in order to install Geant4.

Source Files

The latest version of HKS/HES Geant4 source file and magnetic field data which is calculated by TOSCA is put on the SVN repository. Checkout these files (here I assume your directory name as "~/E05115").

$ls  ~/E05115 
HES/  HKS/  param/

"HES" ("HKS") contains HES (HKS) Geant4 source files and "param" contains magnetic field maps by TOSCA.

Compile and Run

Under the "HES" directory, you can find following directories and files.

$ls  HES
GNUmakefile  HES.cc  gen/  include/  run/  src/

If you have already set up your environment variables, just type "make" under the "HES" directory.

$ cd  HES
$ make

If compilation finished successfully, you will find executable "HES" under $(G4WORKDIR)/bin/ directory.

$ ls  $(G4WORKDIR)/bin/
HES*

Now you can execute the simulation. But before execution, You should do three things.

First, add $(G4WORKDIR)/bin/ directory to $PATH.

Secondly, make a symbolic link to the "~/E05115/param" directory from "run" directory.

$ cd  run
$ ln  -s  ~/E05115/param

Finally, make the "ana" directory under the "HES" directory.

$ cd  ~/E05115/HES/
$ mkdir  ana

Then, go to the "run" directory and type following.

$ cd  ~/E05115/HES/run
$ HES  macro/gun.mac  input/sample.in

If everything goes well, you can get data file under the "ana" directory.

$ ls ~/E05115/HES/ana/
sample.root

This is the basic procedure of compilation and execution. If you have some problem about compilation, ask experts.