CMS 3D CMS Logo

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