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

◆ miniAOD_customizeAllData()

def miniAOD_tools.miniAOD_customizeAllData (   process)

Definition at line 547 of file miniAOD_tools.py.

547 def miniAOD_customizeAllData(process):
548  miniAOD_customizeCommon(process)
549  miniAOD_customizeData(process)
550  return process
551 

References miniAOD_customizeCommon(), and miniAOD_customizeData().

◆ miniAOD_customizeAllMC()

def miniAOD_tools.miniAOD_customizeAllMC (   process)

Definition at line 552 of file miniAOD_tools.py.

552 def miniAOD_customizeAllMC(process):
553  miniAOD_customizeCommon(process)
554  miniAOD_customizeMC(process)
555  return process
556 

References miniAOD_customizeCommon(), and miniAOD_customizeMC().

◆ miniAOD_customizeAllMCFastSim()

def miniAOD_tools.miniAOD_customizeAllMCFastSim (   process)

Definition at line 557 of file miniAOD_tools.py.

557 def miniAOD_customizeAllMCFastSim(process):
558  miniAOD_customizeCommon(process)
559  miniAOD_customizeMC(process)
560  from PhysicsTools.PatAlgos.slimming.metFilterPaths_cff import miniAOD_customizeMETFiltersFastSim
561  process = miniAOD_customizeMETFiltersFastSim(process)
562  from PhysicsTools.PatAlgos.slimming.isolatedTracks_cfi import miniAOD_customizeIsolatedTracksFastSim
563  process = miniAOD_customizeIsolatedTracksFastSim(process)
564  process.patMuons.addTriggerMatching = False
565  # Disable pixelClusterTagInfos in FastSim (no siPixelCluster available)
566  from Configuration.Eras.Modifier_fastSim_cff import fastSim
567  fastSim.toModify(process.patJets, addTagInfos = cms.bool(False) )
568  fastSim.toModify(process.slimmedJetsNoDeepFlavour, dropTagInfos = cms.string('1') )
569  fastSim.toModify(process.updatedPatJetsSlimmedDeepFlavour, addTagInfos = cms.bool(False) )
570  fastSim.toModify(process.updatedPatJetsTransientCorrectedSlimmedDeepFlavour, addTagInfos = cms.bool(False) )
571 
572  return process

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

◆ miniAOD_customizeCommon()

def miniAOD_tools.miniAOD_customizeCommon (   process)

Definition at line 7 of file miniAOD_tools.py.

