Frequently Asked Questions

Please have a look at this list before asking for help on the ROOT forum.

How to generate a dictionary

A dictionary is a source file that once compiled, linked into a library or executable and loaded into a process will give to CINT all the information its need about a type or variable. A dictionary is essential for a C++ to entity to useable from a CINT script or to be Streamed in or out of a ROOT file.

You have 3 options to create a dictionary.

Use ACLiC to generate the dictionary for everything defined in a source or header file:

root [] .L myScript.cxx+

or (from compiled code):

gROOT->ProcessLine(".L myScript.cxx+")
To generate the dictionary for a single class or for a class template instance use (with ROOT v5.27/06 and above):
gInterpreter->GenerateDictionary("vector<Track>","Track.h;vector");
gInterpreter->GenerateDictionary("myclass","myheader.h");
To generate the dictionary from a Makefile, you can use the following rule to generate a dictionary for the headers $(HEADERS) and a library containing the dictionary and the compiled $(SOURCES):
MyDict.cxx: $(HEADERS) Linkdef.h
[TAB]     rootcint -f $@ -c $(CXXFLAGS) -p $^
 
libMyLib.so: MyDict.cxx $(SOURCES)
[TAB]     g++ -shared -o$@ `root-config --ldflags` $(CXXFLAGS) -I$(ROOTSYS)/include $^

See Interacting with Shared Libraries: rootcint for more details.

How can I fix the problem leading to :Error: Can't call vector<...>::push_back

This usually indicates that some classes dictionary refer and/or use this particular instance of std::vector.

Prerequisites for building ROOT from source.

To successfully build ROOT a number of prerequisite packages must be installed. Check the prerequisites page for the list of packages needed for your platform.

Why fill patterns and hatches disappear in PostScript output?

See the WARNING section at the end of this page.

Subversion can not connect to server.

Try adding the line:

http-library=serf
to ~/.subversion/servers

Can I integrate ROOT into my CMake build?

Absolutely. With the two files CMakefile.txt, and FindROOT.cmake which set the variables needed by ROOT, one can compile and link one's own code. An example from the ROOT Event example (found in root/test) can be downloaded here. Just un-tar the attached file and run:

cmake -G  Xcode ./
This will create an Xcode project Event.xcodeproj which can be opened and used e.g. by most IDEs.
How to use ROOT libraries in Xcode on Mac OS X?

The easiest way is to use cmake and let it create the Xcode project, this has the advantage that the dictionaries are created automatically. With the two files CMakefile.txt, and FindROOT.cmake which set the ROOT needed variables, one can compile and link ones own code. An example from the ROOT Event example (found in root/test) is attached. Just un-tar the attached file and run:

cmake -G  Xcode ./

This will create an Xcode project Event.xcodeproj which can be opened and used by Xcode.

How to check is a file is already open?

   if (gROOT->GetListOfFiles()->FindObject(filename) ) {
      // do not open the file
   } else {
      // open the file
   }

Changing the Displayed Title in Canvas.

Disable the title and add yourself your own title with a TPaveLabel:

   gStyle->SetOptTitle(0);
   TPaveLabel *title = new TPaveLabel(.11,.95,.35,.99,"new title","brndc");
   title->Draw(); 

How to change the automatic plot title produced when a tree is drawn?

It is enough to change the title of the histogram htemp:

tree.Draw("x:y");
htemp.SetTitle("New Title");

How to draw several TGraph in one common axis system?
How do I start PROOF?

Type at the ROOT prompt:

   root [0] TProof::Open("")
Some or all windows don't get displayed when ROOT is running on a remote computer.

You probably used ssh to connect to the remote computer. You need to specify the option "-Y" which turns on trusted X11 forwarding.

How to render graphics in a file, without displaying the image on the screen ?

Run in batch mode:

root -b -q myscript.C
or in your program add:
gROOT->SetBatch();
Segmentation violation in TASImage::InitVisual () on Mac

The configure command should specify explicitly where ROOT should find all X11-related libs

./configure --with-x11-libdir=/opt/local/lib/ 
                  --with-xpm-libdir=/opt/local/lib/ 
                  --with-xft-libdir=/opt/local/lib/ 
                  --with-xext-libdir=/opt/local/lib/
Windows: Why must debug (non-debug) compiled code be linked against debug (non-debug) ROOT?

Microsoft's STL classes (std::string, std::vector,...) are different for debug and optimized mode. When calling a ROOT function that expects a STL object as an argument, the caller (e.g. your code) and ROOT must agree on what the object looks like. Thus if you link against ROOT libraries built as debug (non-debug) you must also compile your code as debug (non-debug). ACLiC does that automatically for you.

Ubuntu: No backtrace (stacktrace) when ROOT crashes

Enable /proc/sys/kernel/yama/ptrace_scope or edit /etc/sysctl.d/10-ptrace.conf. See this blog entry for details.

What is the difference between a TFolder and a TDirectory?
TFolder manages a hierrachy of objects in memory. TDirectory is doing it for a file. One can save the TFolder structure to a directory in a file.
Does the FAQ exist in different languages

There is a translation of the FAQ in Belorussian by Paul Bukhovko. We hope the example of Paul will be followed by other translations.