TTree::SetBranchAddress<float>(char const*, float*, TBranch**) ()

Hi All,

After running my code, I have a crash with the error TTree::SetBranchAddress(char const*, float*, TBranch**) (). It seems that the layout inside the brackets missed a third variable. In my code the corresponding line is like: t->SetBranchAddress(“y1”,&Point.y1);
The fact is that I didn’t have this error so far. Is there any chance the new ROOT version affected this?

Thank you.

What kind of an error?
Which ROOT version on which system / compiler?
(The “TBranch**” is an optional parameter so you should not need to use it.)

I currently have the 5.34.30-0ubuntu8. I take the lines below:

There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f6f1c26095c in __libc_waitpid (pid=28347, stat_loc=stat_loc
entry=0x7fffd6278ac0, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1  0x00007f6f1c1e2232 in do_system (line=<optimised out>) at ../sysdeps/posix/system.c:148
#2  0x00007f6f1db8c3a3 in TUnixSystem::StackTrace() () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#3  0x00007f6f1db8e07c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib/x86_64-linux-gnu/libCore.so.5.34
#4  <signal handler called>
#5  0x0000000000403ed1 in int TTree::SetBranchAddress<float>(char const*, float*, TBranch**) ()
#6  0x00000000004031ba in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug 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  0x0000000000403ed1 in int TTree::SetBranchAddress<float>(char const*, float*, TBranch**) ()
#6  0x00000000004031ba in main ()

You source code is needed for inspection.

Thanks a lot for your help! I had to delete the code because it is not only my work.

Try:

// ...

#include "TApplication.h"

int main(int argc, char** argv) {
  TApplication a("a", 0, 0); // just to make sure that the autoloading of ROOT libraries works
  
  if (argc < 2) return 1; // no "filename" provided
  const char *filename = argv[1];
  std::cout << filename << std::endl;
  
  TFile *f = TFile::Open(filename, "update");
  if ((!f) || f->IsZombie()) { delete f; return 2; } // file not usable
  
  TTree *t; f->GetObject("phase", t);
  if (!t) { delete f; return 3; } // tree not found
  
  ProtonPath Point;
  
  // ...

BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your posts have been edited above).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.