CMS 3D CMS Logo

RecoPixelVertexing_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
3 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
4 
7 
8 # legacy pixel vertex reconsruction using the divisive vertex finder
9 pixelVerticesTask = cms.Task(
10  pixelVertices
11 )
12 
13 # "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction
14 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
15 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
16 
17 # HIon modifiers
18 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
19 
20 # build the pixel vertices in SoA format on the CPU
21 from RecoVertex.PixelVertexFinding.pixelVertexProducerCUDAPhase1_cfi import pixelVertexProducerCUDAPhase1 as _pixelVerticesCUDA
22 from RecoVertex.PixelVertexFinding.pixelVertexProducerCUDAPhase2_cfi import pixelVertexProducerCUDAPhase2 as _pixelVerticesCUDAPhase2
23 from RecoVertex.PixelVertexFinding.pixelVertexProducerCUDAHIonPhase1_cfi import pixelVertexProducerCUDAHIonPhase1 as _pixelVerticesCUDAHIonPhase1
24 
25 pixelVerticesSoA = SwitchProducerCUDA(
26  cpu = _pixelVerticesCUDA.clone(
27  pixelTrackSrc = "pixelTracksSoA",
28  onGPU = False
29  )
30 )
31 
32 phase2_tracker.toModify(pixelVerticesSoA,cpu = _pixelVerticesCUDAPhase2.clone(
33  pixelTrackSrc = "pixelTracksSoA",
34  onGPU = False,
35  PtMin = 2.0
36 ))
37 
38 (pp_on_AA & ~phase2_tracker).toModify(pixelVerticesSoA,cpu = _pixelVerticesCUDAHIonPhase1.clone(
39  pixelTrackSrc = "pixelTracksSoA",
40  doSplitting = False,
41  onGPU = False,
42 ))
43 
44 # convert the pixel vertices from SoA to legacy format
45 from RecoVertex.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
46 
47 (pixelNtupletFit).toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone(
48  src = "pixelVerticesSoA"
49 ))
50 
51 (pixelNtupletFit).toReplaceWith(pixelVerticesTask, cms.Task(
52  # build the pixel vertices in SoA format on the CPU
53  pixelVerticesSoA,
54  # convert the pixel vertices from SoA to legacy format
55  pixelVertices
56 ))
57 
58 
59 # "Patatrack" sequence running on the GPU
61 
62 # build pixel vertices in SoA format on the GPU
63 pixelVerticesCUDA = _pixelVerticesCUDA.clone(
64  pixelTrackSrc = "pixelTracksCUDA",
65  onGPU = True
66 )
67 
68 phase2_tracker.toReplaceWith(pixelVerticesCUDA,_pixelVerticesCUDAPhase2.clone(
69  pixelTrackSrc = "pixelTracksCUDA",
70  onGPU = True,
71  PtMin = 2.0
72 ))
73 
74 (pp_on_AA & ~phase2_tracker).toReplaceWith(pixelVerticesCUDA,_pixelVerticesCUDAHIonPhase1.clone(
75  pixelTrackSrc = "pixelTracksCUDA",
76  doSplitting = False,
77  onGPU = True
78 ))
79 
80 # transfer the pixel vertices in SoA format to the CPU
81 from RecoVertex.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
82 gpu.toModify(pixelVerticesSoA,
83  cuda = _pixelVerticesSoA.clone(
84  src = cms.InputTag("pixelVerticesCUDA")
85  )
86 )
87 
88 
90 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
91 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelVerticesSoA.cpu,
92  pixelTrackSrc = "pixelTracksSoA@cpu"
93 )
94 
95 (pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task(
96  # build pixel vertices in SoA format on the GPU
97  pixelVerticesCUDA,
98  # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format
99  pixelVerticesTask.copy()
100 ))
101 
102 
103 
104 # pixel vertex SoA producer with alpaka on the device
105 from RecoVertex.PixelVertexFinding.pixelVertexProducerAlpakaPhase1_cfi import pixelVertexProducerAlpakaPhase1 as _pixelVerticesAlpakaPhase1
106 from RecoVertex.PixelVertexFinding.pixelVertexProducerAlpakaPhase2_cfi import pixelVertexProducerAlpakaPhase2 as _pixelVerticesAlpakaPhase2
107 from RecoVertex.PixelVertexFinding.pixelVertexProducerAlpakaHIonPhase1_cfi import pixelVertexProducerAlpakaHIonPhase1 as _pixelVerticesAlpakaHIonPhase1
108 pixelVerticesAlpaka = _pixelVerticesAlpakaPhase1.clone()
109 phase2_tracker.toReplaceWith(pixelVerticesAlpaka,_pixelVerticesAlpakaPhase2.clone( maxVertices = 512))
110 (pp_on_AA & ~phase2_tracker).toReplaceWith(pixelVerticesAlpaka,_pixelVerticesAlpakaHIonPhase1.clone(doSplitting = False, maxVertices = 32))
111 
112 from RecoVertex.PixelVertexFinding.pixelVertexFromSoAAlpaka_cfi import pixelVertexFromSoAAlpaka as _pixelVertexFromSoAAlpaka
113 alpaka.toReplaceWith(pixelVertices, _pixelVertexFromSoAAlpaka.clone())
114 
115 # pixel vertex SoA producer with alpaka on the cpu, for validation
116 pixelVerticesAlpakaSerial = makeSerialClone(pixelVerticesAlpaka,
117  pixelTrackSrc = 'pixelTracksAlpakaSerial'
118 )
119 
120 alpaka.toReplaceWith(pixelVerticesTask, cms.Task(
121  # Build the pixel vertices in SoA format with alpaka on the device
122  pixelVerticesAlpaka,
123  # Build the pixel vertices in SoA format with alpaka on the cpu (if requested by the validation)
124  pixelVerticesAlpakaSerial,
125  # Convert the pixel vertices from SoA format (on the host) to the legacy format
126  pixelVertices
127 ))
128 
129 # Tasks and Sequences
130 recopixelvertexingTask = cms.Task(
131  pixelTracksTask,
132  pixelVerticesTask
133 )
134 recopixelvertexing = cms.Sequence(recopixelvertexingTask)
def makeSerialClone(module, kwargs)
Definition: functions.py:1