Problem with get name of files in a TChain

Hi rooters.

I have a code with a TChain, but i need to get name of current file.

I try:

TChain bg = new TChain(“h1”);
bg->Add("fundo/
.root");
filename = bg->GetCurrentFile()->GetName();

When i compile and run my code it return only the first name of file. The detail is that all the archives are processings, but I only obtain the name of the first archive.

I try change ‘GetCurrentFile()->’ by ‘GetFile()->’ and this return same results.

I need a suggest for solving this problem.

Thanks for all.

Marco A. A. Pacheco

You must call GetEntry(i) to force loading the files. Only after GetEntry you call call
chain->GetCurrentFile()->Getname()

Rene