def checkMessageLoggerSvc(cfgInstance): """ _checkMessageLogger_ Check that the message logger is active and provides the default job report and event logger settings for production """ svcs = cfgInstance.services # // # // Check Job report service will write the expected #// FrameworkJobReport.xml file if not svcs.has_key('MessageLogger'): cfgInstance.add_(CfgModules.Service("MessageLogger")) messageLogger = cfgInstance.services['MessageLogger'] if "fwkJobReports" not in messageLogger.parameterNames_(): messageLogger.fwkJobReports = CfgTypes.untracked(CfgTypes.vstring()) if "FrameworkJobReport" not in messageLogger.fwkJobReports: messageLogger.fwkJobReports.append("FrameworkJobReport") if "FrameworkJobReport" not in messageLogger.parameterNames_(): messageLogger.FrameworkJobReport = CfgTypes.untracked(CfgTypes.PSet()) messageLogger.FrameworkJobReport.default = CfgTypes.untracked( CfgTypes.PSet(limit=CfgTypes.untracked(CfgTypes.int32(0)))) messageLogger.FrameworkJobReport.FwkJob = CfgTypes.untracked( CfgTypes.PSet(limit=CfgTypes.untracked(CfgTypes.int32(10000000)))) # // # // Install the per event output #// if "destinations" not in messageLogger.parameterNames_(): messageLogger.destinations = CfgTypes.untracked(CfgTypes.vstring()) if "EventLogger" not in messageLogger.destinations: messageLogger.destinations.append("EventLogger") if "EventLogger" not in messageLogger.parameterNames_(): messageLogger.EventLogger = CfgTypes.untracked(CfgTypes.PSet()) messageLogger.EventLogger.default = CfgTypes.untracked( CfgTypes.PSet(limit=CfgTypes.untracked(CfgTypes.int32(0)))) messageLogger.FrameworkJobReport.FwkReport = CfgTypes.untracked( CfgTypes.PSet(limit=CfgTypes.untracked(CfgTypes.int32(10000000)), reportEvery=CfgTypes.untracked( CfgTypes.int32(10000000)))) return
def makeProcess(numEvents = 200): """ _makeProcess_ Create a new Process instance """ proc = Process("HLT") proc.include("FWCore/MessageLogger/data/MessageLogger.cfi") configName = "fake-streamer-config" configVersion = timestamp() configAnnot = "auto generated fake streamer config" proc.configurationMetadata = CmsTypes.untracked(CmsTypes.PSet()) proc.configurationMetadata.name = CmsTypes.untracked(CmsTypes.string( configName)) proc.configurationMetadata.version = CmsTypes.untracked(CmsTypes.string( configVersion)) proc.configurationMetadata.annotation = CmsTypes.untracked(CmsTypes.string( configAnnot)) proc.options = CmsTypes.untracked(CmsTypes.PSet()) proc.options.wantSummary = CmsTypes.untracked(CmsTypes.bool(True)) proc.source = Source("EmptySource") proc.maxEvents = CmsTypes.untracked(CmsTypes.PSet()) proc.maxEvents.input = CmsTypes.untracked(CmsTypes.int32(numEvents)) proc.prod = EDProducer("StreamThingProducer") proc.prod.array_size = CmsTypes.int32(2500) proc.prod.instance_count = CmsTypes.int32(150) proc.prod.apply_bit_mask = CmsTypes.untracked(CmsTypes.bool(True)) proc.prod.bit_mask = CmsTypes.untracked( CmsTypes.uint32( 16777215)) proc.add_(Service("RandomNumberGeneratorService")) svc = proc.services["RandomNumberGeneratorService"] svc.moduleSeeds = CmsTypes.PSet() proc.makeData = Path(proc.prod) return proc
def setMaxEventsInput(self, maxEv): """ _setMaxEventsInput_ Set the input maxEvents limit for the source """ self.data.input = CfgTypes.untracked(CfgTypes.int32(maxEv)) return
def makeLumiSection(lumiProducer, lumiData): """ _makeLumiSection_ Add a Lumi Section PSet to the lumi Producer module """ psetName = "LS%s" % str(lumiData['lsnumber']) psetRef = CmsTypes.untracked( CmsTypes.PSet()) setattr(lumiProducer, psetName, psetRef) psetRef.avginsdellumi = CmsTypes.untracked( CmsTypes.double(lumiData['avginslumi'])) psetRef.avginsdellumierr = CmsTypes.untracked( CmsTypes.double(lumiData['avginslumierr'])) psetRef.lumisecqual = CmsTypes.untracked( CmsTypes.int32(int(lumiData['lumisecqual']))) psetRef.deadfrac = CmsTypes.untracked( CmsTypes.double(lumiData['deadfrac'])) psetRef.lsnumber = CmsTypes.untracked( CmsTypes.int32(lumiData['lsnumber'])) psetRef.lumietsum = CmsTypes.untracked(CmsTypes.vdouble()) psetRef.lumietsum = lumiData['det_et_sum'] psetRef.lumietsumerr = CmsTypes.untracked(CmsTypes.vdouble()) psetRef.lumietsumerr = lumiData['det_et_err'] psetRef.lumietsumqual = CmsTypes.untracked(CmsTypes.vint32()) psetRef.lumietsumqual = lumiData['det_et_qua'] psetRef.lumiocc = CmsTypes.untracked(CmsTypes.vdouble()) psetRef.lumiocc = lumiData['det_occ_sum'] psetRef.lumioccerr = CmsTypes.untracked(CmsTypes.vdouble()) psetRef.lumioccerr = lumiData['det_occ_err'] psetRef.lumioccqual = CmsTypes.untracked(CmsTypes.vint32()) psetRef.lumioccqual = lumiData['det_occ_qua'] return
def addOutputModule(process, fileName): """ _addOutputModule_ """ outMod = OutputModule("EventStreamFileWriter") outMod.max_event_size = CmsTypes.untracked(CmsTypes.int32(7000000)) outMod.max_queue_depth = CmsTypes.untracked(CmsTypes.int32(5)) outMod.use_compression = CmsTypes.untracked(CmsTypes.bool(True)) outMod.compression_level = CmsTypes.untracked(CmsTypes.int32(1)) streamer = "%s.dat" % fileName indexFile = "%s.ind" % fileName outMod.fileName = CmsTypes.untracked(CmsTypes.string(streamer)) outMod.indexFileName = CmsTypes.untracked(CmsTypes.string(indexFile)) process.out = outMod process.o = EndPath(process.out) return
def setMaxEventsOutput(self, maxEv, moduleName=None): """ _setMaxEventsOutput_ """ value = CfgTypes.untracked(CfgTypes.int32(maxEv)) if moduleName == None: self.data.output = value return cfgType = getattr(self.data, "output", None) if cfgType.__class__.__name__ == "VPSet": # is a VPset so we append to that self.data.output.append( CfgTypes.untracked(CfgTypes.PSet(moduleName=value))) else: # add new VPset self.data.output = CfgTypes.untracked( CfgTypes.VPSet( CfgTypes.untracked(CfgTypes.PSet(moduleName=value)))) return
def setMaxEventsOutput(self, maxEv, moduleName = None): """ _setMaxEventsOutput_ """ value = CfgTypes.untracked(CfgTypes.int32(maxEv)) if moduleName == None: self.data.output = value return cfgType = getattr(self.data, "output", None) if cfgType.__class__.__name__ == "VPSet": # is a VPset so we append to that self.data.output.append( CfgTypes.untracked( CfgTypes.PSet( moduleName = value) ) ) else: # add new VPset self.data.output = CfgTypes.untracked( CfgTypes.VPSet( CfgTypes.untracked(CfgTypes.PSet( moduleName = value)) ) ) return
def main(argv) : """ writeCfg - Read in existing, user supplied pycfg or pickled pycfg file - Modify job specific parameters based on environment variables and arguments.xml - Write out pickled pycfg file required parameters: none optional parameters: --help : help --debug : debug statements """ # defaults inputFileNames = None parentFileNames = None debug = False _MAXINT = 900000000 try: opts, args = getopt.getopt(argv, "", ["debug", "help"]) except getopt.GetoptError: print main.__doc__ sys.exit(2) try: CMSSW = os.environ['CMSSW_VERSION'] parts = CMSSW.split('_') CMSSW_major = int(parts[1]) CMSSW_minor = int(parts[2]) except (KeyError, ValueError): msg = "Your environment doesn't specify the CMSSW version or specifies it incorrectly" raise ConfigException(msg) # Parse command line options for opt, arg in opts : if opt == "--help" : print main.__doc__ sys.exit() elif opt == "--debug" : debug = True # Parse remaining parameters try: fileName = args[0] outFileName = args[1] except IndexError: print main.__doc__ sys.exit() # Read in Environment, XML and get optional Parameters nJob = int(os.environ.get('NJob', '0')) preserveSeeds = os.environ.get('PreserveSeeds','') incrementSeeds = os.environ.get('IncrementSeeds','') # Defaults maxEvents = 0 skipEvents = 0 firstEvent = -1 compHEPFirstEvent = 0 firstRun = 0 # FUTURE: Remove firstRun firstLumi = 0 dom = xml.dom.minidom.parse(os.environ['RUNTIME_AREA']+'/arguments.xml') for elem in dom.getElementsByTagName("Job"): if nJob == int(elem.getAttribute("JobID")): if elem.getAttribute("MaxEvents"): maxEvents = int(elem.getAttribute("MaxEvents")) if elem.getAttribute("SkipEvents"): skipEvents = int(elem.getAttribute("SkipEvents")) if elem.getAttribute("FirstEvent"): firstEvent = int(elem.getAttribute("FirstEvent")) if elem.getAttribute("FirstRun"): firstRun = int(elem.getAttribute("FirstRun")) if elem.getAttribute("FirstLumi"): firstLumi = int(elem.getAttribute("FirstLumi")) generator = str(elem.getAttribute('Generator')) inputBlocks = str(elem.getAttribute('InputBlocks')) inputFiles = str(elem.getAttribute('InputFiles')) parentFiles = str(elem.getAttribute('ParentFiles')) lumis = str(elem.getAttribute('Lumis')) report(inputBlocks,inputFiles,parentFiles,lumis) # Read Input python config file handle = open(fileName, 'r') try: # Nested form for Python < 2.5 try: print "Importing .py file" cfo = imp.load_source("pycfg", fileName, handle) cmsProcess = cfo.process except Exception, ex: msg = "Your pycfg file is not valid python: %s" % str(ex) raise ConfigException(msg) finally: handle.close() cfg = CfgInterface(cmsProcess) # Set parameters for job print "Setting parameters" inModule = cfg.inputSource if maxEvents: cfg.maxEvents.setMaxEventsInput(maxEvents) if skipEvents and inModule.sourceType not in ['EmptySource']: inModule.setSkipEvents(skipEvents) # Set "skip events" for various generators if generator == 'comphep': cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(firstEvent) elif generator == 'lhe': cmsProcess.source.skipEvents = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent+1)) elif firstEvent != -1: # (Old? Madgraph) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) if inputFiles: inputFileNames = inputFiles.split(',') inModule.setFileNames(*inputFileNames) # handle parent files if needed if parentFiles: parentFileNames = parentFiles.split(',') inModule.setSecondaryFileNames(*parentFileNames) if lumis: if CMSSW_major < 3: # FUTURE: Can remove this check print "Cannot skip lumis for CMSSW 2_x" else: lumiRanges = lumis.split(',') inModule.setLumisToProcess(*lumiRanges) # Pythia parameters if (firstRun): inModule.setFirstRun(firstRun) if (firstLumi): inModule.setFirstLumi(firstLumi) # Check if there are random #'s to deal with if cfg.data.services.has_key('RandomNumberGeneratorService'): print "RandomNumberGeneratorService found, will attempt to change seeds" from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper ranGenerator = cfg.data.services['RandomNumberGeneratorService'] ranModules = getattr(ranGenerator, "moduleSeeds", None) oldSource = getattr(ranGenerator, "sourceSeed", None) if ranModules != None or oldSource != None: msg = "Your random number seeds are set in an old,\n" msg += "deprecated style. Please change to new style:\n" msg += "https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEDMRandomNumberGeneratorService" raise ConfigException(msg) randSvc = RandomNumberServiceHelper(ranGenerator) incrementSeedList = [] preserveSeedList = [] if incrementSeeds: incrementSeedList = incrementSeeds.split(',') if preserveSeeds: preserveSeedList = preserveSeeds.split(',') # Increment requested seed sets for seedName in incrementSeedList: curSeeds = randSvc.getNamedSeed(seedName) newSeeds = [x+nJob for x in curSeeds] randSvc.setNamedSeed(seedName, *newSeeds) preserveSeedList.append(seedName) # Randomize remaining seeds randSvc.populate(*preserveSeedList) # Write out new config file pklFileName = outFileName + '.pkl' outFile = open(outFileName,"w") outFile.write("import FWCore.ParameterSet.Config as cms\n") outFile.write("import pickle\n") outFile.write("process = pickle.load(open('%s', 'rb'))\n" % pklFileName) outFile.close() pklFile = open(pklFileName,"wb") myPickle = pickle.Pickler(pklFile) myPickle.dump(cmsProcess) pklFile.close() if (debug): print "writeCfg output (May not be exact):" print "import FWCore.ParameterSet.Config as cms" print cmsProcess.dumpPython()
def main(argv) : """ writeCfg - Read in existing, user supplied pycfg or pickled pycfg file - Modify job specific parameters based on environment variables and arguments.xml - Write out pickled pycfg file required parameters: none optional parameters: --help : help --debug : debug statements """ # defaults inputFileNames = None parentFileNames = None debug = False _MAXINT = 900000000 try: opts, args = getopt.getopt(argv, "", ["debug", "help"]) except getopt.GetoptError: print main.__doc__ sys.exit(2) try: CMSSW = os.environ['CMSSW_VERSION'] parts = CMSSW.split('_') CMSSW_major = int(parts[1]) CMSSW_minor = int(parts[2]) CMSSW_patch = int(parts[3]) except (KeyError, ValueError): msg = "Your environment doesn't specify the CMSSW version or specifies it incorrectly" raise ConfigException(msg) # Parse command line options for opt, arg in opts : if opt == "--help" : print main.__doc__ sys.exit() elif opt == "--debug" : debug = True # Parse remaining parameters try: fileName = args[0] outFileName = args[1] except IndexError: print main.__doc__ sys.exit() # Read in Environment, XML and get optional Parameters nJob = int(os.environ.get('NJob', '0')) preserveSeeds = os.environ.get('PreserveSeeds','') incrementSeeds = os.environ.get('IncrementSeeds','') # Defaults maxEvents = 0 skipEvents = 0 firstEvent = -1 compHEPFirstEvent = 0 firstRun = 0 # FUTURE: Remove firstRun firstLumi = 0 dom = xml.dom.minidom.parse(os.environ['RUNTIME_AREA']+'/arguments.xml') for elem in dom.getElementsByTagName("Job"): if nJob == int(elem.getAttribute("JobID")): if elem.getAttribute("MaxEvents"): maxEvents = int(elem.getAttribute("MaxEvents")) if elem.getAttribute("SkipEvents"): skipEvents = int(elem.getAttribute("SkipEvents")) if elem.getAttribute("FirstEvent"): firstEvent = int(elem.getAttribute("FirstEvent")) if elem.getAttribute("FirstRun"): firstRun = int(elem.getAttribute("FirstRun")) if elem.getAttribute("FirstLumi"): firstLumi = int(elem.getAttribute("FirstLumi")) generator = str(elem.getAttribute('Generator')) inputFiles = str(elem.getAttribute('InputFiles')) parentFiles = str(elem.getAttribute('ParentFiles')) lumis = str(elem.getAttribute('Lumis')) # Read Input python config file handle = open(fileName, 'r') try: # Nested form for Python < 2.5 try: print "Importing .py file" cfo = imp.load_source("pycfg", fileName, handle) cmsProcess = cfo.process except Exception, ex: msg = "Your pycfg file is not valid python: %s" % str(ex) raise ConfigException(msg) finally: handle.close() cfg = CfgInterface(cmsProcess) # Set parameters for job print "Setting parameters" inModule = cfg.inputSource if maxEvents: cfg.maxEvents.setMaxEventsInput(maxEvents) if skipEvents: inModule.setSkipEvents(skipEvents) # Set "skip events" for various generators if generator == 'comphep': cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(firstEvent) elif generator == 'lhe': cmsProcess.source.skipEvents = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent+1)) elif firstEvent != -1: # (Old? Madgraph) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) if inputFiles: inputFileNames = inputFiles.split(',') inModule.setFileNames(*inputFileNames) # handle parent files if needed if parentFiles: parentFileNames = parentFiles.split(',') inModule.setSecondaryFileNames(*parentFileNames) if lumis: if CMSSW_major < 3: # FUTURE: Can remove this check print "Cannot skip lumis for CMSSW 2_x" else: lumiRanges = lumis.split(',') inModule.setLumisToProcess(*lumiRanges) # Pythia parameters if (firstRun): inModule.setFirstRun(firstRun) if (firstLumi): inModule.setFirstLumi(firstLumi) # Check if there are random #'s to deal with if cfg.data.services.has_key('RandomNumberGeneratorService'): print "RandomNumberGeneratorService found, will attempt to change seeds" from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper ranGenerator = cfg.data.services['RandomNumberGeneratorService'] randSvc = RandomNumberServiceHelper(ranGenerator) incrementSeedList = [] preserveSeedList = [] if incrementSeeds: incrementSeedList = incrementSeeds.split(',') if preserveSeeds: preserveSeedList = preserveSeeds.split(',') # Increment requested seed sets for seedName in incrementSeedList: curSeeds = randSvc.getNamedSeed(seedName) newSeeds = [x+nJob for x in curSeeds] randSvc.setNamedSeed(seedName, *newSeeds) preserveSeedList.append(seedName) # Randomize remaining seeds randSvc.populate(*preserveSeedList) # Write out new config file outFile = open(outFileName,"w") outFile.write("import FWCore.ParameterSet.Config as cms\n") outFile.write("import pickle\n") outFile.write("pickledCfg=\"\"\"%s\"\"\"\n" % pickle.dumps(cmsProcess)) outFile.write("process = pickle.loads(pickledCfg)\n") outFile.close() if (debug): print "writeCfg output (May not be exact):" print "import FWCore.ParameterSet.Config as cms" print cmsProcess.dumpPython()
def setMaxEvents(self, maxEv): """setMaxEvents value""" self.data.maxEvents = CfgTypes.untracked(CfgTypes.int32(maxEv))
# # JSON (good luminosity sections), only if processing data if flag_mc == 0: goodJSON = 'Cert_160404-180252_7TeV_ReRecoNov08_Collisions11_JSON.txt' myLumis = LumiList.LumiList(filename=goodJSON).getCMSSWString().split(',') process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange() process.source.lumisToProcess.extend(myLumis) # # Load jet correction services for all jet algoritms process.load( "JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff") # # all is ready: pass all arguments to Analyzer (C++ code in src/Analyzer.cc) process.demo = cms.EDAnalyzer('Analyzer', outFile=cms.string(outFile), mc=CfgTypes.int32(flag_mc), reco=CfgTypes.int32(flag_reco), gen=CfgTypes.int32(flag_gen)) process.p = cms.Path(process.demo) # ######################################################################## # ######################################################################## #################### ParticleTreeDrawer ################################ ######################################################################## # # this is another processor which prints MC generated particles # (if you wanr this, disable Analyzer above) # #process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") #process.printTree = cms.EDAnalyzer("ParticleTreeDrawer",
def main(argv): """ writeCfg - Read in existing, user supplied pycfg or pickled pycfg file - Modify job specific parameters based on environment variables and arguments.xml - Write out pickled pycfg file required parameters: none optional parameters: --help : help --debug : debug statements """ # defaults inputFileNames = None parentFileNames = None debug = False _MAXINT = 900000000 try: opts, args = getopt.getopt(argv, "", ["debug", "help"]) except getopt.GetoptError: print main.__doc__ sys.exit(2) try: CMSSW = os.environ["CMSSW_VERSION"] parts = CMSSW.split("_") CMSSW_major = int(parts[1]) CMSSW_minor = int(parts[2]) CMSSW_patch = int(parts[3]) except (KeyError, ValueError): msg = "Your environment doesn't specify the CMSSW version or specifies it incorrectly" raise ConfigException(msg) # Parse command line options for opt, arg in opts: if opt == "--help": print main.__doc__ sys.exit() elif opt == "--debug": debug = True # Parse remaining parameters try: fileName = args[0] outFileName = args[1] except IndexError: print main.__doc__ sys.exit() # Read in Environment, XML and get optional Parameters nJob = int(os.environ.get("NJob", "0")) preserveSeeds = os.environ.get("PreserveSeeds", "") incrementSeeds = os.environ.get("IncrementSeeds", "") # Defaults maxEvents = 0 skipEvents = 0 firstEvent = -1 compHEPFirstEvent = 0 firstRun = 0 # FUTURE: Remove firstRun firstLumi = 0 dom = xml.dom.minidom.parse(os.environ["RUNTIME_AREA"] + "/arguments.xml") for elem in dom.getElementsByTagName("Job"): if nJob == int(elem.getAttribute("JobID")): if elem.getAttribute("MaxEvents"): maxEvents = int(elem.getAttribute("MaxEvents")) if elem.getAttribute("SkipEvents"): skipEvents = int(elem.getAttribute("SkipEvents")) if elem.getAttribute("FirstEvent"): firstEvent = int(elem.getAttribute("FirstEvent")) if elem.getAttribute("FirstRun"): firstRun = int(elem.getAttribute("FirstRun")) if elem.getAttribute("FirstLumi"): firstLumi = int(elem.getAttribute("FirstLumi")) generator = str(elem.getAttribute("Generator")) inputFiles = str(elem.getAttribute("InputFiles")) parentFiles = str(elem.getAttribute("ParentFiles")) lumis = str(elem.getAttribute("Lumis")) # Read Input python config file handle = open(fileName, "r") try: # Nested form for Python < 2.5 try: print "Importing .py file" cfo = imp.load_source("pycfg", fileName, handle) cmsProcess = cfo.process except Exception, ex: msg = "Your pycfg file is not valid python: %s" % str(ex) raise ConfigException(msg) finally: handle.close() cfg = CfgInterface(cmsProcess) # Set parameters for job print "Setting parameters" inModule = cfg.inputSource if maxEvents: cfg.maxEvents.setMaxEventsInput(maxEvents) if skipEvents: inModule.setSkipEvents(skipEvents) # Set "skip events" for various generators if generator == "comphep": cmsProcess.source.CompHEPFirstEvent = CfgTypes.int32(firstEvent) elif generator == "lhe": cmsProcess.source.skipEvents = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent + 1)) elif firstEvent != -1: # (Old? Madgraph) cmsProcess.source.firstEvent = CfgTypes.untracked(CfgTypes.uint32(firstEvent)) if inputFiles: inputFileNames = inputFiles.split(",") inModule.setFileNames(*inputFileNames) # handle parent files if needed if parentFiles: parentFileNames = parentFiles.split(",") inModule.setSecondaryFileNames(*parentFileNames) if lumis: if CMSSW_major < 3: # FUTURE: Can remove this check print "Cannot skip lumis for CMSSW 2_x" else: lumiRanges = lumis.split(",") inModule.setLumisToProcess(*lumiRanges) # Pythia parameters if firstRun: inModule.setFirstRun(firstRun) if firstLumi: inModule.setFirstLumi(firstLumi) # Check if there are random #'s to deal with if cfg.data.services.has_key("RandomNumberGeneratorService"): print "RandomNumberGeneratorService found, will attempt to change seeds" from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper ranGenerator = cfg.data.services["RandomNumberGeneratorService"] randSvc = RandomNumberServiceHelper(ranGenerator) incrementSeedList = [] preserveSeedList = [] if incrementSeeds: incrementSeedList = incrementSeeds.split(",") if preserveSeeds: preserveSeedList = preserveSeeds.split(",") # Increment requested seed sets for seedName in incrementSeedList: curSeeds = randSvc.getNamedSeed(seedName) newSeeds = [x + nJob for x in curSeeds] randSvc.setNamedSeed(seedName, *newSeeds) preserveSeedList.append(seedName) # Randomize remaining seeds randSvc.populate(*preserveSeedList) # Write out new config file outFile = open(outFileName, "w") outFile.write("import FWCore.ParameterSet.Config as cms\n") outFile.write("import pickle\n") outFile.write('pickledCfg="""%s"""\n' % pickle.dumps(cmsProcess)) outFile.write("process = pickle.loads(pickledCfg)\n") outFile.close() if debug: print "writeCfg output (May not be exact):" print "import FWCore.ParameterSet.Config as cms" print cmsProcess.dumpPython()
def checkMessageLoggerSvc(cfgInstance): """ _checkMessageLogger_ Check that the message logger is active and provides the default job report and event logger settings for production """ svcs = cfgInstance.services # // # // Check Job report service will write the expected #// FrameworkJobReport.xml file if not svcs.has_key('MessageLogger'): cfgInstance.add_(CfgModules.Service("MessageLogger")) messageLogger = cfgInstance.services['MessageLogger'] if "fwkJobReports" not in messageLogger.parameterNames_(): messageLogger.fwkJobReports = CfgTypes.untracked( CfgTypes.vstring() ) if "FrameworkJobReport" not in messageLogger.fwkJobReports: messageLogger.fwkJobReports.append("FrameworkJobReport") if "FrameworkJobReport" not in messageLogger.parameterNames_(): messageLogger.FrameworkJobReport = CfgTypes.untracked(CfgTypes.PSet()) messageLogger.FrameworkJobReport.default = CfgTypes.untracked( CfgTypes.PSet( limit = CfgTypes.untracked(CfgTypes.int32(0)) ) ) messageLogger.FrameworkJobReport.FwkJob = CfgTypes.untracked( CfgTypes.PSet( limit = CfgTypes.untracked(CfgTypes.int32(10000000)) ) ) # // # // Install the per event output #// if "destinations" not in messageLogger.parameterNames_(): messageLogger.destinations = CfgTypes.untracked( CfgTypes.vstring() ) if "EventLogger" not in messageLogger.destinations: messageLogger.destinations.append("EventLogger") if "EventLogger" not in messageLogger.parameterNames_(): messageLogger.EventLogger = CfgTypes.untracked(CfgTypes.PSet()) messageLogger.EventLogger.default = CfgTypes.untracked( CfgTypes.PSet( limit = CfgTypes.untracked(CfgTypes.int32(0)) ) ) messageLogger.FrameworkJobReport.FwkReport = CfgTypes.untracked( CfgTypes.PSet( limit = CfgTypes.untracked(CfgTypes.int32(10000000)), reportEvery = CfgTypes.untracked(CfgTypes.int32(10000000)) ) ) return
if flag_year == 0: goodJSON = 'data/Cert_160404-180252_7TeV_ReRecoNov08_Collisions11_JSON.txt' elif flag_year == 1: goodJSON = 'data/Cert_190456-208686_8TeV_22Jan2013ReReco_Collisions12_JSON.txt' myLumis = LumiList.LumiList(filename=goodJSON).getCMSSWString().split(',') process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange() process.source.lumisToProcess.extend(myLumis) # # Load jet correction services for all jet algoritms process.load( "JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff") # # all is ready: pass all arguments to Analyzer (C++ code in src/Analyzer.cc) process.demo = cms.EDAnalyzer('Analyzer', outFile=cms.string(outFile), mc=CfgTypes.int32(flag_mc), reco=CfgTypes.int32(flag_reco), gen=CfgTypes.int32(flag_gen), year=CfgTypes.int32(flag_year)) process.p = cms.Path(process.demo) # ######################################################################## # ######################################################################## #################### ParticleTreeDrawer ################################ ######################################################################## # # this is another processor which prints MC generated particles # (if you wanr this, disable Analyzer above) # #process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")