2 from DataFormats.FWLite
import Events, Handle
10 def __init__(self, label, type, mayFail=False, fallbackLabel=None):
11 '''Note: label can be a tuple : (module_label, collection_label, process)'''
16 Handle.__init__(self, self.
type)
18 if not self.isLoaded :
21 return super(AutoHandle,self).
product()
28 '''Load self from a given event.
30 Call this function, and then just call self.product() to get the collection'''
32 event.getByLabel( self.
label, self)
33 if not self.isValid():
raise RuntimeError
35 Handle.__init__(self, self.
type)
37 Cannot find collection with:
46 if not self.isValid():
raise RuntimeError
50 Handle.__init__(self, self.
type)
52 Cannot find collection with:
54 label = {label} or {lab2}
label
if I succeeded, swap default and fallback assuming that the next event will be like this one ...