Get entries from chain

Right before “elasticchain->GetEntry(jentry);”, try to add:
elasticchain->LoadTree(jentry);

If it doesn’t help, see: Create TH2F gamma-gamma matrix from TTree/TChain data