Error: C++ exception caught

Hi all,
I don’t understand what is happening in my named script code (called spfasi_plot_v4.C).
It should outputs 4 plots, in the same canvas.

Firstly, I do c->cd(1) and this sub-canvas is filled in the correct way.

Then, I do c->cd(3) and I get the following error:

Error: C++ exception caught C:\root\tutorials\spfasi_plot_v4.C(378) (const void)0 *** Interpreter error recovered ***

The error seems to be at the line 378, but the code has 367 lines only!
If I add “cout<<“hello”<<endl;” before “c->cd(3)”, I get no more errors and the script works as expected.

Do you have any suggestions?

Anna [/code]

You forgot to post your script. Make sure that we can execute it.


I was hoping you can give me general suggestions…
Now I enclose the script and the files it needs for running, but I fear it is a bit complicated…

On my computer, the spfasi_plot_v4.C file is in C:\root\tutorials, while the other two files stay in C:\root.

spfasi_plot_v4.C (12.7 KB)
meas_distribution.txt (648 KB)
twisspara.txt (890 Bytes)

You have an error in your code at lines:
char hgeom_name[40]; sprintf(hgeom_name,"#font[42]{Geometrical emittance surface @ %.0f%%}",P);
The sprintf is writing more than 40 chars in hgeom_name. Increase the dimension.