The Gaudi Framework  master (bb95dfce)
Loading...
Searching...
No Matches
GaudiPython.Pythonizations Namespace Reference

Functions

 _printHisto1D (h)
 _contentsHisto1D (h)
 _printHisto2D (h)
 _printStatusCode (s)
 _printBitReference (b)
 _printFillStream (o)
 _container__getitem__ (self, k)
 _container__len__ (self)
 _container__iter__ (self)
 _draw_aida_ (self, *args)
 __mapbase_iter__ (self)
 __mapbase_iteritems__ (self)
 __mapbase_keys__ (self)
 __mapbase_items__ (self)
 __mapbase_values__ (self)
 __mapbase_contains__ (self, key)
 __mapbase_get__ (self, key, value=None)
 __mapbase_str__ (self)
 __mapbase_setitem__ (self, key, value)
 __mapbase_delitem__ (self, key)

Variables

list __all__ = []
 (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE".
 __str__
 contents
 Draw
 plot
 __repr__
 __getitem__
 __len__
 __iter__
 SUCCESS
 FAILURE
 _eq = gbl.Gaudi.StringKey.__cpp_eq__
 _ne = gbl.Gaudi.StringKey.__cpp_ne__
 keys
 __iteritems__
 values
 __contains__
 get
 __setitem__
 __delitem__
 items
 executeEvent
 Helpers for re-entrant interfaces.
 isExecuted
 filterPassed
 _execute_orig
 execute
 self
 ctx

Function Documentation

◆ __mapbase_contains__()

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

365def __mapbase_contains__(self, key):
366 """
367 Check if the certainkey is in the map
368
369 >>> m = ... ## the map
370 >>> if 'a' in m : ... ## chekc the presence of the key in the map
371
372 """
373 _num = self.count(key)
374 return False if 0 == _num else True
375
376
377# ============================================
378# Get the value for certain key,
379# return predefined value otherwise
380#
381# @code
382#
383# >>> m = ... ## the map
384# >>> v = m.get( key , 15 ) ## return the value[key] for existing key, else 15
385#
386# @endcode
387# @see Gaudi::Utils::MapBase
388# @see GaudiUtils::Map
389# @see GaudiUtils::HashMap
390# @see GaudiUtils::VectorMap
391# @see GaudiUtils::Map::count
392# @see GaudiUtils::HashMap::count
393# @ see GaudiUtils::VectorMap::count
394# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
395# @date 2010-02-20
396
397

◆ __mapbase_delitem__()

GaudiPython.Pythonizations.__mapbase_delitem__ ( self,
key )
'Del-item' for MapBase-based maps:

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

Definition at line 502 of file Pythonizations.py.

502def __mapbase_delitem__(self, key):
503 """
504 'Del-item' for MapBase-based maps:
505
506 >>> m = ... ## the map
507 >>> del m[key]
508
509 """
510 _erased = True if key in self else False
511 self.erase(key)
512 return _erased
513
514

◆ __mapbase_get__()

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

398def __mapbase_get__(self, key, value=None):
399 """
400 Get the value for the certain key, or 'value' otherwise
401
402 >>> m = ... ## the map
403 >>> v = m.get ( key , 15 )
404
405 """
406 if key in self:
407 return self.at(key)
408 return value
409
410
411# ============================================
412# Representation of MapBase-based maps
413#
414# @code
415#
416# >>> m = ... ## the map
417# >>> print(m)
418#
419# @endcode
420# @see Gaudi::Utils::MapBase
421# @see GaudiUtils::Map
422# @see GaudiUtils::HashMap
423# @see GaudiUtils::VectorMap
424# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
425# @date 2010-02-20
426
427

◆ __mapbase_items__()

GaudiPython.Pythonizations.__mapbase_items__ ( self)
Get the list of items

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

Definition at line 292 of file Pythonizations.py.

292def __mapbase_items__(self):
293 """
294 Get the list of items
295
296 >>> m = ... ## the map
297 >>> items = m.keys() ## get the list of items
298
299 """
300 _size = len(self)
301 _items = []
302 for i in range(0, _size):
303 _key = self.key_at(i)
304 _value = self.at(_key)
305 _items.append((_key, _value))
306 return _items
307
308
309# ============================================
310# Get the list of values for the map
311#
312# @code
313#
314# >>> m = ... ## the map
315# >>> values = m.values () ## get the list of values
316#
317# @endcode
318# @see Gaudi::Utils::MapBase
319# @see GaudiUtils::Map
320# @see GaudiUtils::HashMap
321# @see GaudiUtils::VectorMap
322# @see GaudiUtils::Map::value_at
323# @see GaudiUtils::HashMap::value_at
324# @ see GaudiUtils::VectorMap::value_at
325# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
326# @date 2010-02-20
327
328

◆ __mapbase_iter__()

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

183def __mapbase_iter__(self):
184 """
185 The iterator for MapBase-based containers
186
187 >>> m = ... ## the map
188 >>> for key in m : print(key , m[key])
189
190 """
191 _size = len(self)
192 _index = 0
193 while _index < _size:
194 yield self.key_at(_index)
195 _index += 1
196
197
198# =============================================================================
199# The iterator for MapBase class
200#
201# @code
202#
203# >>> m = ... ## the map
204# >>> for key,value in m.iteritems() : print(key , value)
205#
206# @endcode
207# @see Gaudi::Utils::MapBase
208# @see GaudiUtils::Map
209# @see GaudiUtils::HashMap
210# @see GaudiUtils::VectorMap
211# @see GaudiUtils::Map::key_at
212# @see GaudiUtils::HashMap::key_at
213# @see GaudiUtils::VectorMap::key_at
214# @see GaudiUtils::Map::value_at
215# @see GaudiUtils::HashMap::value_at
216# @see GaudiUtils::VectorMap::value_at
217# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
218# @date 2010-02-20
219
220

◆ __mapbase_iteritems__()

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

221def __mapbase_iteritems__(self):
222 """
223 The iterator for MapBase-based containers
224
225 >>> m = ... ## the map
226 >>> for key,value in m.iteritems() : print(key, value)
227
228 """
229 _size = len(self)
230 _index = 0
231 while _index < _size:
232 _key = self.key_at(_index)
233 yield (_key, self.at(_key))
234 _index += 1
235
236
237# ============================================
238# Get the list of keys for the map
239#
240# @code
241#
242# >>> m = ... ## the map
243# >>> keys = m.keys() ## get the list of keys
244#
245# @endcode
246# @see Gaudi::Utils::MapBase
247# @see GaudiUtils::Map
248# @see GaudiUtils::HashMap
249# @see GaudiUtils::VectorMap
250# @see GaudiUtils::Map::key_at
251# @see GaudiUtils::HashMap::key_at
252# @ see GaudiUtils::VectorMap::key_at
253# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
254# @date 2010-02-20
255
256

◆ __mapbase_keys__()

GaudiPython.Pythonizations.__mapbase_keys__ ( self)
Get the list of keys

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

Definition at line 257 of file Pythonizations.py.

257def __mapbase_keys__(self):
258 """
259 Get the list of keys
260
261 >>> m = ... ## the map
262 >>> keys = m.keys() ## get the list of keys
263
264 """
265 _size = len(self)
266 _keys = []
267 for i in range(0, _size):
268 _keys.append(self.key_at(i))
269 return _keys
270
271
272# ============================================
273# Get the list of items for the map
274#
275# @code
276#
277# >>> m = ... ## the map
278# >>> items = m.items() ## get the list of items
279#
280# @endcode
281# @see Gaudi::Utils::MapBase
282# @see GaudiUtils::Map
283# @see GaudiUtils::HashMap
284# @see GaudiUtils::VectorMap
285# @see GaudiUtils::Map::key_at
286# @see GaudiUtils::HashMap::key_at
287# @ see GaudiUtils::VectorMap::key_at
288# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
289# @date 2010-02-20
290
291

◆ __mapbase_setitem__()

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

468def __mapbase_setitem__(self, key, value):
469 """
470 'Set-item' for MapBase-based maps:
471
472 >>> m = ... ## the map
473 >>> m[key] = value ## set the item
474
475 """
476 _replaced = True if key in self else False
477 self.update(key, value)
478 return _replaced
479
480
481# ============================================
482# "Del-item" for MapBase-based maps:
483#
484# @code
485#
486# >>> m = ... ## the map
487# >>> del m [ key] ## del th eitem
488#
489# @endcode
490#
491# @see Gaudi::Utils::MapBase
492# @see GaudiUtils::Map
493# @see GaudiUtils::HashMap
494# @see GaudiUtils::VectorMap
495# @see GaudiUtils::Map::erase
496# @see GaudiUtils::HashMap::erase
497# @see GaudiUtils::VectorMap::erase
498# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
499# @date 2010-02-20
500
501

◆ __mapbase_str__()

GaudiPython.Pythonizations.__mapbase_str__ ( self)
Representation of MapBase-based maps:

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

Definition at line 428 of file Pythonizations.py.

428def __mapbase_str__(self):
429 """
430 Representation of MapBase-based maps:
431
432 >>> m = ... ## the map
433 >>> print(map)
434
435 """
436 _result = " { "
437 _size = len(self)
438 for i in range(0, _size):
439 _key = self.key_at(i)
440 _val = self.at(_key)
441 if 0 != i:
442 _result += " , "
443 _result += " %s : %s " % (str(_key), str(_val))
444 _result += " } "
445 return _result
446
447
448# ============================================
449# "Setitem" for MapBase-based maps:
450#
451# @code
452#
453# >>> m = ... ## the map
454# >>> m [ key] = value ## set the item
455#
456# @endcode
457# @see Gaudi::Utils::MapBase
458# @see GaudiUtils::Map
459# @see GaudiUtils::HashMap
460# @see GaudiUtils::VectorMap
461# @see GaudiUtils::Map::update
462# @see GaudiUtils::HashMap::update
463# @see GaudiUtils::VectorMap::update
464# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
465# @date 2010-02-20
466
467

◆ __mapbase_values__()

GaudiPython.Pythonizations.__mapbase_values__ ( self)
Get the list of values

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

Definition at line 329 of file Pythonizations.py.

329def __mapbase_values__(self):
330 """
331 Get the list of values
332
333 >>> m = ... ## the map
334 >>> values = m.values() ## get the list of values
335
336 """
337 _size = len(self)
338 _values = []
339 for i in range(0, _size):
340 _value = self.value_at(i)
341 _values.append(_value)
342 return _values
343
344
345# ============================================
346# Check if the certain key is in the map
347#
348# @code
349#
350# >>> m = ... ## the map
351# >>> if 'a' in m : print('key is in the map!')
352#
353# @endcode
354# @see Gaudi::Utils::MapBase
355# @see GaudiUtils::Map
356# @see GaudiUtils::HashMap
357# @see GaudiUtils::VectorMap
358# @see GaudiUtils::Map::count
359# @see GaudiUtils::HashMap::count
360# @ see GaudiUtils::VectorMap::count
361# @author Vanya BELYAEV Ivan.BElyaev@itep.ru
362# @date 2010-02-20
363
364

◆ _container__getitem__()

GaudiPython.Pythonizations._container__getitem__ ( self,
k )
protected

Definition at line 87 of file Pythonizations.py.

87def _container__getitem__(self, k):
88 return self.containedObject(k)
89
90

◆ _container__iter__()

GaudiPython.Pythonizations._container__iter__ ( self)
protected

Definition at line 95 of file Pythonizations.py.

95def _container__iter__(self):
96 if hasattr(self, "containedObjects"):
97 sequential = self.containedObjects()
98 else:
99 sequential = self
100 count = 0
101 limit = self.__len__()
102 while count < limit:
103 yield sequential.__getitem__(count)
104 count += 1
105
106

◆ _container__len__()

GaudiPython.Pythonizations._container__len__ ( self)
protected

Definition at line 91 of file Pythonizations.py.

91def _container__len__(self):
92 return self.numberOfObjects()
93
94

◆ _contentsHisto1D()

GaudiPython.Pythonizations._contentsHisto1D ( h)
protected

Definition at line 44 of file Pythonizations.py.

44def _contentsHisto1D(h):
45 x = h.axis()
46 return map(h.binEntries, range(x.bins()))
47
48

◆ _draw_aida_()

GaudiPython.Pythonizations._draw_aida_ ( self,
* args )
protected
Draw AIDA histogram (through access to internal ROOT histogram

>>> aida = ...    # get the historgam
>>> aida.Draw()

Definition at line 107 of file Pythonizations.py.

107def _draw_aida_(self, *args):
108 """
109 Draw AIDA histogram (through access to internal ROOT histogram
110
111 >>> aida = ... # get the historgam
112 >>> aida.Draw()
113
114 """
115 _fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
116 _root = _fun(self)
117 return _root.Draw(*args)
118
119

◆ _printBitReference()

GaudiPython.Pythonizations._printBitReference ( b)
protected

Definition at line 69 of file Pythonizations.py.

69def _printBitReference(b):
70 return str(1 == b.bool())
71
72

◆ _printFillStream()

GaudiPython.Pythonizations._printFillStream ( o)
protected

Definition at line 73 of file Pythonizations.py.

73def _printFillStream(o):
74 if o:
75 s = gbl.stringstream()
76 o.fillStream(s)
77 out = str(s.str())
78 if out == "":
79 out = o.__class__.__name__ + " object"
80 if hasattr(o, "hasKey") and o.hasKey():
81 out += " key = " + str(o.key())
82 else:
83 out = o.__class__.__name__ + " NULL object"
84 return out
85
86

◆ _printHisto1D()

GaudiPython.Pythonizations._printHisto1D ( h)
protected

Definition at line 34 of file Pythonizations.py.

34def _printHisto1D(h):
35 x = h.axis()
36 return 'Histogram 1D "%s" %d bins [%f,%f]' % (
37 h.title(),
38 x.bins(),
39 x.lowerEdge(),
40 x.upperEdge(),
41 )
42
43

◆ _printHisto2D()

GaudiPython.Pythonizations._printHisto2D ( h)
protected

Definition at line 49 of file Pythonizations.py.

49def _printHisto2D(h):
50 x, y = h.xAxis(), h.yAxis()
51 return 'Histogram 2D "%s" %d xbins [%f,%f], %d ybins [%f,%f]' % (
52 h.title(),
53 x.bins(),
54 x.lowerEdge(),
55 x.upperEdge(),
56 y.bins(),
57 y.lowerEdge(),
58 y.upperEdge(),
59 )
60
61

◆ _printStatusCode()

GaudiPython.Pythonizations._printStatusCode ( s)
protected

Definition at line 62 of file Pythonizations.py.

62def _printStatusCode(s):
63 if s.isSuccess():
64 return "SUCCESS"
65 else:
66 return "FAILURE"
67
68

Variable Documentation

◆ __all__

list GaudiPython.Pythonizations.__all__ = []
private

(c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE".

# # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #

File: GaudiPython/Pythonizations.py Author: Pere Mato (pere..nosp@m.mato.nosp@m.@cern.nosp@m..ch)

Definition at line 17 of file Pythonizations.py.

◆ __contains__

GaudiPython.Pythonizations.__contains__
private

Definition at line 520 of file Pythonizations.py.

◆ __delitem__

GaudiPython.Pythonizations.__delitem__
private

Definition at line 525 of file Pythonizations.py.

◆ __getitem__

GaudiPython.Pythonizations.__getitem__
private

Definition at line 141 of file Pythonizations.py.

◆ __iter__

GaudiPython.Pythonizations.__iter__
private

Definition at line 143 of file Pythonizations.py.

◆ __iteritems__

GaudiPython.Pythonizations.__iteritems__
private

Definition at line 518 of file Pythonizations.py.

◆ __len__

GaudiPython.Pythonizations.__len__
private

Definition at line 142 of file Pythonizations.py.

◆ __repr__

GaudiPython.Pythonizations.__repr__
private

Definition at line 134 of file Pythonizations.py.

◆ __setitem__

GaudiPython.Pythonizations.__setitem__
private

Definition at line 524 of file Pythonizations.py.

◆ __str__

GaudiPython.Pythonizations.__str__
private

Definition at line 120 of file Pythonizations.py.

◆ _eq

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

Definition at line 153 of file Pythonizations.py.

◆ _execute_orig

GaudiPython.Pythonizations._execute_orig
protected

Definition at line 564 of file Pythonizations.py.

◆ _ne

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

Definition at line 158 of file Pythonizations.py.

◆ contents

GaudiPython.Pythonizations.contents

Definition at line 121 of file Pythonizations.py.

◆ ctx

GaudiPython.Pythonizations.ctx

Definition at line 565 of file Pythonizations.py.

◆ Draw

GaudiPython.Pythonizations.Draw

Definition at line 131 of file Pythonizations.py.

◆ execute

GaudiPython.Pythonizations.execute

Definition at line 565 of file Pythonizations.py.

◆ executeEvent

GaudiPython.Pythonizations.executeEvent

Helpers for re-entrant interfaces.

GaudiPython is inherently single threaded and it's unpractical to use the new re-entrant interfaces. Moreover a lot of existing code (like GaudiMP) expects the old signatures.

Definition at line 561 of file Pythonizations.py.

◆ FAILURE

GaudiPython.Pythonizations.FAILURE

Definition at line 149 of file Pythonizations.py.

◆ filterPassed

GaudiPython.Pythonizations.filterPassed

Definition at line 563 of file Pythonizations.py.

◆ get

GaudiPython.Pythonizations.get

Definition at line 521 of file Pythonizations.py.

◆ isExecuted

GaudiPython.Pythonizations.isExecuted

Definition at line 562 of file Pythonizations.py.

◆ items

GaudiPython.Pythonizations.items

Definition at line 527 of file Pythonizations.py.

◆ keys

GaudiPython.Pythonizations.keys

Definition at line 517 of file Pythonizations.py.

◆ plot

GaudiPython.Pythonizations.plot

Definition at line 132 of file Pythonizations.py.

◆ self

GaudiPython.Pythonizations.self

Definition at line 565 of file Pythonizations.py.

◆ SUCCESS

GaudiPython.Pythonizations.SUCCESS

Definition at line 148 of file Pythonizations.py.

◆ values

GaudiPython.Pythonizations.values

Definition at line 519 of file Pythonizations.py.