How to ignore certain histograms when merging files with hadd?

Dear all,

I would like to merge several root files containing histograms. However, I would not like to merge some of the histograms. The structure of the files is schematically presented below.

I would like to merge all the histograms in “folder1”, while ignoring histograms outside “folder1”, which are all the same in all the files.

|___ folder1

~~~~|__ histogram2
~~~~|__ histogram3
|__ MetaData_EventCount
|__ cutflow1
|__ cutflow2

Is something like this already possible to do with hadd?


May be you can try:

Thanks, rootrm will be particularly useful here to remove some histograms from all but one file.