CMS 3D CMS Logo

Classes | Functions | Variables
jetTools Namespace Reference

Classes

class  AddJetCollection
 
class  AddJetID
 
class  SetTagInfos
 
class  SwitchJetCollection
 
class  UpdateJetCollection
 

Functions

def checkJetCorrectionsFormat (jetCorrections)
 
def deprecatedOptionOutputModule (obj)
 
def jetAlgo (algo)
 
def rerunningIVF ()
 
def rerunningIVFMiniAOD ()
 
def setupBTagging (process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix)
 
def setupJetCorrections (process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
 
def setupSVClustering (btagInfo, svClustering, algo, rParam, fatJets=cms.InputTag(''), groomedFatJets=cms.InputTag(''))
 
def undefinedLabelName (obj)
 
def unsupportedJetAlgorithm (obj)
 

Variables

 supportedJetAlgos
 dictionary with supported jet clustering algorithms More...
 

Function Documentation

def jetTools.checkJetCorrectionsFormat (   jetCorrections)

Definition at line 16 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

16 def checkJetCorrectionsFormat(jetCorrections):
17  ## check for the correct format
18  if type(jetCorrections) != type(('PAYLOAD-LABEL',['CORRECTION-LEVEL-A','CORRECTION-LEVEL-B'], 'MET-LABEL')):
19  raise ValueError("In addJetCollection: 'jetCorrections' must be 'None' (as a python value w/o quotation marks), or of type ('PAYLOAD-LABEL', ['CORRECTION-LEVEL-A', \
20  'CORRECTION-LEVEL-B', ...], 'MET-LABEL'). Note that 'MET-LABEL' can be set to 'None' (as a string in quotation marks) in case you do not want to apply MET(Type1) \
21  corrections.")
22 
23 
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:16
def jetTools.deprecatedOptionOutputModule (   obj)

Definition at line 1658 of file jetTools.py.

1659  sys.stderr.write("-------------------------------------------------------\n")
1660  sys.stderr.write(" Error: the option 'outputModule' is not supported\n")
1661  sys.stderr.write(" anymore by:\n")
1662  sys.stderr.write(" " + obj._label + "\n")
1663  sys.stderr.write(" please use 'outputModules' now and specify the\n")
1664  sys.stderr.write(" names of all needed OutModules in there\n")
1665  sys.stderr.write(" (default: ['out'])\n")
1666  sys.stderr.write("-------------------------------------------------------\n")
1667  raise KeyError("Unsupported option 'outputModule' used in '"+obj._label+"'")
1668 
def deprecatedOptionOutputModule(obj)
Definition: jetTools.py:1658
def jetTools.jetAlgo (   algo)

Definition at line 3 of file jetTools.py.

3 def jetAlgo( algo ):
4 
5  # print 'PF2PAT: selecting jet algorithm ', algo
6 
7  if algo == 'IC5':
8  import RecoJets.JetProducers.ic5PFJets_cfi as jetConfig
9  jetAlgo = jetConfig.iterativeCone5PFJets.clone()
10  elif algo == 'AK4':
11  import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
12  jetAlgo = jetConfig.ak4PFJets.clone()
13  elif algo == 'AK7':
14  import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
15  jetAlgo = jetConfig.ak4PFJets.clone()
16  jetAlgo.rParam = cms.double(0.7)
17  jetAlgo.doAreaFastjet = cms.bool(False)
18 
19  jetAlgo.src = 'pfNoElectronJME'
20  jetAlgo.doPVCorrection = True
21  jetAlgo.srcPVs = cms.InputTag("goodOfflinePrimaryVertices")
22  return jetAlgo
23 
def jetAlgo(algo)
Definition: jetTools.py:3
def jetTools.rerunningIVF ( )

Definition at line 1685 of file jetTools.py.

Referenced by setupBTagging().

1686  sys.stderr.write("-------------------------------------------------------------------\n")
1687  sys.stderr.write(" Warning: You are attempting to remake the IVF secondary vertices\n")
1688  sys.stderr.write(" already produced by the standard reconstruction. This\n")
1689  sys.stderr.write(" option is not enabled by default so please use it only if\n")
1690  sys.stderr.write(" you know what you are doing.\n")
1691  sys.stderr.write("-------------------------------------------------------------------\n")
1692 
def rerunningIVF()
Definition: jetTools.py:1685
def jetTools.rerunningIVFMiniAOD ( )

Definition at line 1693 of file jetTools.py.

Referenced by setupBTagging().

1694  sys.stderr.write("-------------------------------------------------------------------\n")
1695  sys.stderr.write(" Warning: You are attempting to remake IVF secondary vertices from\n")
1696  sys.stderr.write(" MiniAOD. If that was your intention, note that secondary\n")
1697  sys.stderr.write(" vertices remade from MiniAOD will have somewhat degraded\n")
1698  sys.stderr.write(" performance compared to those remade from RECO/AOD.\n")
1699  sys.stderr.write("-------------------------------------------------------------------\n")
1700 
def rerunningIVFMiniAOD()
Definition: jetTools.py:1693
def jetTools.setupBTagging (   process,
  jetSource,
  pfCandidates,
  explicitJTA,
  pvSource,
  svSource,
  elSource,
  muSource,
  runIVF,
  tightBTagNTkHits,
  loadStdRecoBTag,
  svClustering,
  fatJets,
  groomedFatJets,
  algo,
  rParam,
  btagDiscriminators,
  btagInfos,
  patJets,
  labelName,
  btagPrefix,
  postfix 
)

Definition at line 235 of file jetTools.py.

References helpers.addToProcessAndTask(), any(), clone(), helpers.getPatAlgosToolsTask(), list(), helpers.loadWithPrefix(), rerunningIVF(), rerunningIVFMiniAOD(), and setupSVClustering().

Referenced by setupSVClustering(), jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

235  algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix):
236 
237  task = getPatAlgosToolsTask(process)
238 
239  ## expand tagInfos to what is explicitly required by user + implicit
240  ## requirements that come in from one or the other discriminator
241  requiredTagInfos = list(btagInfos)
242  for btagDiscr in btagDiscriminators :
243  for tagInfoList in supportedBtagDiscr[btagDiscr] :
244  for requiredTagInfo in tagInfoList :
245  tagInfoCovered = False
246  for tagInfo in requiredTagInfos :
247  if requiredTagInfo == tagInfo :
248  tagInfoCovered = True
249  break
250  if not tagInfoCovered :
251  requiredTagInfos.append(requiredTagInfo)
252  ## load sequences and setups needed for btagging
253  if hasattr( process, 'candidateJetProbabilityComputer' ) == False :
254  if loadStdRecoBTag: # also loading modules already run in the standard reconstruction
255  process.load("RecoBTag.ImpactParameter.impactParameter_cff")
256  task.add(process.impactParameterTask)
257  process.load("RecoBTag.SecondaryVertex.secondaryVertex_cff")
258  task.add(process.secondaryVertexTask)
259  process.load("RecoBTag.SoftLepton.softLepton_cff")
260  task.add(process.softLeptonTask)
261  process.load("RecoBTag.Combined.combinedMVA_cff")
262  task.add(process.combinedMVATask)
263  process.load("RecoBTag.CTagging.cTagging_cff")
264  task.add(process.cTaggingTask)
265  else: # to prevent loading of modules already run in the standard reconstruction
266  process.load("RecoBTag.ImpactParameter.impactParameter_EventSetup_cff")
267  process.load("RecoBTag.SecondaryVertex.secondaryVertex_EventSetup_cff")
268  process.load("RecoBTag.SoftLepton.softLepton_EventSetup_cff")
269  process.load("RecoBTag.Combined.combinedMVA_EventSetup_cff")
270  process.load("RecoBTag.CTagging.cTagging_EventSetup_cff")
273 
274  if tightBTagNTkHits:
275  if not runIVF:
276  sys.stderr.write("-------------------------------------------------------------------\n")
277  sys.stderr.write(" Warning: For a complete switch to the legacy tight b-tag track\n")
278  sys.stderr.write(" selection, please also enable the \'runIVF\' switch.\n")
279  sys.stderr.write("-------------------------------------------------------------------\n")
280  if btagPrefix == '':
281  sys.stderr.write("-------------------------------------------------------------------\n")
282  sys.stderr.write(" Warning: With the tight b-tag track selection enabled, it is\n")
283  sys.stderr.write(" advisable to set \'btagPrefix\' to a non-empty string to\n")
284  sys.stderr.write(" avoid unintentional modifications to the default\n")
285  sys.stderr.write(" b tagging setup that might be loaded in the same job.\n")
286  sys.stderr.write("-------------------------------------------------------------------\n")
287 
288  ## define c tagging CvsL SV source (for now tied to the default SV source
289  ## in the first part of the module label, product instance label and process name)
290  svSourceCvsL = copy.deepcopy(svSource)
291  svSourceCvsL.setModuleLabel(svSource.getModuleLabel()+'CvsL')
292 
293  ## check if and under what conditions to re-run IVF
294  runIVFforCTagOnly = False
295  ivfcTagInfos = ['pfInclusiveSecondaryVertexFinderCvsLTagInfos', 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos']
296  ## if MiniAOD and running c tagging
297  if pvSource.getModuleLabel() == 'offlineSlimmedPrimaryVertices' and any(i in requiredTagInfos for i in ivfcTagInfos) and not runIVF:
298  runIVFforCTagOnly = True
299  runIVF = True
300  sys.stderr.write("-------------------------------------------------------------------\n")
301  sys.stderr.write(" Info: To run c tagging on MiniAOD, c-tag-specific IVF secondary\n")
302  sys.stderr.write(" vertices will be remade.\n")
303  sys.stderr.write("-------------------------------------------------------------------\n")
304  ## adjust svSources
305  if runIVF and btagPrefix != '':
306  if runIVFforCTagOnly:
307  svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
308  else:
309  svSource.setModuleLabel(btagPrefix+svSource.getModuleLabel())
310  svSourceCvsL.setModuleLabel(btagPrefix+svSourceCvsL.getModuleLabel())
311 
312  ## setup all required btagInfos : we give a dedicated treatment for different
313  ## types of tagInfos here. A common treatment is possible but might require a more
314  ## general approach anyway in coordination with the btagging POG.
315  acceptedTagInfos = list()
316  for btagInfo in requiredTagInfos:
317  if hasattr(btag,btagInfo):
318  if btagInfo == 'pfImpactParameterTagInfos':
319  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
320  btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
321  process, task)
322  if explicitJTA:
323  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
324  _btagInfo.explicitJTA = cms.bool(explicitJTA)
325  if tightBTagNTkHits:
326  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
327  _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
328  _btagInfo.minimumNumberOfHits = cms.int32(8)
329  if btagInfo == 'pfImpactParameterAK8TagInfos':
330  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
331  btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
332  process, task)
333  if explicitJTA:
334  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
335  _btagInfo.explicitJTA = cms.bool(explicitJTA)
336  if tightBTagNTkHits:
337  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
338  _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
339  _btagInfo.minimumNumberOfHits = cms.int32(8)
340  if btagInfo == 'pfImpactParameterCA15TagInfos':
341  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
342  btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates),
343  process, task)
344  if explicitJTA:
345  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
346  _btagInfo.explicitJTA = cms.bool(explicitJTA)
347  if tightBTagNTkHits:
348  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
349  _btagInfo.minimumNumberOfPixelHits = cms.int32(2)
350  _btagInfo.minimumNumberOfHits = cms.int32(8)
351  if btagInfo == 'pfSecondaryVertexTagInfos':
352  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
353  btag.pfSecondaryVertexTagInfos.clone(
354  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix)),
355  process, task)
356  if tightBTagNTkHits:
357  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
358  _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
359  _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
360  if btagInfo == 'pfDeepCSVTagInfos':
361  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
362  btag.pfDeepCSVTagInfos.clone(
363  svTagInfos = cms.InputTag(btagPrefix+'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
364  process, task)
365  if svClustering or fatJets != cms.InputTag(''):
366  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
367  if btagInfo == 'pfDeepCSVNegativeTagInfos':
368  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
369  btag.pfDeepCSVNegativeTagInfos.clone(
370  svTagInfos = cms.InputTag(btagPrefix+'pfInclusiveSecondaryVertexFinderNegativeTagInfos'+labelName+postfix)),
371  process, task)
372  if svClustering or fatJets != cms.InputTag(''):
373  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
374  if btagInfo == 'pfDeepCSVPositiveTagInfos':
375  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
376  btag.pfDeepCSVPositiveTagInfos.clone(
377  svTagInfos = cms.InputTag(btagPrefix+'pfInclusiveSecondaryVertexFinderTagInfos'+labelName+postfix)),
378  process, task)
379  if svClustering or fatJets != cms.InputTag(''):
380  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
381  if btagInfo == 'pfDeepCMVATagInfos':
382  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
383  btag.pfDeepCMVATagInfos.clone(
384  deepNNTagInfos = cms.InputTag(btagPrefix+'pfDeepCSVTagInfos'+labelName+postfix),
385  ipInfoSrc = cms.InputTag(btagPrefix+"pfImpactParameterTagInfos"+labelName+postfix),
386  muInfoSrc = cms.InputTag(btagPrefix+"softPFMuonsTagInfos"+labelName+postfix),
387  elInfoSrc = cms.InputTag(btagPrefix+"softPFElectronsTagInfos"+labelName+postfix)),
388  process, task)
389  if svClustering or fatJets != cms.InputTag(''):
390  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
391  if btagInfo == 'pfDeepCMVANegativeTagInfos':
392  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
393  btag.pfDeepCMVATagInfos.clone(
394  deepNNTagInfos = cms.InputTag(btagPrefix+'pfDeepCSVTagInfos'+labelName+postfix),
395  ipInfoSrc = cms.InputTag(btagPrefix+"pfImpactParameterTagInfos"+labelName+postfix),
396  muInfoSrc = cms.InputTag(btagPrefix+"softPFMuonsTagInfos"+labelName+postfix),
397  elInfoSrc = cms.InputTag(btagPrefix+"softPFElectronsTagInfos"+labelName+postfix)),
398  process, task)
399  if svClustering or fatJets != cms.InputTag(''):
400  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
401  if btagInfo == 'pfDeepCMVAPositiveTagInfos':
402  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
403  btag.pfDeepCMVATagInfos.clone(
404  deepNNTagInfos = cms.InputTag(btagPrefix+'pfDeepCSVTagInfos'+labelName+postfix),
405  ipInfoSrc = cms.InputTag(btagPrefix+"pfImpactParameterTagInfos"+labelName+postfix),
406  muInfoSrc = cms.InputTag(btagPrefix+"softPFMuonsTagInfos"+labelName+postfix),
407  elInfoSrc = cms.InputTag(btagPrefix+"softPFElectronsTagInfos"+labelName+postfix)),
408  process, task)
409  if svClustering or fatJets != cms.InputTag(''):
410  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
411  if btagInfo == 'pfInclusiveSecondaryVertexFinderTagInfos':
412  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
413  btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(
414  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix),
415  extSVCollection=svSource),
416  process, task)
417  if svClustering or fatJets != cms.InputTag(''):
418  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
419  if btagInfo == 'pfInclusiveSecondaryVertexFinderAK8TagInfos':
420  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
421  btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(
422  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterAK8TagInfos'+labelName+postfix),
423  extSVCollection=svSource),
424  process, task)
425  if svClustering or fatJets != cms.InputTag(''):
426  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
427  if btagInfo == 'pfBoostedDoubleSVAK8TagInfos':
428  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
429  btag.pfBoostedDoubleSVAK8TagInfos.clone(
430  svTagInfos = cms.InputTag(btagPrefix+'pfInclusiveSecondaryVertexFinderAK8TagInfos'+labelName+postfix)),
431  process, task)
432  if btagInfo == 'pfInclusiveSecondaryVertexFinderCA15TagInfos':
433  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
434  btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(
435  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterCA15TagInfos'+labelName+postfix),
436  extSVCollection=svSource),
437  process, task)
438  if svClustering or fatJets != cms.InputTag(''):
439  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
440  if btagInfo == 'pfBoostedDoubleSVCA15TagInfos':
441  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
442  btag.pfBoostedDoubleSVCA15TagInfos.clone(
443  svTagInfos = cms.InputTag(btagPrefix+'pfInclusiveSecondaryVertexFinderCA15TagInfos'+labelName+postfix)),
444  process, task)
445  if btagInfo == 'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
446  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
447  btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
448  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix),
449  extSVCollection=svSourceCvsL),
450  process, task)
451  if svClustering or fatJets != cms.InputTag(''):
452  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
453  if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
454  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
455  btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
456  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix),
457  extSVCollection=svSourceCvsL),
458  process, task)
459  if svClustering or fatJets != cms.InputTag(''):
460  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
461  if btagInfo == 'pfGhostTrackVertexTagInfos':
462  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
463  btag.pfGhostTrackVertexTagInfos.clone(
464  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix)),
465  process, task)
466  if btagInfo == 'pfSecondaryVertexNegativeTagInfos':
467  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
468  btag.pfSecondaryVertexNegativeTagInfos.clone(
469  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix)),
470  process, task)
471  if tightBTagNTkHits:
472  _btagInfo = getattr(process, btagPrefix+btagInfo+labelName+postfix)
473  _btagInfo.trackSelection.pixelHitsMin = cms.uint32(2)
474  _btagInfo.trackSelection.totalHitsMin = cms.uint32(8)
475  if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
476  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
477  btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(
478  trackIPTagInfos = cms.InputTag(btagPrefix+'pfImpactParameterTagInfos'+labelName+postfix),
479  extSVCollection=svSource),
480  process, task)
481  if svClustering or fatJets != cms.InputTag(''):
482  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
483  if btagInfo == 'impactParameterTagInfos':
484  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
485  btag.impactParameterTagInfos.clone(
486  jetTracks = cms.InputTag('jetTracksAssociatorAtVertex'+labelName+postfix),
487  primaryVertex=pvSource),
488  process, task)
489  if btagInfo == 'secondaryVertexTagInfos':
490  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
491  btag.secondaryVertexTagInfos.clone(
492  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
493  process, task)
494  if btagInfo == 'inclusiveSecondaryVertexFinderTagInfos':
495  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
496  btag.inclusiveSecondaryVertexFinderTagInfos.clone(
497  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
498  process, task)
499  if svClustering or fatJets != cms.InputTag(''):
500  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
501  if btagInfo == 'inclusiveSecondaryVertexFinderFilteredTagInfos':
502  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
503  btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(
504  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
505  process, task)
506  if svClustering or fatJets != cms.InputTag(''):
507  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
508  if btagInfo == 'secondaryVertexNegativeTagInfos':
509  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
510  btag.secondaryVertexNegativeTagInfos.clone(
511  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
512  process, task)
513  if btagInfo == 'inclusiveSecondaryVertexFinderNegativeTagInfos':
514  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
515  btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(
516  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
517  process, task)
518  if svClustering or fatJets != cms.InputTag(''):
519  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
520  if btagInfo == 'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
521  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
522  btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(
523  trackIPTagInfos = cms.InputTag(btagPrefix+'impactParameterTagInfos'+labelName+postfix)),
524  process, task)
525  if svClustering or fatJets != cms.InputTag(''):
526  setupSVClustering(getattr(process, btagPrefix+btagInfo+labelName+postfix), svClustering, algo, rParam, fatJets, groomedFatJets)
527  if btagInfo == 'softMuonTagInfos':
528  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
529  btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource),
530  process, task)
531  if btagInfo == 'softPFMuonsTagInfos':
532  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
533  btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource),
534  process, task)
535  if btagInfo == 'softPFElectronsTagInfos':
536  addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
537  btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource),
538  process, task)
539  acceptedTagInfos.append(btagInfo)
540  elif hasattr(toptag, btagInfo) :
541  acceptedTagInfos.append(btagInfo)
542  else:
543  print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
544  ## setup all required btagDiscriminators
545  acceptedBtagDiscriminators = list()
546  for discriminator_name in btagDiscriminators :
547  btagDiscr = discriminator_name.split(':')[0] #split input tag to get the producer label
548  #print discriminator_name, '-->', btagDiscr
549  if hasattr(btag,btagDiscr):
550  newDiscr = btagPrefix+btagDiscr+labelName+postfix #new discriminator name
551  if hasattr(process, newDiscr):
552  pass
553  elif hasattr(getattr(btag, btagDiscr), 'tagInfos'):
555  newDiscr,
556  getattr(btag, btagDiscr).clone(
557  tagInfos = cms.VInputTag(
558  *[ cms.InputTag(btagPrefix+x+labelName+postfix) \
559  for x in supportedBtagDiscr[discriminator_name][0] ]
560  )
561  ),
562  process,
563  task
564  )
565  elif hasattr(getattr(btag, btagDiscr), 'src'):
567  newDiscr,
568  getattr(btag, btagDiscr).clone(
569  src = cms.InputTag(btagPrefix+supportedBtagDiscr[discriminator_name][0][0]+labelName+postfix)
570  ),
571  process,
572  task
573  )
574  else:
575  raise ValueError('I do not know how to update %s it does not have neither "tagInfos" nor "src" attributes' % btagDiscr)
576  acceptedBtagDiscriminators.append(discriminator_name)
577  else:
578  print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
579  ## replace corresponding tags for pat jet production
580  patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(btagPrefix+x+labelName+postfix) for x in acceptedTagInfos ] )
581  patJets.discriminatorSources = cms.VInputTag(*[
582  cms.InputTag(btagPrefix+x+labelName+postfix) \
583  if ':' not in x else \
584  cms.InputTag(btagPrefix+x.split(':')[0]+labelName+postfix+':'+x.split(':')[1]) \
585  for x in acceptedBtagDiscriminators
586  ])
587  if len(acceptedBtagDiscriminators) > 0 :
588  patJets.addBTagInfo = True
589  ## if re-running IVF
590  if runIVF:
591  if not tightBTagNTkHits:
592  if pvSource.getModuleLabel() == 'offlineSlimmedPrimaryVertices': ## MiniAOD case
593  if not runIVFforCTagOnly: rerunningIVFMiniAOD()
594  else:
595  rerunningIVF()
596  from PhysicsTools.PatAlgos.tools.helpers import loadWithPrefix
597  ivfbTagInfos = ['pfInclusiveSecondaryVertexFinderTagInfos', 'pfInclusiveSecondaryVertexFinderAK8TagInfos', 'pfInclusiveSecondaryVertexFinderCA15TagInfos']
598  if any(i in acceptedTagInfos for i in ivfbTagInfos) and not runIVFforCTagOnly:
599  if not hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ):
600  loadWithPrefix(process, 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
601  if tightBTagNTkHits:
602  if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ):
603  _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinder')
604  _temp.minHits = cms.uint32(8)
605  ## MiniAOD case
606  if pvSource.getModuleLabel() == 'offlineSlimmedPrimaryVertices':
607  if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinder' ):
608  _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinder')
609  _temp.primaryVertices = pvSource
610  _temp.tracks = pfCandidates
611  if hasattr( process, btagPrefix+'candidateVertexArbitrator' ):
612  _temp = getattr(process, btagPrefix+'candidateVertexArbitrator')
613  _temp.primaryVertices = pvSource
614  _temp.tracks = pfCandidates
615  if hasattr( process, btagPrefix+'inclusiveCandidateSecondaryVertices' ) and not hasattr( process, svSource.getModuleLabel() ):
616  addToProcessAndTask(svSource.getModuleLabel(),
617  getattr(process, btagPrefix+'inclusiveCandidateSecondaryVertices').clone(),
618  process, task)
619  if any(i in acceptedTagInfos for i in ivfcTagInfos):
620  if not hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ):
621  loadWithPrefix(process, 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff', btagPrefix, task.label())
622  if tightBTagNTkHits:
623  if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ):
624  _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinderCvsL')
625  _temp.minHits = cms.uint32(8)
626  ## MiniAOD case
627  if pvSource.getModuleLabel() == 'offlineSlimmedPrimaryVertices':
628  if hasattr( process, btagPrefix+'inclusiveCandidateVertexFinderCvsL' ):
629  _temp = getattr(process, btagPrefix+'inclusiveCandidateVertexFinderCvsL')
630  _temp.primaryVertices = pvSource
631  _temp.tracks = pfCandidates
632  if hasattr( process, btagPrefix+'candidateVertexArbitratorCvsL' ):
633  _temp = getattr(process, btagPrefix+'candidateVertexArbitratorCvsL')
634  _temp.primaryVertices = pvSource
635  _temp.tracks = pfCandidates
636  if hasattr( process, btagPrefix+'inclusiveCandidateSecondaryVerticesCvsL' ) and not hasattr( process, svSourceCvsL.getModuleLabel() ):
637  addToProcessAndTask(svSourceCvsL.getModuleLabel(),
638  getattr(process, btagPrefix+'inclusiveCandidateSecondaryVerticesCvsL').clone(),
639  process, task)
640  if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
641  if not hasattr( process, 'inclusiveVertexing' ):
642  process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
643  task.add(process.inclusiveVertexingTask)
644  task.add(process.inclusiveCandidateVertexingTask)
645  task.add(process.inclusiveCandidateVertexingCvsLTask)
646  if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
647  if not hasattr( process, 'inclusiveVertexing' ):
648  process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
649  task.add(process.inclusiveVertexingTask)
650  task.add(process.inclusiveCandidateVertexingTask)
651  task.add(process.inclusiveCandidateVertexingCvsLTask)
652  if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
653  if not hasattr( process, 'inclusiveSecondaryVerticesFiltered' ):
654  process.load( 'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
655  task.add(process.inclusiveSecondaryVerticesFiltered)
656  task.add(process.bVertexFilter)
657  if not hasattr( process, 'bToCharmDecayVertexMerged' ):
658  process.load( 'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
659  task.add(process.bToCharmDecayVertexMerged)
660  if 'caTopTagInfos' in acceptedTagInfos :
661  patJets.addTagInfos = True
662  if not hasattr( process, 'caTopTagInfos' ) and not hasattr( process, 'caTopTagInfosAK8' ):
663  process.load( 'RecoJets.JetProducers.caTopTaggers_cff' )
664  task.add(process.caTopTaggersTask)
665 
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:27
def setupSVClustering(btagInfo, svClustering, algo, rParam, fatJets=cms.InputTag(''), groomedFatJets=cms.InputTag(''))
Definition: jetTools.py:223
def loadWithPrefix(process, moduleName, prefix='', loadedProducersAndFilters=None)
Definition: helpers.py:42
def rerunningIVF()
Definition: jetTools.py:1685
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def rerunningIVFMiniAOD()
Definition: jetTools.py:1693
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def jetTools.setupJetCorrections (   process,
  knownModules,
  jetCorrections,
  jetSource,
  pvSource,
  patJets,
  labelName,
  postfix 
)

Definition at line 24 of file jetTools.py.

References helpers.addToProcessAndTask(), clone(), KineDebug3.count(), helpers.getPatAlgosToolsTask(), and split.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

24 def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix):
25 
26  task = getPatAlgosToolsTask(process)
27 
28  ## determine type of jet constituents from jetSource; supported
29  ## jet constituent types are calo, pf, jpt, for pf also particleflow
30  ## is aloowed as part of the jetSource label, which might be used
31  ## in CommonTools.ParticleFlow
32  _type="NONE"
33  if jetCorrections[0].count('PF')>0:
34  _type='PF'
35  elif jetCorrections[0].count('Calo')>0:
36  _type='Calo'
37  elif jetCorrections[0].count('JPT')>0:
38  _type='JPT'
39  else:
40  raise TypeError("In addJetCollection: Jet energy corrections are only supported for PF, JPT and Calo jets.")
41  from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import patJetCorrFactors
42  if 'patJetCorrFactors'+labelName+postfix in knownModules :
43  _newPatJetCorrFactors=getattr(process, 'patJetCorrFactors'+labelName+postfix)
44  _newPatJetCorrFactors.src=jetSource
45  _newPatJetCorrFactors.primaryVertices=pvSource
46  else:
47  addToProcessAndTask('patJetCorrFactors'+labelName+postfix,
48  patJetCorrFactors.clone(src=jetSource, primaryVertices=pvSource),
49  process, task)
50  _newPatJetCorrFactors=getattr(process, "patJetCorrFactors"+labelName+postfix)
51  _newPatJetCorrFactors.payload=jetCorrections[0]
52  _newPatJetCorrFactors.levels=jetCorrections[1]
53  ## check whether L1Offset or L1FastJet is part of levels
54  error=False
55  for x in jetCorrections[1]:
56  if x == 'L1Offset' :
57  if not error :
58  _newPatJetCorrFactors.useNPV=True
59  _newPatJetCorrFactors.primaryVertices='offlinePrimaryVertices'
60  _newPatJetCorrFactors.useRho=False
61  ## we set this to True now as a L1 correction type should appear only once
62  ## otherwise levels is miss configured
63  error=True
64  else:
65  raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \
66  once. Check the list of correction levels you requested to be applied: ", jetCorrections[1]
67  if x == 'L1FastJet' :
68  if not error :
69  if _type == "JPT" :
70  raise TypeError("In addJetCollection: L1FastJet corrections are only supported for PF and Calo jets.")
71  ## configure module
72  _newPatJetCorrFactors.useRho=True
73  if "PF" in _type :
74  _newPatJetCorrFactors.rho=cms.InputTag('fixedGridRhoFastjetAll')
75  else :
76  _newPatJetCorrFactors.rho=cms.InputTag('fixedGridRhoFastjetAllCalo')
77  ## we set this to True now as a L1 correction type should appear only once
78  ## otherwise levels is miss configured
79  error=True
80  else:
81  raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \
82  once. Check the list of correction levels you requested to be applied: ", jetCorrections[1]
83  patJets.jetCorrFactorsSource=cms.VInputTag(cms.InputTag('patJetCorrFactors'+labelName+postfix))
84  ## configure MET(Type1) corrections
85  if jetCorrections[2].lower() != 'none' and jetCorrections[2] != '':
86  if not jetCorrections[2].lower() == 'type-1' and not jetCorrections[2].lower() == 'type-2':
87  raise valueError, "In addJetCollection: Wrong choice of MET corrections for new jet collection. Possible choices are None (or empty string), Type-1, Type-2 (i.e.\
88  Type-1 and Type-2 corrections applied). This choice is not case sensitive. Your choice was: ", jetCorrections[2]
89  if _type == "JPT":
90  raise ValueError("In addJecCollection: MET(type1) corrections are not supported for JPTJets. Please set the MET-LABEL to \"None\" (as string in quatiation \
91  marks) and use raw tcMET together with JPTJets.")
92  ## set up jet correctors for MET corrections
93  process.load( "JetMETCorrections.Configuration.JetCorrectorsAllAlgos_cff") # FIXME: This adds a lot of garbage
94  # I second the FIXME comment on the last line. When I counted it, this brought in 344 EDProducers
95  # to be available to run unscheduled. All jet correctors, probably some small fraction of which
96  # are actually used.
97  task.add(process.jetCorrectorsAllAlgosTask)
98  _payloadType = jetCorrections[0].split(_type)[0].lower()+_type
99  if "PF" in _type :
100  addToProcessAndTask(jetCorrections[0]+'L1FastJet',
101  getattr(process, _payloadType+'L1FastjetCorrector').clone(srcRho=cms.InputTag('fixedGridRhoFastjetAll')),
102  process, task)
103  else :
104  addToProcessAndTask(jetCorrections[0]+'L1FastJet',
105  getattr(process, _payloadType+'L1FastjetCorrector').clone(srcRho=cms.InputTag('fixedGridRhoFastjetAllCalo')),
106  process, task)
107  addToProcessAndTask(jetCorrections[0]+'L1Offset', getattr(process, _payloadType+'L1OffsetCorrector').clone(), process, task)
108  addToProcessAndTask(jetCorrections[0]+'L2Relative', getattr(process, _payloadType+'L2RelativeCorrector').clone(), process, task)
109  addToProcessAndTask(jetCorrections[0]+'L3Absolute', getattr(process, _payloadType+'L3AbsoluteCorrector').clone(), process, task)
110  addToProcessAndTask(jetCorrections[0]+'L2L3Residual', getattr(process, _payloadType+'ResidualCorrector').clone(), process, task)
111  addToProcessAndTask(jetCorrections[0]+'CombinedCorrector',
112  cms.EDProducer( 'ChainedJetCorrectorProducer', correctors = cms.VInputTag()),
113  process, task)
114  for x in jetCorrections[1]:
115  if x != 'L1FastJet' and x != 'L1Offset' and x != 'L2Relative' and x != 'L3Absolute' and x != 'L2L3Residual':
116  raise ValueError('In addJetCollection: Unsupported JEC for MET(Type1). Currently supported jet correction levels are L1FastJet, L1Offset, L2Relative, L3Asolute, L2L3Residual. Requested was: %s'%(x))
117  else:
118  _corrector = _payloadType
119  if x == 'L1FastJet':
120  _corrector += 'L1Fastjet'
121  elif x == 'L2L3Residual':
122  _corrector += 'Residual'
123  else:
124  _corrector += x
125  _corrector += 'Corrector'
126  getattr(process, jetCorrections[0]+'CombinedCorrector').correctors.append(cms.InputTag(_corrector))
127 
128  ## set up MET(Type1) correction modules
129  _labelCorrName = labelName
130  if labelName != '':
131  _labelCorrName = 'For' + labelName
132  if _type == 'Calo':
133  from JetMETCorrections.Type1MET.correctionTermsCaloMet_cff import corrCaloMetType1
134  from JetMETCorrections.Type1MET.correctionTermsCaloMet_cff import corrCaloMetType2
135  from JetMETCorrections.Type1MET.correctedMet_cff import caloMetT1
136  from JetMETCorrections.Type1MET.correctedMet_cff import caloMetT1T2
138  jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix,
139  corrCaloMetType1.clone(src=jetSource,srcMET = "caloMetM",jetCorrLabel = cms.InputTag(jetCorrections[0]+'CombinedCorrector')),
140  process, task)
142  jetCorrections[0]+_labelCorrName+'JetMETcorr2'+postfix,
143  corrCaloMetType2.clone(srcUnclEnergySums = cms.VInputTag(
144  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type2'),
145  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'offset'),
146  cms.InputTag('muCaloMetCorr'))),
147  process, task)
149  jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix,
150  caloMetT1.clone(src = "caloMetM", srcCorrections = cms.VInputTag(
151  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'))),
152  process, task)
153  addToProcessAndTask(jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix,
154  caloMetT1T2.clone(src = "caloMetM", srcCorrections = cms.VInputTag(
155  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'),
156  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr2'+postfix))),
157  process, task)
158  elif _type == 'PF':
160  from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import pfCandsNotInJetsPtrForMetCorr
161  from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import pfCandsNotInJetsForMetCorr
165  from JetMETCorrections.Type1MET.correctedMet_cff import pfMetT1
166  from JetMETCorrections.Type1MET.correctedMet_cff import pfMetT1T2
167  addToProcessAndTask(jetCorrections[0]+_labelCorrName+'pfJetsPtrForMetCorr'+postfix,
168  pfJetsPtrForMetCorr.clone(src = jetSource), process, task)
170  jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsPtrForMetCorr'+postfix,
171  pfCandsNotInJetsPtrForMetCorr.clone(topCollection = jetCorrections[0]+_labelCorrName+'pfJetsPtrForMetCorr'+postfix),
172  process, task)
174  jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsForMetCorr'+postfix,
175  pfCandsNotInJetsForMetCorr.clone(src = jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsPtrForMetCorr'+postfix),
176  process, task)
178  jetCorrections[0]+_labelCorrName+'CandMETcorr'+postfix,
179  pfCandMETcorr.clone(src = cms.InputTag(jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsForMetCorr'+postfix)),
180  process, task)
182  jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix,
183  corrPfMetType1.clone(src = jetSource, jetCorrLabel = cms.InputTag(jetCorrections[0]+'CombinedCorrector')),
184  process, task) # FIXME: Originally w/o jet corrections?
185  addToProcessAndTask(jetCorrections[0]+_labelCorrName+'corrPfMetType2'+postfix,
186  corrPfMetType2.clone(srcUnclEnergySums = cms.VInputTag(
187  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type2'),
188  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'offset'),
189  cms.InputTag(jetCorrections[0]+_labelCorrName+'CandMETcorr'+postfix))),
190  process, task)
191  addToProcessAndTask(jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix,
192  pfMetT1.clone(srcCorrections = cms.VInputTag(
193  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'))),
194  process, task)
195  addToProcessAndTask(jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix,
196  pfMetT1T2.clone(srcCorrections = cms.VInputTag(
197  cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'),
198  jetCorrections[0]+_labelCorrName+'corrPfMetType2'+postfix)),
199  process, task)
200 
201  ## common configuration for Calo and PF
202  if ('L1FastJet' in jetCorrections[1] or 'L1Fastjet' in jetCorrections[1]):
203  getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag(jetCorrections[0]+'L1FastJet')
204  #FIXME: What is wrong here?
205  #elif ('L1Offset' in jetCorrections[1]):
206  #getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag(jetCorrections[0]+'L1Offset')
207  else:
208  getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag('')
209 
211  if jetCorrections[2].lower() == 'type-1':
212  addToProcessAndTask('patMETs'+labelName+postfix,
213  patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix),
214  addMuonCorrections = False),
215  process, task)
216  elif jetCorrections[2].lower() == 'type-2':
217  addToProcessAndTask('patMETs'+labelName+postfix,
218  patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix),
219  addMuonCorrections = False),
220  process, task)
221 
222 
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:27
def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
Definition: jetTools.py:24
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
double split
Definition: MVATrainer.cc:139
def jetTools.setupSVClustering (   btagInfo,
  svClustering,
  algo,
  rParam,
  fatJets = cms.InputTag(''),
  groomedFatJets = cms.InputTag('') 
)

