From 8a7dcbfcfce1e34c55e49a222e20027da51940af Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 21 May 2021 12:38:54 -0700 Subject: [PATCH] Add option to run mkFit in initialStepPreSplitting --- ...rackingMkFitInitialStepPreSplitting_cff.py | 4 ++ .../python/trackingMkFit_cff.py | 2 + .../python/InitialStepPreSplitting_cff.py | 43 +++++++++++++++++++ .../python/InitialStep_cff.py | 3 +- .../python/plotting/trackingPlots.py | 10 +++-- 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 Configuration/ProcessModifiers/python/trackingMkFitInitialStepPreSplitting_cff.py diff --git a/Configuration/ProcessModifiers/python/trackingMkFitInitialStepPreSplitting_cff.py b/Configuration/ProcessModifiers/python/trackingMkFitInitialStepPreSplitting_cff.py new file mode 100644 index 0000000000000..938865286bb2f --- /dev/null +++ b/Configuration/ProcessModifiers/python/trackingMkFitInitialStepPreSplitting_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets replaces the default pattern recognition with mkFit for initialStep +trackingMkFitInitialStepPreSplitting = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/trackingMkFit_cff.py b/Configuration/ProcessModifiers/python/trackingMkFit_cff.py index b62a8d8376937..e0e6c6e0250e7 100644 --- a/Configuration/ProcessModifiers/python/trackingMkFit_cff.py +++ b/Configuration/ProcessModifiers/python/trackingMkFit_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.ProcessModifiers.trackingMkFitCommon_cff import * +from Configuration.ProcessModifiers.trackingMkFitInitialStepPreSplitting_cff import * from Configuration.ProcessModifiers.trackingMkFitInitialStep_cff import * from Configuration.ProcessModifiers.trackingMkFitLowPtQuadStep_cff import * from Configuration.ProcessModifiers.trackingMkFitHighPtTripletStep_cff import * @@ -14,6 +15,7 @@ # Use mkFit in selected iterations trackingMkFit = cms.ModifierChain( trackingMkFitCommon, + trackingMkFitInitialStepPreSplitting, trackingMkFitInitialStep, trackingMkFitLowPtQuadStep, trackingMkFitHighPtTripletStep, diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index 826412e2db73f..fe7a571c9a029 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -125,6 +125,45 @@ ) initialStepTrackCandidatesPreSplitting.MeasurementTrackerEvent = 'MeasurementTrackerEventPreSplitting' +from Configuration.ProcessModifiers.trackingMkFitInitialStepPreSplitting_cff import trackingMkFitInitialStepPreSplitting +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 +# TODO: Split the MkHitConverter to two to avoid re-converting strip hits in initialStep +mkFitSiPixelHitsPreSplitting = mkFitSiPixelHitConverter_cfi.mkFitSiPixelHitConverter.clone( + hits = 'siPixelRecHitsPreSplitting' +) +mkFitSiStripHits = mkFitSiStripHitConverter_cfi.mkFitSiStripHitConverter.clone() # TODO: figure out better place for this module? +mkFitEventOfHitsPreSplitting = mkFitEventOfHitsProducer_cfi.mkFitEventOfHitsProducer.clone( + pixelHits = 'mkFitSiPixelHitsPreSplitting' +) +initialStepTrackCandidatesMkFitSeedsPreSplitting = mkFitSeedConverter_cfi.mkFitSeedConverter.clone( + seeds = 'initialStepSeedsPreSplitting', +) +# TODO: or try to re-use the ESProducer of initialStep? +initialStepTrackCandidatesMkFitConfigPreSplitting = mkFitIterationConfigESProducer_cfi.mkFitIterationConfigESProducer.clone( + ComponentName = 'initialStepTrackCandidatesMkFitConfigPreSplitting', + config = 'RecoTracker/MkFit/data/mkfit-phase1-initialStep.json', +) +initialStepTrackCandidatesMkFitPreSplitting = mkFitProducer_cfi.mkFitProducer.clone( + pixelHits = 'mkFitSiPixelHitsPreSplitting', + eventOfHits = 'mkFitEventOfHitsPreSplitting', + seeds = 'initialStepTrackCandidatesMkFitSeedsPreSplitting', + config = ('', 'initialStepTrackCandidatesMkFitConfigPreSplitting'), +) +trackingMkFitInitialStepPreSplitting.toReplaceWith(initialStepTrackCandidatesPreSplitting, mkFitOutputConverter_cfi.mkFitOutputConverter.clone( + mkFitPixelHits = 'mkFitSiPixelHitsPreSplitting', + mkFitEventOfHits = 'mkFitEventOfHitsPreSplitting', + seeds = 'initialStepSeedsPreSplitting', + mkFitSeeds = 'initialStepTrackCandidatesMkFitSeedsPreSplitting', + tracks = 'initialStepTrackCandidatesMkFitPreSplitting', +)) + # fitting import RecoTracker.TrackProducer.TrackProducer_cfi initialStepTracksPreSplitting = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone( @@ -195,6 +234,10 @@ _InitialStepPreSplittingTask_trackingPhase1.replace(initialStepHitTripletsPreSplitting, cms.Task(initialStepHitTripletsPreSplitting,initialStepHitQuadrupletsPreSplitting)) trackingPhase1.toReplaceWith(InitialStepPreSplittingTask, _InitialStepPreSplittingTask_trackingPhase1.copyAndExclude([initialStepHitTripletsPreSplitting])) +_InitialStepPreSplittingTask_trackingMkFit = InitialStepPreSplittingTask.copy() +_InitialStepPreSplittingTask_trackingMkFit.add(mkFitSiPixelHitsPreSplitting, mkFitSiStripHits, mkFitEventOfHitsPreSplitting, initialStepTrackCandidatesMkFitSeedsPreSplitting, initialStepTrackCandidatesMkFitPreSplitting, initialStepTrackCandidatesMkFitConfigPreSplitting) +trackingMkFitInitialStepPreSplitting.toReplaceWith(InitialStepPreSplittingTask, _InitialStepPreSplittingTask_trackingMkFit) + # Although InitialStepPreSplitting is not really part of LowPU/Run1/Phase2PU140 # tracking, we use it to get siPixelClusters and siPixelRecHits diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index d8fa10a6768d4..693a9de80c92a 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -233,7 +233,6 @@ import RecoTracker.MkFit.mkFitProducer_cfi as mkFitProducer_cfi import RecoTracker.MkFit.mkFitOutputConverter_cfi as mkFitOutputConverter_cfi 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', @@ -428,7 +427,7 @@ from Configuration.ProcessModifiers.trackingMkFitCommon_cff import trackingMkFitCommon _InitialStepTask_trackingMkFitCommon = InitialStepTask.copy() -_InitialStepTask_trackingMkFitCommon.add(mkFitSiPixelHits, mkFitSiStripHits, mkFitEventOfHits, mkFitGeometryESProducer) +_InitialStepTask_trackingMkFitCommon.add(mkFitSiPixelHits, mkFitEventOfHits, mkFitGeometryESProducer) trackingMkFitCommon.toReplaceWith(InitialStepTask, _InitialStepTask_trackingMkFitCommon) _InitialStepTask_trackingMkFit = InitialStepTask.copy() diff --git a/Validation/RecoTrack/python/plotting/trackingPlots.py b/Validation/RecoTrack/python/plotting/trackingPlots.py index 24bdd0c21a86d..2e5155d4d4a56 100644 --- a/Validation/RecoTrack/python/plotting/trackingPlots.py +++ b/Validation/RecoTrack/python/plotting/trackingPlots.py @@ -1456,7 +1456,9 @@ def modules(self): "initialStepHitTripletsPreSplitting", "initialStepHitQuadrupletsPreSplitting", "initialStepSeedsPreSplitting"], - building=["initialStepTrackCandidatesPreSplitting"], + building=["initialStepTrackCandidatesPreSplitting" + "initialStepTrackCandidatesMkFitSeedsPreSplitting", + "initialStepTrackCandidatesMkFitPreSplitting"], fit=["initialStepTracksPreSplitting"], other=["firstStepPrimaryVerticesPreSplitting", "initialStepTrackRefsForJetsPreSplitting", @@ -1466,7 +1468,10 @@ def modules(self): "siPixelClusters", "siPixelRecHits", "MeasurementTrackerEvent", - "siPixelClusterShapeCache"]), + "siPixelClusterShapeCache", + "mkFitSiPixelHitsPreSplitting", + "mkFitSiStripHits", + "mkFitEventOfHitsPreSplitting"]), Iteration("initialStep", clusterMasking=[], selection=["initialStepClassifier1", "initialStepClassifier2", @@ -1479,7 +1484,6 @@ def modules(self): "ak4CaloJetsForTrk", "firstStepPrimaryVertices", "mkFitSiPixelHits", - "mkFitSiStripHits", "mkFitEventOfHits"]), Iteration("highPtTripletStep", selection=["highPtTripletStepClassifier1",