How to access a specific element (string) in TTree Branch?

I’m looking for a way to access a specific element (string) of a branch.

Let’s say I have a branch called “voltage” and I’m looking for a way to access the 10th element of the branch. If the branch contains double or int, for example, it seems I can normally do:

However, when I try to access a branch containing strings I get a segmentation violation.

How can I access elements of a branch containing strings?

Hi,

what did you store in the tree? Can you post the root file?

Cheers,
Danilo

I think I managed to obtain what I wanted (It seems this was due to my unfamiliarity with TTrees).

I’m using a MakeClass Analyzer. I’ve discovered it is sufficient to run:

fChain->GetEntry(10); std::cout << voltage << std::endl;

to access the 10th element of the “voltage” branch.