The LHCb software includes several distributions of Root, among which you can find the one needed when submitting a Root job through Ganga. Without going into details on dealing with CMT (documentation), the following example should help with getting things the way you want:
with the LHCb software on, start by creating a new CMT project from your top directory:
cmt create_project lhcbRoot v1r0 cmtuser
where lhcbRoot is the project name, v1r0 is the version and cmtuser is a path. You should now get something like:
% ls cmtuser/lhcbRoot/v1r0/
cmt/
% ls cmtuser/lhcbRoot/v1r0/cmt/
project.cmt
edit the project.cmt file and add the lines:
use LCGCMT v*
this is telling CMT that you need the latest version of the package LCGCMT. Now create a requirements at the same place. In here, you are going to specify that from the lcg software area, get the environment for Root i.e. the variables ROOTSYS, PATH and LD_LIBRARY_PATH will point to the requested version. In this example, we want the latest version and some other packages found in the lcg software area:
package lhcbRoot
version v1r0
use ROOT v* LCG_Interfaces
use Reflex v* LCG_Interfaces -no_auto_imports
use gfal v* LCG_Interfaces
use dcache_client v* LCG_Interfaces
use GSL v* LCG_Interfaces
Now you can do cmt config and source setup.sh{csh}. The selected Root should now be ready for you.
NOTE for the system manager: unfortunately, because of the way CMT works, the environment variable CMTPROJECTPATH has to point to "/Disk/lochnagar/lhcb/lhcb-soft/lcg/externals". Therefore, I had to modify the local-setup.sh{csh} (+ the Condor version) scripts to add this definition. However, this breaks the setup for any other package like DaVinci and Ganga environment. The solution was to add a line in the corresponding scripts to "unset" this variable before any of the configuration steps.
Using root in Ganga
Root is controlled with ganga in three separate ways.
The version of root used by Ganga to do merging etc.
Using a precompiled executable
Using a root macro with precompiled code in a shared object.
Depending what you want to do, you may need to change your ROOTSYS variables. Locally versions of root can be found in /opt/root, /Disk/lochnagar0/lhcb/lhcb-soft/lcg/external/root and /Disk/lochnagar0/general/root. /opt/ is ifp-controlled. lcg/external/ are the versions of root which are available with DaVinci, general/root are compiled by Barney/Greig which we can essentially play around with.
The type which root at the command line in ganga to see what version of root you are using in the subshells of ganga. Type config.ROOT to see which version of root Ganga is using as standard. To ensure merging works correctly a single version of root should be chosen, the same version for the creation and merging of files. Edit your .bashrc and your .gangarc to give the same version of root. Locally this means setting the config.ROOT.path variable to point to an install of root. This is equal to your ROOTSYS variable in your .bashrc.
You may have compiled root code. Probably, though, it still needs some shared objects from Root. Ensure you have compiled and run your code with the same version by checking that your gangarc and bashrc agree with what you compiled. Within ganga, precompiled code can be run in the executable, although you will need to use a shell script wrapper to set ROOTSYS before running your code.
The Root() application provides a nice way of working locally and on the grid with shared objects. To run on the GRID the version of Root you choose must correspond to a version available with a DaVinci release.
To wrap your code in Ganga-compatible shared objects, there is a nice tutorial here: HowToRootJobsSharedObject
The standard makefile with this tutorial may not work for you. Instead you can start with Greig's makefile
The gangarc vaiables to look out for are uder ROOT in your gangarc.
Better colour schemes
The default colour scheme in Root is terrible. The following 2 lines fix this and should probably be in (the very beginning of) every Root macro that plots something:
gROOT->SetStyle("Plain")
gStyle->SetPalette(1)
The horrible default colour scheme for a ColZ plot:
What the above 2 lines give you. Now the ColZ plot has sensible colours: