ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
python.Dso.DsoDb Class Reference
Inheritance diagram for python.Dso.DsoDb:
Collaboration diagram for python.Dso.DsoDb:

Public Member Functions

def __init__ (self)
 
def has_type (self, typename)
 
def load_type (self, typename)
 
def rflx_type (self, typename)
 
def visit (self, typename, visitor=None, ctx=None)
 

Public Attributes

 msg
 

Private Attributes

 _rflx_type
 

Detailed Description

The repository of 'rootmap' files (location, content,...) and a set of
operations one can apply on them (load dict, query dicts,...)

Definition at line 42 of file Control/AthenaServices/python/Dso.py.

Constructor & Destructor Documentation

◆ __init__()

def python.Dso.DsoDb.__init__ (   self)

Definition at line 47 of file Control/AthenaServices/python/Dso.py.

47  def __init__(self):
48  super(DsoDb, self).__init__('AthenaDsoDb')
49  import AthenaCommon.Logging
50  self.msg = AthenaCommon.Logging.logging.getLogger("AthenaDsoDb")
51  #self.msg.setLevel(AthenaCommon.Logging.logging.VERBOSE)
52 
53  # inject the known aliases NOW
54  for k,v in _aliases.iteritems():
55  try:
56  self.db[k] = self.db[v]
57  except KeyError:
58  self.msg.info("could not install alias [%s] -> [%s]", k,v)
59  # make sure we'll be able to load dicts
60  import cppyy
61  #self._load_dict = cppyy.loadDict
62  self._rflx_type = cppyy.gbl.RootType.ByName
63  return
64 

Member Function Documentation

◆ has_type()

def python.Dso.DsoDb.has_type (   self,
  typename 
)

Definition at line 65 of file Control/AthenaServices/python/Dso.py.

65  def has_type (self, typename):
66  global _cpp_builtins
67  if typename in _cpp_builtins:
68  return True
69  # need to massage a bit the typename to match ROOT naming convention
70  typename = self._to_rootmap_name (typename)
71  return self.db.has_key (typename) or \
72  self.pf.has_key (typename)
73 

◆ load_type()

def python.Dso.DsoDb.load_type (   self,
  typename 
)

Definition at line 74 of file Control/AthenaServices/python/Dso.py.

74  def load_type (self, typename):
75  rflx_type = self.rflx_type(typename)
76  if not(rflx_type is None):
77  rflx_name = rflx_type.Name(RflxEnums.DICTSCOPE)
78  if rflx_name != '':
79  return rflx_name
80  return None
81 

◆ rflx_type()

def python.Dso.DsoDb.rflx_type (   self,
  typename 
)

Definition at line 82 of file Control/AthenaServices/python/Dso.py.

82  def rflx_type(self, typename):
83  _rootmap_name = self._to_rootmap_name (typename)
84  _rflx_name = self._to_rflx_name (typename)
85  self.msg.verbose("------- loading type [%s]...", typename)
86 
87  global _cpp_builtins
88  if typename in _cpp_builtins:
89  self.msg.verbose(" ==> [ok] (builtin)")
90  return self._rflx_type (_rflx_name)
91 
92  if not self.has_type (_rootmap_name):
93  self.msg.verbose(" ==> [err] (no '%s')",_rootmap_name)
94  return None
95  libs = (self.db.get(_rootmap_name) or
96  self.pf.get(_rootmap_name))
97  if libs is None or len(libs) <= 0:
98  return None
99  from ctypes import cdll
100  _load = cdll.LoadLibrary
101  from cppyy import loadDict as _load
102  lib = libs[0]
103  self.msg.verbose("... %s",lib)
104  _load (os.path.basename(lib.strip()))
105  self.msg.verbose("... %s [done]",lib)
106  self.msg.verbose(" ==> [ok]")
107 
108  # give the non-massaged name to reflex as this is what it expects
109  # ...ROOT is sooo self-consistent...
110  rflx_type = self._rflx_type (_rflx_name)
111  if rflx_type.Name() != '':
112  return rflx_type
113  return None
114 
115 

◆ visit()

def python.Dso.DsoDb.visit (   self,
  typename,
  visitor = None,
  ctx = None 
)

Definition at line 116 of file Control/AthenaServices/python/Dso.py.

116  def visit(self, typename, visitor=None, ctx=None):
117  self.msg.verbose("=== visiting %s", typename)
118  if ctx is None:
119  ctx = set()
120  if isinstance (typename, str):
121  rflx_type = self.load_type (typename)
122  typename = rflx_type.Name (RflxEnums.DICTSCOPE)
123  else:
124  rflx_type = typename
125 
126  if not rflx_type:
127  self.msg.verbose("**warning** no dict for [%s] !!", typename)
128  return ctx
129 
130  ctx.add (typename)
131  if visitor:
132  visitor (rflx_type)
133 
134  if rflx_type.IsClass() or rflx_type.IsStruct():
135  for i in range(rflx_type.BaseSize()):
136  itype = rflx_type.BaseAt(i).ToType()
137  itype_name = itype.Name(RflxEnums.DICTSCOPE)
138  if itype_name != '' and not (itype_name in ctx):
139  self.load_type (itype_name)
140  ctx.add (itype_name)
141  ctx.update (self.visit (itype, visitor, ctx))
142 
143  for i in range(rflx_type.DataMemberSize()):
144  itype = rflx_type.DataMemberAt (i).TypeOf()
145  itype = itype.RawType() if itype.IsPointer() else itype
146  itype_name = itype.Name(RflxEnums.DICTSCOPE)
147  if itype_name != '' and not (itype_name in ctx):
148  self.load_type (itype_name)
149  ctx.add (itype_name)
150  # restore original type
151  itype = rflx_type.DataMemberAt (i).TypeOf()
152  itype_name = itype.Name(RflxEnums.DICTSCOPE)
153  ctx.update (self.visit (itype, visitor, ctx))
154  return ctx
155 

Member Data Documentation

◆ _rflx_type

python.Dso.DsoDb._rflx_type
private

Definition at line 62 of file Control/AthenaServices/python/Dso.py.

◆ msg

python.Dso.DsoDb.msg

Definition at line 50 of file Control/AthenaServices/python/Dso.py.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127