Excluding custom class from merging

Is it possible to exclude a custom class from being merged when using TFileMerger to merge multiple root files? We have root files with multiple custom classes. When merging them without any Merge function defined, we end up with one cycle per custom class and file in the output file, and this makes it very hard to check e.g. what histograms are in the files.

For some of the custom classes writing a Merge function solved this, but we have some classes that are creating some issues as it seems that at the end of the merging TList::Delete is being called and this seems to cause a crash:

 *** Break *** segmentation violation
Fatal in <TFileMerger::RecursiveRemove>: Output file of the TFile Merger (targeting gaddtest.root) has been deleted (likely due to a TTree larger than 100Gb)
aborting
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[/opt/local/libexec/root6/lib/root/libCore.6.34.08.so] TList::Delete(char const*) (no debug info)
[/opt/local/libexec/root6/lib/root/libRIO.6.34.08.so] TFileMerger::MergeOne(TDirectory*, TList*, int, TFileMergeInfo&, TString&, THashList&, bool&, bool&, TString const&, TDirectory*, TFile*, TKey*, TObject*, TIter&) (no debug info)
[/opt/local/libexec/root6/lib/root/libRIO.6.34.08.so] TFileMerger::MergeRecursive(TDirectory*, TList*, int) (no debug info)
[/opt/local/libexec/root6/lib/root/libRIO.6.34.08.so] TFileMerger::PartialMerge(int) (no debug info)

I tried clearing the input list in the Merge function, but that doesn’t change anything. So I was wondering whether there is any way to exclude specific classes from being merged.

I tried to find some more information about the Merge function, but either the links were broken or the webpages were marked as deprecated.

Maybe list->SetOwner(false) helps.

If not, there is this PR: [hadd] add option to specify which objects should (not) be merged by marianstahl · Pull Request #5995 · root-project/root · GitHub

list->SetOwner(false) did not help, but the PR did help. Thank you @ferhue!

1 Like

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