CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA
18 pixelVerticesSoA = SwitchProducerCUDA(
19  cpu = _pixelVerticesCUDA.clone(
20  pixelTrackSrc = "pixelTracksSoA",
21  onGPU = False
22  )
23 )
24 
25 # convert the pixel vertices from SoA to legacy format
26 from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
27 (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone(
28  src = "pixelVerticesSoA"
29 ))
30 
31 (pixelNtupletFit & ~phase2_tracker).toReplaceWith(pixelVerticesTask, cms.Task(
32  # build the pixel vertices in SoA format on the CPU
33  pixelVerticesSoA,
34  # convert the pixel vertices from SoA to legacy format
35  pixelVertices
36 ))
37 
38 
39 # "Patatrack" sequence running on the GPU
41 
42 # build pixel vertices in SoA format on the GPU
43 pixelVerticesCUDA = _pixelVerticesCUDA.clone(
44  pixelTrackSrc = "pixelTracksCUDA",
45  onGPU = True
46 )
47 
48 # transfer the pixel vertices in SoA format to the CPU
49 from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
50 gpu.toModify(pixelVerticesSoA,
51  cuda = _pixelVerticesSoA.clone(
52  src = cms.InputTag("pixelVerticesCUDA")
53  )
54 )
55 
56 
58 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
59 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelVerticesSoA.cpu,
60  pixelTrackSrc = "pixelTracksSoA@cpu"
61 )
62 
63 (pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task(
64  # build pixel vertices in SoA format on the GPU
65  pixelVerticesCUDA,
66  # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format
67  pixelVerticesTask.copy()
68 ))
69 
70 # Tasks and Sequences
71 recopixelvertexingTask = cms.Task(
72  pixelTracksTask,
73  pixelVerticesTask
74 )
75 recopixelvertexing = cms.Sequence(recopixelvertexingTask)