Combining tree

Hello,
I have two rootuples with data coming from different detectors for the same set of events (same number of entries N, different variables). I would like to merge the two trees event by event, in the way that at the end I have just one tree with N entries and all the variables.
Is there an easy way to do it?
thanks,

Hi,

We currently do not have any tools to merge TTree ‘horizontally’, you will need to create by hand the merge TTree and connect properly the input and output in way similar to the example $ROOTSYS/tutorials/tree/copy*C

Cheers,
Philippe

[quote=“vale_gala”]Hello,
I have two rootuples with data coming from different detectors for the same set of events (same number of entries N, different variables). I would like to merge the two trees event by event, in the way that at the end I have just one tree with N entries and all the variables.
Is there an easy way to do it?
thanks,[/quote]

If both trees have the same “run” and “event”, you may have luck using TTree’s Friend capability (that is, make tree B a friend of tree A, and hook up all relevant branches and write them out in tree C).

Good luck,
Charles