Reading ROOT Class Information

The aim of this crib ROOT is to supply enough information that beginners can start to use ROOT classes without ever having to consult the official documentation. However, the ROOT class library is huge and still growing fast, so this crib can do no more than scratch the surface.

To dig deeper you can find a complete index to all ROOT classes here. but beginners should treat this link with caution. The index links to a set of HTML documents generated automatically (by THtml - a ROOT class). Consequently the documentation is very complete, but is not alway very user- friendly. Clicking on any class in the index, say TCLonesArray, leads to a page that looks something like:-

TClonesArray

class description - source file - inheritance tree

class TClonesArray : public TObjArray

Start by clicking on class description which leads to some comments in general about the class. The value of the comments to a newcomer are very variable, some are good, but others poor. One of the hardest parts of understanding OO code is that to get a complete understanding of a class, you must not only read about it, but about all the classes from which it inherits. The ROOT documentation provides links to help you see the bigger picture:-

  1. It lists the classes from which it directly inherits at the top of the document. For TClonesArray it is

    class TClonesArray : public TObjArray

    meaning that it inherits from TObjArray, clicking on this link takes you to that class. From there you can jump to the classes it inherits from and so can explore the full inheritance tree. However, after visiting several classes it get very hard to remember what member functions a class has, which is the most important information a user needs to know.
  2. The link inheritance tree addresses this problem by showing the inheritance tree as a diagram. This shows you all the member functions. A member function that has been replaced (i.e. overloaded) in a subclass is shown in grey.
Besides the class description and the inheritance tree the next area of the document to study is the first part. It is constructed from the class's header file and consequently lists all its member functions and data members. One of the features to notice first about a class's member functions are the ones that start "Get" that return information about the object in question. For example, TClonesArray inherits from TObjArray that has the entry:-
Int_t GetEntries()
which suggests that this function gives the caller the number of entries in the array. Clicking on GetEntries() leads to a description of the member function and confirms the suggestion. With some practice, looking at the inheritance tree to look for interesting member functions and then learning more about them by checking the header file section of the appropriate class, it is possible even for beginners to start to use some of the ROOT supplied information about objects that the user may want to manipulate.

The source file link is probably not going to be a very helpful for beginners as this leads to the source code itself, in HTML form. Sometimes there are additional comments here that appear nowhere else, so it may be worth checking if all else fails!


Go Back to the The ROOT Crib Top Page


If you have any comments about this page please send them to Nick West