CMS 3D CMS Logo

RecoParticleFlow_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 
5 #from RecoParticleFlow.PFTracking.particleFlowTrackWithDisplacedVertex_cff import *
6 
9 
14 #from RecoParticleFlow.PFProducer.pfGsfElectronCiCSelector_cff import *
16 
18 
20 
23 
25 fixedGridRhoFastjetAllTmp = fixedGridRhoFastjetAll.clone(pfCandidatesTag = "particleFlowTmp")
26 
27 particleFlowTmpTask = cms.Task(particleFlowTmp)
28 particleFlowTmpSeq = cms.Sequence(particleFlowTmpTask)
29 
30 particleFlowRecoTask = cms.Task( particleFlowTrackWithDisplacedVertexTask,
31 # pfGsfElectronCiCSelectionSequence,
32  pfGsfElectronMVASelectionTask,
33  particleFlowBlock,
34  particleFlowEGammaFullTask,
35  particleFlowTmpTask,
36  fixedGridRhoFastjetAllTmp,
37  particleFlowTmpPtrs,
38  particleFlowEGammaFinalTask,
39  pfParticleSelectionTask )
40 particleFlowReco = cms.Sequence(particleFlowRecoTask)
41 
42 particleFlowLinksTask = cms.Task( particleFlow, particleFlowPtrs, chargedHadronPFTrackIsolation, particleBasedIsolationTask)
43 particleFlowLinks = cms.Sequence(particleFlowLinksTask)
44 
45 #
46 # for phase 2
47 particleFlowTmpBarrel = particleFlowTmp.clone()
48 _phase2_hgcal_particleFlowTmp = cms.EDProducer(
49  "PFCandidateListMerger",
50  src = cms.VInputTag("particleFlowTmpBarrel",
51  "pfTICL")
52 
53 )
54 
55 from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
56 phase2_hgcal.toReplaceWith( particleFlowTmp, _phase2_hgcal_particleFlowTmp )
57 phase2_hgcal.toModify(
58  particleFlowTmpBarrel,
59  vetoEndcap = True
60  # If true, PF(Muon)Algo will ignore muon candidates incorporated via pfTICL
61  # in addMissingMuons. This will prevent potential double-counting.
62 )
63 
64 #
65 # for simPF
71 
72 _phase2_hgcal_simPFTask = cms.Task( pfTrack ,
73  hgcalTrackCollection ,
74  tpClusterProducer ,
75  quickTrackAssociatorByHits ,
76  particleFlowClusterHGCalFromSimCl ,
77  simPFProducer )
78 _phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask)
79 
80 _phase2_hgcal_particleFlowRecoTask = cms.Task( _phase2_hgcal_simPFTask , particleFlowRecoTask.copy() )
81 _phase2_hgcal_particleFlowRecoTask.replace( particleFlowTmpTask, cms.Task( particleFlowTmpBarrel, particleFlowTmp ) )
82 
83 phase2_hgcal.toReplaceWith( particleFlowRecoTask, _phase2_hgcal_particleFlowRecoTask )
84 
85 #
86 # for heavy ion
87 from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
88 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
89 
90 for e in [pp_on_XeXe_2017, pp_on_AA]:
91  e.toModify(particleFlowDisplacedVertexCandidate,
92  tracksSelectorParameters = dict(pt_min = 999999.0,
93  nChi2_max = 0.0,
94  pt_min_prim = 999999.0,
95  dxy = 999999.0)
96  )
97  e.toModify(pfNoPileUpIso, enable = False)
98  e.toModify(pfPileUpIso, enable = False)
99  e.toModify(pfNoPileUp, enable = False)
100  e.toModify(pfPileUp, enable = False)
101 
102 
103 # for MLPF, replace standard PFAlgo with the ONNX-based MLPF producer
104 from Configuration.ProcessModifiers.mlpf_cff import mlpf
105 from RecoParticleFlow.PFProducer.mlpfProducer_cfi import mlpfProducer
106 mlpf.toReplaceWith(particleFlowTmp, mlpfProducer)
107 
108 #
109 # switch from pfTICL to simPF
110 def _findIndicesByModule(process,name):
111  ret = []
112  if hasattr(process,'particleFlowBlock'):
113  for i, pset in enumerate(process.particleFlowBlock.elementImporters):
114  if pset.importerName.value() == name:
115  ret.append(i)
116  return ret
117 
118 from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
119 def replaceTICLwithSimPF(process):
120  if hasattr(process,'particleFlowTmp'):
121  process.particleFlowTmp.src = ['particleFlowTmpBarrel', 'simPFProducer']
122 
123  if hasattr(process,'particleFlowTmpBarrel'):
124  process.particleFlowTmpBarrel.vetoEndcap = False
125 
126  _insertTrackImportersWithVeto = {}
127  _trackImporters = ['GeneralTracksImporter','ConvBremTrackImporter',
128  'ConversionTrackImporter','NuclearInteractionTrackImporter']
129  for importer in _trackImporters:
130  for idx in _findIndicesByModule(process,importer):
131  _insertTrackImportersWithVeto[idx] = dict(
132  vetoMode = cms.uint32(0), # HGCal-region PFTrack list for simPF
133  vetoSrc = cms.InputTag('hgcalTrackCollection:TracksInHGCal')
134  )
135  phase2_hgcal.toModify(
136  process.particleFlowBlock,
137  elementImporters = _insertTrackImportersWithVeto
138  )
139 
140  return process
def _findIndicesByModule(process, name)