Interactive usage

ROOT can broadly be divided in two conceptually distinct objects:

  • An interactive tool to perform data analysis or execute macros
  • A library with a corresponding set of APIs to be used in the context of a user-written C++ or Python progam

In this chapter we will concentrate on the first aspect.

If you do not have root on your local machine, we suggest you to download and install it from the official ROOT repository (here).

You may check whether ROOT is installed with the following command (NB: the > sign, in the following examples, represents the shell prompt):

> which root
/user/service/root-6.04.10/bin/root

(in this example ROOT turns out to be installed in /user/service/root-6.04.10, but the actual location on your machine will, most likely, be different).

In order to explore the interactive capabilities of ROOT let's start with an example.

First, we would like to know what additional qualifiers are accepted by the ROOT executable. This information is provided by the following command:

> root --help
Usage: root [-l] [-b] [-n] [-q] [dir] [[file:]data.root] [file1.C ... fileN.C]
Options:
  -b : run in batch mode without graphics
  -n : do not execute logon and logoff macros as specified in .rootrc
  -q : exit after processing command line macro files
  -l : do not show splash screen
  -x : exit on exception
 dir : if dir is a valid directory cd to it before executing

  -?       : print usage
  -h       : print usage
  --help   : print usage
  -config  : print ./configure options
  -memstat : run with memory usage monitoring
> root -l
root[0]

The prompt has changed from > to root[0]. Users can now enter commands to this shell.

An official guide on how to use ROOT interactively, can be found here.