Dear Experts:
I try to read in a ntuple object in this macro but get a segmentation fault when execute run -x test.mac. There is no Error when i type in the command lines in root session. How could this happen?
{
TFile f("Neutron_001eV_LiF_1mm.root");
TNtuple* ntuple = (TNtuple*)f.Get("SimResults");
ntuple->GetEntry(0);
float* row = ntuple->GetArgs();
if(row == nullptr) std::cout << "it is null" << std::endl;
else std::cout << row[0] << row[1] << row[2]<<std::endl;
}
The Error Message is below:
Processing test.C...
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007fedbe177457 in __GI___waitpid (pid=1132, stat_loc=stat_loc
entry=0x7ffe03a1fc28, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1 0x00007fedbe0e2177 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2 0x00007fedbe77b813 in TUnixSystem::StackTrace() () from /usr/local/root6.22_install/lib/libCore.so
#3 0x00007fedbe77e305 in TUnixSystem::DispatchSignals(ESignals) () from /usr/local/root6.22_install/lib/libCore.so
#4 <signal handler called>
#5 0x00007fedbeea222a in ?? ()
#6 0x00007fedbeea2200 in ?? ()
#7 0xf5c8a06fe8ec0d00 in ?? ()
#8 0x00007ffe03a226f0 in ?? ()
#9 0x00005619f809ea90 in ?? ()
#10 0x00005619f809ea90 in ?? ()
#11 0x00007fedb96737e8 in cling::MultiplexInterpreterCallbacks::EnteringUserCode() () from /usr/local/root6.22_install/lib/libCling.so
#12 0x00007ffe03a232b0 in ?? ()
#13 0x00007fedbeea2200 in ?? ()
#14 0x00007fedb96e66c0 in cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const () from /usr/local/root6.22_install/lib/libCling.so
#15 0x00007fedb96753e6 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/local/root6.22_install/lib/libCling.so
#16 0x00007fedb9676559 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/local/root6.22_install/lib/libCling.so
#17 0x00007fedb96767da in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /usr/local/root6.22_install/lib/libCling.so
#18 0x00007fedb9737e0f in cling::MetaProcessor::readInputFromFile(llvm::StringRef, cling::Value*, unsigned long, bool) () from /usr/local/root6.22_install/lib/libCling.so
#19 0x00007fedb95f0c84 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/local/root6.22_install/lib/libCling.so
#20 0x00007fedb95f1762 in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /usr/local/root6.22_install/lib/libCling.so
#21 0x00007fedbe61f438 in TApplication::ExecuteFile(char const*, int*, bool) () from /usr/local/root6.22_install/lib/libCore.so
#22 0x00007fedbe61ec60 in TApplication::ProcessLine(char const*, bool, int*) () from /usr/local/root6.22_install/lib/libCore.so
#23 0x00007fedbebf6fd2 in TRint::ProcessLineNr(char const*, char const*, int*) () from /usr/local/root6.22_install/lib/libRint.so
#24 0x00007fedbebf88c9 in TRint::Run(bool) () from /usr/local/root6.22_install/lib/libRint.so
#25 0x00005619f5e06a0c in main ()
===========================================================
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 0x00007fedbeea222a in ?? ()
#6 0x00007fedbeea2200 in ?? ()
#7 0xf5c8a06fe8ec0d00 in ?? ()
#8 0x00007ffe03a226f0 in ?? ()
#9 0x00005619f809ea90 in ?? ()
#10 0x00005619f809ea90 in ?? ()
#11 0x00007fedb96737e8 in cling::MultiplexInterpreterCallbacks::EnteringUserCode() () from /usr/local/root6.22_install/lib/libCling.so
#12 0x00007ffe03a232b0 in ?? ()
#13 0x00007fedbeea2200 in ?? ()
#14 0x00007fedb96e66c0 in cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const () from /usr/local/root6.22_install/lib/libCling.so
#15 0x00007fedb96753e6 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/local/root6.22_install/lib/libCling.so
#16 0x00007fedb9676559 in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/local/root6.22_install/lib/libCling.so
#17 0x00007fedb96767da in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /usr/local/root6.22_install/lib/libCling.so
#18 0x00007fedb9737e0f in cling::MetaProcessor::readInputFromFile(llvm::StringRef, cling::Value*, unsigned long, bool) () from /usr/local/root6.22_install/lib/libCling.so
_ROOT Version: 6-22-02
_Platform: Ubuntu 18.04
_Compiler: gcc 10.2.0
___[HotBeam_Neutron_LiF.root|attachment]
The root file is too big , so i upload this smaller one, they have the same structure.
(upload://dkVnussj8Al5k4QtOfXjYQga9pl.root) (230.9 KB)