I would like to exploit class autoloading (using the rootmap files) as way to avoid the frustration of many users of PyROOT (PyCintex), or ROOT I/O that the dictionary library for a given type is not loaded and in addition they do not know which library has which types. In principle the mechanism existing in ROOT works fine expect for two cases: namespaces and templates.
Look at the following example:
[code]>>> import ROOT
ROOT.ROOT.Math.SVector(‘double’,‘2’)
Traceback (most recent call last):
File “”, line 1, in ?
AttributeError: type object ‘ROOT’ has no attribute ‘Math’
import libPyROOT
libPyROOT.makeRootClass(‘ROOT::Math::SVector<double,2>’)
<class ‘main.ROOT::Math::SVector<double,2>’>
ROOT.ROOT.Math.SVector(‘double’,‘2’)
<class ‘main.ROOT::Math::SVector<double,2>’>
[/code]
In the first attempt, PyROOT does not find the namespace “Math”. ROOT namespace is OK because it is introduced already with libCore. The Math namespace is declared in CINT as type ‘a’ but there is no library associated to load it (this is normal for namespaces). Then, if I look with the complete class name with makeRootClass(), and the autoload mechanism loads the library and everything is fine again.
Similar behaviour will happen with the template ‘SVector’. It is not clear what library you need to load to obtain the right instantiation, which you do not know its name at the time you try to resolve the name ‘Svector’.
Would it be possible to tentatively return a Namespace object (if you find the name declared in CINT with type ‘a’) or a Template call object to be able to reach the next stage and have the chance to compose the complete class name to look for.
Additionaly, it would be nice to allow integers as template arguments. I had to put ‘2’ instead of 2.