TGraph2D error

Hi
i tried run a script in root using .x plot_selected.cxx
i got error as:

[code] Error in TGraph2D::TGraph2D: Cannot open file: RPC 4, 30X30 (H), TGraph2D is Zombie
0
Error in TGraph2D::Paint: Empty TGraph2D
root [1]
*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007fc34337ec8e in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fc34330429e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fc3442315a7 in TUnixSystem::StackTrace() () from /home/raman/Downloads/root/lib/libCore.so
#3 0x00007fc344233e23 in TUnixSystem::DispatchSignals(ESignals) () from /home/raman/Downloads/root/lib/libCore.so
#4
#5 0x00007fc340c2477c in TGraph2D::DistancetoPrimitive(int, int) () from /home/raman/Downloads/root/lib/libHist.so
#6 0x00007fc33fb9e926 in TPad::Pick(int, int, TObjLink*&) () from /home/raman/Downloads/root/lib/libGpad.so
#7 0x00007fc33fb87e5a in TCanvas::Pick(int, int, TObject*) () from /home/raman/Downloads/root/lib/libGpad.so
#8 0x00007fc33fb8b625 in TCanvas::HandleInput(EEventType, int, int) () from /home/raman/Downloads/root/lib/libGpad.so
#9 0x00007fc33e4d663b in TRootCanvas::HandleContainerMotion(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#10 0x00007fc33e4185d8 in TGFrame::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#11 0x00007fc33e3eb30b in TGClient::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#12 0x00007fc33e3eb465 in TGClient::ProcessOneEvent() () from /home/raman/Downloads/root/lib/libGui.so
#13 0x00007fc33e3eb4cd in TGClient::HandleInput() () from /home/raman/Downloads/root/lib/libGui.so
#14 0x00007fc344234508 in TUnixSystem::DispatchOneEvent(bool) () from /home/raman/Downloads/root/lib/libCore.so
#15 0x00007fc3441b8506 in TSystem::InnerLoop() () from /home/raman/Downloads/root/lib/libCore.so
#16 0x00007fc3441ba1c4 in TSystem::Run() () from /home/raman/Downloads/root/lib/libCore.so
#17 0x00007fc34416125f in TApplication::Run(bool) () from /home/raman/Downloads/root/lib/libCore.so
#18 0x00007fc343dc458c in TRint::Run(bool) () from /home/raman/Downloads/root/lib/libRint.so
#19 0x0000000000400f6c in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007fc340c2477c in TGraph2D::DistancetoPrimitive(int, int) () from /home/raman/Downloads/root/lib/libHist.so
#6 0x00007fc33fb9e926 in TPad::Pick(int, int, TObjLink*&) () from /home/raman/Downloads/root/lib/libGpad.so
#7 0x00007fc33fb87e5a in TCanvas::Pick(int, int, TObject*) () from /home/raman/Downloads/root/lib/libGpad.so
#8 0x00007fc33fb8b625 in TCanvas::HandleInput(EEventType, int, int) () from /home/raman/Downloads/root/lib/libGpad.so
#9 0x00007fc33e4d663b in TRootCanvas::HandleContainerMotion(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#10 0x00007fc33e4185d8 in TGFrame::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#11 0x00007fc33e3eb30b in TGClient::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#12 0x00007fc33e3eb465 in TGClient::ProcessOneEvent() () from /home/raman/Downloads/root/lib/libGui.so
#13 0x00007fc33e3eb4cd in TGClient::HandleInput() () from /home/raman/Downloads/root/lib/libGui.so
#14 0x00007fc344234508 in TUnixSystem::DispatchOneEvent(bool) () from /home/raman/Downloads/root/lib/libCore.so
#15 0x00007fc3441b8506 in TSystem::InnerLoop() () from /home/raman/Downloads/root/lib/libCore.so
#16 0x00007fc3441ba1c4 in TSystem::Run() () from /home/raman/Downloads/root/lib/libCore.so
#17 0x00007fc34416125f in TApplication::Run(bool) () from /home/raman/Downloads/root/lib/libCore.so
#18 0x00007fc343dc458c in TRint::Run(bool) () from /home/raman/Downloads/root/lib/libRint.so
#19 0x0000000000400f6c in main ()

