Gaudi Framework, version v23r9

Home   Generated: Thu Jul 18 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
GaudiPython.Pythonizations Namespace Reference

Functions

def _loadDict
 
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__ [ ]
 
 gbl PyCintex.gbl
 
 _loadDict_save PyCintex.loadDict
 
 _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 307 of file Pythonizations.py.

308 def __mapbase_contains__ ( self , key ) :
309  """
310  Check if the certainkey is in the map
311 
312  >>> m = ... ## the map
313  >>> if 'a' in m : ... ## chekc the presence of the key in the map
314 
315  """
316  _num = self.count ( key )
317  return False if 0 == _num else True
318 
# ============================================
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 430 of file Pythonizations.py.

431 def __mapbase_delitem__ ( self , key ) :
432  """
433  'Del-item' for MapBase-based maps:
434 
435  >>> m = ... ## the map
436  >>> del m[key]
437 
438  """
439  _erased = True if key in self else False
440  self.erase ( key )
441  return _erased
442 
443 gbl.Gaudi.Utils.MapBase . __len__ = lambda s : s.size()
444 gbl.Gaudi.Utils.MapBase . __iter__ = __mapbase_iter__
445 gbl.Gaudi.Utils.MapBase . keys = __mapbase_keys__
446 gbl.Gaudi.Utils.MapBase . __iteritems__ = __mapbase_iteritems__
447 gbl.Gaudi.Utils.MapBase . iteritems = __mapbase_iteritems__
448 gbl.Gaudi.Utils.MapBase . items = __mapbase_items__
449 gbl.Gaudi.Utils.MapBase . values = __mapbase_values__
450 gbl.Gaudi.Utils.MapBase . __contains__ = __mapbase_contains__
451 gbl.Gaudi.Utils.MapBase . has_key = __mapbase_contains__
452 gbl.Gaudi.Utils.MapBase . get = __mapbase_get__
453 gbl.Gaudi.Utils.MapBase . __str__ = __mapbase_str__
454 gbl.Gaudi.Utils.MapBase . __repr__ = __mapbase_str__
455 gbl.Gaudi.Utils.MapBase . __setitem__ = __mapbase_setitem__
456 gbl.Gaudi.Utils.MapBase . __delitem__ = __mapbase_delitem__
457 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 337 of file Pythonizations.py.

338 def __mapbase_get__ ( self , key , value = None ) :
339  """
340  Get the value for the certain key, or 'value' otherwise
341 
342  >>> m = ... ## the map
343  >>> v = m.get ( key , 15 )
344 
345  """
346  if key in self : return self.at( key )
347  return value
348 
# ============================================
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 240 of file Pythonizations.py.

241 def __mapbase_items__ ( self ) :
242  """
243  Get the list of items
244 
245  >>> m = ... ## the map
246  >>> items = m.keys() ## get the list of items
247 
248  """
249  _size = len ( self )
250  _items = []
251  for i in range ( 0 , _size ) :
252  _key = self.key_at ( i )
253  _value = self.at ( _key )
254  _items.append ( ( _key , _value ) )
255  return _items
256 
# ============================================
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 141 of file Pythonizations.py.

142 def __mapbase_iter__ ( self ) :
143  """
144  The iterator for MapBase-based containers
145 
146  >>> m = ... ## the map
147  >>> for key in m : print key , m[key]
148 
149  """
150  _size = len ( self )
151  _index = 0
152  while _index < _size :
153  yield self.key_at ( _index )
154  _index +=1
155 
# =============================================================================
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 176 of file Pythonizations.py.

177 def __mapbase_iteritems__ ( self ) :
178  """
179  The iterator for MapBase-based containers
180 
181  >>> m = ... ## the map
182  >>> for key,value in m.iteritems() : print key, value
183 
184  """
185  _size = len ( self )
186  _index = 0
187  while _index < _size :
188  _key = self.key_at ( _index )
189  yield ( _key , self.at ( _key ) )
190  _index +=1
191 
# ============================================
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 209 of file Pythonizations.py.

210 def __mapbase_keys__ ( self ) :
211  """
212  Get the list of keys
213 
214  >>> m = ... ## the map
215  >>> keys = m.keys() ## get the list of keys
216 
217  """
218  _size = len ( self )
219  _keys = []
220  for i in range ( 0 , _size ) : _keys.append ( self.key_at ( i ) )
221  return _keys
222 
# ============================================
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 399 of file Pythonizations.py.

400 def __mapbase_setitem__ ( self , key , value ) :
401  """
402  'Set-item' for MapBase-based maps:
403 
404  >>> m = ... ## the map
405  >>> m[key] = value ## set the item
406 
407  """
408  _replaced = True if key in self else False
409  self.update ( key , value )
410  return _replaced
411 
# ============================================
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 363 of file Pythonizations.py.

