CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
nano_cff Namespace Reference

Functions

def nanoAOD_activateVID
 
def nanoAOD_addBoostedTauIds
 
def nanoAOD_addDeepInfo
 
def nanoAOD_addDeepInfoAK8
 
def nanoAOD_addTauIds
 
def nanoAOD_customizeCommon
 
def nanoAOD_customizeData
 
def nanoAOD_customizeMC
 
def nanoAOD_jetForT1met
 
def nanoAOD_recalibrateMETs
 
def nanoAOD_runMETfixEE2017
 
def nanoWmassGenCustomize
 increasing the precision of selected GenParticles. More...
 

Variables

tuple lhcInfoTable
 
tuple linkedObjects
 
tuple nanoMetadata
 
tuple nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
 
tuple nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)
 
tuple nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))
 
tuple nanoSequenceMC = nanoSequenceFS.copy()
 
tuple nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
 
tuple nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
 
tuple nanoTableTaskCommon
 
tuple nanoTableTaskFS
 
tuple simpleCleanerTable
 

Function Documentation

def nano_cff.nanoAOD_activateVID (   process)

Definition at line 212 of file nano_cff.py.

References vid_id_tools.setupAllVIDIdsInModule(), vid_id_tools.switchOnVIDElectronIdProducer(), and vid_id_tools.switchOnVIDPhotonIdProducer().

Referenced by nanoAOD_customizeCommon().

213 def nanoAOD_activateVID(process):
214 
215  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD,electronTask)
216  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
217  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
218 
219  electronTask_ = process.egmGsfElectronIDTask.copy()
220  electronTask_.add(electronTask.copy())
221  process.electronTask = electronTask_.copy()
222  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
223  modifier.toModify(process.electronMVAValueMapProducer, src = "slimmedElectronsUpdated")
224  modifier.toModify(process.egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
225 
226  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD,photonTask) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
227  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
228  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
229 
230  photonTask_ = process.egmPhotonIDTask.copy()
231  photonTask_.add(photonTask.copy())
232  process.photonTask = photonTask_.copy()
233  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016,run2_nanoAOD_102Xv1:
234  modifier.toModify(process.photonMVAValueMapProducer, src = "slimmedPhotonsTo106X")
235  modifier.toModify(process.egmPhotonIDs, physicsObjectSrc = "slimmedPhotonsTo106X")
236  return process
def setupAllVIDIdsInModule
Definition: vid_id_tools.py:49
def switchOnVIDElectronIdProducer
Electrons.
Definition: vid_id_tools.py:66
def switchOnVIDPhotonIdProducer
Photons.
def nanoAOD_activateVID
Definition: nano_cff.py:212
def nano_cff.nanoAOD_addBoostedTauIds (   process)

Definition at line 106 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

107 def nanoAOD_addBoostedTauIds(process):
108  updatedBoostedTauName = "slimmedTausBoostedNewID"
109  boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug=False,
110  originalTauName = "slimmedTausBoosted",
111  updatedTauName = updatedBoostedTauName,
112  postfix="Boosted",
113  toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018",])
114  boostedTauIdEmbedder.runTauID()
115  _boostedTauTask = process.rerunMvaIsolationTaskBoosted.copy()
116  _boostedTauTask.add(getattr(process, updatedBoostedTauName))
117  _boostedTauTask.add(process.finalBoostedTaus)
118 
119  process.boostedTauTask = _boostedTauTask.copy()
120 
121  return process
122 
def nanoAOD_addBoostedTauIds
Definition: nano_cff.py:106
def nano_cff.nanoAOD_addDeepInfo (   process,
  addDeepBTag,
  addDeepFlavour 
)

Definition at line 124 of file nano_cff.py.

References join(), and print().

Referenced by nanoAOD_customizeCommon().

