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 518 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeData().

519  miniAOD_customizeCommon(process)
520  miniAOD_customizeData(process)
521  return process
522 
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 523 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeMC().

524  miniAOD_customizeCommon(process)
525  miniAOD_customizeMC(process)
526  return process
527 
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 528 of file miniAOD_tools.py.

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

529  miniAOD_customizeCommon(process)
530  miniAOD_customizeMC(process)
531  from PhysicsTools.PatAlgos.slimming.metFilterPaths_cff import miniAOD_customizeMETFiltersFastSim
532  process = miniAOD_customizeMETFiltersFastSim(process)
533  from PhysicsTools.PatAlgos.slimming.isolatedTracks_cfi import miniAOD_customizeIsolatedTracksFastSim
534  process = miniAOD_customizeIsolatedTracksFastSim(process)
535  process.patMuons.addTriggerMatching = False
536 
537  return process
538 
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(), 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 = cms.bool(True)
29  process.patMuons.computeMuonMVA = cms.bool(True)
30  process.patMuons.computeSoftMuonMVA = cms.bool(True)
31 
32  process.patMuons.addTriggerMatching = True
33 
34  #
35  # disable embedding of electron and photon associated objects already stored by the ReducedEGProducer
36  process.patElectrons.embedGsfElectronCore = False ## process.patElectrons.embed in AOD externally stored gsf electron core
37  process.patElectrons.embedSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
38  process.patElectrons.embedPflowSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
39  process.patElectrons.embedSeedCluster = False ## process.patElectrons.embed in AOD externally stored the electron's seedcluster
40  process.patElectrons.embedBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's basic clusters
41  process.patElectrons.embedPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's preshower clusters
42  process.patElectrons.embedPflowBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow basic clusters
43  process.patElectrons.embedPflowPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow preshower clusters
44  process.patElectrons.embedRecHits = False ## process.patElectrons.embed in AOD externally stored the RecHits - can be called from the PATElectronProducer
45  process.patElectrons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
46  process.patElectrons.usePfCandidateMultiMap = True
47  process.patElectrons.pfCandidateMultiMap = cms.InputTag("reducedEgamma","reducedGsfElectronPfCandMap")
48  process.patElectrons.electronIDSources = cms.PSet()
49  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
50  run2_miniAOD_80XLegacy.toModify(process.patElectrons,
51  addPFClusterIso = cms.bool(True),
52  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"),
53  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso"))
54  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
55  run2_miniAOD_94XFall17.toModify(process.patElectrons,
56  addPFClusterIso = cms.bool(True),
57  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso"),
58  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso"))
59 
60  #add puppi isolation in miniAOD
61  process.patElectrons.addPuppiIsolation = cms.bool(True)
62  process.patElectrons.puppiIsolationChargedHadrons = cms.InputTag("egmElectronPUPPIIsolation","h+-DR030-BarVeto000-EndVeto001")
63  process.patElectrons.puppiIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPIIsolation","h0-DR030-BarVeto000-EndVeto000")
64  process.patElectrons.puppiIsolationPhotons = cms.InputTag("egmElectronPUPPIIsolation","gamma-DR030-BarVeto000-EndVeto008")
65  process.patElectrons.puppiNoLeptonsIsolationChargedHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h+-DR030-BarVeto000-EndVeto001")
66  process.patElectrons.puppiNoLeptonsIsolationNeutralHadrons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","h0-DR030-BarVeto000-EndVeto000")
67  process.patElectrons.puppiNoLeptonsIsolationPhotons = cms.InputTag("egmElectronPUPPINoLeptonsIsolation","gamma-DR030-BarVeto000-EndVeto008")
68 
69  process.patElectrons.computeMiniIso = cms.bool(True)
70 
71  process.elPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
72  process.elPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
73  process.elPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
74  process.elPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
75  process.elPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
76  #
77  process.patPhotons.embedSuperCluster = False ## whether to process.patPhotons.embed in AOD externally stored supercluster
78  process.patPhotons.embedSeedCluster = False ## process.patPhotons.embed in AOD externally stored the photon's seedcluster
79  process.patPhotons.embedBasicClusters = False ## process.patPhotons.embed in AOD externally stored the photon's basic clusters
80  process.patPhotons.embedPreshowerClusters = False ## process.patPhotons.embed in AOD externally stored the photon's preshower clusters
81  process.patPhotons.embedRecHits = False ## process.patPhotons.embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer
82 
83  #add puppi isolation in miniAOD
84  process.patPhotons.addPuppiIsolation = cms.bool(True)
85  process.patPhotons.puppiIsolationChargedHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h+-DR030-")
86  process.patPhotons.puppiIsolationNeutralHadrons = cms.InputTag("egmPhotonPUPPIIsolation","h0-DR030-")
87  process.patPhotons.puppiIsolationPhotons = cms.InputTag("egmPhotonPUPPIIsolation","gamma-DR030-")
88 
89  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
90  run2_miniAOD_80XLegacy.toModify(process.patPhotons,
91  addPFClusterIso = cms.bool(True),
92  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"),
93  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso"))
94  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
95  run2_miniAOD_94XFall17.toModify(process.patPhotons,
96  addPFClusterIso = cms.bool(True),
97  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso"),
98  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso"))
99  #the 80X legacy customsations are done in ootPhotonProducer for OOT photons
100  run2_miniAOD_94XFall17.toModify(process.patOOTPhotons,
101  addPFClusterIso = cms.bool(True),
102  ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoEcalPFClusIso"),
103  hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "ootPhoHcalPFClusIso"))
104 
105 
106  process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
107  process.patPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
108 
109  process.phPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
110  process.phPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
111  process.phPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
112  process.phPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
113  process.phPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
114  #
115  process.patOOTPhotons.photonSource = cms.InputTag("reducedEgamma","reducedOOTPhotons")
116  process.patOOTPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
117  #
118  process.selectedPatJets.cut = cms.string("pt > 10")
119  process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
120 
121  from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon
122  phase2_muon.toModify(process.selectedPatMuons, cut = "pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose') || muonID('ME0MuonArbitrated') || muonID('GEMMuonArbitrated')) )")
123 
124  process.selectedPatElectrons.cut = cms.string("")
125  process.selectedPatTaus.cut = cms.string("pt > 18. && tauID('decayModeFindingNewDMs')> 0.5")
126  process.selectedPatPhotons.cut = cms.string("")
127 
128  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
129 
130  from PhysicsTools.PatAlgos.slimming.applySubstructure_cff import applySubstructure
131  applySubstructure( process )
132 
133 
134  #
135  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
136  switchOnTriggerStandAlone( process, outputModule = '' )
137  process.patTrigger.packTriggerPathNames = cms.bool(True)
138  #
139  # apply type I + other PFMEt corrections to pat::MET object
140  # and estimate systematic uncertainties on MET
141 
142  from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncForMiniAODProduction
143  runMetCorAndUncForMiniAODProduction(process, metType="PF",
144  jetCollUnskimmed="patJets")
145 
146  #caloMET computation
147  from PhysicsTools.PatAlgos.tools.metTools import addMETCollection
148  addMETCollection(process,
149  labelName = "patCaloMet",
150  metSource = "caloMetM"
151  )
152 
153  #noHF pfMET =========
154 
155  task = getPatAlgosToolsTask(process)
156 
157  process.noHFCands = cms.EDFilter("GenericPFCandidateSelector",
158  src=cms.InputTag("particleFlow"),
159  cut=cms.string("abs(pdgId)!=1 && abs(pdgId)!=2 && abs(eta)<3.0")
160  )
161  task.add(process.noHFCands)
162 
164  pfCandColl=cms.InputTag("noHFCands"),
165  recoMetFromPFCs=True, #needed for HF removal
166  jetSelection="pt>15 && abs(eta)<3.",
167  postfix="NoHF"
168  )
169 
170  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
171  task.add(process.slimmedMETs)
172  addToProcessAndTask('slimmedMETsNoHF', process.slimmedMETs.clone(), process, task)
173  process.slimmedMETsNoHF.src = cms.InputTag("patMETsNoHF")
174  process.slimmedMETsNoHF.rawVariation = cms.InputTag("patPFMetNoHF")
175  process.slimmedMETsNoHF.t1Uncertainties = cms.InputTag("patPFMetT1%sNoHF")
176  process.slimmedMETsNoHF.t01Variation = cms.InputTag("patPFMetT0pcT1NoHF")
177  process.slimmedMETsNoHF.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sNoHF")
178  process.slimmedMETsNoHF.tXYUncForRaw = cms.InputTag("patPFMetTxyNoHF")
179  process.slimmedMETsNoHF.tXYUncForT1 = cms.InputTag("patPFMetT1TxyNoHF")
180  process.slimmedMETsNoHF.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyNoHF")
181  process.slimmedMETsNoHF.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyNoHF")
182  process.slimmedMETsNoHF.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyNoHF")
183  del process.slimmedMETsNoHF.caloMET
184  # ================== NoHF pfMET
185 
186  # ================== CHSMET
187  process.CHSCands = cms.EDFilter("CandPtrSelector",
188  src=cms.InputTag("packedPFCandidates"),
189  cut=cms.string("fromPV(0) > 0")
190  )
191  task.add(process.CHSCands)
192 
193  process.pfMetCHS = cms.EDProducer("PFMETProducer",
194  src = cms.InputTag("CHSCands"),
195  alias = cms.string('pfMet'),
196  globalThreshold = cms.double(0.0),
197  calculateSignificance = cms.bool(False),
198  )
199  task.add(process.pfMetCHS)
200 
201  addMETCollection(process,
202  labelName = "patCHSMet",
203  metSource = "pfMetCHS"
204  )
205 
206  process.patCHSMet.computeMETSignificance = cms.bool(False)
207 
208  # ================== CHSMET
209 
210  # ================== TrkMET
211  process.TrkCands = cms.EDFilter("CandPtrSelector",
212  src=cms.InputTag("packedPFCandidates"),
213  cut=cms.string("charge()!=0 && pvAssociationQuality()>=4 && vertexRef().key()==0")
214  )
215  task.add(process.TrkCands)
216 
217  process.pfMetTrk = cms.EDProducer("PFMETProducer",
218  src = cms.InputTag("TrkCands"),
219  alias = cms.string('pfMet'),
220  globalThreshold = cms.double(0.0),
221  calculateSignificance = cms.bool(False),
222  )
223 
224  task.add(process.pfMetTrk)
225 
226  addMETCollection(process,
227  labelName = "patTrkMet",
228  metSource = "pfMetTrk"
229  )
230 
231  process.patTrkMet.computeMETSignificance = cms.bool(False)
232 
233  # ================== TrkMET
234 
235 
236  ## PU JetID
237  process.load("RecoJets.JetProducers.PileupJetID_cfi")
238  task.add(process.pileUpJetIDTask)
239 
240  process.patJets.userData.userFloats.src = [ cms.InputTag("pileupJetId:fullDiscriminant"), ]
241  process.patJets.userData.userInts.src = [ cms.InputTag("pileupJetId:fullId"), ]
242 
243  ## Quark Gluon Likelihood
244  process.load('RecoJets.JetProducers.QGTagger_cfi')
245  task.add(process.QGTaggerTask)
246 
247  process.patJets.userData.userFloats.src += [ cms.InputTag('QGTagger:qgLikelihood'), ]
248 
249  ## DeepCSV meta discriminators (simple arithmethic on output probabilities)
250  process.load('RecoBTag.Combined.deepFlavour_cff')
251  task.add(process.pfDeepCSVDiscriminatorsJetTags)
252  process.patJets.discriminatorSources.extend([
253  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:BvsAll' ),
254  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsB' ),
255  cms.InputTag('pfDeepCSVDiscriminatorsJetTags:CvsL' ),
256  ])
257 
258  ## CaloJets
259  process.caloJetMap = cms.EDProducer("RecoJetDeltaRValueMapProducer",
260  src = process.patJets.jetSource,
261  matched = cms.InputTag("ak4CaloJets"),
262  distMax = cms.double(0.4),
263  values = cms.vstring('pt','emEnergyFraction'),
264  valueLabels = cms.vstring('pt','emEnergyFraction'),
265  lazyParser = cms.bool(True) )
266  task.add(process.caloJetMap)
267  process.patJets.userData.userFloats.src += [ cms.InputTag("caloJetMap:pt"), cms.InputTag("caloJetMap:emEnergyFraction") ]
268 
269  #Muon object modifications
270  from PhysicsTools.PatAlgos.slimming.muonIsolationsPUPPI_cfi import makeInputForPUPPIIsolationMuon
272 
273  #EGM object modifications
274  from PhysicsTools.PatAlgos.slimming.egmIsolationsPUPPI_cfi import makeInputForPUPPIIsolationEgm
276  from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import egamma_modifications
277  process.slimmedElectrons.modifierConfig.modifications = egamma_modifications
278  process.slimmedPhotons.modifierConfig.modifications = egamma_modifications
279 
280  #VID Electron IDs
281  process.patElectrons.addElectronID = cms.bool(True)
282  electron_ids = ['RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
283  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
284  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
285  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
286  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
287  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
288  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff',
289  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Summer16_80X_V1_cff',
290  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff',
291  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff',
292  ]
293  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD, task)
294  process.egmGsfElectronIDs.physicsObjectSrc = \
295  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
296  process.electronMVAVariableHelper.src = \
297  cms.InputTag('reducedEgamma','reducedGedGsfElectrons')
298  process.electronMVAValueMapProducer.src = \
299  cms.InputTag('reducedEgamma','reducedGedGsfElectrons')
300  for idmod in electron_ids:
301  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection,None,False,task)
302 
303  #heepIDVarValueMaps only exists if HEEP V6.1 or HEEP 7.0 ID has already been loaded
304  if hasattr(process,'heepIDVarValueMaps'):
305  process.heepIDVarValueMaps.elesMiniAOD = cms.InputTag('reducedEgamma','reducedGedGsfElectrons')
306  #force HEEP to use miniAOD (otherwise it'll detect the AOD)
307  process.heepIDVarValueMaps.dataFormat = cms.int32(2)
308 
309  #add the HEEP trk isol to the slimmed electron, add it to the first FromFloatValMap modifier
310  for pset in process.slimmedElectrons.modifierConfig.modifications:
311  if pset.hasParameter("modifierName") and pset.modifierName == cms.string('EGExtraInfoModifierFromFloatValueMaps'):
312  pset.electron_config.heepTrkPtIso = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso")
313  break
314 
315 
316  #VID Photon IDs
317  process.patPhotons.addPhotonID = cms.bool(True)
318  photon_ids = ['RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff',
319  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1_cff',
320  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff',
321  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff',
322  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff']
323  switchOnVIDPhotonIdProducer(process,DataFormat.AOD, task)
324  process.egmPhotonIsolation.srcToIsolate = \
325  cms.InputTag("reducedEgamma","reducedGedPhotons")
326  for iPSet in process.egmPhotonIsolation.isolationConeDefinitions:
327  iPSet.particleBasedIsolation = cms.InputTag("reducedEgamma","reducedPhotonPfCandMap")
328 
329  process.egmPhotonIDs.physicsObjectSrc = \
330  cms.InputTag("reducedEgamma","reducedGedPhotons")
331  process.photonIDValueMapProducer.src = \
332  cms.InputTag("reducedEgamma","reducedGedPhotons")
333  process.photonIDValueMapProducer.particleBasedIsolation = \
334  cms.InputTag("reducedEgamma","reducedPhotonPfCandMap")
335  process.photonMVAValueMapProducer.src = \
336  cms.InputTag('reducedEgamma','reducedGedPhotons')
337  for idmod in photon_ids:
338  setupAllVIDIdsInModule(process,idmod,setupVIDPhotonSelection,None,False,task)
339 
340  #add the cut base IDs bitmaps of which cuts passed
341  from RecoEgamma.EgammaTools.egammaObjectModifications_tools import makeVIDBitsModifier
342  egamma_modifications.append(makeVIDBitsModifier(process,"egmGsfElectronIDs","egmPhotonIDs"))
343 
344  #-- Adding boosted taus
345  from RecoTauTag.Configuration.boostedHPSPFTaus_cfi import addBoostedTaus
346  addBoostedTaus(process)
347  process.load("RecoTauTag.Configuration.RecoPFTauTag_cff")
348  process.load("RecoTauTag.Configuration.HPSPFTaus_cff")
349  #-- Adding customization for 94X 2017 legacy reMniAOD
350  from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
351  _makePatTausTaskWithRetrainedMVATauID = process.makePatTausTask.copy()
352  _makePatTausTaskWithRetrainedMVATauID.add(process.hpsPFTauDiscriminationByIsolationMVArun2v1DBoldDMwLTTask)
353  run2_miniAOD_94XFall17.toReplaceWith(
354  process.makePatTausTask, _makePatTausTaskWithRetrainedMVATauID
355  )
356  #-- Adding customization for 80X 2016 legacy reMiniAOD and 2018 heavy ions
357  from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
358  from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
359  _makePatTausTaskWithTauReReco = process.makePatTausTask.copy()
360  _makePatTausTaskWithTauReReco.add(process.PFTauTask)
361  (run2_miniAOD_80XLegacy | pp_on_AA_2018).toReplaceWith(
362  process.makePatTausTask, _makePatTausTaskWithTauReReco
363  )
364 
365  # Adding puppi jets
366  if not hasattr(process, 'ak4PFJetsPuppi'): #MM: avoid confilct with substructure call
367  process.load('RecoJets.JetProducers.ak4PFJetsPuppi_cfi')
368  task.add(process.ak4PFJets)
369  task.add(process.ak4PFJetsPuppi)
370  process.ak4PFJetsPuppi.doAreaFastjet = True # even for standard ak4PFJets this is overwritten in RecoJets/Configuration/python/RecoPFJets_cff
371  from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import j2tParametersVX
372  process.ak4PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
373  j2tParametersVX,
374  jets = cms.InputTag("ak4PFJetsPuppi")
375  )
376  task.add(process.ak4PFJetsPuppiTracksAssociatorAtVertex)
377  process.patJetPuppiCharge = cms.EDProducer("JetChargeProducer",
378  src = cms.InputTag("ak4PFJetsPuppiTracksAssociatorAtVertex"),
379  var = cms.string('Pt'),
380  exp = cms.double(1.0)
381  )
382  task.add(process.patJetPuppiCharge)
383 
384  noDeepFlavourDiscriminators = [x.value() for x in process.patJets.discriminatorSources if not "DeepFlavour" in x.value()]
385  addJetCollection(process, postfix = "", labelName = 'Puppi', jetSource = cms.InputTag('ak4PFJetsPuppi'),
386  jetCorrections = ('AK4PFPuppi', ['L2Relative', 'L3Absolute'], ''),
387  pfCandidates = cms.InputTag("particleFlow"),
388  algo= 'AK', rParam = 0.4, btagDiscriminators = noDeepFlavourDiscriminators
389  )
390 
391  process.patJetGenJetMatchPuppi.matched = 'slimmedGenJets'
392 
393  process.patJetsPuppi.jetChargeSource = cms.InputTag("patJetPuppiCharge")
394 
395  process.selectedPatJetsPuppi.cut = cms.string("pt > 15")
396 
397  from PhysicsTools.PatAlgos.slimming.applyDeepBtagging_cff import applyDeepBtagging
398  applyDeepBtagging( process )
399 
400  addToProcessAndTask('slimmedJetsPuppiNoMultiplicities', process.slimmedJetsNoDeepFlavour.clone(), process, task)
401  process.slimmedJetsPuppiNoMultiplicities.src = cms.InputTag("selectedPatJetsPuppi")
402  process.slimmedJetsPuppiNoMultiplicities.packedPFCandidates = cms.InputTag("packedPFCandidates")
403 
404  from PhysicsTools.PatAlgos.patPuppiJetSpecificProducer_cfi import patPuppiJetSpecificProducer
405  from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
406  process.patPuppiJetSpecificProducer = patPuppiJetSpecificProducer.clone(
407  src=cms.InputTag("slimmedJetsPuppiNoMultiplicities"),
408  )
409  task.add(process.patPuppiJetSpecificProducer)
410  updateJetCollection(
411  process,
412  labelName = 'PuppiJetSpecific',
413  jetSource = cms.InputTag('slimmedJetsPuppiNoMultiplicities'),
414  )
415  process.updatedPatJetsPuppiJetSpecific.userData.userFloats.src = ['patPuppiJetSpecificProducer:puppiMultiplicity', 'patPuppiJetSpecificProducer:neutralPuppiMultiplicity', 'patPuppiJetSpecificProducer:neutralHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:photonPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFHadronPuppiMultiplicity', 'patPuppiJetSpecificProducer:HFEMPuppiMultiplicity' ]
416  process.slimmedJetsPuppi = process.selectedUpdatedPatJetsPuppiJetSpecific.clone()
417  delattr(process, 'selectedUpdatedPatJetsPuppiJetSpecific')
418 
419  task.add(process.slimmedJetsPuppi)
420 
421  ## puppi met
422  from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppies
423  makePuppies( process );
424 
425  runMetCorAndUncForMiniAODProduction(process, metType="Puppi",
426  pfCandColl=cms.InputTag("puppiForMET"),
427  jetCollUnskimmed="slimmedJetsPuppi",
428  recoMetFromPFCs=True,
429  jetFlavor="AK4PFPuppi",
430  postfix="Puppi"
431  )
432 
433  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
434  task.add(process.slimmedMETs)
435  addToProcessAndTask('slimmedMETsPuppi', process.slimmedMETs.clone(), process, task)
436  process.slimmedMETsPuppi.src = cms.InputTag("patMETsPuppi")
437  process.slimmedMETsPuppi.rawVariation = cms.InputTag("patPFMetPuppi")
438  process.slimmedMETsPuppi.t1Uncertainties = cms.InputTag("patPFMetT1%sPuppi")
439  process.slimmedMETsPuppi.t01Variation = cms.InputTag("patPFMetT0pcT1Puppi")
440  process.slimmedMETsPuppi.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sPuppi")
441  process.slimmedMETsPuppi.tXYUncForRaw = cms.InputTag("patPFMetTxyPuppi")
442  process.slimmedMETsPuppi.tXYUncForT1 = cms.InputTag("patPFMetT1TxyPuppi")
443  process.slimmedMETsPuppi.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyPuppi")
444  process.slimmedMETsPuppi.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyPuppi")
445  process.slimmedMETsPuppi.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyPuppi")
446  del process.slimmedMETsPuppi.caloMET
447 
448  # add DetIdAssociatorRecords to EventSetup (for isolatedTracks)
449  process.load("TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff")
450 
451  # EGamma objects from HGCal are not yet in GED
452  # so add companion collections for Phase-II MiniAOD production
453  from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
454  process.load("RecoEgamma.EgammaTools.slimmedEgammaFromMultiCl_cff")
455  phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaFromMultiClTask))
456 
457 
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:282
def makeVIDBitsModifier(process, eleVIDModuleName, phoVIDModuleName)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def switchOnVIDPhotonIdProducer(process, dataFormat, task=None)
Photons.
def miniAOD_tools.miniAOD_customizeData (   process)

