Now I need to read in say 4 input files (same structure just more events then).
so I tried the above with TChain
TChain* f = new TChain(“test”);
for (std::vector::const_iterator itr = files.begin() ; itr != files.end() ; ++itr)
{
chain.Add(itr); // add filenames to chain
}
TTree t_truth = (TTree*)f->Get(“Truth”);
TTree* t_indet = (TTree*)f->Get(“InDet”);
so “f” is a chain pointer now. That does not work however. I guess TChain is a sort of TTree already but I dont know how to use it now …
Hi,
a TChain behaves like a TTree, only the TTree spans over multiple files. See root.cern.ch/root/html/TChain#TChain:TChain on how to use it. In your case you need two chains, one for each TTree, even though both TChains use the same set of files.
Axel.
that might depend on your event loop. If you use SetBranchAddress you’ll have to call it each time the chain loads a new tree. Please post how you’re trying to get the data out of the trees.