CloneTree versus Clone

What is the difference between calling Clone() and CloneTree() on a TTree *? Under what situations should you use CloneTree() or Clone()? Also, please answer the same question for a TChain * instead of a TTree *.




Clone makes a strict copy of the TTree object itself (and the TBranch objects) and is essentially equivalent to reading a second copy of the object from file ; it does not trigger any copy of the underlying data nor does it make the resulting copy useable in anyway to copy any of the data. You would use this only if you need two distinct view of the TTree (for example to compare to separate part/entries of the data).

CloneTree would be used (for both TTree and TChain) any time you want copy the underlying data (or a subset there of) to a new file.