Merging ROOT files containing different header?

Dear rooters,

I would like to know if it possible (if it make sense) to merge two root files with different headers (see attached rootfiles)?
By advance
Thank you

PS: I try to do

hadd toto.root ppsim1.root ppsim2.root

and it give this following error :

Target file: toto.root
Source file 1: ppsim1.root
Source file 2: ppsim2.root
Target path: toto.root:/
ppsim1.root tree:Sampler1 entries=1234567890
ppsim2.root tree:Sampler1 entries=1234567890
ppsim1.root tree:Sampler2 entries=1234567890
ppsim2.root tree:Sampler2 entries=1234567890

*** Break *** segmentation violation
/Volumes/MotherShip/geant4/PPSimDev/23628: No such file or directory.
Attaching to process 23628.
Reading symbols for shared libraries . done
Reading symbols for shared libraries … done
0x92a9c189 in wait4 ()

========== STACKS OF ALL THREADS ==========

Thread 1 (process 23628 thread 0x10b):
#0 0x92a9c189 in wait4 ()
#1 0x92a99cd4 in system$UNIX2003 ()
#2 0x008aba61 in TUnixSystem::StackTrace ()
#3 0x008af3e5 in TUnixSystem::DispatchSignals ()
#4 0x008af558 in SigHandler ()
#6 0xc57559c9 in ?? ()
#7 0x00d53bc5 in typeinfo for TStyle ()
Previous frame inner to this frame (gdb could not unwind past this frame)
ppsim2.root (16.6 KB)
ppsim1.root (13.1 KB)

hadd can only merge objects of classes deriving from TObject. In your case you have a TString object that cannot be merged. Changed it to a TobjString.
There was a protection missing in hadd in this case. Now protected in the SVN version.


TString to TObjString works perfectly :smiley:
thank you