Exemple #1
0
 def handleSeeding(self):
     """
     _handleSeeding_
     
     Handle Random Seed settings for the job
     
     """
     baggage = self.job.getBaggage()
     seeding = getattr(baggage, "seeding", None)
     if seeding == None:
         return
     if seeding == "AutomaticSeeding":
         from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
         helper = RandomNumberServiceHelper(self.process.RandomNumberGeneratorService)
         helper.populate()
         return
     if seeding == "ReproducibleSeeding":
         randService = self.process.RandomNumberGeneratorService
         tweak = PSetTweak()
         for x in randService:
             parameter = "process.RandomNumberGeneratorService.%s.initialSeed" % x._internal_name
             tweak.addParameter(parameter, x.initialSeed)
         applyTweak(self.process, tweak, self.fixupDict)
         return
     # still here means bad seeding algo name
     raise RuntimeError, "Bad Seeding Algorithm: %s" % seeding
   def PrepareJobUser(self, jobDir, value ):
      '''Prepare one job. This function is called by the base class.'''
      
      process.source = fullSource.clone()
      
      #prepare the batch script
      scriptFileName = jobDir+'/batchScript.sh'
      scriptFile = open(scriptFileName,'w')
      storeDir = self.remoteOutputDir_.replace('/castor/cern.ch/cms','')
      mode = self.RunningMode(options.batch)
      if mode == 'LXPLUS':
         scriptFile.write( batchScriptCERN( storeDir, value) )    #here is the call to batchScriptCERN, i need to change value
      elif mode == 'LOCAL':
         scriptFile.write( batchScriptLocal( storeDir, value) )   #same as above but for batchScriptLocal
      scriptFile.close()
      os.system('chmod +x %s' % scriptFileName)

      #prepare the cfg
      # replace the list of fileNames by a chunk of filenames:
      if generator:
         randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
         randSvc.populate()
      else:
         iFileMin = (value-1)*grouping 
         iFileMax = (value)*grouping 
         process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
         print process.source
      cfgFile = open(jobDir+'/run_cfg.py','w')
      cfgFile.write('import FWCore.ParameterSet.Config as cms\n\n')
      cfgFile.write('import os,sys\n')
      # need to import most of the config from the base directory containing all jobs
      cfgFile.write("sys.path.append('%s')\n" % os.path.dirname(jobDir) )
      cfgFile.write('from base_cfg import *\n')
      cfgFile.write('process.source = ' + process.source.dumpPython() + '\n')
      cfgFile.close()
Exemple #3
0
    def insertSeeds(self, *seeds):
        """
        _insertSeeds_

        Insert the list of seeds into the RandomNumber Service

        """
        seedList = list(seeds)
        if "RandomNumberGeneratorService" not in self.data.services.keys():
            return

        if self.hasOldSeeds():
            self.insertOldSeeds(*seeds)
            return

        #  //
        # // Use seed service utility to generate seeds on the fly
        #//
        svc = self.data.services["RandomNumberGeneratorService"]
        try:
            from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
        except ImportError:
            msg = "Unable to import RandomeNumberServiceHelper"
            print msg
            raise RuntimeError, msg
        randHelper = RandomNumberServiceHelper(svc)
        randHelper.populate()
        svc.saveFileName = CfgTypes.untracked(
            CfgTypes.string("RandomEngineState.log"))

        return
Exemple #4
0
def customise(process):
	# Remove output modules
	process.schedule.remove(process.endjob_step)
	process.schedule.remove(process.out_step)

	# Logging options
	process.options.wantSummary = cms.untracked.bool(True)
	process.MessageLogger.cerr.FwkReport.reportEvery = 1000
#	process.genParticles.abortOnUnknownPDGCode = False

	# Seed random generator
	from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
	randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
	randSvc.populate()

	# Add kappa skim
	process.load("Kappa.Producers.KTuple_cff")
	process.kappatuple = cms.EDAnalyzer('KTuple',
		process.kappaTupleDefaultsBlock,
		outputFile = cms.string('skim.root'),
	)
	process.kappatuple.active = cms.vstring('GenMetadata', 'LV')
	process.kappatuple.Metadata.l1Source = cms.InputTag("")
	process.kappatuple.Metadata.hltSource = cms.InputTag("")
	process.kappatuple.Metadata.noiseHCAL = cms.InputTag("")
	process.kappatuple.Metadata.hlTrigger = cms.InputTag("")
	process.kappatuple.Metadata.muonTriggerObjects = cms.vstring()
	process.kappatuple.Metadata.noiseHCAL = cms.InputTag("")
	process.pathSkim = cms.Path(process.kappatuple)
	process.schedule += process.pathSkim

	return process
Exemple #5
0
def customise(process):
    # Remove output modules
    process.schedule.remove(process.endjob_step)
    process.schedule.remove(process.out_step)

    # Logging options
    process.options.wantSummary = cms.untracked.bool(True)
    process.MessageLogger.cerr.FwkReport.reportEvery = 1000
    #	process.genParticles.abortOnUnknownPDGCode = False

    # Seed random generator
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randSvc.populate()

    # Add kappa skim
    process.load("Kappa.Producers.KTuple_cff")
    process.kappatuple = cms.EDAnalyzer(
        'KTuple',
        process.kappaTupleDefaultsBlock,
        outputFile=cms.string('skim.root'),
    )
    process.kappatuple.active = cms.vstring('GenMetadata', 'LV')
    process.kappatuple.Metadata.l1Source = cms.InputTag("")
    process.kappatuple.Metadata.hltSource = cms.InputTag("")
    process.kappatuple.Metadata.noiseHCAL = cms.InputTag("")
    process.kappatuple.Metadata.hlTrigger = cms.InputTag("")
    process.kappatuple.Metadata.muonTriggerObjects = cms.vstring()
    process.kappatuple.Metadata.noiseHCAL = cms.InputTag("")
    process.pathSkim = cms.Path(process.kappatuple)
    process.schedule += process.pathSkim

    return process
    def insertSeeds(self, *seeds):
        """
        _insertSeeds_

        Insert the list of seeds into the RandomNumber Service

        """
        seedList = list(seeds)
        if "RandomNumberGeneratorService" not in self.data.services.keys():
            return


        if self.hasOldSeeds():
            self.insertOldSeeds(*seeds)
            return

        #  //
        # // Use seed service utility to generate seeds on the fly
        #//
        svc = self.data.services["RandomNumberGeneratorService"]
        try:
            from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
        except ImportError:
            msg = "Unable to import RandomeNumberServiceHelper"
            print msg
            raise RuntimeError, msg
        randHelper = RandomNumberServiceHelper(svc)
        randHelper.populate()
        svc.saveFileName = CfgTypes.untracked(
            CfgTypes.string("RandomEngineState.log"))

        return
