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 17 of file jetTools.py.

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

17 def checkJetCorrectionsFormat(jetCorrections):
18  ## check for the correct format
19  if type(jetCorrections) != type(('PAYLOAD-LABEL',['CORRECTION-LEVEL-A','CORRECTION-LEVEL-B'], 'MET-LABEL')):
20  raise ValueError("In addJetCollection: 'jetCorrections' must be 'None' (as a python value w/o quotation marks), or of type ('PAYLOAD-LABEL', ['CORRECTION-LEVEL-A', \
21  '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) \
22  corrections.")
23 
24 
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:17
def jetTools.deprecatedOptionOutputModule (   obj)

Definition at line 1694 of file jetTools.py.

1695  sys.stderr.write("-------------------------------------------------------\n")
1696  sys.stderr.write(" Error: the option 'outputModule' is not supported\n")
1697  sys.stderr.write(" anymore by:\n")
1698  sys.stderr.write(" " + obj._label + "\n")
1699  sys.stderr.write(" please use 'outputModules' now and specify the\n")
1700  sys.stderr.write(" names of all needed OutModules in there\n")
1701  sys.stderr.write(" (default: ['out'])\n")
1702  sys.stderr.write("-------------------------------------------------------\n")
1703  raise KeyError("Unsupported option 'outputModule' used in '"+obj._label+"'")
1704 
def deprecatedOptionOutputModule(obj)
Definition: jetTools.py:1694
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 1721 of file jetTools.py.

Referenced by setupBTagging().

1722  sys.stderr.write("-------------------------------------------------------------------\n")
1723  sys.stderr.write(" Warning: You are attempting to remake the IVF secondary vertices\n")
1724  sys.stderr.write(" already produced by the standard reconstruction. This\n")
1725  sys.stderr.write(" option is not enabled by default so please use it only if\n")
1726  sys.stderr.write(" you know what you are doing.\n")
1727  sys.stderr.write("-------------------------------------------------------------------\n")
1728 
def rerunningIVF()
Definition: jetTools.py:1721
def jetTools.rerunningIVFMiniAOD ( )

Definition at line 1729 of file jetTools.py.

Referenced by setupBTagging().

1730  sys.stderr.write("-------------------------------------------------------------------\n")
1731  sys.stderr.write(" Warning: You are attempting to remake IVF secondary vertices from\n")
1732  sys.stderr.write(" MiniAOD. If that was your intention, note that secondary\n")
1733  sys.stderr.write(" vertices remade from MiniAOD will have somewhat degraded\n")
1734  sys.stderr.write(" performance compared to those remade from RECO/AOD.\n")
1735  sys.stderr.write("-------------------------------------------------------------------\n")
1736 
def rerunningIVFMiniAOD()
Definition: jetTools.py:1729
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 236 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().

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

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

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

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

References setupBTagging().

Referenced by setupBTagging().

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

Definition at line 1705 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode().

1706  sys.stderr.write("-------------------------------------------------------\n")
1707  sys.stderr.write(" Error: the jet 'labelName' is not defined.\n")
1708  sys.stderr.write(" All added jets must have 'labelName' defined.\n")
1709  sys.stderr.write("-------------------------------------------------------\n")
1710  raise KeyError("Undefined jet 'labelName' used in '"+obj._label+"'")
1711 
def undefinedLabelName(obj)
Definition: jetTools.py:1705
def jetTools.unsupportedJetAlgorithm (   obj)

Definition at line 1712 of file jetTools.py.

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

1713  sys.stderr.write("-------------------------------------------------------\n")
1714  sys.stderr.write(" Error: Unsupported jet algorithm detected.\n")
1715  sys.stderr.write(" The supported algorithms are:\n")
1716  for key in supportedJetAlgos.keys():
1717  sys.stderr.write(" " + key.upper() + ", " + key.lower() + ": " + supportedJetAlgos[key] + "\n")
1718  sys.stderr.write("-------------------------------------------------------\n")
1719  raise KeyError("Unsupported jet algorithm used in '"+obj._label+"'")
1720 
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:1712

Variable Documentation

jetTools.supportedJetAlgos

dictionary with supported jet clustering algorithms

Definition at line 11 of file jetTools.py.