7 def miniAOD_customizeCommon(process):
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
45  process.patElectrons.embedSuperCluster = False
46  process.patElectrons.embedPflowSuperCluster = False
47  process.patElectrons.embedSeedCluster = False
48  process.patElectrons.embedBasicClusters = False
49  process.patElectrons.embedPreshowerClusters = False
50  process.patElectrons.embedPflowBasicClusters = False
51  process.patElectrons.embedPflowPreshowerClusters = False
52  process.patElectrons.embedRecHits = False
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 
58  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
59  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
60  (run2_miniAOD_80XLegacy | run2_miniAOD_94XFall17).toModify(process.patElectrons,
61  addPFClusterIso = True,
62  ecalPFClusterIsoMap = "reducedEgamma:eleEcalPFClusIso",
63  hcalPFClusterIsoMap = "reducedEgamma:eleHcalPFClusIso")
64 
65  #add puppi isolation in miniAOD
66  process.patElectrons.addPuppiIsolation = cms.bool(True)
67  process.patElectrons.puppiIsolationChargedHadrons = cms.InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001")
68  process.patElectrons.puppiIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPIIsolation","h0-DR030-BarVeto000-EndVeto000")
69  process.patElectrons.puppiIsolationPhotons = cms.InputTag("egmElectronPUPPIIsolation","gamma-DR030-BarVeto000-EndVeto008")
70  process.patElectrons.puppiNoLeptonsIsolationChargedHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h+-DR030-BarVeto000-EndVeto001")
71  process.patElectrons.puppiNoLeptonsIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h0-DR030-BarVeto000-EndVeto000")
72  process.patElectrons.puppiNoLeptonsIsolationPhotons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008")
73 
74  process.patElectrons.computeMiniIso = cms.bool(True)
75 
76  process.elPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
77  process.elPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
78  process.elPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
79  process.elPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
80  process.elPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
81  #
82  process.patPhotons.embedSuperCluster = False
83  process.patPhotons.embedSeedCluster = False
84  process.patPhotons.embedBasicClusters = False
85  process.patPhotons.embedPreshowerClusters = False
86  process.patPhotons.embedRecHits = False
87 
88  #add puppi isolation in miniAOD
89  process.patPhotons.addPuppiIsolation = cms.bool(True)
90  process.patPhotons.puppiIsolationChargedHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h+-DR030-")
91  process.patPhotons.puppiIsolationNeutralHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h0-DR030-")
92  process.patPhotons.puppiIsolationPhotons = cms.InputTag("egmPhotonPUPPIIsolation","gamma-DR030-")
93 
94  (run2_miniAOD_80XLegacy | run2_miniAOD_94XFall17).toModify(process.patPhotons,
95  addPFClusterIso = True,
96  ecalPFClusterIsoMap = "reducedEgamma:phoEcalPFClusIso",
97  hcalPFClusterIsoMap = "reducedEgamma:phoHcalPFClusIso")
98  #the 80X legacy customsations are done in ootPhotonProducer for OOT photons
99  run2_miniAOD_94XFall17.toModify(process.patOOTPhotons,
100  addPFClusterIso = True,
101  ecalPFClusterIsoMap = "reducedEgamma:ootPhoEcalPFClusIso",
102  hcalPFClusterIsoMap = "reducedEgamma:ootPhoHcalPFClusIso")
103 
104 
105  process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
106  process.patPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
107 
108  process.phPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
109  process.phPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
110  process.phPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
111  process.phPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
112  process.phPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
113  #
114  process.patOOTPhotons.photonSource = cms.InputTag("reducedEgamma","reducedOOTPhotons")
115  process.patOOTPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
116  #
117  process.selectedPatJets.cut = cms.string("pt > 10")
118  process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
119 
120  from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon
121  phase2_muon.toModify(process.selectedPatMuons, cut = "pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose') || muonID('ME0MuonArbitrated') || muonID('GEMMuonArbitrated')) )")
122 
123  process.selectedPatElectrons.cut = cms.string("")
124  process.selectedPatTaus.cut = cms.string("pt > 18. && tauID('decayModeFindingNewDMs')> 0.5")
125  process.selectedPatPhotons.cut = cms.string("")
126 
127  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
128 
129  from PhysicsTools.PatAlgos.slimming.applySubstructure_cff import applySubstructure
130  applySubstructure( process )
131 
132 
133  #
134  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
135  switchOnTriggerStandAlone( process, outputModule = '' )
136  process.patTrigger.packTriggerPathNames = cms.bool(True)
137  #
138  # apply type I + other PFMEt corrections to pat::MET object
139  # and estimate systematic uncertainties on MET
140 
141  from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncForMiniAODProduction
142  runMetCorAndUncForMiniAODProduction(process, metType="PF",
143  jetCollUnskimmed="patJets")
144 
145  #caloMET computation
146  from PhysicsTools.PatAlgos.tools.metTools import addMETCollection
147  addMETCollection(process,
148  labelName = "patCaloMet",
149  metSource = "caloMetM"
150  )
151 
152  #noHF pfMET =========
153 
154  task = getPatAlgosToolsTask(process)
155 
156  process.noHFCands = cms.EDFilter("GenericPFCandidateSelector",
157  src=cms.InputTag("particleFlow"),
158  cut=cms.string("abs(pdgId)!=1 && abs(pdgId)!=2 && abs(eta)<3.0")
159  )
160  task.add(process.noHFCands)
161 
163  pfCandColl=cms.InputTag("noHFCands"),
164  recoMetFromPFCs=True, #needed for HF removal
165  jetSelection="pt>15 && abs(eta)<3.",
166  postfix="NoHF"
167  )
168 
169  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
170  task.add(process.slimmedMETs)
171  process.slimmedMETs.addDeepMETs = True
172 
173  addToProcessAndTask('slimmedMETsNoHF', process.slimmedMETs.clone(), process, task)
174  process.slimmedMETsNoHF.src = cms.InputTag("patMETsNoHF")
175  process.slimmedMETsNoHF.rawVariation = cms.InputTag("patPFMetNoHF")
176  process.slimmedMETsNoHF.t1Uncertainties = cms.InputTag("patPFMetT1%sNoHF")
177  process.slimmedMETsNoHF.t01Variation = cms.InputTag("patPFMetT0pcT1NoHF")
178  process.slimmedMETsNoHF.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sNoHF")
179  process.slimmedMETsNoHF.tXYUncForRaw = cms.InputTag("patPFMetTxyNoHF")
180  process.slimmedMETsNoHF.tXYUncForT1 = cms.InputTag("patPFMetT1TxyNoHF")
181  process.slimmedMETsNoHF.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyNoHF")
182  process.slimmedMETsNoHF.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyNoHF")
183  process.slimmedMETsNoHF.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyNoHF")
184  del process.slimmedMETsNoHF.caloMET
185  # ================== NoHF pfMET
186 
187  # ================== CHSMET
188  process.CHSCands = cms.EDFilter("CandPtrSelector",
189  src=cms.InputTag("packedPFCandidates"),
190  cut=cms.string("fromPV(0) > 0")
191  )
192  task.add(process.CHSCands)
193 
194  from RecoMET.METProducers.pfMet_cfi import pfMet
195  process.pfMetCHS = pfMet.clone(src = 'CHSCands')
196  task.add(process.pfMetCHS)
197 
198  addMETCollection(process,
199  labelName = "patCHSMet",
200  metSource = "pfMetCHS"
201  )
202 
203  process.patCHSMet.computeMETSignificance = cms.bool(False)
204 
205  # ================== CHSMET
206 
207  # ================== TrkMET
208  process.TrkCands = cms.EDFilter("CandPtrSelector",
209  src=cms.InputTag("packedPFCandidates"),
210  cut=cms.string("charge()!=0 && pvAssociationQuality()>=4 && vertexRef().key()==0")
211  )
212  task.add(process.TrkCands)
213 
214  process.pfMetTrk = pfMet.clone(src = 'TrkCands')
215  task.add(process.pfMetTrk)
216 
217  addMETCollection(process,
218  labelName = "patTrkMet",
219  metSource = "pfMetTrk"
220  )
221 
222  process.patTrkMet.computeMETSignificance = cms.bool(False)
223 
224  # ================== TrkMET
225 
226 
227 
228  process.load("RecoJets.JetProducers.PileupJetID_cfi")
229  task.add(process.pileUpJetIDTask)
230 
231  process.patJets.userData.userFloats.src = [ cms.InputTag("pileupJetId:fullDiscriminant"), ]
232  process.patJets.userData.userInts.src = [ cms.InputTag("pileupJetId:fullId"), ]
233 
234 
235  process.load('RecoJets.JetProducers.QGTagger_cfi')
236  task.add(process.QGTaggerTask)
237 
238  process.patJets.userData.userFloats.src += [ cms.InputTag('QGTagger:qgLikelihood'), ]
239 
240 
241  process.load('RecoBTag.Combined.deepFlavour_cff')
242  task.add(process.pfDeepCSVDiscriminatorsJetTags)
243  process.patJets.discriminatorSources.extend([
244  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:BvsAll' ),
245  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsB' ),
246  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsL' ),
247  ])
248 
249 
250  process.caloJetMap = cms.EDProducer("RecoJetDeltaRValueMapProducer",
251  src = process.patJets.jetSource,
252  matched = cms.InputTag("ak4CaloJets"),
253  distMax = cms.double(0.4),
254  values = cms.vstring('pt','emEnergyFraction'),
255  valueLabels = cms.vstring('pt','emEnergyFraction'),
256  lazyParser = cms.bool(True) )
257  task.add(process.caloJetMap)
258  process.patJets.userData.userFloats.src += [ cms.InputTag("caloJetMap:pt"), cms.InputTag("caloJetMap:emEnergyFraction") ]
259 
260  #Muon object modifications
261  from PhysicsTools.PatAlgos.slimming.muonIsolationsPUPPI_cfi import makeInputForPUPPIIsolationMuon
263 
264  #EGM object modifications
265  from PhysicsTools.PatAlgos.slimming.egmIsolationsPUPPI_cfi import makeInputForPUPPIIsolationEgm
267  from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import egamma_modifications
268  process.slimmedElectrons.modifierConfig.modifications = egamma_modifications
269  process.slimmedPhotons.modifierConfig.modifications = egamma_modifications
270 
271  #VID Electron IDs
272  process.patElectrons.addElectronID = cms.bool(True)
273  electron_ids = ['RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
274  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV71_cff',
275  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
276  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
277  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
278  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
279  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
280  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff',
281  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Summer16_80X_V1_cff',
282  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff',
283  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff',
284  ]
285  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD, task)
286  process.egmGsfElectronIDs.physicsObjectSrc = \
287  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
288  process.electronMVAValueMapProducer.src = \
289  cms.InputTag('reducedEgamma','reducedGedGsfElectrons')
290  for idmod in electron_ids:
291  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection,None,False,task)
292 
293  #VID Photon IDs
294  process.patPhotons.addPhotonID = cms.bool(True)
295  photon_ids = ['RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff',
296  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V2_cff',
297  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff',
298  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V2_cff',
299  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff',
300  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff']
301  switchOnVIDPhotonIdProducer(process,DataFormat.AOD, task)
302  process.egmPhotonIDs.physicsObjectSrc = \
303  cms.InputTag("reducedEgamma","reducedGedPhotons")
304  process.photonMVAValueMapProducer.src = \
305  cms.InputTag('reducedEgamma','reducedGedPhotons')
306  for idmod in photon_ids:
307  setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection,None,False,task)
308 
309  #add the cut base IDs bitmaps of which cuts passed
310  from RecoEgamma.EgammaTools.egammaObjectModifications_tools import makeVIDBitsModifier
311  egamma_modifications.append(makeVIDBitsModifier(process,"egmGsfElectronIDs","egmPhotonIDs"))
312 
313  #-- Adding boosted taus
314  from RecoTauTag.Configuration.boostedHPSPFTaus_cfi import addBoostedTaus
315  addBoostedTaus(process)
316  process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
317  process.load("RecoTauTag.Configuration.HPSPFTaus_cff")
318  #-- Adding customization for 94X 2017 legacy reMniAOD
319  _makePatTausTaskWithRetrainedMVATauID = process.makePatTausTask.copy()
320  _makePatTausTaskWithRetrainedMVATauID.add(process.hpsPFTauBasicDiscriminatorsTask,
321  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTTask,
322  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBnewDMwLTTask,
323  process.hpsPFTauBasicDiscriminatorsdR03Task,
324  process.hpsPFTauDiscriminationByIsolationMVArun2v1DBdR03oldDMwLTTask,
325  process.hpsPFTauDiscriminationByMVA6rawElectronRejection,
326  process.hpsPFTauDiscriminationByMVA6ElectronRejection,
327  process.hpsPFTauDiscriminationByMuonRejection3)
328  from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
329  (run2_miniAOD_94XFall17 | run2_miniAOD_UL).toReplaceWith(
330  process.makePatTausTask, _makePatTausTaskWithRetrainedMVATauID
331  )
332  #-- Adding DeepTauID
333  # deepTau v2p1
334  _updatedTauName = 'slimmedTausDeepIDsv2p1'
335  _noUpdatedTauName = 'slimmedTausNoDeepIDs'
336  import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
337  tauIdEmbedder = tauIdConfig.TauIDEmbedder(
338  process, debug = False,
339  updatedTauName = _updatedTauName,
340  toKeep = ['deepTau2017v2p1']
341  )
342  tauIdEmbedder.runTauID()
343  addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task)
344  delattr(process, 'slimmedTaus')
345  process.deepTau2017v2p1.taus = _noUpdatedTauName
346  process.slimmedTaus = getattr(process, _updatedTauName).clone(
347  src = _noUpdatedTauName
348  )
349  process.deepTauIDTask = cms.Task(process.deepTau2017v2p1, process.slimmedTaus)
350  task.add(process.deepTauIDTask)
351 
352  #-- Adding customization for 80X 2016 legacy reMiniAOD and 2018 heavy ions
353  from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
354  _makePatTausTaskWithTauReReco = process.makePatTausTask.copy()
355  _makePatTausTaskWithTauReReco.add(process.PFTauTask)
356  (run2_miniAOD_80XLegacy | pp_on_AA_2018).toReplaceWith(
357  process.makePatTausTask, _makePatTausTaskWithTauReReco
358  )
359 
360  # Adding puppi jets
361  process.load('CommonTools.PileupAlgos.Puppi_cff')
362  process.load('RecoJets.JetProducers.ak4PFJets_cfi')
363  from Configuration.Eras.Modifier_pA_2016_cff import pA_2016
364  _rerun_puppijets_task = task.copy()
365  _rerun_puppijets_task.add(process.puppi, process.ak4PFJetsPuppi)
366  _run2_miniAOD_ANY = (run2_miniAOD_80XLegacy | run2_miniAOD_94XFall17 | run2_miniAOD_UL)
367  (_run2_miniAOD_ANY | pA_2016 | pp_on_AA_2018).toReplaceWith(task, _rerun_puppijets_task)
368 
369  from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import j2tParametersVX
370  process.ak4PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
371  j2tParametersVX,
372  jets = cms.InputTag("ak4PFJetsPuppi")
373  )
374  task.add(process.ak4PFJetsPuppiTracksAssociatorAtVertex)
375  process.patJetPuppiCharge = cms.EDProducer("JetChargeProducer",
376  src = cms.InputTag("ak4PFJetsPuppiTracksAssociatorAtVertex"),
377  var = cms.string('Pt'),
378  exp = cms.double(1.0)
379  )
380  task.add(process.patJetPuppiCharge)
381 
382  noDeepFlavourDiscriminators = [x.value() for x in process.patJets.discriminatorSources if not "DeepFlavour" in x.value()]
383  addJetCollection(process, postfix = "", labelName = 'Puppi', jetSource = cms.InputTag('ak4PFJetsPuppi'),
384  jetCorrections = ('AK4PFPuppi', ['L2Relative', 'L3Absolute'], ''),
385  pfCandidates = cms.InputTag("particleFlow"),
386  algo= 'AK', rParam = 0.4, btagDiscriminators = noDeepFlavourDiscriminators
387  )
388 
389  process.patJetGenJetMatchPuppi.matched = 'slimmedGenJets'
390 
391  process.patJetsPuppi.jetChargeSource = cms.InputTag("patJetPuppiCharge")
392 
393  process.selectedPatJetsPuppi.cut = cms.string("pt > 15")
394 
395  from PhysicsTools.PatAlgos.slimming.applyDeepBtagging_cff import applyDeepBtagging
396  applyDeepBtagging( process )
397 
398  addToProcessAndTask('slimmedJetsPuppi', process.slimmedJetsNoDeepFlavour.clone(
399  src = "selectedPatJetsPuppi", packedPFCandidates = "packedPFCandidates"),
400  process, task)
401 
402  task.add(process.slimmedJetsPuppi)
403 
404  # Embed pixelClusterTagInfos in slimmedJets
405  process.patJets.addTagInfos = True
406  process.patJets.tagInfoSources = ["pixelClusterTagInfos"]
407  process.slimmedJetsNoDeepFlavour.dropTagInfos = '0'
408  process.updatedPatJetsTransientCorrectedSlimmedDeepFlavour.addTagInfos = True
409  process.updatedPatJetsTransientCorrectedSlimmedDeepFlavour.tagInfoSources = ["pixelClusterTagInfos"]
410 
411  _run2_miniAOD_ANY.toModify(process.patJets, addTagInfos = False )
412  _run2_miniAOD_ANY.toModify(process.updatedPatJetsTransientCorrectedSlimmedDeepFlavour, addTagInfos = False )
413 
414 
415  process.load('RecoMET.METProducers.pfMetPuppi_cfi')
416  _rerun_puppimet_task = task.copy()
417  _rerun_puppimet_task.add(process.puppiNoLep, process.pfMetPuppi)
418  _run2_miniAOD_ANY.toReplaceWith(task, _rerun_puppimet_task)
419 
420  runMetCorAndUncForMiniAODProduction(process, metType="Puppi",
421  jetCollUnskimmed="slimmedJetsPuppi",
422  recoMetFromPFCs=True,
423  jetFlavor="AK4PFPuppi",
424  postfix="Puppi"
425  )
426 
427  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
428  task.add(process.slimmedMETs)
429  addToProcessAndTask('slimmedMETsPuppi', process.slimmedMETs.clone(), process, task)
430  process.slimmedMETsPuppi.src = cms.InputTag("patMETsPuppi")
431  process.slimmedMETsPuppi.rawVariation = cms.InputTag("patPFMetPuppi")
432  process.slimmedMETsPuppi.t1Uncertainties = cms.InputTag("patPFMetT1%sPuppi")
433  process.slimmedMETsPuppi.t01Variation = cms.InputTag("patPFMetT0pcT1Puppi")
434  process.slimmedMETsPuppi.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sPuppi")
435  process.slimmedMETsPuppi.tXYUncForRaw = cms.InputTag("patPFMetTxyPuppi")
436  process.slimmedMETsPuppi.tXYUncForT1 = cms.InputTag("patPFMetT1TxyPuppi")
437  process.slimmedMETsPuppi.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyPuppi")
438  process.slimmedMETsPuppi.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyPuppi")
439  process.slimmedMETsPuppi.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyPuppi")
440  del process.slimmedMETsPuppi.caloMET
441 
442  process.load('RecoMET.METPUSubtraction.deepMETProducer_cfi')
443 
444  addToProcessAndTask('deepMETsResolutionTune', process.deepMETProducer.clone(), process, task)
445  addToProcessAndTask('deepMETsResponseTune', process.deepMETProducer.clone(), process, task)
446  process.deepMETsResponseTune.graph_path = 'RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb'
447 
448  from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
449  phase2_common.toModify(
450  process.deepMETsResolutionTune,
451  max_n_pf=12500,
452  graph_path="RecoMET/METPUSubtraction/data/deepmet/deepmet_v1_phase2.pb"
453  )
454  phase2_common.toModify(
455  process.deepMETsResponseTune,
456  max_n_pf=12500,
457  graph_path="RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_phase2.pb"
458  )
459 
460  from Configuration.Eras.Modifier_run2_jme_2016_cff import run2_jme_2016
461  run2_jme_2016.toModify(
462  process.deepMETsResponseTune,
463  graph_path="RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2016.pb"
464  )
465  # add DetIdAssociatorRecords to EventSetup (for isolatedTracks)
466  process.load("TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff")
467 
468  # EGamma objects from HGCal are not yet in GED
469  # so add companion collections for Phase-II MiniAOD production
470  from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
471  process.load("RecoEgamma.EgammaTools.slimmedEgammaFromMultiCl_cff")
472  phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaFromMultiClTask))
473 
474  # L1 pre-firing weights for 2016 and 2017
475  from Configuration.Eras.Modifier_run2_L1prefiring_cff import run2_L1prefiring
476  from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger
477  from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
478  process.load("PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff")
479  stage1L1Trigger.toModify(process.prefiringweight, DataEra = "2016BtoH")
480  stage2L1Trigger_2017.toModify(process.prefiringweight, DataEra = "2017BtoF")
481  run2_L1prefiring.toModify(task, func=lambda t: t.add(process.prefiringweight))
482 