125 def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour):
126  _btagDiscriminators=[]
127  if addDeepBTag:
128  print("Updating process to run DeepCSV btag")
129  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb','pfDeepCSVJetTags:probc']
130  if addDeepFlavour:
131  print("Updating process to run DeepFlavour btag")
132  _btagDiscriminators += ['pfDeepFlavourJetTags:probb','pfDeepFlavourJetTags:probbb','pfDeepFlavourJetTags:problepb','pfDeepFlavourJetTags:probc']
133  if len(_btagDiscriminators)==0: return process
134  print("Will recalculate the following discriminators: "+", ".join(_btagDiscriminators))
135  updateJetCollection(
136  process,
137  jetSource = cms.InputTag('slimmedJets'),
138  jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual']), 'None'),
139  btagDiscriminators = _btagDiscriminators,
140  postfix = 'WithDeepInfo',
141  )
142  process.load("Configuration.StandardSequences.MagneticField_cff")
143  process.jetCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo"
144  process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo"
145  return process
146 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def nanoAOD_addDeepInfo
Definition: nano_cff.py:124
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def nano_cff.nanoAOD_addDeepInfoAK8 (   process,
  addDeepBTag,
  addDeepBoostedJet,
  addDeepDoubleX,
  addDeepDoubleXV2,
  addParticleNet,
  addParticleNetMass,
  jecPayload 
)

Definition at line 237 of file nano_cff.py.

References join(), and print().

Referenced by nanoAOD_customizeCommon().

238 def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload):
239  _btagDiscriminators=[]
240  if addDeepBTag:
241  print("Updating process to run DeepCSV btag to AK8 jets")
242  _btagDiscriminators += ['pfDeepCSVJetTags:probb','pfDeepCSVJetTags:probbb']
243  if addDeepBoostedJet:
244  print("Updating process to run DeepBoostedJet on datasets before 103X")
245  from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll
246  _btagDiscriminators += pfDeepBoostedJetTagsAll
247  if addParticleNet:
248  print("Updating process to run ParticleNet before it's included in MiniAOD")
249  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll
250  _btagDiscriminators += pfParticleNetJetTagsAll
251  if addParticleNetMass:
252  from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs
253  _btagDiscriminators += _pfParticleNetMassRegressionOutputs
254  if addDeepDoubleX:
255  print("Updating process to run DeepDoubleX on datasets before 104X")
256  _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \
257  'pfDeepDoubleCvLJetTags:probHcc', \
258  'pfDeepDoubleCvBJetTags:probHcc', \
259  'pfMassIndependentDeepDoubleBvLJetTags:probHbb', 'pfMassIndependentDeepDoubleCvLJetTags:probHcc', 'pfMassIndependentDeepDoubleCvBJetTags:probHcc']
260  if addDeepDoubleXV2:
261  print("Updating process to run DeepDoubleXv2 on datasets before 11X")
262  _btagDiscriminators += [
263  'pfMassIndependentDeepDoubleBvLV2JetTags:probHbb',
264  'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc',
265  'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc'
266  ]
267  if len(_btagDiscriminators)==0: return process
268  print("Will recalculate the following discriminators on AK8 jets: "+", ".join(_btagDiscriminators))
269  updateJetCollection(
270  process,
271  jetSource = cms.InputTag('slimmedJetsAK8'),
272  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
273  svSource = cms.InputTag('slimmedSecondaryVertices'),
274  rParam = 0.8,
275  jetCorrections = (jecPayload.value(), cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute', 'L2L3Residual']), 'None'),
276  btagDiscriminators = _btagDiscriminators,
277  postfix='AK8WithDeepInfo',
278  printWarning = False
279  )
280  process.jetCorrFactorsAK8.src="selectedUpdatedPatJetsAK8WithDeepInfo"
281  process.updatedJetsAK8.jetSource="selectedUpdatedPatJetsAK8WithDeepInfo"
282  return process
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def nanoAOD_addDeepInfoAK8
Definition: nano_cff.py:237
def nano_cff.nanoAOD_addTauIds (   process)

Definition at line 95 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

95 
96 def nanoAOD_addTauIds(process):
97  updatedTauName = "slimmedTausUpdated"
98  tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName,
99  toKeep = [ "deepTau2017v2p1" ])
100  tauIdEmbedder.runTauID()
101  _tauTask = patTauMVAIDsTask.copy()
102  _tauTask.add(process.rerunMvaIsolationTask)
103  _tauTask.add(finalTaus)
104  process.tauTask = _tauTask.copy()
105  return process
def nanoAOD_addTauIds
Definition: nano_cff.py:95
def nano_cff.nanoAOD_customizeCommon (   process)

