Skip to content

Commit

Permalink
Merge pull request #33802 from trackreco/mkFitIntegration
Browse files Browse the repository at this point in the history
Update MkFit to support multiple iterations
  • Loading branch information
cmsbuild authored Jun 16, 2021
2 parents 39fb77a + 78094ae commit bf3047e
Show file tree
Hide file tree
Showing 62 changed files with 3,057 additions and 662 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier does iteration-independent changes for enabling mkFit
trackingMkFitCommon = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for detachedQuadStep
trackingMkFitDetachedQuadStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for detachedTripletStep
trackingMkFitDetachedTripletStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for highPtTripletStep
trackingMkFitHighPtTripletStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for initialStep
trackingMkFitInitialStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for lowPtQuadStep
trackingMkFitLowPtQuadStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for lowPtTripletStep
trackingMkFitLowPtTripletStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for mixedTripletStep
trackingMkFitMixedTripletStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for pixelLessStep
trackingMkFitPixelLessStep = cms.Modifier()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit for tobTecStep
trackingMkFitTobTecStep = cms.Modifier()
26 changes: 24 additions & 2 deletions Configuration/ProcessModifiers/python/trackingMkFit_cff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets replaces the default pattern recognition with mkFit (possibly in selected iterations only)
trackingMkFit = cms.Modifier()
from Configuration.ProcessModifiers.trackingMkFitCommon_cff import *
from Configuration.ProcessModifiers.trackingMkFitInitialStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitLowPtQuadStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitHighPtTripletStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitLowPtTripletStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitDetachedQuadStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitDetachedTripletStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitMixedTripletStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitPixelLessStep_cff import *
from Configuration.ProcessModifiers.trackingMkFitTobTecStep_cff import *

# Use mkFit in selected iterations
trackingMkFit = cms.ModifierChain(
trackingMkFitCommon,
trackingMkFitInitialStep,
trackingMkFitLowPtQuadStep,
trackingMkFitHighPtTripletStep,
trackingMkFitLowPtTripletStep,
trackingMkFitDetachedQuadStep,
# trackingMkFitDetachedTripletStep, # to be enabled later
# trackingMkFitMixedTripletStep, # to be enabled later
trackingMkFitPixelLessStep,
trackingMkFitTobTecStep,
)
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,24 @@ def condition_(self, fragment, stepList, key, hasHarvest):

class UpgradeWorkflow_trackingMkFit(UpgradeWorkflowTracking):
def setup_(self, step, stepName, stepDict, k, properties):
if 'Digi' in step: stepDict[stepName][k] = merge([self.step2, stepDict[step][k]])
if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
def condition_(self, fragment, stepList, key, hasHarvest):
return '2017' in key or '2021' in key
upgradeWFs['trackingMkFit'] = UpgradeWorkflow_trackingMkFit(
steps = [
'Digi',
'DigiTrigger',
'Reco',
'RecoGlobal',
],
PU = [],
suffix = '_trackingMkFit',
offset = 0.7,
)
upgradeWFs['trackingMkFit'].step2 = {
'--customise': 'RecoTracker/MkFit/customizeHLTIter0ToMkFit.customizeHLTIter0ToMkFit'
}
upgradeWFs['trackingMkFit'].step3 = {
'--procModifiers': 'trackingMkFit'
}
Expand Down
28 changes: 28 additions & 0 deletions RecoTracker/IterativeTracking/python/DetachedQuadStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,29 @@
phase2clustersToSkip = cms.InputTag('detachedQuadStepClusters')
)

