Given a 'process', find all modules (EDProducers,EDFilters,EDAnalyzers,OutputModules)
and remove them if they do not appear on a Path or EndPath. One can optionally pass in
a list of modules which even if they are not on a Path or EndPath you wish to have stay
in the configuration [useful for unscheduled execution].
Definition at line 1 of file Utilities.py.
00002 :
00003 """Given a 'process', find all modules (EDProducers,EDFilters,EDAnalyzers,OutputModules)
00004 and remove them if they do not appear on a Path or EndPath. One can optionally pass in
00005 a list of modules which even if they are not on a Path or EndPath you wish to have stay
00006 in the configuration [useful for unscheduled execution].
00007 """
00008 allMods=set((x for x in process.producers_().iterkeys()))
00009 allMods.update((x for x in process.filters_().iterkeys()))
00010 allMods.update((x for x in process.analyzers_().iterkeys()))
00011 allMods.update((x for x in process.outputModules_().iterkeys()))
00012
00013 modulesOnPaths = set()
00014 for p in process.paths_():
00015 modulesOnPaths.update( (x for x in getattr(process,p).moduleNames()))
00016 for p in process.endpaths_():
00017 modulesOnPaths.update( (x for x in getattr(process,p).moduleNames()))
00018
00019 notOnPaths = allMods.difference(modulesOnPaths)
00020
00021 keepModuleNames = set( (x.label_() for x in keepList) )
00022
00023 getRidOf = notOnPaths.difference(keepModuleNames)
00024
00025 for n in getRidOf:
00026 delattr(process,n)