CMS 3D CMS Logo

Functions
miniAOD_tools Namespace Reference

Functions

def miniAOD_customizeAllData (process)
 
def miniAOD_customizeAllMC (process)
 
def miniAOD_customizeAllMCFastSim (process)
 
def miniAOD_customizeCommon (process)
 
def miniAOD_customizeData (process)
 
def miniAOD_customizeMC (process)
 
def miniAOD_customizeOutput (out)
 

Function Documentation

def miniAOD_tools.miniAOD_customizeAllData (   process)

Definition at line 559 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeData().

560  miniAOD_customizeCommon(process)
561  miniAOD_customizeData(process)
562  return process
563 
def miniAOD_customizeAllData(process)
def miniAOD_customizeData(process)
def miniAOD_customizeCommon(process)
Definition: miniAOD_tools.py:7
def miniAOD_tools.miniAOD_customizeAllMC (   process)

Definition at line 564 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeMC().

565  miniAOD_customizeCommon(process)
566  miniAOD_customizeMC(process)
567  return process
568 
def miniAOD_customizeCommon(process)
Definition: miniAOD_tools.py:7
def miniAOD_customizeAllMC(process)
def miniAOD_customizeMC(process)
def miniAOD_tools.miniAOD_customizeAllMCFastSim (   process)

Definition at line 569 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), isolatedTracks_cfi.miniAOD_customizeIsolatedTracksFastSim(), miniAOD_customizeMC(), and metFilterPaths_cff.miniAOD_customizeMETFiltersFastSim().

570  miniAOD_customizeCommon(process)
571  miniAOD_customizeMC(process)
572  from PhysicsTools.PatAlgos.slimming.metFilterPaths_cff import miniAOD_customizeMETFiltersFastSim
573  process = miniAOD_customizeMETFiltersFastSim(process)
574  from PhysicsTools.PatAlgos.slimming.isolatedTracks_cfi import miniAOD_customizeIsolatedTracksFastSim
575  process = miniAOD_customizeIsolatedTracksFastSim(process)
576  process.patMuons.addTriggerMatching = False
577 
578  return process
579 
def miniAOD_customizeCommon(process)
Definition: miniAOD_tools.py:7
def miniAOD_customizeMETFiltersFastSim(process)
def miniAOD_customizeAllMCFastSim(process)
def miniAOD_customizeIsolatedTracksFastSim(process)
def miniAOD_customizeMC(process)
def miniAOD_tools.miniAOD_customizeCommon (   process)

Definition at line 7 of file miniAOD_tools.py.

References boostedHPSPFTaus_cfi.addBoostedTaus(), helpers.addToProcessAndTask(), applyDeepBtagging_cff.applyDeepBtagging(), applySubstructure_cff.applySubstructure(), clone(), helpers.getPatAlgosToolsTask(), egmIsolationsPUPPI_cfi.makeInputForPUPPIIsolationEgm(), muonIsolationsPUPPI_cfi.makeInputForPUPPIIsolationMuon(), puppiForMET_cff.makePuppies(), egammaObjectModifications_tools.makeVIDBitsModifier(), runMETCorrectionsAndUncertainties.runMetCorAndUncForMiniAODProduction(), vid_id_tools.setupAllVIDIdsInModule(), trigTools.switchOnTriggerStandAlone, vid_id_tools.switchOnVIDElectronIdProducer(), and vid_id_tools.switchOnVIDPhotonIdProducer().

Referenced by miniAOD_customizeAllData(), miniAOD_customizeAllMC(), and miniAOD_customizeAllMCFastSim().

