Nothing in the “output”, that you show in your post, suggests that your macro “died” in any way.
Try to add some “debug” lines, e.g.: std::cout << "Before totalPE" << std::endl << std::flush;
Double_t totalPE[fiberNum][numOfVoxels];
std::cout << "After totalPE" << std::endl << std::flush;
There is just one possible problem in the line that you suspect.
Your “Double_t totalPE[768][161616];” is 24MB long.
It is possible that this exceeds your stack size “limit”. Try:
[bash]$ ulimit -S -a
[bash]$ ulimit -H -a
[tcsh]$ limit
[tcsh]$ limit -h
If this is the case, try (note: your new “soft limit” cannot be higher than the “hard limit”):
[bash]$ ulimit -S -s 32768
[tcsh]$ limit stacksize 32768
and then try to run your “root -q …” command again.