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