Merging complex root files with weighting

Hi Guys,

First of all, I would really urgently need help (have to present on monday my results). Is there any possibility that one can merge files and give them a weight in addition. For a file with a simple structure this seems to be quite easy but if you have something like (-> means on step further in the hierarchy)
-> TDirectory
-> -> TList -> TList -> TH
-> -> -> -> TH
-> -> TList -> TList -> TH

its not so easy to merge. I tried to adapt the TFileMerger::MergeRecursive() but it does not work and I am really lost, as I am not used to working with so many pointers.
Attached you find my trial, it takes a directory and then merges defined files in that directory to a specified output. File 1 should be weighted with crossection[0] and file 2 with crossection[1].
Furthermore I put 2 files for trying on this web page

I really need help, anybody an idea how to do this???

MergingWithProperWeighting.C (9.67 KB)


Change line 135-136 into:

TH1* h2 = (TH1*) hobj;
h1->Add( h2 );

Cheers, Axel.