Read Ntuple with two trees at the same time ROOT

Hello everyone and thanks four your attention , I am new with root and i am trying to read two trees in the same Ntuple at the same time but i don’t know how do it.
I didn’t find information about that, but I would like to know the process to get read both trees in parallel.

Thank you again for your attention.

Best regards

I don’t think it’s possible to have trees inside ntuples. Can you describe more precisely what you have and what you want?
Also, do you know how to read one tree? If so, the solution could be simple to explain and understand, but again, depends on the answer above.

If the two tree/ntuple have the same structure you can chain them. But as @dastudillo said you need to clarify a bit what you want to do.

Hello @dastudillo, sorry you’re right, it’s actually two trees in the same nupple, what I’m trying to do is read the two trees at the same time, so that I can manipulate takes the variables at the same time.

Thanks in advance.


Hello @couet , I am trying to read at the same time 2 trees and manipulate both at the same time.
Thank you in advance.

Attach outputs from “tree_1->Print();” and “tree_2->Print();”.

I’m afraid it’s not clear what you are trying to achieve.
In principle, there exist two possibilities:

  1. to “add” / “merge” entries from both trees (so that they are treated as a single “combined” tree with the number of entries equal to the sum of numbers of entries from both of them), you may want: TChain

  2. to analyze some variable(s) from the first tree versus some variable(s) from the second tree, you may want: TTree::AddFriend

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