The Gaudi Framework  v32r2 (46d42edc)
GaudiPython.Pythonizations Namespace Reference

Functions

def _printHisto1D (h)
 
def _contentsHisto1D (h)
 
def _printHisto2D (h)
 
def _printStatusCode (s)
 
def _printBitReference (b)
 
def _printFillStream (o)
 
def _container__getitem__ (self, k)
 
def _container__len__ (self)
 
def _container__iter__ (self)
 
def _draw_aida_ (self, *args)
 
def __mapbase_iter__ (self)
 
def __mapbase_iteritems__ (self)
 
def __mapbase_keys__ (self)
 
def __mapbase_items__ (self)
 
def __mapbase_values__ (self)
 
def __mapbase_contains__ (self, key)
 
def __mapbase_get__ (self, key, value=None)
 
def __mapbase_str__ (self)
 
def __mapbase_setitem__ (self, key, value)
 
def __mapbase_delitem__ (self, key)
 

Variables

list __all__ = []
 
 Draw
 
 plot
 
 __repr__
 
 __getitem__
 
 __len__
 
 __iter__
 
 update
 
 invalidate
 
 SUCCESS
 
 FAILURE
 
 _eq = gbl.Gaudi.StringKey.__cpp_eq__
 
 _ne = gbl.Gaudi.StringKey.__cpp_ne__
 
 iteritems
 
 items
 
 has_key
 
 executeEvent
 Helpers for re-entrant interfaces. More...
 
 isExecuted
 
 filterPassed
 
 _execute_orig
 
 execute
 
 self
 
 ctx
 

Function Documentation

◆ __mapbase_contains__()

def GaudiPython.Pythonizations.__mapbase_contains__ (   self,
  key 
)
Check if the certainkey is in the map

>>> m     = ...        ## the map
>>> if 'a' in m : ...  ##  chekc the presence of the key in the map

Definition at line 351 of file Pythonizations.py.

351 def __mapbase_contains__(self, key):
352  """
353  Check if the certainkey is in the map
354 
355  >>> m = ... ## the map
356  >>> if 'a' in m : ... ## chekc the presence of the key in the map
357 
358  """
359  _num = self.count(key)
360  return False if 0 == _num else True
361 
362 
363 # ============================================
364 # Get the value for certain key,
365 # return predefined value otherwise
366 #
367 # @code
368 #
369 # >>> m = ... ## the map
370 # >>> v = m.get( key , 15 ) ## return the value[key] for existing key, else 15
371 #
372 # @endcode
373 # @see Gaudi::Utils::MapBase
374 # @see GaudiUtils::Map
375 # @see GaudiUtils::HashMap
376 # @see GaudiUtils::VectorMap
377 # @see GaudiUtils::Map::count
378 # @see GaudiUtils::HashMap::count
379 # @ see GaudiUtils::VectorMap::count
380 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
381 # @date 2010-02-20
382 
383 
def __mapbase_contains__(self, key)

◆ __mapbase_delitem__()

def GaudiPython.Pythonizations.__mapbase_delitem__ (   self,
  key 
)
'Del-item' for MapBase-based maps:

>>> m      = ...        ## the map
>>> del m[key]

Definition at line 488 of file Pythonizations.py.

488 def __mapbase_delitem__(self, key):
489  """
490  'Del-item' for MapBase-based maps:
491 
492  >>> m = ... ## the map
493  >>> del m[key]
494 
495  """
496  _erased = True if key in self else False
497  self.erase(key)
498  return _erased
499 
500 
501 gbl.Gaudi.Utils.MapBase.__len__ = lambda s: s.size()
502 gbl.Gaudi.Utils.MapBase.__iter__ = __mapbase_iter__
503 gbl.Gaudi.Utils.MapBase.keys = __mapbase_keys__
504 gbl.Gaudi.Utils.MapBase.__iteritems__ = __mapbase_iteritems__
505 gbl.Gaudi.Utils.MapBase.values = __mapbase_values__
506 gbl.Gaudi.Utils.MapBase.__contains__ = __mapbase_contains__
507 gbl.Gaudi.Utils.MapBase.get = __mapbase_get__
508 gbl.Gaudi.Utils.MapBase.__str__ = __mapbase_str__
509 gbl.Gaudi.Utils.MapBase.__repr__ = __mapbase_str__
510 gbl.Gaudi.Utils.MapBase.__setitem__ = __mapbase_setitem__
511 gbl.Gaudi.Utils.MapBase.__delitem__ = __mapbase_delitem__
512 gbl.Gaudi.Utils.MapBase.__getitem__ = lambda s, key: s.at(key)
def __mapbase_delitem__(self, key)

