ROOT
For analysing Monte Carlo data in ROOT, see Monte Carlo and Smearing.
ROOT
ROOT is an object-oriented data analysis framework written in C++. It was developed at CERN to allow efficient large-scale data analysis.
Configuration
The EIC group performs most of its analysis using ROOT, and maintains its own installation, documented here. All EIC ROOT code is compiled and tested against this version of ROOT, so it is recommended that this is the version used whenever using EIC ROOT libraries or scripts. This version is automatically selected (via the environment variable ROOTSYS) if the environment is configured by eic_cshrc.csh. Users may find it useful to run the script
$EICDIRECTORY/etc/rootlogon_eic.C
when starting the EIC installation of ROOT. This script loads some commonly used libraries, and adds some EIC directories to the ROOT include path, simplifying compiling of analysis scripts. It is automatically loaded at startup unless the system-wide configuration is overridden by a custom .rootrc in your home directory.
If you already run a ROOT logon script and wish to incorporate the EIC logon script you can add the following to your existing script:
gROOT->Macro("$EICDIRECTORY/etc/rootlogon_eic.C");
or if you only wish to load it when on an EIC node:
if(TString(gSystem->Getenv("HOST")).BeginsWith("eic")) { gROOT->Macro("$EICDIRECTORY/etc/rootlogon_eic.C"); }
Running ROOT
If you have an EIC account, then in order to run the ROOT analysis package you will have to add the location of the ROOT binary to your path. If you source the EIC logon script this is done automatically. If not, you can select the currently used version of ROOT by adding the location of ROOT to your PATH environment variable. To add this to your path, in a c shell use the command:
setenv PATH $ROOTSYS:{$PATH}
or in bash:
export PATH=$ROOTSYS:$PATH
where ROOTSYS is the path to the desired ROOT installation. Currently the standard EIC installation is $EICDIRECTORY/root6. After this, you can use the root executable from any directory.
You will also need to add the location of the ROOT libraries to your LD_LIBRARY_PATH environment variable using
setenv LD_LIBRARY_PATH $ROOTSYS/lib:{$LD_LIBRARY_PATH}
or
export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
If you are just getting started in running the ROOT analysis framework, there is a tutorials directory at:
$ROOTSYS/tutorials
These tutorials are discussed in detail at the main ROOT webpage at CERN and are worth looking over, especially for anyone who is new to ROOT.
ROOT Utilities
There are a number of classes providing utilities to simplify making figures in ROOT, provided via the eicplot package.
Help with ROOT
If you have questions about ROOT, you can search or submit a question to the ROOT Forum mailing list. Or, you can ask on the EIC software mailing list.
Below are some random ROOT tips that you may find useful. Please feel free to add your own.
Moving and resizing the palette axis of a 2D histogram
When drawn with the option "colz" a 2D histogram is drawn using a colour scale, with a colour palette giving the key, as shown in the figure.
It may be that, as in this example, the right margin in which the colour palette is drawn is not large enough to fit the text labels. To increase the space for the colour palette, first increase the right margin of the image: |
gPad->SetRightMargin(0.15); // The default right margin is 0.1 i.e. 10% of the image width
This provides more space for the colour palette, but does not actually reposition it. To do that, do the following, after drawing with colz:
TPaletteAxis* palette = dynamic_cast<TPaletteAxis*>(myHistogram.GetListOfFunctions()->FindObject("palette")); if(palette) { palette->SetX1NDC(0.86); // Start the palette 86 % of the way across the image palette->SetX2NDC(0.91); // End the palette 91% of the way across the image gPad->Modified(); // Update with the new position } // if
Note that the vertical size of the palette can also be modified using SetY1NDC (0.1 by default) and SetY2NDC (0.9 by default).
Logarithmic axes
Setting an axis to be logarithmic is done via the graphical pad (TPad, TCanvas etc) on which a histogram is drawn, rather than via the histogram itself. For example:
myPad.SetLogx(1);