Controlling ROOT

One more remark at this point: as every command you type into ROOT is usually interpreted by Cling, an "escape character" is needed to pass commands to ROOT directly. This character is the dot at the beginning of a line:

root [1] .<command>

This is a selection of the most common commands.

  • quit root, simply type .q
  • obtain a list of commands, use .?
  • access the shell of the operating system, type .!<OS_command>; try, e.g. .!ls or .!pwd
  • execute a macro, enter .x <file_name>; in the above example, you might have used .x slits.C at the ROOT prompt
  • load a macro, type .L <file_name>; in the above example, you might instead have used the command .L slits.C followed by the function call slits();. Note that after loading a macro all functions and procedures defined therein are available at the ROOT prompt.
  • compile a macro, type .L <file_name>+; ROOT is able to manage for you the C++ compiler behind the scenes and to produce machine code starting from your macro. One could decide to compile a macro in order to obtain better performance or to get nearer to the production environment.

Use .help at the prompt to inspect the full list.