◆ __mapbase_get__()

def GaudiPython.Pythonizations.__mapbase_get__ (   self,
  key,
  value = None 
)
Get the value for the certain key, or 'value' otherwise

>>> m     = ...        ## the map
>>> v = m.get ( key , 15 )

Definition at line 384 of file Pythonizations.py.

384 def __mapbase_get__(self, key, value=None):
385  """
386  Get the value for the certain key, or 'value' otherwise
387 
388  >>> m = ... ## the map
389  >>> v = m.get ( key , 15 )
390 
391  """
392  if key in self:
393  return self.at(key)
394  return value
395 
396 
397 # ============================================
398 # Representation of MapBase-based maps
399 #
400 # @code
401 #
402 # >>> m = ... ## the map
403 # >>> print m
404 #
405 # @endcode
406 # @see Gaudi::Utils::MapBase
407 # @see GaudiUtils::Map
408 # @see GaudiUtils::HashMap
409 # @see GaudiUtils::VectorMap
410 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
411 # @date 2010-02-20
412 
413 
def __mapbase_get__(self, key, value=None)

◆ __mapbase_items__()

def GaudiPython.Pythonizations.__mapbase_items__ (   self)
Get the list of items

>>> m     = ...        ## the map
>>> items = m.keys()   ## get the list of items

Definition at line 278 of file Pythonizations.py.

278 def __mapbase_items__(self):
279  """
280  Get the list of items
281 
282  >>> m = ... ## the map
283  >>> items = m.keys() ## get the list of items
284 
285  """
286  _size = len(self)
287  _items = []
288  for i in range(0, _size):
289  _key = self.key_at(i)
290  _value = self.at(_key)
291  _items.append((_key, _value))
292  return _items
293 
294 
295 # ============================================
296 # Get the list of values for the map
297 #
298 # @code
299 #
300 # >>> m = ... ## the map
301 # >>> values = m.values () ## get the list of values
302 #
303 # @endcode
304 # @see Gaudi::Utils::MapBase
305 # @see GaudiUtils::Map
306 # @see GaudiUtils::HashMap
307 # @see GaudiUtils::VectorMap
308 # @see GaudiUtils::Map::value_at
309 # @see GaudiUtils::HashMap::value_at
310 # @ see GaudiUtils::VectorMap::value_at
311 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
312 # @date 2010-02-20
313 
314 
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ __mapbase_iter__()

def GaudiPython.Pythonizations.__mapbase_iter__ (   self)
The iterator for MapBase-based containers

>>> m = ...  ## the map
>>> for key in m : print key , m[key]

Definition at line 169 of file Pythonizations.py.

169 def __mapbase_iter__(self):
170  """
171  The iterator for MapBase-based containers
172 
173  >>> m = ... ## the map
174  >>> for key in m : print key , m[key]
175 
176  """
177  _size = len(self)
178  _index = 0
179  while _index < _size:
180  yield self.key_at(_index)
181  _index += 1
182 
183 
184 # =============================================================================
185 # The iterator for MapBase class
186 #
187 # @code
188 #
189 # >>> m = ... ## the map
190 # >>> for key,value in m.iteritems() : print key , value
191 #
192 # @endcode
193 # @see Gaudi::Utils::MapBase
194 # @see GaudiUtils::Map
195 # @see GaudiUtils::HashMap
196 # @see GaudiUtils::VectorMap
197 # @see GaudiUtils::Map::key_at
198 # @see GaudiUtils::HashMap::key_at
199 # @see GaudiUtils::VectorMap::key_at
200 # @see GaudiUtils::Map::value_at
201 # @see GaudiUtils::HashMap::value_at
202 # @see GaudiUtils::VectorMap::value_at
203 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
204 # @date 2010-02-20
205 
206 

◆ __mapbase_iteritems__()

def GaudiPython.Pythonizations.__mapbase_iteritems__ (   self)
The iterator for MapBase-based containers

>>> m = ...  ## the map
>>> for key,value in m.iteritems() : print key, value

Definition at line 207 of file Pythonizations.py.