References boostedHPSPFTaus_cfi.addBoostedTaus(), helpers.addToProcessAndTask(), applyDeepBtagging_cff.applyDeepBtagging(), applySubstructure_cff.applySubstructure(), clone(), helpers.getPatAlgosToolsTask(), egmIsolationsPUPPI_cfi.makeInputForPUPPIIsolationEgm(), muonIsolationsPUPPI_cfi.makeInputForPUPPIIsolationMuon(), 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().

◆ miniAOD_customizeData()

def miniAOD_tools.miniAOD_customizeData (   process)

Definition at line 536 of file miniAOD_tools.py.

536 def miniAOD_customizeData(process):
537  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
538  runOnData( process, outputModules = [] )
539  process.load("RecoPPS.Local.ctppsLocalTrackLiteProducer_cff")
540  process.load("RecoPPS.ProtonReconstruction.ctppsProtons_cff")
541  process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi")
542  task = getPatAlgosToolsTask(process)
543  from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016
544  ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsLocalTrackLiteProducer))
545  ctpps_2016.toModify(task, func=lambda t: t.add(process.ctppsProtons))
546 

References helpers.getPatAlgosToolsTask().

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

◆ miniAOD_customizeMC()

def miniAOD_tools.miniAOD_customizeMC (   process)

Definition at line 483 of file miniAOD_tools.py.

