Typical time and dependencies
It should take typically about 10-20 minutes for a new user to get the framework up and running, given that root and geant4 are already installed (see here for help if you do not have those tool). You do not need geant4 installed if you want to only perform analysis (e.g. for online analysis).
If you encounter issues during the install process, please contact the support team.
Getting the code
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 https://gitlab.in2p3.fr/np/nptool
This will create the nptool folder with the latest version of nptool.
Downloading from Gitlab
Alternatively, you can browse the following page https://gitlab.in2p3.fr/np/nptool, and click the Download ZIP button on the right side of the page. Then, unzip the archive at the desire location
nptool components are compiled and installed using the CMake build system, so be sure to have a working CMake installation before starting.
In order to compile NPLib, the nptool core libraries, ROOT 5 (tested with 5.34) or 6 should be installed. This is sufficient to compile NPLib and any analysis project.
In order to compile NPSimulation, a recent installation of Geant4 is needed. If you want to use GDML format in nptool, Geant4 should be installed with GDML support.
Preparing the build
To set the needed environment variables, PATH and LD_LIBRARY_PATH, and aliases, source the following script doing:
$ source <pathname>/nptool/nptool.sh
<pathname> is the location where you unpacked the nptool package. Then, restart your terminal.
You should typically add the previous command line to your .profile, .bashrc or similar file. An alternative nptool.csh file existe for csh user.
NPLib is the core of the nptool package, holding most of the actual code. It is made of a collection of stand alone C++ classes that can be used in programs and macros.
First, go to the NPLib folder by using the command:
In order to prepare the compilation CMake must be run to generate the Makefile. If no arguments are given to CMake, all detectors will be compiled. If you wish to limit the number of detectors to be compiled, specify the detector folder name (respecting the case). Note that more than one detector can be specified.
All detectors compiled:
$ cmake ./
OR some detectors compiled:
$ cmake ./ -DNPTOOL_DETLIST="DetFolder1 DetFolder2"
Then, the whole NPLib can be compiled with n threads using:
$ make -jn install
If you wish to recompile in order to get support for more detectors, do:
$ nptool-cleaner $ cmake ./ -NPTOOL_DETLIST="DetFolder1 DetFolder2 ..." $ make -jn install
If you have google ninja build installed you can alternatively ask CMake to generate the ninja.build file:
$ cmake -GNinja ./ $ ninja install
Compilation using Ninja is faster than using make and is highly recommended.
In order for Root to correctly load the nptool headers and library, and so be able to use nptool objects within interactive root macro, you need to add a couple of line to the ~/.rootlogon.C file. You may or may note already have such a file, in any case, a bash scripts is there to either create or modify ~/.rootlogon.C. To run it, simply use the following commands:
$ npl $ ./scripts/RootLogon.sh
You can then test that everything is working correctly by doing:
$ root > NPL::Reaction r("28Si(d,p)29Si@280") > r.GetKinematicLine3()->Draw("ac")
This should display a (d,p) kinematic line and no error message display.
This part of the package relies on Geant4 to perform Monte Carlo simulation. NPLib needs first to be compiled and configured correctly before NPSimulation can be compiled. The compilation is done as follow:
$ nps $ cmake ./ $ make -jn install
This will produce the npsimulation executable. For a detailed list of the available input flags and their meaning, run the following command:
$ npsimulation -h