207 def __mapbase_iteritems__(self):
208  """
209  The iterator for MapBase-based containers
210 
211  >>> m = ... ## the map
212  >>> for key,value in m.iteritems() : print key, value
213 
214  """
215  _size = len(self)
216  _index = 0
217  while _index < _size:
218  _key = self.key_at(_index)
219  yield (_key, self.at(_key))
220  _index += 1
221 
222 
223 # ============================================
224 # Get the list of keys for the map
225 #
226 # @code
227 #
228 # >>> m = ... ## the map
229 # >>> keys = m.keys() ## get the list of keys
230 #
231 # @endcode
232 # @see Gaudi::Utils::MapBase
233 # @see GaudiUtils::Map
234 # @see GaudiUtils::HashMap
235 # @see GaudiUtils::VectorMap
236 # @see GaudiUtils::Map::key_at
237 # @see GaudiUtils::HashMap::key_at
238 # @ see GaudiUtils::VectorMap::key_at
239 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
240 # @date 2010-02-20
241 
242 

◆ __mapbase_keys__()

def GaudiPython.Pythonizations.__mapbase_keys__ (   self)
Get the list of keys

>>> m = ...           ## the map
>>> keys = m.keys()   ## get the list of keys

Definition at line 243 of file Pythonizations.py.

243 def __mapbase_keys__(self):
244  """
245  Get the list of keys
246 
247  >>> m = ... ## the map
248  >>> keys = m.keys() ## get the list of keys
249 
250  """
251  _size = len(self)
252  _keys = []
253  for i in range(0, _size):
254  _keys.append(self.key_at(i))
255  return _keys
256 
257 
258 # ============================================
259 # Get the list of items for the map
260 #
261 # @code
262 #
263 # >>> m = ... ## the map
264 # >>> items = m.items() ## get the list of items
265 #
266 # @endcode
267 # @see Gaudi::Utils::MapBase
268 # @see GaudiUtils::Map
269 # @see GaudiUtils::HashMap
270 # @see GaudiUtils::VectorMap
271 # @see GaudiUtils::Map::key_at
272 # @see GaudiUtils::HashMap::key_at
273 # @ see GaudiUtils::VectorMap::key_at
274 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
275 # @date 2010-02-20
276 
277 
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ __mapbase_setitem__()

def GaudiPython.Pythonizations.__mapbase_setitem__ (   self,
  key,
  value 
)
'Set-item' for MapBase-based maps:

>>> m      = ...        ## the map
>>> m[key] = value     ## set the item

Definition at line 454 of file Pythonizations.py.

454 def __mapbase_setitem__(self, key, value):
455  """
456  'Set-item' for MapBase-based maps:
457 
458  >>> m = ... ## the map
459  >>> m[key] = value ## set the item
460 
461  """
462  _replaced = True if key in self else False
463  self.update(key, value)
464  return _replaced
465 
466 
467 # ============================================
468 # "Del-item" for MapBase-based maps:
469 #
470 # @code
471 #
472 # >>> m = ... ## the map
473 # >>> del m [ key] ## del th eitem
474 #
475 # @endcode
476 #
477 # @see Gaudi::Utils::MapBase
478 # @see GaudiUtils::Map
479 # @see GaudiUtils::HashMap
480 # @see GaudiUtils::VectorMap
481 # @see GaudiUtils::Map::erase
482 # @see GaudiUtils::HashMap::erase
483 # @see GaudiUtils::VectorMap::erase
484 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
485 # @date 2010-02-20
486 
487 
def __mapbase_setitem__(self, key, value)

◆ __mapbase_str__()

def GaudiPython.Pythonizations.__mapbase_str__ (   self)
Representation of MapBase-based maps:

>>> m     = ...        ## the map
>>> print map

Definition at line 414 of file Pythonizations.py.

414 def __mapbase_str__(self):
415  """
416  Representation of MapBase-based maps:
417 
418  >>> m = ... ## the map
419  >>> print map
420 
421  """
422  _result = ' { '
423  _size = len(self)
424  for i in range(0, _size):
425  _key = self.key_at(i)
426  _val = self.at(_key)
427  if 0 != i:
428  _result += ' , '
429  _result += " %s : %s " % (str(_key), str(_val))
430  _result += ' } '
431  return _result
432 
433 
434 # ============================================
435 # "Setitem" for MapBase-based maps:
436 #
437 # @code
438 #
439 # >>> m = ... ## the map
440 # >>> m [ key] = value ## set the item
441 #
442 # @endcode
443 # @see Gaudi::Utils::MapBase
444 # @see GaudiUtils::Map
445 # @see GaudiUtils::HashMap
446 # @see GaudiUtils::VectorMap
447 # @see GaudiUtils::Map::update
448 # @see GaudiUtils::HashMap::update
449 # @see GaudiUtils::VectorMap::update
450 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
451 # @date 2010-02-20
452 
453 
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ __mapbase_values__()

def GaudiPython.Pythonizations.__mapbase_values__ (   self)
Get the list of values

>>> m      = ...          ## the map
>>> values = m.values()   ## get the list of values

Definition at line 315 of file Pythonizations.py.

315 def __mapbase_values__(self):
316  """
317  Get the list of values
318 
319  >>> m = ... ## the map
320  >>> values = m.values() ## get the list of values
321 
322  """
323  _size = len(self)
324  _values = []
325  for i in range(0, _size):
326  _value = self.value_at(i)
327  _values.append(_value)
328  return _values
329 
330 
331 # ============================================
332 # Check if the certain key is in the map
333 #
334 # @code
335 #
336 # >>> m = ... ## the map
337 # >>> if 'a' in m : print 'key is in the map!'
338 #
339 # @endcode
340 # @see Gaudi::Utils::MapBase
341 # @see GaudiUtils::Map
342 # @see GaudiUtils::HashMap
343 # @see GaudiUtils::VectorMap
344 # @see GaudiUtils::Map::count
345 # @see GaudiUtils::HashMap::count
346 # @ see GaudiUtils::VectorMap::count
347 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
348 # @date 2010-02-20
349 
350 
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ _container__getitem__()

def GaudiPython.Pythonizations._container__getitem__ (   self,
  k 
)
private

Definition at line 69 of file Pythonizations.py.

69 def _container__getitem__(self, k):
70  return self.containedObject(k)
71 
72 
def _container__getitem__(self, k)

◆ _container__iter__()

def GaudiPython.Pythonizations._container__iter__ (   self)
private

Definition at line 77 of file Pythonizations.py.

77 def _container__iter__(self):
78  if hasattr(self, 'containedObjects'):
79  sequential = self.containedObjects()
80  else:
81  sequential = self
82  count = 0
83  limit = self.__len__()
84  while count < limit:
85  yield sequential.__getitem__(count)
86  count += 1
87 
88 

◆ _container__len__()

def GaudiPython.Pythonizations._container__len__ (   self)
private

Definition at line 73 of file Pythonizations.py.

73 def _container__len__(self):
74  return self.numberOfObjects()
75 
76 

◆ _contentsHisto1D()

def GaudiPython.Pythonizations._contentsHisto1D (   h)
private

Definition at line 32 of file Pythonizations.py.

32 def _contentsHisto1D(h):
33  x = h.axis()
34  return map(h.binEntries, range(x.bins()))
35 
36 
struct GAUDI_API map
Parametrisation class for map-like implementation.
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ _draw_aida_()

