Merging TTree's from ReadFile

Hi,

I apologize if this has already been discussed, but a quick search did not help and I am missing time to search deeper.

I couldn’t find how to merge trees without saving them into different files.

I mean, suppose I read several ascii files using TTree::ReadFile, then I want to merge them into one tree. I see two natural solutions :

1/ mytree->ReadFile(“filename”,“a/F:b:c…”,"+"), which would add the file content to the existing tree ;

2/ creating a TChain, then mychain->Add(mytree) ;

However, none of these methods exist. Any reason for this ?

What would be a workaround ? I saw some advices about making the trees friends, but for what I understood friends trees are not merged trees, or did I miss something ?

The only way I can think of is to save each TTree in a TFile, then use TChain::Add() to merge them, which is not very convenient.

Any thought ?

In the SVN trunk I have implemented the possibility to read multiple input files.
For reading more files, simply omit the second argument.

Rene

Nice, thanks. :slight_smile:

So for the records, it should be implemented in version 5.23/05 and higher.