Trouble with vector<vector<double> > using Refle


I’m trying to read vector<vector > tree branches in pyroot. These are made with Reflex dictionaries, so I need to use these to avoid possible data corruption, and I’m using ROOT version 5.18/00d to be consistent with the (ATLAS) collaboration software that produced the ntuple. With lines like this:

[code]## Two lines recommended by collaboration experts for loading Reflex dictionaries
import PyCintex

Rest of the macro

import ROOT
_file0 = ROOT.TFile.Open(“TestNtupleOutput.root”)
tree = _file0.Get(“ZTree”)
for event in tree:
blah = tree.Zee_m # This is a vector : It’s fine
print blah
blahblah = tree.Zee_element_pt # vector<vector > : It breaks
print blahblah[/code]
I get this error:

<ROOT.vector<double> object at 0xa494e18> Traceback (most recent call last): File "./", line 45, in <module> blahblah = tree.Zee_element_pt AttributeError: type object 'ROOT' has no attribute 'vector<vector<double> >'

Now, I’ve done some checking, and the library is apparently there. In particular, if I load the file (to force loading of the dictionaries), print ROOT.gROOT.GetListOfClasses().FindObject("vector<vector<double> >") gives a perfectly good non-null value. However, print getattr(ROOT,'vector<vector<double> >') indeed throws an AttributeError. So somehow the class that would be available in CINT isn’t available in the python ROOT object.

Any ideas? Please let me know if I can post anything more that would be of help.


PS: print getattr(ROOT,'vector<vector<int> >') works fine, it is only vector<vector > which is causing me grief.

I should add: I’ve been specifically instructed not to make the usual LinkDef.h/Loader.C file as instructed here: … highlight= I understand that this would create a CINT dictionary, not a Reflex one. Unless there’s some way to change this behaviour…? (I was using the line ‘gROOT.ProcessLine(’.L Loader.C+’)’ quite successfully until informed of the library mismatch).

Cheers, and sorry for the multiple-posting,


the dictionary for std::vector<std::vector > is not generated in any of the ATLAS dictionaries. Easiest would be to check out the package “Database/AtlasSTLAddReflex” and modify the selection.xml and Dict.h header files and rebuild. (From what I gather from the ChangeLog files, the dict was generated there first and in GaudiPython, then both packages removed the dictionary to prevent having a dupe …)


P.S. Of course, Axel and Philippe should know better, but I don’t see why you couldn’t mix ACLiC-generated and Reflex dictionaries.

[quote]P.S. Of course, Axel and Philippe should know better, but I don’t see why you couldn’t mix ACLiC-generated and Reflex dictionaries.[/quote]Yes there is no problem on the ROOT side (however some experiment library accessing Reflex directly may have additional limitations …).



Thanks for the replys. It does seem odd to me that some people say the libraries are compatible, others say not. For now, I can just use the CINT libraries (I’ve checked that I see no significant data corruption), but the ATLAS dictionaries really should have vector<vector >, it’s a very useful container :slight_smile: