CMS 3D CMS Logo

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

Functions

def muonRecoMitigation
 

Function Documentation

def muonRecoMitigation.muonRecoMitigation (   process,
  pfCandCollection,
  runOnMiniAOD,
  selection = "",
  muonCollection = "",
  cleanCollName = "cleanMuonsPFCandidates",
  cleaningScheme = "all",
  postfix = "" 
)

Definition at line 14 of file muonRecoMitigation.py.

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

14 
15  postfix=""):
16 
17  task = getPatAlgosToolsTask(process)
18 
19  sequence=cms.Sequence()
20 
21  if selection=="":
22  typeFix=""
23 
24  if runOnMiniAOD:
25  from RecoMET.METFilters.badGlobalMuonTaggersMiniAOD_cff import badGlobalMuonTaggerMAOD, cloneGlobalMuonTaggerMAOD
26  typeFix="MAOD"
27  badMuModule=badGlobalMuonTaggerMAOD
28  cloneMuModule=cloneGlobalMuonTaggerMAOD
29  else:
30  from RecoMET.METFilters.badGlobalMuonTaggersAOD_cff import badGlobalMuonTagger, cloneGlobalMuonTagger
31  badMuModule=badGlobalMuonTagger
32  cloneMuModule=cloneGlobalMuonTagger
33 
34  vtags=cms.VInputTag()
35  if cleaningScheme in ["bad","all","computeAllApplyBad","computeAllApplyClone"]:
36  addToProcessAndTask('badGlobalMuonTagger'+typeFix+postfix, badMuModule.clone(), process, task )
37  sequence +=getattr(process,"badGlobalMuonTagger"+typeFix+postfix)
38  if cleaningScheme in ["bad","computeAllApplyBad"]:
39  badMuonCollection = 'badGlobalMuonTagger'+typeFix+postfix+':bad'
40  if cleaningScheme in ["clone","duplicated","all","computeAllApplyBad","computeAllApplyClone"]:
41  addToProcessAndTask('cloneGlobalMuonTagger'+typeFix+postfix, cloneMuModule.clone(), process, task )
42  sequence +=getattr(process,"cloneGlobalMuonTagger"+typeFix+postfix)
43  if cleaningScheme in ["clone","duplicated","computeAllApplyClone"]:
44  badMuonCollection = 'cloneGlobalMuonTagger'+typeFix+postfix+':bad'
45 
46  if cleaningScheme=="all":
47  badMuonCollection="badMuons"+postfix
48  badMuonProducer = cms.EDProducer(
49  "CandViewMerger",
50  src = cms.VInputTag(
51  cms.InputTag('badGlobalMuonTagger'+typeFix+postfix,'bad'),
52  cms.InputTag('cloneGlobalMuonTagger'+typeFix+postfix,'bad'),
53  )
54  )
55  addToProcessAndTask(badMuonCollection, badMuonProducer, process, task)
56  sequence +=getattr(process, badMuonCollection )
57  else:
58  badMuonCollection="badMuons"+postfix
59  badMuonModule = cms.EDFilter("CandViewSelector",
60  src = cms.InputTag(muonCollection),
61  cut = cms.string(selection)
62  )
63 
64  # now cleaning ================================
65  cleanedPFCandCollection=cleanCollName+postfix
66 
67  if runOnMiniAOD:
68  import CommonTools.CandAlgos.candPtrProjector_cfi as _mod
69  cleanedPFCandProducer = _mod.candPtrProjector.clone(
70  src = pfCandCollection,
71  veto = badMuonCollection
72  )
73  else:
74  cleanedPFCandProducer = cms.EDProducer("PFCandPtrProjector",
75  src = cms.InputTag(pfCandCollection),
76  veto = cms.InputTag(badMuonCollection)
77  )
78 
79  addToProcessAndTask(cleanedPFCandCollection, cleanedPFCandProducer, process, task)
80  sequence +=getattr(process, cleanedPFCandCollection )
81 
82  return sequence
def getPatAlgosToolsTask
Definition: helpers.py:13
def addToProcessAndTask
Definition: helpers.py:28