|
| 1 | +import FWCore.ParameterSet.Config as cms |
| 2 | + |
| 3 | +from FWCore.ParameterSet.VarParsing import VarParsing |
| 4 | +options = VarParsing ('python') |
| 5 | +options.register('outFilename', 'particleLevel.root', VarParsing.multiplicity.singleton, VarParsing.varType.string, "Output file name") |
| 6 | +options.register('photos', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "ME corrections") |
| 7 | +options.register('lepton', 13, VarParsing.multiplicity.singleton, VarParsing.varType.int, "Lepton ID for Z decays") |
| 8 | +options.register('cutoff', 0.00011, VarParsing.multiplicity.singleton, VarParsing.varType.float, "IR cutoff") |
| 9 | +options.register('taufilter', 'off', VarParsing.multiplicity.singleton, VarParsing.varType.string, "Filter tau -> leptons") |
| 10 | +options.setDefault('maxEvents', 100) |
| 11 | +options.parseArguments() |
| 12 | +print(options) |
| 13 | + |
| 14 | +process = cms.Process("PROD") |
| 15 | + |
| 16 | +# import of standard configurations |
| 17 | +process.load('Configuration.StandardSequences.Services_cff') |
| 18 | +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') |
| 19 | +process.load("FWCore.MessageLogger.MessageLogger_cfi") |
| 20 | +process.MessageLogger.cerr.FwkReport.reportEvery = int(options.maxEvents/100) |
| 21 | + |
| 22 | +from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper |
| 23 | +randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService) |
| 24 | +randSvc.populate() |
| 25 | + |
| 26 | +# set input to process |
| 27 | +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) ) |
| 28 | + |
| 29 | +process.source = cms.Source("EmptySource") |
| 30 | + |
| 31 | +from Configuration.Generator.Pythia8CommonSettings_cfi import * |
| 32 | +from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * |
| 33 | + |
| 34 | +process.generator = cms.EDFilter("Pythia8HepMC3GeneratorFilter", |
| 35 | + maxEventsToPrint = cms.untracked.int32(1), |
| 36 | + pythiaPylistVerbosity = cms.untracked.int32(1), |
| 37 | + filterEfficiency = cms.untracked.double(1.0), |
| 38 | + pythiaHepMCVerbosity = cms.untracked.bool(False), |
| 39 | + comEnergy = cms.double(13000.), |
| 40 | + PythiaParameters = cms.PSet( |
| 41 | + pythia8CommonSettingsBlock, |
| 42 | + pythia8CUEP8M1SettingsBlock, |
| 43 | + processParameters = cms.vstring( |
| 44 | + 'WeakSingleBoson:ffbar2gmZ = on', |
| 45 | + 'PhaseSpace:mHatMin = 50.', |
| 46 | + '23:onMode = off', |
| 47 | + '23:onIfAny = 15', |
| 48 | + 'HadronLevel:QED = on', |
| 49 | + 'TimeShower:QEDshowerByL = off', |
| 50 | + ), |
| 51 | + parameterSets = cms.vstring('pythia8CommonSettings', |
| 52 | + 'pythia8CUEP8M1Settings', |
| 53 | + 'processParameters') |
| 54 | + ), |
| 55 | + ExternalDecays = cms.PSet( |
| 56 | + Photospp = cms.untracked.PSet( |
| 57 | + parameterSets = cms.vstring("setExponentiation", "setInfraredCutOff", "setMeCorrectionWtForW", "setMeCorrectionWtForZ", "setMomentumConservationThreshold", "setPairEmission", "setPhotonEmission", "setStopAtCriticalError", "suppressAll", "forceBremForDecay"), |
| 58 | + setExponentiation = cms.bool(True), |
| 59 | + setMeCorrectionWtForW = cms.bool(True), |
| 60 | + setMeCorrectionWtForZ = cms.bool(True), |
| 61 | + setInfraredCutOff = cms.double(0.00011), |
| 62 | + setMomentumConservationThreshold = cms.double(0.1), |
| 63 | + setPairEmission = cms.bool(False), |
| 64 | + setPhotonEmission = cms.bool(True), |
| 65 | + setStopAtCriticalError = cms.bool(False), |
| 66 | + # Use Photos only for W/Z decays |
| 67 | + suppressAll = cms.bool(True), |
| 68 | + forceBremForDecay = cms.PSet( |
| 69 | + parameterSets = cms.vstring("Z", "Wp", "Wm"), |
| 70 | + Z = cms.vint32(0, 23), |
| 71 | + Wp = cms.vint32(0, 24), |
| 72 | + Wm = cms.vint32(0, -24), |
| 73 | + ), |
| 74 | + ), |
| 75 | + parameterSets = cms.vstring("Photospp") |
| 76 | + ) |
| 77 | +) |
| 78 | + |
| 79 | +if options.taufilter != 'off': |
| 80 | + process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:filter = on') |
| 81 | + if options.taufilter == 'el': |
| 82 | + process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = on') |
| 83 | + process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = off') |
| 84 | + if options.taufilter == 'mu': |
| 85 | + process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:eDecays = off') |
| 86 | + process.generator.PythiaParameters.processParameters.append('BiasedTauDecayer:muDecays = on') |
| 87 | + |
| 88 | + |
| 89 | +## configure process options |
| 90 | +process.options = cms.untracked.PSet( |
| 91 | + allowUnscheduled = cms.untracked.bool(True), |
| 92 | + wantSummary = cms.untracked.bool(True) |
| 93 | +) |
| 94 | + |
| 95 | +process.genParticles = cms.EDProducer("GenParticleProducer", |
| 96 | + saveBarCodes = cms.untracked.bool(True), |
| 97 | + src = cms.InputTag("generator:unsmeared"), |
| 98 | + abortOnUnknownPDGCode = cms.untracked.bool(False) |
| 99 | +) |
| 100 | +process.printTree1 = cms.EDAnalyzer("ParticleListDrawer", |
| 101 | + src = cms.InputTag("genParticles"), |
| 102 | + maxEventsToPrint = cms.untracked.int32(10) |
| 103 | +) |
| 104 | + |
| 105 | +process.load("GeneratorInterface.RivetInterface.rivetAnalyzer_cfi") |
| 106 | +process.rivetAnalyzer.AnalysisNames = cms.vstring('PDG_TAUS', 'MC_ELECTRONS', 'MC_MUONS', 'MC_TAUS') |
| 107 | +process.rivetAnalyzer.useLHEweights = False |
| 108 | +# process.rivetAnalyzer.OutputFile = 'out.yoda' |
| 109 | +process.rivetAnalyzer.OutputFile = 'z-taufilter-%s.yoda' % options.taufilter |
| 110 | + |
| 111 | +# process.path = cms.Path(process.externalLHEProducer*process.generator*process.rivetAnalyzer) |
| 112 | +process.path = cms.Path(process.generator*process.rivetAnalyzer) |
| 113 | + |
0 commit comments