nptool components are compiled and installed using the CMake build system, so be sure to have a working CMake installation before starting.

The nptool core libraries, ROOT 6 should be installed. If ROOT is not installed the compilation can proceed but most functionality will not be available

In order to run simulation, a recent installation of Geant4 is needed. If you want to use GDML format in nptool, Geant4 should be installed with GDML support.

Getting the code

Using git

The recommended method to obtain the source code is to use git. This is an easy way to access the last version of the code. First make sure you have git installed. If not, use your package manager to get it. Then go to the directory where you want to install the nptool package and do:

$ git clone

This will create the nptool folder with the latest version of the nptool base framework. This framework contain all the base application and functionality, and will allow to install and managed the requested plugins (detectors, libraries,…).


Preparing the build

We recommand to use an nptool out of source build. You can choose where to put the build and install directory, in this manual we assume you will create them inside the nptool folder. We then run cmake to generate the build file

$ cd nptool
$ mkdir build,install
$ cmake -B build -DCMAKE_INSTALL_PREFIX=install ./

If you are using google-ninja, you can add the -GNinja flag to the cmake command.

Compilation and installation

We can now run the compilation and installation of the framework, using the appropriate command with your generator:

$ make -C build install
$ ninja -C build install

The framework is now compiled and installed inside the install directory.

Environment setup

By sourcing a the file all the necessary environment variable will be created.

$ source install/

This command could be add to your bashrc:

source <path_to_nptool>/nptool/install/

You now need to create an environment folder where nptool can install the requested plugin, in this case we will create the default environment:

$ nptool --new-env default

This will create the new folder ~/.local/nptool/default and populate it with the necessary folder and files. All installation of new plugin will happen in this folder.