Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the default phase 2 PF reconstruction for endcap from simPF to pfTICL #32766

Merged
merged 2 commits into from Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 0 additions & 32 deletions RecoHGCal/TICL/python/iterativeTICL_cff.py
Expand Up @@ -42,35 +42,3 @@
ticlHFNoseMIPStepTask,
ticlHFNoseEMStepTask
)

def _findIndicesByModule(process,name):
ret = []
if getattr(process,'particleFlowBlock', None):
for i, pset in enumerate(process.particleFlowBlock.elementImporters):
if pset.importerName.value() == name:
ret.append(i)
return ret

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
def injectTICLintoPF(process):
if getattr(process,'particleFlowTmp', None):
process.particleFlowTmp.src = ['particleFlowTmpBarrel', 'pfTICL']

if getattr(process,'particleFlowTmpBarrel', None):
process.particleFlowTmpBarrel.vetoEndcap = True

_insertTrackImportersWithVeto = {}
_trackImporters = ['GeneralTracksImporter','ConvBremTrackImporter',
'ConversionTrackImporter','NuclearInteractionTrackImporter']
for importer in _trackImporters:
for idx in _findIndicesByModule(process,importer):
_insertTrackImportersWithVeto[idx] = dict(
vetoMode = cms.uint32(2), # pfTICL candidate list
vetoSrc = cms.InputTag("pfTICL")
)
phase2_hgcal.toModify(
process.particleFlowBlock,
elementImporters = _insertTrackImportersWithVeto
)

return process
76 changes: 63 additions & 13 deletions RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py
Expand Up @@ -14,7 +14,7 @@
#from RecoParticleFlow.PFProducer.pfGsfElectronCiCSelector_cff import *
from RecoParticleFlow.PFProducer.pfGsfElectronMVASelector_cff import *

from RecoParticleFlow.PFProducer.pfLinker_cff import *
from RecoParticleFlow.PFProducer.pfLinker_cff import *

from CommonTools.ParticleFlow.pfParticleSelection_cff import *

Expand All @@ -34,39 +34,54 @@
particleFlowEGammaFullTask,
particleFlowTmpTask,
fixedGridRhoFastjetAllTmp,
particleFlowTmpPtrs,
particleFlowTmpPtrs,
particleFlowEGammaFinalTask,
pfParticleSelectionTask )
particleFlowReco = cms.Sequence(particleFlowRecoTask)

particleFlowLinksTask = cms.Task( particleFlow, particleFlowPtrs, chargedHadronPFTrackIsolation, particleBasedIsolationTask)
particleFlowLinks = cms.Sequence(particleFlowLinksTask)

from RecoParticleFlow.PFTracking.hgcalTrackCollection_cfi import *
from RecoParticleFlow.PFProducer.simPFProducer_cff import *
from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import *
from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import *
#
# for phase 2
particleFlowTmpBarrel = particleFlowTmp.clone()
_phase2_hgcal_particleFlowTmp = cms.EDProducer(
"PFCandidateListMerger",
src = cms.VInputTag("particleFlowTmpBarrel",
"simPFProducer")
"pfTICL")

)

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
phase2_hgcal.toReplaceWith( particleFlowTmp, _phase2_hgcal_particleFlowTmp )
phase2_hgcal.toModify(
particleFlowTmpBarrel,
vetoEndcap = True
# If true, PF(Muon)Algo will ignore muon candidates incorporated via pfTICL
# in addMissingMuons. This will prevent potential double-counting.
)

#
# for simPF
from RecoParticleFlow.PFTracking.hgcalTrackCollection_cfi import *
from RecoParticleFlow.PFProducer.simPFProducer_cff import *
from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import *
from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import *

_phase2_hgcal_simPFTask = cms.Task( pfTrack ,
hgcalTrackCollection ,
hgcalTrackCollection ,
tpClusterProducer ,
quickTrackAssociatorByHits ,
simPFProducer )
_phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask)
_phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask)

