From 3ead0e533a54c595cc7ff82a3fded9b7c37b597e Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 23 Apr 2021 00:07:21 +0200 Subject: [PATCH] Rework the definition of the Patatrack pixel workflows Drop the obsolete pixelNtupleFit modifier, and replace the customizePixelTracksSoAonCPU function with the pixelNtupletFit modifier. Make the "gpu" workflows autodetect if a GPU is a present, and fall back to running only on CPU otherwise. Update the name of the modules for better consistency. --- .../python/Reconstruction_cff.py | 18 +-- .../python/pixelNtupleFit_cff.py | 5 - .../python/pixelNtupletFit_cff.py | 7 + .../python/relval_steps.py | 11 +- .../python/upgradeWorkflowComponents.py | 11 +- .../StandardSequences/python/RawToDigi_cff.py | 2 +- .../StandardSequences/python/Services_cff.py | 5 +- .../python/SiPixelRawToDigiRegional_cfi.py | 2 +- .../python/SiPixelRawToDigi_cfi.py | 13 +- .../python/siPixelDigis_cff.py | 39 ++++-- .../python/RecoLocalTracker_cff.py | 20 ++- .../SiPixelClusterizerPreSplitting_cfi.py | 10 +- .../python/siPixelClustersPreSplitting_cff.py | 42 ++++-- .../python/SiPixelRecHits_cfi.py | 50 +++---- .../python/RecoPixelVertexing_cff.py | 70 +++++++--- .../python/customizePixelTracksForTriplets.py | 10 ++ .../python/customizePixelTracksSoAonCPU.py | 62 --------- .../plugins/PixelTrackDumpCUDA.cc | 2 +- .../plugins/PixelTrackProducerFromSoA.cc | 2 +- .../plugins/PixelTrackSoAFromCUDA.cc | 4 +- .../python/PixelTracks_cff.py | 124 ++++++++++++------ .../PixelTriplets/plugins/CAHitNtupletCUDA.cc | 2 +- .../plugins/PixelVertexProducerCUDA.cc | 2 +- .../python/PixelVertexes_cff.py | 6 +- .../python/customizePixelOnlyForProfiling.py | 4 +- 25 files changed, 304 insertions(+), 219 deletions(-) delete mode 100644 Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py create mode 100644 Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py create mode 100644 RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py delete mode 100644 RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py diff --git a/CalibTracker/Configuration/python/Reconstruction_cff.py b/CalibTracker/Configuration/python/Reconstruction_cff.py index f6cafe076db9e..5e20b01ceb9a2 100644 --- a/CalibTracker/Configuration/python/Reconstruction_cff.py +++ b/CalibTracker/Configuration/python/Reconstruction_cff.py @@ -1,24 +1,24 @@ import FWCore.ParameterSet.Config as cms -#local reconstruction +# local reconstruction from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * from EventFilter.SiStripRawToDigi.SiStripDigis_cfi import * from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import * from RecoLocalTracker.SiStripZeroSuppression.SiStripZeroSuppression_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterizer_cfi import * -recolocal = cms.Sequence( siPixelDigis*siPixelClustersPreSplitting*siStripDigis*siStripZeroSuppression*siStripClusters) -siPixelDigis.InputLabel = 'rawDataCollector' +recolocal = cms.Sequence(siPixelDigis + siPixelClustersPreSplitting + siStripDigis + siStripZeroSuppression + siStripClusters) +siPixelDigis.cpu.InputLabel = 'rawDataCollector' -#tracking +# tracking from RecoVertex.BeamSpotProducer.BeamSpot_cff import * from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoTracker.Configuration.RecoTracker_cff import * from RecoTracker.Configuration.RecoTrackerP5_cff import * from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * -recotrack = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ckftracks) -recotrackP5 = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ctftracksP5) +recotrack = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ckftracks) +recotrackP5 = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ctftracksP5) -#Schedule -reconstruction_step = cms.Path( recolocal + recotrack ) -reconstructionP5_step = cms.Path( recolocal + recotrackP5 ) +# Schedule +reconstruction_step = cms.Path(recolocal + recotrack) +reconstructionP5_step = cms.Path(recolocal + recotrackP5) diff --git a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py deleted file mode 100644 index db8a2ac229a02..0000000000000 --- a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for replacing the default pixel track "fitting" with eihter Riemann or BrokenLine fit - -pixelNtupleFit = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py new file mode 100644 index 0000000000000..94b14a4f5a6e3 --- /dev/null +++ b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for replacing the legacy pixel tracks with the "Patatrack" pixel ntuplets, +# fishbone cleaning, and either the Broken Line fit (by default) or the Riemann fit. +# It also replaces the "gap" pixel vertices with a density-based vertex reconstruction algorithm. + +pixelNtupletFit = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 97235248c83b6..f25b5178c1fd8 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2187,10 +2187,13 @@ def gen2021HiMix(fragment,howMuch): } step3_pixel_ntuplet_cpu = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + '--procModifiers': 'pixelNtupletFit' +} +step3_pixel_ntuplet_gpu = { + '--procModifiers': 'pixelNtupletFit,gpu' } step3_pixel_triplets = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' } step3_gpu = { '--procModifiers': 'gpu', @@ -2324,9 +2327,9 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2018reHLT_ZBPrompt']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']=merge([{'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,DQM:@pixelTrackingOnlyDQM'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixel_ntuplet_cpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_pixel_ntuplet_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsCPU']=merge([step3_pixel_ntuplet_cpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_pixel_ntuplet_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_ECALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,DQM:@ecalOnly'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_ECALOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_ECALOnlyCPU']]) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index ff88d3b0c0546..492ff70c2c91c 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -444,7 +444,7 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + '--procModifiers': 'pixelNtupletFit' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -456,7 +456,7 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--procModifiers': 'gpu' + '--procModifiers': 'pixelNtupletFit,gpu' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -468,7 +468,8 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--procModifiers': 'pixelNtupletFit', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -480,8 +481,8 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--procModifiers': 'gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 60ed421a6205f..ef77578a7775d 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -87,7 +87,7 @@ run3_common.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([castorDigis])) from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -# Remove siPixelDigis until we have phase1 pixel digis +# Remove siPixelDigis until we have Phase 2 pixel digis phase2_tracker.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([siPixelDigis])) # FIXME diff --git a/Configuration/StandardSequences/python/Services_cff.py b/Configuration/StandardSequences/python/Services_cff.py index ef1da8dec1d59..0949c7b8d4972 100644 --- a/Configuration/StandardSequences/python/Services_cff.py +++ b/Configuration/StandardSequences/python/Services_cff.py @@ -8,12 +8,13 @@ # DQM store service from DQMServices.Core.DQMStore_cfi import * -# load CUDA services when the "gpu" modifier is enabled +# load CUDA services when the "gpu" or "pixelNtupletFit" modifiers are enabled def _addCUDAServices(process): process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") from Configuration.ProcessModifiers.gpu_cff import gpu -modifyConfigurationStandardSequencesServicesAddCUDAServices_ = gpu.makeProcessModifier(_addCUDAServices) +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit +modifyConfigurationStandardSequencesServicesAddCUDAServices_ = (gpu | pixelNtupletFit).makeProcessModifier(_addCUDAServices) # load TritonService when SONIC workflow is enabled def _addTritonService(process): diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py index 34897891cd323..81622b3b9d1e1 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py @@ -3,7 +3,7 @@ from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * ## regional seeded unpacking for specialized HLT paths -siPixelDigisRegional = siPixelDigis.clone() +siPixelDigisRegional = siPixelDigis.cpu.clone() siPixelDigisRegional.Regions = cms.PSet( inputs = cms.VInputTag( "hltL2EtCutDoublePFIsoTau45Trk5" ), deltaPhi = cms.vdouble( 0.5 ), diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py index 50c8f0fcabd3c..13fff5e0e1600 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py @@ -1,15 +1,20 @@ import FWCore.ParameterSet.Config as cms -from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi - from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu + +# legacy pixel unpacker +from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi siPixelDigis = SwitchProducerCUDA( cpu = _siPixelRawToDigi.clone() ) +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigis.cpu, UsePhase1=True) +phase1Pixel.toModify(siPixelDigis.cpu, + UsePhase1 = True +) -from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA gpu.toModify(siPixelDigis, cuda = cms.EDAlias( siPixelDigiErrors = cms.VPSet( diff --git a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py index 5c1ff74be9c69..8a84ba90b5ac0 100644 --- a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py +++ b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py @@ -1,30 +1,43 @@ import FWCore.ParameterSet.Config as cms from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import siPixelDigis -from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA -siPixelDigisTask = cms.Task(siPixelDigis) +siPixelDigisTask = cms.Task( + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigis +) +# copy the pixel digis (except errors) and clusters to the host +from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA siPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# copy the pixel digis errors to the host +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA siPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# convert the pixel digis errors to the legacy format +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA siPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone() +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigiErrors, UsePhase1=True) - -siPixelDigisTaskCUDA = cms.Task( - siPixelDigisSoA, - siPixelDigiErrorsSoA, - siPixelDigiErrors +phase1Pixel.toModify(siPixelDigiErrors, + UsePhase1 = True ) + from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelDigisTask_gpu = siPixelDigisTask.copy() -_siPixelDigisTask_gpu.add(siPixelDigisTaskCUDA) -gpu.toReplaceWith(siPixelDigisTask, _siPixelDigisTask_gpu) +gpu.toReplaceWith(siPixelDigisTask, cms.Task( + # copy the pixel digis (except errors) and clusters to the host + siPixelDigisSoA, + # copy the pixel digis errors to the host + siPixelDigiErrorsSoA, + # convert the pixel digis errors to the legacy format + siPixelDigiErrors, + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigisTask.copy() +)) diff --git a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py index 35a72f0edb08f..809c440effb53 100644 --- a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py +++ b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py @@ -1,9 +1,7 @@ import FWCore.ParameterSet.Config as cms -# # Tracker Local Reco -# Initialize magnetic field -# + from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import * from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import * @@ -13,9 +11,19 @@ from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SubCollectionProducers.clustersummaryproducer_cfi import * -pixeltrackerlocalrecoTask = cms.Task(siPixelClustersPreSplittingTask,siPixelRecHitsPreSplittingTask) -striptrackerlocalrecoTask = cms.Task(siStripZeroSuppression,siStripClusters,siStripMatchedRecHits) -trackerlocalrecoTask = cms.Task(pixeltrackerlocalrecoTask,striptrackerlocalrecoTask,clusterSummaryProducer) +pixeltrackerlocalrecoTask = cms.Task( + siPixelClustersPreSplittingTask, + siPixelRecHitsPreSplittingTask) + +striptrackerlocalrecoTask = cms.Task( + siStripZeroSuppression, + siStripClusters, + siStripMatchedRecHits) + +trackerlocalrecoTask = cms.Task( + pixeltrackerlocalrecoTask, + striptrackerlocalrecoTask, + clusterSummaryProducer) pixeltrackerlocalreco = cms.Sequence(pixeltrackerlocalrecoTask) striptrackerlocalreco = cms.Sequence(striptrackerlocalrecoTask) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py index b9c6862b015bf..f3675134fb84d 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py @@ -1,14 +1,22 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SiPixelGainCalibrationServiceParameters from CondTools.SiPixel.SiPixelGainCalibrationService_cfi import * + +# legacy pixel cluster producer from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi import siPixelClusters as _siPixelClusters -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA siPixelClustersPreSplitting = SwitchProducerCUDA( cpu = _siPixelClusters.clone() ) from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA gpu.toModify(siPixelClustersPreSplitting, + # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU + cpu = dict( + payloadType = 'HLT' + ), cuda = cms.EDAlias( siPixelDigisClustersPreSplitting = cms.VPSet( cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector")) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py index 8bbf47e9ebf90..50e47edbcce26 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py @@ -1,26 +1,40 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run3_common_cff import run3_common +from Configuration.ProcessModifiers.gpu_cff import gpu +# conditions used *only* by the modules running on GPU +from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import siPixelROCsStatusAndMappingWrapperESProducer +from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import siPixelGainCalibrationForHLTGPU + +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import siPixelClustersPreSplitting -from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA -from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA -from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import * -from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import * -siPixelClustersPreSplittingTask = cms.Task(siPixelClustersPreSplitting) +siPixelClustersPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplitting +) +# reconstruct the pixel digis and clusters on the gpu +from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA siPixelClustersPreSplittingCUDA = _siPixelRawToClusterCUDA.clone() -from Configuration.Eras.Modifier_run3_common_cff import run3_common + run3_common.toModify(siPixelClustersPreSplittingCUDA, - isRun2=False + # use the pixel channel calibrations scheme for Run 3 + isRun2 = False ) +# convert the pixel digis (except errors) and clusters to the legacy format +from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA siPixelDigisClustersPreSplitting = _siPixelDigisClustersFromSoA.clone() -siPixelClustersPreSplittingTaskCUDA = cms.Task( + +gpu.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task( + # conditions used *only* by the modules running on GPU + siPixelROCsStatusAndMappingWrapperESProducer, + siPixelGainCalibrationForHLTGPU, + # reconstruct the pixel digis and clusters on the gpu siPixelClustersPreSplittingCUDA, + # convert the pixel digis (except errors) and clusters to the legacy format siPixelDigisClustersPreSplitting, -) - -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelClustersPreSplittingTask_gpu = siPixelClustersPreSplittingTask.copy() -_siPixelClustersPreSplittingTask_gpu.add(siPixelClustersPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelClustersPreSplittingTask, _siPixelClustersPreSplittingTask_gpu) + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplittingTask.copy() +)) diff --git a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py index eb9dbad4934cd..8430b19f1e9be 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py +++ b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py @@ -1,44 +1,46 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu +# legacy pixel rechit producer siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src = cms.InputTag("siPixelClusters"), CPE = cms.string('PixelCPEGeneric'), VerboseLevel = cms.untracked.int32(0) ) -_siPixelRecHitsPreSplitting = siPixelRecHits.clone( - src = 'siPixelClustersPreSplitting' -) - -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SwitchProducer wrapping the legacy pixel rechit producer siPixelRecHitsPreSplitting = SwitchProducerCUDA( - cpu = _siPixelRecHitsPreSplitting.clone() + cpu = siPixelRecHits.clone( + src = 'siPixelClustersPreSplitting' + ) ) +# convert the pixel rechits from legacy to SoA format +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as siPixelRecHitsPreSplittingSoA - -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA - -gpu.toModify(siPixelRecHitsPreSplitting, - cuda = _siPixelRecHitFromCUDA.clone() +siPixelRecHitsPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel rechit producer + siPixelRecHitsPreSplitting, + # convert the pixel rechits from legacy to SoA format + siPixelRecHitsPreSplittingSoA ) - -siPixelRecHitsPreSplittingTask = cms.Task(siPixelRecHitsPreSplitting) - +# reconstruct the pixel rechits on the gpu +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone( beamSpot = "offlineBeamSpotToCUDA" ) -siPixelRecHitsPreSplittingLegacy = _siPixelRecHitFromCUDA.clone() -siPixelRecHitsPreSplittingTaskCUDA = cms.Task( - siPixelRecHitsPreSplittingCUDA, - siPixelRecHitsPreSplittingLegacy, +# transfer the pixel rechits to the host and convert them from SoA +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA +gpu.toModify(siPixelRecHitsPreSplitting, + cuda = _siPixelRecHitFromCUDA.clone() ) -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelRecHitsPreSplittingTask_gpu = siPixelRecHitsPreSplittingTask.copy() -_siPixelRecHitsPreSplittingTask_gpu.add(siPixelRecHitsPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, _siPixelRecHitsPreSplittingTask_gpu) +gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task( + # reconstruct the pixel rechits on the gpu + siPixelRecHitsPreSplittingCUDA, + # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA + siPixelRecHitsPreSplittingTask.copy() +)) diff --git a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py index 4b32839e21b0e..391055bd870e8 100644 --- a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py +++ b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py @@ -1,29 +1,67 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * -# -# for STARTUP ONLY use try and use Offline 3D PV from pixelTracks, with adaptive vertex -# from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import * -#from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * -recopixelvertexingTask = cms.Task(pixelTracksTask, pixelVertices) -from Configuration.ProcessModifiers.gpu_cff import gpu -_recopixelvertexingTask_gpu = recopixelvertexingTask.copy() +# legacy pixel vertex reconsruction using the divisive vertex finder +pixelVerticesTask = cms.Task( + pixelVertices +) -from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA -_recopixelvertexingTask_gpu.add(pixelVertexCUDA) +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA -_recopixelvertexingTask_gpu.add(pixelVertexSoA) +# build the pixel vertices in SoA format on the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA +pixelVerticesSoA = SwitchProducerCUDA( + cpu = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksSoA", + onGPU = False + ) +) +# convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA -# this is needed because the 'pixelTrack' EDAlias does not contain the 'ushorts' collections -_pixelVertexFromSoA.TrackCollection = 'pixelTrackFromSoA' -gpu.toModify(pixelVertices, - cuda = _pixelVertexFromSoA +pixelNtupletFit.toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone( + src = "pixelVerticesSoA" +)) + +pixelNtupletFit.toReplaceWith(pixelVerticesTask, cms.Task( + # build the pixel vertices in SoA format on the CPU + pixelVerticesSoA, + # convert the pixel vertices from SoA to legacy format + pixelVertices +)) + + +# "Patatrack" sequence running on the GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build pixel vertices in SoA format on the GPU +pixelVerticesCUDA = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksCUDA", + onGPU = True ) -gpu.toReplaceWith(recopixelvertexingTask, _recopixelvertexingTask_gpu) +# transfer the pixel vertices in SoA format to the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA as _pixelVertexSoA +gpu.toModify(pixelVerticesSoA, + cuda = _pixelVertexSoA.clone( + src = cms.InputTag("pixelVerticesCUDA") + ) +) +(pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task( + # build pixel vertices in SoA format on the GPU + pixelVerticesCUDA, + # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format + pixelVerticesTask.copy() +)) + +# Tasks and Sequences +recopixelvertexingTask = cms.Task( + pixelTracksTask, + pixelVerticesTask +) recopixelvertexing = cms.Sequence(recopixelvertexingTask) diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py new file mode 100644 index 0000000000000..51abcd3ea7982 --- /dev/null +++ b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +def customizePixelTracksForTriplets(process): + + from HLTrigger.Configuration.common import producers_by_type + for producer in producers_by_type(process, 'CAHitNtupletCUDA'): + producer.includeJumpingForwardDoublets = True + producer.minHitsPerNtuplet = 3 + + return process diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py deleted file mode 100644 index 1661cac832b8b..0000000000000 --- a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py +++ /dev/null @@ -1,62 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -def customizePixelTracksSoAonCPU(process): - - process.CUDAService = cms.Service('CUDAService', - enabled = cms.untracked.bool(False) - ) - - # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU - process.siPixelClustersPreSplitting.cpu.payloadType = cms.string('HLT') - - from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy - process.siPixelRecHitsPreSplitting = siPixelRecHitSoAFromLegacy.clone( - convertToLegacy = True - ) - - from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA - process.pixelTrackSoA = caHitNtupletCUDA.clone( - onGPU = False, - pixelRecHitSrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA - process.pixelVertexSoA = pixelVertexCUDA.clone( - onGPU = False, - pixelTrackSrc = 'pixelTrackSoA' - ) - - from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA - process.pixelTracks = pixelTrackProducerFromSoA.clone( - pixelRecHitLegacySrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA - process.pixelVertices = pixelVertexFromSoA.clone() - - process.reconstruction_step += process.siPixelRecHitsPreSplitting + process.pixelTrackSoA + process.pixelVertexSoA - - return process - - -def customizePixelTracksForTriplets(process): - - from HLTrigger.Configuration.common import producers_by_type - for producer in producers_by_type(process, 'CAHitNtupletCUDA'): - producer.includeJumpingForwardDoublets = True - producer.minHitsPerNtuplet = 3 - - return process - - -def customizePixelTracksSoAonCPUForProfiling(process): - - process = customizePixelTracksSoAonCPU(process) - - process.siPixelRecHitSoAFromLegacy.convertToLegacy = False - - process.TkSoA = cms.Path(process.offlineBeamSpot + process.siPixelDigis + process.siPixelClustersPreSplitting + process.siPixelRecHitSoAFromLegacy + process.pixelTrackSoA + process.pixelVertexSoA) - - process.schedule = cms.Schedule(process.TkSoA) - - return process diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc index 2f0965be50eb8..04cc57db5876c 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc @@ -54,7 +54,7 @@ void PixelTrackDumpCUDA::fillDescriptions(edm::ConfigurationDescriptions& descri edm::ParameterSetDescription desc; desc.add("onGPU", true); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); desc.add("pixelVertexSrc", edm::InputTag("pixelVertexCUDA")); descriptions.add("pixelTrackDumpCUDA", desc); } diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc index 94c490e948575..60225eceebc00 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc @@ -82,7 +82,7 @@ PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iC void PixelTrackProducerFromSoA::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); - desc.add("trackSrc", edm::InputTag("pixelTrackSoA")); + desc.add("trackSrc", edm::InputTag("pixelTracksSoA")); desc.add("pixelRecHitLegacySrc", edm::InputTag("siPixelRecHitsPreSplittingLegacy")); desc.add("minNumberOfHits", 0); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc index 2de8ec6c335b5..ad2da317e8ba6 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc @@ -46,8 +46,8 @@ PixelTrackSoAFromCUDA::PixelTrackSoAFromCUDA(const edm::ParameterSet& iConfig) void PixelTrackSoAFromCUDA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("caHitNtupletCUDA")); - descriptions.add("pixelTrackSoA", desc); + desc.add("src", edm::InputTag("pixelTracksCUDA")); + descriptions.add("pixelTracksSoA", desc); } void PixelTrackSoAFromCUDA::acquire(edm::Event const& iEvent, diff --git a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py index 244e68faba8b6..ec9bb133a6c58 100644 --- a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py +++ b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py @@ -24,9 +24,11 @@ import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder +# Eras from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_run3_common_cff import run3_common -# SEEDING LAYERS +# seeding layers from RecoTracker.IterativeTracking.InitialStep_cff import initialStepSeedLayers, initialStepHitDoublets, _initialStepCAHitQuadruplets # TrackingRegion @@ -34,7 +36,7 @@ trackingLowPU.toReplaceWith(pixelTracksTrackingRegions, _globalTrackingRegionFromBeamSpot.clone()) -# Pixel Quadruplets Tracking +# Pixel quadruplets tracking pixelTracksSeedLayers = initialStepSeedLayers.clone( BPix = dict(HitProducer = "siPixelRecHitsPreSplitting"), FPix = dict(HitProducer = "siPixelRecHitsPreSplitting") @@ -51,22 +53,10 @@ SeedComparitorPSet = dict(clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting') ) -# for trackingLowPU -pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( - doublets = "pixelTracksHitDoublets", - produceSeedingHitSets = True, - SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( - clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" - ) +pixelTracks = _pixelTracks.clone( + SeedingHitSets = "pixelTracksHitQuadruplets" ) -pixelTracks = SwitchProducerCUDA( - cpu = _pixelTracks.clone( - SeedingHitSets = "pixelTracksHitQuadruplets" - ) -) -trackingLowPU.toModify(pixelTracks.cpu, SeedingHitSets = "pixelTracksHitTriplets") - pixelTracksTask = cms.Task( pixelTracksTrackingRegions, pixelFitterByHelixProjections, @@ -76,35 +66,91 @@ pixelTracksHitQuadruplets, pixelTracks ) + +pixelTracksSequence = cms.Sequence(pixelTracksTask) + + +# Pixel triplets for trackingLowPU +pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "pixelTracksHitDoublets", + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( + clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" + ) +) + +trackingLowPU.toModify(pixelTracks, + SeedingHitSets = "pixelTracksHitTriplets" +) + _pixelTracksTask_lowPU = pixelTracksTask.copy() _pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets, pixelTracksHitTriplets) trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU) -# Use ntuple fit and substitute previous Fitter producer with the ntuple one -from Configuration.ProcessModifiers.pixelNtupleFit_cff import pixelNtupleFit as ntupleFit -ntupleFit.toModify(pixelTracks.cpu, Fitter = "pixelNtupletsFitter") -_pixelTracksTask_ntupleFit = pixelTracksTask.copy() -_pixelTracksTask_ntupleFit.replace(pixelFitterByHelixProjections, pixelNtupletsFitter) -ntupleFit.toReplaceWith(pixelTracksTask, _pixelTracksTask_ntupleFit) +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi import pixelTrackSoA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as pixelTrackFromSoA -_pixelTracksTask_gpu = pixelTracksTask.copy() -_pixelTracksTask_gpu.add(caHitNtupletCUDA, pixelTrackSoA, pixelTrackFromSoA) -# this is needed (instead of simply using pixelTracks.cuda = pixelTrackFromSoA.clone()) because -# the PixelTrackProducerFromSoA produces an additional 'ushorts' collection -gpu.toModify(pixelTracks, - cuda = cms.EDAlias( - pixelTrackFromSoA = cms.VPSet( - cms.PSet(type = cms.string("recoTracks")), - cms.PSet(type = cms.string("recoTrackExtras")), - cms.PSet(type = cms.string("TrackingRecHitsOwned")) - ) +from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +pixelTracksSoA = SwitchProducerCUDA( + # build pixel ntuplets and pixel tracks in SoA format on the CPU + cpu = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA", + idealConditions = False, + onGPU = False ) ) -gpu.toReplaceWith(pixelTracksTask, _pixelTracksTask_gpu) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksSoA.cpu, + idealConditions = True +) -pixelTracksSequence = cms.Sequence(pixelTracksTask) +# convert the pixel tracks from SoA to legacy format +from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA +pixelNtupletFit.toReplaceWith(pixelTracks, _pixelTrackProducerFromSoA.clone( + pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting", +)) + +pixelNtupletFit.toReplaceWith(pixelTracksTask, cms.Task( + #pixelTracksTrackingRegions, + #pixelFitterByHelixProjections, + #pixelTrackFilterByKinematics, + #pixelTracksSeedLayers, + #pixelTracksHitDoublets, + #pixelTracksHitQuadruplets, + # build the pixel ntuplets and the pixel tracks in SoA format on the GPU + pixelTracksSoA, + # convert the pixel tracks from SoA to legacy format + pixelTracks +)) + + +# "Patatrack" sequence running on GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build the pixel ntuplets and pixel tracks in SoA format on the GPU +pixelTracksCUDA = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA", + idealConditions = False, + onGPU = True +) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksCUDA, + idealConditions = True +) + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA +gpu.toModify(pixelTracksSoA, + # transfer the pixel tracks in SoA format to the host + cuda = _pixelTracksSoA.clone() +) + +(pixelNtupletFit & gpu).toReplaceWith(pixelTracksTask, cms.Task( + # build the pixel ntuplets and pixel tracks in SoA format on the GPU + pixelTracksCUDA, + # transfer the pixel tracks in SoA format to the CPU, and convert them to legacy format + pixelTracksTask.copy() +)) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc index beba54c33f513..ee295d8f5253c 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc @@ -61,7 +61,7 @@ void CAHitNtupletCUDA::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("pixelRecHitSrc", edm::InputTag("siPixelRecHitsPreSplittingCUDA")); CAHitNtupletGeneratorOnGPU::fillDescriptions(desc); - descriptions.add("caHitNtupletCUDA", desc); + descriptions.add("pixelTracksCUDA", desc); } void CAHitNtupletCUDA::produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& es) const { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc index e2c2bc76c8612..2989403fa4214 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc @@ -85,7 +85,7 @@ void PixelVertexProducerCUDA::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("chi2max", 9.); // max normalized distance to cluster desc.add("PtMin", 0.5); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); auto label = "pixelVertexCUDA"; descriptions.add(label, desc); diff --git a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py index a33d5c14af751..d47ce2eb339b4 100644 --- a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py +++ b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py @@ -1,7 +1,3 @@ import FWCore.ParameterSet.Config as cms -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import pvClusterComparer, pixelVertices as _pixelVertices -pixelVertices = SwitchProducerCUDA( - cpu = _pixelVertices.clone() -) +from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import * diff --git a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py index 24774bbda649c..045738b37dde1 100644 --- a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py +++ b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py @@ -6,7 +6,7 @@ def customizePixelOnlyForProfilingGPUOnly(process): process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('caHitNtupletCUDA', 'pixelVertexCUDA') + eventProducts = cms.untracked.vstring('pixelTracksCUDA', 'pixelVertexCUDA') ) process.consume_step = cms.EndPath(process.consumer) @@ -28,7 +28,7 @@ def customizePixelOnlyForProfilingGPUWithHostCopy(process): #? process.siPixelRecHitSoAFromLegacy.convertToLegacy = False process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('pixelTrackSoA', 'pixelVertexSoA') + eventProducts = cms.untracked.vstring('pixelTracksSoA', 'pixelVertexSoA') ) process.consume_step = cms.EndPath(process.consumer)