def GaudiPython.Pythonizations._draw_aida_ (   self,
args 
)
private
Draw AIDA histogram (through access to internal ROOT histogram

>>> aida = ...    # get the historgam
>>> aida.Draw()

Definition at line 89 of file Pythonizations.py.

89 def _draw_aida_(self, *args):
90  """
91  Draw AIDA histogram (through access to internal ROOT histogram
92 
93  >>> aida = ... # get the historgam
94  >>> aida.Draw()
95 
96  """
97  _fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
98  _root = _fun(self)
99  return _root.Draw(*args)
100 
101 
102 gbl.AIDA.IHistogram1D.__repr__ = _printHisto1D
103 gbl.AIDA.IHistogram1D.contents = _contentsHisto1D
104 gbl.AIDA.IHistogram2D.__repr__ = _printHisto2D
def _draw_aida_(self, *args)

◆ _printBitReference()

def GaudiPython.Pythonizations._printBitReference (   b)
private

Definition at line 51 of file Pythonizations.py.

51 def _printBitReference(b):
52  return str(1 == b.bool())
53 
54 

◆ _printFillStream()

def GaudiPython.Pythonizations._printFillStream (   o)
private

Definition at line 55 of file Pythonizations.py.

55 def _printFillStream(o):
56  if o:
57  s = gbl.stringstream()
58  o.fillStream(s)
59  out = str(s.str())
60  if out == '':
61  out = o.__class__.__name__ + ' object'
62  if hasattr(o, 'hasKey') and o.hasKey():
63  out += ' key = ' + str(o.key())
64  else:
65  out = o.__class__.__name__ + ' NULL object'
66  return out
67 
68 

◆ _printHisto1D()

def GaudiPython.Pythonizations._printHisto1D (   h)
private

Definition at line 26 of file Pythonizations.py.

26 def _printHisto1D(h):
27  x = h.axis()
28  return 'Histogram 1D "%s" %d bins [%f,%f]' % (h.title(), x.bins(),
29  x.lowerEdge(), x.upperEdge())
30 
31 

◆ _printHisto2D()

def GaudiPython.Pythonizations._printHisto2D (   h)
private

Definition at line 37 of file Pythonizations.py.

37 def _printHisto2D(h):
38  x, y = h.xAxis(), h.yAxis()
39  return 'Histogram 2D "%s" %d xbins [%f,%f], %d ybins [%f,%f]' % \
40  (h.title(), x.bins(), x.lowerEdge(), x.upperEdge(),
41  y.bins(), y.lowerEdge(), y.upperEdge())
42 
43 

◆ _printStatusCode()

def GaudiPython.Pythonizations._printStatusCode (   s)
private

Definition at line 44 of file Pythonizations.py.

44 def _printStatusCode(s):
45  if s.isSuccess():
46  return 'SUCCESS'
47  else:
48  return 'FAILURE'
49 
50 

Variable Documentation

◆ __all__

list GaudiPython.Pythonizations.__all__ = []
private

Definition at line 9 of file Pythonizations.py.

◆ __getitem__

GaudiPython.Pythonizations.__getitem__
private

Definition at line 117 of file Pythonizations.py.

◆ __iter__

GaudiPython.Pythonizations.__iter__
private

Definition at line 119 of file Pythonizations.py.

◆ __len__

GaudiPython.Pythonizations.__len__
private

Definition at line 118 of file Pythonizations.py.

◆ __repr__

GaudiPython.Pythonizations.__repr__
private

Definition at line 110 of file Pythonizations.py.

◆ _eq

GaudiPython.Pythonizations._eq = gbl.Gaudi.StringKey.__cpp_eq__
private

Definition at line 134 of file Pythonizations.py.

◆ _execute_orig

GaudiPython.Pythonizations._execute_orig
private

Definition at line 555 of file Pythonizations.py.

◆ _ne

GaudiPython.Pythonizations._ne = gbl.Gaudi.StringKey.__cpp_ne__
private

Definition at line 139 of file Pythonizations.py.

◆ ctx

GaudiPython.Pythonizations.ctx

Definition at line 556 of file Pythonizations.py.

◆ Draw

GaudiPython.Pythonizations.Draw

Definition at line 107 of file Pythonizations.py.

◆ execute

GaudiPython.Pythonizations.execute

Definition at line 556 of file Pythonizations.py.

◆ executeEvent

GaudiPython.Pythonizations.executeEvent

Helpers for re-entrant interfaces.

GaudiPython is inherently single threaded and it's unpractical to use the new re-entrant interfaces. Moreover a lot of existing code (like GaudiMP) expects the old signatures.

Definition at line 552 of file Pythonizations.py.

◆ FAILURE

GaudiPython.Pythonizations.FAILURE

Definition at line 130 of file Pythonizations.py.

◆ filterPassed

GaudiPython.Pythonizations.filterPassed

Definition at line 554 of file Pythonizations.py.

◆ has_key

GaudiPython.Pythonizations.has_key

Definition at line 517 of file Pythonizations.py.

◆ invalidate

GaudiPython.Pythonizations.invalidate

Definition at line 123 of file Pythonizations.py.

◆ isExecuted

GaudiPython.Pythonizations.isExecuted

Definition at line 553 of file Pythonizations.py.

◆ items

GaudiPython.Pythonizations.items

Definition at line 516 of file Pythonizations.py.

◆ iteritems

GaudiPython.Pythonizations.iteritems

Definition at line 515 of file Pythonizations.py.

◆ plot

GaudiPython.Pythonizations.plot

Definition at line 108 of file Pythonizations.py.

◆ self

GaudiPython.Pythonizations.self

Definition at line 556 of file Pythonizations.py.

◆ SUCCESS

GaudiPython.Pythonizations.SUCCESS

Definition at line 129 of file Pythonizations.py.

◆ update

GaudiPython.Pythonizations.update

Definition at line 121 of file Pythonizations.py.