Definition at line 318 of file nano_cff.py.

References nanoAOD_activateVID(), nanoAOD_addBoostedTauIds(), nanoAOD_addDeepInfo(), nanoAOD_addDeepInfoAK8(), nanoAOD_addTauIds(), and nanoAOD_jetForT1met().

Referenced by nanoAOD_customizeData(), and nanoAOD_customizeMC().

319 def nanoAOD_customizeCommon(process):
320 
321  process = nanoAOD_jetForT1met(process)
322  process = nanoAOD_activateVID(process)
323  nanoAOD_addDeepInfo_switch = cms.PSet(
324  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
325  nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(False),
326  )
327  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepBTag_switch = cms.untracked.bool(True))
328  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
329  modifier.toModify(nanoAOD_addDeepInfo_switch, nanoAOD_addDeepFlavourTag_switch = cms.untracked.bool(True))
330  process = nanoAOD_addDeepInfo(process,
331  addDeepBTag=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepBTag_switch,
332  addDeepFlavour=nanoAOD_addDeepInfo_switch.nanoAOD_addDeepFlavourTag_switch)
333  nanoAOD_addDeepInfoAK8_switch = cms.PSet(
334  nanoAOD_addDeepBTag_switch = cms.untracked.bool(False),
335  nanoAOD_addDeepBoostedJet_switch = cms.untracked.bool(False),
336  nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False),
337  nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False),
338  nanoAOD_addParticleNet_switch = cms.untracked.bool(False),
339  nanoAOD_addParticleNetMass_switch = cms.untracked.bool(False),
340  jecPayload = cms.untracked.string('AK8PFPuppi')
341  )
342  # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets
343  run2_miniAOD_80XLegacy.toModify(nanoAOD_addDeepInfoAK8_switch,
344  nanoAOD_addDeepBTag_switch = True,
345  jecPayload = 'AK8PFchs')
346  # for 94X and 102X samples: needs to run DeepAK8, DeepDoubleX and ParticleNet
347  (run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(
348  nanoAOD_addDeepInfoAK8_switch,
349  nanoAOD_addDeepBoostedJet_switch = True,
350  nanoAOD_addDeepDoubleX_switch = True,
351  nanoAOD_addDeepDoubleXV2_switch = True,
352  nanoAOD_addParticleNet_switch = True,
353  nanoAOD_addParticleNetMass_switch = True,
354  )
355  # for 106Xv1: only needs to run ParticleNet and DDXV2; DeepAK8, DeepDoubleX are already in MiniAOD
356  run2_nanoAOD_106Xv1.toModify(
357  nanoAOD_addDeepInfoAK8_switch,
358  nanoAOD_addDeepDoubleXV2_switch = True,
359  nanoAOD_addParticleNet_switch = True,
360  nanoAOD_addParticleNetMass_switch = True,
361  )
362 
363  run2_nanoAOD_106Xv2.toModify(
364  nanoAOD_addDeepInfoAK8_switch,
365  nanoAOD_addParticleNetMass_switch = True,
366  )
367 
368  process = nanoAOD_addDeepInfoAK8(process,
369  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
370  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
371  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
372  addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
373  addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
374  addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch,
375  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload)
376  (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p))
377  (~(run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)).toModify(process, lambda p : nanoAOD_addBoostedTauIds(p))
378  return process
def nanoAOD_customizeCommon
Definition: nano_cff.py:318
def nanoAOD_addDeepInfo
Definition: nano_cff.py:124
def nanoAOD_jetForT1met
Definition: nano_cff.py:292
def nanoAOD_activateVID
Definition: nano_cff.py:212
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 nano_cff.nanoAOD_customizeData (   process)

Definition at line 379 of file nano_cff.py.

References nanoAOD_customizeCommon(), nanoAOD_recalibrateMETs(), and nanoAOD_runMETfixEE2017().

