10 print(
"StreamerInfoGenerator v1.0.0")
14 self.
blacklist = [
'std::',
'vector<',
'map<',
'queue<',
'list<']
15 self.
type = cppyy.gbl.RootType
16 self.
type.EnableCintex()
17 cppyy.load_library(
'libAtlasSTLAddReflexDict')
19 ROOT.gROOT.ProcessLine(
".autodict")
28 if typename.find(b) == 0:
38 t = self.
type.ByName(typename)
41 if self.
debug:
print(typename,
' is fundamental')
49 exceptions = [
"string::(anonymous)",
"string::(unnamed)"]
56 bind_name = bind_name.replace(
"<",
"['", 1)[::-1].
replace(
">",
"]'", 1)[::-1]
58 base_and_arg = bind_name.split(
"[")
59 base_and_arg[0] = base_and_arg[0].
replace(
"::",
".")
60 bind_name =
"[".
join(base_and_arg)
61 bind_name =
"ROOT." + bind_name
63 print(
"Making class {} -> {}".
format(typename, bind_name))
64 print(
"cl = " + bind_name)
65 exec(
"cl = " + bind_name, globals())
69 if self.
debug:
print(
"appended type to the classlist")
70 except Exception
as ex:
72 if typename
not in exceptions:
75 t = self.
type.ByName(typename)
80 if self.
debug:
print(typename,
' isn\'t complete')
83 if self.
debug:
print(typename,
' is a pointer')
86 underlying = t.ToType()
88 self.
inspect(underlying.Name(7))
91 elif t.IsTemplateInstance():
93 if typename.find(
'std::')==0:
99 for i
in range(t.TemplateArgumentSize()):
100 tt = t.TemplateArgumentAt(i)
102 if tt.IsPointer()
or tt.IsArray()
or tt.IsTypedef():
103 ttname = tt.ToType().Name(7)
110 for i
in range(t.DataMemberSize()):
111 d = t.DataMemberAt(i)
113 dtype = d.TypeOf().Name(7)
115 print(
'DataMember: ', dname,
' ', dtype,
' transient=', d.IsTransient())
116 if not d.IsTransient():
120 print(
'what to do about ', typename,
'?')
130 if __name__ ==
'__main__':
131 from ROOT
import TClass, TFile
133 a.inspect(
'TrigTauClusterContainer_tlp1')