Exemple #7
0
def resetSeeds(process,options):
    # reset all random numbers to ensure statistically distinct but reproducible jobs
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randHelper.resetSeeds(options.maxEvents+options.part)
    if process.source.type_()=='EmptySource' and options.part>0: process.source.firstEvent = cms.untracked.uint32((options.part-1)*options.maxEvents+1)
    return process
Exemple #8
0
def randomize_seeds(process, save_fn='RandomEngineState.xml'):
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randHelper = RandomNumberServiceHelper(
        process.RandomNumberGeneratorService)
    randHelper.populate()
    if save_fn:
        process.RandomNumberGeneratorService.saveFileName = cms.untracked.string(
            save_fn)
def customise_for_gc(process):
    import FWCore.ParameterSet.Config as cms
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper

    try:
        maxevents = __MAX_EVENTS__
        process.maxEvents = cms.untracked.PSet(
            input=cms.untracked.int32(max(-1, maxevents)))
    except:
        pass

    # Dataset related setup
    try:
        primaryFiles = [__FILE_NAMES__]
        process.source = cms.Source(
            'PoolSource',
            skipEvents=cms.untracked.uint32(__SKIP_EVENTS__),
            fileNames=cms.untracked.vstring(primaryFiles))
        try:
            secondaryFiles = [__FILE_NAMES2__]
            process.source.secondaryFileNames = cms.untracked.vstring(
                secondaryFiles)
        except:
            pass
        try:
            lumirange = [__LUMI_RANGE__]
            if len(lumirange) > 0:
                process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(
                    lumirange)
                process.maxEvents = cms.untracked.PSet(
                    input=cms.untracked.int32(-1))
        except:
            pass
    except:
        pass

    if hasattr(process, 'RandomNumberGeneratorService'):
        randSvc = RandomNumberServiceHelper(
            process.RandomNumberGeneratorService)
        randSvc.populate()

    process.AdaptorConfig = cms.Service(
        'AdaptorConfig',
        enable=cms.untracked.bool(True),
        stats=cms.untracked.bool(True),
    )

    # Generator related setup
    try:
        if hasattr(process,
                   'generator') and process.source.type_() != 'PoolSource':
            process.source.firstLuminosityBlock = cms.untracked.uint32(
                1 + __MY_JOBID__)
            print 'Generator random seed:', process.RandomNumberGeneratorService.generator.initialSeed
    except:
        pass

    return (process)
def customise_for_gc(process):
	import FWCore.ParameterSet.Config as cms
	from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper

	try:
		maxevents = int(__MAX_EVENTS__)
		process.maxEvents = cms.untracked.PSet(
			input = cms.untracked.int32(max(-1, maxevents))
		)
	except:
		pass

	# Dataset related setup
	try:
		primaryFiles = [__FILE_NAMES__]
		process.source = cms.Source('PoolSource',
			skipEvents = cms.untracked.uint32(__SKIP_EVENTS__),
			fileNames = cms.untracked.vstring(primaryFiles)
		)
		try:
			secondaryFiles = [__FILE_NAMES2__]
			process.source.secondaryFileNames = cms.untracked.vstring(secondaryFiles)
		except:
			pass
		try:
			lumirange = [__LUMI_RANGE__]
			if len(lumirange) > 0:
				process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(lumirange)
				process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))
		except:
			pass
	except:
		pass

	if hasattr(process, 'RandomNumberGeneratorService'):
		randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
		randSvc.populate()

	process.AdaptorConfig = cms.Service('AdaptorConfig',
		enable = cms.untracked.bool(True),
		stats = cms.untracked.bool(True),
	)

	# Generator related setup
	try:
		if hasattr(process, 'generator') and process.source.type_() != 'PoolSource':
			process.source.firstLuminosityBlock = cms.untracked.uint32(1 + __GC_JOB_ID__)
			print 'Generator random seed:', process.RandomNumberGeneratorService.generator.initialSeed
	except:
		pass

	# Print GlobalTag for DBS3 registration - output is taken from edmConfigHash
	try:
		print 'globaltag:%s' % process.GlobalTag.globaltag.value()
	except:
		pass
	return (process)
Exemple #11
0
def useSystemRandomSeeds(process):
    """_useSystemRandomSeeds_
    
    Initiate RandomNumberServiceHelper seed using random.SystemRandom
    to have different seeds every time one runs cmsRun.

    """
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randSvc.populate()

    return process
def customise_for_gc(process):
	import FWCore.ParameterSet.Config as cms
	from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper

	try:
		maxevents = __MAX_EVENTS__
		process.maxEvents = cms.untracked.PSet(
			input = cms.untracked.int32(max(-1, maxevents))
		)
	except:
		pass

	# Dataset related setup
	try:
		primaryFiles = [__FILE_NAMES__]
		process.source = cms.Source("PoolSource",
			skipEvents = cms.untracked.uint32(__SKIP_EVENTS__),
			fileNames = cms.untracked.vstring(primaryFiles)
		)
		try:
			secondaryFiles = [__FILE_NAMES2__]
			process.source.secondaryFileNames = cms.untracked.vstring(secondaryFiles)
		except:
			pass
		try:
			lumirange = [__LUMI_RANGE__]
			process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(lumirange)
		except:
			pass
	except:
		pass

	if hasattr(process, "RandomNumberGeneratorService"):
		randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
		randSvc.populate()

	process.AdaptorConfig = cms.Service("AdaptorConfig",
		enable = cms.untracked.bool(True),
		stats = cms.untracked.bool(True),
	)

	# Generator related setup
	try:
		if hasattr(process, "generator"):
			#muss deaktiviert werden!
			#process.source.firstLuminosityBlock = cms.untracked.uint32(1+__MY_JOBID__)
			print "Generator random seed:", process.RandomNumberGeneratorService.generator.initialSeed
	except:
		pass

	return (process)
