Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-04 02:53:13

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
0003 
0004 from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import *
0005 from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import *
0006 
0007 # legacy pixel vertex reconsruction using the divisive vertex finder
0008 pixelVerticesTask = cms.Task(
0009     pixelVertices
0010 )
0011 
0012 # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction
0013 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
0014 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
0015 
0016 # build the pixel vertices in SoA format on the CPU
0017 from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA
0018 pixelVerticesSoA = SwitchProducerCUDA(
0019     cpu = _pixelVerticesCUDA.clone(
0020         pixelTrackSrc = "pixelTracksSoA",
0021         onGPU = False
0022     )
0023 )
0024 
0025 # convert the pixel vertices from SoA to legacy format
0026 from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
0027 (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone(
0028     src = "pixelVerticesSoA"
0029 ))
0030 
0031 (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelVerticesTask, cms.Task(
0032     # build the pixel vertices in SoA format on the CPU
0033     pixelVerticesSoA,
0034     # convert the pixel vertices from SoA to legacy format
0035     pixelVertices
0036 ))
0037 
0038 
0039 # "Patatrack" sequence running on the GPU
0040 from Configuration.ProcessModifiers.gpu_cff import gpu
0041 
0042 # build pixel vertices in SoA format on the GPU
0043 pixelVerticesCUDA = _pixelVerticesCUDA.clone(
0044     pixelTrackSrc = "pixelTracksCUDA",
0045     onGPU = True
0046 )
0047 
0048 # transfer the pixel vertices in SoA format to the CPU
0049 from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
0050 gpu.toModify(pixelVerticesSoA,
0051     cuda = _pixelVerticesSoA.clone(
0052         src = cms.InputTag("pixelVerticesCUDA")
0053     )
0054 )
0055 
0056 ## GPU vs CPU validation
0057 # force CPU vertexing to use track SoA from CPU chain and not the converted one from GPU chain
0058 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
0059 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelVerticesSoA.cpu,
0060     pixelTrackSrc = "pixelTracksSoA@cpu"
0061 )
0062 
0063 (pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task(
0064     # build pixel vertices in SoA format on the GPU
0065     pixelVerticesCUDA,
0066     # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format
0067     pixelVerticesTask.copy()
0068 ))
0069 
0070 # Tasks and Sequences
0071 recopixelvertexingTask = cms.Task(
0072     pixelTracksTask,
0073     pixelVerticesTask
0074 )
0075 recopixelvertexing = cms.Sequence(recopixelvertexingTask)