Bug or feature? TRefs and merging two TFiles

Hi Philippe! I thought for sure you guys abandoned this issue… :slight_smile: I almost did.

So, I did solve my TRef unique ID number problem. My final conclusion, however, is that the order in which you call TTree::GetEntry is important for the case where you are merging two files.

tree1->GetEntry(entry1++)
tree2->GetEntry(entry2++)

*myEventOut = *myTree1Event; // this doesn’t work because I called tree2->GetEntry after I called tree1.

Ah! I just had a thought. This probably doesn’t work because the unique IDs for the sub records for each event in both file1 and file2 are possibly the SAME! So, myTree1Event TRef object points to the objects in Tree2 because those unique ID numbers match! Why is that, though? Shouldn’t the ProcessIDs be different? Or are they not because I create both file1 and file2 within the same running program?

Adam

[quote]So, myTree1Event TRef object points to the objects in Tree2 because those unique ID numbers match![/quote]Yes.

[quote]Shouldn’t the ProcessIDs be different? [/quote]No, unless you create the object in 2 different processes.

[quote]Or are they not because I create both file1 and file2 within the same running program? [/quote]Yes (and the unique id are the same because of the calls to SetObjectCount).

Cheers,
PHilippe.