from Configuration.ProcessModifiers.trackingMkFitDetachedQuadStep_cff import trackingMkFitDetachedQuadStep
import RecoTracker.MkFit.mkFitSeedConverter_cfi as mkFitSeedConverter_cfi
import RecoTracker.MkFit.mkFitIterationConfigESProducer_cfi as mkFitIterationConfigESProducer_cfi
import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi
import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi
detachedQuadStepTrackCandidatesMkFitSeeds = mkFitSeedConverter_cfi.mkFitSeedConverter.clone(
seeds = 'detachedQuadStepSeeds',
)
detachedQuadStepTrackCandidatesMkFitConfig = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone(
config = 'RecoTracker/MkFit/data/mkfit-phase1-detachedQuadStep.json',
ComponentName = 'detachedQuadStepTrackCandidatesMkFitConfig',
)
detachedQuadStepTrackCandidatesMkFit = mkFitProducer_cfi.mkFitProducer.clone(
seeds = 'detachedQuadStepTrackCandidatesMkFitSeeds',
config = ('', 'detachedQuadStepTrackCandidatesMkFitConfig'),
clustersToSkip = 'detachedQuadStepClusters',
)
trackingMkFitDetachedQuadStep.toReplaceWith(detachedQuadStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
seeds = 'detachedQuadStepSeeds',
mkFitSeeds = 'detachedQuadStepTrackCandidatesMkFitSeeds',
tracks = 'detachedQuadStepTrackCandidatesMkFit',
))

#For FastSim phase1 tracking
import FastSimulation.Tracking.TrackCandidateProducer_cfi
_fastSim_detachedQuadStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
Expand Down Expand Up @@ -337,6 +360,11 @@
detachedQuadStepTracks,
detachedQuadStep)
DetachedQuadStep = cms.Sequence(DetachedQuadStepTask)

_DetachedQuadStepTask_trackingMkFit = DetachedQuadStepTask.copy()
_DetachedQuadStepTask_trackingMkFit.add(detachedQuadStepTrackCandidatesMkFitSeeds, detachedQuadStepTrackCandidatesMkFit, detachedQuadStepTrackCandidatesMkFitConfig)
trackingMkFitDetachedQuadStep.toReplaceWith(DetachedQuadStepTask, _DetachedQuadStepTask_trackingMkFit)

_DetachedQuadStepTask_Phase2PU140 = DetachedQuadStepTask.copy()
_DetachedQuadStepTask_Phase2PU140.replace(detachedQuadStep, cms.Task(detachedQuadStepSelector,detachedQuadStep))
trackingPhase2PU140.toReplaceWith(DetachedQuadStepTask, _DetachedQuadStepTask_Phase2PU140)
Expand Down
28 changes: 28 additions & 0 deletions RecoTracker/IterativeTracking/python/DetachedTripletStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,29 @@
detachedTripletStepTrackCandidates.TrajectoryCleaner = 'detachedTripletStepTrajectoryCleanerBySharedHits'
trackingLowPU.toModify(detachedTripletStepTrajectoryCleanerBySharedHits, fractionShared = 0.19)

from Configuration.ProcessModifiers.trackingMkFitDetachedTripletStep_cff import trackingMkFitDetachedTripletStep
import RecoTracker.MkFit.mkFitSeedConverter_cfi as mkFitSeedConverter_cfi
import RecoTracker.MkFit.mkFitIterationConfigESProducer_cfi as mkFitIterationConfigESProducer_cfi
import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi
import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi
detachedTripletStepTrackCandidatesMkFitSeeds = mkFitSeedConverter_cfi.mkFitSeedConverter.clone(
seeds = 'detachedTripletStepSeeds',
)
detachedTripletStepTrackCandidatesMkFitConfig = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone(
ComponentName = 'detachedTripletStepTrackCandidatesMkFitConfig',
config = 'RecoTracker/MkFit/data/mkfit-phase1-detachedTripletStep.json',
)
detachedTripletStepTrackCandidatesMkFit = mkFitProducer_cfi.mkFitProducer.clone(
seeds = 'detachedTripletStepTrackCandidatesMkFitSeeds',
config = ('', 'detachedTripletStepTrackCandidatesMkFitConfig'),
clustersToSkip = 'detachedTripletStepClusters',
)
trackingMkFitDetachedTripletStep.toReplaceWith(detachedTripletStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
seeds = 'detachedTripletStepSeeds',
mkFitSeeds = 'detachedTripletStepTrackCandidatesMkFitSeeds',
tracks = 'detachedTripletStepTrackCandidatesMkFit',
))

