File indexing completed on 2024-11-25 02:29:58
0001
0002 from PhysicsTools.PatAlgos.patTemplate_cfg import *
0003
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 options = VarParsing.VarParsing ('standard')
0006
0007 options.register('GlobalTag', "GR_R_52_V7::All", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "GlobaTTag to use (otherwise default Pat GT is used)")
0008 options.register('mcInfo', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "process MonteCarlo data, default is data")
0009 options.register('jetCorrections', 'L2Relative', VarParsing.VarParsing.multiplicity.list, VarParsing.VarParsing.varType.string, "Level of jet corrections to use: Note the factors are read from DB via GlobalTag")
0010 options.jetCorrections.append('L3Absolute')
0011 options.register('doJetPFchs', True, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "process MonteCarlo data, default is data")
0012
0013 options.register('hltName', 'HLT', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "HLT menu to use for trigger matching, e.g., HLT, REDIGI311X")
0014 options.register('mcVersion', '', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "'36X' for example. Used for specific MC fix")
0015 options.register('jetTypes', 'AK5PF', VarParsing.VarParsing.multiplicity.list, VarParsing.VarParsing.varType.string, "Additional jet types that will be produced (AK5Calo and AK5PF, cross cleaned in PF2PAT, are included anyway)")
0016
0017 options.register('hltSelection', '*', VarParsing.VarParsing.multiplicity.list, VarParsing.VarParsing.varType.string, "hlTriggers (OR) used to filter events. for data: ''HLT_Mu9', 'HLT_IsoMu9', 'HLT_IsoMu13_v*''; for MC, HLT_Mu9")
0018 options.register('addKeep', '', VarParsing.VarParsing.multiplicity.list, VarParsing.VarParsing.varType.string, "Additional keep and drop statements to trim the event content")
0019
0020 options.register('dataVersion', '', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "'36X' for example. Used for specific DATA fix")
0021
0022 options.register('debug', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "switch on/off debug mode")
0023
0024 options.register('type', 'METScanning', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "key output type string")
0025
0026 options.register('dataTier', 'AOD', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "data tier string, e.g., AOD, RECO")
0027
0028 options.parseArguments()
0029 options._tagOrder =[]
0030
0031 print(options)
0032
0033
0034 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0035 if options.debug:
0036 process.MessageLogger.cerr.FwkReport.reportEvery = 1
0037
0038
0039 if options.files:
0040 process.source.fileNames = options.files
0041 else:
0042 process.source.fileNames = [
0043 'file:pickevents_merged.root'
0044 ]
0045
0046 process.source.inputCommands = cms.untracked.vstring( "keep *", "drop *_MEtoEDMConverter_*_*" )
0047 process.maxEvents.input = options.maxEvents
0048
0049
0050 if options.GlobalTag:
0051 process.GlobalTag.globaltag = options.GlobalTag
0052
0053
0054 if options.mcInfo == False: options.jetCorrections.append('L2L3Residual')
0055 options.jetCorrections.insert(0, 'L1FastJet')
0056
0057
0058 process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True))
0059 process.out.fileName = cms.untracked.string('skim.root')
0060
0061
0062 process.load("PhysicsTools.PatAlgos.patSequences_cff")
0063
0064
0065
0066
0067 from PhysicsTools.PatAlgos.tools.pfTools import *
0068
0069
0070 from PhysicsTools.SelectorUtils.pvSelector_cfi import pvSelector
0071 process.goodOfflinePrimaryVertices = cms.EDFilter(
0072 "PrimaryVertexObjectFilter",
0073 filterParams = pvSelector.clone( minNdof = cms.double(4.0), maxZ = cms.double(24.0) ),
0074 src=cms.InputTag('offlinePrimaryVertices')
0075 )
0076
0077 postfix = "PFlow"
0078 jetAlgo="AK5"
0079 print("====> Configuring usePF2PAT : using AK5PFchs ...")
0080 print("See https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookJetEnergyCorrections#JetEnCorPFnoPU")
0081 usePF2PAT(process, runPF2PAT=True, jetAlgo=jetAlgo, runOnMC=options.mcInfo, postfix=postfix, jetCorrections=('AK5PFchs', options.jetCorrections))
0082 getattr(process,"pfPileUp"+postfix).enable = True
0083 getattr(process,"pfPileUp"+postfix).Vertices = 'goodOfflinePrimaryVertices'
0084 getattr(process,"pfPileUp"+postfix).checkClosestZVertex = False
0085 getattr(process,"pfJets"+postfix).doAreaFastjet = True
0086 getattr(process,"pfJets"+postfix).doRhoFastjet = False
0087 getattr(process,"patJetCorrFactors"+postfix).rho = cms.InputTag("kt6PFJets", "rho")
0088
0089 process.load('RecoJets.JetProducers.kt4PFJets_cfi')
0090 process.kt6PFJets = process.kt4PFJets.clone( rParam = 0.6, doAreaFastjet = True, doRhoFastjet = True )
0091
0092
0093 getattr(process,"pfNoPileUp"+postfix).enable = True
0094 getattr(process,"pfNoMuon"+postfix).enable = True
0095 getattr(process,"pfNoElectron"+postfix).enable = True
0096 getattr(process,"pfNoTau"+postfix).enable = False
0097 getattr(process,"pfNoJet"+postfix).enable = True
0098
0099
0100
0101
0102 getattr(process,"patPF2PATSequence"+postfix).replace(
0103 getattr(process,"pfNoElectron"+postfix),
0104 getattr(process,"pfNoElectron"+postfix)*process.kt6PFJets )
0105
0106
0107 process.primaryVertexFilter = cms.EDFilter(
0108 "VertexSelector",
0109 src = cms.InputTag("offlinePrimaryVertices"),
0110 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
0111 filter = cms.bool(True)
0112 )
0113
0114
0115 process.noscraping = cms.EDFilter(
0116 "FilterOutScraping",
0117 applyfilter = cms.untracked.bool(True),
0118 debugOn = cms.untracked.bool(False),
0119 numtrack = cms.untracked.uint32(10),
0120 thresh = cms.untracked.double(0.25)
0121 )
0122
0123
0124 process.load('CommonTools/RecoAlgos/HBHENoiseFilter_cfi')
0125 process.HBHENoiseFilter.minIsolatedNoiseSumE = cms.double(999999.)
0126 process.HBHENoiseFilter.minNumIsolatedNoiseChannels = cms.int32(999999)
0127 process.HBHENoiseFilter.minIsolatedNoiseSumEt = cms.double(999999.)
0128
0129
0130
0131
0132
0133 process.load("RecoMET.METFilters.hcalLaserEventFilter_cfi")
0134 process.hcalLaserEventFilter.vetoByRunEventNumber=cms.untracked.bool(False)
0135 process.hcalLaserEventFilter.vetoByHBHEOccupancy=cms.untracked.bool(True)
0136
0137
0138 process.load('RecoMET.METFilters.EcalDeadCellTriggerPrimitiveFilter_cfi')
0139 process.EcalDeadCellTriggerPrimitiveFilter.debug = cms.bool(True)
0140
0141
0142 process.load('RecoMET.METFilters.EcalDeadCellBoundaryEnergyFilter_cfi')
0143
0144 process.load('RecoMET.METFilters.jetIDFailureFilter_cfi')
0145 process.jetIDFailure.MinJetPt = cms.double(30.0)
0146 process.jetIDFailure.MaxJetEta = cms.double(999.0)
0147
0148 process.goodVertices = cms.EDFilter(
0149 "VertexSelector",
0150 filter = cms.bool(False),
0151 src = cms.InputTag("offlinePrimaryVertices"),
0152 cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.rho < 2")
0153 )
0154
0155 process.load('RecoMET.METFilters.trackingFailureFilter_cfi')
0156 process.load('JetMETCorrections.Configuration.DefaultJEC_cff')
0157
0158
0159
0160 process.load('RecoMET.METFilters.inconsistentMuonPFCandidateFilter_cfi')
0161
0162 process.load('RecoMET.METFilters.greedyMuonPFCandidateFilter_cfi')
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179 process.load('RecoMET.METFilters.eeNoiseFilter_cfi')
0180
0181 process.load('RecoMET/METAnalyzers/CSCHaloFilter_cfi')
0182
0183 process.rejectRecov = cms.EDFilter(
0184 "RecovRecHitFilter",
0185 EERecHitSource = cms.InputTag("reducedEcalRecHitsEE"),
0186 MinRecovE = cms.double(30),
0187 TaggingMode=cms.bool(False)
0188 )
0189
0190 process.Vertex = cms.Path(process.goodOfflinePrimaryVertices*getattr(process,"patPF2PATSequence"+postfix)*~process.primaryVertexFilter)
0191 process.Scraping = cms.Path(~process.noscraping)
0192 process.HBHENoise = cms.Path(~process.HBHENoiseFilter)
0193 process.CSCTightHalo = cms.Path(~process.CSCTightHaloFilter)
0194 process.RecovRecHit = cms.Path(~process.rejectRecov)
0195
0196 process.HCALLaser = cms.Path(~process.hcalLaserEventFilter)
0197 process.ECALDeadCellTP = cms.Path(~process.EcalDeadCellTriggerPrimitiveFilter)
0198 process.ECALDeadCellBE = cms.Path(~process.EcalDeadCellBoundaryEnergyFilter)
0199 process.jetID = cms.Path(~process.jetIDFailure)
0200 process.trackingFailure = cms.Path(process.goodVertices*~process.trackingFailureFilter)
0201 process.inconsistentMuon = cms.Path(~process.inconsistentMuonPFCandidateFilter)
0202 process.greedyMuon = cms.Path(~process.greedyMuonPFCandidateFilter)
0203 process.eeNoise = cms.Path(~process.eeNoiseFilter)
0204
0205
0206 process.hltTriggerSummaryAOD = cms.EDProducer(
0207 "TriggerSummaryProducerAOD",
0208 processName = cms.string( "@" )
0209 )
0210
0211
0212 from PhysicsTools.PatAlgos.tools.trigTools import *
0213 switchOnTrigger(process)
0214
0215
0216 process.patTriggerFilter = process.patTrigger.clone()
0217 process.patTriggerFilter.processName = cms.string('PAT')
0218 process.MessageLogger.suppressWarning += ['patTriggerFilter']
0219
0220 process.outpath = cms.EndPath(
0221 process.patTrigger *
0222 process.hltTriggerSummaryAOD *
0223 process.patTriggerFilter *
0224 process.out
0225 )
0226
0227
0228 from PhysicsTools.PatAlgos.patEventContent_cff import *
0229 process.out.outputCommands = cms.untracked.vstring(
0230 'drop *',
0231 'keep patTriggerPaths_patTrigger*_*_*',
0232 )
0233 process.out.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('*', '!*'))
0234
0235