Basic ROOT start-up guide
Migrated automatically from an old site engine: soon to be sorted out, and maybe expanded a bit, although there are better guides out there
This is a quick start for the ROOT HEP analysis framework, based on an email I sent to some people in my ex research group in Cambridge and ocasionally augmented since then. Please let me know if any of the content of this page becomes obsolete or redundant.
I should also point out that this document is by no means an endorsement of ROOT, a flawed and ill-conceived abortion of a software project in my view is one of the most prescient threats to reliable HEP research. But I had to work with it, so here's my collection of work-arounds for the design flaws and niggles that are easy to fix --- a multitude of others are not. As they say, know your enemy. If you want know more about why ROOT is a problem, here's my critique of ROOT's more obvious flaws.
Reference material
The best references are the manual (only available in PDF or Word -- download from http://root.cern.ch) and the online class reference. The problem with the latter is that it only tells you about the methods that are implemented in the current class but most of the useful ones are defined in some arbitrarily-named superclass!
Viewing a ROOT file with the browser
If you just want to read a file produced by ROOT (from, for example, the LHCb Gaudi framework) then this is what you want:
root [0] f = new TFile("brunel.root"); root [1] b = new TBrowser();
Alternatively, from the command line
> root brunel.root
will load the
file into scope as in the first line above.
Avoiding Cint
More recently I've just been compiling via g++ from the shell (not CINT) with commands like,
g++ -c
since this avoids the general nightmare of CINT (no STL, little type safety) and ACliC (unreadable
compile warnings and inability to handle prototype declarations in header files).root-config --cflags
*.cpp g++ -o mkBuVarPlots root-config --libs --cflags
Bu2KsPi-selection-plots.cpp
SBHisto
This can also be incorporated fairly easily into the GNU autotools framework if you know what you're doing. I'll take the opportunity to make a brief aside on the subject of autotools. While it certainly has its own obscurities, perhaps to be ameliorated by systems like Ant and SCons, it is a robust and widely tested system for software building, configuration and installation. Indeed, the reasons for many of the more obscure aspects of its design arise from the many quite unexpected problems that arise when trying to deal in general terms with the deceptively simple problem of software configuration and distribution over many different platforms and systems. I can highly recommend it: persevere and find someone who knows what they're doing when you write your first autoconf build and you'll never look back :).
Removing the splash screen
Over remote connections (in fact, all the time as far as I'm concerned) the ROOT graphical splash screen is a bit
annoying: it's very slow to load remotely and hangs around for a few seconds even when the interpreter has initialised.
It also doesn't seem to play well with multiple workspaces if you flick between them when the splash is active. Let's
deactivate it add the following command alias to your .bashrc
(or the equivalent statement in your .tcshrc
if
you're a C-shell sicko) :
alias root="root -l";
This deactivates the graphical splash screen, but also removes the quite useful text splash (it's nice to know you're
running the right version of ROOT when so many versions can be lying around on AFS and your shell environment gets
mangled by collaboration software). That's okay, we can make a new one via the rootlogon.C
file, which gets run on
ROOT start-up. Actually, I don't like capitalised extensions and I don't like having config files visible in my home
directory, so I've changed the name to .rootlogon
via this line in my $HOME/.rootrc
:
Rint.Logon: .rootlogon
Finally, the .rootlogon file contains this:
{ cout << "****" << endl; cout << " Welcome to ROOT v"
<< gROOT->GetVersion() << " *" << endl; cout << "*****" << endl; cout << endl; }
All put together, this means that typing root
on the command line now doesn't bother me with a splash screen and the
initial ROOT prompt looks like this:
****************************** * Welcome to ROOT v4.00/02 * ******************************
root [0]
Happiness! Well, not desperate unhappiness, and that'll have to do for now.