| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
GaudiPython.Pythonizations Namespace Reference

## Functions
def | _printHisto1D
def | _contentsHisto1D
def | _printHisto2D
def | _printStatusCode
def | _printBitReference
def | _printFillStream
def | _container__getitem__
def | _container__len__
def | _container__iter__
def | _draw_aida_
def | __mapbase_iter__
| # decorate some map-like objects The iterator for MapBase class
def | __mapbase_iteritems__
| The iterator for MapBase class.
def | __mapbase_keys__
| Get the list of keys for the map.
def | __mapbase_items__
| Get the list of items for the map.
def | __mapbase_values__
| Get the list of values for the map.
def | __mapbase_contains__
| Check if the certain key is in the map.
def | __mapbase_get__
| Get the value for certain key, return predefined value otherwise.
def | __mapbase_str__
| Representation of MapBase-based maps.
def | __mapbase_setitem__
| "Setitem" for MapBase-based maps:
def | __mapbase_delitem__
| "Del-item" for MapBase-based maps:

## Variables
list | __all__ [ ]
| _eq gbl.Gaudi.StringKey.__cpp_eq__
| _ne gbl.Gaudi.StringKey.__cpp_ne__

## Function Documentation

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

Check if the certain key is in the map.

1 >>> m = ... ## the map
2 >>> if 'a' in m : print 'key is in the map!'

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::count
  GaudiUtils::HashMap::count @ see GaudiUtils::VectorMap::count

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

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

303
304 def __mapbase_contains__ ( self , key ) :
305 """
306 Check if the certainkey is in the map
307
308 >>> m = ... ## the map
309 >>> if 'a' in m : ... ## chekc the presence of the key in the map
310
311 """
312 _num = self.count ( key )
313 return False if 0 == _num else True
314
# ============================================

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

"Del-item" for MapBase-based maps:

1 >>> m = ... ## the map
2 >>> del m [ key] ## del th eitem

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::erase
  GaudiUtils::HashMap::erase
  GaudiUtils::VectorMap::erase

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      'Del-item' for MapBase-based maps:

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

Definition at line 426 of file Pythonizations.py.

426
427 def __mapbase_delitem__ ( self , key ) :
428 """
429 'Del-item' for MapBase-based maps:
430
431 >>> m = ... ## the map
432 >>> del m[key]
433
434 """
435 _erased = True if key in self else False
436 self.erase ( key )
437 return _erased
438
439 gbl.Gaudi.Utils.MapBase . __len__ = lambda s : s.size()
440 gbl.Gaudi.Utils.MapBase . __iter__ = __mapbase_iter__
441 gbl.Gaudi.Utils.MapBase . keys = __mapbase_keys__
442 gbl.Gaudi.Utils.MapBase . __iteritems__ = __mapbase_iteritems__
443 gbl.Gaudi.Utils.MapBase . iteritems = __mapbase_iteritems__
444 gbl.Gaudi.Utils.MapBase . items = __mapbase_items__
445 gbl.Gaudi.Utils.MapBase . values = __mapbase_values__
446 gbl.Gaudi.Utils.MapBase . __contains__ = __mapbase_contains__
447 gbl.Gaudi.Utils.MapBase . has_key = __mapbase_contains__
448 gbl.Gaudi.Utils.MapBase . get = __mapbase_get__
449 gbl.Gaudi.Utils.MapBase . __str__ = __mapbase_str__
450 gbl.Gaudi.Utils.MapBase . __repr__ = __mapbase_str__
451 gbl.Gaudi.Utils.MapBase . __setitem__ = __mapbase_setitem__
452 gbl.Gaudi.Utils.MapBase . __delitem__ = __mapbase_delitem__
453 gbl.Gaudi.Utils.MapBase . __getitem__ = lambda s,key : s.at ( key )

def GaudiPython.Pythonizations.__mapbase_get__ | ( |  | self,
|  |  | key,
|  |  | value = `None`
| ) |  |

Get the value for certain key, return predefined value otherwise.

1 >>> m = ... ## the map
2 >>> v = m.get( key , 15 ) ## return the value[key] for existing key, else 15

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::count
  GaudiUtils::HashMap::count @ see GaudiUtils::VectorMap::count

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the value for the certain key, or 'value' otherwise

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

