Sunday, January 31, 2010

Setting Up CMS Tools on My Mac

I finally decided to install some CMS tools on my Mac today, and was surprised at how easy it was. With one download of the Fireworks event display package, you get not only Fireworks, but also ROOT and FWLite. An informal page on the TWiki gives instructions for setting up your Mac for FWLite using this Fireworks installation. What I did was to include the basic content of the root.sh script he creates in my .bashrc on my Mac:

export CMSSW_BASE=/Users/jeff/Work/cmsShow34
export ROOTSYS=$CMSSW_BASE/external/root
export LD_LIBRARY_PATH=${CMSSW_BASE}:${CMSSW_BASE}/external/lib:${ROOTSYS}/lib
export DYLD_LIBRARY_PATH=${CMSSW_BASE}:${CMSSW_BASE}/external/lib:${ROOTSYS}/lib
export PATH=${ROOTSYS}/bin:$PATH


Next, I wanted to get PyROOT (the Python interface to ROOT) working. Looking through the documentation on PyROOT, I was able to get the basic information needed, but it took a little fiddling. I added the necessary lines to my .bashrc,

export LD_LIBRARY_PATH=$(addto $LD_LIBRARY_PATH $ROOTSYS/lib)
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH

but there was a mismatch of Python versions that gave me an error message. The solution was to force the use of Python 2.5.x by calling python2.5 rather than python, which can even be specified in the "shebang" of a script: #!/usr/bin/env python2.5.