Need help in my application

I have attached my root program where I plot the energy deposit vs depth. I use Geant4 simulation to generate data files. If I plot for 100000 events from my data file this program works fine. But I need to run 140009 events. Then I get this error.
root [0] .x TotEVsXYZAll_hexc.C
Number of events process: 100001
Error: Symbol x5et[i] is not defined in current scope FILE:TotEVsXYZAll_hexc.C LINE:85
Error: Binary operator oprand missing FILE:TotEVsXYZAll_hexc.C LINE:85

*** Break *** segmentation violation
My data file is about 40 MB.
Will you be able to help me.
Thank you
TotEVsXYZAll_hexc.C (3.15 KB)

Have you tried compiling this script with ACLiC and running
the compiled version?