Merging root files with custom classes

Greetings,

I’m trying to merge files that have TTrees that are output of geant simulations, as well as objects of other custom classes, e.g. “Info” classes that contain common parameters used to do the simulation. However, “hadd” chokes on the custom class objects, and so none. of the info objects get into the final file. This effectively eliminates the advantage of parallel computing, particularly important when dealing with geant.

I searched this forum for similar questions, and find that there is apparently anonymous “documentation” that describes how to write mergeable classes, but it’s not clear where that documentation exists, could someone please point me to it?

Alternatively, it seems hadd could stand to have additional options that give the user some flexibility without having to generate additional code, e.g.:

  1. have the object from the first (or nth) file copied to the output; this would be useful in the case that all of the files have the same information in that object

  2. have all such objects copied to the final output without merging, and with version specifiers, e.g. “;1”, “;2”, “;3”, etc.

Thanks,
-Phil D.

Hi Phil,

we take note of your request for a better documentation about mergeable classes: we’ll take an action about this.
For the time being, did you try to implement for your classes a Merge method like the one of TH1, i.e. with the signature Long64_t MyClass::Merge(TCollection*)?

Cheers,
Danilo

No, I had assumed that there was documentation to show me how. I got that idea from this post, where the poster refers vaguely to “the documentation”.

Thanks,

I will write a clear how to in this section root.cern.ch/howtos and keep you posted.

Cheers,
Danilo

So I have run across this problem again, having forgotten that I already asked about this last fall - I don’t see any updates to the howtos. Is there any progress on this?

Thanks,
-Phil D.

Hi Phil,

somehow the document was not correctly published on the website: thanks for the report.
It’s online now: root.cern.ch/how/how-merge-custom-objects

Cheers,
Danilo