All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 More...
 
def __mapbase_iteritems__
 The iterator for MapBase class. More...
 
def __mapbase_keys__
 Get the list of keys for the map. More...
 
def __mapbase_items__
 Get the list of items for the map. More...
 
def __mapbase_values__
 Get the list of values for the map. More...
 
def __mapbase_contains__
 Check if the certain key is in the map. More...
 
def __mapbase_get__
 Get the value for certain key, return predefined value otherwise. More...
 
def __mapbase_str__
 Representation of MapBase-based maps. More...
 
def __mapbase_setitem__
 "Setitem" for MapBase-based maps: More...
 
def __mapbase_delitem__
 "Del-item" for MapBase-based maps: More...
 

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

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

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

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

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

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

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

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

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

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

273 def __mapbase_values__ ( self ) :
274  """
275  Get the list of values
276 
277  >>> m = ... ## the map
278  >>> values = m.values() ## get the list of values
279 
280  """
281  _size = len ( self )
282  _values = []
283  for i in range ( 0 , _size ) :
284  _value = self.value_at ( i )
285  _values.append ( _value )
286  return _values
287 
# ============================================
def __mapbase_values__
Get the list of values for the map.
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()))
struct GAUDI_API map
Parametrisation class for map-like implementation.
NamedRange_< CONTAINER > range(const CONTAINER &cnt, const std::string &name)
simple function to create the named range form arbitrary container
Definition: NamedRange.h:133
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 105 of file Pythonizations.py.

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

Definition at line 110 of file Pythonizations.py.