Segmentation fault with TTreeReader

Dear experts,

I am reading a ROOT file containing many branches using a set of TTreeReaderValue and TTreeReaderArray.
I get the complete list of the needed ReaderValues and ReaderArrays by opening the file and calling MakeSelector on the tree. Then I copy the list of readers into my code.

If I use the full list of readers (one per each branch), everything works fine. But as soon as I comment out some of the unneeded readers, the code crashes with a bus error.

Moreover, I cannot identify a single line that, when commented, makes the code crash.
For example, referring to the code attached, I see that

  1. if I comment only the readers Electron_* (ll. [25 - 66]) the code works fine
  2. if in addition I comment the bool branches at ll. [358 - 982] it crashes
  3. if I only comment ll. [358 - 982] the code works fine

The minimal example where I can reproduce this error is attached.
The error appears when calling the method Next().
The file I run on is also attached.

The tree is both created and read with ROOT 6.10/09 .

I also tried to read it with ROOT 6.08/02 and still got the segmentation fault, but for different configurations of commented readers. For example, here the code works fine in case 2) above but crashes in case 1) and also if I do not comment any branch.

Thanks in advance for your help in debugging this issue.

Best regards,

MWE.cpp (88.4 KB)

P.S.: I am not sure the attachment of the ROOT file worked.
I uploaded it in case at the following link:

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