Before you can use ROOT, you must have a working ROOT installation. → See Installation Guide.
Working with an interactive ROOT session
Starting and quitting ROOT
ROOT can be started at the system prompt. To that end, you can type:
and the ROOT prompt is displayed:
------------------------------------------------------------------ | Welcome to ROOT 6.27/01 https://root.cern | | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers | | Built for linuxx8664gcc on Apr 07 2022, 13:00:54 | | From heads/master@v6-25-01-3805-ge505630f86 | | With c++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 | | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' | ------------------------------------------------------------------ root 
To display a list of ROOT commands, type
root  .help
To quit the ROOT prompt, type
root  .q
Command line options
These are some command line options you can use when starting ROOT:
-b: ROOT session runs in batch mode, without graphics display. This mode is useful in case you do not want to set the DISPLAY.
-n: Does not execute the logon script and logoff script as specified in
-q: Exits after processing the command line macro files.
-l: Does not show the ROOT banner.
-a: Displays the ROOT splash screen.
-x: Exits on exception.
dir is a valid directory, change to it (
cd) before executing ROOT.
--help: Prints usage.
-config: Prints the
cmake configure options.
Running C++ code
ROOT uses the interactive C++ interpreter Cling that is built on top of the
Low Level Virtual Machine (LLVM) and the Clang libraries.
Cling provides a command line prompt and a just-in-time (JIT) compiler for compilation.
For more information on Cling, → see Cling.
Cling provides a user experience that is closer to a typical interpreter, e.g. IPython. Therefore, unlike pure C++ language, no semicolon (
;) is required at the end of the line.
You can use ROOT to execute simple commands at the ROOT prompt.
Every command typed at the ROOT prompt is stored in the
.root_hist file in your home directory.
Calling a function from a ROOT class like
You can use ROOT to execute multi-line commands at the ROOT prompt.
To start a multi-line command, type at the ROOT prompt:
Type one command per line.
To end the multi-line command, type:
You can also write the commands to a file, called a ROOT macro, and then execute and compile it. For more information on ROOT macros, → see ROOT macros and shared libraries.
Special interpreter commands
ROOT provides a set of commands to perform special actions from the ROOT prompt. They are all prefixed by a dot:
root  .<command>
Here a selection of commands:
.?: Provides the full list of all commands. (Also
.? edit: Prints a list of keyboard shortcuts for editing the input text at the ROOT prompt.
.!<OS_command>: Accesses the shell of the operating system. For example
.x <file_name>: Executes a ROOT macro.
.U <file_name>: Unloads a file.
.L <file_name>: Loads a ROOT macro or library.
.L <file_name>+: Compiles a ROOT macro.
.class: Lists the available ROOT classes.
.Class X: Shows what cling knows about class
.files: Shows all loaded files.
.include: Shows the include paths.
.I path: Adds an include path.
ROOT command line tools
ROOT also provides many command line tools at the system prompt for simple file operations or automating common operations performed on ROOT classes. → See ROOT command line tools
Using ROOT from Python
ROOT provides Python bindings, called PyROOT, which allow to access all the ROOT C++ functionality from Python.
Therefore, ROOT can be used interactively from the Python prompt. The first step consists in importing the ROOT module:
After that, we can use ROOT as we did from C++. The global C++ namespace is accessible via the ROOT module, e.g.:
ROOT tutorials are available online on the Reference Guide tutorial page.
Moreover, when you install ROOT, a
tutorials directory is created, containing all ROOT tutorials.
Starting with a simple tutorial
root  .x df000_simple.C
A window with the plot of a histogram should appear as a result.
The same tutorial is also available in Python → df000_simple.py .
A more thorough introduction to RDataFrame can be found → here.
Browsing through the rest of tutorials
Tutorials are written in C++, Python or both. For instance, the following dataframe tutorial is available in both languages:
Moreover, some tutorials are also published in the form of Jupyter notebooks. If that is the case, below the tutorial link there are two buttons to open the notebook statically (
View notebook) or in SWAN (
Open in SWAN). Please note that SWAN is an online notebook service that requires a CERN account.