CMS 3D CMS Logo

Classes | Functions

Utilities Namespace Reference

Classes

class  TestModuleCommand

Functions

def _build_options
def getHltConfiguration
def loadHltConfiguration
def removeModulesNotOnAPathExcluding

Function Documentation

def Utilities::_build_options (   args) [private]

Definition at line 6 of file Utilities.py.

00007                           :
00008   options = _options.HLTProcessOptions()
00009   for key, val in args.iteritems():
00010     setattr(options, key, val)
00011   return options
00012 

def Utilities::getHltConfiguration (   menu,
  args 
)

Definition at line 13 of file Utilities.py.

00014                                      :
00015   args['menu']     = menu
00016   args['fragment'] = False
00017   options = _build_options(**args)
00018 
00019   hlt = _imp.new_module('hlt')
00020   exec _confdb.HLTProcess(options).dump() in globals(), hlt.__dict__
00021   return hlt.process
00022 

def Utilities::loadHltConfiguration (   process,
  menu,
  args 
)

Definition at line 23 of file Utilities.py.

00024                                                :
00025   args['menu']     = menu
00026   args['fragment'] = True
00027   options = _build_options(**args)
00028 
00029   hlt = _imp.new_module('hlt')
00030   exec _confdb.HLTProcess(options).dump() in globals(), hlt.__dict__
00031   process.extend( hlt )
00032 

def Utilities::removeModulesNotOnAPathExcluding (   process,
  keepList = () 
)
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)