File indexing completed on 2024-04-06 12:23:27
0001 from PhysicsTools.Heppy.physicsobjects.PhysicsObject import *
0002 import fnmatch
0003
0004 class TriggerObject( PhysicsObject):
0005 '''With a nice printout, and functions to investigate the path and filters in the trigger object.'''
0006
0007 def hasPath( self, path ):
0008 '''Returns true if this trigger object was used in path
0009 (path can contain a wildcard).
0010 '''
0011 selNames = fnmatch.filter( self.getSelectionNames(), path )
0012 if len(selNames)>0:
0013 return True
0014 else:
0015 return False
0016
0017 def __str__(self):
0018 base = super(TriggerObject, self).__str__()
0019 specific = []
0020 theStrs = [base]
0021 for name in self.getSelectionNames():
0022 hasSel = self.getSelection( name )
0023 if hasSel:
0024 specific.append( ''.join(['\t', name]) )
0025 if len(specific)>0:
0026 specific.insert(0,'Paths:')
0027 theStrs.extend( specific )
0028 return '\n'.join(theStrs)
0029