Go to the documentation of this file.00001
00002 """
00003 _Utils_
00004
00005 Module containing some utility tools
00006
00007 """
00008
00009 def stepALCAPRODUCER(skims):
00010 """
00011 _stepALCAPRODUCER_
00012
00013 Creates and returns the configuration string for the ALCAPRODUCER step
00014 starting from the list of AlcaReco path to be run.
00015
00016 """
00017
00018 step = ''
00019 if len(skims) >0:
00020 step = ',ALCAPRODUCER:'+('+'.join(skims))
00021 return step
00022
00023 def addMonitoring(process):
00024 """
00025 _addMonitoring_
00026
00027 Add the monitoring services to the process provided
00028 in order to write out performance summaries to the framework job report
00029 """
00030 import FWCore.ParameterSet.Config as cms
00031
00032 process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
00033 jobReportOutputOnly = cms.untracked.bool(True)
00034 )
00035 process.Timing = cms.Service("Timing",
00036 summaryOnly = cms.untracked.bool(True)
00037 )
00038
00039 return process
00040
00041
00042 def validateProcess(process):
00043 """
00044 _validateProcess_
00045
00046 Check attributes of process are appropriate for production
00047 This method returns nothing but will throw a RuntimeError for any issues it finds
00048 likely to cause problems in the production system
00049
00050 """
00051
00052 schedule=process.schedule_()
00053 paths=process.paths_()
00054 endpaths=process.endpaths_()
00055
00056
00057 for outputModName in process.outputModules_().keys():
00058 outputMod = getattr(process, outputModName)
00059 if not hasattr(outputMod, 'dataset'):
00060 msg = "Process contains output module without dataset PSET: %s \n" % outputModName
00061 msg += " You need to add this PSET to this module to set dataTier and filterName\n"
00062 raise RuntimeError, msg
00063 ds=getattr(outputMod,'dataset')
00064 if not hasattr(ds, "dataTier"):
00065 msg = "Process contains output module without dataTier parameter: %s \n" % outputModName
00066 msg += " You need to add an untracked parameter to the dataset PSET of this module to set dataTier\n"
00067 raise RuntimeError, msg
00068
00069
00070 omRun=False
00071
00072 if schedule==None:
00073 for path in paths:
00074 if outputModName in getattr(process,path).moduleNames():
00075 omRun=True
00076 for path in endpaths:
00077 if outputModName in getattr(process,path).moduleNames():
00078 omRun=True
00079 else:
00080 for path in schedule:
00081 if outputModName in path.moduleNames():
00082 omRun=True
00083 if omRun==False:
00084 msg = "Output Module %s not in endPath" % outputModName
00085 raise RuntimeError, msg
00086
00087
00088 def dqmIOSource(args):
00089 import FWCore.ParameterSet.Config as cms
00090 if args.get('newDQMIO', False):
00091 return cms.Source("DQMRootSource",
00092 fileNames = cms.untracked(cms.vstring())
00093 )
00094 else:
00095 return cms.Source("PoolSource",
00096 fileNames = cms.untracked(cms.vstring())
00097 )
00098
00099 def harvestingMode(process, datasetName, args,rANDl=True):
00100 import FWCore.ParameterSet.Config as cms
00101 if rANDl and (not args.get('newDQMIO', False)):
00102 process.source.processingMode = cms.untracked.string('RunsAndLumis')
00103 process.dqmSaver.workflow = datasetName
00104 process.dqmSaver.saveByLumiSection = 1
00105 if args.has_key('referenceFile') and args.get('referenceFile', ''):
00106 process.DQMStore.referenceFileName = cms.untracked.string(args['referenceFile'])
00107
00108 def dictIO(options,args):
00109 if args.has_key('outputs'):
00110 options.outputDefinition = args['outputs'].__str__()
00111 else:
00112 writeTiers = args.get('writeTiers', [])
00113 options.eventcontent = ','.join(writeTiers)
00114 options.datatier = ','.join(writeTiers)
00115
00116 def dqmSeq(args,default):
00117 if 'dqmSeq' in args and len(args['dqmSeq'])!=0:
00118 return ':'+('+'.join(args['dqmSeq']))
00119 else:
00120 return default
00121