Sho's website

Tips on HEP computing

ROOT on MacOSX Mavericks (10.9)

ROOT with CLANG (MacOSX default)

While ago, it was quite a tough work to install ROOT on MacOS. Now, by the developers’ efforts, we can install ROOT on MacOSX with a few commands like

./configure --all --prefix=/usr/local --enable-builtin-freetype
sudo make install

ROOT with GCC (installed with Homebrew)

However, if you want to combine ROOT with C++ and FORTRAN, you will want to compile ROOT with GCC.

Procedure to install GCC on OSX is now established; you should use Homebrew. You can install GCC together with GFORTRAN by just typing brew install --enable-fortran gcc49 (for GCC version 4.9).

Yes, Homebrew is really cool. Most of my IT-engineer friends use it, not MacPorts. I recommend you to follow the processionals’ way.

Now the time to install ROOT. For my case with Mavericks + “brewed” GCC4.9+GFORTRAN, I made it done by

./configure macosx64 --all --enable-builtin-freetype \
    --with-cc=gcc --with-cxx=g++ --with-f77=gfortran --with-ld=g++ \
    --disable-cocoa --disable-vc
sudo make install

Note that I chose macosx64 since my MacBookPro is with 64bit CPU. Unfortunately vc and cocoa cannot be enabled perhaps because they severely depend on architecture. Anyway I made it done.

Also, in ROOT 6 you might encounter an error in compiling net/bonjour/src/TBonjourRegistrar.o or TBonjourResolver.o, in which case you should add --disable-bonjour to the configure options. Good luck.

libpng problem (ROOT v5.34.21 with homebrew-libpng)

See if you have a trouble with

Warning in <TASImage::GetMask>: No image
libpng warning: Application built with libpng-1.5.18 but running with 1.6.13

In my case with ROOT v5.34.21,

./configure macosx64 --all --enable-builtin-freetype \
    --with-cc=gcc --with-cxx=g++ --with-f77=gfortran --with-ld=g++ \
    --disable-cocoa --disable-vc
cd graf2d/asimage/src/libAfterImage
./configure --with-ttf \
    --with-ttf-includes="-I../../../../graf2d/freetype/src/freetype-2.3.12/include -I../../../../graf2d/freetype/src/freetype-2.3.12/include/freetype" \
    --with-afterbase=no --without-svg --disable-glx --with-builtin-ungif --with-jpeg \
    --with-jpeg-includes=/usr/local/include \
    --with-png --with-png-includes=/usr/local/include \
    --with-tiff-includes=/usr/local/include --with-builtin-png=yes
cd -
sudo make install

(Or I maybe should have added --with-builtin-png=yes in the first configure.)

(LaTeX + dvipdfmx) || PDFLaTeX

Sometimes we want a TeX file to be compiled both with latex+ dvipdfmx procedure and pdflatex procedure. For such cases, you can do as follows:

\ifpdf                                     % For pdfLaTeX
  \usepackage{hyperref,graphicx}           %   usepackage without driver option
  \DeclareGraphicsRule{*}{mps}{*}{}        %   [For feynMP] Accept metapost graphics
\else                                      % For (p)LaTeX + dvipdfmx
  \usepackage[dvipdfmx]{hyperref,graphicx} %   usepackage with driver option
  \usepackage{mediabb}                     %   [For PDF graphics] Automatic PDF-bounding box


With feynMP (or old feynMF), we can draw Feynman diagrams automatically in a TeX file. An example of TeX-preamble is as follows, which is different for LaTeX + dvipdfmx or PDFLaTeX.

%%% For latex+dvipdfmx

%%% For pdflatex
\usepackage{graphicx}   % auto-detectable

For arXiv submission

If you want to submit a paper with feynMP to arXiv, you should use pdfLaTeX. Then, what we have to do is only to execute mpost commands beforehand. The command will be:

latex hoge.tex
rm hoge.dvi
rm hoge.log
tar czvf hoge_for_arxiv.tar.gz *

For JHEP/JCAP submission

JHEP/JCAP processing system acts like the arXiv server. So what we have to do is the same as the arXiv case.