Hadding root files with a TFolder structure

I am trying to hadd multiple root files that all contain a structure of TFolders. Inside the TFolders (and subfolders) are histograms.
Each root file was generated by the same code, so all histogram names are identical.
Hadd does not seem to like TFolders I suppose? Is there a way these files can be merged?


Welcome to the ROOT forum

May be @pcanal has some ideas about it.
As far as I know hadd is recursive…

Can you upload two of these files, and the command you use for hadding ?

But it seems that this is not supported: Hadd problems (with TFolders?) and RootTalk: [ROOT] Re: hadd on files with folders

There is: https://its.cern.ch/jira/browse/ROOT-5877

Indeed,TFolder is not supported by hadd at the moment and would require the implementation of TFolder::Merge.

OK thank you for the confirmation guys.

I’m using a TFolder because its the only way to have any sort of structure on a js-root THttpServer. But sadly the output Sink file then contains a TFolder at the top level, even if everything underneath is TDirectory, so I still can’t hadd this so easily (if desired).

@linev Is there a way to have a structured view of a file containing only TDirectory on a js-root server?

@cej25 Which version of ROOT and js-root are you using?


Sub-directories in the TFile are supported by the THttpServer.
It can be easily tested with basic tutorials/http/httpserver.C example.

Just add creation of the sub-directory after creation of the file:

TFile *hfile = new TMemFile(filename,"RECREATE","Demo ROOT file with histograms");



All objects will be created in this subdirectory and can be accessed via THttpServer.

Also such file supported by jsroot directly.


@linev Not sure, maybe the top TFolder that the user is mentioning in the output sink file is related to this root/net/http/src/TRootSniffer.cxx at master · root-project/root · GitHub ?

This kind of folder structure is “internal” data management of THttpServer.
As I understand, question was using of files with sub-directories - which can be produced by hadd.
I see no problem here.

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