Illegal pointer to class object back 0x0 165

Your “Mau AF11225_5x20x20.TKA” and “Khongbia.TKA” data files are also needed in order to run your macro.

The first problem that I see is that you have:
const int n = 2000000;
Double_t y1[n],y[n];
and this uses more than 30MB on “stack” (quite often, the “stack” is limited to something like 8MB).
See, for example: No error when macro crashes

You also try to create two TFile objects with names which end with “.pdf” (which suggests “Adobe PDF” files, not ROOT files).

Notes:

  1. Always try to precompile your macro using ACLiC, in order to find source code problems, e.g. try something like (inspect all reported warnings and errors):
    root [0] .L YourRootMacro.cxx++
  2. You can “debug” many problems using “valgrind”. See, for example: Segmentation Fault depending on linux distribution