test
CMS 3D CMS Logo

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

Functions

def customise
 

Function Documentation

def embeddingCustomizePF.customise (   process,
  inputProcess 
)

Definition at line 6 of file embeddingCustomizePF.py.

6 
7 def customise(process, inputProcess):
8 
9  process.particleFlowORG = process.particleFlow.clone()
10 
11  # Since CMSSW 4_4 the particleFlow reco works a bit differently. The step is
12  # twofold, first particleFlowTmp is created and then the final particleFlow
13  # collection. What we do in this case is that we merge the final ParticleFlow
14  # collection. For the muon reconstruction, we also merge particleFlowTmp in
15  # order to get PF-based isolation right.
16  if hasattr(process, 'particleFlowTmp'):
17  process.particleFlowTmpMixed = cms.EDProducer('PFCandidateMixer',
18  col1 = cms.untracked.InputTag("cleanedParticleFlow"),
19  col2 = cms.untracked.InputTag("particleFlowTmp", ""),
20  trackCol = cms.untracked.InputTag("generalTracks"),
21 
22  # Don't produce value maps:
23  muons = cms.untracked.InputTag(""),
24  gsfElectrons = cms.untracked.InputTag("")
25  )
26  process.muons.PFCandidates = cms.InputTag("particleFlowTmpMixed")
27 
28  for p in process.paths:
29  pth = getattr(process,p)
30  if "particleFlow" in pth.moduleNames():
31  pth.replace(process.particleFlow, process.particleFlowORG*process.particleFlow)
32  if "muons" in pth.moduleNames():
33  pth.replace(process.muons, process.particleFlowTmpMixed*process.muons)
34  else:
35  # CMSSW_4_2
36  if hasattr(process,"famosParticleFlowSequence"):
37  process.famosParticleFlowSequence.remove(process.pfPhotonTranslatorSequence)
38  process.famosParticleFlowSequence.remove(process.pfElectronTranslatorSequence)
39  process.famosParticleFlowSequence.remove(process.particleFlow)
40  process.famosParticleFlowSequence.__iadd__(process.particleFlowORG)
41  process.famosParticleFlowSequence.__iadd__(process.particleFlow)
42  process.famosParticleFlowSequence.__iadd__(process.pfElectronTranslatorSequence)
43  process.famosParticleFlowSequence.__iadd__(process.pfPhotonTranslatorSequence)
44  elif hasattr(process,"particleFlowReco"):
45  process.particleFlowReco.remove(process.pfPhotonTranslatorSequence)
46  process.particleFlowReco.remove(process.pfElectronTranslatorSequence)
47  process.particleFlowReco.remove(process.particleFlow)
48  process.particleFlowReco.__iadd__(process.particleFlowORG)
49  process.particleFlowReco.__iadd__(process.particleFlow)
50  process.particleFlowReco.__iadd__(process.pfElectronTranslatorSequence)
51  process.particleFlowReco.__iadd__(process.pfPhotonTranslatorSequence)
52  else :
53  raise "Cannot find particleFlow sequence"
54 
55  process.pfSelectedElectrons.src = cms.InputTag("particleFlowORG")
56  process.pfSelectedPhotons.src = cms.InputTag("particleFlowORG")
57 
58  process.particleFlow = cms.EDProducer('PFCandidateMixer',
59  col1 = cms.untracked.InputTag("cleanedParticleFlow"),
60  col2 = cms.untracked.InputTag("particleFlowORG", ""),
61  trackCol = cms.untracked.InputTag("generalTracks"),
62  muons = cms.untracked.InputTag("muons"),
63  gsfElectrons = cms.untracked.InputTag("gsfElectrons")
64  # TODO: photons ???
65  )
66 
67  return process