483 def miniAOD_customizeMC(process):
484  task = getPatAlgosToolsTask(process)
485  #GenJetFlavourInfos
486  process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")
487  task.add(process.selectedHadronsAndPartons)
488  task.add(process.selectedHadronsAndPartonsForGenJetsFlavourInfos)
489 
490  process.load("PhysicsTools.JetMCAlgos.AK4GenJetFlavourInfos_cfi")
491  task.add(process.ak4GenJetFlavourInfos)
492 
493  process.load('PhysicsTools.PatAlgos.slimming.slimmedGenJetsFlavourInfos_cfi')
494  task.add(process.slimmedGenJetsFlavourInfos)
495 
496  #slimmed pileup information
497  process.load('PhysicsTools.PatAlgos.slimming.slimmedAddPileupInfo_cfi')
498  task.add(process.slimmedAddPileupInfo)
499 
500  process.muonMatch.matched = "prunedGenParticles"
501  process.electronMatch.matched = "prunedGenParticles"
502  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
503  process.photonMatch.matched = "prunedGenParticles"
504  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
505  process.ootPhotonMatch.matched = "prunedGenParticles"
506  process.ootPhotonMatch.src = cms.InputTag("reducedEgamma","reducedOOTPhotons")
507  process.tauMatch.matched = "prunedGenParticles"
508  process.tauGenJets.GenParticles = "prunedGenParticles"
509  #Boosted taus
510  process.tauMatchBoosted.matched = "prunedGenParticles"
511  process.tauGenJetsBoosted.GenParticles = "prunedGenParticles"
512  process.patJetPartons.particles = "genParticles"
513  process.patJetPartonMatch.matched = "prunedGenParticles"
514  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
515  process.patJetGenJetMatch.matched = "slimmedGenJets"
516  process.patJetGenJetMatchAK8Puppi.matched = "slimmedGenJetsAK8"
517  process.patMuons.embedGenMatch = False
518  process.patElectrons.embedGenMatch = False
519  process.patPhotons.embedGenMatch = False
520  process.patOOTPhotons.embedGenMatch = False
521  process.patTaus.embedGenMatch = False
522  process.patTausBoosted.embedGenMatch = False
523  process.patJets.embedGenPartonMatch = False
524  #also jet flavour must be switched
525  process.patJetFlavourAssociation.rParam = 0.4
526 

