Basic Root Info
Reference Material
Installing Root On Your Local Machine
The current version of Root (correct on 25th Feb 2011) is 5.28.00. You can download the source code by doing (from somewhere sensible, e.g. your Applications folder):
svn co http://root.cern.ch/svn/root/tags/v5-28-00a root
cd root
Doing
./configure --help
will give you the information about what different configurations you can use. Unless you know what you're doing, just use the standard configuration by doing:
./configure
N.B. If you want to use Roofit (e.g. for limit setting) you will need to use the --enable-roofit option instead (
./configure --enable-roofit
). Then all you have to do is compile:
make
Now go and make a nice cup of tea while you wait for it to finish.
Starting a Root Session
Every time you log on you'll need to source the Root setup script. This only works if you do it from the directory where Root is installed.
On Your Local Machine
cd <path/to/the/place/where/I/put/root>
. bin/thisroot.sh
cd -
If you're as lazy as me and can't be bother to do all of that whenever you log on, you might want to put this into a little script and then add alias rootSetup='source <path/to/myRootSetupScript.sh'.
On Lxplus
The Root setup script will be automatically sourced if you setup an Athena release. If you don't want to setup Athena then you'll need to setup Root separately by doing the following:
. /afs/cern.ch/sw/lcg/contrib/gcc/4.3/i686-slc5-gcc43-opt/setup.sh
cd /afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00/i686-slc5-gcc43-opt/root
. bin/thisroot.sh
cd -
To start a Root session all you then have to do is type
root
from wherever you like.
MakeClass will give you a skeleton piece of code that you can use as a starting point for an ntuple/D3PD analysis. Once you have started a Root session (see above), you need to do:
f = new TFile("<path-to>myNtupleOrD3PD.root");
t = (TTree*)(f->Get(""));
t -> MakeClass();
This will generate the
.C and .h files you need.
Plotting
* RatioPlotExample.C: Example code for drawing a ratio runner under your histogram
-- KatharineLeney - 25-Feb-2011