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 # HIon modifiers
17 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
18 
19 # build the pixel vertices in SoA format on the CPU
20 from RecoTracker.PixelVertexFinding.pixelVertexProducerCUDAPhase1_cfi import pixelVertexProducerCUDAPhase1 as _pixelVerticesCUDA
21 from RecoTracker.PixelVertexFinding.pixelVertexProducerCUDAPhase2_cfi import pixelVertexProducerCUDAPhase2 as _pixelVerticesCUDAPhase2
22 from RecoTracker.PixelVertexFinding.pixelVertexProducerCUDAHIonPhase1_cfi import pixelVertexProducerCUDAHIonPhase1 as _pixelVerticesCUDAHIonPhase1
23 
24 pixelVerticesSoA = SwitchProducerCUDA(
25  cpu = _pixelVerticesCUDA.clone(
26  pixelTrackSrc = "pixelTracksSoA",
27  onGPU = False
28  )
29 )
30 
31 phase2_tracker.toModify(pixelVerticesSoA,cpu = _pixelVerticesCUDAPhase2.clone(
32  pixelTrackSrc = "pixelTracksSoA",
33  onGPU = False,
34  PtMin = 2.0
35 ))
36 
37 (pp_on_AA & ~phase2_tracker).toModify(pixelVerticesSoA,cpu = _pixelVerticesCUDAHIonPhase1.clone(
38  pixelTrackSrc = "pixelTracksSoA",
39  doSplitting = False,
40  onGPU = False,
41 ))
42 
43 # convert the pixel vertices from SoA to legacy format
44 from RecoTracker.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
45 
46 (pixelNtupletFit).toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone(
47  src = "pixelVerticesSoA"
48 ))
49 
50 (pixelNtupletFit).toReplaceWith(pixelVerticesTask, cms.Task(
51  # build the pixel vertices in SoA format on the CPU
52  pixelVerticesSoA,
53  # convert the pixel vertices from SoA to legacy format
54  pixelVertices
55 ))
56 
57 
58 # "Patatrack" sequence running on the GPU
60 
61 # build pixel vertices in SoA format on the GPU
62 pixelVerticesCUDA = _pixelVerticesCUDA.clone(
63  pixelTrackSrc = "pixelTracksCUDA",
64  onGPU = True
65 )
66 
67 phase2_tracker.toReplaceWith(pixelVerticesCUDA,_pixelVerticesCUDAPhase2.clone(
68  pixelTrackSrc = "pixelTracksCUDA",
69  onGPU = True,
70  PtMin = 2.0
71 ))
72 
73 (pp_on_AA & ~phase2_tracker).toReplaceWith(pixelVerticesCUDA,_pixelVerticesCUDAHIonPhase1.clone(
74  pixelTrackSrc = "pixelTracksCUDA",
75  doSplitting = False,
76  onGPU = True
77 ))
78 
79 # transfer the pixel vertices in SoA format to the CPU
80 from RecoTracker.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
81 gpu.toModify(pixelVerticesSoA,
82  cuda = _pixelVerticesSoA.clone(
83  src = cms.InputTag("pixelVerticesCUDA")
84  )
85 )
86 
87 
89 from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel
90 (pixelNtupletFit & gpu & gpuValidationPixel).toModify(pixelVerticesSoA.cpu,
91  pixelTrackSrc = "pixelTracksSoA@cpu"
92 )
93 
94 (pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task(
95  # build pixel vertices in SoA format on the GPU
96  pixelVerticesCUDA,
97  # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format
98  pixelVerticesTask.copy()
99 ))
100 
101 # Tasks and Sequences
102 recopixelvertexingTask = cms.Task(
103  pixelTracksTask,
104  pixelVerticesTask
105 )
106 recopixelvertexing = cms.Sequence(recopixelvertexingTask)