The Gaudi Framework  v36r1 (3e2fb5a8)
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

 Draw
 
 plot
 
 __repr__
 
 __getitem__
 
 __len__
 
 __iter__
 
 update
 
 invalidate
 
 SUCCESS
 
 FAILURE
 
 _eq
 
 _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 361 of file Pythonizations.py.

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

◆ __mapbase_delitem__()

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

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

Definition at line 498 of file Pythonizations.py.

498 def __mapbase_delitem__(self, key):
499  """
500  'Del-item' for MapBase-based maps:
501 
502  >>> m = ... ## the map
503  >>> del m[key]
504 
505  """
506  _erased = True if key in self else False
507  self.erase(key)
508  return _erased
509 
510 
511 gbl.Gaudi.Utils.MapBase.__len__ = lambda s: s.size()
512 gbl.Gaudi.Utils.MapBase.__iter__ = __mapbase_iter__
513 gbl.Gaudi.Utils.MapBase.keys = __mapbase_keys__
514 gbl.Gaudi.Utils.MapBase.__iteritems__ = __mapbase_iteritems__
515 gbl.Gaudi.Utils.MapBase.values = __mapbase_values__
516 gbl.Gaudi.Utils.MapBase.__contains__ = __mapbase_contains__
517 gbl.Gaudi.Utils.MapBase.get = __mapbase_get__
518 gbl.Gaudi.Utils.MapBase.__str__ = __mapbase_str__
519 gbl.Gaudi.Utils.MapBase.__repr__ = __mapbase_str__
520 gbl.Gaudi.Utils.MapBase.__setitem__ = __mapbase_setitem__
521 gbl.Gaudi.Utils.MapBase.__delitem__ = __mapbase_delitem__
522 gbl.Gaudi.Utils.MapBase.__getitem__ = lambda s, key: s.at(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 394 of file Pythonizations.py.

394 def __mapbase_get__(self, key, value=None):
395  """
396  Get the value for the certain key, or 'value' otherwise
397 
398  >>> m = ... ## the map
399  >>> v = m.get ( key , 15 )
400 
401  """
402  if key in self:
403  return self.at(key)
404  return value
405 
406 
407 # ============================================
408 # Representation of MapBase-based maps
409 #
410 # @code
411 #
412 # >>> m = ... ## the map
413 # >>> print(m)
414 #
415 # @endcode
416 # @see Gaudi::Utils::MapBase
417 # @see GaudiUtils::Map
418 # @see GaudiUtils::HashMap
419 # @see GaudiUtils::VectorMap
420 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
421 # @date 2010-02-20
422 
423 

◆ __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 288 of file Pythonizations.py.

288 def __mapbase_items__(self):
289  """
290  Get the list of items
291 
292  >>> m = ... ## the map
293  >>> items = m.keys() ## get the list of items
294 
295  """
296  _size = len(self)
297  _items = []
298  for i in range(0, _size):
299  _key = self.key_at(i)
300  _value = self.at(_key)
301  _items.append((_key, _value))
302  return _items
303 
304 
305 # ============================================
306 # Get the list of values for the map
307 #
308 # @code
309 #
310 # >>> m = ... ## the map
311 # >>> values = m.values () ## get the list of values
312 #
313 # @endcode
314 # @see Gaudi::Utils::MapBase
315 # @see GaudiUtils::Map
316 # @see GaudiUtils::HashMap
317 # @see GaudiUtils::VectorMap
318 # @see GaudiUtils::Map::value_at
319 # @see GaudiUtils::HashMap::value_at
320 # @ see GaudiUtils::VectorMap::value_at
321 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
322 # @date 2010-02-20
323 
324 

◆ __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 179 of file Pythonizations.py.

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

◆ __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 217 of file Pythonizations.py.

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

◆ __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 253 of file Pythonizations.py.

253 def __mapbase_keys__(self):
254  """
255  Get the list of keys
256 
257  >>> m = ... ## the map
258  >>> keys = m.keys() ## get the list of keys
259 
260  """
261  _size = len(self)
262  _keys = []
263  for i in range(0, _size):
264  _keys.append(self.key_at(i))
265  return _keys
266 
267 
268 # ============================================
269 # Get the list of items for the map
270 #
271 # @code
272 #
273 # >>> m = ... ## the map
274 # >>> items = m.items() ## get the list of items
275 #
276 # @endcode
277 # @see Gaudi::Utils::MapBase
278 # @see GaudiUtils::Map
279 # @see GaudiUtils::HashMap
280 # @see GaudiUtils::VectorMap
281 # @see GaudiUtils::Map::key_at
282 # @see GaudiUtils::HashMap::key_at
283 # @ see GaudiUtils::VectorMap::key_at
284 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
285 # @date 2010-02-20
286 
287 

◆ __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 464 of file Pythonizations.py.

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

◆ __mapbase_str__()

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

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

Definition at line 424 of file Pythonizations.py.

424 def __mapbase_str__(self):
425  """
426  Representation of MapBase-based maps:
427 
428  >>> m = ... ## the map
429  >>> print(map)
430 
431  """
432  _result = ' { '
433  _size = len(self)
434  for i in range(0, _size):
435  _key = self.key_at(i)
436  _val = self.at(_key)
437  if 0 != i:
438  _result += ' , '
439  _result += " %s : %s " % (str(_key), str(_val))
440  _result += ' } '
441  return _result
442 
443 
444 # ============================================
445 # "Setitem" for MapBase-based maps:
446 #
447 # @code
448 #
449 # >>> m = ... ## the map
450 # >>> m [ key] = value ## set the item
451 #
452 # @endcode
453 # @see Gaudi::Utils::MapBase
454 # @see GaudiUtils::Map
455 # @see GaudiUtils::HashMap
456 # @see GaudiUtils::VectorMap
457 # @see GaudiUtils::Map::update
458 # @see GaudiUtils::HashMap::update
459 # @see GaudiUtils::VectorMap::update
460 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
461 # @date 2010-02-20
462 
463 

◆ __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 325 of file Pythonizations.py.

325 def __mapbase_values__(self):
326  """
327  Get the list of values
328 
329  >>> m = ... ## the map
330  >>> values = m.values() ## get the list of values
331 
332  """
333  _size = len(self)
334  _values = []
335  for i in range(0, _size):
336  _value = self.value_at(i)
337  _values.append(_value)
338  return _values
339 
340 
341 # ============================================
342 # Check if the certain key is in the map
343 #
344 # @code
345 #
346 # >>> m = ... ## the map
347 # >>> if 'a' in m : print('key is in the map!')
348 #
349 # @endcode
350 # @see Gaudi::Utils::MapBase
351 # @see GaudiUtils::Map
352 # @see GaudiUtils::HashMap
353 # @see GaudiUtils::VectorMap
354 # @see GaudiUtils::Map::count
355 # @see GaudiUtils::HashMap::count
356 # @ see GaudiUtils::VectorMap::count
357 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
358 # @date 2010-02-20
359 
360 

◆ _container__getitem__()

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

Definition at line 79 of file Pythonizations.py.

79 def _container__getitem__(self, k):
80  return self.containedObject(k)
81 
82 

◆ _container__iter__()

def GaudiPython.Pythonizations._container__iter__ (   self)
private

Definition at line 87 of file Pythonizations.py.

87 def _container__iter__(self):
88  if hasattr(self, 'containedObjects'):
89  sequential = self.containedObjects()
90  else:
91  sequential = self
92  count = 0
93  limit = self.__len__()
94  while count < limit:
95  yield sequential.__getitem__(count)
96  count += 1
97 
98 

◆ _container__len__()

def GaudiPython.Pythonizations._container__len__ (   self)
private

Definition at line 83 of file Pythonizations.py.

83 def _container__len__(self):
84  return self.numberOfObjects()
85 
86 

◆ _contentsHisto1D()

def GaudiPython.Pythonizations._contentsHisto1D (   h)
private

Definition at line 42 of file Pythonizations.py.

42 def _contentsHisto1D(h):
43  x = h.axis()
44  return map(h.binEntries, range(x.bins()))
45 
46 

◆ _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 99 of file Pythonizations.py.

99 def _draw_aida_(self, *args):
100  """
101  Draw AIDA histogram (through access to internal ROOT histogram
102 
103  >>> aida = ... # get the historgam
104  >>> aida.Draw()
105 
106  """
107  _fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
108  _root = _fun(self)
109  return _root.Draw(*args)
110 
111 
112 gbl.AIDA.IHistogram1D.__str__ = _printHisto1D
113 gbl.AIDA.IHistogram1D.contents = _contentsHisto1D
114 gbl.AIDA.IHistogram2D.__str__ = _printHisto2D

◆ _printBitReference()

def GaudiPython.Pythonizations._printBitReference (   b)
private

Definition at line 61 of file Pythonizations.py.

61 def _printBitReference(b):
62  return str(1 == b.bool())
63 
64 

◆ _printFillStream()

def GaudiPython.Pythonizations._printFillStream (   o)
private

Definition at line 65 of file Pythonizations.py.

65 def _printFillStream(o):
66  if o:
67  s = gbl.stringstream()
68  o.fillStream(s)
69  out = str(s.str())
70  if out == '':
71  out = o.__class__.__name__ + ' object'
72  if hasattr(o, 'hasKey') and o.hasKey():
73  out += ' key = ' + str(o.key())
74  else:
75  out = o.__class__.__name__ + ' NULL object'
76  return out
77 
78 

◆ _printHisto1D()

def GaudiPython.Pythonizations._printHisto1D (   h)
private

Definition at line 36 of file Pythonizations.py.

36 def _printHisto1D(h):
37  x = h.axis()
38  return 'Histogram 1D "%s" %d bins [%f,%f]' % (h.title(), x.bins(),
39  x.lowerEdge(), x.upperEdge())
40 
41 

◆ _printHisto2D()

def GaudiPython.Pythonizations._printHisto2D (   h)
private

Definition at line 47 of file Pythonizations.py.

47 def _printHisto2D(h):
48  x, y = h.xAxis(), h.yAxis()
49  return 'Histogram 2D "%s" %d xbins [%f,%f], %d ybins [%f,%f]' % \
50  (h.title(), x.bins(), x.lowerEdge(), x.upperEdge(),
51  y.bins(), y.lowerEdge(), y.upperEdge())
52 
53 

◆ _printStatusCode()

def GaudiPython.Pythonizations._printStatusCode (   s)
private

Definition at line 54 of file Pythonizations.py.

54 def _printStatusCode(s):
55  if s.isSuccess():
56  return 'SUCCESS'
57  else:
58  return 'FAILURE'
59 
60 

Variable Documentation

◆ __getitem__

GaudiPython.Pythonizations.__getitem__
private

Definition at line 127 of file Pythonizations.py.

◆ __iter__

GaudiPython.Pythonizations.__iter__
private

Definition at line 129 of file Pythonizations.py.

◆ __len__

GaudiPython.Pythonizations.__len__
private

Definition at line 128 of file Pythonizations.py.

◆ __repr__

GaudiPython.Pythonizations.__repr__
private

Definition at line 120 of file Pythonizations.py.

◆ _eq

GaudiPython.Pythonizations._eq
private

Definition at line 144 of file Pythonizations.py.

◆ _execute_orig

GaudiPython.Pythonizations._execute_orig
private

Definition at line 565 of file Pythonizations.py.

◆ _ne

GaudiPython.Pythonizations._ne
private

Definition at line 149 of file Pythonizations.py.

◆ ctx

GaudiPython.Pythonizations.ctx

Definition at line 566 of file Pythonizations.py.

◆ Draw

GaudiPython.Pythonizations.Draw

Definition at line 117 of file Pythonizations.py.

◆ execute

GaudiPython.Pythonizations.execute

Definition at line 566 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 562 of file Pythonizations.py.

◆ FAILURE

GaudiPython.Pythonizations.FAILURE

Definition at line 140 of file Pythonizations.py.

◆ filterPassed

GaudiPython.Pythonizations.filterPassed

Definition at line 564 of file Pythonizations.py.

◆ has_key

GaudiPython.Pythonizations.has_key

Definition at line 527 of file Pythonizations.py.

◆ invalidate

GaudiPython.Pythonizations.invalidate

Definition at line 133 of file Pythonizations.py.

◆ isExecuted

GaudiPython.Pythonizations.isExecuted

Definition at line 563 of file Pythonizations.py.

◆ items

GaudiPython.Pythonizations.items

Definition at line 526 of file Pythonizations.py.

◆ iteritems

GaudiPython.Pythonizations.iteritems

Definition at line 525 of file Pythonizations.py.

◆ plot

GaudiPython.Pythonizations.plot

Definition at line 118 of file Pythonizations.py.

◆ self

GaudiPython.Pythonizations.self

Definition at line 566 of file Pythonizations.py.

◆ SUCCESS

GaudiPython.Pythonizations.SUCCESS

Definition at line 139 of file Pythonizations.py.

◆ update

GaudiPython.Pythonizations.update

Definition at line 131 of file Pythonizations.py.

GaudiPython.Pythonizations.__mapbase_keys__
def __mapbase_keys__(self)
Definition: Pythonizations.py:253
GaudiPython.Pythonizations._printHisto2D
def _printHisto2D(h)
Definition: Pythonizations.py:47
GaudiPython.Pythonizations._printBitReference
def _printBitReference(b)
Definition: Pythonizations.py:61
GaudiPython.Pythonizations._printFillStream
def _printFillStream(o)
Definition: Pythonizations.py:65
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:35
GaudiPython.Pythonizations._draw_aida_
def _draw_aida_(self, *args)
Definition: Pythonizations.py:99
GaudiPython.Pythonizations.__mapbase_iter__
def __mapbase_iter__(self)
Definition: Pythonizations.py:179
GaudiPython.Pythonizations._contentsHisto1D
def _contentsHisto1D(h)
Definition: Pythonizations.py:42
GaudiPython.Pythonizations.__mapbase_items__
def __mapbase_items__(self)
Definition: Pythonizations.py:288
GaudiPython.Pythonizations._container__getitem__
def _container__getitem__(self, k)
Definition: Pythonizations.py:79
GaudiPython.Pythonizations._printStatusCode
def _printStatusCode(s)
Definition: Pythonizations.py:54
GaudiPython.Pythonizations.__mapbase_str__
def __mapbase_str__(self)
Definition: Pythonizations.py:424
GaudiPython.Pythonizations.__mapbase_values__
def __mapbase_values__(self)
Definition: Pythonizations.py:325
GaudiPython.Pythonizations.__mapbase_setitem__
def __mapbase_setitem__(self, key, value)
Definition: Pythonizations.py:464
GaudiPython.Pythonizations._printHisto1D
def _printHisto1D(h)
Definition: Pythonizations.py:36
GaudiPython.Pythonizations.__mapbase_delitem__
def __mapbase_delitem__(self, key)
Definition: Pythonizations.py:498
GaudiPython.Pythonizations.__mapbase_iteritems__
def __mapbase_iteritems__(self)
Definition: Pythonizations.py:217
GaudiPython.Pythonizations.__mapbase_get__
def __mapbase_get__(self, key, value=None)
Definition: Pythonizations.py:394
GaudiPython.Pythonizations.__mapbase_contains__
def __mapbase_contains__(self, key)
Definition: Pythonizations.py:361
GaudiPython.Pythonizations._container__len__
def _container__len__(self)
Definition: Pythonizations.py:83
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:97
GaudiPython.Pythonizations._container__iter__
def _container__iter__(self)
Definition: Pythonizations.py:87