CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 nanoTableTaskCommon = cms.Task(
65  cms.Task(nanoMetadata), jetTask, extraFlagsProducersTask, muonTask, tauTask, boostedTauTask,
66  electronTask , lowPtElectronTask, photonTask,
67  vertexTask, isoTrackTask, jetLepTask, # must be after all the leptons
68  cms.Task(linkedObjects),
69  jetTablesTask, muonTablesTask, tauTablesTask, boostedTauTablesTask,
70  electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
71  globalTablesTask, vertexTablesTask, metTablesTask, simpleCleanerTable, extraFlagsTableTask,
72  isoTrackTablesTask
73  )
74 
75 nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)
76 
77 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
78 nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
79 
80 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
81 
82 nanoTableTaskFS = cms.Task(genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
83  tauMCTask, boostedTauMCTask,
84  metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, cms.Task(btagWeightTable), ttbarCategoryTableTask,
85  genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, particleLevelTablesTask)
86 
87 nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))
88 
89 # GenVertex only stored in newer MiniAOD
90 nanoSequenceMC = nanoSequenceFS.copy()
91 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
92 
93 # modifier which adds new tauIDs (currently only deepTauId2017v2p1 is being added)
94 import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
95 def nanoAOD_addTauIds(process):
96  updatedTauName = "slimmedTausUpdated"
97  tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName,
98  toKeep = [ "deepTau2017v2p1" ])
99  tauIdEmbedder.runTauID()
100  _tauTask = patTauMVAIDsTask.copy()
101  _tauTask.add(process.rerunMvaIsolationTask)
102  _tauTask.add(finalTaus)
103  process.tauTask = _tauTask.copy()
104  return process
105 
107  updatedBoostedTauName = "slimmedTausBoostedNewID"
108  boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug=False,
109  originalTauName = "slimmedTausBoosted",
110  updatedTauName = updatedBoostedTauName,
111  postfix="Boosted",
112  toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018",])
113  boostedTauIdEmbedder.runTauID()
114  _boostedTauTask = process.rerunMvaIsolationTaskBoosted.copy()
115  _boostedTauTask.add(getattr(process, updatedBoostedTauName))
116  _boostedTauTask.add(process.finalBoostedTaus)
117 
118  process.boostedTauTask = _boostedTauTask.copy()
119 
120  return process
121 
122 
123 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
124 def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour):
125  _btagDiscriminators=[]
126  if addDeepBTag:
127  print("Updating process to run DeepCSV btag")
128  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb','pfDeepCSVJetTags:probc']
129  if addDeepFlavour:
130  print("Updating process to run DeepFlavour btag")
131  _btagDiscriminators += ['pfDeepFlavourJetTags:probb','pfDeepFlavourJetTags:probbb','pfDeepFlavourJetTags:problepb','pfDeepFlavourJetTags:probc']
132  if len(_btagDiscriminators)==0: return process
133  print("Will recalculate the following discriminators: "+", ".join(_btagDiscriminators))
134  updateJetCollection(
135  process,
136  jetSource = cms.InputTag('slimmedJets'),
137  jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual']), 'None'),
138  btagDiscriminators = _btagDiscriminators,
139  postfix = 'WithDeepInfo',
140  )
141  process.load("Configuration.StandardSequences.MagneticField_cff")
142  process.jetCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo"
143  process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo"
144  return process
145 
146 
147 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
148 def nanoAOD_recalibrateMETs(process,isData):
149  # add DeepMETs
150  nanoAOD_DeepMET_switch = cms.PSet(
151  ResponseTune_Graph = cms.untracked.string('RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb')
152  )
153  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
154  modifier.toModify(nanoAOD_DeepMET_switch, ResponseTune_Graph=cms.untracked.string("RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2016.pb"))
155 
156  print("add DeepMET Producers")
157  process.load('RecoMET.METPUSubtraction.deepMETProducer_cfi')
158  process.deepMETsResolutionTune = process.deepMETProducer.clone()
159  process.deepMETsResponseTune = process.deepMETProducer.clone()
160  process.deepMETsResponseTune.graph_path = nanoAOD_DeepMET_switch.ResponseTune_Graph.value()
161 
162  runMetCorAndUncFromMiniAOD(process,isData=isData)
163  process.nanoSequenceCommon.insert(2,cms.Sequence(process.fullPatMetSequence))
164 
165 
166  from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
167  makePuppiesFromMiniAOD(process,True)
168  process.puppiNoLep.useExistingWeights = True
169  process.puppi.useExistingWeights = True
170  run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False)
171  run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False)
172  print("will make Puppies on top of MINIAOD")
173 
174 # makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
175  nanoAOD_PuppiV15_switch = cms.PSet(
176  recoMetFromPFCs = cms.untracked.bool(False),
177  reclusterJets = cms.untracked.bool(False),
178  )
179  run2_nanoAOD_106Xv1.toModify(nanoAOD_PuppiV15_switch,recoMetFromPFCs=True,reclusterJets=True)
180  if nanoAOD_PuppiV15_switch.reclusterJets:
181  from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
182  from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
183  task = getPatAlgosToolsTask(process)
184  addToProcessAndTask('ak4PuppiJets', ak4PFJets.clone (src = 'puppi', doAreaFastjet = True, jetPtMin = 10.), process, task)
185  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
186  addJetCollection(process,
187  labelName = 'Puppi',
188  jetSource = cms.InputTag('ak4PuppiJets'),
189  algo = 'AK', rParam=0.4,
190  genJetCollection=cms.InputTag('slimmedGenJets'),
191  jetCorrections = ('AK4PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'], 'None'),
192  pfCandidates = cms.InputTag('packedPFCandidates'),
193  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
194  svSource = cms.InputTag('slimmedSecondaryVertices'),
195  muSource =cms.InputTag( 'slimmedMuons'),
196  elSource = cms.InputTag('slimmedElectrons'),
197  genParticles= cms.InputTag('prunedGenParticles'),
198  getJetMCFlavour= False
199  )
200 
201  process.patJetsPuppi.addGenPartonMatch = cms.bool(False)
202  process.patJetsPuppi.addGenJetMatch = cms.bool(False)
203 
204  print("nanoAOD_PuppiV15_switch.reclusterJets is true")
205 
206  runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets))
207  process.nanoSequenceCommon.insert(2,cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
208 
209  return process
210 
212 def nanoAOD_activateVID(process):
213 
214  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD,electronTask)
215  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
216  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
217 
218  electronTask_ = process.egmGsfElectronIDTask.copy()
219  electronTask_.add(electronTask.copy())
220  process.electronTask = electronTask_.copy()
221  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
222  modifier.toModify(process.electronMVAValueMapProducer, src = "slimmedElectronsUpdated")
223  modifier.toModify(process.egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
224 
225  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD,photonTask) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
226  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
227  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
228 
229  photonTask_ = process.egmPhotonIDTask.copy()
230  photonTask_.add(photonTask.copy())
231  process.photonTask = photonTask_.copy()
232  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1:
233  modifier.toModify(process.photonMVAValueMapProducer, src = "slimmedPhotonsTo106X")
234  modifier.toModify(process.egmPhotonIDs, physicsObjectSrc = "slimmedPhotonsTo106X")
235  return process
236 
237 def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload):
238  _btagDiscriminators=[]
239  if addDeepBTag:
240  print("Updating process to run DeepCSV btag to AK8 jets")
241  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb']
242  if addDeepBoostedJet:
243  print("Updating process to run DeepBoostedJet on datasets before 103X")
244  from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll
245  _btagDiscriminators += pfDeepBoostedJetTagsAll
246  if addParticleNet:
247  print("Updating process to run ParticleNet before it's included in MiniAOD")
248  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll
249  _btagDiscriminators += pfParticleNetJetTagsAll
250  if addParticleNetMass:
251  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs
252  _btagDiscriminators += _pfParticleNetMassRegressionOutputs
253  if addDeepDoubleX:
254  print("Updating process to run DeepDoubleX on datasets before 104X")
255  _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \
256  'pfDeepDoubleCvLJetTags:probHcc', \
257  'pfDeepDoubleCvBJetTags:probHcc', \
258  'pfMassIndependentDeepDoubleBvLJetTags:probHbb', 'pfMassIndependentDeepDoubleCvLJetTags:probHcc', 'pfMassIndependentDeepDoubleCvBJetTags:probHcc']
259  if addDeepDoubleXV2:
260  print("Updating process to run DeepDoubleXv2 on datasets before 11X")
261  _btagDiscriminators += [
262  'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb',
263  'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc',
264  'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc'
265  ]
266  if len(_btagDiscriminators)==0: return process
267  print("Will recalculate the following discriminators on AK8 jets: "+", ".join(_btagDiscriminators))
268  updateJetCollection(
269  process,
270  jetSource = cms.InputTag('slimmedJetsAK8'),
271  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
272  svSource = cms.InputTag('slimmedSecondaryVertices'),
273  rParam = 0.8,
274  jetCorrections = (jecPayload.value(), cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual']), 'None'),
275  btagDiscriminators = _btagDiscriminators,
276  postfix='AK8WithDeepInfo',
277  printWarning = False
278  )
279  process.jetCorrFactorsAK8.src="selectedUpdatedPatJetsAK8WithDeepInfo"
280  process.updatedJetsAK8.jetSource="selectedUpdatedPatJetsAK8WithDeepInfo"
281  return process
282 
283 from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncFromMiniAOD
284 def nanoAOD_runMETfixEE2017(process,isData):
285  runMetCorAndUncFromMiniAOD(process,isData=isData,
286  fixEE2017 = True,
287  fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139},
288  postfix = "FixEE2017")
289  process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017)
290 
291 
292 def nanoAOD_jetForT1met(process):
293  process.basicJetsForMetForT1METNano = cms.EDProducer("PATJetCleanerForType1MET",
294  src = process.updatedJetsWithUserData.src,
295  jetCorrEtaMax = cms.double(9.9),
296  jetCorrLabel = cms.InputTag("L3Absolute"),
297  jetCorrLabelRes = cms.InputTag("L2L3Residual"),
298  offsetCorrLabel = cms.InputTag("L1FastJet"),
299  skipEM = cms.bool(False),
300  skipEMfractionThreshold = cms.double(0.9),
301  skipMuonSelection = cms.string('isGlobalMuon | isStandAloneMuon'),
302  skipMuons = cms.bool(True),
303  type1JetPtThreshold = cms.double(0.0),
304  calcMuonSubtrRawPtAsValueMap = cms.bool(True)
305  )
306 
307  process.jetTask.add(process.basicJetsForMetForT1METNano)
308  process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt")
309  process.corrT1METJetTable.src = process.finalJets.src
310  process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9"
311  process.metTablesTask.add(process.corrT1METJetTable)
312 
313  for table in process.jetTable, process.corrT1METJetTable:
314  table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
315 
316  return process
317 
319 
320  process = nanoAOD_jetForT1met(process)
321  process = nanoAOD_activateVID(process)
322  nanoAOD_addDeepInfo_switch = cms.PSet(
323  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
324  nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(False),
325  )
326  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepBTag_switch = cms.untracked.bool(True))
327  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
328  modifier.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(True))
329  process = nanoAOD_addDeepInfo(process,
330  addDeepBTag=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepBTag_switch,
331  addDeepFlavour=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepFlavourTag_switch)
332  nanoAOD_addDeepInfoAK8_switch = cms.PSet(
333  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
334  nanoAOD_addDeepBoostedJet_switch = cms.untracked.bool(False),
335  nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False),
336  nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False),
337  nanoAOD_addParticleNet_switch = cms.untracked.bool(False),
338  nanoAOD_addParticleNetMass_switch = cms.untracked.bool(False),
339  jecPayload = cms.untracked.string('AK8PFPuppi')
340  )
341  # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets
342  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfoAK8_switch,
343  nanoAOD_addDeepBTag_switch = True,
344  jecPayload = 'AK8PFchs')
345  # for 94X and 102X samples: needs to run DeepAK8, DeepDoubleX and ParticleNet
346  (run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(
347  nanoAOD_addDeepInfoAK8_switch,
348  nanoAOD_addDeepBoostedJet_switch = True,
349  nanoAOD_addDeepDoubleX_switch = True,
350  nanoAOD_addDeepDoubleXV2_switch = True,
351  nanoAOD_addParticleNet_switch = True,
352  nanoAOD_addParticleNetMass_switch = True,
353  )
354  # for 106Xv1: only needs to run ParticleNet and DDXV2; DeepAK8, DeepDoubleX are already in MiniAOD
355  run2_nanoAOD_106Xv1.toModify(
356  nanoAOD_addDeepInfoAK8_switch,
357  nanoAOD_addDeepDoubleXV2_switch = True,
358  nanoAOD_addParticleNet_switch = True,
359  nanoAOD_addParticleNetMass_switch = True,
360  )
361 
362  run2_nanoAOD_106Xv2.toModify(
363  nanoAOD_addDeepInfoAK8_switch,
364  nanoAOD_addParticleNetMass_switch = True,
365  )
366 
367  process = nanoAOD_addDeepInfoAK8(process,
368  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
369  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
370  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
371  addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
372  addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
373  addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch,
374  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload)
375  (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p))
376  (~(run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)).toModify(process, lambda p : nanoAOD_addBoostedTauIds(p))
377  return process
378 
380  process = nanoAOD_customizeCommon(process)
381 
382  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
383  modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=True))
384  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
385  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True))
386  return process
387 
388 def nanoAOD_customizeMC(process):
389  process = nanoAOD_customizeCommon(process)
390  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
391  modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=False))
392  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
393  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False))
394  return process
395 
396 ###increasing the precision of selected GenParticles.
398  pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)"
399  # Keep precision same as default RECO for selected particles
400  ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
401  process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
402  phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
403  process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
404  etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
405  process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
406  return process
def setupAllVIDIdsInModule
Definition: vid_id_tools.py:49
def nanoAOD_customizeCommon
Definition: nano_cff.py:318
def switchOnVIDElectronIdProducer
Electrons.
Definition: vid_id_tools.py:66
def getPatAlgosToolsTask
Definition: helpers.py:13
def nanoAOD_customizeData
Definition: nano_cff.py:379
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def nanoAOD_runMETfixEE2017
Definition: nano_cff.py:284
def nanoAOD_addDeepInfo
Definition: nano_cff.py:124
def nanoAOD_jetForT1met
Definition: nano_cff.py:292
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def nanoAOD_customizeMC
Definition: nano_cff.py:388
def switchOnVIDPhotonIdProducer
Photons.
def nanoAOD_activateVID
Definition: nano_cff.py:212
def nanoWmassGenCustomize
increasing the precision of selected GenParticles.
Definition: nano_cff.py:397
def addToProcessAndTask
Definition: helpers.py:28
def nanoAOD_addDeepInfoAK8
Definition: nano_cff.py:237
def nanoAOD_addTauIds
Definition: nano_cff.py:95
def nanoAOD_addBoostedTauIds
Definition: nano_cff.py:106
def nanoAOD_recalibrateMETs
Definition: nano_cff.py:148