import FastSimulation.Tracking.TrackCandidateProducer_cfi
_fastSim_detachedTripletStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
src = 'detachedTripletStepSeeds',
Expand Down Expand Up @@ -379,6 +402,11 @@
detachedTripletStepClassifier1,detachedTripletStepClassifier2,
detachedTripletStep)
DetachedTripletStep = cms.Sequence(DetachedTripletStepTask)

_DetachedTripletStepTask_trackingMkFit = DetachedTripletStepTask.copy()
_DetachedTripletStepTask_trackingMkFit.add(detachedTripletStepTrackCandidatesMkFitSeeds, detachedTripletStepTrackCandidatesMkFit, detachedTripletStepTrackCandidatesMkFitConfig)
trackingMkFitDetachedTripletStep.toReplaceWith(DetachedTripletStepTask, _DetachedTripletStepTask_trackingMkFit)

_DetachedTripletStepTask_LowPU = DetachedTripletStepTask.copyAndExclude([detachedTripletStepClassifier2])
_DetachedTripletStepTask_LowPU.replace(detachedTripletStepClassifier1, detachedTripletStepSelector)
trackingLowPU.toReplaceWith(DetachedTripletStepTask, _DetachedTripletStepTask_LowPU)
Expand Down
28 changes: 28 additions & 0 deletions RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,29 @@
useHitsSplitting = True
)

from Configuration.ProcessModifiers.trackingMkFitHighPtTripletStep_cff import trackingMkFitHighPtTripletStep
import RecoTracker.MkFit.mkFitSeedConverter_cfi as mkFitSeedConverter_cfi
import RecoTracker.MkFit.mkFitIterationConfigESProducer_cfi as mkFitIterationConfigESProducer_cfi
import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi
import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi
highPtTripletStepTrackCandidatesMkFitSeeds = mkFitSeedConverter_cfi.mkFitSeedConverter.clone(
seeds = 'highPtTripletStepSeeds',
)
highPtTripletStepTrackCandidatesMkFitConfig = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone(
ComponentName = 'highPtTripletStepTrackCandidatesMkFitConfig',
config = 'RecoTracker/MkFit/data/mkfit-phase1-highPtTripletStep.json',
)
highPtTripletStepTrackCandidatesMkFit = mkFitProducer_cfi.mkFitProducer.clone(
seeds = 'highPtTripletStepTrackCandidatesMkFitSeeds',
config = ('', 'highPtTripletStepTrackCandidatesMkFitConfig'),
clustersToSkip = 'highPtTripletStepClusters',
)
trackingMkFitHighPtTripletStep.toReplaceWith(highPtTripletStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
seeds = 'highPtTripletStepSeeds',
mkFitSeeds = 'highPtTripletStepTrackCandidatesMkFitSeeds',
tracks = 'highPtTripletStepTrackCandidatesMkFit',
))

# For Phase2PU140
from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import trajectoryCleanerBySharedHits as _trajectoryCleanerBySharedHits
highPtTripletStepTrajectoryCleanerBySharedHits = _trajectoryCleanerBySharedHits.clone(
Expand Down Expand Up @@ -332,6 +355,11 @@
highPtTripletStepTracks,
highPtTripletStep)
HighPtTripletStep = cms.Sequence(HighPtTripletStepTask)

_HighPtTripletStepTask_trackingMkFit = HighPtTripletStepTask.copy()
_HighPtTripletStepTask_trackingMkFit.add(highPtTripletStepTrackCandidatesMkFitSeeds, highPtTripletStepTrackCandidatesMkFit, highPtTripletStepTrackCandidatesMkFitConfig)
trackingMkFitHighPtTripletStep.toReplaceWith(HighPtTripletStepTask, _HighPtTripletStepTask_trackingMkFit)

_HighPtTripletStepTask_Phase2PU140 = HighPtTripletStepTask.copy()
_HighPtTripletStepTask_Phase2PU140.replace(highPtTripletStep, highPtTripletStepSelector)
_HighPtTripletStep_Phase2PU140 = cms.Sequence(_HighPtTripletStepTask_Phase2PU140)
Expand Down
34 changes: 26 additions & 8 deletions RecoTracker/IterativeTracking/python/InitialStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,32 @@
useHitsSplitting = True
)

from Configuration.ProcessModifiers.trackingMkFit_cff import trackingMkFit
import RecoTracker.MkFit.mkFitInputConverter_cfi as mkFitInputConverter_cfi
from Configuration.ProcessModifiers.trackingMkFitInitialStep_cff import trackingMkFitInitialStep
from RecoTracker.MkFit.mkFitGeometryESProducer_cfi import mkFitGeometryESProducer
import RecoTracker.MkFit.mkFitSiPixelHitConverter_cfi as mkFitSiPixelHitConverter_cfi
import RecoTracker.MkFit.mkFitSiStripHitConverter_cfi as mkFitSiStripHitConverter_cfi
import RecoTracker.MkFit.mkFitEventOfHitsProducer_cfi as mkFitEventOfHitsProducer_cfi
import RecoTracker.MkFit.mkFitSeedConverter_cfi as mkFitSeedConverter_cfi
import RecoTracker.MkFit.mkFitIterationConfigESProducer_cfi as mkFitIterationConfigESProducer_cfi
import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi
import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi
initialStepTrackCandidatesMkFitInput = mkFitInputConverter_cfi.mkFitInputConverter.clone(
mkFitSiPixelHits = mkFitSiPixelHitConverter_cfi.mkFitSiPixelHitConverter.clone() # TODO: figure out better place for this module?
mkFitSiStripHits = mkFitSiStripHitConverter_cfi.mkFitSiStripHitConverter.clone() # TODO: figure out better place for this module?
mkFitEventOfHits = mkFitEventOfHitsProducer_cfi.mkFitEventOfHitsProducer.clone() # TODO: figure out better place for this module?
initialStepTrackCandidatesMkFitSeeds = mkFitSeedConverter_cfi.mkFitSeedConverter.clone(
seeds = 'initialStepSeeds',
)
initialStepTrackCandidatesMkFitConfig = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone(
ComponentName = 'initialStepTrackCandidatesMkFitConfig',
config = 'RecoTracker/MkFit/data/mkfit-phase1-initialStep.json',
)
initialStepTrackCandidatesMkFit = mkFitProducer_cfi.mkFitProducer.clone(
hitsSeeds = 'initialStepTrackCandidatesMkFitInput',
seeds = 'initialStepTrackCandidatesMkFitSeeds',
config = ('', 'initialStepTrackCandidatesMkFitConfig'),
)
trackingMkFit.toReplaceWith(initialStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
trackingMkFitInitialStep.toReplaceWith(initialStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
seeds = 'initialStepSeeds',
hitsSeeds = 'initialStepTrackCandidatesMkFitInput',
mkFitSeeds = 'initialStepTrackCandidatesMkFitSeeds',
tracks = 'initialStepTrackCandidatesMkFit',
))

Expand Down Expand Up @@ -413,9 +426,14 @@
initialStep,caloJetsForTrkTask)
InitialStep = cms.Sequence(InitialStepTask)

from Configuration.ProcessModifiers.trackingMkFitCommon_cff import trackingMkFitCommon
_InitialStepTask_trackingMkFitCommon = InitialStepTask.copy()
_InitialStepTask_trackingMkFitCommon.add(mkFitSiPixelHits, mkFitSiStripHits, mkFitEventOfHits, mkFitGeometryESProducer)
trackingMkFitCommon.toReplaceWith(InitialStepTask, _InitialStepTask_trackingMkFitCommon)