380 def nanoAOD_customizeData(process):
381  process = nanoAOD_customizeCommon(process)
382 
383  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
384  modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=True))
385  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
386  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=True))
387  return process
def nanoAOD_customizeCommon
Definition: nano_cff.py:318
def nanoAOD_customizeData
Definition: nano_cff.py:379
def nanoAOD_runMETfixEE2017
Definition: nano_cff.py:284
def nanoAOD_recalibrateMETs
Definition: nano_cff.py:148
def nano_cff.nanoAOD_customizeMC (   process)

Definition at line 388 of file nano_cff.py.

References nanoAOD_customizeCommon(), nanoAOD_recalibrateMETs(), and nanoAOD_runMETfixEE2017().

389 def nanoAOD_customizeMC(process):
390  process = nanoAOD_customizeCommon(process)
391  for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94X2016,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_102Xv1,run2_nanoAOD_106Xv1:
392  modifier.toModify(process, lambda p: nanoAOD_recalibrateMETs(p,isData=False))
393  for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
394  modifier.toModify(process, lambda p: nanoAOD_runMETfixEE2017(p,isData=False))
395  return process
def nanoAOD_customizeCommon
Definition: nano_cff.py:318
def nanoAOD_runMETfixEE2017
Definition: nano_cff.py:284
def nanoAOD_customizeMC
Definition: nano_cff.py:388
def nanoAOD_recalibrateMETs
Definition: nano_cff.py:148
def nano_cff.nanoAOD_jetForT1met (   process)

Definition at line 292 of file nano_cff.py.

References common_cff.Var().

Referenced by nanoAOD_customizeCommon().

293 def nanoAOD_jetForT1met(process):
294  process.basicJetsForMetForT1METNano = cms.EDProducer("PATJetCleanerForType1MET",
295  src = process.updatedJetsWithUserData.src,
296  jetCorrEtaMax = cms.double(9.9),
297  jetCorrLabel = cms.InputTag("L3Absolute"),
298  jetCorrLabelRes = cms.InputTag("L2L3Residual"),
299  offsetCorrLabel = cms.InputTag("L1FastJet"),
300  skipEM = cms.bool(False),
301  skipEMfractionThreshold = cms.double(0.9),
302  skipMuonSelection = cms.string('isGlobalMuon | isStandAloneMuon'),
303  skipMuons = cms.bool(True),
304  type1JetPtThreshold = cms.double(0.0),
305  calcMuonSubtrRawPtAsValueMap = cms.bool(True)
306  )
307 
308  process.jetTask.add(process.basicJetsForMetForT1METNano)
309  process.updatedJetsWithUserData.userFloats.muonSubtrRawPt = cms.InputTag("basicJetsForMetForT1METNano:MuonSubtrRawPt")
310  process.corrT1METJetTable.src = process.finalJets.src
311  process.corrT1METJetTable.cut = "pt<15 && abs(eta)<9.9"
312  process.metTablesTask.add(process.corrT1METJetTable)
313 
314  for table in process.jetTable, process.corrT1METJetTable:
315  table.variables.muonSubtrFactor = Var("1-userFloat('muonSubtrRawPt')/(pt()*jecFactor('Uncorrected'))",float,doc="1-(muon-subtracted raw pt)/(raw pt)",precision=6)
316 
317  return process
def nanoAOD_jetForT1met
Definition: nano_cff.py:292
def nano_cff.nanoAOD_recalibrateMETs (   process,
  isData 
)

Definition at line 148 of file nano_cff.py.

References helpers.addToProcessAndTask(), helpers.getPatAlgosToolsTask(), puppiForMET_cff.makePuppiesFromMiniAOD(), print(), and runMETCorrectionsAndUncertainties.runMetCorAndUncFromMiniAOD().

Referenced by nanoAOD_customizeData(), and nanoAOD_customizeMC().

