ROOT architecture and components


ROOT is modular scientific software toolkit and provides numerous tools for big data processing, statistical analysis, visualization and storage.

The ROOT Reference Guide provides a complete list of all available ROOT classes and their documentation. It is the central source of information for all ROOT classes.

The source code is available on GitHub and many examples are available as tutorials.

ROOT is implementing new interfaces following new design style.

ROOT contains several classes developed in the past which are following a specific naming convention and a special inheritance scheme.

ROOT has a set of global ROOT variables that apply to a ROOT session, → see Global ROOT variables.

Naming conventions

The following naming conventions apply to ROOT objects:

  • ROOT classes begin with T
    Examples: TLine, TTree

  • Non-class types end with _t
    Example: Int_t

  • Data members begin with f
    Example: fTree

  • Member functions begin with a capital letter.
    Example: Loop()

  • Constants begin with k
    Examples: kInitialSize, kRed

  • Global variables begin with g followed by a capital letter.
    Example: gEnv

  • Static data members begin with fg
    Example: fgTokenClient

  • Enumeration types begin with E
    Example: EColorLevel

  • Locals and parameters begin with a lower case
    Example: nbytes

  • Getters and setters begin with Get and Set
    Examples: SetLast(), GetFirst()

TObject - the ROOT base class

In ROOT, almost all ROOT classes inherit from the common ROOT base class TObject.

The TObject class provides default behavior and protocol such as:

  • Object I/O (Read(), Write())

  • Inspection (Dump(),Inspect(), ls())

  • Printing (Print())

  • Drawing (Draw())

  • Access to meta information (IsA(), InheritsFrom())


  • TFile::ls: Lists objects in a file or directory.
    • list->ls(): Lists objects in a collection pointed by list.
    • list->Dump(): Dumps all objects in a collection pointed by list.
  • TObject::Inspect Dumps the contents of this object in a graphics canvas. A table is displayed where, for each data member, its name, current value and its title are given. If a data member is a pointer to another object, one can click on the pointer and, in turn, inspect the pointed object,etc.

  • TObject::Dump: Same as TObject::Inspect, except that the output is on stdout. An object dump can be written to a file.

  • ROOT object browser (TBrowser): Allows you to browse collections, such as the list of classes, geometries, files and TTree. → See also ROOT object browser.

Global ROOT variables

ROOT has a set of global ROOT variables that apply to a ROOT session.


Via the global gROOT variable, a single instance of TROOT is accessible. The global gROOT variable holds the information relative to the current session.

By using the global gROOT variable, you get the access to every object created in a ROOT program. The TROOT object has several lists pointing to the main ROOT objects. During a ROOT session, the global gROOT variable keeps a series of collections to manage these objects. They can be accessed via the gROOT::GetListOf()... methods.

The gROOT::GetListOf()... methods return a TSeqCollection, meaning a collection of objects. They can be used to do list operations such as finding an object, traversing a list and calling a method for each of the members. See TCollection for the full set of methods supported for a ROOT collection.


For finding a canvas called c1, you can use:


This returns a pointer to a TObject. Before you can use it as a canvas, you need to cast it to a TCanvas.


gFile is the pointer to the current opened ROOT file in a ROOT session (TFile).


gStyle holds the current style, which is the global object of class TStyle.


A generic interface to the underlying Operating System.


gDirectory is a pointer to the current directory.


gPad points to an active pad on which a graphic object is drawn.


gRandom is a pointer to the current random number generator (TRandom interface). By default, it points to a TRandom3 object. You can replace the current random number generator by deleting gRandom and recreating with your own desired generator.


   delete gRandom;
   gRandom = new TRandomRanluxpp(0); //seed=0

TRandomRanluxpp is another generator based on Ranlux++.


gEnv contains all the environment settings for the current session and is of type TEnv.

gEnv is set by reading the contents of the .rootrc file (or $ROOTSYS/etc/system.rootrc) at the beginning of a ROOT session.


gGeoManager is used to access the geometry manager class created with TGeoManager.

New ROOT classes

The new interface styles follow the C++ Core Guidelines where reasonable in our context. Most noticeably this means

  • new classes are in namespace ROOTand their names begin with R; headers are in include/ROOT/ and are included as <ROOT/...>; libraries are starting with libROOT...
  • use of references as parameters instead of pointers,
  • massive reduction of virtual functions (and calls), no more TObject inheritance,
  • use of stdlib classes (std::vector, std::string) instead of TList and friends,
  • separation of concerns, including separation of internal (ROOT::Internal::) and user-facing functionality.