Appending Root files

Hello,

How could i append several root files .
They have the same structure, such as directories and ntuples., and i wish i coud keep
the same structure .

Thanks a lot.

Use $ROOTSYS/bin/hadd

hadd result.root file1.root file2.root … fileN.root

Rene

Sorry,
it did not work, the new.root was composed only by the first file.

$ hadd new.root file1.root file2.root
Target file: new.root
Source file 1: file1.root
Source file 2: file2.root
Found subdirectory ELECTRON
Unknown object type, name: h101 title: e-id

where ELECTRON is a directory inside both files, and h101 is a ntuple inside ELECTRON, that also exists in both files.

I wish the new.root file to have the same directory ELECTRON with a new ntuple called h101, where thie new h101 is composed by the appending of the two old ntuples h101.

Thanks a lot

This simple case should work.
It looks like you are using a very old version of ROOT

Rene

Hi,

so as I will do it manually,

how do i write a tuple to a TDirectory and then write it to a file.

dir.Write();
saves the directory in the opened file, but how do i write the tuple to the
directory?

thanks a lot.

see the tree*.C examples in the tutorials

Rene