Adding Friends to a chain

I would like to simultaneously analyze two separate sets of ntuples. To do one or the other I used TChain. I want to compare entries in chain1 vs. chain2. Do I do this using AddFriend? If so, I know how to do it for just pairs of single files, but not for a chain.

Thanks, Tony Liss

Simply do:chain1->AddFriend(chain2);


Thank you for the reply. I have a follow-up question. My two chains have trees with the same name. For individual files I can use an alias as described in the Users Guide:
tree.AddFriend(“tree1 = tree”,“friendfile1.root”);

But I have not been able to make the similar thing work with my two chains. If I do

is there a way to alias the tree name in chain2? I have tried both an alais when I create the chain:
TChain * chain2 = new TChain(“CT2=CollectionTree”,"");

or similarly when I do the AddFriend, but in both cases CT2.VariableName is not recognized in my macro.

Tony Liss

Simply do:


Thanks but I still get “Error symbol CT2 is not defined in current scope” in my MakeClass C file .

humm … Did MakeClass actually write the symbol CT2? Can you send me a simple example reproducing this?