GetEntry() crash in Root

Hi,

I am trying to access the data from the branches of a root file in tree structure. However, when I try to use the GetEntry(0) command, the terminal crashes. This is the message I get. What could be the issue?

*.........................................................................*
root [4] Float_t A,B,C;
root [5] SCD_data->SetBranchAddress("ADC",&A);
root [6] SCD_data->SetBranchAddress("ped",&B);
root [7] SCD_data->SetBranchAddress("ped_rms",&C);
root [8] cout << A << "\t" << B << "\t" << C << endl;
0       0       0
root [9] SCD_data->GetEntry(1);

 *** 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  0x00007f9ef78f460c in waitpid () from /lib64/libc.so.6
#1  0x00007f9ef7871f62 in do_system () from /lib64/libc.so.6
#2  0x00007f9ef83daa6c in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.24
#3  0x00007f9ef83dc98a in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.6.24
#4  <signal handler called>
#5  0x00007f9ef5c91e35 in TBufferFile::ReadFastArray(float*, int) () from /usr/lib64/root/libRIO.so
#6  0x00007f9ee80461f3 in TBranch::GetEntry(long long, int) () from /usr/lib64/root/libTree.so.6.24.06
#7  0x00007f9ee80abaa7 in TTree::GetEntry(long long, int) () from /usr/lib64/root/libTree.so.6.24.06
#8  0x00007f9ef8aea050 in ?? ()
#9  0x00007ffd2fc10a50 in ?? ()
#10 0xa27ae88cf3d2b500 in ?? ()
#11 0x00007ffd2fc10ae0 in ?? ()
#12 0x00000000020b7dc8 in ?? ()
#13 0x0000000001d74290 in ?? ()
#14 0x00007ffd2fc10f50 in ?? ()
#15 0x00007f9ee83103f0 in vtable for TTree () from /usr/lib64/root/libTree.so.6.24.06
#16 0x00007ffd2fc10f50 in ?? ()
#17 0x0000000003460598 in ?? ()
#18 0x00007f9ef0ca499e in cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const () from /usr/lib64/root/libCling.so
#19 0x00007f9ef0c2d0a0 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/lib64/root/libCling.so
#20 0x00007f9ef0c2e050 in cling::Interpreter::EvaluateInternal(std::string const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/lib64/root/libCling.so
#21 0x00007f9ef0c2e2f3 in cling::Interpreter::process(std::string const&, cling::Value*, cling::Transaction**, bool) () from /usr/lib64/root/libCling.so
#22 0x00007f9ef0d012b7 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /usr/lib64/root/libCling.so
#23 0x00007f9ef0b5f4ca in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /usr/lib64/root/libCling.so
#24 0x00007f9ef0b72f22 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /usr/lib64/root/libCling.so
#25 0x00007f9ef82a479a in TApplication::ProcessLine(char const*, bool, int*) () from /usr/lib64/root/libCore.so.6.24
#26 0x00007f9ef876dd5f in TRint::ProcessLineNr(char const*, char const*, int*) () from /usr/lib64/root/libRint.so.6.24
#27 0x00007f9ef876e0fb in TRint::HandleTermInput() () from /usr/lib64/root/libRint.so.6.24
#28 0x00007f9ef83dbd85 in TUnixSystem::CheckDescriptors() () from /usr/lib64/root/libCore.so.6.24
#29 0x00007f9ef83dd05a in TUnixSystem::DispatchOneEvent(bool) () from /usr/lib64/root/libCore.so.6.24
#30 0x00007f9ef8302e66 in TSystem::InnerLoop() () from /usr/lib64/root/libCore.so.6.24
#31 0x00007f9ef8303de0 in TSystem::Run() () from /usr/lib64/root/libCore.so.6.24
#32 0x00007f9ef82a2b6f in TApplication::Run(bool) () from /usr/lib64/root/libCore.so.6.24
#33 0x00007f9ef876f6b9 in TRint::Run(bool) () from /usr/lib64/root/libRint.so.6.24
#34 0x00000000004008ea in main ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at 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  0x00007f9ef5c91e35 in TBufferFile::ReadFastArray(float*, int) () from /usr/lib64/root/libRIO.so
#6  0x00007f9ee80461f3 in TBranch::GetEntry(long long, int) () from /usr/lib64/root/libTree.so.6.24.06
#7  0x00007f9ee80abaa7 in TTree::GetEntry(long long, int) () from /usr/lib64/root/libTree.so.6.24.06
#8  0x00007f9ef8aea050 in ?? ()
#9  0x00007ffd2fc10a50 in ?? ()
#10 0xa27ae88cf3d2b500 in ?? ()
#11 0x00007ffd2fc10ae0 in ?? ()
#12 0x00000000020b7dc8 in ?? ()
#13 0x0000000001d74290 in ?? ()
#14 0x00007ffd2fc10f50 in ?? ()
#15 0x00007f9ee83103f0 in vtable for TTree () from /usr/lib64/root/libTree.so.6.24.06
#16 0x00007ffd2fc10f50 in ?? ()
#17 0x0000000003460598 in ?? ()
#18 0x00007f9ef0ca499e in cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const () from /usr/lib64/root/libCling.so
#19 0x00007f9ef0c2d0a0 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/lib64/root/libCling.so
#20 0x00007f9ef0c2e050 in cling::Interpreter::EvaluateInternal(std::string const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/lib64/root/libCling.so
#21 0x00007f9ef0c2e2f3 in cling::Interpreter::process(std::string const&, cling::Value*, cling::Transaction**, bool) () from /usr/lib64/root/libCling.so
#22 0x00007f9ef0d012b7 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) () from /usr/lib64/root/libCling.so
#23 0x00007f9ef0b5f4ca in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /usr/lib64/root/libCling.so
===========================================================

In the stack we see evidence that at least one of the branch you are reading is an array. Its data does not fit into the single float passed to SetBranchAddress leading to memory over-writes.

Consider using RDataFrame which would avoid this problem. Alternatively look at the result of MakeSelector call on your TTree to see how to use the TTreeReader. Or look at the result of SCD_data->Print() to get an idea of what needs to be passed to SetBranchAddress