Adding multiple trees from same file

Hi,

I’m trying to read in multiple trees from the same file. The names of the trees are “DecayTree” and “tInt” and the filename is LL.root. I’ve tried the code snippet below, but this doesn’t seem to recognise the branches from DecayTree.

Any help would be appreciated.

Thanks

	TChain *chain = new TChain("DecayTree");
	chain->Add("LL.root");
	chain->Add("LL.root/tInt");
	chain->Add("LL.root/DecayTree");

Hi,

Do ‘DecayTree’ and ‘tInt’ have the same list of branches? (a chain ‘append’ the entries of each tree (i.e. number of entries in the chain == sum number of entries in each trees).

If they do not have the same list of branches, maybe you have the case where the entry of both TTree are extension of each other (ie. tInt add additional information to the entries in DecayTree), in which case you are looking for the ‘Tree friendship’ mechanism:

Cheers,
Philippe.

[quote=“pcanal”]Hi,

Do ‘DecayTree’ and ‘tInt’ have the same list of branches? (a chain ‘append’ the entries of each tree (i.e. number of entries in the chain == sum number of entries in each trees).

If they do not have the same list of branches, maybe you have the case where the entry of both TTree are extension of each other (ie. tInt add additional information to the entries in DecayTree), in which case you are looking for the ‘Tree friendship’ mechanism:

Cheers,
Philippe.[/quote]

Hi, sorry for the slow reply.

“DecayTree” & “tint” do have different data on them so I guess the AddFriend function is what I need. I’ll try that then.

Thanks for your help :slight_smile: