File indexing completed on 2024-04-06 12:21:14
0001 import FWCore.ParameterSet.Config as cms
0002
0003
0004 from CondCore.CondDB.CondDB_cfi import *
0005 from PhysicsTools.SelectorUtils.tools.vid_id_tools import *
0006 from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry
0007 from JetMETCorrections.Configuration.JetCorrectors_cff import *
0008 from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
0009
0010 def L1NtupleCustomReco(process):
0011
0012
0013
0014
0015
0016 process.load("CondCore.CondDB.CondDB_cfi")
0017
0018
0019 process.load('JetMETCorrections.Configuration.JetCorrectors_cff')
0020
0021 process.load('L1Trigger.L1TNtuples.l1JetRecoTree_cfi')
0022
0023 addJetCollection(
0024 process,
0025 labelName = "CorrectedPuppiJets",
0026 jetSource = process.l1JetRecoTree.puppiJetToken,
0027 jetCorrections = ('AK4PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'], 'None'),
0028 pfCandidates = cms.InputTag("particleFlow"),
0029 algo= 'AK', rParam = 0.4,
0030 getJetMCFlavour=False
0031 )
0032 delattr(process, 'patJetGenJetMatchCorrectedPuppiJets')
0033 delattr(process, 'patJetPartonMatchCorrectedPuppiJets')
0034
0035
0036
0037
0038
0039
0040 process.load('CommonTools/RecoAlgos/HBHENoiseFilterResultProducer_cfi')
0041
0042
0043 process.load("JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff")
0044 process.load("JetMETCorrections.Type1MET.correctedMet_cff")
0045
0046
0047 process.load('RecoMET.METFilters.BadPFMuonFilter_cfi')
0048 process.BadPFMuonFilter.muons = cms.InputTag("muons")
0049 process.BadPFMuonFilter.PFCandidates = cms.InputTag("particleFlow")
0050
0051
0052 process.load('RecoMET.METFilters.BadChargedCandidateFilter_cfi')
0053 process.BadChargedCandidateFilter.muons = cms.InputTag("muons")
0054 process.BadChargedCandidateFilter.PFCandidates = cms.InputTag("particleFlow")
0055
0056
0057
0058
0059
0060
0061 dataFormat = DataFormat.AOD
0062 switchOnVIDElectronIdProducer(process, dataFormat)
0063 process.load("RecoEgamma.ElectronIdentification.egmGsfElectronIDs_cfi")
0064 process.egmGsfElectronIDSequence = cms.Sequence(process.egmGsfElectronIDs)
0065
0066 idmod = 'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Spring15_25ns_V1_cff'
0067 setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection)
0068
0069 switchOnVIDPhotonIdProducer(process, dataFormat)
0070 process.load("RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi")
0071 process.load("RecoEgamma.PhotonIdentification.PhotonMVAValueMapProducer_cfi")
0072 process.egmPhotonIDs.physicsObjectSrc = cms.InputTag("photons")
0073 process.photonMVAValueMapProducer.src = cms.InputTag("photons")
0074 process.egmPhotonIDSequence = cms.Sequence(process.photonMVAValueMapProducer*process.egmPhotonIDs)
0075 idmod_photon = 'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Winter22_122X_V1_cff'
0076 setupAllVIDIdsInModule(process,idmod_photon,setupVIDPhotonSelection)
0077
0078 process.l1CustomReco = cms.Path(
0079 process.ak4PFCHSL1FastL2L3ResidualCorrectorChain
0080 +process.ak4CaloL1FastL2L3ResidualCorrectorChain
0081 +process.HBHENoiseFilterResultProducer
0082 +process.correctionTermsPfMetType1Type2
0083 +process.pfMetT1
0084 +process.egmGsfElectronIDSequence
0085 +process.egmPhotonIDSequence
0086 +process.BadPFMuonFilter
0087 +process.BadChargedCandidateFilter
0088 )
0089
0090 process.schedule.append(process.l1CustomReco)
0091
0092 return process
0093
0094
0095 def getJECFromSQLite(process):
0096
0097 process.load("CondCore.CondDB.CondDB_cfi")
0098
0099 process.jec = cms.ESSource(
0100 "PoolDBESSource",
0101 DBParameters = cms.PSet(
0102 messageLevel = cms.untracked.int32(0)
0103 ),
0104 timetype = cms.string('runnumber'),
0105 toGet = cms.VPSet(
0106 cms.PSet(
0107 record = cms.string('JetCorrectionsRecord'),
0108
0109 tag = cms.string('JetCorrectorParametersCollection_Summer15_25nsV6_DATA_AK4PFchs'),
0110
0111
0112 label = cms.untracked.string('AK4PFCHS')
0113 ),
0114 ),
0115 connect = cms.string('sqlite:Summer15_25nsV6_DATA.db')
0116
0117
0118 )
0119
0120 process.es_prefer_jec = cms.ESPrefer('PoolDBESSource','jec')
0121
0122 return process