TRef and TChain::Merge


I’m having a strange behaviour when merging together big trees (with complex structure). I cannot reproduce the problem with smaller trees and/or simpler structures, so I cannot give a running example, sorry. Any ideas or suggestions are welcome, though.

When merging several big trees (285) the output file automatically splits into 5 files 1.9GB each. When reading back the files, everything is OK for the 4 first files, but in the last file, and only for one particular branch of the last file, which contains a TClonesArrray of TRef, pointers are lost when trying to read the objects:

Error: illegal pointer to class object b 0x0 1214

I know that TRef are very special objects (also TClonesArrays). Is there a particular thing I need to worry about when merging trees with TRef? I am simply doing

TChain ch(“T”);

and then quit root. Any ideas? Thanks!

PS: This is ROOT 4.00/08 on linux.

Could you try:

Long64_t maxsize = 100000000; //100GB maxsize *= 100; //to bypass some compiler limitations with big constants TTree::SetMaxTreeSize(maxsize); TChain ch("T"); ch.Add("*.root"); ch.Merge("all.root",0,"keep fast");
or simply use the standard tool hadd to merge ROOT files

hadd -f all.root *.root


Thank you for the suggestion. I still get the same problem, though. I will get around without merging the trees. It’s not a big deal. It is just funny that I can perfectly access all the information on the file, but the TRef point nowhere (and this only happen for the last entries of the tree).

Thanks anyway,

To make progress with this case, we will need access to the smallest possible set of files and a script reproducing the problem.