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
.
A simple example is the following:
TChain* myChain = new TChain("DecayTree"); myChain->Add("myRootFile.root");
Note the following:
DecayTree
is in the subdirectory mySubdirectory
in the root file myRootFile.root
, call the constructor with:TChain* myChain = new TChain("mySubdirectory/DecayTree");
All the trees in the chain can be accessed the same way as it is done with trees, for example:
myChain->Draw("B_M");
to make a histogram with the B-mass.
Note: The first time you access the chain in a ROOT session, it takes a little longer, as the file has to be checked (there is a way around this, but it hasn't worked out yet…)