Root >
*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007fc34337ec8e in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fc34330429e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fc3442315a7 in TUnixSystem::StackTrace() () from /home/raman/Downloads/root/lib/libCore.so
#3 0x00007fc344233e23 in TUnixSystem::DispatchSignals(ESignals) () from /home/raman/Downloads/root/lib/libCore.so
#4
#5 0x00007fc340c2477c in TGraph2D::DistancetoPrimitive(int, int) () from /home/raman/Downloads/root/lib/libHist.so
#6 0x00007fc33fb9e926 in TPad::Pick(int, int, TObjLink*&) () from /home/raman/Downloads/root/lib/libGpad.so
#7 0x00007fc33fb87e5a in TCanvas::Pick(int, int, TObject*) () from /home/raman/Downloads/root/lib/libGpad.so
#8 0x00007fc33fb8b625 in TCanvas::HandleInput(EEventType, int, int) () from /home/raman/Downloads/root/lib/libGpad.so
#9 0x00007fc33e4d663b in TRootCanvas::HandleContainerMotion(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#10 0x00007fc33e4185d8 in TGFrame::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#11 0x00007fc33e3eb30b in TGClient::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#12 0x00007fc33e3eb465 in TGClient::ProcessOneEvent() () from /home/raman/Downloads/root/lib/libGui.so
#13 0x00007fc33e3eb4cd in TGClient::HandleInput() () from /home/raman/Downloads/root/lib/libGui.so
#14 0x00007fc344234508 in TUnixSystem::DispatchOneEvent(bool) () from /home/raman/Downloads/root/lib/libCore.so
#15 0x00007fc3441b8506 in TSystem::InnerLoop() () from /home/raman/Downloads/root/lib/libCore.so
#16 0x00007fc3441ba1c4 in TSystem::Run() () from /home/raman/Downloads/root/lib/libCore.so
#17 0x00007fc34416125f in TApplication::Run(bool) () from /home/raman/Downloads/root/lib/libCore.so
#18 0x00007fc343dc458c in TRint::Run(bool) () from /home/raman/Downloads/root/lib/libRint.so
#19 0x0000000000400f6c in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007fc340c2477c in TGraph2D::DistancetoPrimitive(int, int) () from /home/raman/Downloads/root/lib/libHist.so
#6 0x00007fc33fb9e926 in TPad::Pick(int, int, TObjLink*&) () from /home/raman/Downloads/root/lib/libGpad.so
#7 0x00007fc33fb87e5a in TCanvas::Pick(int, int, TObject*) () from /home/raman/Downloads/root/lib/libGpad.so
#8 0x00007fc33fb8b625 in TCanvas::HandleInput(EEventType, int, int) () from /home/raman/Downloads/root/lib/libGpad.so
#9 0x00007fc33e4d663b in TRootCanvas::HandleContainerMotion(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#10 0x00007fc33e4185d8 in TGFrame::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#11 0x00007fc33e3eb30b in TGClient::HandleEvent(Event_t*) () from /home/raman/Downloads/root/lib/libGui.so
#12 0x00007fc33e3eb465 in TGClient::ProcessOneEvent() () from /home/raman/Downloads/root/lib/libGui.so
#13 0x00007fc33e3eb4cd in TGClient::HandleInput() () from /home/raman/Downloads/root/lib/libGui.so
#14 0x00007fc344234508 in TUnixSystem::DispatchOneEvent(bool) () from /home/raman/Downloads/root/lib/libCore.so
#15 0x00007fc3441b8506 in TSystem::InnerLoop() () from /home/raman/Downloads/root/lib/libCore.so
#16 0x00007fc3441ba1c4 in TSystem::Run() () from /home/raman/Downloads/root/lib/libCore.so
#17 0x00007fc34416125f in TApplication::Run(bool) () from /home/raman/Downloads/root/lib/libCore.so
#18 0x00007fc343dc458c in TRint::Run(bool) () from /home/raman/Downloads/root/lib/libRint.so
#19 0x0000000000400f6c in main ()

Root > .x plot_selected.cxx
Error in TGraph2D::TGraph2D: Cannot open file: RPC 4, 30X30 (H), TGraph2D is Zombie