_phase2_hgcal_particleFlowRecoTask = cms.Task( _phase2_hgcal_simPFTask , particleFlowRecoTask.copy() )
_phase2_hgcal_particleFlowRecoTask.replace( particleFlowTmpTask, cms.Task( particleFlowTmpBarrel, particleFlowTmp ) )

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
phase2_hgcal.toReplaceWith( particleFlowTmp, _phase2_hgcal_particleFlowTmp )
phase2_hgcal.toReplaceWith( particleFlowRecoTask, _phase2_hgcal_particleFlowRecoTask )

#
# for heavy ion
from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA

Expand All @@ -84,11 +99,46 @@
e.toModify(pfPileUpIso, enable = cms.bool(False))
e.toModify(pfNoPileUp, enable = cms.bool(False))
e.toModify(pfPileUp, enable = cms.bool(False))


#
# for MLPF
from Configuration.ProcessModifiers.mlpf_cff import mlpf
from RecoParticleFlow.PFProducer.mlpfProducer_cfi import mlpfProducer

_mlpfTask = cms.Task(mlpfProducer, particleFlowRecoTask.copy())

mlpf.toReplaceWith(particleFlowRecoTask, _mlpfTask)

#
# switch from pfTICL to simPF
def _findIndicesByModule(process,name):
ret = []
if getattr(process,'particleFlowBlock', None):
for i, pset in enumerate(process.particleFlowBlock.elementImporters):
if pset.importerName.value() == name:
ret.append(i)
return ret

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
def replaceTICLwithSimPF(process):
if getattr(process,'particleFlowTmp', None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasattr(process,'particleFlowTmp') is slightly simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't hear any other suggestions, i will make this change soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (including two other lines).

process.particleFlowTmp.src = ['particleFlowTmpBarrel', 'simPFProducer']

if getattr(process,'particleFlowTmpBarrel', None):
process.particleFlowTmpBarrel.vetoEndcap = False

_insertTrackImportersWithVeto = {}
_trackImporters = ['GeneralTracksImporter','ConvBremTrackImporter',
'ConversionTrackImporter','NuclearInteractionTrackImporter']
for importer in _trackImporters:
for idx in _findIndicesByModule(process,importer):
_insertTrackImportersWithVeto[idx] = dict(
vetoMode = cms.uint32(0), # HGCal-region PFTrack list for simPF
vetoSrc = cms.InputTag('hgcalTrackCollection:TracksInHGCal')
)
phase2_hgcal.toModify(
process.particleFlowBlock,
elementImporters = _insertTrackImportersWithVeto
)

return process
8 changes: 4 additions & 4 deletions RecoParticleFlow/PFProducer/python/particleFlowBlock_cfi.py
Expand Up @@ -157,15 +157,15 @@
minSuperClusterPt = 1.0,
minPTforBypass = 0.0)

#
# kill pfTICL tracks
def _findIndicesByModule(name):
ret = []
for i, pset in enumerate(particleFlowBlock.elementImporters):
if pset.importerName.value() == name:
ret.append(i)
return ret

#
# kill tracks in the HGCal
from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
_insertTrackImportersWithVeto = {}
_trackImporters = ['GeneralTracksImporter','ConvBremTrackImporter',
Expand All @@ -174,8 +174,8 @@ def _findIndicesByModule(name):
for idx in _findIndicesByModule(importer):
_insertTrackImportersWithVeto[idx] = dict(
vetoEndcap = True,
vetoMode = cms.uint32(0), # HGCal-region PFTrack list for simPF
vetoSrc = cms.InputTag('hgcalTrackCollection:TracksInHGCal')
vetoMode = cms.uint32(2), # pfTICL candidate list
vetoSrc = cms.InputTag("pfTICL")
)
phase2_hgcal.toModify(
particleFlowBlock,
Expand Down