Definition at line 333 of file Pythonizations.py.

333
334 def __mapbase_get__ ( self , key , value = None ) :
335 """
336 Get the value for the certain key, or 'value' otherwise
337
338 >>> m = ... ## the map
339 >>> v = m.get ( key , 15 )
340
341 """
342 if key in self : return self.at( key )
343 return value
344
# ============================================

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

Get the list of items for the map.

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at @ see GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of items

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

Definition at line 236 of file Pythonizations.py.

236
237 def __mapbase_items__ ( self ) :
238 """
239 Get the list of items
240
241 >>> m = ... ## the map
242 >>> items = m.keys() ## get the list of items
243
244 """
245 _size = len ( self )
246 _items = []
247 for i in range ( 0 , _size ) :
248 _key = self.key_at ( i )
249 _value = self.at ( _key )
250 _items.append ( ( _key , _value ) )
251 return _items
252
# ============================================

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

# decorate some map-like objects

The iterator for MapBase class
1 >>> m = ... ## the map
2 >>> for key in m : print key , m[key]

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at
  GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      The iterator for MapBase-based containers

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

Definition at line 137 of file Pythonizations.py.

137
138 def __mapbase_iter__ ( self ) :
139 """
140 The iterator for MapBase-based containers
141
142 >>> m = ... ## the map
143 >>> for key in m : print key , m[key]
144
145 """
146 _size = len ( self )
147 _index = 0
148 while _index < _size :
149 yield self.key_at ( _index )
150 _index +=1
151
# =============================================================================

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

The iterator for MapBase class.

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at
  GaudiUtils::VectorMap::key_at
  GaudiUtils::Map::value_at
  GaudiUtils::HashMap::value_at
  GaudiUtils::VectorMap::value_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      The iterator for MapBase-based containers

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

Definition at line 172 of file Pythonizations.py.

172
173 def __mapbase_iteritems__ ( self ) :
174 """
175 The iterator for MapBase-based containers
176
177 >>> m = ... ## the map
178 >>> for key,value in m.iteritems() : print key, value
179
180 """
181 _size = len ( self )
182 _index = 0
183 while _index < _size :
184 _key = self.key_at ( _index )
185 yield ( _key , self.at ( _key ) )
186 _index +=1
187
# ============================================

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

Get the list of keys for the map.

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::key_at
  GaudiUtils::HashMap::key_at @ see GaudiUtils::VectorMap::key_at

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of keys

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

Definition at line 205 of file Pythonizations.py.

205
206 def __mapbase_keys__ ( self ) :
207 """
208 Get the list of keys
209
210 >>> m = ... ## the map
211 >>> keys = m.keys() ## get the list of keys
212
213 """
214 _size = len ( self )
215 _keys = []
216 for i in range ( 0 , _size ) : _keys.append ( self.key_at ( i ) )
217 return _keys
218
# ============================================

def GaudiPython.Pythonizations.__mapbase_setitem__ | ( |  | self,
|  |  | key,
|  |  | value
| ) |  |

"Setitem" for MapBase-based maps:

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::update
  GaudiUtils::HashMap::update
  GaudiUtils::VectorMap::update

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      'Set-item' for MapBase-based maps:

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

Definition at line 395 of file Pythonizations.py.

395
396 def __mapbase_setitem__ ( self , key , value ) :
397 """
398 'Set-item' for MapBase-based maps:
399
400 >>> m = ... ## the map
401 >>> m[key] = value ## set the item
402
403 """
404 _replaced = True if key in self else False
405 self.update ( key , value )
406 return _replaced
407
# ============================================

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

Representation of MapBase-based maps.

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap

Author
  Vanya BELYAEV Ivan..nosp@m.BEly.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Representation of MapBase-based maps:

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

Definition at line 359 of file Pythonizations.py.

