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


Member Function Documentation

def python::Handle::__str__ (   self)

Definition at line 92 of file __init__.py.

00093                       :
00094         return "%s" % (self._type)
00095 
                                          
def python::Handle::_addressOf (   self) [private]
(Internal) Return address of edm wrapper

Definition at line 103 of file __init__.py.

00104                          :
00105         """(Internal) Return address of edm wrapper"""
00106         return ROOT.AddressOf (self._wrapper)
00107 

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

Definition at line 108 of file __init__.py.

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

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

Private member functions ##.

(Internal) Return the type info

Definition at line 98 of file __init__.py.

00099                               :
00100         """(Internal) Return the type info"""
00101         return self._typeInfo
00102 

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

Definition at line 79 of file __init__.py.

00080                       :
00081         """Returns true if getByLabel call was successful and data is
00082         present in handle."""
00083         return not self._exception
00084 

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

Definition at line 85 of file __init__.py.

00086                       :
00087         """Returns product stored in handle."""
00088         if self._exception:
00089             raise self._exception
00090         return self._wrapper.product()
00091 


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.