149 def nanoAOD_recalibrateMETs(process,isData):
150  # add DeepMETs
151  nanoAOD_DeepMET_switch = cms.PSet(
152  ResponseTune_Graph = cms.untracked.string('RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2018.pb')
153  )
154  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
155  modifier.toModify(nanoAOD_DeepMET_switch, ResponseTune_Graph=cms.untracked.string("RecoMET/METPUSubtraction/data/deepmet/deepmet_resp_v1_2016.pb"))
156 
157  print("add DeepMET Producers")
158  process.load('RecoMET.METPUSubtraction.deepMETProducer_cfi')
159  process.deepMETsResolutionTune = process.deepMETProducer.clone()
160  process.deepMETsResponseTune = process.deepMETProducer.clone()
161  process.deepMETsResponseTune.graph_path = nanoAOD_DeepMET_switch.ResponseTune_Graph.value()
162 
163  runMetCorAndUncFromMiniAOD(process,isData=isData)
164  process.nanoSequenceCommon.insert(2,cms.Sequence(process.fullPatMetSequence))
165 
166 
167  from PhysicsTools.PatAlgos.slimming.puppiForMET_cff import makePuppiesFromMiniAOD
168  makePuppiesFromMiniAOD(process,True)
169  process.puppiNoLep.useExistingWeights = True
170  process.puppi.useExistingWeights = True
171  run2_nanoAOD_106Xv1.toModify(process.puppiNoLep, useExistingWeights = False)
172  run2_nanoAOD_106Xv1.toModify(process.puppi, useExistingWeights = False)
173  print("will make Puppies on top of MINIAOD")
174 
175 # makePuppiesFromMiniAOD(process,True) # call this before in the global customizer otherwise it would reset photon IDs in VID
176  nanoAOD_PuppiV15_switch = cms.PSet(
177  recoMetFromPFCs = cms.untracked.bool(False),
178  reclusterJets = cms.untracked.bool(False),
179  )
180  run2_nanoAOD_106Xv1.toModify(nanoAOD_PuppiV15_switch,recoMetFromPFCs=True,reclusterJets=True)
181  if nanoAOD_PuppiV15_switch.reclusterJets:
182  from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
183  from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
184  task = getPatAlgosToolsTask(process)
185  addToProcessAndTask('ak4PuppiJets', ak4PFJets.clone (src = 'puppi', doAreaFastjet = True, jetPtMin = 10.), process, task)
186  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
187  addJetCollection(process,
188  labelName = 'Puppi',
189  jetSource = cms.InputTag('ak4PuppiJets'),
190  algo = 'AK', rParam=0.4,
191  genJetCollection=cms.InputTag('slimmedGenJets'),
192  jetCorrections = ('AK4PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute','L2L3Residual'], 'None'),
193  pfCandidates = cms.InputTag('packedPFCandidates'),
194  pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
195  svSource = cms.InputTag('slimmedSecondaryVertices'),
196  muSource =cms.InputTag( 'slimmedMuons'),
197  elSource = cms.InputTag('slimmedElectrons'),
198  genParticles= cms.InputTag('prunedGenParticles'),
199  getJetMCFlavour= False
200  )
201 
202  process.patJetsPuppi.addGenPartonMatch = cms.bool(False)
203  process.patJetsPuppi.addGenJetMatch = cms.bool(False)
204 
205  print("nanoAOD_PuppiV15_switch.reclusterJets is true")
206 
207  runMetCorAndUncFromMiniAOD(process,isData=isData,metType="Puppi",postfix="Puppi",jetFlavor="AK4PFPuppi", recoMetFromPFCs=bool(nanoAOD_PuppiV15_switch.recoMetFromPFCs), reclusterJets=bool(nanoAOD_PuppiV15_switch.reclusterJets))
208  process.nanoSequenceCommon.insert(2,cms.Sequence(process.puppiMETSequence+process.fullPatMetSequencePuppi))
209 
210  return process
def getPatAlgosToolsTask
Definition: helpers.py:13
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def addToProcessAndTask
Definition: helpers.py:28
def nanoAOD_recalibrateMETs
Definition: nano_cff.py:148
def nano_cff.nanoAOD_runMETfixEE2017 (   process,
  isData 
)

Definition at line 284 of file nano_cff.py.

References runMETCorrectionsAndUncertainties.runMetCorAndUncFromMiniAOD().

Referenced by nanoAOD_customizeData(), and nanoAOD_customizeMC().

285 def nanoAOD_runMETfixEE2017(process,isData):
286  runMetCorAndUncFromMiniAOD(process,isData=isData,
287  fixEE2017 = True,
288  fixEE2017Params = {'userawPt': True, 'ptThreshold':50.0, 'minEtaThreshold':2.65, 'maxEtaThreshold': 3.139},
289  postfix = "FixEE2017")
290  process.nanoSequenceCommon.insert(2,process.fullPatMetSequenceFixEE2017)
291 
def nanoAOD_runMETfixEE2017
Definition: nano_cff.py:284
def nano_cff.nanoWmassGenCustomize (   process)

