GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
go4.py
Go to the documentation of this file.
1 
2 from internals.facade import Facade
3 from types import ModuleType
4 
5 
6 def realNone(obj):
7  """
8  Replace PyROOT null pointer (== None) with a real Python None (is None)
9  """
10  return None if obj == None else obj
11 
12 
13 
14 @Facade(__name__)
15 class go4Wrapper(ModuleType):
16  """
17  Wraps the PyROOT-bound go4 object (transferred here via __builtin__)
18  to provide some safety measures
19  """
20  try:
21  analysis = go4
22  except NameError:
23  analysis = None
24 
25  def __getattr__(self, name):
26  """Forward missing attributes to the internal go4 object"""
27  return getattr(self.analysis, name)
28 
29  def NextMatchingObject(self, expr="*", folder=None, reset=False):
30  """Safer proxy for the eponymous go4 method"""
31  if not folder:
32  folder = "Go4"
33  obj = self.analysis.NextMatchingObject(expr, folder, reset)
34  return self.realNone(obj)
35 
36 
37 
def realNone
Definition: go4.py:6
def NextMatchingObject
Definition: go4.py:29