Exemple #13
0
    def PrepareJobUser(self, jobDir, value ):

       process.source = fullSource.clone()

       #prepare the batch script
       scriptFileName = jobDir+'/batchScript.sh'
       scriptFile = open(scriptFileName,'w')

       # are we at CERN or somewhere else? testing the afs path
       cwd = os.getcwd()
       patternCern = re.compile( '^/afs/cern.ch' )
       patterncmsphys01 = re.compile( '/data' )
       if patternCern.match( cwd ):
          print '@ CERN'
          scriptFile.write( batchScriptCERN( self.remoteOutputFile_,
                                             self.remoteOutputDir_,
                                             value) )
       elif patterncmsphys01.match( cwd ):
          print '@ cmsphys01'
          scriptFile.write( batchScriptcmsphys01( self.remoteOutputFile_,
                                                  self.remoteOutputDir_,
                                                  value) )          
       else:
          print "I don't know on which computing site you are... "
          sys.exit(2)
       
       scriptFile.close()
       os.system('chmod +x %s' % scriptFileName)

       #prepare the cfg
       
       # replace the list of fileNames by a chunk of filenames:
       if generator:
          randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
          randSvc.populate()
       else:

          print "grouping : ", grouping
          print "value : ", value
          
          iFileMin = (value)*grouping 
          iFileMax = (value+1)*grouping 
          
          process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
          print process.source
          
       cfgFile = open(jobDir+'/run_cfg.py','w')
       cfgFile.write(process.dumpPython())
       cfgFile.close()
    def PrepareJobUser(self, jobDir, value):

        process.source = fullSource.clone()

        #prepare the batch script
        scriptFileName = jobDir + '/batchScript.sh'
        scriptFile = open(scriptFileName, 'w')

        # are we at CERN or somewhere else? testing the afs path
        cwd = os.getcwd()
        patternCern = re.compile('^/afs/cern.ch')
        patternIn2p3 = re.compile('^/afs/in2p3.fr')
        if patternCern.match(cwd):
            print '@ CERN'
            scriptFile.write(
                batchScriptCERN(self.remoteOutputFile_, self.remoteOutputDir_,
                                value))
        elif patternIn2p3.match(cwd):
            print '@ IN2P3 - not supported yet'
            sys.exit(2)
        else:
            print "I don't know on which computing cern you are... "
            sys.exit(2)

        scriptFile.close()
        os.system('chmod +x %s' % scriptFileName)

        #prepare the cfg

        # replace the list of fileNames by a chunk of filenames:
        if generator:
            randSvc = RandomNumberServiceHelper(
                process.RandomNumberGeneratorService)
            randSvc.populate()
        else:

            print "grouping : ", grouping
            print "value : ", value

            iFileMin = (value) * grouping
            iFileMax = (value + 1) * grouping

            process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
            print process.source

        cfgFile = open(jobDir + '/run_cfg.py', 'w')
        cfgFile.write(process.dumpPython())
        cfgFile.close()
Exemple #15
0
    def PrepareJobUser(self, jobDir, value ):

       process.source = fullSource.clone()

       #prepare the batch script
       scriptFileName = jobDir+'/batchScript.sh'
       scriptFile = open(scriptFileName,'w')

       # are we at CERN or somewhere else? testing the afs path
       cwd = os.getcwd()
       patternCern = re.compile( '^/afs/cern.ch' )

       patternBatch = re.compile( '\w*bsub')
       wantBatch = patternBatch.match( options.batch )
       if wantBatch:
          print "we want to run on the batch with bsub"
          if patternCern.match( cwd ):
             print '@ CERN'
             scriptFile.write( batchScriptCERN( self.remoteOutputDir_,
                                                value) )
       else: 
          print '@ local'
          scriptFile.write( batchScriptLocal( self.remoteOutputDir_,
                                              value) )          
       
       scriptFile.close()
       os.system('chmod +x %s' % scriptFileName)

       #prepare the cfg
       
       # replace the list of fileNames by a chunk of filenames:
       if generator:
          randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
          randSvc.populate()
       else:

          print "grouping : ", grouping
          print "value : ", value
          
          iFileMin = (value)*grouping 
          iFileMax = (value+1)*grouping 
          
          process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
          print process.source
          
       cfgFile = open(jobDir+'/run_cfg.py','w')
       cfgFile.write(process.dumpPython())
       cfgFile.close()
Exemple #16
0
    def PrepareJobUser(self, jobDir, value):
        '''Prepare one job. This function is called by the base class.'''

        process.source = fullSource.clone()

        #prepare the batch script
        scriptFileName = jobDir + '/batchScript.sh'
        scriptFile = open(scriptFileName, 'w')
        storeDir = self.remoteOutputDir_.replace('/castor/cern.ch/cms', '')
        mode = self.RunningMode(options.batch)
        if mode == 'LXPLUS':
            scriptFile.write(
                batchScriptCERN(storeDir, value)
            )  #here is the call to batchScriptCERN, i need to change value
        elif mode == 'LOCAL':
            scriptFile.write(batchScriptLocal(
                storeDir, value))  #same as above but for batchScriptLocal
        scriptFile.close()
        os.system('chmod +x %s' % scriptFileName)

        #prepare the cfg
        # replace the list of fileNames by a chunk of filenames:
        if generator:
            randSvc = RandomNumberServiceHelper(
                process.RandomNumberGeneratorService)
            randSvc.populate()
        else:
            iFileMin = (value - 1) * grouping
            iFileMax = (value) * grouping
            process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
            print(process.source)
        cfgFile = open(jobDir + '/run_cfg.py', 'w')
        cfgFile.write('import FWCore.ParameterSet.Config as cms\n\n')
        cfgFile.write('import os,sys\n')
        # need to import most of the config from the base directory containing all jobs
        cfgFile.write("sys.path.append('%s')\n" % os.path.dirname(jobDir))
        cfgFile.write('from base_cfg import *\n')
        cfgFile.write('process.source = ' + process.source.dumpPython() + '\n')
        if generator:
            cfgFile.write('process.RandomNumberGeneratorService = ' +
                          process.RandomNumberGeneratorService.dumpPython() +
                          '\n')
        cfgFile.close()
Exemple #17
0
    def handleSeeding(self):
        """
        _handleSeeding_

        Handle Random Seed settings for the job
        """
        baggage = self.job.getBaggage()
        seeding = getattr(baggage, "seeding", None)
        if seeding == "ReproducibleSeeding":
            randService = self.process.RandomNumberGeneratorService
            tweak = PSetTweak()
            for x in randService:
                parameter = "process.RandomNumberGeneratorService.%s.initialSeed" % x._internal_name
                tweak.addParameter(parameter, x.initialSeed)
            applyTweak(self.process, tweak, self.fixupDict)
        else:
            if hasattr(self.process, "RandomNumberGeneratorService"):
                from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
                helper = RandomNumberServiceHelper(self.process.RandomNumberGeneratorService)
                helper.populate()
        return
Exemple #18
0
def handle_seeds(process, args):

    seedings = args.seeding

    if not hasattr(process, "RandomNumberGeneratorService"):
        return process

    for seeding in seedings:
        if seeding == "ReproducibleSeeding":
            init_seeds = read_json(args.reproducible_json)
            randService = process.RandomNumberGeneratorService
            for x in randService.parameters_():
                if hasattr(getattr(randService, x), "initialSeed"):
                    getattr(process.RandomNumberGeneratorService,
                            x).initialSeed = init_seeds[x]
            print("Recalled random seeds from saved seeds")
        else:
            from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
            helper = RandomNumberServiceHelper(
                process.RandomNumberGeneratorService)
            helper.populate()
            print("Populared random numbers of RandomNumberService")
    return process
