Hadd problems (with TFolders?)

Hi all,

I’m trying to merge files with the exact same folder/histogram structure, but hadd fails leaving me none the wiser, can someone clue me in on what might be wrong…

mdj@hepmac-mdj output> hadd -f final.root output1.root output2.root
Target file: final.root
Source file 1: output1.root
Source file 2: output2.root
Target path: final.root:/
Cannot merge object type, name: Analysis title: Analysis Folder

I use the following elements: TFolders, TH1, TH2, TH3 and TProfiles, nothing else for now.

The first level directory structure (TFolders can contain other TFolders with histograms and TFolders…):
mdj@hepmac-mdj output> root output1.root
root [0]
Attaching file output1.root as _file0…
root [1] _file0.ls()
TFile** output1.root
TFile* output1.root
KEY: TFolder Analysis;1 Analysis Folder
root [2] Analysis.ls()
TFolder* Analysis Analysis Folder
TFolder* Calorimeters
TFolder* Liquid Argon Calorimeters
OBJ: TProfile LAr Layer 2 dEdx LAr Layer 2 dEdx : 0 at: 0x102ca52d0
OBJ: TH2F LAr Layer 2 dEdx Scatter LAr Layer 2 dEdx Scatter : 0 at: 0x102c88510
TFolder* Tile Calorimeters
OBJ: TProfile Tile Layer 2 dEdx Tile Layer 2 dEdx : 0 at: 0x102ca0e50
OBJ: TH2F Tile Layer 2 dEdx Scatter Tile Layer 2 dEdx Scatter : 0 at: 0x102ca1da0
TFolder* Low momentum dEdx
OBJ: TH2F Calo pixel Calo pixel : 0 at: 0x102ca2390
OBJ: TH2F Calo SCT Calo SCT : 0 at: 0x102ca28e0
OBJ: TH2F Calo TRT Calo TRT : 0 at: 0x102ca2e30
OBJ: TH2F Calo ps Calo ps : 0 at: 0x102ca3380
OBJ: TH2F Calo em1 Calo em1 : 0 at: 0x102ca38b0
OBJ: TH2F Calo em2 Calo em2 : 0 at: 0x102ca3e00
OBJ: TH2F Calo em3 Calo em3 : 0 at: 0x102d00000
OBJ: TH2F Calo tile1 Calo tile1 : 0 at: 0x102d00390
OBJ: TH2F Calo tile2 Calo tile2 : 0 at: 0x102d00890
OBJ: TH2F Calo tile3 Calo tile3 : 0 at: 0x102d00de0
OBJ: TH2F Calo hec0 Calo hec0 : 0 at: 0x102d01330
OBJ: TH2F Calo hec1 Calo hec1 : 0 at: 0x102d01880
OBJ: TH2F Calo hec2 Calo hec2 : 0 at: 0x102d01dd0
OBJ: TH2F Calo hec3 Calo hec3 : 0 at: 0x102d02320
OBJ: TH2F Calo Muon Calo Muon : 0 at: 0x102d02870
TFolder* Pixel detector
OBJ: TProfile Pixel 2 dEdx Pixel 2 dEdx : 0 at: 0x102d02ea0
OBJ: TH2F Pixel dEdx Scatter Pixel dEdx Scatter : 0 at: 0x102d03460
TFolder* TRT detector
OBJ: TH1F Bits over threshold Bits over threshold : 0 at: 0x102d03a10
OBJ: TH1F Inverse Beta Inverse Beta : 0 at: 0x102d08f00
OBJ: TH2F TRT Bits over Thr vs P TRT Bits over Thr vs P : 0 at: 0x102d09410
OBJ: TH1F last bits last bits : 0 at: 0x102d09940
OBJ: TH2F Pixel dEdx vs TRT ToT Pixel dEdx vs TRT ToT : 0 at: 0x102d09e50
OBJ: TH1F Length in straw Length in straw : 0 at: 0x102d0a380

Cheers,

Morten

Hi Morten,

hadd currently does not support TFolders (because they are not ‘Merge-able’). You will need to write your own code to do the merging.

Cheers
Philippe.

Hi Philippe,

Thanks for the clarification.

I implemented it by looping over my folders and added the histogram manually, it seems to be working :slight_smile:

Have a nice week-end

Morten