*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x00007fc34337ec8e in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fc34330429e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fc3442315a7 in TUnixSystem::StackTrace() () from /home/raman/Downloads/root/lib/libCore.so
#3 0x00007fc344233e23 in TUnixSystem::DispatchSignals(ESignals) () from /home/raman/Downloads/root/lib/libCore.so
#4
#5 0x00007fc340c24411 in TGraph2D::SetPoint(int, double, double, double) () from /home/raman/Downloads/root/lib/libHist.so
#6 0x00007fc340d8f363 in G__G__Hist_108_0_71(G__value*, char const*, G__param*, int) () from /home/raman/Downloads/root/lib/libHist.so
#7 0x00007fc342772a3b in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /home/raman/Downloads/root/lib/libCint.so
#8 0x00007fc342817e11 in G__execute_call () from /home/raman/Downloads/root/lib/libCint.so
#9 0x00007fc3428181fe in G__call_cppfunc () from /home/raman/Downloads/root/lib/libCint.so
#10 0x00007fc3427f8b37 in G__interpret_func () from /home/raman/Downloads/root/lib/libCint.so
#11 0x00007fc3427e5016 in G__getfunction () from /home/raman/Downloads/root/lib/libCint.so
#12 0x00007fc3428cf790 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /home/raman/Downloads/root/lib/libCint.so
#13 0x00007fc3428c657a in G__getvariable () from /home/raman/Downloads/root/lib/libCint.so
#14 0x00007fc3427be80b in G__getitem () from /home/raman/Downloads/root/lib/libCint.so
#15 0x00007fc3427c4ef4 in G__getexpr () from /home/raman/Downloads/root/lib/libCint.so
#16 0x00007fc342848746 in G__exec_statement () from /home/raman/Downloads/root/lib/libCint.so
#17 0x00007fc342850742 in G__exec_loop(char const*, char*, std::list<G__FastAllocString, std::allocator<G__FastAllocString> > const&) [clone .constprop.69] () from /home/raman/Downloads/root/lib/libCint.so
#18 0x00007fc3428496ff in G__exec_statement () from /home/raman/Downloads/root/lib/libCint.so
#19 0x00007fc3427aae53 in G__exec_tempfile_core () from /home/raman/Downloads/root/lib/libCint.so
#20 0x00007fc3427ac60b in G__exec_tempfile () from /home/raman/Downloads/root/lib/libCint.so
#21 0x00007fc342859953 in G__process_cmd () from /home/raman/Downloads/root/lib/libCint.so
#22 0x00007fc3441fba3a in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/raman/Downloads/root/lib/libCore.so
#23 0x00007fc3441f2433 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/raman/Downloads/root/lib/libCore.so
#24 0x00007fc344164604 in TApplication::ExecuteFile(char const*, int*, bool) () from /home/raman/Downloads/root/lib/libCore.so
#25 0x00007fc34416333f in TApplication::ProcessLine(char const*, bool, int*) () from /home/raman/Downloads/root/lib/libCore.so
#26 0x00007fc343dc3b69 in TRint::HandleTermInput() () from /home/raman/Downloads/root/lib/libRint.so
#27 0x00007fc344232e4c in TUnixSystem::CheckDescriptors() () from /home/raman/Downloads/root/lib/libCore.so
#28 0x00007fc344234596 in TUnixSystem::DispatchOneEvent(bool) () from /home/raman/Downloads/root/lib/libCore.so
#29 0x00007fc3441b8506 in TSystem::InnerLoop() () from /home/raman/Downloads/root/lib/libCore.so
#30 0x00007fc3441ba1c4 in TSystem::Run() () from /home/raman/Downloads/root/lib/libCore.so
#31 0x00007fc34416125f in TApplication::Run(bool) () from /home/raman/Downloads/root/lib/libCore.so
#32 0x00007fc343dc458c in TRint::Run(bool) () from /home/raman/Downloads/root/lib/libRint.so
#33 0x0000000000400f6c in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x00007fc340c24411 in TGraph2D::SetPoint(int, double, double, double) () from /home/raman/Downloads/root/lib/libHist.so

[/code]

my script is plot_selected.cxx
plot_selected.cxx (483 Bytes)

The first error message perfectly explains what you are doing wrong: when you use this ctor, the first argument
is the file name, the second is a format for scanf-like reading. This constructor tries to open the file (not found in you case) and reads the data.
So in your case

is all you need.

Thanks i used

but now i am getting error as:
Error: Bad source file(unnamed macro) /home/raman/Downloads/root/./plot_selected.cxx plot_selected.cxx:1:
unnamed macro has to be executed by ‘x’ command
*** Interpreter error recovered ***

[quote=“raman”]Thanks i used

but now i am getting error as:
Error: Bad source file(unnamed macro) /home/raman/Downloads/root/./plot_selected.cxx plot_selected.cxx:1:
unnamed macro has to be executed by ‘x’ command
*** Interpreter error recovered ***[/quote]

Hmm, please, do not hesitate, execute an unnamed macro with .x command as suggested!

hi
i used the

but i still got error as:
Error: Bad source file(unnamed macro) /home/raman/Downloads/root/./plot_selected.cxx plot_selected.cxx:1:
unnamed macro has to be executed by ‘x’ command
*** Interpreter error recovered ***

[quote=“raman”]hi
i used the

but i still got error as:
Error: Bad source file(unnamed macro) /home/raman/Downloads/root/./plot_selected.cxx plot_selected.cxx:1:
unnamed macro has to be executed by ‘x’ command
*** Interpreter error recovered ***[/quote]

Oh indeed , I was using ROOT 6 and did not realise - fix is simple: remove a new line (empty line) you have before the opening ‘{’.

Thanks ,now it worked. :smiley: