Merging files with hadd that contain TNamed tags

Hello.
We store the output of our simulations in a .root file and we add a Tag (that is a TNamed object) together with the tree. This tag is used to store the version of the code we used, Geant4 version…physics…etc. The problem comes when I simulate 300 files in parallel and merge them with hadd. The resulting .root file has merged the 300 trees, but I also get a list of 300 Tags. Is there a way to avoid merging these tags?

Thank you very much.

Hello,

You could implement a custom merge routine by deriving from TNamed a custom class that implements a method Merge(TCollection *items). It’s probably easier though to post-process the file or to ignore the additional TNamed objects. I don’t think they can be easily filtered but @pcanal might correct me.

Cheers,
Jakob

Hi Jose,

It is not clear if copying the Tag object is the semantically necessary or not. I.e. Doesn’t the merge file also need to know the “tag”/“provenance” of the data?

So theorically implementing Tag::Merge(TCollection*,Option_t*) is the best solution.

Another is to just “ignore” those in the merge file but it was disk space…

Another is to use TFileMerger directly (the class implementing the hadd behavior), as seen in the tutorials: tutorials/io/mergeSelective.C it lets you skip some of the object.

Cheers,
Philippe.

Hello, and thank you very much for your answers. I will try the implementation of Tag::Merge() and I tell you.

Jose

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.