Merging of TLists (or TSeqCollections)

Dear ROOT experts,

When two TLists are merged that themselves contain collections, the TLists and those collections are expected to have the same structure and the content of the collections will be merged, as shown in the cartoon below.

Is it possible to add the feature, that when the name of the collections differ (in the cartoon below let’s say we have “L1” and “L2”), the collections are not merged but appended in the merged TList?

This can be convenient when it is desirable to collect in one root file, and under the same TList, collections (of histograms) that are intended to be kept separate.

Update: with a few small additions in the file TSeqCollections.cxx (attached) I managed to get the behavior that I aimed for. Collections will be merged if they have the same name and structure and appended if they have different names. Problematic would be when collections have partially the same name and partially not, in that case the merging will likely not be meaningful. In the current version of root those collections would be merged regardless of their names. I don’t know if that is a preferred feature of root, but as far as I can see I would favor the change. Also attached is a macro which produces root files with an example output structure. Hadding the output files will show the behavior I am referring to.

Regards,
Jaap

list
---------------------|
| L1 (TSeqCollection)|- [A1, B1(C1,D1,E1)]
| L1 (TSeqCollection)|- [A2, B2(C2,D2,E2)]
| … |- […]
|_________________|
TSeqCollection.cxx (10.1 KB)
mergetest.C (760 Bytes)

May be you ca add a request in the Jira Data base (click on “in Jira” in the forum’s top page).