- Notifications
You must be signed in to change notification settings - Fork18
NPTool, a ROOT/Geant4 based framework for Nuclear Physics
License
adrien-matta/nptool
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
nptool has moved away. The repository has been transferred to the gitlab in2p3 service for more consistency. The entire repository has been cloned, you can now use the repository at :https://gitlab.in2p3.fr/np/nptool
for more information, contact Adrien Matta atmatta@lpccaen.in2p3.fr
NPTool, which stands for Nuclear Physics Tool, is an open source and freelydistributed data analysis and Monte Carlo simulation package for low-energynuclear physics experiments. The NPTool package aims to offer an unifiedframework for preparing and analysing complex experiments, making an efficientuse of Geant4 and ROOT toolkits. If you wish to contribute, contact AdrienMATTA atmatta@lpccaen.in2p3.fr
- nptool website : Find the latest informations on the framework
- nptool manual : Find a more detail manual on how to install and run the framework
- Getting the code
- Using git
- Downloading from Git Hub
- Setup
- Requirements
- Preparing the build
- Building NPLib
- Building NPSimulation
- Benchmarks and Examples
- Benchmarks
- Examples
- Tricks
The recommended method to obtain the source code is to use git. This is aneasy way to access the last version of the code. First make sure you have gitinstalled. If not, use your package manager to get it. Then go to the directorywhere you want to install the NPTool package and do:
$ git clone https://github.com/adrien-matta/nptool
This will create the nptool folder with the latest version of NPTool.
Alternatively, you can browse the following pagehttps://github.com/adrien-matta/nptool,and click the Download ZIP button on the right side of the page. Then, unzipthe 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 (testedwith version 9.6 and 10.1) is needed. If you want to use GDML support inNPTool, Geant4 should be installed with GDML support.
To set the needed environment variables, PATH and LD_LIBRARY_PATH, andaliases, source the following script doing:
source <pathname>/nptool/nptool.sh
where<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 .tcshrc file.
NPLib is the core of the NPTool package, holding most of the actual code. It ismade of a collection of stand alone C++ classes that can be used in programsand macros.
First, go to the NPLib folder by using the command:
$ npl
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 wishto limit the number of detectors to be compiled, specify the detector foldername (respecting the case). Note that more than one detector can be specified.
All detectors compiled:
$ cmake ./
OR some detectors compiled:
$ cmake ./ -DETLIST="DetFolder1 DetFolder2"
Then, the whole NPLib can be compiled withn threads using:
$ make -jn install
If you wish to recompile in order to get support for more detectors, do:
$ nptool-cleaner$ cmake ./ -DETLIST="DetFolder1 DetFolder2 ..."$ make -jn install
If you have google ninja build installed you can alternatively ask CMake togenerate the ninja.build file:
$ cmake -GNinja ./$ ninja install
Compilation using Ninja is faster than using make.
This part of the package relies on Geant4 to perform Monte Carlo simulation.NPLib needs first to be compiled and configured correctly before NPSimulationcan be compiled. The compilation is done as follow:
$ nps$ cmake ./$ make -jn install
This will produce thenpsimulation executable. For a detailed list of theavailable input flags and their meaning, run the following command:
$ npsimulation -h
You need to download additional files to be able to run the benchmarks andthe examples. In the $NPTOOL directory, do the following:
$ git clone https://github.com/adrien-matta/NPData
Benchmarks play an important role to check the installation or upgrade integrityof the NPTool package. They are also useful for comparing CPU performances ondifferent computer platforms. So far two benchmarks are included in the NPToolpackage. The first one (cats) analyses experimental data from a beam trackerdetector using thenpanalysis facility, while the second one (gaspard) runsa silicon array simulation using thenpsimulation facility and display somebasics control spectra. Each benchmark produces figures that can be compared tothe reference figures provided in NPTool. These two benchmarks cover all the corefunctionalities of NPTool's framework.
The first benchmark can be run with the following commands:
$ cd $NPTOOL/Benchmarks/cats$ npanalysis -D benchmark_cats.detector -C calibration.txt -R RunToTreat.txt -O benchmark_cats
For the second benchmark do:
$ cd $NPTOOL/Benchmarks/gaspard$ npsimulation -D benchmark_gaspard.detector -E 132Sndp_benchmark.reaction -O benchmark_gaspard -B batch.mac
In both cases, the results can be displayed and compared to reference resultsusing the following command:
$ root -l ShowResult.C
With respect to benchmarks, examples deal with more complex analysis caseswhere several detectors are present. In this context, physical informationresulting from the combination of information from several detectors can becalculated.
As a standardized test case, you can run Example1 by the following command:
$ npsimulation -D Example1.detector -E Example1.reaction -O Example1
This will open thenpsimulation GUI (if you are using Qt) or the promptterminal. In either case events can be generated using the followingcommand:
> run/beamOn/ 10000> exit
This will simulate the11Li(d,3He)10He->8He+n+nreaction and produce an output ROOT file located in $NPTOOL/Outputs/Simulation/Example1.root.
TheExample1.detector
file located in $NPTOOL/Inputs/DetectorConfigurationand theExample1.reaction
file located in $NPTOOL/Inputs/EventGenerator areself explanatory thanks to the use of understandable tokens.
The simulated file can be analysed using the following commands:
$ npp Example1$ cmake ./$ make -jn$ npanalysis -R RunToTreat.txt -O Example1
This will produce an analysed tree located in the $NPTOOL/Outputs/Analysis/Example1.root file.Note that since the input files needed bynpsimulation are stored in theROOT file,npanalysis use these automatically as inputs.
The results can be displayed using the command:
$ root -l ShowResult.C
You should be able to see the light particle identification, the light particle kinematical line and the associated excitation energy spectrum fitted by a gaussian.
The Example1 input files and NPAnalysis project are simple basis that can be used to start doing your own simulations.
- npsimulation andnpanalysis facilities can be run from any directory.
- npanalysis looks in the current directory for an analysis library(libNPAnalysis) to load and use. If not present, the analysis is limitedto build the PhysicsTree.
- To perform a quick analysis of the last MOnte Carlo simulation, do:
npanalysis --last-sim
Any additional flag can be used
- npsimulation can be used in batch mode (with no UI) if the user providesa Geant4 macro file specified with the -B flag
npsimulation -D Example1.detector -E Example1.reaction -B path/to/macro.mac -O FileName
About
NPTool, a ROOT/Geant4 based framework for Nuclear Physics