CMS 3D CMS Logo

RecoPixelVertexing_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
3 
6 
7 # legacy pixel vertex reconsruction using the divisive vertex finder
8 pixelVerticesTask = cms.Task(
9  pixelVertices
10 )
11 
12 # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction
13 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
14 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
15 
16 # build the pixel vertices in SoA format on the CPU
17 from RecoPixelVertexing.PixelVertexFinding.pixelVertexProducerCUDAPhase1_cfi import pixelVertexProducerCUDAPhase1 as _pixelVerticesCUDA
18 from RecoPixelVertexing.PixelVertexFinding.pixelVertexProducerCUDAPhase2_cfi import pixelVertexProducerCUDAPhase2 as _pixelVerticesCUDAPhase2
19 
20 pixelVerticesSoA = SwitchProducerCUDA(
21  cpu = _pixelVerticesCUDA.clone(
22  pixelTrackSrc = "pixelTracksSoA",
23  onGPU = False
24  )
25 )
26 
27 phase2_tracker.toModify(pixelVerticesSoA,cpu = _pixelVerticesCUDAPhase2.clone(
28  pixelTrackSrc = "pixelTracksSoA",
29  onGPU = False,
30  PtMin = 2.0
31 ))
32 
33 # convert the pixel vertices from SoA to legacy format
34 from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
35 
36 (pixelNtupletFit).toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone(
37  src = "pixelVerticesSoA"
38 ))
39 
40 (pixelNtupletFit).toReplaceWith(pixelVerticesTask, cms.Task(
41  # build the pixel vertices in SoA format on the CPU
42  pixelVerticesSoA,
43  # convert the pixel vertices from SoA to legacy format
44  pixelVertices
45 ))
46 
47 
48 # "Patatrack" sequence running on the GPU
50 
51 # build pixel vertices in SoA format on the GPU
52 pixelVerticesCUDA = _pixelVerticesCUDA.clone(
53  pixelTrackSrc = "pixelTracksCUDA",
54  onGPU = True
55 )
56 
57 phase2_tracker.toReplaceWith(pixelVerticesCUDA,_pixelVerticesCUDAPhase2.clone(
58  pixelTrackSrc = "pixelTracksCUDA",
59  onGPU = True,
60  PtMin = 2.0
61 ))
62 
63 # transfer the pixel vertices in SoA format to the CPU
64 from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
65 gpu.toModify(pixelVerticesSoA,
66  cuda = _pixelVerticesSoA.clone(
67  src = cms.InputTag("pixelVerticesCUDA")
68  )
69 )
70 
71 
73 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
74 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelVerticesSoA.cpu,
75  pixelTrackSrc = "pixelTracksSoA@cpu"
76 )
77 
78 (pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task(
79  # build pixel vertices in SoA format on the GPU
80  pixelVerticesCUDA,
81  # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format
82  pixelVerticesTask.copy()
83 ))
84 
85 # Tasks and Sequences
86 recopixelvertexingTask = cms.Task(
87  pixelTracksTask,
88  pixelVerticesTask
89 )
90 recopixelvertexing = cms.Sequence(recopixelvertexingTask)