Please read tips for efficient and successful posting and posting code
ROOT Version: 6.26/00
Platform: arm64 apple m1
Compiler: xcode12
Dear expert,
when I run this macro without grms::SetTitle everything works.
If I define the name of each graph it gives me the error you see below.
Why does this happen?
TCanvas *c2[M];
TGraph *grms[M];
for(int ttc=0; ttc<M; ttc++){
c2[ttc] = new TCanvas( Form("c2_%d",ttc),Form("c2_%d",ttc));
}
for(int ttc=0; ttc<M; ttc++){
grms[ttc]= new TGraph();
for(int bbb=0; bbb<nt; bbb++){
grms[ttc]->SetPoint(bbb, time[ttc][bbb], rms[ttc][bbb]);
}
grms[ttc]->SetName("RMS/t");
//grms[ttc]->SetTitle("Graph RMS/t"); //this work fine but is generic
grms[0]->SetTitle("Itot[uA]");
grms[1]->SetTitle("Ie[uA]");
grms[2]->SetTitle("Ih[uA]");
grms[3]->SetTitle("Ieg[uA]");
grms[4]->SetTitle("Ihg[uA]");
grms[5]->SetTitle("BB[mV]");
grms[6]->SetTitle("CSA[mV]");
grms[7]->SetTitle("Charge[fC]");
grms[ttc]->SetMarkerColor(4);
grms[ttc]->SetMarkerStyle(21);
c2[ttc]->cd();
c2[ttc]->SetGrid();
c2[ttc]->SetTicks();
grms[ttc]->Draw();
// use this methods
grms[ttc]->GetXaxis()->SetTitle("time (ns)");
grms[ttc]->GetYaxis()->SetTitle("rms");
}
Problem is the âBreak Segmentation Violationâ ,there is only when naming curves.
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_0
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_1
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_2
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_3
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_4
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_5
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_6
Warning in <TCanvas::Constructor>: Deleting canvas with same name: c2_7
*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[/Users/roany/Downloads/landaulgad/exam5bc_C.so] graph(char const*) (no debug info)
[<unknown binary>] (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/Users/roany/Downloads/root2/lib/libCling.6.26.00.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/Users/roany/Downloads/root2/lib/libRint.6.26.00.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/Users/roany/Downloads/root2/lib/libRint.6.26.00.so] TRint::HandleTermInput() (no debug info)
[/Users/roany/Downloads/root2/lib/libCore.6.26.00.so] TUnixSystem::CheckDescriptors() (no debug info)
[/Users/roany/Downloads/root2/lib/libCore.6.26.00.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)
[/Users/roany/Downloads/root2/lib/libCore.6.26.00.so] TSystem::InnerLoop() (no debug info)
[/Users/roany/Downloads/root2/lib/libCore.6.26.00.so] TSystem::Run() (no debug info)
[/Users/roany/Downloads/root2/lib/libCore.6.26.00.so] TApplication::Run(bool) (no debug info)
[/Users/roany/Downloads/root2/lib/libRint.6.26.00.so] TRint::Run(bool) (no debug info)
[/users/roany/downloads/root2/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
thanks