ROOT Version: 5.34 (But also observed with recent versions)
Platform: Linux
Hi, when I am in a TCanvas I can save my Draw-ed object in a C-macro file. Then, if everything is ok I can recover the plot in an interactive ROOT session by doing “.x plot.C”
However, sometimes, when I save the ROOT file some “nan” values are generated which are not properly understood when I execute the macro.
Have you observed something similar? There is a way to bypass this problem?
Yes, I have an idea where the problem is coming from. Actually, some of the points in my TGraph contain “nan” values. This makes no problem to draw the TGraph object, but it makes a problem when saving it to a .C macro. When writing the C-macro, the range of the histogram is nan, nan.
I have saved the TCanvas in a ROOT file. I can redraw by doing
Then I can generate the .C macro with the problem I describe.
There is another problem, I have to replace by hand “Event Viewer” by “Event_Viewer” for the TCanvas variable name (at the beginning of the generated .C macro).
I see the same. Your Canvas is corrupted with NaNs. you should clean that.
From the canvas plot one can even see that the graphics behaves in a strange way:
If you click on the graphs (the blue one for instance) you see weird lines appearing. Even without clicking you can see strange vertical lines on the side of the plot. I would not trust a such plot full of NaN values.
Yes. I was always wondering what are those strange vertical lines on the side of the plot.
But what do you mean by clicking on the blue graph? Which weird lines appear? When you Left-click?
Actually, we use a 3D (X,Y,Z) description and we use NaN to identify if a hit is projected in XY, for example, (X,Y,NaN) is a projected hit on XY. I will need to check that.
I see a problem because your canvas name has a white space in its name but once I have renamed it, the C macro generated with SaveAs works fine for me.