Definition at line 223 of file jetTools.py.

References setupBTagging().

Referenced by setupBTagging().

223 def setupSVClustering(btagInfo, svClustering, algo, rParam, fatJets=cms.InputTag(''), groomedFatJets=cms.InputTag('')):
224  btagInfo.useSVClustering = cms.bool(svClustering)
225  btagInfo.jetAlgorithm = cms.string(algo)
226  btagInfo.rParam = cms.double(rParam)
227  ## if the jet is actually a subjet
228  if fatJets != cms.InputTag(''):
229  btagInfo.fatJets = fatJets
230  if groomedFatJets != cms.InputTag(''):
231  btagInfo.groomedFatJets = groomedFatJets
232 
233 
def setupSVClustering(btagInfo, svClustering, algo, rParam, fatJets=cms.InputTag(''), groomedFatJets=cms.InputTag(''))
Definition: jetTools.py:223
def jetTools.undefinedLabelName (   obj)

Definition at line 1669 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode().

1670  sys.stderr.write("-------------------------------------------------------\n")
1671  sys.stderr.write(" Error: the jet 'labelName' is not defined.\n")
1672  sys.stderr.write(" All added jets must have 'labelName' defined.\n")
1673  sys.stderr.write("-------------------------------------------------------\n")
1674  raise KeyError("Undefined jet 'labelName' used in '"+obj._label+"'")
1675 
def undefinedLabelName(obj)
Definition: jetTools.py:1669
def jetTools.unsupportedJetAlgorithm (   obj)

Definition at line 1676 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

1677  sys.stderr.write("-------------------------------------------------------\n")
1678  sys.stderr.write(" Error: Unsupported jet algorithm detected.\n")
1679  sys.stderr.write(" The supported algorithms are:\n")
1680  for key in supportedJetAlgos.keys():
1681  sys.stderr.write(" " + key.upper() + ", " + key.lower() + ": " + supportedJetAlgos[key] + "\n")
1682  sys.stderr.write("-------------------------------------------------------\n")
1683  raise KeyError("Unsupported jet algorithm used in '"+obj._label+"'")
1684 
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:1676

Variable Documentation

jetTools.supportedJetAlgos

dictionary with supported jet clustering algorithms

Definition at line 10 of file jetTools.py.