References helpers.getPatAlgosToolsTask().

Referenced by miniAOD_customizeAllMC(), and miniAOD_customizeAllMCFastSim().

◆ miniAOD_customizeOutput()

def miniAOD_tools.miniAOD_customizeOutput (   out)

Definition at line 527 of file miniAOD_tools.py.

527 def miniAOD_customizeOutput(out):
528  from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel
529  out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel
530  out.splitLevel = cms.untracked.int32(0)
531  out.dropMetaData = cms.untracked.string('ALL')
532  out.fastCloning= cms.untracked.bool(False)
533  out.overrideInputFileSplitLevels = cms.untracked.bool(True)
534  out.compressionAlgorithm = cms.untracked.string('LZMA')
535 

Referenced by ConfigBuilder.ConfigBuilder.addOutput().

miniAOD_tools.miniAOD_customizeMC
def miniAOD_customizeMC(process)
Definition: miniAOD_tools.py:483
j2tParametersVX_cfi
helpers.getPatAlgosToolsTask
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
miniAOD_tools.miniAOD_customizeCommon
def miniAOD_customizeCommon(process)
Definition: miniAOD_tools.py:7
vid_id_tools.switchOnVIDElectronIdProducer
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
metFilterPaths_cff.miniAOD_customizeMETFiltersFastSim
def miniAOD_customizeMETFiltersFastSim(process)
Definition: metFilterPaths_cff.py:55
egammaObjectModifications_tools.makeVIDBitsModifier
def makeVIDBitsModifier(process, eleVIDModuleName, phoVIDModuleName)
Definition: egammaObjectModifications_tools.py:7
isolatedTracks_cfi
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
egmIsolationsPUPPI_cfi.makeInputForPUPPIIsolationEgm
def makeInputForPUPPIIsolationEgm(process)
Definition: egmIsolationsPUPPI_cfi.py:8
jetTools
pfMet_cfi
applyDeepBtagging_cff.applyDeepBtagging
def applyDeepBtagging(process, postfix="")
Definition: applyDeepBtagging_cff.py:5
metFilterPaths_cff
muonIsolationsPUPPI_cfi.makeInputForPUPPIIsolationMuon
def makeInputForPUPPIIsolationMuon(process)
Definition: muonIsolationsPUPPI_cfi.py:7
trigTools.switchOnTriggerStandAlone
switchOnTriggerStandAlone
Definition: trigTools.py:283
miniAOD_tools.miniAOD_customizeAllMCFastSim
def miniAOD_customizeAllMCFastSim(process)
Definition: miniAOD_tools.py:557
miniAOD_tools.miniAOD_customizeData
def miniAOD_customizeData(process)
Definition: miniAOD_tools.py:536
runMETCorrectionsAndUncertainties.runMetCorAndUncForMiniAODProduction
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="")
Definition: runMETCorrectionsAndUncertainties.py:1933
miniAOD_tools.miniAOD_customizeOutput
def miniAOD_customizeOutput(out)
Definition: miniAOD_tools.py:527
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.switchOnVIDPhotonIdProducer
def switchOnVIDPhotonIdProducer(process, dataFormat, task=None)
Photons.
Definition: vid_id_tools.py:158
coreTools
boostedHPSPFTaus_cfi.addBoostedTaus
def addBoostedTaus(process)
Definition: boostedHPSPFTaus_cfi.py:4
isolatedTracks_cfi.miniAOD_customizeIsolatedTracksFastSim
def miniAOD_customizeIsolatedTracksFastSim(process)
Definition: isolatedTracks_cfi.py:65
miniAOD_tools.miniAOD_customizeAllMC
def miniAOD_customizeAllMC(process)
Definition: miniAOD_tools.py:552
miniAOD_tools.miniAOD_customizeAllData
def miniAOD_customizeAllData(process)
Definition: miniAOD_tools.py:547
MicroEventContent_cff
helpers.addToProcessAndTask
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
applySubstructure_cff.applySubstructure
def applySubstructure(process, postfix="")
Definition: applySubstructure_cff.py:5