CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

python::Handle Class Reference

################## ## ## ############ ## ## ## ## Handle ## ## ## ## ############ ## ## ################## ## More...

List of all members.

Public Member Functions

def __init__
def __str__
def isValid
def product

Private Member Functions

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

Private Attributes

 _exception
 _type
 _typeInfo
 _wrapper

Detailed Description

################## ## ## ############ ## ## ## ## Handle ## ## ## ## ############ ## ## ################## ##

Python interface to FWLite Handle class

Definition at line 49 of file __init__.py.


Constructor & Destructor Documentation

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

Definition at line 52 of file __init__.py.

00055                            :
00056         """Initialize python handle wrapper """
00057         # turn off warnings
00058         oldWarningLevel = ROOT.gErrorIgnoreLevel
00059         ROOT.gErrorIgnoreLevel = ROOT.kError
00060         self._type      = typeString 
00061         self._wrapper   = ROOT.edm.Wrapper (self._type)()
00062         self._typeInfo  = self._wrapper.typeInfo()
00063         self._exception = RuntimeError ("getByLabel not called for '%s'", self)
00064         ROOT.SetOwnership (self._wrapper, False)
00065         # restore warning state
00066         ROOT.gErrorIgnoreLevel = oldWarningLevel
00067         # O.k.  This is a little weird.  We want a pointer to an EDM
00068         # wrapper, but we don't want the memory it is pointing to.
00069         # So, we've created it and grabbed the type info.  Since we
00070         # don't want a memory leak, we destroy it.
00071         if kwargs.get ('noDelete'):
00072             print "Not deleting wrapper"
00073             del kwargs['noDelete']
00074         else:
00075             self._wrapper.IsA().Destructor( self._wrapper )
00076         # Since we deleted the options as we used them, that means
00077         # that kwargs should be empty.  If it's not, that means that
00078         # somebody passed in an argument that we're not using and we
00079         # should complain.
00080         if len (kwargs):
00081             raise RuntimeError, "Unknown arguments %s" % kwargs
00082 


Member Function Documentation

def python::Handle::__str__ (   self)

Definition at line 96 of file __init__.py.

00097                       :
00098         return "%s" % (self._type)
00099 
                                          
def python::Handle::_addressOf (   self) [private]
(Internal) Return address of edm wrapper

Definition at line 107 of file __init__.py.

00108                          :
00109         """(Internal) Return address of edm wrapper"""
00110         return ROOT.AddressOf (self._wrapper)
00111 

def python::Handle::_setStatus (   self,
  getByLabelSuccess,
  labelString 
) [private]
(Internal) To be called by Events.getByLabel

Definition at line 112 of file __init__.py.

00113                                                          :
00114         """(Internal) To be called by Events.getByLabel"""
00115         if not getByLabelSuccess:
00116             self._exception = RuntimeError ("getByLabel (%s, %s) failed" \
00117                                             % (self, labelString))
00118             return
00119         if not self._wrapper.isPresent():
00120             self._exception = RuntimeError ("getByLabel (%s, %s) not present this event" \
00121                                             % (self, labelString))
00122             return
00123         # if we're still here, then everything is happy.  Clear the exception
00124         self._exception = None
00125 

def python::Handle::_typeInfoGetter (   self) [private]

Private member functions ##.

(Internal) Return the type info

Definition at line 102 of file __init__.py.

00103                               :
00104         """(Internal) Return the type info"""
00105         return self._typeInfo
00106 

def python::Handle::isValid (   self)
Returns true if getByLabel call was successful and data is
present in handle.

Definition at line 83 of file __init__.py.

00084                       :
00085         """Returns true if getByLabel call was successful and data is
00086         present in handle."""
00087         return not self._exception
00088 

def python::Handle::product (   self)
Returns product stored in handle.

Definition at line 89 of file __init__.py.

00090                       :
00091         """Returns product stored in handle."""
00092         if self._exception:
00093             raise self._exception
00094         return self._wrapper.product()
00095 


Member Data Documentation

Definition at line 52 of file __init__.py.

Definition at line 52 of file __init__.py.

Definition at line 52 of file __init__.py.

Definition at line 52 of file __init__.py.