Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:38

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.AlpakaCore.functions import *
0003 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
0004 
0005 from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import *
0006 from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import *
0007 from RecoTracker.TransientTrackingRecHit.TransientTrackingRecHitBuilder_cfi import *
0008 import RecoTracker.TransientTrackingRecHit.TransientTrackingRecHitBuilder_cfi
0009 myTTRHBuilderWithoutAngle = RecoTracker.TransientTrackingRecHit.TransientTrackingRecHitBuilder_cfi.ttrhbwr.clone(
0010     StripCPE = 'Fake',
0011     ComponentName = 'PixelTTRHBuilderWithoutAngle'
0012 )
0013 from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import *
0014 from RecoTracker.TkSeedingLayers.TTRHBuilderWithoutAngle4PixelTriplets_cfi import *
0015 from RecoTracker.PixelTrackFitting.pixelFitterByHelixProjections_cfi import pixelFitterByHelixProjections
0016 from RecoTracker.PixelTrackFitting.pixelNtupletsFitter_cfi import pixelNtupletsFitter
0017 from RecoTracker.PixelTrackFitting.pixelTrackFilterByKinematics_cfi import pixelTrackFilterByKinematics
0018 from RecoTracker.PixelTrackFitting.pixelTrackCleanerBySharedHits_cfi import pixelTrackCleanerBySharedHits
0019 from RecoTracker.PixelTrackFitting.pixelTracks_cfi import pixelTracks as _pixelTracks
0020 from RecoTracker.TkTrackingRegions.globalTrackingRegion_cfi import globalTrackingRegion as _globalTrackingRegion
0021 from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpot_cfi import globalTrackingRegionFromBeamSpot as _globalTrackingRegionFromBeamSpot
0022 from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer
0023 from RecoTracker.PixelSeeding.pixelTripletHLTEDProducer_cfi import pixelTripletHLTEDProducer as _pixelTripletHLTEDProducer
0024 from RecoTracker.PixelLowPtUtilities.ClusterShapeHitFilterESProducer_cfi import *
0025 import RecoTracker.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi
0026 from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder
0027 
0028 # Eras
0029 from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU
0030 from Configuration.Eras.Modifier_run3_common_cff import run3_common
0031 
0032 # seeding layers
0033 from RecoTracker.IterativeTracking.InitialStep_cff import initialStepSeedLayers, initialStepHitDoublets, _initialStepCAHitQuadruplets
0034 
0035 # TrackingRegion
0036 pixelTracksTrackingRegions = _globalTrackingRegion.clone()
0037 trackingLowPU.toReplaceWith(pixelTracksTrackingRegions, _globalTrackingRegionFromBeamSpot.clone())
0038 
0039 
0040 # Pixel quadruplets tracking
0041 pixelTracksSeedLayers = initialStepSeedLayers.clone(
0042     BPix = dict(HitProducer = "siPixelRecHitsPreSplitting"),
0043     FPix = dict(HitProducer = "siPixelRecHitsPreSplitting")
0044 )
0045 
0046 pixelTracksHitDoublets = initialStepHitDoublets.clone(
0047     clusterCheck = "",
0048     seedingLayers = "pixelTracksSeedLayers",
0049     trackingRegions = "pixelTracksTrackingRegions"
0050 )
0051 
0052 pixelTracksHitQuadruplets = _initialStepCAHitQuadruplets.clone(
0053     doublets = "pixelTracksHitDoublets",
0054     SeedComparitorPSet = dict(clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting')
0055 )
0056 
0057 pixelTracks = _pixelTracks.clone(
0058     SeedingHitSets = "pixelTracksHitQuadruplets"
0059 )
0060 
0061 pixelTracksTask = cms.Task(
0062     pixelTracksTrackingRegions,
0063     pixelFitterByHelixProjections,
0064     pixelTrackFilterByKinematics,
0065     pixelTracksSeedLayers,
0066     pixelTracksHitDoublets,
0067     pixelTracksHitQuadruplets,
0068     pixelTracks
0069 )
0070 
0071 pixelTracksSequence = cms.Sequence(pixelTracksTask)
0072 
0073 
0074 # Pixel triplets for trackingLowPU
0075 pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone(
0076     doublets = "pixelTracksHitDoublets",
0077     produceSeedingHitSets = True,
0078     SeedComparitorPSet = RecoTracker.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone(
0079         clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting"
0080     )
0081 )
0082 
0083 trackingLowPU.toModify(pixelTracks,
0084     SeedingHitSets = "pixelTracksHitTriplets"
0085 )
0086 
0087 _pixelTracksTask_lowPU = pixelTracksTask.copy()
0088 _pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets, pixelTracksHitTriplets)
0089 trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU)
0090 
0091 
0092 # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction
0093 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
0094 
0095 from RecoTracker.PixelSeeding.caHitNtupletCUDAPhase1_cfi import caHitNtupletCUDAPhase1 as _pixelTracksCUDA
0096 from RecoTracker.PixelSeeding.caHitNtupletCUDAPhase2_cfi import caHitNtupletCUDAPhase2 as _pixelTracksCUDAPhase2
0097 from RecoTracker.PixelSeeding.caHitNtupletCUDAHIonPhase1_cfi import caHitNtupletCUDAHIonPhase1 as _pixelTracksCUDAHIonPhase1
0098 
0099 # Phase 2 modifier
0100 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
0101 # HIon modifiers
0102 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0103 
0104 # SwitchProducer providing the pixel tracks in SoA format on the CPU
0105 pixelTracksSoA = SwitchProducerCUDA(
0106     # build pixel ntuplets and pixel tracks in SoA format on the CPU
0107     cpu = _pixelTracksCUDA.clone(
0108         pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA",
0109         idealConditions = False,
0110         onGPU = False
0111     )
0112 )
0113 
0114 # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
0115 run3_common.toModify(pixelTracksSoA.cpu,
0116     idealConditions = True
0117 )
0118 
0119 # convert the pixel tracks from SoA to legacy format
0120 from RecoTracker.PixelTrackFitting.pixelTrackProducerFromSoAPhase1_cfi import pixelTrackProducerFromSoAPhase1 as _pixelTrackProducerFromSoA
0121 from RecoTracker.PixelTrackFitting.pixelTrackProducerFromSoAPhase2_cfi import pixelTrackProducerFromSoAPhase2 as _pixelTrackProducerFromSoAPhase2
0122 from RecoTracker.PixelTrackFitting.pixelTrackProducerFromSoAHIonPhase1_cfi import pixelTrackProducerFromSoAHIonPhase1 as _pixelTrackProducerFromSoAHIonPhase1
0123 
0124 pixelNtupletFit.toReplaceWith(pixelTracks, _pixelTrackProducerFromSoA.clone(
0125     pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting",
0126 ))
0127 
0128 (pixelNtupletFit & phase2_tracker).toReplaceWith(pixelTracks, _pixelTrackProducerFromSoAPhase2.clone(
0129     pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting",
0130 ))
0131 
0132 (pixelNtupletFit & pp_on_AA).toReplaceWith(pixelTracks, _pixelTrackProducerFromSoAHIonPhase1.clone(
0133     pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting",
0134 ))
0135 
0136 pixelNtupletFit.toReplaceWith(pixelTracksTask, cms.Task(
0137     # build the pixel ntuplets and the pixel tracks in SoA format on the GPU
0138     pixelTracksSoA,
0139     # convert the pixel tracks from SoA to legacy format
0140     pixelTracks
0141 ))
0142 
0143 # "Patatrack" sequence running on GPU (or CPU if not available)
0144 from Configuration.ProcessModifiers.gpu_cff import gpu
0145 
0146 # build the pixel ntuplets and pixel tracks in SoA format on the GPU
0147 pixelTracksCUDA = _pixelTracksCUDA.clone(
0148     pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA",
0149     idealConditions = False,
0150     onGPU = True,
0151 )
0152 
0153 # use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
0154 run3_common.toModify(pixelTracksCUDA,
0155     idealConditions = True
0156 )
0157 
0158 # SwitchProducer providing the pixel tracks in SoA format on the CPU
0159 from RecoTracker.PixelTrackFitting.pixelTrackSoAFromCUDAPhase1_cfi import pixelTrackSoAFromCUDAPhase1 as _pixelTracksSoA
0160 from RecoTracker.PixelTrackFitting.pixelTrackSoAFromCUDAPhase2_cfi import pixelTrackSoAFromCUDAPhase2 as _pixelTracksSoAPhase2
0161 from RecoTracker.PixelTrackFitting.pixelTrackSoAFromCUDAHIonPhase1_cfi import pixelTrackSoAFromCUDAHIonPhase1 as _pixelTracksSoAHIonPhase1
0162 
0163 gpu.toModify(pixelTracksSoA,
0164     # transfer the pixel tracks in SoA format to the host
0165     cuda = _pixelTracksSoA.clone()
0166 )
0167 
0168 (gpu & phase2_tracker).toModify(pixelTracksSoA,cuda = _pixelTracksSoAPhase2.clone(
0169 ))
0170 
0171 (gpu & pp_on_AA).toModify(pixelTracksSoA,cuda = _pixelTracksSoAHIonPhase1.clone(
0172 ))
0173 
0174 phase2_tracker.toModify(pixelTracksSoA,cpu = _pixelTracksCUDAPhase2.clone(
0175     pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA",
0176     onGPU = False
0177 ))
0178 
0179 (pp_on_AA & ~phase2_tracker).toModify(pixelTracksSoA,cpu = _pixelTracksCUDAHIonPhase1.clone(
0180     pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA",
0181     onGPU = False
0182 ))
0183 
0184 phase2_tracker.toReplaceWith(pixelTracksCUDA,_pixelTracksCUDAPhase2.clone(
0185     pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA",
0186     onGPU = True,
0187 ))
0188 
0189 (pp_on_AA & ~phase2_tracker).toReplaceWith(pixelTracksCUDA,_pixelTracksCUDAHIonPhase1.clone(
0190     pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA",
0191     onGPU = True,
0192 ))
0193 
0194 (pixelNtupletFit & gpu).toReplaceWith(pixelTracksTask, cms.Task(
0195     # build the pixel ntuplets and pixel tracks in SoA format on the GPU
0196     pixelTracksCUDA,
0197     # transfer the pixel tracks in SoA format to the CPU, and convert them to legacy format
0198     pixelTracksTask.copy()
0199 ))
0200 
0201 ## GPU vs CPU validation
0202 # force CPU vertexing to use hit SoA from CPU chain and not the converted one from GPU chain
0203 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
0204 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelTracksSoA.cpu,
0205     pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA@cpu"
0206     )
0207 
0208 ######################################################################
0209 
0210 ### Alpaka Pixel Track Reco
0211 
0212 from Configuration.ProcessModifiers.alpaka_cff import alpaka
0213 
0214 # pixel tracks SoA producer on the device
0215 from RecoTracker.PixelSeeding.caHitNtupletAlpakaPhase1_cfi import caHitNtupletAlpakaPhase1 as _pixelTracksAlpakaPhase1
0216 from RecoTracker.PixelSeeding.caHitNtupletAlpakaPhase2_cfi import caHitNtupletAlpakaPhase2 as _pixelTracksAlpakaPhase2
0217 
0218 pixelTracksAlpaka = _pixelTracksAlpakaPhase1.clone()
0219 phase2_tracker.toReplaceWith(pixelTracksAlpaka,_pixelTracksAlpakaPhase2.clone())
0220 
0221 # pixel tracks SoA producer on the cpu, for validation
0222 pixelTracksAlpakaSerial = makeSerialClone(pixelTracksAlpaka,
0223     pixelRecHitSrc = 'siPixelRecHitsPreSplittingAlpakaSerial'
0224 )
0225 
0226 # legacy pixel tracks from SoA
0227 from  RecoTracker.PixelTrackFitting.pixelTrackProducerFromSoAAlpakaPhase1_cfi import pixelTrackProducerFromSoAAlpakaPhase1 as _pixelTrackProducerFromSoAAlpakaPhase1
0228 from  RecoTracker.PixelTrackFitting.pixelTrackProducerFromSoAAlpakaPhase2_cfi import pixelTrackProducerFromSoAAlpakaPhase2 as _pixelTrackProducerFromSoAAlpakaPhase2
0229 
0230 (alpaka & ~phase2_tracker).toReplaceWith(pixelTracks, _pixelTrackProducerFromSoAAlpakaPhase1.clone(
0231     pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting",
0232 ))
0233 
0234 (alpaka & phase2_tracker).toReplaceWith(pixelTracks, _pixelTrackProducerFromSoAAlpakaPhase2.clone(
0235     pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting",
0236 ))
0237 
0238 alpaka.toReplaceWith(pixelTracksTask, cms.Task(
0239     # Build the pixel ntuplets and the pixel tracks in SoA format with alpaka on the device
0240     pixelTracksAlpaka,
0241     # Build the pixel ntuplets and the pixel tracks in SoA format with alpaka on the cpu (if requested by the validation)
0242     pixelTracksAlpakaSerial,
0243     # Convert the pixel tracks from SoA to legacy format
0244     pixelTracks)
0245 )