CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.Handle Class Reference

## Handle

More...

Public Member Functions

def __init__
 
def __str__
 
def isValid
 
def product
 

Private Member Functions

def _addressOf
 
def _resetWrapper
 Private member functions ##. More...
 
def _setStatus
 
def _typeInfoGetter
 

Private Attributes

 _exception
 
 _nodel
 
 _type
 
 _typeInfo
 
 _wrapper
 

Detailed Description

## Handle

Python interface to FWLite Handle class

Definition at line 50 of file __init__.py.

Constructor & Destructor Documentation

def python.Handle.__init__ (   self,
  typeString,
  kwargs 
)
Initialize python handle wrapper 

Definition at line 55 of file __init__.py.

55 
56  **kwargs):
57  """Initialize python handle wrapper """
58  # turn off warnings
59  oldWarningLevel = ROOT.gErrorIgnoreLevel
60  ROOT.gErrorIgnoreLevel = ROOT.kError
61  self._nodel = False
62  if kwargs.get ('noDelete'):
63  print("Not deleting wrapper")
64  del kwargs['noDelete']
65  else:
66  self._nodel = True
67  self._type = typeString
69  self._exception = RuntimeError ("getByLabel not called for '%s'", self)
70  # restore warning state
71  ROOT.gErrorIgnoreLevel = oldWarningLevel
72  # Since we deleted the options as we used them, that means
73  # that kwargs should be empty. If it's not, that means that
74  # somebody passed in an argument that we're not using and we
75  # should complain.
76  if len (kwargs):
77  raise RuntimeError("Unknown arguments %s" % kwargs)
def _resetWrapper
Private member functions ##.
Definition: __init__.py:97
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Function Documentation

def python.Handle.__str__ (   self)

Definition at line 91 of file __init__.py.

References PGeometricDet::Item._type, python.Handle._type, and MELaserPrim._type.

Referenced by edmStreamStallGrapher.Point.__repr__(), BeautifulSoup.Tag.__repr__(), BeautifulSoup.Tag.__unicode__(), and BeautifulSoup.Tag.prettify().

91 
92  def __str__ (self):
93  return "%s" % (self._type)
94 
def python.Handle._addressOf (   self)
private
(Internal) Return address of edm wrapper

Definition at line 114 of file __init__.py.

References python.Handle._wrapper.

115  def _addressOf (self):
116  """(Internal) Return address of edm wrapper"""
117  return ROOT.AddressOf (self._wrapper)
118 
def _addressOf
Definition: __init__.py:114
def python.Handle._resetWrapper (   self)
private

Private member functions ##.

(Internal) reset the edm wrapper

Definition at line 97 of file __init__.py.

97 
98  def _resetWrapper (self):
99  """(Internal) reset the edm wrapper"""
100  self._wrapper = ROOT.edm.Wrapper (self._type)()
101  self._typeInfo = self._wrapper.typeInfo()
102  ROOT.SetOwnership (self._wrapper, False)
103  # O.k. This is a little weird. We want a pointer to an EDM
104  # wrapper, but we don't want the memory it is pointing to.
105  # So, we've created it and grabbed the type info. Since we
106  # don't want a memory leak, we destroy it.
107  if not self._nodel :
108  ROOT.TClass.GetClass("edm::Wrapper<"+self._type+">").Destructor( self._wrapper )
def _resetWrapper
Private member functions ##.
Definition: __init__.py:97
def python.Handle._setStatus (   self,
  getByLabelSuccess,
  labelString 
)
private
(Internal) To be called by Events.getByLabel

Definition at line 119 of file __init__.py.

References python.Handle._exception.

120  def _setStatus (self, getByLabelSuccess, labelString):
121  """(Internal) To be called by Events.getByLabel"""
122  if not getByLabelSuccess:
123  self._exception = RuntimeError ("getByLabel (%s, %s) failed" \
124  % (self, labelString))
125  return
126  if not self._wrapper.isPresent():
127  self._exception = RuntimeError ("getByLabel (%s, %s) not present this event" \
128  % (self, labelString))
129  return
130  # if we're still here, then everything is happy. Clear the exception
131  self._exception = None
132 
def _setStatus
Definition: __init__.py:119
def python.Handle._typeInfoGetter (   self)
private
(Internal) Return the type info

Definition at line 109 of file __init__.py.

References python.Handle._typeInfo.

110  def _typeInfoGetter (self):
111  """(Internal) Return the type info"""
112  return self._typeInfo
113 
def _typeInfoGetter
Definition: __init__.py:109
def python.Handle.isValid (   self)
Returns true if getByLabel call was successful and data is
present in handle.

Definition at line 78 of file __init__.py.

References python.Handle._exception.

Referenced by ntupleDataFormat._Object._checkIsValid(), and core.AutoHandle.AutoHandle.ReallyLoad().

78 
79  def isValid (self):
80  """Returns true if getByLabel call was successful and data is
81  present in handle."""
82  return not self._exception
83 
def python.Handle.product (   self)
Returns product stored in handle.

Definition at line 84 of file __init__.py.

References python.Handle._exception.

84 
85  def product (self):
86  """Returns product stored in handle."""
87  if self._exception:
88  raise self._exception
89  return self._wrapper.product()
90 

Member Data Documentation

python.Handle._exception
private

Definition at line 68 of file __init__.py.

Referenced by python.Handle._setStatus(), python.Handle.isValid(), and python.Handle.product().

python.Handle._nodel
private

Definition at line 60 of file __init__.py.

python.Handle._type
private

Definition at line 66 of file __init__.py.

Referenced by python.Handle.__str__(), and SequenceTypes.ExpandVisitor.result().

python.Handle._typeInfo
private

Definition at line 100 of file __init__.py.

Referenced by python.Handle._typeInfoGetter().

python.Handle._wrapper
private

Definition at line 99 of file __init__.py.

Referenced by python.Handle._addressOf().