ROOT-based tools for FLUKA, PHITS and MCNP Monte Carlo codes
Project homepage: https://github.com/kbat/mc-tools

FLUKA
- Emacs syntax highlighting script for FLUKA input files (screenshot).
- fluka2root: tool that converts FLUKA binary output into ROOT format. It merges the data files using standard FLUKA tools, and then converts the merged files into a single ROOT file. To understand how to use it, try runing a standard example
$FLUPRO/flutil/rfluka $FLUPRO/exmixed.inp
and then execute fluka2root exmixed.inp. A more detailed tutorial is available in the wiki section.
Attention FLUKA.CERN users: these tools are designed for the official FLUKA distribution, but they sholud also work with the files generated by your fork. However, you must install the official FLUKA version, as it includes essential libraries that are not available elsewhere. Any assistance in improving mc-tools compatibility with FLUKA.CERN is greately appreciated. See the Contacts section below.
MСNР
- Emacs syntax highlighting script for MCNP input files.
- An implementation of application programming interface (API) to
read data from mctal files. It allows to convert mctal
files into any format. Known issue: tallies with perturbation
records are not supported.
- mctal2root
script converts mctal to ROOT format. The
tallies are saved as
THnSparse
histograms. The same script can convert mctal to XML format via TXMLFile.
- mctal2txt
script shows an example how to convert an mctal file into an easily parsable ASCII file.
- WSSA file converters.
- ssw2txt:
converts WSSA phase space files into plain text. The comments in
the script explain how to derive additional information (like
particle type and surface crossed) from the WSSA records.
- ssw2root:
converts WSSA phase space files into a ROOT ntuple. The list of
aliases defined in the tree can be printed by the
TTree::GetListOfAliases()::Print() method. In particular, this
list shows how to get particle type and surface number. This
macro
gives several simple examples how to analyse SSW files with
ROOT.
- vol.py:
a tool to facilitate input of volume/importance/probability values
for all cells in geometry. To be used with cards like area, vol, imp, pd, dxc etc.
For example, in order to set the volume of cell 5 to 3.14, cell 7 to 2.71 in a geometry of 10 cells total, run
python $MCTOOLS/mctools/mcnp/vol.py -card vol -ntotal 10 -values "5 3.14 7 2.71" -default j
This generates the required data card: vol 4j 3.1 j 2.7 3j.
- mcnpview:
a wrapper around
mcnp ip which allows to return to the selected
geometry view in subsequent calls of the viewer. Find a detailed
tutorial in the wiki
section.
PHITS
- Emacs syntax highlighting script for PHITS input files.
- ANGEL to ROOT converter (converts the PHITS output into ROOT).
- A script
rotate3dshow.py
which allows to animate the output of the t-3dshow tally. It
runs PHITS to generate many images, so one can get a rotating
video of geometry setup. Example:
snowman.gif
(should be viewed with an image viewer which supports GIF
animation). A simplified version of this script with a detailed
manual can be downloaded from the PHITS website:
http://phits.jaea.go.jp/examples.html
- A Python module to calculate atomic fractions of isotopes in a
mixture for the given volume fractions of materials. Some examples
can be found in
mixtures.py.
- ace2root, a converter from ACE (a compact ENDF) to ROOT formats. It loops through all available cross-sections in an ACE file and saves them as TGraph objects. We use this simple script to visualise ENDF cross sections. Requires the PyNE toolkit to be installed.
- hplot, an advanced TH3 histogram plotter. We use it to visualise data maps and superimpose them with Monte Carlo geometry. A detailed manual can be generted with the
-h argument.
Requirements
- The ROOT-related scripts (file names end with
*2root), require ROOT to be compiled with Python 3 support.
- To verify whether Python support in ROOT is set up correctly, run
import ROOT
in the Python 3 shell. If no error messages appear, the setup is correct. If errors occur, ensure that:
root-config --features includes pyroot. To fix it, refer to the ROOT installation documentation.
- Your
$PYTHONPATH environment variable contains the $ROOTSYS/lib directory. To fix it, execute
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH (and add it in your shell configuration).
hplot requires the Boost libraries and ROOT to be compiled with at least C++17 standard.
ace2root needs the PyNE toolkit.
fluka-stats needs the uncertainties and tqdm packages.
- If the GNU parallel tool is
installed then the FLUKA merge and ROOT converter tools called by
the
fluka2root script will use all available cores which makes
them run faster.
- Linux and MacOS are supported. We have never tried to use these
tools on Windows.
Installation
- Get the source code:
- either
git clone https://github.com/kbat/mc-tools.git
- or download and uncompress
https://github.com/kbat/mc-tools/archive/master.zip
- Set the variable MCTOOLS to the folder where you have installed the
code:
export MCTOOLS=/path/to/mc-tools
(specify the folder containing README.md)
- Add the
$MCTOOLS folder into $PYTHONPATH:
export PYTHONPATH=$MCTOOLS:$PYTHONPATH
- Add the
$MCTOOLS/bin folder into your $PATH:
export PATH=$MCTOOLS/bin:$PATH
Konstantin Batkov, batkov [аt] gmail.com
Many thanks to
- Nicolò Borghi, for carefully implementing all my ideas in the mctal2root converter.
- Kazuyoshi Furutaka, for adding the pip installer and helping with the PHITS tools debugging.
- Esben & Troels, for the initial version of the SSW converter.
- Stuart Ansell, for endless discussions and amazing ideas.
See also
https://github.com/SAnsell/CombLayer
https://github.com/lanl/mcnptools
http://pyne.io
https://github.com/Lindt8/DCHAIN-Tools
评论