Hello,
Suppose I fill a TTree using a C++ based macro with one of its branches a std::mapstd::string,int. How do you access the different key values of the map? I figured it would’ve been very similar to a python dictionary, but when I try something like this:
import ROOT
f = ROOT.TFile('Output.AANT.root')
t = f.Get('MyTree')
for i in xrange(t.GetEntries()):
t.GetEntry(i)
print t.MAP_NAME["KEY_NAME"].second
or
print t.MAP_NAME["KEY_NAME"]
I keep getting a seg fault:
…
#11 0xf6e78764 in std::map<std::string, int, std::lessstd::string, std::allocator<std::pair<std::string const, int> > >::operator[](std::string const&) ()
from /afs/cern.ch/atlas/software/releases/16.6.3/DetCommon/16.6.3/InstallArea/i686-slc5-gcc43-opt/lib/libCint.so
Traceback (most recent call last):
File “test.py”, line 12, in
print t.MAP_NAME[“KEY_NAME”]
SystemError: problem in C++; program state has been reset
Anyone can help?
Thanks!