increasing the precision of selected GenParticles.

Definition at line 397 of file nano_cff.py.

398 def nanoWmassGenCustomize(process):
399  pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)"
400  # Keep precision same as default RECO for selected particles
401  ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
402  process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
403  phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
404  process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
405  etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
406  process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
407  return process
def nanoWmassGenCustomize
increasing the precision of selected GenParticles.
Definition: nano_cff.py:397

Variable Documentation

tuple nano_cff.lhcInfoTable
Initial value:
1 = cms.EDProducer("LHCInfoProducer",
2  precision = cms.int32(10),
3 )

Definition at line 60 of file nano_cff.py.

tuple nano_cff.linkedObjects
Initial value:
1 = cms.EDProducer("PATObjectCrossLinker",
2  jets=cms.InputTag("finalJets"),
3  muons=cms.InputTag("finalMuons"),
4  electrons=cms.InputTag("finalElectrons"),
5  taus=cms.InputTag("finalTaus"),
6  photons=cms.InputTag("finalPhotons"),
7 )

Definition at line 34 of file nano_cff.py.

tuple nano_cff.nanoMetadata
Initial value:
1 = cms.EDProducer("UniqueStringProducer",
2  strings = cms.PSet(
3  tag = cms.string("untagged"),
4  )
5 )

Definition at line 28 of file nano_cff.py.

tuple nano_cff.nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)

Definition at line 80 of file nano_cff.py.

tuple nano_cff.nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)

Definition at line 75 of file nano_cff.py.

tuple nano_cff.nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))

Definition at line 87 of file nano_cff.py.

tuple nano_cff.nanoSequenceMC = nanoSequenceFS.copy()

Definition at line 90 of file nano_cff.py.

tuple nano_cff.nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)

Definition at line 78 of file nano_cff.py.

tuple nano_cff.nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)

Definition at line 77 of file nano_cff.py.

tuple nano_cff.nanoTableTaskCommon
Initial value:
1 = cms.Task(
2  cms.Task(nanoMetadata), jetTask, extraFlagsProducersTask, muonTask, tauTask, boostedTauTask,
3  electronTask , lowPtElectronTask, photonTask,
4  vertexTask, isoTrackTask, jetLepTask, # must be after all the leptons
5  cms.Task(linkedObjects),
6  jetTablesTask, muonTablesTask, tauTablesTask, boostedTauTablesTask,
7  electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
8  globalTablesTask, vertexTablesTask, metTablesTask, simpleCleanerTable, extraFlagsTableTask,
9  isoTrackTablesTask
10  )

Definition at line 64 of file nano_cff.py.

tuple nano_cff.nanoTableTaskFS
Initial value:
1 = cms.Task(genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
2  tauMCTask, boostedTauMCTask,
3  metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, cms.Task(btagWeightTable), ttbarCategoryTableTask,
4  genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, particleLevelTablesTask)

Definition at line 82 of file nano_cff.py.

tuple nano_cff.simpleCleanerTable
Initial value:
1 = cms.EDProducer("NanoAODSimpleCrossCleaner",
2  name=cms.string("cleanmask"),
3  doc=cms.string("simple cleaning mask with priority to leptons"),
4  jets=cms.InputTag("linkedObjects","jets"),
5  muons=cms.InputTag("linkedObjects","muons"),
6  electrons=cms.InputTag("linkedObjects","electrons"),
7  taus=cms.InputTag("linkedObjects","taus"),
8  photons=cms.InputTag("linkedObjects","photons"),
9  jetSel=cms.string("pt>15"),
10  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 )"),
11  electronSel=cms.string(""),
12  tauSel=cms.string(""),
13  photonSel=cms.string(""),
14  jetName=cms.string("Jet"),muonName=cms.string("Muon"),electronName=cms.string("Electron"),
15  tauName=cms.string("Tau"),photonName=cms.string("Photon")
16 )

Definition at line 42 of file nano_cff.py.