Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 # ============================================
362 # Get the value for certain key,
363 # return predefined value otherwise
364 #
365 # @code
366 #
367 # >>> m = ... ## the map
368 # >>> v = m.get( key , 15 ) ## return the value[key] for existing key, else 15
369 #
370 # @endcode
371 # @see Gaudi::Utils::MapBase
372 # @see GaudiUtils::Map
373 # @see GaudiUtils::HashMap
374 # @see GaudiUtils::VectorMap
375 # @see GaudiUtils::Map::count
376 # @see GaudiUtils::HashMap::count
377 # @ see GaudiUtils::VectorMap::count
378 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
379 # @date 2010-02-20
380 
381 
def __mapbase_contains__(self, key)
def GaudiPython.Pythonizations.__mapbase_delitem__ (   self,
  key 
)
'Del-item' for MapBase-based maps:

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

Definition at line 486 of file Pythonizations.py.

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

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

277  """
278  Get the list of items
279 
280  >>> m = ... ## the map
281  >>> items = m.keys() ## get the list of items
282 
283  """
284  _size = len(self)
285  _items = []
286  for i in range(0, _size):
287  _key = self.key_at(i)
288  _value = self.at(_key)
289  _items.append((_key, _value))
290  return _items
291 
292 
293 # ============================================
294 # Get the list of values for the map
295 #
296 # @code
297 #
298 # >>> m = ... ## the map
299 # >>> values = m.values () ## get the list of values
300 #
301 # @endcode
302 # @see Gaudi::Utils::MapBase
303 # @see GaudiUtils::Map
304 # @see GaudiUtils::HashMap
305 # @see GaudiUtils::VectorMap
306 # @see GaudiUtils::Map::value_at
307 # @see GaudiUtils::HashMap::value_at
308 # @ see GaudiUtils::VectorMap::value_at
309 # @author Vanya BELYAEV Ivan.Belyaev@itep.ru
310 # @date 2010-02-20
311 
312 
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
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 167 of file Pythonizations.py.

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

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

242  """
243  Get the list of keys
244 
245  >>> m = ... ## the map
246  >>> keys = m.keys() ## get the list of keys
247 
248  """
249  _size = len(self)
250  _keys = []
251  for i in range(0, _size):
252  _keys.append(self.key_at(i))
253  return _keys
254 
255 
256 # ============================================
257 # Get the list of items for the map
258 #
259 # @code
260 #
261 # >>> m = ... ## the map
262 # >>> items = m.items() ## get the list of items
263 #
264 # @endcode
265 # @see Gaudi::Utils::MapBase
266 # @see GaudiUtils::Map
267 # @see GaudiUtils::HashMap
268 # @see GaudiUtils::VectorMap
269 # @see GaudiUtils::Map::key_at
270 # @see GaudiUtils::HashMap::key_at
271 # @ see GaudiUtils::VectorMap::key_at
272 # @author Vanya BELYAEV Ivan.BElyaev@itep.ru
273 # @date 2010-02-20
274 
275 
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
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 452 of file Pythonizations.py.

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

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

Definition at line 412 of file Pythonizations.py.

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

314  """
315  Get the list of values
316 
317  >>> m = ... ## the map
318  >>> values = m.values() ## get the list of values
319 
320  """
321  _size = len(self)
322  _values = []
323  for i in range(0, _size):
324  _value = self.value_at(i)
325  _values.append(_value)
326  return _values
327 
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 
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
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 
def _container__getitem__(self, k)
def GaudiPython.Pythonizations._container__iter__ (   self)
private

Definition at line 75 of file Pythonizations.py.

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 
def GaudiPython.Pythonizations._container__len__ (   self)
private

Definition at line 71 of file Pythonizations.py.

72  return self.numberOfObjects()
73 
74 
def GaudiPython.Pythonizations._contentsHisto1D (   h)
private

Definition at line 30 of file Pythonizations.py.

31  x = h.axis()
32  return map(h.binEntries, range(x.bins()))
33 
34 
struct GAUDI_API map
Parametrisation class for map-like implementation.
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
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
def _draw_aida_(self, args)
def GaudiPython.Pythonizations._printBitReference (   b)
private

Definition at line 49 of file Pythonizations.py.

50  return str(1 == b.bool())
51 
52 
def GaudiPython.Pythonizations._printFillStream (   o)
private

Definition at line 53 of file Pythonizations.py.

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 
def GaudiPython.Pythonizations._printHisto1D (   h)
private

Definition at line 24 of file Pythonizations.py.

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

Definition at line 35 of file Pythonizations.py.

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 
def GaudiPython.Pythonizations._printStatusCode (   s)
private

Definition at line 42 of file Pythonizations.py.

43  if s.isSuccess():
44  return 'SUCCESS'
45  else:
46  return 'FAILURE'
47 
48 

Variable Documentation

list GaudiPython.Pythonizations.__all__ = []
private

Definition at line 7 of file Pythonizations.py.

GaudiPython.Pythonizations.__getitem__
private

Definition at line 115 of file Pythonizations.py.

GaudiPython.Pythonizations.__iter__
private

Definition at line 117 of file Pythonizations.py.

GaudiPython.Pythonizations.__len__
private

Definition at line 116 of file Pythonizations.py.

GaudiPython.Pythonizations.__repr__
private

Definition at line 108 of file Pythonizations.py.

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

Definition at line 132 of file Pythonizations.py.

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

Definition at line 137 of file Pythonizations.py.

GaudiPython.Pythonizations.Draw

Definition at line 105 of file Pythonizations.py.

GaudiPython.Pythonizations.FAILURE

Definition at line 128 of file Pythonizations.py.

GaudiPython.Pythonizations.invalidate

Definition at line 121 of file Pythonizations.py.

GaudiPython.Pythonizations.plot

Definition at line 106 of file Pythonizations.py.

GaudiPython.Pythonizations.SUCCESS

Definition at line 127 of file Pythonizations.py.

GaudiPython.Pythonizations.update

Definition at line 119 of file Pythonizations.py.