Help needed!

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?

Hi Russo,
I did not try that. What is ACLiC. How to do that…please tell me.
Thank you

ACLiC is the Automatic Compiler of Libraries for CINT. You will need
to modify your code in few ways:

  1. Remove the “gROOT->Reset();”, if you leave this in it will unload
    your code before it gets a chance to run.

  2. Add #include’s for each data type you use in your code,
    otherwise the compiler will be very unhappy.

  3. Make your script into a function returning void by adding
    "void myfunc()" just before the curly braces at the beginning.

  4. Load and compile your code with “.L source_file.C+”, where
    the plus sign is what causes ACLiC to be used.

  5. Run your code by calling your function from the command line,
    like this: “myfunc();”

Note: You can use .x with the plus sign, but then your function
name has to be the same name as your source code file without
the .C extension, which is not exactly obvious. This is what I
usually do, just because I can do everything with one command,
so it is more convenient.

I did the way you told Russo…but yet did not solved the problem :frowning:

Do you still get exactly the same error message? It not,
could you please post what you get now.

I would also advice you to compile completely outside of root/cint.

That’s what I always do when I have more than 50 lines of code.

You’d be amazed how many mistakes you can make in your code which CINT will never tell you but try to handle it “somehow”.


P.S.: this procedure does not cover memory leaks of course … which might be the cause for your error.

Thank you very much for all the helps given to me.
As Brun pointed out it was not a ROOT problem. I had to change char id[10] into id[100].
!!! :cry: