_ROOT Version:6.20/02
_Platform:CentOS-7-x86_64
_Compiler:gcc 9.2 (I’m not sure but I install root from epel)
In a macro ,when I read a TTree from a TFile small and after some operation I want to write a new tree to a new TFile GS, I get the following wrong
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
gdb.printing.register_pretty_printer(gdb.current_objfile(),
gdb.printing.register_pretty_printer(gdb.current_objfile(),
#0 0x00007fc935be041c in waitpid () from /lib64/libc.so.6
#1 0x00007fc935b5df12 in do_system () from /lib64/libc.so.6
#2 0x00007fc9366bd0cc in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.20
#3 0x00007fc9366bfa9c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.6.20
#4 <signal handler called>
#5 0x00007fc935ee2be8 in main_arena () from /lib64/libc.so.6
#6 0x00007fc936e7e102 in ?? ()
#7 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
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 0x00007fc935ee2be8 in main_arena () from /lib64/libc.so.6
#6 0x00007fc936e7e102 in ?? ()
#7 0x0000000000000000 in ?? ()
===========================================================
My code about I/O is just as following
#define Digit 10201
//definition
TFile*small=new TFile("small.root","UPDATE");
TTree*Gau=new TTree("Gaussian","Gaussian");
Float_t gau[Digit]={};
TTree*tree;
small->GetObject("tree",tree);
//set branch
EVENT event;
tree->SetBranchAddress("m_NpartA",&event.m_NpartA);
int M=0;
tree->SetBranchAddress("m_NpartB",&event.m_NpartB);
tree->SetBranchAddress("m_XA",event.m_XA);
tree->SetBranchAddress("m_XB",event.m_XB);
tree->SetBranchAddress("m_YA",event.m_YA);
tree->SetBranchAddress("m_YB",event.m_YB);
Gau->Branch("Gaussian",gau,"gau[10201]/F");
//then some operations with tree and Gau are done
//write the tree
small->Close();
TFile*GS=new TFile("GS.root","RECREATE");
Gau->Write();
GS->Close();
In addition, if I remove the
Gau->Write();
Then everything is ok.