364 def __mapbase_str__ ( self ) :
365  """
366  Representation of MapBase-based maps:
367 
368  >>> m = ... ## the map
369  >>> print map
370 
371  """
372  _result = ' { '
373  _size = len ( self )
374  for i in range ( 0 , _size ) :
375  _key = self.key_at ( i )
376  _val = self.at ( _key )
377  if 0 != i : _result += ' , '
378  _result += " %s : %s " % ( str ( _key ) , str ( _val ) )
379  _result += ' } '
380  return _result
381 
# ============================================
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 274 of file Pythonizations.py.

275 def __mapbase_values__ ( self ) :
276  """
277  Get the list of values
278 
279  >>> m = ... ## the map
280  >>> values = m.values() ## get the list of values
281 
282  """
283  _size = len ( self )
284  _values = []
285  for i in range ( 0 , _size ) :
286  _value = self.value_at ( i )
287  _values.append ( _value )
288  return _values
289 
# ============================================
def GaudiPython.Pythonizations._container__getitem__ (   self,
  k 
)
private

Definition at line 52 of file Pythonizations.py.

52 
53 def _container__getitem__(self, k) :
return self.containedObject(k)
def GaudiPython.Pythonizations._container__iter__ (   self)
private

Definition at line 56 of file Pythonizations.py.

56 
57 def _container__iter__(self) :
58  if hasattr(self,'containedObjects') : sequential = self.containedObjects()
59  else : sequential = self
60  count = 0
61  limit = self.__len__()
62  while count < limit :
63  yield sequential.__getitem__(count)
64  count += 1
def GaudiPython.Pythonizations._container__len__ (   self)
private

Definition at line 54 of file Pythonizations.py.

54 
55 def _container__len__(self) :
return self.numberOfObjects()
def GaudiPython.Pythonizations._contentsHisto1D (   h)
private

Definition at line 28 of file Pythonizations.py.

28 
29 def _contentsHisto1D(h) :
30  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 65 of file Pythonizations.py.

65 
66 def _draw_aida_ ( self , *args ) :
67  """
68  Draw AIDA histogram (through access to internal ROOT histogram
69 
70  >>> aida = ... # get the historgam
71  >>> aida.Draw()
72 
73  """
74  _fun = PyCintex.gbl.Gaudi.Utils.Aida2ROOT.aida2root
75  _root = _fun ( self )
76  return _root.Draw( *args )
77 
78 gbl.AIDA.IHistogram1D.__repr__ = _printHisto1D
79 gbl.AIDA.IHistogram1D.contents = _contentsHisto1D
gbl.AIDA.IHistogram2D.__repr__ = _printHisto2D
def GaudiPython.Pythonizations._loadDict (   name)
private

Definition at line 18 of file Pythonizations.py.

18 
19 def _loadDict(name):
20  import sys
21  if sys.platform != 'win32' and name[:3] != 'lib' : name = 'lib'+name
22  return _loadDict_save(name)
23 PyCintex.loadDict = _loadDict
24 
#--- Adding extra functionality to C++ raw classes------------------------------------
def GaudiPython.Pythonizations._printBitReference (   b)
private

Definition at line 38 of file Pythonizations.py.

38 
39 def _printBitReference(b) :
return str(1==b.bool())
def GaudiPython.Pythonizations._printFillStream (   o)
private

Definition at line 40 of file Pythonizations.py.

40 
41 def _printFillStream(o) :
42  if o :
43  s = gbl.stringstream()
44  o.fillStream(s)
45  out = s.str()
46  if out == '' :
47  out = o.__class__.__name__ + ' object'
48  if hasattr( o, 'hasKey') and o.hasKey() :
49  out += ' key = '+ str(o.key())
50  else :
51  out = o.__class__.__name__ + ' NULL object'
return out
def GaudiPython.Pythonizations._printHisto1D (   h)
private

Definition at line 25 of file Pythonizations.py.

25 
26 def _printHisto1D(h) :
27  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 31 of file Pythonizations.py.

31 
32 def _printHisto2D(h) :
33  x,y = h.xAxis(),h.yAxis()
34  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 35 of file Pythonizations.py.

35 
36 def _printStatusCode(s) :
37  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 107 of file Pythonizations.py.

GaudiPython.Pythonizations._loadDict_save PyCintex.loadDict

Definition at line 17 of file Pythonizations.py.

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

Definition at line 112 of file Pythonizations.py.

GaudiPython.Pythonizations.gbl PyCintex.gbl

Definition at line 11 of file Pythonizations.py.


Generated at Thu Jul 18 2013 12:18:15 for Gaudi Framework, version v23r9 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004