Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:59

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from FWCore.ParameterSet.VarParsing import VarParsing
0004 options = VarParsing ('python')
0005 options.register('outFilename', 'particleLevel.root',  VarParsing.multiplicity.singleton, VarParsing.varType.string, "Output file name")
0006 options.register('photos', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "ME corrections")
0007 options.register('lepton', 13, VarParsing.multiplicity.singleton, VarParsing.varType.int, "Lepton ID for Z decays")
0008 options.register('cutoff', 0.00011, VarParsing.multiplicity.singleton, VarParsing.varType.float, "IR cutoff")
0009 options.register('taufilter', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "Filter tau -> leptons")
0010 options.setDefault('maxEvents', 100)
0011 options.parseArguments()
0012 print(options)
0013 
0014 process = cms.Process("PROD")
0015 
0016 # import of standard configurations
0017 process.load('Configuration.StandardSequences.Services_cff')
0018 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0019 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0020 process.MessageLogger.cerr.FwkReport.reportEvery = int(options.maxEvents/100)
0021 
0022 from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper
0023 randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
0024 randSvc.populate()
0025 
0026 # set input to process
0027 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
0028 
0029 process.source = cms.Source("EmptySource")
0030 
0031 from Configuration.Generator.Pythia8CommonSettings_cfi import *
0032 from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import *
0033 
0034 process.generator = cms.EDFilter("Pythia8GeneratorFilter",
0035     maxEventsToPrint = cms.untracked.int32(1),
0036     pythiaPylistVerbosity = cms.untracked.int32(1),
0037     filterEfficiency = cms.untracked.double(1.0),
0038     pythiaHepMCVerbosity = cms.untracked.bool(False),
0039     comEnergy = cms.double(13000.),
0040     PythiaParameters = cms.PSet(
0041         pythia8CommonSettingsBlock,
0042         pythia8CUEP8M1SettingsBlock,
0043         processParameters = cms.vstring(
0044             'WeakSingleBoson:ffbar2gmZ = on',
0045             'PhaseSpace:mHatMin = 50.',
0046             '23:onMode = off', 
0047             '23:onIfAny = 15',
0048             'ParticleDecays:allowPhotonRadiation = on',
0049             'TimeShower:QEDshowerByL = off',
0050             ),
0051         parameterSets = cms.vstring('pythia8CommonSettings',
0052                                     'pythia8CUEP8M1Settings',
0053                                     'processParameters')
0054     ),
0055     ExternalDecays = cms.PSet(
0056         Photospp = cms.untracked.PSet(
0057             parameterSets = cms.vstring("setExponentiation", "setInfraredCutOff", "setMeCorrectionWtForW", "setMeCorrectionWtForZ", "setMomentumConservationThreshold", "setPairEmission", "setPhotonEmission", "setStopAtCriticalError", "suppressAll", "forceBremForDecay"),
0058             setExponentiation = cms.bool(True),
0059             setMeCorrectionWtForW = cms.bool(True),
0060             setMeCorrectionWtForZ = cms.bool(True),
0061             setInfraredCutOff = cms.double(0.00011),
0062             setMomentumConservationThreshold = cms.double(0.1),
0063             setPairEmission = cms.bool(True),
0064             setPhotonEmission = cms.bool(True),
0065             setStopAtCriticalError = cms.bool(False),
0066             # Use Photos only for W/Z decays
0067             suppressAll = cms.bool(True),
0068             forceBremForDecay = cms.PSet(
0069                 parameterSets = cms.vstring("Z", "Wp", "Wm"),
0070                 Z = cms.vint32(0, 23),
0071                 Wp = cms.vint32(0, 24),
0072                 Wm = cms.vint32(0, -24),
0073             ),
0074         ),
0075         parameterSets = cms.vstring("Photospp")
0076     )
0077 )
0078 
0079 if options.taufilter != 'off':
0080     process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:filter = on')
0081     if options.taufilter == 'el':
0082         process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = on')
0083         process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = off')
0084     if options.taufilter == 'mu':
0085         process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = off')
0086         process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = on')
0087 
0088 
0089 ## configure process options
0090 process.options = cms.untracked.PSet(
0091     allowUnscheduled = cms.untracked.bool(True),
0092     wantSummary      = cms.untracked.bool(True)
0093 )
0094 
0095 process.genParticles = cms.EDProducer("GenParticleProducer",
0096     saveBarCodes = cms.untracked.bool(True),
0097     src = cms.InputTag("generator:unsmeared"),
0098     abortOnUnknownPDGCode = cms.untracked.bool(False)
0099 )
0100 process.printTree1 = cms.EDAnalyzer("ParticleListDrawer",
0101     src = cms.InputTag("genParticles"),
0102     maxEventsToPrint  = cms.untracked.int32(10)
0103 )
0104 
0105 process.load("GeneratorInterface.RivetInterface.rivetAnalyzer_cfi")
0106 process.rivetAnalyzer.AnalysisNames = cms.vstring('PDG_TAUS', 'MC_ELECTRONS', 'MC_MUONS', 'MC_TAUS')
0107 process.rivetAnalyzer.useLHEweights = False
0108 # process.rivetAnalyzer.OutputFile = 'out.yoda'
0109 process.rivetAnalyzer.OutputFile = 'z-taufilter-%s.yoda' % options.taufilter
0110 
0111 # process.path = cms.Path(process.externalLHEProducer*process.generator*process.rivetAnalyzer)
0112 process.path = cms.Path(process.generator*process.rivetAnalyzer)
0113