Merge two trees from diffrent root file

Could Anyone help me to merge two trees of two different root files parallelly?
I mean —>
TFile 1 TTree1 Entries: A1,A2,A3,A4.
TFile 2 TTree2 Entries: B1,B2,B3,B4…
TFile 3 (combine TFile 1+TFile 2) TTree3 (combine TTree1+TTree2) Entries: A1,B1,A2,B2,A3,B3…

Best Regards,


Thanks For suggestion,
But I am not able to do this. Could you please write a sample macro to merge two root files attached herewith in single root file in which Trees have been added parallely(mentioned in previous massage).

Thanks in advance,
Omtree2.root (5.6 KB)
tree1.root (5.6 KB)

It seems I misunderstood your question.
My reply was good if you wanted to “combine” entries from both trees, i.e. “(A1,B1), (A2,B2), (A3,B3), …”.
ROOT can easily “add” trees using the TChain class, but it then creates “A1,A2,A3,A4,…,B1,B2,B3,B4,…”.
It seems, however, that you want to “mix” entries from both trees and in this case maybe @pcanal has some idea how to do it easily.

Exactly, I want to mix entries from both trees.

waiting for @pcanal suggestion.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.