obj = process.generator.PythiaParameters.processParameters

obj += ['PhaseSpace:pTHatMin='+str(options.ptHatLow)] 
obj += ['PhaseSpace:pTHatMax='+str(options.ptHatHigh)] 

# If user has provided some additional options, it gets appended into the pythia config list
# potentially overriding what's in the cards, check before proceeding
for userOption in options.userOptionsForPythia8:
	obj += [userOption]

#print "typeof obj: ", type(process.generator.PythiaParameters.processParameters )
#print "typeof obj: ", type(pythia8Parameters)


from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randSvc.populate()

process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", 
		generator = cms.PSet(

		       initialSeed = cms.untracked.uint32(random.randint(1, 999999)),
		       engineName = cms.untracked.string('TRandom3')
		)
	)

'''
process.rnsParams = cms.PSet(

		       initialSeed = cms.untracked.uint32(random.randint(1, 999999)),
		       engineName = cms.untracked.string('TRandom3')
Exemple #20
0
if len(options.output) == 0: options.output = sorted(oprocess.outputModules_())
if len(options._outpre) != len(options.output):
    raise ValueError(
        "Mismatch between # of output prefixes and # of output modules\n\tOutput prefixes are: "
        + ", ".join(options._outpre) + "\n\tOutput modules are: " +
        ", ".join(options.output))
for iout, output in enumerate(options.output):
    if len(output) == 0: continue
    if not hasattr(oprocess, output):
        raise ValueError("Unavailable output module: " + output)
    getattr(oprocess, output).fileName = 'file:' + _outname.replace(
        "outpre", options._outpre[iout])

# reset all random numbers to ensure statistically distinct but reproducible jobs
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randHelper.resetSeeds(options.maxEvents + options.part)

if options.signal:
    if len(options.scan) > 0:
        if hasattr(process, 'generator'):
            process.generator = getattr(
                __import__("SVJ.Production." + options.scan + "_cff",
                           fromlist=["generator"]), "generator")
    else:
        # generator settings
        if hasattr(process, 'generator'):
            process.generator.crossSection = cms.untracked.double(_helper.xsec)
            process.generator.PythiaParameters.processParameters = cms.vstring(
                _helper.getPythiaSettings())
            process.generator.maxEventsToPrint = cms.untracked.int32(1)
Exemple #21
0
    '/store/relval/CMSSW_12_0_0_pre3/RelValMinBias_14TeV/GEN-SIM/120X_mcRun3_2021_realistic_v1-v1/00000/af4e94a6-f36e-492f-974e-8d11ab13e4cc.root',
    '/store/relval/CMSSW_12_0_0_pre3/RelValMinBias_14TeV/GEN-SIM/120X_mcRun3_2021_realistic_v1-v1/00000/cafb30d5-857d-4471-93be-f3b0c302a8c6.root'
])
if hasattr(process, "XMLFromDBSource"):
    process.XMLFromDBSource.label = "Extended"
if hasattr(process, "DDDetectorESProducerFromDB"):
    process.DDDetectorESProducerFromDB.label = "Extended"
process.genstepfilter.triggerConditions = cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag import GlobalTag

process.GlobalTag = GlobalTag(process.GlobalTag,
                              '120X_mcRun3_2021_realistic_v1', '')

from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper

randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
import random

randHelper.resetSeeds(random.randrange(
    0, 100000))  #options.maxEvents+options.part)

from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import *
from Configuration.Generator.Pythia8CommonSettings_cfi import *

process.generator = cms.EDFilter(
    "Pythia8GeneratorFilter",
    pythiaHepMCVerbosity=cms.untracked.bool(False),
    maxEventsToPrint=cms.untracked.int32(1),
    pythiaPylistVerbosity=cms.untracked.int32(0),
    filterEfficiency=cms.untracked.double(1.0),
    comEnergy=cms.double(14000.0),
Exemple #22
0
if skipSimStep:
  process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,
                                  process.endjob_step,process.RAWSIMoutput_step,process.LHEoutput_step)
else:
  process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,
                                  process.simulation_step,
                                  process.endjob_step,process.RAWSIMoutput_step,process.LHEoutput_step)
from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
associatePatAlgosToolsTask(process)

# SETUP FWK for multithreaded
process.options.numberOfThreads = cms.untracked.uint32(nThreads)
process.options.numberOfStreams = cms.untracked.uint32(0)
for path in process.paths: # filter all path with the production filter sequence
  if path in ['lhe_step']: continue
  getattr(process,path)._seq = process.generator * getattr(process,path)._seq 

# CUSTUMIZATION
from Configuration.DataProcessing.Utils import addMonitoring 
process = addMonitoring(process)

# CUSTUMIZATION from command line
if seed>0:
  process.RandomNumberGeneratorService.externalLHEProducer.initialSeed = int(seed)
else:
  randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
  randSvc.populate() # set random number each cmsRun
from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete # early deletion of temporary data products to reduce peak memory need
process = customiseEarlyDelete(process)

print ">>> %s done pset_GENSIM.py %s"%('-'*15,'-'*16)
Exemple #23
0
def customise(process):
    if hasattr(process, "RandomNumberGeneratorService"):
        randSvc = RandomNumberServiceHelper(
            process.RandomNumberGeneratorService)
        randSvc.populate()

    process._Process__name = "SELECTION"
    process.LoadAllDictionaries = cms.Service("LoadAllDictionaries")
    process.options = cms.untracked.PSet(wantSummary=cms.untracked.bool(True))
    #process.Tracer = cms.Service("Tracer")

    process.TFileService = cms.Service("TFileService",
                                       fileName=cms.string("histo.root"),
                                       closeFileFast=cms.untracked.bool(True))

    process.load("ElectroWeakAnalysis.ZReco.dimuons_SkimPaths_cff")
    #process.load("ElectroWeakAnalysis.Skimming.dimuons_SkimPaths_cff")
    process.schedule.insert(len(process.schedule) - 1, process.dimuonsPath)

    # Output module configuration
    #process.load("ElectroWeakAnalysis.Skimming.dimuonsOutputModule_cfi")

    process.load("TrackingTools.TrackAssociator.default_cfi")

    process.selectMuons = cms.EDProducer('SelectReplacementCandidates',
                                         process.TrackAssociatorParameterBlock,
                                         muonInputTag=cms.InputTag("muons"))

    process.prepareMuonsPath = cms.Path(process.selectMuons)
    process.schedule.insert(
        len(process.schedule) - 1, process.prepareMuonsPath)
    process.load(
        "Configuration.StandardSequences.SimulationRandomNumberGeneratorSeeds_cff"
    )
    process.RandomNumberGeneratorService.newSource = cms.PSet(
        initialSeed=cms.untracked.uint32(12345),
        engineName=cms.untracked.string('HepJamesRandom'))
    process.load("IOMC/RandomEngine/IOMC_cff")

    process.load(
        "Configuration.StandardSequences.SimulationRandomNumberGeneratorSeeds_cff"
    )
    process.RandomNumberGeneratorService.newSource = cms.PSet(
        initialSeed=cms.untracked.uint32(12345),
        engineName=cms.untracked.string('HepJamesRandom'))
    process.RandomNumberGeneratorService.theSource = cms.PSet(
        initialSeed=cms.untracked.uint32(12345),
        engineName=cms.untracked.string('HepJamesRandom'))

    process.newSource = cms.EDProducer(
        "MCParticleReplacer",
        src=cms.InputTag("muons"),
        beamSpotSrc=cms.InputTag("dummy"),
        primaryVertexLabel=cms.InputTag("dummy"),
        hepMcSrc=cms.InputTag("generator"),
        algorithm=cms.string(
            "ZTauTau"),  # "ParticleGun", "ZTauTau", "CommissioningGun"
        hepMcMode=cms.string(
            "new"),  # "new" for new HepMCProduct with taus and decay products,
        # "replace" for replacing muons in the existing HepMCProcuct
        # commissioning
        verbose=cms.bool(False),
        CommissioningGun=cms.PSet(maxMuonEta=cms.double(2.1),
                                  minMuonPt=cms.double(5.)),
        ZTauTau=cms.PSet(
            TauolaOptions=cms.PSet(TauolaPolar,
                                   InputCards=cms.PSet(pjak1=cms.int32(0),
                                                       pjak2=cms.int32(0),
                                                       mdtau=cms.int32(102))),
            filterEfficiency=cms.untracked.double(1.0),
            pythiaHepMCVerbosity=cms.untracked.bool(False),
            generatorMode=cms.string(
                "Tauola"),  # "Tauola", "Pythia" (not implemented yet)
        ))

    process.insertNewSourcePath = cms.Path(process.newSource)
    process.schedule.insert(
        len(process.schedule) - 1, process.insertNewSourcePath)

    process.options = cms.untracked.PSet(
        SkipEvent=cms.untracked.vstring('ProductNotFound'))

    if runOnTheGrid:
        process.source.fileNames = cms.untracked.vstring(__FILE_NAMES__)
        process.source.skipEvents = cms.untracked.uint32(__SKIP_EVENTS__)
        process.maxEvents.input = cms.untracked.int32(__MAX_EVENTS__)
        process.output.fileName = cms.untracked.string("output.root")

    process.filterNumHepMCEvents = cms.EDFilter(
        'EmptyEventsFilter',
        minEvents=cms.untracked.int32(2),
        target=cms.untracked.int32(1))
    process.filterNumHepMCEventsPath = cms.Path(process.filterNumHepMCEvents)
    process.schedule.insert(
        len(process.schedule) - 1, process.filterNumHepMCEventsPath)

    process.output.SelectEvents = cms.untracked.PSet(
        SelectEvents=cms.vstring('filterNumHepMCEventsPath'))
    process.output.outputCommands = cms.untracked.vstring(
        "drop *_*_*_*", "keep edmHepMCProduct_*_*_*",
        "keep CaloTowersSorted_*_*_*", "keep recoMuons_*_*_*",
        "keep recoCaloMETs_met_*_*", "keep *_overlay_*_*",
        "keep *_selectMuons_*_*",
        "keep *_selectMuonsForMuonMuonReplacement_*_*",
        "keep EBDigiCollection_*_*_*", "keep EEDigiCollection_*_*_*",
        "keep ESDataFramesSorted_*_*_*",
        "keep DTLayerIdDTDigiMuonDigiCollection_*_*_*",
        "keep CSCDetIdCSCStripDigiMuonDigiCollection_*_*_*",
        "keep CSCDetIdCSCWireDigiMuonDigiCollection_*_*_*",
        "keep CSCDetIdCSCComparatorDigiMuonDigiCollection_*_*_*",
        "keep RPCDetIdRPCDigiMuonDigiCollection_*_*_*",
        "keep HBHEDataFramesSorted_*_*_*", "keep HFDataFramesSorted_*_*_*",
        "keep HODataFramesSorted_*_*_*", "keep *_hcalDigis_*_*",
        "keep SiStripDigiedmDetSetVector_*_*_*",
        "keep PixelDigiedmDetSetVector_*_*_*")
    #print process.schedule
    print process.dumpPython()
    return (process)
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()
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D41_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC_cfi')
process.load('GeneratorInterface.Core.genFilterSummary_cff')
process.load('Configuration.StandardSequences.SimIdeal_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')
process.load(
    'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

# reset all random numbers to ensure statistically distinct but reproducible jobs
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randHelper.resetSeeds(options.seed)

# process.MessageLogger = cms.Service(
#     "MessageLogger",
#     destinations = cms.untracked.vstring('cout'),
#     categories = cms.untracked.vstring('CaloSD'),
#     debugModules = cms.untracked.vstring('*'),
#     cout = cms.untracked.PSet(
#         threshold =  cms.untracked.string('DEBUG'),
#         INFO =  cms.untracked.int32(0),
#         DEBUG = cms.untracked.int32(0),
#         CaloSD = cms.untracked.int32(10000000)
#         )
#     )
Exemple #26
0
def init_process(options):
    from Configuration.Eras.Era_Phase2C11_cff import Phase2C11
    if options.dofinecalo:
        from Configuration.ProcessModifiers.fineCalo_cff import fineCalo
        process = cms.Process('SIM', Phase2C11, fineCalo)
    else:
        process = cms.Process('SIM', Phase2C11)
    process.load('Configuration.StandardSequences.Services_cff')
    process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
    process.load('FWCore.MessageService.MessageLogger_cfi')
    # process.load("Configuration.Geometry.GeometryExtended2026D71_cff")
    # process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff')
    process.load("Configuration.Geometry.GeometryExtended2026D84_cff")
    process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff')
    process.load("SimGeneral.MixingModule.mixNoPU_cfi")
    process.load('Configuration.StandardSequences.MagneticField_cff')
    process.load('Configuration.StandardSequences.Generator_cff')
    process.load('Configuration.StandardSequences.VtxSmearedNoSmear_cff')
    process.load('GeneratorInterface.Core.genFilterSummary_cff')
    process.load('Configuration.StandardSequences.SimIdeal_cff')
    process.load('Configuration.StandardSequences.Digi_cff')
    process.load('Configuration.StandardSequences.SimL1Emulator_cff')
    process.load('Configuration.StandardSequences.L1TrackTrigger_cff')
    process.load('Configuration.StandardSequences.DigiToRaw_cff')
    process.load('HLTrigger.Configuration.HLT_Fake2_cff')
    process.load('Configuration.StandardSequences.EndOfProcess_cff')
    process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

    # reset all random numbers to ensure statistically distinct but reproducible jobs
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randHelper.resetSeeds(options.seed)

    process.maxEvents = cms.untracked.PSet(
        input = cms.untracked.int32(options.maxEvents),
        output = cms.optional.untracked.allowed(cms.int32,cms.PSet)
        )

    process.source = cms.Source("EmptySource")

    process.options = cms.untracked.PSet(
        FailPath = cms.untracked.vstring(),
        IgnoreCompletely = cms.untracked.vstring(),
        Rethrow = cms.untracked.vstring(),
        SkipEvent = cms.untracked.vstring(),
        allowUnscheduled = cms.obsolete.untracked.bool,
        canDeleteEarly = cms.untracked.vstring(),
        emptyRunLumiMode = cms.obsolete.untracked.string,
        eventSetup = cms.untracked.PSet(
            forceNumberOfConcurrentIOVs = cms.untracked.PSet(),
            numberOfConcurrentIOVs = cms.untracked.uint32(1)
            ),
        fileMode = cms.untracked.string('FULLMERGE'),
        forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False),
        makeTriggerResults = cms.obsolete.untracked.bool,
        numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1),
        numberOfConcurrentRuns = cms.untracked.uint32(1),
        numberOfStreams = cms.untracked.uint32(0),
        numberOfThreads = cms.untracked.uint32(1),
        printDependencies = cms.untracked.bool(False),
        sizeOfStackForThreadsInKB = cms.optional.untracked.uint32,
        throwIfIllegalParameter = cms.untracked.bool(True),
        wantSummary = cms.untracked.bool(False)
        )

    # Production Info
    process.configurationMetadata = cms.untracked.PSet(
        annotation = cms.untracked.string('SingleMuPt1000_pythia8_cfi nevts:10'),
        name = cms.untracked.string('Applications'),
        version = cms.untracked.string('$Revision: 1.19 $')
        )

    from Configuration.AlCa.autoCond import autoCond
    process.GlobalTag.globaltag = autoCond['phase2_realistic']


    # _____________________________
    # Main customisations

    if options.minpt == -1. and options.maxpt == -1.:
        minpt = options.pt - 0.01
        maxpt = options.pt + 0.01
        ptstring = str(int(options.pt))
    else:
        minpt = options.minpt
        maxpt = options.maxpt
        ptstring = str(int(options.minpt)) + 'to' + str(int(options.maxpt))
    if abs(options.pdgid) == 6: ptstring = '14000'
    print('Using pdgid={}, minpt={}, maxpt={}'.format(options.pdgid, minpt, maxpt))
    add_single_particle_gun(process, options.pdgid, minpt=minpt, maxpt=maxpt)
    if options.debug: add_debug_module(process, 'DoFineCalo')

    # _____________________________
    # Finalizing

    # The standard steps
    process.generation_step = cms.Path(process.pgen)
    process.simulation_step = cms.Path(process.psim)
    process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
    process.endjob_step = cms.EndPath(process.endOfProcess)

    # Make nicely formatted output root file
    if options.outputFile.startswith('default'):
        from time import strftime
        outputFile = '{outputlvl}_seed{seed}_pdgid{pdgid}_{pt}GeV_{date}_{finecalo}_n{nevents}.root'.format(
            outputlvl = 'NTUPLE' if options.ntuple else 'SIM',
            seed = options.seed,
            pdgid = abs(options.pdgid),
            pt = ptstring,
            date = strftime('%b%d'),
            finecalo = 'finecalo' if options.dofinecalo else 'nofine',
            nevents = options.maxEvents
            )
    else:
        outputFile = options.outputFile

    # Figure out the output format
    if options.ntuple:
        process.TFileService = cms.Service("TFileService",
            fileName = cms.string(outputFile)
            )
        process.ntupler = cms.EDAnalyzer('HistoryNTupler')
        process.ntupler_step = cms.Path(process.HistoryNTupler)
        process.schedule = cms.Schedule(
            process.generation_step,
            process.genfiltersummary_step,
            process.simulation_step,
            process.ntupler_step,
            process.endjob_step,
            )
    else:
        process.load('Configuration.EventContent.EventContent_cff')
        process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule",
            SelectEvents = cms.untracked.PSet(
                SelectEvents = cms.vstring('generation_step')
                ),
            dataset = cms.untracked.PSet(
                dataTier = cms.untracked.string('GEN-SIM'),
                filterName = cms.untracked.string('')
                ),
            fileName = cms.untracked.string('file:{}'.format(outputFile)),
            outputCommands = process.FEVTDEBUGEventContent.outputCommands,
            splitLevel = cms.untracked.int32(0)
            )
        process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput)
        process.schedule = cms.Schedule(
            process.generation_step,
            process.genfiltersummary_step,
            process.simulation_step,
            process.endjob_step,
            process.FEVTDEBUGoutput_step,
            )

    from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
    associatePatAlgosToolsTask(process)
    # filter all path with the production filter sequence
    for path in process.paths:
        getattr(process,path).insert(0, process.generator)

    if options.profiling:
        # customisation function from Validation.Performance.TimeMemoryInfo
        from Validation.Performance.TimeMemoryInfo import customise 
        process = customise(process)

    if options.dofinecalo:
        for _pset in ["CaloSD", "CaloTrkProcessing", "TrackingAction"]:
            getattr(process.g4SimHits,_pset).UseFineCalo = [2]

    # Add early deletion of temporary data products to reduce peak memory need
    from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
    process = customiseEarlyDelete(process)
    return process
Exemple #27
0
def customise_for_gc(process):
    import FWCore.ParameterSet.Config as cms
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper

    try:
        maxevents = int(__MAX_EVENTS__)
        process.maxEvents = cms.untracked.PSet(
            input=cms.untracked.int32(max(-1, maxevents)))
    except Exception:
        pass

    # Dataset related setup
    try:
        primaryFiles = [__FILE_NAMES__]
        if not hasattr(process, "source"):
            print("creating input source for grid-control")
            process.source = cms.Source(
                'PoolSource',
                skipEvents=cms.untracked.uint32(__SKIP_EVENTS__),
                fileNames=cms.untracked.vstring(primaryFiles))
        else:
            print("input source already exists, adapting it for grid-control")
            process.source.skipEvents = cms.untracked.uint32(__SKIP_EVENTS__)
            process.source.fileNames = cms.untracked.vstring(primaryFiles)
        try:
            secondaryFiles = [__FILE_NAMES2__]
            process.source.secondaryFileNames = cms.untracked.vstring(
                secondaryFiles)
        except Exception:
            pass
        try:
            lumirange = [__LUMI_RANGE__]
            if len(lumirange) > 0:
                process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(
                    lumirange)
                process.maxEvents = cms.untracked.PSet(
                    input=cms.untracked.int32(-1))
        except Exception:
            pass
    except Exception:
        pass

    if hasattr(process, 'RandomNumberGeneratorService'):
        randSvc = RandomNumberServiceHelper(
            process.RandomNumberGeneratorService)
        randSvc.populate()
        print('Generator random seed: %s' %
              process.RandomNumberGeneratorService.generator.initialSeed)

    process.AdaptorConfig = cms.Service(
        'AdaptorConfig',
        enable=cms.untracked.bool(True),
        stats=cms.untracked.bool(True),
    )

    # Generator related setup
    try:
        if hasattr(process,
                   'generator') and process.source.type_() != 'PoolSource':
            process.source.firstLuminosityBlock = cms.untracked.uint32(
                1 + __GC_JOB_ID__)
            print('Generator random seed: %s' %
                  process.RandomNumberGeneratorService.generator.initialSeed)
    except Exception:
        pass

    # Print GlobalTag for DBS3 registration - output is taken from edmConfigHash
    try:
        print('globaltag:%s' % process.GlobalTag.globaltag.value())
    except Exception:
        pass
    return (process)
Exemple #28
0
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()
        l1ParamMuons=cms.untracked.uint32(870926),
        paramMuons=cms.untracked.uint32(541225),
        muonRPCDigis=cms.untracked.uint32(2146964),
        siTrackerGaussianSmearingRecHits=cms.untracked.uint32(321480),
        simMuonCSCDigis=cms.untracked.uint32(121245),
        simMuonDTDigis=cms.untracked.uint32(123115),
        simMuonRPCDigis=cms.untracked.uint32(1215235),
        generator=cms.untracked.uint32(10000),
        ecalRecHit=cms.untracked.uint32(18734),
        ecalPreshowerRecHit=cms.untracked.uint32(18734),
        hbhereco=cms.untracked.uint32(18734),
        horeco=cms.untracked.uint32(18734),
        hfreco=cms.untracked.uint32(18734)),
    sourceSeed=cms.untracked.uint32(10000))
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randHelper.populate()
process.RandomNumberGeneratorService.saveFileName = cms.untracked.string(
    "RandomEngineState.log")

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(9000))

#process.MessageLogger.categories.append('L1GtTrigReport')
#process.MessageLogger.categories.append('HLTrigReport')

process.MessageLogger.cerr.noTimeStamps = cms.untracked.bool(True)
process.MessageLogger.cerr.threshold = cms.untracked.string('INFO')

##########################################################################################################
        parameterSets = cms.vstring('pythiaUESettings', 
            'customProcesses', 
            'pythiaPromptPhotons', 
            'kinematics'),
        kinematics = cms.vstring('CKIN(3)=15', 
            'CKIN(4)=9999', 
            'CKIN(7)=-3.', 
            'CKIN(8)=3.')
    )
)
process.ProductionFilterSequence = cms.Sequence(process.hiSignal)


process.load('Configuration/StandardSequences/SimulationRandomNumberGeneratorSeeds_cff')
from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randSvc.populate()

# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen_himix)
process.simulation_step = cms.Path(process.psim)
process.digitisation_step = cms.Path(process.pdigi)
process.L1simulation_step = cms.Path(process.SimL1Emulator)
process.digi2raw_step = cms.Path(process.DigiToRaw)
process.endjob_step = cms.Path(process.endOfProcess)
process.out_step = cms.EndPath(process.output)

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.digi2raw_step)
process.schedule.extend(process.HLTSchedule)
process.schedule.extend([process.endjob_step,process.out_step])
Exemple #31
0
def randomizeSeeds(process):
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    rndSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    rndSvc.populate()
    return process
def randomizeSeeds(process):
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    rndSvc=RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    rndSvc.populate()
    return process
Exemple #33
0
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 customise(process):
	if hasattr(process, "RandomNumberGeneratorService"):
		randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
		randSvc.populate()
	
	process._Process__name="SELECTION"
	process.LoadAllDictionaries = cms.Service("LoadAllDictionaries")
	process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
	#process.Tracer = cms.Service("Tracer")
	
	process.TFileService = cms.Service("TFileService", 
		fileName = cms.string("histo.root"),
		closeFileFast = cms.untracked.bool(True)
	)
	
	process.load("ElectroWeakAnalysis.ZReco.dimuons_SkimPaths_cff")
	#process.load("ElectroWeakAnalysis.Skimming.dimuons_SkimPaths_cff")
	process.schedule.insert(len(process.schedule)-1,process.dimuonsPath)
	
	# Output module configuration
	#process.load("ElectroWeakAnalysis.Skimming.dimuonsOutputModule_cfi")
	
	process.load("TrackingTools.TrackAssociator.default_cfi")
	
	process.selectMuons = cms.EDProducer('SelectReplacementCandidates',
		process.TrackAssociatorParameterBlock,
		muonInputTag = cms.InputTag("muons")
	)

	process.prepareMuonsPath = cms.Path(process.selectMuons)
	process.schedule.insert(len(process.schedule)-1,process.prepareMuonsPath)
	process.load("Configuration.StandardSequences.SimulationRandomNumberGeneratorSeeds_cff")
	process.RandomNumberGeneratorService.newSource = cms.PSet(
		initialSeed = cms.untracked.uint32(12345),
		engineName = cms.untracked.string('HepJamesRandom')
	)                                                                                               
	process.load("IOMC/RandomEngine/IOMC_cff")
	
	process.load("Configuration.StandardSequences.SimulationRandomNumberGeneratorSeeds_cff")
	process.RandomNumberGeneratorService.newSource = cms.PSet(
		      initialSeed = cms.untracked.uint32(12345),
		      engineName = cms.untracked.string('HepJamesRandom')
	) 
	process.RandomNumberGeneratorService.theSource = cms.PSet(
		      initialSeed = cms.untracked.uint32(12345),
		      engineName = cms.untracked.string('HepJamesRandom')
	)
			    
	process.newSource = cms.EDProducer("MCParticleReplacer",
    src                = cms.InputTag("muons"),
    beamSpotSrc        = cms.InputTag("dummy"),
    primaryVertexLabel = cms.InputTag("dummy"),
    hepMcSrc           = cms.InputTag("generator"),

    algorithm = cms.string("ZTauTau"), # "ParticleGun", "ZTauTau", "CommissioningGun"
    hepMcMode = cms.string("new"),         # "new" for new HepMCProduct with taus and decay products,
                                           # "replace" for replacing muons in the existing HepMCProcuct
                                           # commissioning
    verbose = cms.bool(False),

                CommissioningGun = cms.PSet(
                        maxMuonEta = cms.double(2.1),
                        minMuonPt = cms.double(5.)
                ),


    ZTauTau = cms.PSet(
		    TauolaOptions = cms.PSet(
		  		TauolaPolar,
		  		InputCards = cms.PSet
					(
					    pjak1 = cms.int32(0),
		    			pjak2 = cms.int32(0),
					    mdtau = cms.int32(102)
		 			)
		 		),
        filterEfficiency = cms.untracked.double(1.0),
        pythiaHepMCVerbosity = cms.untracked.bool(False),
        generatorMode = cms.string("Tauola"),  # "Tauola", "Pythia" (not implemented yet)
        
    )
	)
	
	
	process.insertNewSourcePath = cms.Path(process.newSource)
	process.schedule.insert(len(process.schedule)-1,process.insertNewSourcePath)
                                              
	process.options = cms.untracked.PSet( SkipEvent = cms.untracked.vstring('ProductNotFound') )

	if runOnTheGrid:
		process.source.fileNames=cms.untracked.vstring(__FILE_NAMES__)
		process.source.skipEvents=cms.untracked.uint32(__SKIP_EVENTS__)
		process.maxEvents.input = cms.untracked.int32(__MAX_EVENTS__)
		process.output.fileName=cms.untracked.string("output.root")

	process.filterNumHepMCEvents = cms.EDFilter('EmptyEventsFilter',
		minEvents=cms.untracked.int32(2),
		target=cms.untracked.int32(1)
	)		
	process.filterNumHepMCEventsPath = cms.Path(process.filterNumHepMCEvents)
	process.schedule.insert(len(process.schedule)-1,process.filterNumHepMCEventsPath)
		
	process.output.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('filterNumHepMCEventsPath'))	
	process.output.outputCommands = cms.untracked.vstring(
                "drop *_*_*_*",
								"keep edmHepMCProduct_*_*_*",
                "keep CaloTowersSorted_*_*_*",
                "keep recoMuons_*_*_*",
                "keep recoCaloMETs_met_*_*",
                "keep *_overlay_*_*",
                "keep *_selectMuons_*_*",
                "keep *_selectMuonsForMuonMuonReplacement_*_*",                
                "keep EBDigiCollection_*_*_*",
                "keep EEDigiCollection_*_*_*",
                "keep ESDataFramesSorted_*_*_*",
                "keep DTLayerIdDTDigiMuonDigiCollection_*_*_*",
                "keep CSCDetIdCSCStripDigiMuonDigiCollection_*_*_*",
                "keep CSCDetIdCSCWireDigiMuonDigiCollection_*_*_*",
                "keep CSCDetIdCSCComparatorDigiMuonDigiCollection_*_*_*",
                "keep RPCDetIdRPCDigiMuonDigiCollection_*_*_*",
                "keep HBHEDataFramesSorted_*_*_*",
                "keep HFDataFramesSorted_*_*_*",
                "keep HODataFramesSorted_*_*_*",
                "keep *_hcalDigis_*_*",
                "keep SiStripDigiedmDetSetVector_*_*_*",
                "keep PixelDigiedmDetSetVector_*_*_*"
        )
	#print process.schedule
	print process.dumpPython()
	return(process)
#process.RandomNumberGeneratorService.generator.engineName = cms.untracked.string('TRandom3')
#process.RandomNumberGeneratorService.VtxSmeared.engineName = cms.untracked.string('TRandom3')
#process.RandomNumberGeneratorService.g4SimHits.engineName = cms.untracked.string('TRandom3')
#process.RandomNumberGeneratorService.mix.engineName = cms.untracked.string('TRandom3')
#process.RandomNumberGeneratorService.LHCTransport.engineName = cms.untracked.string('TRandom3')
#process.RandomNumberGeneratorService.simSiPixelDigis.engineName = cms.untracked.string('TRandom3')

process.RandomNumberGeneratorService.generator.initialSeed = theSeedValue+111211
process.RandomNumberGeneratorService.VtxSmeared.initialSeed=theSeedValue+22222
process.RandomNumberGeneratorService.g4SimHits.initialSeed=theSeedValue+33333
process.RandomNumberGeneratorService.mix.initialSeed=theSeedValue+33333
process.RandomNumberGeneratorService.LHCTransport.initialSeed=theSeedValue+33333
process.RandomNumberGeneratorService.simSiPixelDigis.initialSeed=theSeedValue+33333

from IOMC.RandomEngine.RandomServiceHelper import  RandomNumberServiceHelper
randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randHelper.populate()

# muon specific ----------------------------------------------------------------
process.load("Geometry.DTGeometry.dtGeometry_cfi")
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
process.load("SimMuon/DTDigitizer/muonDTDigis_cfi")

# tracker specific -------------------------------------------------------------
# replace with long barrel geometry
#MOVED UPSTAIRS sep = '1'
if os.getenv('pgun_sep'):
   sep= str(os.getenv('pgun_sep'))
print 'Stack Separation: '+sep

process.siPixelFakeGainOfflineESSource = cms.ESSource("SiPixelFakeGainOfflineESSource",
def customizeRandomSeed(process):

    randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randSvc.populate()

    return (process)
Exemple #37
0
        Overlapping = cms.bool(isOverlapping),
        RandomShoot = cms.bool(False),
        NParticles = cms.int32(nparticles),
        MaxEta = cms.double(etaMax),
        MinEta = cms.double(etaMin),
        MaxPhi = cms.double(phiMax),
        MinPhi = cms.double(phiMin),
    ),
    Verbosity = cms.untracked.int32(10),
    psethack = cms.string('single particle random energy'),
    AddAntiParticle = cms.bool(False),
    firstRun = cms.untracked.uint32(1)
)

from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
randHelper.resetSeeds(99)


process.ProductionFilterSequence = cms.Sequence(process.generator)

# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
process.simulation_step = cms.Path(process.psim)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.endjob_step = cms.EndPath(process.endOfProcess)
process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput)

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step,process.FEVTDEBUGoutput_step)
from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
Exemple #38
0
def randomize_seeds(process, save_fn='RandomEngineState.xml'):
    from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
    randHelper =  RandomNumberServiceHelper(process.RandomNumberGeneratorService)
    randHelper.populate()
    if save_fn:
        process.RandomNumberGeneratorService.saveFileName =  cms.untracked.string(save_fn)