CMS 3D CMS Logo

customiseL1CustomReco.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 
4 from CondCore.CondDB.CondDB_cfi import *
6 from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry
8 
9 def L1NtupleCustomReco(process):
10 
11 
12 
13 
14  # load JEC from SQLite file
15  process.load("CondCore.CondDB.CondDB_cfi")
16 
17  # re-apply JEC for AK4 CHS PF jets
18  process.load('JetMETCorrections.Configuration.JetCorrectors_cff')
19 
20 
21 
22  # load hbhe noise filter result producer
23  process.load('CommonTools/RecoAlgos/HBHENoiseFilterResultProducer_cfi')
24 
25  # Type-1 pf MET correction
26  process.load("JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff")
27  process.load("JetMETCorrections.Type1MET.correctedMet_cff")
28 
29  # Bad PF Muon filter for MET & HT
30  process.load('RecoMET.METFilters.BadPFMuonFilter_cfi')
31  process.BadPFMuonFilter.muons = cms.InputTag("muons")
32  process.BadPFMuonFilter.PFCandidates = cms.InputTag("particleFlow")
33 
34  # bad charged candidate filter
35  process.load('RecoMET.METFilters.BadChargedCandidateFilter_cfi')
36  process.BadChargedCandidateFilter.muons = cms.InputTag("muons")
37  process.BadChargedCandidateFilter.PFCandidates = cms.InputTag("particleFlow")
38 
39 
40 
41 
42  # turn on VID producer, indicate data format to be
43  # DataFormat.AOD or DataFormat.MiniAOD, as appropriate
44  dataFormat = DataFormat.AOD
45  switchOnVIDElectronIdProducer(process, dataFormat)
46  process.load("RecoEgamma.ElectronIdentification.egmGsfElectronIDs_cfi")
47  process.egmGsfElectronIDSequence = cms.Sequence(process.egmGsfElectronIDs)
48  # define which IDs we want to produce
49  idmod = 'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Spring15_25ns_V1_cff'
50  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection)
51 
52 
53 
54 
55  process.l1CustomReco = cms.Path(
56  process.ak4PFCHSL1FastL2L3ResidualCorrectorChain
57  +process.ak4CaloL1FastL2L3ResidualCorrectorChain
58  +process.HBHENoiseFilterResultProducer
59  +process.correctionTermsPfMetType1Type2
60  +process.pfMetT1
61  +process.egmGsfElectronIDSequence
62  +process.BadPFMuonFilter
63  +process.BadChargedCandidateFilter
64  )
65 
66  process.schedule.append(process.l1CustomReco)
67 
68  return process
69 
70 
71 def getJECFromSQLite(process):
72 
73  process.load("CondCore.CondDB.CondDB_cfi")
74 
75  process.jec = cms.ESSource(
76  "PoolDBESSource",
77  DBParameters = cms.PSet(
78  messageLevel = cms.untracked.int32(0)
79  ),
80  timetype = cms.string('runnumber'),
81  toGet = cms.VPSet(
82  cms.PSet(
83  record = cms.string('JetCorrectionsRecord'),
84  # for data
85  tag = cms.string('JetCorrectorParametersCollection_Summer15_25nsV6_DATA_AK4PFchs'),
86  # for MC
87  #tag = cms.string('JetCorrectorParametersCollection_Fall15_25nsV2_MC_AK4PFchs'),
88  label = cms.untracked.string('AK4PFCHS')
89  ),
90  ),
91  connect = cms.string('sqlite:Summer15_25nsV6_DATA.db')
92  # uncomment above tag lines and this comment to use MC JEC
93  # connect = cms.string('sqlite:Fall15_25nsV2_MC.db')
94  )
95 
96  process.es_prefer_jec = cms.ESPrefer('PoolDBESSource','jec')
97 
98  return process
vid_id_tools.switchOnVIDElectronIdProducer
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
customiseL1CustomReco.L1NtupleCustomReco
def L1NtupleCustomReco(process)
Definition: customiseL1CustomReco.py:9
JetCorrectors_cff
customiseL1CustomReco.getJECFromSQLite
def getJECFromSQLite(process)
Definition: customiseL1CustomReco.py:71
vid_id_tools.setupAllVIDIdsInModule
def setupAllVIDIdsInModule(process, id_module_name, setupFunction, patProducer=None, addUserData=True, task=None)
Definition: vid_id_tools.py:49
vid_id_tools
CondDB_cfi