Definition at line 511 of file miniAOD_tools.py.

References helpers.getPatAlgosToolsTask().

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

512  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
513  runOnData( process, outputModules = [] )
514  process.load("RecoCTPPS.TotemRPLocal.ctppsLocalTrackLiteProducer_cff")
515  task = getPatAlgosToolsTask(process)
516  task.add(process.ctppsLocalTrackLiteProducer)
517 
def miniAOD_customizeData(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def miniAOD_tools.miniAOD_customizeMC (   process)

Definition at line 458 of file miniAOD_tools.py.

References helpers.getPatAlgosToolsTask().

Referenced by miniAOD_customizeAllMC(), and miniAOD_customizeAllMCFastSim().

458 def miniAOD_customizeMC(process):
459  task = getPatAlgosToolsTask(process)
460  #GenJetFlavourInfos
461  process.load("PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi")
462  task.add(process.selectedHadronsAndPartons)
463  task.add(process.selectedHadronsAndPartonsForGenJetsFlavourInfos)
464 
465  process.load("PhysicsTools.JetMCAlgos.AK4GenJetFlavourInfos_cfi")
466  task.add(process.ak4GenJetFlavourInfos)
467 
468  process.load('PhysicsTools.PatAlgos.slimming.slimmedGenJetsFlavourInfos_cfi')
469  task.add(process.slimmedGenJetsFlavourInfos)
470 
471  #slimmed pileup information
472  process.load('PhysicsTools.PatAlgos.slimming.slimmedAddPileupInfo_cfi')
473  task.add(process.slimmedAddPileupInfo)
474 
475  process.muonMatch.matched = "prunedGenParticles"
476  process.electronMatch.matched = "prunedGenParticles"
477  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
478  process.photonMatch.matched = "prunedGenParticles"
479  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
480  process.ootPhotonMatch.matched = "prunedGenParticles"
481  process.ootPhotonMatch.src = cms.InputTag("reducedEgamma","reducedOOTPhotons")
482  process.tauMatch.matched = "prunedGenParticles"
483  process.tauGenJets.GenParticles = "prunedGenParticles"
484  #Boosted taus
485  process.tauMatchBoosted.matched = "prunedGenParticles"
486  process.tauGenJetsBoosted.GenParticles = "prunedGenParticles"
487  process.patJetPartons.particles = "genParticles"
488  process.patJetPartonMatch.matched = "prunedGenParticles"
489  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
490  process.patJetGenJetMatch.matched = "slimmedGenJets"
491  process.patJetGenJetMatchAK8.matched = "slimmedGenJetsAK8"
492  process.patMuons.embedGenMatch = False
493  process.patElectrons.embedGenMatch = False
494  process.patPhotons.embedGenMatch = False
495  process.patOOTPhotons.embedGenMatch = False
496  process.patTaus.embedGenMatch = False
497  process.patTausBoosted.embedGenMatch = False
498  process.patJets.embedGenPartonMatch = False
499  #also jet flavour must be switched
500  process.patJetFlavourAssociation.rParam = 0.4
501 
def miniAOD_customizeMC(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def miniAOD_tools.miniAOD_customizeOutput (   out)

Definition at line 502 of file miniAOD_tools.py.

Referenced by ConfigBuilder.ConfigBuilder.addOutput().

503  from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel
504  out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel
505  out.splitLevel = cms.untracked.int32(0)
506  out.dropMetaData = cms.untracked.string('ALL')
507  out.fastCloning= cms.untracked.bool(False)
508  out.overrideInputFileSplitLevels = cms.untracked.bool(True)
509  out.compressionAlgorithm = cms.untracked.string('LZMA')
510 
def miniAOD_customizeOutput(out)