Skip to content

Installation and run

Paola Ferrario edited this page Apr 12, 2023 · 6 revisions

Getting the source

The petalosim source can be downloaded from the git repository:

git clone [email protected]/petalo-project/petalosim.git

This command will create a folder names petalosim. To get a particular tag, just enter the petalosim folder and type:

git checkout name_of_tag

External dependencies

petalosim depends on the following third-party libraries:

  • Geant4
  • nexus
  • hdf5
  • NEST

Geant4

petalosim is based on Geant4. To install it, see the Geant4 page. The recommended version is geant4.11.0. A petalosim tag >= v1_00_00 is needed to run with this Geant4 release. A summary of the installation instructions can be found here.

Once Geant4 is installed, make sure to have the G4INSTALL environment variable pointing to the Geant4 installation directory.

Download the data files from the Geant4 web page and place them in the $G4INSTALL/share/Geant4-11.0.0/data directory (you have to create it), if it wasn't done during the compilation step.

Now do

cd $G4INSTALL/bin; source geant4.sh

This script will do the following:

  1. Add G4INSTALL/bin path to the PATH environment variable.

  2. Assign the path of the PhotonEvaporation data file to the G4LEVELGAMMADATA environment variable.

  3. Assign the path of the G4EMLOW data file to the G4LEDATA environment variable.

  4. Assign the path of the RadioactiveDecay data file to the G4RADIOACTIVEDATA environment variable.

  5. Assign the path of the G4ENSDFSTATE data file to the G4ENSDFSTATEDATA environment variable.

  6. Assign the path of the G4SAIDDATA data file to the G4SAIDXSDATA environment variable.

  7. Assign the path of the G4PARTICLEXS data file to the G4PARTICLEXSDATA environment variable.

  8. Assign the path of the G4NDL data file to the G4NEUTRONHPDATA environment variable.

  9. Assign the path of the G4INCL data file to the G4INCLDATA environment variable.

Finally, add the G4INSTALL/lib path to the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS) variable.

NEXUS

petalosim depends on NEXUS for basic class management. You can download NEXUS from here. Once NEXUS is installed, make sure to have

  1. The nexus bin directory in your PATH variable.
  2. The nexus lib directory in your LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS systems) variable.

hdf5

petalosim writes its output in hdf5 files, therefore depends on the hdf5 library. You can download it from here.

After the installation, you need to have the following environment variables defined:

  1. hdf5 installation directory in your HDF5_DIR variable.
  2. hdf5 lib directory in your HDF5_LIB variable.
  3. hdf5 include directory in your HDF5_INC variable.
  4. hdf5 lib directory added to the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH for macOS) variable.

NEST

The NEST code simulates charge and scintillation yields in noble gases. You can download the version adapted to petalosim doing:

git clone [email protected]:petalo-project/nest.git

and changing to the petalo branch:

git checkout petalo

Once you have installed NEST, make sure to have the following environment variables defined:

  1. NEST include directory in your NEST_INC variable.
  2. NEST library directory (lib or lib64) in your NEST_LIB variable.

Installation

petalosim uses SCons for building. Detailed information on SCons can be found here. To install SCons on your computer:

  1. You must have Python3 installed on your system.
  2. Download the latest stable version of SCons and uncompress the file.
  3. Move to the resulting folder and type (you may need super-user privileges for this to work):
python setup.py install

To build petalosim just type: scons inside the top-level directory. The building script (SConstruct) tries to locate the headers and libraries of all dependencies using pkg-config scripts, the environment variables previously defined or examining common system-paths (/usr/local, for instance). Alternatively to defining environment variables, it is possible to pass the locations of the third-party libraries via command line, in the following way:

scons GEANT4_BINDIR=/path/to/Geant4/bin-directory ROOT_BINDIR=/path/to/root/bin-directory HDF5_DIR=/path/to/hdf5/installation-directory

You can speed up the build using scons -jN where N is the number of available cores.

To silence excessive verbosity you can use scons -s.

Running petalosim

In order to run petalosim, be sure to execute the setup script, placed in the scripts folder.

  • If you use a macOS more recent than Mojave (version >= 10.15), you should execute:
source /path/to/scripts/petalosim_setup.zsh
  • For the rest of operative systems:
source /path/to/scripts/petalosim_setup.sh

It will set the PETALODIR variable to the top level directory of the installation.

To run petalosim, just type

bin/petalo -b -n numb_of_events init_macro_filename
Clone this wiki locally