CMS 3D CMS Logo

nano_cff.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import FWCore.ParameterSet.Config as cms
20 from PhysicsTools.NanoAOD.met_cff import *
26 
27 
28 nanoMetadata = cms.EDProducer("UniqueStringProducer",
29  strings = cms.PSet(
30  tag = cms.string("untagged"),
31  )
32 )
33 
34 linkedObjects = cms.EDProducer("PATObjectCrossLinker",
35  jets=cms.InputTag("finalJets"),
36  muons=cms.InputTag("finalMuons"),
37  electrons=cms.InputTag("finalElectrons"),
38  taus=cms.InputTag("finalTaus"),
39  photons=cms.InputTag("finalPhotons"),
40 )
41 
42 simpleCleanerTable = cms.EDProducer("NanoAODSimpleCrossCleaner",
43  name=cms.string("cleanmask"),
44  doc=cms.string("simple cleaning mask with priority to leptons"),
45  jets=cms.InputTag("linkedObjects","jets"),
46  muons=cms.InputTag("linkedObjects","muons"),
47  electrons=cms.InputTag("linkedObjects","electrons"),
48  taus=cms.InputTag("linkedObjects","taus"),
49  photons=cms.InputTag("linkedObjects","photons"),
50  jetSel=cms.string("pt>15"),
51  muonSel=cms.string("track.isNonnull && isLooseMuon && isPFMuon && innerTrack.validFraction >= 0.49 && ( isGlobalMuon && globalTrack.normalizedChi2 < 3 && combinedQuality.chi2LocalPosition < 12 && combinedQuality.trkKink < 20 && segmentCompatibility >= 0.303 || segmentCompatibility >= 0.451 )"),
52  electronSel=cms.string(""),
53  tauSel=cms.string(""),
54  photonSel=cms.string(""),
55  jetName=cms.string("Jet"),muonName=cms.string("Muon"),electronName=cms.string("Electron"),
56  tauName=cms.string("Tau"),photonName=cms.string("Photon")
57 )
58 
59 
60 lhcInfoTable = cms.EDProducer("LHCInfoProducer",
61  precision = cms.int32(10),
62 )
63 
64 nanoSequenceCommon = cms.Sequence(
65  nanoMetadata + jetSequence + cms.Sequence(extraFlagsProducersTask, muonTask, tauTask, boostedTauTask, electronTask, lowPtElectronTask, photonTask,
66  vertexTablesTask,isoTrackTask) + jetLepSequence + # must be after all the leptons
67  linkedObjects +
68  jetTables + cms.Sequence(muonTablesTask, tauTablesTask, boostedTauTablesTask, electronTablesTask, lowPtElectronTablesTask, photonTablesTask, globalTablesTask) + metTables + simpleCleanerTable + cms.Sequence(extraFlagsTableTask,isoTrackTablesTask)
69  )
70 
71 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
72 nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
73 
74 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
75 
76 nanoSequenceFS = cms.Sequence(
77  cms.Sequence(genParticleTask,particleLevelTask) + nanoSequenceCommon + jetMC + cms.Sequence(muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
78  tauMCTask,boostedTauMCTask) + metMC +
79  cms.Sequence(ttbarCatMCProducersTask,globalTablesMCTask,cms.Task(btagWeightTable),genWeightsTableTask,genVertexTablesTask,genParticleTablesTask,particleLevelTablesTask,ttbarCategoryTableTask) )
80 
81 # GenVertex only stored in newer MiniAOD
82 nanoSequenceMC = nanoSequenceFS.copy()
83 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
84 
85 # modifier which adds new tauIDs (currently only deepTauId2017v2p1 is being added)
86 import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
87 def nanoAOD_addTauIds(process):
88  updatedTauName = "slimmedTausUpdated"
89  tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName,
90  toKeep = [ "deepTau2017v2p1" ])
91  tauIdEmbedder.runTauID()
92  _tauTask = patTauMVAIDsTask.copy()
93  _tauTask.add(process.rerunMvaIsolationTask)
94  _tauTask.add(finalTaus)
95  process.tauTask = _tauTask.copy()
96  return process
97 
99  updatedBoostedTauName = "slimmedTausBoostedNewID"
100  boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug=False,
101  originalTauName = "slimmedTausBoosted",
102  updatedTauName = updatedBoostedTauName,
103  postfix="Boosted",
104  toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018",])
105  boostedTauIdEmbedder.runTauID()
106  _boostedTauTask = process.rerunMvaIsolationTaskBoosted.copy()
107  _boostedTauTask.add(getattr(process, updatedBoostedTauName))
108  _boostedTauTask.add(process.finalBoostedTaus)
109 
110  process.boostedTauTask = _boostedTauTask.copy()
111 
112  return process
113 
114 
115 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
116 def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour):
117  _btagDiscriminators=[]
118  if addDeepBTag:
119  print("Updating process to run DeepCSV btag")
120  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb','pfDeepCSVJetTags:probc']
121  if addDeepFlavour:
122  print("Updating process to run DeepFlavour btag")
123  _btagDiscriminators += ['pfDeepFlavourJetTags:probb','pfDeepFlavourJetTags:probbb','pfDeepFlavourJetTags:problepb','pfDeepFlavourJetTags:probc']
124  if len(_btagDiscriminators)==0: return process
125  print("Will recalculate the following discriminators: "+", ".join(_btagDiscriminators))
126  updateJetCollection(
127  process,
128  jetSource = cms.InputTag('slimmedJets'),
129  jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual']), 'None'),
130  btagDiscriminators = _btagDiscriminators,
131  postfix = 'WithDeepInfo',
132  )
133  process.load("Configuration.StandardSequences.MagneticField_cff")
134  process.jetCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo"
135  process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo"
136  return process
137 
138 def nanoAOD_addDeepMET(process, addDeepMETProducer, ResponseTune_Graph):
139  if addDeepMETProducer:
140  # produce DeepMET on the fly if it is not in MiniAOD
141  print("add DeepMET Producers")
142  process.load('RecoMET.METPUSubtraction.deepMETProducer_cfi')
143 # process.deepMETsResolutionTune = process.deepMETProducer.clone()
144  process.deepMETsResponseTune = process.deepMETProducer.clone()
145  #process.deepMETsResponseTune.graph_path = 'RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb'
146  process.deepMETsResponseTune.graph_path = ResponseTune_Graph.value()
147  process.metTables += process.deepMetTables
148  return process
149 
150 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
151 from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
152 def nanoAOD_recalibrateMETs(process,isData):
153 
154  # add DeepMETs
155  nanoAOD_DeepMET_switch = cms.PSet(
156  nanoAOD_addDeepMET_switch = cms.untracked.bool(True), # decide if DeeMET should be included in Nano
157  nanoAOD_produceDeepMET_switch = cms.untracked.bool(False), # decide if DeepMET should be computed on the fly
158  ResponseTune_Graph = cms.untracked.string('RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb')
159  )
160  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1:
161  # compute DeepMETs in these eras (before 111X)
162  modifier.toModify(nanoAOD_DeepMET_switch, nanoAOD_produceDeepMET_switch = cms.untracked.bool(True))
163  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
164  modifier.toModify(nanoAOD_DeepMET_switch, ResponseTune_Graph=cms.untracked.string("RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2016.pb"))
165  if nanoAOD_DeepMET_switch.nanoAOD_addDeepMET_switch:
166  process = nanoAOD_addDeepMET(process,
167  addDeepMETProducer=nanoAOD_DeepMET_switch.nanoAOD_produceDeepMET_switch,
168  ResponseTune_Graph=nanoAOD_DeepMET_switch.ResponseTune_Graph)
169 
170  # if included in Nano, and not computed in the fly, then it should be extracted from minAOD
171  extractDeepMETs = nanoAOD_DeepMET_switch.nanoAOD_addDeepMET_switch and not nanoAOD_DeepMET_switch.nanoAOD_produceDeepMET_switch
172 
173  runMetCorAndUncFromMiniAOD(process,isData=isData, extractDeepMETs=extractDeepMETs)
174  process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.fullPatMetSequence))
175  process.basicJetsForMetForT1METNano = process.basicJetsForMet.clone(
176  src = process.updatedJetsWithUserData.src,
177  skipEM = False,
178  type1JetPtThreshold = 0.0,
179  calcMuonSubtrRawPtAsValueMap = cms.bool(True),
180  )
181  process.jetSequence.insert(process.jetSequence.index(process.updatedJetsWithUserData),cms.Sequence(process.basicJetsForMetForT1METNano))
182  process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt")
183  process.corrT1METJetTable.src = process.finalJets.src
184  process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9"
185  for table in process.jetTable, process.corrT1METJetTable:
186  table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
187  process.metTables += process.corrT1METJetTable
188 
189 
190 #
191 # makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
192  nanoAOD_PuppiV15_switch = cms.PSet(
193  recoMetFromPFCs = cms.untracked.bool(False),
194  reclusterJets = cms.untracked.bool(False),
195  )
196  run2_nanoAOD_106Xv1.toModify(nanoAOD_PuppiV15_switch,recoMetFromPFCs=True,reclusterJets=True)
197  if nanoAOD_PuppiV15_switch.reclusterJets:
198  from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
199  from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
200  task = getPatAlgosToolsTask(process)
201  addToProcessAndTask('ak4PuppiJets', ak4PFJets.clone (src = 'puppi', doAreaFastjet = True, jetPtMin = 10.), process, task)
202  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
203  addJetCollection(process,
204  labelName = 'Puppi',
205  jetSource = cms.InputTag('ak4PuppiJets'),
206  algo = 'AK', rParam=0.4,
207  genJetCollection=cms.InputTag('slimmedGenJets'),
208  jetCorrections = ('AK4PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'], 'None'),
209  pfCandidates = cms.InputTag('packedPFCandidates'),
210  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
211  svSource = cms.InputTag('slimmedSecondaryVertices'),
212  muSource =cms.InputTag( 'slimmedMuons'),
213  elSource = cms.InputTag('slimmedElectrons'),
214  genParticles= cms.InputTag('prunedGenParticles'),
215  getJetMCFlavour= False
216  )
217 
218  process.patJetsPuppi.addGenPartonMatch = cms.bool(False)
219  process.patJetsPuppi.addGenJetMatch = cms.bool(False)
220 
221  runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets))
222  process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(process.jetSequence),cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
223  return process
224 
226 def nanoAOD_activateVID(process):
227 
228  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD,electronTask)
229  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
230  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
231 
232  electronTask_ = process.egmGsfElectronIDTask.copy()
233  electronTask_.add(electronTask.copy())
234  process.electronTask = electronTask_.copy()
235  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
236  modifier.toModify(process.electronMVAValueMapProducer, src = "slimmedElectronsUpdated")
237  modifier.toModify(process.egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
238 
239  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD,photonTask) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
240  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
241  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
242 
243  photonTask_ = process.egmPhotonIDTask.copy()
244  photonTask_.add(photonTask.copy())
245  process.photonTask = photonTask_.copy()
246  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1:
247  modifier.toModify(process.photonMVAValueMapProducer, src = "slimmedPhotonsTo106X")
248  modifier.toModify(process.egmPhotonIDs, physicsObjectSrc = "slimmedPhotonsTo106X")
249  return process
250 
251 def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload):
252  _btagDiscriminators=[]
253  if addDeepBTag:
254  print("Updating process to run DeepCSV btag to AK8 jets")
255  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb']
256  if addDeepBoostedJet:
257  print("Updating process to run DeepBoostedJet on datasets before 103X")
258  from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll
259  _btagDiscriminators += pfDeepBoostedJetTagsAll
260  if addParticleNet:
261  print("Updating process to run ParticleNet before it's included in MiniAOD")
262  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll
263  _btagDiscriminators += pfParticleNetJetTagsAll
264  if addParticleNetMass:
265  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs
266  _btagDiscriminators += _pfParticleNetMassRegressionOutputs
267  if addDeepDoubleX:
268  print("Updating process to run DeepDoubleX on datasets before 104X")
269  _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \
270  'pfDeepDoubleCvLJetTags:probHcc', \
271  'pfDeepDoubleCvBJetTags:probHcc', \
272  'pfMassIndependentDeepDoubleBvLJetTags:probHbb', 'pfMassIndependentDeepDoubleCvLJetTags:probHcc', 'pfMassIndependentDeepDoubleCvBJetTags:probHcc']
273  if addDeepDoubleXV2:
274  print("Updating process to run DeepDoubleXv2 on datasets before 11X")
275  _btagDiscriminators += [
276  'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb',
277  'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc',
278  'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc'
279  ]
280  if len(_btagDiscriminators)==0: return process
281  print("Will recalculate the following discriminators on AK8 jets: "+", ".join(_btagDiscriminators))
282  updateJetCollection(
283  process,
284  jetSource = cms.InputTag('slimmedJetsAK8'),
285  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
286  svSource = cms.InputTag('slimmedSecondaryVertices'),
287  rParam = 0.8,
288  jetCorrections = (jecPayload.value(), cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual']), 'None'),
289  btagDiscriminators = _btagDiscriminators,
290  postfix='AK8WithDeepInfo',
291  printWarning = False
292  )
293  process.jetCorrFactorsAK8.src="selectedUpdatedPatJetsAK8WithDeepInfo"
294  process.updatedJetsAK8.jetSource="selectedUpdatedPatJetsAK8WithDeepInfo"
295  return process
296 
297 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
298 def nanoAOD_runMETfixEE2017(process,isData):
299  runMetCorAndUncFromMiniAOD(process,isData=isData,
300  fixEE2017 = True,
301  fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139},
302  postfix = "FixEE2017")
303  process.nanoSequenceCommon.insert(process.nanoSequenceCommon.index(jetSequence),process.fullPatMetSequenceFixEE2017)
304 
306  makePuppiesFromMiniAOD(process,True)
307  process.puppiNoLep.useExistingWeights = True
308  process.puppi.useExistingWeights = True
309  run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False)
310  run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False)
311  process = nanoAOD_activateVID(process)
312  nanoAOD_addDeepInfo_switch = cms.PSet(
313  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
314  nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(False),
315  )
316  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepBTag_switch = cms.untracked.bool(True))
317  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
318  modifier.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(True))
319  process = nanoAOD_addDeepInfo(process,
320  addDeepBTag=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepBTag_switch,
321  addDeepFlavour=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepFlavourTag_switch)
322  nanoAOD_addDeepInfoAK8_switch = cms.PSet(
323  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
324  nanoAOD_addDeepBoostedJet_switch = cms.untracked.bool(False),
325  nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False),
326  nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False),
327  nanoAOD_addParticleNet_switch = cms.untracked.bool(False),
328  nanoAOD_addParticleNetMass_switch = cms.untracked.bool(False),
329  jecPayload = cms.untracked.string('AK8PFPuppi')
330  )
331  # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets
332  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfoAK8_switch,
333  nanoAOD_addDeepBTag_switch = True,
334  jecPayload = 'AK8PFchs')
335  # for 94X and 102X samples: needs to run DeepAK8, DeepDoubleX and ParticleNet
336  (run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(
337  nanoAOD_addDeepInfoAK8_switch,
338  nanoAOD_addDeepBoostedJet_switch = True,
339  nanoAOD_addDeepDoubleX_switch = True,
340  nanoAOD_addDeepDoubleXV2_switch = True,
341  nanoAOD_addParticleNet_switch = True,
342  nanoAOD_addParticleNetMass_switch = True,
343  )
344  # for 106Xv1: only needs to run ParticleNet and DDXV2; DeepAK8, DeepDoubleX are already in MiniAOD
345  run2_nanoAOD_106Xv1.toModify(
346  nanoAOD_addDeepInfoAK8_switch,
347  nanoAOD_addDeepDoubleXV2_switch = True,
348  nanoAOD_addParticleNet_switch = True,
349  nanoAOD_addParticleNetMass_switch = True,
350  )
351 
352  run2_nanoAOD_106Xv2.toModify(
353  nanoAOD_addDeepInfoAK8_switch,
354  nanoAOD_addParticleNetMass_switch = True,
355  )
356 
357  process = nanoAOD_addDeepInfoAK8(process,
358  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
359  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
360  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
361  addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
362  addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
363  addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch,
364  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload)
365  (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p))
366  (~(run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)).toModify(process, lambda p : nanoAOD_addBoostedTauIds(p))
367  return process
368 
370  process = nanoAOD_customizeCommon(process)
371  process = nanoAOD_recalibrateMETs(process,isData=True)
372  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
373  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True))
374  return process
375 
376 def nanoAOD_customizeMC(process):
377  process = nanoAOD_customizeCommon(process)
378  process = nanoAOD_recalibrateMETs(process,isData=False)
379  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
380  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False))
381  return process
382 
383 
385  pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)"
386  # Keep precision same as default RECO for selected particles
387  ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
388  process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
389  phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
390  process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
391  etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
392  process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
393  return process
nano_cff.nanoAOD_customizeData
def nanoAOD_customizeData(process)
Definition: nano_cff.py:369
electrons_cff.bool
bool
Definition: electrons_cff.py:366
runMETCorrectionsAndUncertainties.runMetCorAndUncFromMiniAOD
def runMetCorAndUncFromMiniAOD(process, metType="PF", jetCollUnskimmed="slimmedJets", photonColl="slimmedPhotons", electronColl="slimmedElectrons", muonColl="slimmedMuons", tauColl="slimmedTaus", pfCandColl="packedPFCandidates", jetFlavor="AK4PFchs", jetCleaning="LepClean", isData=False, manualJetConfig=False, reclusterJets=None, jetSelection="pt>15 && abs(eta)<9.9", recoMetFromPFCs=None, jetCorLabelL3="ak4PFCHSL1FastL2L3Corrector", jetCorLabelRes="ak4PFCHSL1FastL2L3ResidualCorrector", CHS=False, reapplyJEC=True, jecUncFile="", computeMETSignificance=True, fixEE2017=False, fixEE2017Params=None, extractDeepMETs=False, postfix="")
Definition: runMETCorrectionsAndUncertainties.py:2047
helpers.getPatAlgosToolsTask
def getPatAlgosToolsTask(process)
Definition: helpers.py:13
isotracks_cff
ttbarCategorization_cff
taus_cff
genparticles_cff
genVertex_cff
vid_id_tools.switchOnVIDElectronIdProducer
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
nano_cff.nanoAOD_addTauIds
def nanoAOD_addTauIds(process)
Definition: nano_cff.py:87
pfDeepBoostedJet_cff
particlelevel_cff
lowPtElectrons_cff
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
globals_cff
nano_cff.nanoAOD_recalibrateMETs
def nanoAOD_recalibrateMETs(process, isData)
Definition: nano_cff.py:152
common_cff
vertices_cff
NanoAODEDMEventContent_cff
nano_cff.nanoAOD_addBoostedTauIds
def nanoAOD_addBoostedTauIds(process)
Definition: nano_cff.py:98
photons_cff
puppiForMET_cff.makePuppiesFromMiniAOD
def makePuppiesFromMiniAOD(process, createScheduledSequence=False)
Definition: puppiForMET_cff.py:13
common_cff.Var
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
nano_cff.nanoAOD_customizeMC
def nanoAOD_customizeMC(process)
Definition: nano_cff.py:376
nano_cff.nanoAOD_activateVID
def nanoAOD_activateVID(process)
Definition: nano_cff.py:226
nano_cff.nanoAOD_addDeepInfoAK8
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload)
Definition: nano_cff.py:251
extraflags_cff
nano_cff.nanoAOD_addDeepInfo
def nanoAOD_addDeepInfo(process, addDeepBTag, addDeepFlavour)
Definition: nano_cff.py:116
boostedTaus_cff
genWeightsTable_cfi
jetTools
ak4PFJets_cfi
protons_cff
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
jets_cff
muons_cff
pfParticleNet_cff
nano_cff.nanoWmassGenCustomize
def nanoWmassGenCustomize(process)
increasing the precision of selected GenParticles.
Definition: nano_cff.py:384
helpers
nano_cff.nanoAOD_runMETfixEE2017
def nanoAOD_runMETfixEE2017(process, isData)
Definition: nano_cff.py:298
nano_eras_cff
btagWeightTable_cff
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
format
vid_id_tools
electrons_cff
nano_cff.nanoAOD_addDeepMET
def nanoAOD_addDeepMET(process, addDeepMETProducer, ResponseTune_Graph)
Definition: nano_cff.py:138
triggerObjects_cff
helpers.addToProcessAndTask
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:28
met_cff
nano_cff.nanoAOD_customizeCommon
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:305