Chaining TTree wrapped in a class

Hi all,

here is what I’d like to do but cannot find a smart to do so:

I have a class: Result which has a member TTree fTree and other useful members
of various types ( base/classes/ … ). I run several set of analyses each of them
spits out a Result object I store in a ROOT file ( this class inherits from TObject so
the job is quite easy ).
Now, I’d like to read in several files and retrieve the Result object for each of them
and e.g create a combined one: Result3 = Result1 + Result2. The job is being
done by the operator + for the various memebers of the Result class.
Unfortunately I fail to find a way to “merge” the 2 resp. trees
( the one from Result1/2 ) into the one in Result3.
TChain offers the possibility to merge trees which are written as “raw” trees in a
ROOT file but it seems it doesn’t allow me to do something like:
tree3 = tree1 + tree2 ( or tree3.Add( tree1 ); tree3.Add( tree2 ); )

Hence my question, is this latter operation feasible ? I am aware that an obvious
alternative would be to write out the trees separately and make use of a TChain
to combine them instead of wrapping the trees in an object.


Hi again,

ok, simply mving to a newer ROOT version did answer my pb … :slight_smile: TTree::Merge does
the job