Reading Ttree from ROOT file

I want to read i_th and j_th entry from a Ttree using a for loop, for example:

for (Long64_t entryi = 0; entryi < tree_sig->GetEntries(); ++entryi) {

But this give me break segmentation error. Could you please help me.

First check: are you sure the tree has enough entries for the index you set by hand? (in this case, 5 entries, so that there is an entry number 4)