Dear ROOTers, I am encountering a problem with TGraphs in the following macro: void grtest() { TGraph *tgVZ=new TGraph(); tgVZ->SetName("tgVZ"); tgVZ->SetPoint(0,1.,1.); tgVZ->SetPoint(1,2.,4.); tgVZ->SetPoint(2,3.,9.); tgVZ->SetPoint(3,4.,16.); gROOT->GetList()->Add(tgVZ); gROOT->ls(); } When I go to draw it, I get a segv, somehow connected to the histogram associated with the TGraph: (4.00/08) root [0] .x grtest.C TROOT* Rint The ROOT of EVERYTHING OBJ: TGraph tgVZ : 0 at: 0x8b3af28 root [1] tgVZ->Draw("ap") <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 Warning in <TH1::Build>: Replacing existing histogram: tgVZ (Potential memory leak). *** Break *** segmentation violation Generating stack trace... (stack trace below) ... Root > root [2] The graph does draw, and I can then repeat the draw command without problems. If I change the name before the first draw command, there is no problem: root [0] .x grtest.C TROOT* Rint The ROOT of EVERYTHING OBJ: TGraph tgVZ : 0 at: 0x8b3aec8 root [1] tgVZ->SetName("ntgVZ") root [2] tgVZ->Draw("ap") Is there something I'm doing wrong with the assignment of the TGraph to the directory? Many thanks, Peter Shanahan 0x42029188 in <unknown> from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/bin/root.exe 0x40b6f3eb in TH1::TH1[not-in-charge](char const*, char const*, int, double, double) at hist/src/TH1.cxx:524 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libHist.so 0x40b87bbd in TH1F::TH1F[in-charge](char const*, char const*, int, double, double) at hist/src/TH1.cxx:6347 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libHist.so 0x40e3a6ee in TGraph::PaintGraph(int, double const*, double const*, char const*) at graf/src/TGraph.cxx:2082 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libGraf.so 0x40e3922b in TGraph::Paint(char const*) at graf/src/TGraph.cxx:1818 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libGraf.so 0x4124c498 in TPad::PaintModified() at gpad/src/TPad.cxx:2734 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libGpad.so 0x4122a14c in TCanvas::Update() at gpad/src/TCanvas.cxx:1791 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libGpad.so 0x4020f48d in TCint::UpdateAllCanvases() at meta/src/TCint.cxx:1106 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x4020c725 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) at meta/src/TCint.cxx:302 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x4020c8cb in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) at meta/src/TCint.cxx:352 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x4020c24d in TCint::EndOfLineAction() at meta/src/TCint.cxx:185 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x41794c6c in TRint::HandleTermInput() at rint/src/TRint.cxx:420 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libRint.so 0x417933ab in TTermInputHandler::Notify() at rint/src/TRint.cxx:102 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libRint.so 0x41795a4d in TTermInputHandler::ReadNotify() at rint/src/TRint.cxx:96 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libRint.so 0x4028bd93 in TUnixSystem::CheckDescriptors() at unix/src/TUnixSystem.cxx:892 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x4028b5d1 in TUnixSystem::DispatchOneEvent(bool) at unix/src/TUnixSystem.cxx:693 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x401cbdd1 in TSystem::InnerLoop() at base/src/TSystem.cxx:317 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x401cbd5a in TSystem::Run() at base/src/TSystem.cxx:285 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x40155331 in TApplication::Run(bool) at base/src/TApplication.cxx:807 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libCore.so 0x41794561 in TRint::Run(bool) at rint/src/TRint.cxx:263 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/lib/libRint.so 0x08048d4e in main + 0xba from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/bin/root.exe 0x42017589 in __libc_start_main + 0x95 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/bin/root.exe 0x08048bf1 in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x31 from /afs/fnal.gov/files/code/e875/general/ROOT/Linux2.4-GCC_3_3/v4-00-08/bin/root.exe Root > ======================================================================= Fermilab MS-220 Phone: (+1) 630 840 8378 P.O. Box 500 Fax: (+1) 630 840 6039 Batavia, IL 60510 USA
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET