Problem with multiple file fill a new Tree + MLP

Hi,

This is actually part of my project. My project is to build a MLP.
I’m a newbie to programming.

Suituation:
I have multiple files in seperate directories.
In each file there is a TTree with same name.
In the TTree, there is lots of variables.

Problem
I need a TTree(merged from multiple files)
with selected variable. (not all)
I want a loop to set all TTree in multiple file
and set the variable branches statues to 1,
SetBranchAddress,
then Get Entry and fill them into a new TTree (for input to MLP)

I did try with loops, but it turn out lot of errors
so I try to break some loops and type each line myself.
but it turn out error TTree fill
my code in Attachment.

So I need some help on this error,
n how can I modify it using loops, so i can set all setting
without everytime changing the code itself.
or maybe should I do it in a different method?

Thanks
mlpbuild.C (2.55 KB)

At a first glnce, your code looks correct, except that you should replace

for (i=1; i<nbg; i++){ by

for (i=0; i<nbg; i++){

To analyze your problem further, we neec a copy of your files.
Could you post them in a public area (afs or http)?

Rene