Try to modify your loop over all entries (not sure if it is enough, @pcanal would need to confirm):
Long64_t nentries = chain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0; // not really needed
for (Long64_t jentry = 0; jentry < nentries; jentry++) {
Long64_t ientry = chain->LoadTree(jentry);
if (ientry < 0) break; // no new entries (or opening the file failed)
if (ientry == 0) { // the first entry from the (next) file
// ... set all addresses of branches and leaves here ...
}
nb = chain->GetEntry(jentry); nbytes += nb;
// ... analyze this entry here ...
}