| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Functions | Variables
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__

## Function Documentation

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 349 of file Pythonizations.py.

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

def GaudiPython.Pythonizations.__mapbase_delitem__ | ( |  | self,
|  |  | key
| ) |  |

    'Del-item' for MapBase-based maps:

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

Definition at line 482 of file Pythonizations.py.

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

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 381 of file Pythonizations.py.

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

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 # Get the list of values for the map
296 #
297 # @code
298 #
299 # >>> m = ... ## the map
300 # >>> values = m.values () ## get the list of values
301 #
302 # @endcode
303 # @see Gaudi::Utils::MapBase
304 # @see GaudiUtils::Map
305 # @see GaudiUtils::HashMap
306 # @see GaudiUtils::VectorMap
307 # @see GaudiUtils::Map::value_at
308 # @see GaudiUtils::HashMap::value_at
309 # @ see GaudiUtils::VectorMap::value_at
310 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
311 # @date 2010-02-20
312
313
GaudiPython.Pythonizations.__mapbase_items__
def __mapbase_items__(self)
Definition: Pythonizations.py:278
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:85

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 172 of file Pythonizations.py.

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

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 209 of file Pythonizations.py.

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

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 244 of file Pythonizations.py.

244 def __mapbase_keys__(self):
245 """
246 Get the list of keys
247
248 >>> m = ... ## the map
249 >>> keys = m.keys() ## get the list of keys
250
251 """
252 _size = len(self)
253 _keys = []
254 for i in range(0, _size):
255 _keys.append(self.key_at(i))
256 return _keys
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
GaudiPython.Pythonizations.__mapbase_keys__
def __mapbase_keys__(self)
Definition: Pythonizations.py:244
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:85

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 449 of file Pythonizations.py.

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

def GaudiPython.Pythonizations.__mapbase_str__ | ( |  | self | ) |

    Representation of MapBase-based maps:

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

Definition at line 410 of file Pythonizations.py.

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

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 314 of file Pythonizations.py.

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

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

Definition at line 67 of file Pythonizations.py.

67 def _container__getitem__(self, k):
68 return self.containedObject(k)
69
70
GaudiPython.Pythonizations._container__getitem__
def _container__getitem__(self, k)
Definition: Pythonizations.py:67

def GaudiPython.Pythonizations._container__iter__ | ( |  | self | ) |
| private

Definition at line 75 of file Pythonizations.py.

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

def GaudiPython.Pythonizations._container__len__ | ( |  | self | ) |
| private

Definition at line 71 of file Pythonizations.py.

71 def _container__len__(self):
72 return self.numberOfObjects()
73
74
GaudiPython.Pythonizations._container__len__
def _container__len__(self)
Definition: Pythonizations.py:71

def GaudiPython.Pythonizations._contentsHisto1D | ( |  | h | ) |
| private

Definition at line 30 of file Pythonizations.py.

30 def _contentsHisto1D(h):
31 x = h.axis()
32 return map(h.binEntries, range(x.bins()))
33
34
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:26
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:85
GaudiPython.Pythonizations._contentsHisto1D
def _contentsHisto1D(h)
Definition: Pythonizations.py:30

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 87 of file Pythonizations.py.

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

def GaudiPython.Pythonizations._printBitReference | ( |  | b | ) |
| private

Definition at line 49 of file Pythonizations.py.

49 def _printBitReference(b):
50 return str(1 == b.bool())
51
52
GaudiPython.Pythonizations._printBitReference
def _printBitReference(b)
Definition: Pythonizations.py:49

def GaudiPython.Pythonizations._printFillStream | ( |  | o | ) |
| private

Definition at line 53 of file Pythonizations.py.

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

def GaudiPython.Pythonizations._printHisto1D | ( |  | h | ) |
| private

Definition at line 25 of file Pythonizations.py.

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

def GaudiPython.Pythonizations._printHisto2D | ( |  | h | ) |
| private

Definition at line 35 of file Pythonizations.py.

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

def GaudiPython.Pythonizations._printStatusCode | ( |  | s | ) |
| private

Definition at line 42 of file Pythonizations.py.

42 def _printStatusCode(s):
43 if s.isSuccess():
44 return 'SUCCESS'
45 else:
46 return 'FAILURE'
47
48
GaudiPython.Pythonizations._printStatusCode
def _printStatusCode(s)
Definition: Pythonizations.py:42

## Variable Documentation

list GaudiPython.Pythonizations.__all__ = []
| private

Definition at line 8 of file Pythonizations.py.

GaudiPython.Pythonizations.__getitem__
| private

Definition at line 119 of file Pythonizations.py.

GaudiPython.Pythonizations.__iter__
| private

Definition at line 121 of file Pythonizations.py.

GaudiPython.Pythonizations.__len__
| private

Definition at line 120 of file Pythonizations.py.

GaudiPython.Pythonizations.__repr__
| private

Definition at line 112 of file Pythonizations.py.

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

Definition at line 136 of file Pythonizations.py.

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

Definition at line 141 of file Pythonizations.py.

GaudiPython.Pythonizations.Draw

Definition at line 109 of file Pythonizations.py.

GaudiPython.Pythonizations.FAILURE

Definition at line 132 of file Pythonizations.py.

GaudiPython.Pythonizations.invalidate

Definition at line 125 of file Pythonizations.py.

GaudiPython.Pythonizations.plot

Definition at line 110 of file Pythonizations.py.

GaudiPython.Pythonizations.SUCCESS

Definition at line 131 of file Pythonizations.py.

GaudiPython.Pythonizations.update

Definition at line 123 of file Pythonizations.py.