How to add TTree to TChain?

Consider I have something like:

[code]TTree *tree1;
TTree *tree2;

// Extract Trees from files. Each file has tree saved in different folder. So, I’d use
// TFile::FindObjectAny(“customtree”)

TChain *chain = new TChain();

// Trees should be added to the Chain
// ???

// Loop over chain with standard means[/code]

How can I add tree1 and tree2 to the TChain in order to process it?

Any thoughts? Any Suggestions?

Hi,

You currently can not add a TTree object directly to a TChain. However,[quote]Extract Trees from files. Each file has tree saved in different folder. [/quote]you can easily add TTree that are in different folders:TChain ch("defaultdir/defaulttreename"); ch.Add("file1.root/dirone/treeone"); ch.add("file2.root/dirtwo/subdir/treetwo");

Cheers,
Philippe.