TTree AddFriend and SetAlias

Hi everyone,

I have a question corning tree friends and the SetAlias function.
My problem is that I have two trees that I would like to merge using the AddFriend and they don’t have a common branch that I can easily merge onto. I have a set of 4-5 variables that would make an entry unique, but the BuildIndex function only allows for two.

I was wondering if there is a way to make the merging using a SetAlias so that I construct a unique identifier from those four variables and use this as an indexing function e.g tree->SetAlias("key", "1000000*a+10000*b+100*c+d");tree->BuildIndex("key");

I tried to play around with the treefriend.C macro, but so far it seems that all I get is that the lookup is not working and the entries are randomly associated.

Any hint if this type of action is possible at all and if so how would be gladly appreciated.