Root5 hadd trouble with TClonesArray*

Hi,

I have a set of .root files, each containing a single tree. Each tree contains a single branch of a user-defined event type. One of the data members of the event is a TClonesArray* of tracks.

I have always used the hadd executable in root4 to merge these files successfully (thanks for the large file support, by the way!). However, when I try to merge the same files using v5.08, I run into a problem with the TClonesArray. hadd appears to work fine, but when I call TTree.GetEntry() for an event containing more than 7 tracks I get the message

Error in TBranchElement::ReadLeaves: Incorrect size read for the container in mPionCandidates
The size read is 8 while the maximum is 7
The size is reset to 0 for this entry (0)

where mPionCandidates is of type TClonesArray*. A few things I have noticed:

–I am able to analyze these events containing more than 7 tracks if I open the inidividual files without merging in v5.08.
–I am also able to analyze them if I merge the files using v4.04 and then read the resulting file using v5.08.
–merging the files using an haddDir.C script (a slightly modified hadd.C) in v5.08 is also successful.
–the maximum size available seems to be dependent on the maximum number of tracks in the first file that is merged

A selection of root files and the haddDir.C script should be accessible at

web.mit.edu/kocolosk/www/root_files/

Thanks in advance,
Adam Kocoloski

The problem is fixed in the development version in CVS.
If you do not want to import the CVS head and have access to the source of 5.08, replace the line 246 in hadd.cxx

globChain->Merge(target->GetFile(),0,"keep fast");
by

globChain->Merge(target->GetFile(),0,"keep");
Rene

Thanks for the fast response, Rene! I’ll make the change when I get the chance to recompile.

Adam

Hi,

This problem is now resolved in the CVS repository.

Cheers,
Philippe.

I’m just starting to pay more attention to hadd and noted the change in the option passed to TChain::Merge which removed the “fast” from the option string.

How much of an impact on performance will that have?

If one were to write their own merge routine that uses TChain::Merge - under what circumstances is it acceptable to use the “fast” option? I assume TClonesArray is a no no.

Thanks,
Heather

The change to hadd was reverted and “fast” was re-added. You should be able to use the “fast” in all cases (it should disable itself when it is not appropriate to use (see the documentation for the details)).

The ‘fast’ option significantly improve the performance of cloning the file (as long as you do not need to skim).

Cheers,
Philippe.