User Tools

Site Tools


root:chain

This is an old revision of the document!


How to use chains in ROOT

Idea

A chain is sort of a container for trees. A chain can contain an arbitrary number of trees and can be used the same way as a tree, as the class chain inherits from the class tree.

Adding Files

A simple example is the following:

TChain* myChain = new TChain("DecayTree");
myChain->Add("myRootFile.root");

Note the following:

  • You have to add files, not trees to the chain
  • All your files need to have the same structure (subdirectories, branches,…)
  • If your trees are in a subdirectory, you have to specify it in the constructor. For example: If your tree DecayTree is in the subdirectory mySubdirectory in the root file myRootFile.root, call the constructor with:
TChain* myChain = new TChain("mySubdirectory/DecayTree");
root/chain.1245657616.txt.gz · Last modified: 2009/06/22 10:00 by decianm