8  process.patMuons.isoDeposits = cms.PSet()
9  process.patElectrons.isoDeposits = cms.PSet()
10  process.patTaus.isoDeposits = cms.PSet()
11  process.patPhotons.isoDeposits = cms.PSet()
12  #
13  process.patMuons.embedTrack = True # used for IDs
14  process.patMuons.embedCombinedMuon = True # used for IDs
15  process.patMuons.embedMuonBestTrack = True # used for IDs
16  process.patMuons.embedStandAloneMuon = True # maybe?
17  process.patMuons.embedPickyMuon = False # no, use best track
18  process.patMuons.embedTpfmsMuon = False # no, use best track
19  process.patMuons.embedDytMuon = False # no, use best track
20  process.patMuons.addPuppiIsolation = cms.bool(True)
21  process.patMuons.puppiIsolationChargedHadrons = cms.InputTag("muonPUPPIIsolation","h+-DR040-ThresholdVeto000-ConeVeto000")
22  process.patMuons.puppiIsolationNeutralHadrons = cms.InputTag("muonPUPPIIsolation","h0-DR040-ThresholdVeto000-ConeVeto001")
23  process.patMuons.puppiIsolationPhotons = cms.InputTag("muonPUPPIIsolation","gamma-DR040-ThresholdVeto000-ConeVeto001")
24  process.patMuons.puppiNoLeptonsIsolationChargedHadrons = cms.InputTag("muonPUPPINoLeptonsIsolation","h+-DR040-ThresholdVeto000-ConeVeto000")
25  process.patMuons.puppiNoLeptonsIsolationNeutralHadrons = cms.InputTag("muonPUPPINoLeptonsIsolation","h0-DR040-ThresholdVeto000-ConeVeto001")
26  process.patMuons.puppiNoLeptonsIsolationPhotons = cms.InputTag("muonPUPPINoLeptonsIsolation","gamma-DR040-ThresholdVeto000-ConeVeto001")
27 
28  process.patMuons.computeMiniIso = True
29  process.patMuons.computeMuonMVA = True
30  process.patMuons.computeSoftMuonMVA = True
31 
32  process.patMuons.addTriggerMatching = True
33  from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016
34  from Configuration.Eras.Modifier_run2_muon_2017_cff import run2_muon_2017
35  from Configuration.Eras.Modifier_run2_muon_2018_cff import run2_muon_2018
36  run2_muon_2016.toModify( process.patMuons, effectiveAreaVec = [0.0735,0.0619,0.0465,0.0433,0.0577])
37  run2_muon_2017.toModify( process.patMuons, effectiveAreaVec = [0.0566, 0.0562, 0.0363, 0.0119, 0.0064])
38  run2_muon_2018.toModify( process.patMuons, effectiveAreaVec = [0.0566, 0.0562, 0.0363, 0.0119, 0.0064])
39  run2_muon_2016.toModify( process.patMuons, mvaTrainingFile = "RecoMuon/MuonIdentification/data/mu_2016_BDTG.weights.xml")
40 
41  process.patMuons.computePuppiCombinedIso = True
42  #
43  # disable embedding of electron and photon associated objects already stored by the ReducedEGProducer
44  process.patElectrons.embedGsfElectronCore = False ## process.patElectrons.embed in AOD externally stored gsf electron core
45  process.patElectrons.embedSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
46  process.patElectrons.embedPflowSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
47  process.patElectrons.embedSeedCluster = False ## process.patElectrons.embed in AOD externally stored the electron's seedcluster
48  process.patElectrons.embedBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's basic clusters
49  process.patElectrons.embedPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's preshower clusters
50  process.patElectrons.embedPflowBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow basic clusters
51  process.patElectrons.embedPflowPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow preshower clusters
52  process.patElectrons.embedRecHits = False ## process.patElectrons.embed in AOD externally stored the RecHits - can be called from the PATElectronProducer
53  process.patElectrons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
54  process.patElectrons.usePfCandidateMultiMap = True
55  process.patElectrons.pfCandidateMultiMap = cms.InputTag("reducedEgamma","reducedGsfElectronPfCandMap")
56  process.patElectrons.electronIDSources = cms.PSet()
57  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
58  run2_miniAOD_80XLegacy.toModify(process.patElectrons,
59  addPFClusterIso = cms.bool(True),
60  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"),
61  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso"))
62  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
63  run2_miniAOD_94XFall17.toModify(process.patElectrons,
64  addPFClusterIso = cms.bool(True),
65  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"),
66  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso"))
67 
68  #add puppi isolation in miniAOD
69  process.patElectrons.addPuppiIsolation = cms.bool(True)
70  process.patElectrons.puppiIsolationChargedHadrons = cms.InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001")
71  process.patElectrons.puppiIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPIIsolation","h0-DR030-BarVeto000-EndVeto000")
72  process.patElectrons.puppiIsolationPhotons = cms.InputTag("egmElectronPUPPIIsolation","gamma-DR030-BarVeto000-EndVeto008")
73  process.patElectrons.puppiNoLeptonsIsolationChargedHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h+-DR030-BarVeto000-EndVeto001")
74  process.patElectrons.puppiNoLeptonsIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h0-DR030-BarVeto000-EndVeto000")
75  process.patElectrons.puppiNoLeptonsIsolationPhotons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008")
76 
77  process.patElectrons.computeMiniIso = cms.bool(True)
78 
79  process.elPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
80  process.elPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
81  process.elPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
82  process.elPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
83  process.elPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
84  #
85  process.patPhotons.embedSuperCluster = False ## whether to process.patPhotons.embed in AOD externally stored supercluster
86  process.patPhotons.embedSeedCluster = False ## process.patPhotons.embed in AOD externally stored the photon's seedcluster
87  process.patPhotons.embedBasicClusters = False ## process.patPhotons.embed in AOD externally stored the photon's basic clusters
88  process.patPhotons.embedPreshowerClusters = False ## process.patPhotons.embed in AOD externally stored the photon's preshower clusters
89  process.patPhotons.embedRecHits = False ## process.patPhotons.embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer
90 
91  #add puppi isolation in miniAOD
92  process.patPhotons.addPuppiIsolation = cms.bool(True)
93  process.patPhotons.puppiIsolationChargedHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h+-DR030-")
94  process.patPhotons.puppiIsolationNeutralHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h0-DR030-")
95  process.patPhotons.puppiIsolationPhotons = cms.InputTag("egmPhotonPUPPIIsolation","gamma-DR030-")
96 
97  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
98  run2_miniAOD_80XLegacy.toModify(process.patPhotons,
99  addPFClusterIso = cms.bool(True),
100  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"),
101  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso"))
102  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
103  run2_miniAOD_94XFall17.toModify(process.patPhotons,
104  addPFClusterIso = cms.bool(True),
105  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"),
106  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso"))
107  #the 80X legacy customsations are done in ootPhotonProducer for OOT photons
108  run2_miniAOD_94XFall17.toModify(process.patOOTPhotons,
109  addPFClusterIso = cms.bool(True),
110  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoEcalPFClusIso"),
111  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoHcalPFClusIso"))
112 
113 
114  process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
115  process.patPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
116 
117  process.phPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
118  process.phPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
119  process.phPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
120  process.phPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
121  process.phPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
122  #
123  process.patOOTPhotons.photonSource = cms.InputTag("reducedEgamma","reducedOOTPhotons")
124  process.patOOTPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
125  #
126  process.selectedPatJets.cut = cms.string("pt > 10")
127  process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
128 
129  from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon
130  phase2_muon.toModify(process.selectedPatMuons, cut = "pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose') || muonID('ME0MuonArbitrated') || muonID('GEMMuonArbitrated')) )")
131 
132  process.selectedPatElectrons.cut = cms.string("")
133  process.selectedPatTaus.cut = cms.string("pt > 18. && tauID('decayModeFindingNewDMs')> 0.5")
134  process.selectedPatPhotons.cut = cms.string("")
135 
136  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
137 
138  from PhysicsTools.PatAlgos.slimming.applySubstructure_cff import applySubstructure
139  applySubstructure( process )
140 
141 
142  #
143  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
144  switchOnTriggerStandAlone( process, outputModule = '' )
145  process.patTrigger.packTriggerPathNames = cms.bool(True)
146  #
147  # apply type I + other PFMEt corrections to pat::MET object
148  # and estimate systematic uncertainties on MET
149 
150  from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncForMiniAODProduction
151  runMetCorAndUncForMiniAODProduction(process, metType="PF",
152  jetCollUnskimmed="patJets")
153 
154  #caloMET computation
155  from PhysicsTools.PatAlgos.tools.metTools import addMETCollection
156  addMETCollection(process,
157  labelName = "patCaloMet",
158  metSource = "caloMetM"
159  )
160 
161  #noHF pfMET =========
162 
163  task = getPatAlgosToolsTask(process)
164 
165  process.noHFCands = cms.EDFilter("GenericPFCandidateSelector",
166  src=cms.InputTag("particleFlow"),
167  cut=cms.string("abs(pdgId)!=1 && abs(pdgId)!=2 && abs(eta)<3.0")
168  )
169  task.add(process.noHFCands)
170 
172  pfCandColl=cms.InputTag("noHFCands"),
173  recoMetFromPFCs=True, #needed for HF removal
174  jetSelection="pt>15 && abs(eta)<3.",
175  postfix="NoHF"
176  )
177 
178  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
179  task.add(process.slimmedMETs)
180  addToProcessAndTask('slimmedMETsNoHF', process.slimmedMETs.clone(), process, task)
181  process.slimmedMETsNoHF.src = cms.InputTag("patMETsNoHF")
182  process.slimmedMETsNoHF.rawVariation = cms.InputTag("patPFMetNoHF")
183  process.slimmedMETsNoHF.t1Uncertainties = cms.InputTag("patPFMetT1%sNoHF")
184  process.slimmedMETsNoHF.t01Variation = cms.InputTag("patPFMetT0pcT1NoHF")
185  process.slimmedMETsNoHF.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sNoHF")
186  process.slimmedMETsNoHF.tXYUncForRaw = cms.InputTag("patPFMetTxyNoHF")
187  process.slimmedMETsNoHF.tXYUncForT1 = cms.InputTag("patPFMetT1TxyNoHF")
188  process.slimmedMETsNoHF.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyNoHF")
189  process.slimmedMETsNoHF.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyNoHF")
190  process.slimmedMETsNoHF.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyNoHF")
191  del process.slimmedMETsNoHF.caloMET
192  # ================== NoHF pfMET
193 
194  # ================== CHSMET
195  process.CHSCands = cms.EDFilter("CandPtrSelector",
196  src=cms.InputTag("packedPFCandidates"),
197  cut=cms.string("fromPV(0) > 0")
198  )
199  task.add(process.CHSCands)
200 
201  process.pfMetCHS = cms.EDProducer("PFMETProducer",
202  src = cms.InputTag("CHSCands"),
203  alias = cms.string('pfMet'),
204  globalThreshold = cms.double(0.0),
205  calculateSignificance = cms.bool(False),
206  )
207  task.add(process.pfMetCHS)
208 
209  addMETCollection(process,
210  labelName = "patCHSMet",
211  metSource = "pfMetCHS"
212  )
213 
214  process.patCHSMet.computeMETSignificance = cms.bool(False)
215 
216  # ================== CHSMET
217 
218  # ================== TrkMET
219  process.TrkCands = cms.EDFilter("CandPtrSelector",
220  src=cms.InputTag("packedPFCandidates"),
221  cut=cms.string("charge()!=0 && pvAssociationQuality()>=4 && vertexRef().key()==0")
222  )
223  task.add(process.TrkCands)
224 
225  process.pfMetTrk = cms.EDProducer("PFMETProducer",
226  src = cms.InputTag("TrkCands"),
227  alias = cms.string('pfMet'),
228  globalThreshold = cms.double(0.0),
229  calculateSignificance = cms.bool(False),
230  )
231 
232  task.add(process.pfMetTrk)
233 
234  addMETCollection(process,
235  labelName = "patTrkMet",
236  metSource = "pfMetTrk"
237  )
238 
239  process.patTrkMet.computeMETSignificance = cms.bool(False)
240 
241  # ================== TrkMET
242 
243 
244  ## PU JetID
245  process.load("RecoJets.JetProducers.PileupJetID_cfi")
246  task.add(process.pileUpJetIDTask)
247 
248  process.patJets.userData.userFloats.src = [ cms.InputTag("pileupJetId:fullDiscriminant"), ]
249  process.patJets.userData.userInts.src = [ cms.InputTag("pileupJetId:fullId"), ]
250 
251  ## Quark Gluon Likelihood
252  process.load('RecoJets.JetProducers.QGTagger_cfi')
253  task.add(process.QGTaggerTask)
254 
255  process.patJets.userData.userFloats.src += [ cms.InputTag('QGTagger:qgLikelihood'), ]
256 
257  ## DeepCSV meta discriminators (simple arithmethic on output probabilities)
258  process.load('RecoBTag.Combined.deepFlavour_cff')
259  task.add(process.pfDeepCSVDiscriminatorsJetTags)
260  process.patJets.discriminatorSources.extend([
261  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:BvsAll' ),
262  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsB' ),
263  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsL' ),
264  ])
265 
266  ## CaloJets
267  process.caloJetMap = cms.EDProducer("RecoJetDeltaRValueMapProducer",
268  src = process.patJets.jetSource,
269  matched = cms.InputTag("ak4CaloJets"),
270  distMax = cms.double(0.4),
271  values = cms.vstring('pt','emEnergyFraction'),
272  valueLabels = cms.vstring('pt','emEnergyFraction'),
273  lazyParser = cms.bool(True) )
274  task.add(process.caloJetMap)
275  process.patJets.userData.userFloats.src += [ cms.InputTag("caloJetMap:pt"), cms.InputTag("caloJetMap:emEnergyFraction") ]
276 
277  #Muon object modifications
278  from PhysicsTools.PatAlgos.slimming.muonIsolationsPUPPI_cfi import makeInputForPUPPIIsolationMuon
280 
281  #EGM object modifications
282  from PhysicsTools.PatAlgos.slimming.egmIsolationsPUPPI_cfi import makeInputForPUPPIIsolationEgm
284  from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import egamma_modifications
285  process.slimmedElectrons.modifierConfig.modifications = egamma_modifications
286  process.slimmedPhotons.modifierConfig.modifications = egamma_modifications
287 
288  #VID Electron IDs
289  process.patElectrons.addElectronID = cms.bool(True)
290  electron_ids = ['RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
291  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV71_cff',
292  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
293  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
294  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
295  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
296  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
297  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff',
298  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Summer16_80X_V1_cff',
299  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff',
300  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff',
301  ]
302  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD, task)
303  process.egmGsfElectronIDs.physicsObjectSrc = \
304  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
305  process.electronMVAValueMapProducer.src = \
306  cms.InputTag('reducedEgamma','reducedGedGsfElectrons')
307  for idmod in electron_ids:
308  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection,None,False,task)
309 
310  #VID Photon IDs
311  process.patPhotons.addPhotonID = cms.bool(True)
312  photon_ids = ['RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff',
313  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V2_cff',
314  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff',
315  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V2_cff',
316  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff',
317  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff']
318  switchOnVIDPhotonIdProducer(process,DataFormat.AOD, task)
319  process.egmPhotonIDs.physicsObjectSrc = \
320  cms.InputTag("reducedEgamma","reducedGedPhotons")
321  process.photonMVAValueMapProducer.src = \
322  cms.InputTag('reducedEgamma','reducedGedPhotons')
323  for idmod in photon_ids:
324  setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection,None,False,task)
325 
326  #add the cut base IDs bitmaps of which cuts passed
327  from RecoEgamma.EgammaTools.egammaObjectModifications_tools import makeVIDBitsModifier
328  egamma_modifications.append(makeVIDBitsModifier(process,"egmGsfElectronIDs","egmPhotonIDs"))
329 
330  #-- Adding boosted taus
331  from RecoTauTag.Configuration.boostedHPSPFTaus_cfi import addBoostedTaus
332  addBoostedTaus(process)
333  process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
334  process.load("RecoTauTag.Configuration.HPSPFTaus_cff")
335  #-- Adding customization for 94X 2017 legacy reMniAOD
336  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
337  _makePatTausTaskWithRetrainedMVATauID = process.makePatTausTask.copy()
338  _makePatTausTaskWithRetrainedMVATauID.add(process.hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTTask,
339  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLTTask,
340  process.hpsPFTauIsolationSums03Task,
341  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLTTask)
342  run2_miniAOD_94XFall17.toReplaceWith(
343  process.makePatTausTask, _makePatTausTaskWithRetrainedMVATauID
344  )
345  #-- Adding DeepTauID
346  # deepTau v2
347  _updatedTauName = 'slimmedTausDeepIDsv2'
348  _noUpdatedTauName = 'slimmedTausNoDeepIDs'
349  import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
350  tauIdEmbedder = tauIdConfig.TauIDEmbedder(
351  process, cms, debug = False,
352  updatedTauName = _updatedTauName,
353  toKeep = ['deepTau2017v2']
354  )
355  tauIdEmbedder.runTauID()
356  addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task)
357  delattr(process, 'slimmedTaus')
358  process.deepTau2017v2.taus = _noUpdatedTauName
359  process.slimmedTaus = getattr(process, _updatedTauName).clone(
360  src = _noUpdatedTauName
361  )
362  process.deepTauIDTask = cms.Task(process.deepTau2017v2, process.slimmedTaus)
363  task.add(process.deepTauIDTask)
364 
365  # deepTau v2p1
366  _updatedTauNameNew = 'slimmedTausDeepIDsv2p1'
367  tauIdEmbedderNew = tauIdConfig.TauIDEmbedder(
368  process, cms, debug = False,
369  updatedTauName = _updatedTauNameNew,
370  toKeep = ['deepTau2017v2p1']
371  )
372  tauIdEmbedderNew.runTauID()
373  process.deepTau2017v2p1.taus = _noUpdatedTauName
374  deepTauIDTaskNew_ = cms.Task(process.deepTau2017v2p1,process.slimmedTaus)
375 
376  from Configuration.Eras.Modifier_run2_miniAOD_devel_cff import run2_miniAOD_devel
377  from Configuration.Eras.Modifier_run2_tau_ul_2016_cff import run2_tau_ul_2016
378  from Configuration.Eras.Modifier_run2_tau_ul_2018_cff import run2_tau_ul_2018
379  for era in [run2_miniAOD_devel,run2_tau_ul_2016,run2_tau_ul_2018]:
380  era.toReplaceWith(process.slimmedTaus,
381  getattr(process, _updatedTauNameNew).clone(src = _noUpdatedTauName))
382  era.toReplaceWith(process.deepTauIDTask,
383  deepTauIDTaskNew_)
384 
385  #-- Adding customization for 80X 2016 legacy reMiniAOD and 2018 heavy ions
386  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
387  from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
388  _makePatTausTaskWithTauReReco = process.makePatTausTask.copy()
389  _makePatTausTaskWithTauReReco.add(process.PFTauTask)
390  (run2_miniAOD_80XLegacy | pp_on_AA_2018).toReplaceWith(
391  process.makePatTausTask, _makePatTausTaskWithTauReReco
392  )
393 
394  # Adding puppi jets
395  if not hasattr(process, 'ak4PFJetsPuppi'): #MM: avoid confilct with substructure call
396  process.load('RecoJets.JetProducers.ak4PFJetsPuppi_cfi')
397  task.add(process.ak4PFJets)
398  task.add(process.ak4PFJetsPuppi)
399  process.ak4PFJetsPuppi.doAreaFastjet = True # even for standard ak4PFJets this is overwritten in RecoJets/Configuration/python/RecoPFJets_cff
400  from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import j2tParametersVX
401  process.ak4PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
402  j2tParametersVX,
403  jets = cms.InputTag("ak4PFJetsPuppi")
404  )
405  task.add(process.ak4PFJetsPuppiTracksAssociatorAtVertex)
406  process.patJetPuppiCharge = cms.EDProducer("JetChargeProducer",
407  src = cms.InputTag("ak4PFJetsPuppiTracksAssociatorAtVertex"),
408  var = cms.string('Pt'),
409  exp = cms.double(1.0)
410  )
411  task.add(process.patJetPuppiCharge)
412 
413  noDeepFlavourDiscriminators = [x.value() for x in process.patJets.discriminatorSources if not "DeepFlavour" in x.value()]
414  addJetCollection(process, postfix = "", labelName = 'Puppi', jetSource = cms.InputTag('ak4PFJetsPuppi'),
415  jetCorrections = ('AK4PFPuppi', ['L2Relative', 'L3Absolute'], ''),
416  pfCandidates = cms.InputTag("particleFlow"),
417  algo= 'AK', rParam = 0.4, btagDiscriminators = noDeepFlavourDiscriminators
418  )
419 
420  process.patJetGenJetMatchPuppi.matched = 'slimmedGenJets'
421 
422  process.patJetsPuppi.jetChargeSource = cms.InputTag("patJetPuppiCharge")
423 
424  process.selectedPatJetsPuppi.cut = cms.string("pt > 15")
425 
426  from PhysicsTools.PatAlgos.slimming.applyDeepBtagging_cff import applyDeepBtagging
427  applyDeepBtagging( process )
428 
429  addToProcessAndTask('slimmedJetsPuppiNoMultiplicities', process.slimmedJetsNoDeepFlavour.clone(), process, task)
430  process.slimmedJetsPuppiNoMultiplicities.src = cms.InputTag("selectedPatJetsPuppi")
431  process.slimmedJetsPuppiNoMultiplicities.packedPFCandidates = cms.InputTag("packedPFCandidates")
432 
433  from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer
434  from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
435  process.patPuppiJetSpecificProducer = patPuppiJetSpecificProducer.clone(
436  src=cms.InputTag("slimmedJetsPuppiNoMultiplicities"),
437  )
438  task.add(process.patPuppiJetSpecificProducer)
439  updateJetCollection(
440  process,
441  labelName = 'PuppiJetSpecific',
442  jetSource = cms.InputTag('slimmedJetsPuppiNoMultiplicities'),
443  )
444  process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ]
445  process.slimmedJetsPuppi = process.selectedUpdatedPatJetsPuppiJetSpecific.clone()
446  delattr(process, 'selectedUpdatedPatJetsPuppiJetSpecific')
447 
448  task.add(process.slimmedJetsPuppi)
449 
450  ## puppi met
451  from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppies
452  makePuppies( process );
453 
454  runMetCorAndUncForMiniAODProduction(process, metType="Puppi",
455  pfCandColl=cms.InputTag("puppiForMET"),
456  jetCollUnskimmed="slimmedJetsPuppi",
457  recoMetFromPFCs=True,
458  jetFlavor="AK4PFPuppi",
459  postfix="Puppi"
460  )
461 
462  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
463  task.add(process.slimmedMETs)
464  addToProcessAndTask('slimmedMETsPuppi', process.slimmedMETs.clone(), process, task)
465  process.slimmedMETsPuppi.src = cms.InputTag("patMETsPuppi")
466  process.slimmedMETsPuppi.rawVariation = cms.InputTag("patPFMetPuppi")
467  process.slimmedMETsPuppi.t1Uncertainties = cms.InputTag("patPFMetT1%sPuppi")
468  process.slimmedMETsPuppi.t01Variation = cms.InputTag("patPFMetT0pcT1Puppi")
469  process.slimmedMETsPuppi.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sPuppi")
470  process.slimmedMETsPuppi.tXYUncForRaw = cms.InputTag("patPFMetTxyPuppi")
471  process.slimmedMETsPuppi.tXYUncForT1 = cms.InputTag("patPFMetT1TxyPuppi")
472  process.slimmedMETsPuppi.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyPuppi")
473  process.slimmedMETsPuppi.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyPuppi")
474  process.slimmedMETsPuppi.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyPuppi")
475  del process.slimmedMETsPuppi.caloMET
476 
477  # add DetIdAssociatorRecords to EventSetup (for isolatedTracks)
478  process.load("TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff")
479 
480  # EGamma objects from HGCal are not yet in GED
481  # so add companion collections for Phase-II MiniAOD production
482  from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
483  process.load("RecoEgamma.EgammaTools.slimmedEgammaFromMultiCl_cff")
484  phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaFromMultiClTask))
485 
486  # L1 pre-firing weights for 2016 and 2017
487  from Configuration.Eras.Modifier_run2_L1prefiring_cff import run2_L1prefiring
488  from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger
489  from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
490  process.load("PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff")
491  stage1L1Trigger.toModify(process.prefiringweight, DataEra = "2016BtoH")
492  stage2L1Trigger_2017.toModify(process.prefiringweight, DataEra = "2017BtoF")
493  run2_L1prefiring.toModify(task, func=lambda t: t.add(process.prefiringweight))
494 
def makeInputForPUPPIIsolationMuon(process)
def miniAOD_customizeCommon(process)
Definition: miniAOD_tools.py:7
def applySubstructure(process, postfix="")
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
def makeInputForPUPPIIsolationEgm(process)
def setupAllVIDIdsInModule(process, id_module_name, setupFunction, patProducer=None, addUserData=True, task=None)
Definition: vid_id_tools.py:49
def runMetCorAndUncForMiniAODProduction(process, metType="PF", jetCollUnskimmed="patJets", photonColl="selectedPatPhotons", electronColl="selectedPatElectrons", muonColl="selectedPatMuons", tauColl="selectedPatTaus", pfCandColl="particleFlow", jetCleaning="LepClean", jetSelection="pt>15 && abs(eta)<9.9", jecUnFile="", jetFlavor="AK4PFchs", recoMetFromPFCs=False, postfix="")
def makePuppies(process)
def applyDeepBtagging(process, postfix="")
switchOnTriggerStandAlone
Definition: trigTools.py:283
def makeVIDBitsModifier(process, eleVIDModuleName, phoVIDModuleName)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def switchOnVIDPhotonIdProducer(process, dataFormat, task=None)
Photons.
def miniAOD_tools.miniAOD_customizeData (   process)