359
360 def __mapbase_str__ ( self ) :
361 """
362 Representation of MapBase-based maps:
363
364 >>> m = ... ## the map
365 >>> print map
366
367 """
368 _result = ' { '
369 _size = len ( self )
370 for i in range ( 0 , _size ) :
371 _key = self.key_at ( i )
372 _val = self.at ( _key )
373 if 0 != i : _result += ' , '
374 _result += " %s : %s " % ( str ( _key ) , str ( _val ) )
375 _result += ' } '
376 return _result
377
# ============================================

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

Get the list of values for the map.

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

See Also
  Gaudi::Utils::MapBase
  GaudiUtils::Map
  GaudiUtils::HashMap
  GaudiUtils::VectorMap
  GaudiUtils::Map::value_at
  GaudiUtils::HashMap::value_at @ see GaudiUtils::VectorMap::value_at

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2010-02-20

      Get the list of values

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

Definition at line 270 of file Pythonizations.py.

270
271 def __mapbase_values__ ( self ) :
272 """
273 Get the list of values
274
275 >>> m = ... ## the map
276 >>> values = m.values() ## get the list of values
277
278 """
279 _size = len ( self )
280 _values = []
281 for i in range ( 0 , _size ) :
282 _value = self.value_at ( i )
283 _values.append ( _value )
284 return _values
285
# ============================================

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

Definition at line 48 of file Pythonizations.py.

48
49 def _container__getitem__(self, k) :
return self.containedObject(k)

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

Definition at line 52 of file Pythonizations.py.

52
53 def _container__iter__(self) :
54 if hasattr(self,'containedObjects') : sequential = self.containedObjects()
55 else : sequential = self
56 count = 0
57 limit = self.__len__()
58 while count < limit :
59 yield sequential.__getitem__(count)
60 count += 1

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

Definition at line 50 of file Pythonizations.py.

50
51 def _container__len__(self) :
return self.numberOfObjects()

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

Definition at line 24 of file Pythonizations.py.

24
25 def _contentsHisto1D(h) :
26 x = h.axis()
return map(h.binEntries, range(x.bins()))

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

61
62 def _draw_aida_ ( self , *args ) :
63 """
64 Draw AIDA histogram (through access to internal ROOT histogram
65
66 >>> aida = ... # get the historgam
67 >>> aida.Draw()
68
69 """
70 _fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
71 _root = _fun ( self )
72 return _root.Draw( *args )
73
74 gbl.AIDA.IHistogram1D.__repr__ = _printHisto1D
75 gbl.AIDA.IHistogram1D.contents = _contentsHisto1D
gbl.AIDA.IHistogram2D.__repr__ = _printHisto2D

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

Definition at line 34 of file Pythonizations.py.

34
35 def _printBitReference(b) :
return str(1==b.bool())

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

Definition at line 36 of file Pythonizations.py.

36
37 def _printFillStream(o) :
38 if o :
39 s = gbl.stringstream()
40 o.fillStream(s)
41 out = str(s.str())
42 if out == '' :
43 out = o.__class__.__name__ + ' object'
44 if hasattr( o, 'hasKey') and o.hasKey() :
45 out += ' key = '+ str(o.key())
46 else :
47 out = o.__class__.__name__ + ' NULL object'
return out

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

Definition at line 21 of file Pythonizations.py.

21
22 def _printHisto1D(h) :
23 x = h.axis()
return 'Histogram 1D "%s" %d bins [%f,%f]' % (h.title(), x.bins(), x.lowerEdge(), x.upperEdge())

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

Definition at line 27 of file Pythonizations.py.

27
28 def _printHisto2D(h) :
29 x,y = h.xAxis(),h.yAxis()
30 return 'Histogram 2D "%s" %d xbins [%f,%f], %d ybins [%f,%f]' % \
(h.title(), x.bins(), x.lowerEdge(), x.upperEdge(), y.bins(), y.lowerEdge(), y.upperEdge() )

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

Definition at line 31 of file Pythonizations.py.

31
32 def _printStatusCode(s) :
33 if s.isSuccess() : return 'SUCCESS'
else : return 'FAILURE'

## Variable Documentation

list GaudiPython.Pythonizations.__all__ [ ]

Definition at line 8 of file Pythonizations.py.

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

Definition at line 103 of file Pythonizations.py.

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

Definition at line 108 of file Pythonizations.py.