CMS 3D CMS Logo

Classes | Functions | Variables

hltFindDuplicates Namespace Reference

Classes

class  Module
class  ModuleList

Functions

def findDuplicates
def freeze
def main
def pythonize
def unfreeze
def whitelist

Variables

 debug = False
list whitelist_labels
list whitelist_types

Function Documentation

def hltFindDuplicates::findDuplicates (   process)

Definition at line 154 of file hltFindDuplicates.py.

00155                            :
00156   modules = ModuleList( 
00157     process._Process__analyzers.itervalues(), 
00158     process._Process__producers.itervalues(),
00159     process._Process__filters.itervalues() 
00160   )
00161 
00162   oldups = 0
00163   groups = modules.group()
00164   dups   = sum(len(g[0]) for g in groups.itervalues()) - len(groups)
00165 
00166   index = 1
00167   while(dups != oldups):
00168     if debug:
00169       dump = open('step%d.sed' % index, 'w')
00170       for target, (group, regexp) in groups.iteritems():
00171         dump.write('s#\\<\\(%s\\)\\>#%s#\n' % ('\\|'.join(group), target))
00172       dump.close()
00173     print "found %d duplicates" % dups
00174     oldups = dups
00175     modules.apply_rename(groups)
00176     groups = modules.group()
00177     dups   = sum(len(g[0]) for g in groups.itervalues()) - len(groups)
00178     index  = index + 1
00179 
00180   dump = open('groups.sed', 'w')
00181   for target, (group, regexp) in groups.iteritems():
00182     dump.write('s#\\<\\(%s\\)\\>#%s#\n' % ('\\|'.join(group), target))
00183   dump.close()
00184 
00185   dump = open('groups.txt', 'w')
00186   for target, (group, regexp) in groups.iteritems():
00187     dump.write('#%s\n%s\n\n' % ( target, '\n'.join(group)))
00188   dump.close()
00189 
00190 

def hltFindDuplicates::freeze (   arg)

Definition at line 23 of file hltFindDuplicates.py.

00024                :
00025   if type(arg) == dict:
00026     return frozendict((k, freeze(v)) for (k, v) in arg.iteritems())
00027   elif '__iter__' in dir(arg):
00028     return tuple( freeze(v) for v in arg )
00029   else:
00030     return arg

def hltFindDuplicates::main ( )

Definition at line 191 of file hltFindDuplicates.py.

00192           :
00193   # parse the HLT configuration from standard input or from the given file
00194   hlt = imp.new_module('hlt')
00195   try:
00196     configname = sys.argv[1]
00197   except:
00198     config = sys.stdin
00199   else:
00200     config = open(configname)
00201   exec config in globals(), hlt.__dict__
00202   config.close()
00203   findDuplicates(hlt.process)
00204 

def hltFindDuplicates::pythonize (   arg)

Definition at line 39 of file hltFindDuplicates.py.

00040                   :
00041   if 'parameters_' in dir(arg):
00042     arg = arg.parameters_()
00043 
00044   if 'value' in dir(arg):
00045     arg = arg.value()
00046 
00047   if type(arg) == dict:
00048     return frozendict((k, pythonize(v)) for (k, v) in arg.iteritems())
00049   elif '__iter__' in dir(arg):
00050     return tuple( pythonize(v) for v in arg )
00051   else:
00052     return arg
00053 

def hltFindDuplicates::unfreeze (   arg)

Definition at line 31 of file hltFindDuplicates.py.

00032                  :
00033   if type(arg) == frozendict:
00034     return dict((k, unfreeze(v)) for (k, v) in arg.iteritems())
00035   elif '__iter__' in dir(arg):
00036     return list( unfreeze(v) for v in arg )
00037   else:
00038     return arg

def hltFindDuplicates::whitelist (   module)

Definition at line 19 of file hltFindDuplicates.py.

00020                      :
00021   return module.label in whitelist_labels or module.type in whitelist_types
00022 


Variable Documentation

Definition at line 7 of file hltFindDuplicates.py.

Initial value:
00001 [
00002   'hltPreExpressSmart',
00003   'hltPreEventDisplaySmart',
00004 ]

Definition at line 14 of file hltFindDuplicates.py.

Initial value:
00001 [
00002   'HLTPrescaler',
00003   'HLTBool', 
00004 ]

Definition at line 9 of file hltFindDuplicates.py.