Single TTree from TChain


ROOT Version: 6.14.04
Platform: SLC6
Compiler: gcc62


Hi, I’d like to be able to manipulate a number of root files (with similar contents) as one, for the purposes of projecting trees into various histograms and “befriending” with other trees etc.

For instance, if I do

>>> from ROOT import *
>>> chain = TChain("nominal")
>>> chain.Add("*.root")
15
>>> chain.GetEntries()
1220986L
>>> chain.GetTree().GetEntries()
6330L

It seems TChain::GetTree() returns a pointer to the last tree only. How can I get a single tree, containing the contents of all the root files in my TChain, in a similar way to hadding those files?

Thanks!

Actually never mind, should have read the docs better :slight_smile:

This is explicitly the purpose of TChain :slight_smile: … [alternatively you can merge the files into one very large one in several including using the hadd command line tool]

Cheers,
Philippe.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.