_InitialStepTask_trackingMkFit = InitialStepTask.copy()
_InitialStepTask_trackingMkFit.add(initialStepTrackCandidatesMkFitInput, initialStepTrackCandidatesMkFit)
trackingMkFit.toReplaceWith(InitialStepTask, _InitialStepTask_trackingMkFit)
_InitialStepTask_trackingMkFit.add(initialStepTrackCandidatesMkFitSeeds, initialStepTrackCandidatesMkFit, initialStepTrackCandidatesMkFitConfig)
trackingMkFitInitialStep.toReplaceWith(InitialStepTask, _InitialStepTask_trackingMkFit)

_InitialStepTask_LowPU = InitialStepTask.copyAndExclude([firstStepPrimaryVerticesUnsorted, initialStepTrackRefsForJets, caloJetsForTrkTask, firstStepPrimaryVertices, initialStepClassifier1, initialStepClassifier2, initialStepClassifier3])
_InitialStepTask_LowPU.replace(initialStep, initialStepSelector)
Expand Down
27 changes: 27 additions & 0 deletions RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,29 @@
phase2clustersToSkip = cms.InputTag('lowPtQuadStepClusters')
)

from Configuration.ProcessModifiers.trackingMkFitLowPtQuadStep_cff import trackingMkFitLowPtQuadStep
import RecoTracker.MkFit.mkFitSeedConverter_cfi as mkFitSeedConverter_cfi
import RecoTracker.MkFit.mkFitIterationConfigESProducer_cfi as mkFitIterationConfigESProducer_cfi
import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi
import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi
lowPtQuadStepTrackCandidatesMkFitSeeds = mkFitSeedConverter_cfi.mkFitSeedConverter.clone(
seeds = 'lowPtQuadStepSeeds',
)
lowPtQuadStepTrackCandidatesMkFitConfig = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone(
ComponentName = 'lowPtQuadStepTrackCandidatesMkFitConfig',
config = 'RecoTracker/MkFit/data/mkfit-phase1-lowPtQuadStep.json',
)
lowPtQuadStepTrackCandidatesMkFit = mkFitProducer_cfi.mkFitProducer.clone(
seeds = 'lowPtQuadStepTrackCandidatesMkFitSeeds',
config = ('', 'lowPtQuadStepTrackCandidatesMkFitConfig'),
clustersToSkip = 'lowPtQuadStepClusters',
)
trackingMkFitLowPtQuadStep.toReplaceWith(lowPtQuadStepTrackCandidates, mkFitOutputConverter_cfi.mkFitOutputConverter.clone(
seeds = 'lowPtQuadStepSeeds',
mkFitSeeds = 'lowPtQuadStepTrackCandidatesMkFitSeeds',
tracks = 'lowPtQuadStepTrackCandidatesMkFit',
))

#For FastSim phase1 tracking
import FastSimulation.Tracking.TrackCandidateProducer_cfi
_fastSim_lowPtQuadStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
Expand Down Expand Up @@ -278,6 +301,10 @@
lowPtQuadStep)
LowPtQuadStep = cms.Sequence(LowPtQuadStepTask)

_LowPtQuadStepTask_trackingMkFit = LowPtQuadStepTask.copy()
_LowPtQuadStepTask_trackingMkFit.add(lowPtQuadStepTrackCandidatesMkFitSeeds, lowPtQuadStepTrackCandidatesMkFit, lowPtQuadStepTrackCandidatesMkFitConfig)
trackingMkFitLowPtQuadStep.toReplaceWith(LowPtQuadStepTask, _LowPtQuadStepTask_trackingMkFit)

_LowPtQuadStepTask_Phase2PU140 = LowPtQuadStepTask.copy()
_LowPtQuadStepTask_Phase2PU140.replace(lowPtQuadStep, lowPtQuadStepSelector)
trackingPhase2PU140.toReplaceWith(LowPtQuadStepTask, _LowPtQuadStepTask_Phase2PU140)
Expand Down
Loading

0 comments on commit bf3047e

Please sign in to comment.