Hi all,
I had a script properly running on my XP Windows computer, using ROOT 5.15.08.
I had to move it on a new XP Windows computer, where I installed ROOT 5.18.00. Now it crashes very often. Not always, but very often. I enclose to this post the snapshoot of the ROOT terminal, with the errors message.
Can somebody help me? Do you think it’s an error due to the different ROOT versions I’m using or something else?
I really have no ideas…
Hi,
I tried to install ROOT on a new XP Windows machine. This time, I installed there the old ROOT release ( 5.15.08 ), the same I have on my computer where my script runs correctly.
…but the script still crashes
I enclose the new message error snapshoot and my script.
Looking forward for some help!
thanks!
anna spfasi_plot_v11.C (23.8 KB)
The problem comes from a char array being too small!
To solve it, please change your following piece of code (note the // <<— comment):
//Add statistical emitt value on the plot
TPaveText *ptrms=new TPaveText (0.15,0.81,0.9,0.91,"NDC");
//NDC: normalized coordinates (x1,y1,x2,y2)
char text[100];
sprintf (text,"#font[42]{#splitline{alpha RMS= %.3g - beta RMS= %.3g m}{Emitt RMS= %.3g #pi#upointmm#upointmrad}}", alpha, beta,emi);
TText *trms=ptrms->AddText(text);
as following:
//Add statistical emitt value on the plot
TPaveText *ptrms=new TPaveText (0.15,0.81,0.9,0.91,"NDC");
//NDC: normalized coordinates (x1,y1,x2,y2)
char text[200]; // <<--- Array size!!!!!
sprintf (text,"#font[42]{#splitline{alpha RMS= %.3g - beta RMS= %.3g m}{Emitt RMS= %.3g #pi#upointmm#upointmrad}}", alpha, beta,emi);
TText *trms=ptrms->AddText(text);
To avoid this kind of problem , you should use this method:
TText *trms=ptrms->AddText(Form("#font[42]{#splitline{alpha RMS= %.3g - beta RMS= %.3g m}{Emitt RMS= %.3g #pi#upointmm#upointmrad}}", alpha, beta,emi));
or to declare large enough char arrays
p.s. Posting images of your error messages can make it difficult for people to see what’s going on. The old dos-style windows do have cut and paste capabilities.
[ul]
click on icon in upper left hand corner, choose Edit->Mark
Highlight the text you want to copy (it will does a rectangle copy so you need to make sure you highlight the full width of the window) and hit Enter.
Paste the text where ever you want it.
[/ul]
Cheers,
Charles
thanks to both you, for both the very useful suggestions!
but the problem is not due to the array length. It still remains…
Computers were I’m trying to install my code are specially “installed” computers. Some Window applications could be not installed there, to improve performances of other running programs.
So, I fear some dll or similar, needed to make Root running, were not installed there.
Is there an easy way to check if the problem is due to that?
I don’t thik this is due to missing DLL, otherwise the message would be “Failed to load missingdll.dll” (or something similar).
It is quite hard to tell what’s hapening… Could you try a newer version of ROOT?