How to open 2 TTrees in a TTreeViewer?

I want to use the TTreeViewer to create a 2D histogram of two branches that are stored in two different TTrees. I remember that before I could manage to do this by opening a TBrowser. From there I can open the TTreeViewer via the context menu of one of the TTrees. And then I could add the second tree to the viewer via drag and drop. However, now I am working on a different machine (windows) and drag and drop seems not to work. Also, trying to load the second try via the File menu seems to have no effect.

Hi,

Drag and drop should work on Windows, but slightly differently. I’s possible that it doesn’t work in the Tree Viewer… I’ll try and let you know

Cheers, Bertrand.

Hi,

OK, drag and drop doesn’t work between the browser and the tree viewer on Windows, but are you sure it works on Linux? (I can’t try on Linux right now, as it doesn’t work via ssh, so I’ll have to try on Monday anyway…)

Cheers, Bertrand,

I am sure that it was working. However, I just tried it again on a different (linux) machine and also there it didnt work, so its probably not a linux/windows problem.

If it does not work with the Viewer via drag and drop, what is the easiest way to create a 2D histogram from branches located in 2 different trees (the trees are friends)?
I could write a script to do it, but I hope there is an easier way to do it.

ps: Apart from my actual problem, I also do not understand how the Viewer is supposed to work… I can open a Viewer for a tree from the context menu in the TBrowser, but when I do “File->Open Tree File” to open a different tree in the viewer, just nothing happens. Is this normal?

[quote=“Hobbybastler”]If it does not work with the Viewer via drag and drop, what is the easiest way to create a 2D histogram from branches located in 2 different trees (the trees are friends)? [/quote]Well, in the case where they are friends, then you should already automatically see them both in the Tree Viewer. For example, when running $(ROOTSYS)/tutorial/tree/tree3.C, you see the t3 members and the t3f members as well… See the following capture:

[quote=“Hobbybastler”]ps: Apart from my actual problem, I also do not understand how the Viewer is supposed to work… I can open a Viewer for a tree from the context menu in the TBrowser, but when I do “File->Open Tree File” to open a different tree in the viewer, just nothing happens. Is this normal?[/quote]Probably not. I’ll check.

Cheers, Bertrand.

[quote=“Hobbybastler”]ps: Apart from my actual problem, I also do not understand how the Viewer is supposed to work… I can open a Viewer for a tree from the context menu in the TBrowser, but when I do “File->Open Tree File” to open a different tree in the viewer, just nothing happens. Is this normal?[/quote]In fact the file is open. You have to right-click on the right pane of the viewer, select “SetTreeName” in the context menu, and then enter the tree name. (you can also use this method if the trees are not friends)

Cheers, Bertrand.

Sorry, I forgot to call AddFriend(…) before opening the tree in the viewer. Thanks for you help