Getting access to data in vector<string>

Hi,
I’ve trying to get data from a ROOT file created by someone else. I need to get the detector name from a TLeafElement which contains a vector of strings. I’ve trying just about every TLeafElement method, but can’t seem to get a data type I can work with in python. Any ideas how I can get access to this data? Here’s what TTree.Print() has to say about it.

*............................................................................* *Br 3 :detector : vector<string> * *Entries : 388746 : Total Size= 20975177 bytes File Size = 1656299 * *Baskets : 733 : Basket Size= 32000 bytes Compression= 12.65 * *............................................................................*

I can see the information in TBrowser


Here’s some code that doesn’t work.

detector = tree.GetLeaf('detector') # detector is a ROOT.TLeafElement

#valuepointer is set to a {PyLongBuffer} <Long_t buffer, size l>
valuepointer = detector.GetValuePointer()  

How can a get the data from a {PyLongBuffer} <Long_t buffer, size l>?

Thanks for any help you can provide,

Dennis

Hi dennis,

You can access the strings like this:

for e in tree:
    for s in e.detector:
        print s

Danilo

Thank you Danilo.

This is what I was looking for, and it couldn’t be any easier (Thanks ROOT developers!).