I have a ROOT file which contains a tree as shown above. I tried to print the entries of a variable (for example, Px) using the following code.
root[0] TFile f("ampt_afterART.root");
root[1] TTree* t;
root[2] f.GetObject("AMPT;1",t);
root[3] float px;
root[4] t->SetBranchAddress("Px",&px);
root[5] int k;
root[6] for (k=0; k<t->GetEntries(); {t->GetEntry(k); cout<<px<<endl;}
However I got the following error:
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f96a1b08687 in __GI___waitpid (pid=3950, stat_loc=stat_loc
entry=0x7ffd260618e8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007f96a1a73067 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2 0x00007f96a2717cc3 in TUnixSystem::StackTrace() () from /home/recaptcha19/Downloads/ROOT6/root/lib/libCore.so.6.18
#3 0x00007f96a271a6b4 in TUnixSystem::DispatchSignals(ESignals) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libCore.so.6.18
#4 <signal handler called>
#5 0x00007f96a053a971 in TBufferFile::ReadFastArray(float*, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libRIO.so
#6 0x00007f9694185345 in TBranch::GetEntry(long long, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#7 0x00007f96941f9e88 in TTree::GetEntry(long long, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#8 0x00007f96a2ef6101 in ?? ()
#9 0x0000000000000015 in ?? ()
#10 0x0a660d27f4bb4100 in ?? ()
#11 0x0000561c0fffbd30 in ?? ()
#12 0x00007f96941f9dc0 in ?? () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#13 0x0000561c0ffd8078 in ?? ()
#14 0x0000561c0ebb88d0 in ?? ()
#15 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 0x00007f96a053a971 in TBufferFile::ReadFastArray(float*, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libRIO.so
#6 0x00007f9694185345 in TBranch::GetEntry(long long, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#7 0x00007f96941f9e88 in TTree::GetEntry(long long, int) () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#8 0x00007f96a2ef6101 in ?? ()
#9 0x0000000000000015 in ?? ()
#10 0x0a660d27f4bb4100 in ?? ()
#11 0x0000561c0fffbd30 in ?? ()
#12 0x00007f96941f9dc0 in ?? () from /home/recaptcha19/Downloads/ROOT6/root/lib/libTree.so.6.18.02
#13 0x0000561c0ffd8078 in ?? ()
#14 0x0000561c0ebb88d0 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================
Root >
How do I rectify this?