Definition at line 548 of file miniAOD_tools.py.

References helpers.getPatAlgosToolsTask().

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll(), and miniAOD_customizeAllData().

549  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
550  runOnData( process, outputModules = [] )
551  process.load("RecoCTPPS.TotemRPLocal.ctppsLocalTrackLiteProducer_cff")
552  process.load("RecoCTPPS.ProtonReconstruction.ctppsProtons_cff")
553  process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi")
554  task = getPatAlgosToolsTask(process)
555  from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016
556  ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsLocalTrackLiteProducer))
557  ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsProtons))
558 
def miniAOD_customizeData(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def miniAOD_tools.miniAOD_customizeMC (   process)

Definition at line 495 of file miniAOD_tools.py.

References helpers.getPatAlgosToolsTask().

Referenced by miniAOD_customizeAllMC(), and miniAOD_customizeAllMCFastSim().

495 def miniAOD_customizeMC(process):
496  task = getPatAlgosToolsTask(process)
497  #GenJetFlavourInfos
498  process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")
499  task.add(process.selectedHadronsAndPartons)
500  task.add(process.selectedHadronsAndPartonsForGenJetsFlavourInfos)
501 
502  process.load("PhysicsTools.JetMCAlgos.AK4GenJetFlavourInfos_cfi")
503  task.add(process.ak4GenJetFlavourInfos)
504 
505  process.load('PhysicsTools.PatAlgos.slimming.slimmedGenJetsFlavourInfos_cfi')
506  task.add(process.slimmedGenJetsFlavourInfos)
507 
508  #slimmed pileup information
509  process.load('PhysicsTools.PatAlgos.slimming.slimmedAddPileupInfo_cfi')
510  task.add(process.slimmedAddPileupInfo)
511 
512  process.muonMatch.matched = "prunedGenParticles"
513  process.electronMatch.matched = "prunedGenParticles"
514  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
515  process.photonMatch.matched = "prunedGenParticles"
516  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
517  process.ootPhotonMatch.matched = "prunedGenParticles"
518  process.ootPhotonMatch.src = cms.InputTag("reducedEgamma","reducedOOTPhotons")
519  process.tauMatch.matched = "prunedGenParticles"
520  process.tauGenJets.GenParticles = "prunedGenParticles"
521  #Boosted taus
522  process.tauMatchBoosted.matched = "prunedGenParticles"
523  process.tauGenJetsBoosted.GenParticles = "prunedGenParticles"
524  process.patJetPartons.particles = "genParticles"
525  process.patJetPartonMatch.matched = "prunedGenParticles"
526  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
527  process.patJetGenJetMatch.matched = "slimmedGenJets"
528  process.patJetGenJetMatchAK8.matched = "slimmedGenJetsAK8"
529  process.patMuons.embedGenMatch = False
530  process.patElectrons.embedGenMatch = False
531  process.patPhotons.embedGenMatch = False
532  process.patOOTPhotons.embedGenMatch = False
533  process.patTaus.embedGenMatch = False
534  process.patTausBoosted.embedGenMatch = False
535  process.patJets.embedGenPartonMatch = False
536  #also jet flavour must be switched
537  process.patJetFlavourAssociation.rParam = 0.4
538 
def miniAOD_customizeMC(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def miniAOD_tools.miniAOD_customizeOutput (   out)

Definition at line 539 of file miniAOD_tools.py.

Referenced by ConfigBuilder.ConfigBuilder.addOutput().

540  from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel
541  out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel
542  out.splitLevel = cms.untracked.int32(0)
543  out.dropMetaData = cms.untracked.string('ALL')
544  out.fastCloning= cms.untracked.bool(False)
545  out.overrideInputFileSplitLevels = cms.untracked.bool(True)
546  out.compressionAlgorithm = cms.untracked.string('LZMA')
547 
def miniAOD_customizeOutput(out)