CMS 3D CMS Logo

SiPixelRecHits_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
4 
5 # legacy pixel rechit producer
6 siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter",
7  src = cms.InputTag("siPixelClusters"),
8  CPE = cms.string('PixelCPEGeneric'),
9  VerboseLevel = cms.untracked.int32(0)
10 )
11 
12 # SwitchProducer wrapping the legacy pixel rechit producer
13 siPixelRecHitsPreSplitting = SwitchProducerCUDA(
14  cpu = siPixelRecHits.clone(
15  src = 'siPixelClustersPreSplitting'
16  )
17 )
18 
19 # phase 2 tracker modifier
20 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
21 
22 # convert the pixel rechits from legacy to SoA format on CPU
23 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase1_cfi import siPixelRecHitSoAFromLegacyPhase1 as _siPixelRecHitsPreSplittingSoA
24 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase2_cfi import siPixelRecHitSoAFromLegacyPhase2 as _siPixelRecHitsPreSplittingSoAPhase2
25 
26 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
27 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCPU, _siPixelRecHitsPreSplittingSoAPhase2.clone(convertToLegacy=True, CPE = cms.string('PixelCPEFastPhase2')))
28 
29 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
30 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
31 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
32  cpu = cms.EDAlias(
33  siPixelRecHitsPreSplittingCPU = cms.VPSet(
34  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
35  cms.PSet(type = cms.string("uintAsHostProduct"))
36  )
37 ))
38 
39 
40 siPixelRecHitsPreSplittingTask = cms.Task(
41  # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
42  siPixelRecHitsPreSplitting
43 )
44 
45 # reconstruct the pixel rechits on the gpu
46 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase1_cfi import siPixelRecHitCUDAPhase1 as _siPixelRecHitCUDAPhase1
47 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase2_cfi import siPixelRecHitCUDAPhase2 as _siPixelRecHitCUDAPhase2
48 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDAPhase1.clone(
49  beamSpot = "offlineBeamSpotToCUDA"
50 )
51 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCUDA,_siPixelRecHitCUDAPhase2.clone(
52  beamSpot = "offlineBeamSpotToCUDA"
53 ))
54 
55 #this is an alias for the SoA on GPU or CPU to be used for DQM
56 siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
57  cpu = cms.EDAlias(
58  siPixelRecHitsPreSplittingCPU = cms.VPSet(
59  cms.PSet(type = cms.string("pixelTopologyPhase1TrackingRecHitSoAHost")),
60  cms.PSet(type = cms.string("uintAsHostProduct"))
61  )),
62 )
63 
64 phase2_tracker.toModify(siPixelRecHitsPreSplittingSoA,
65 cpu = cms.EDAlias(
66  siPixelRecHitsPreSplittingCPU = cms.VPSet(
67  cms.PSet(type = cms.string("pixelTopologyPhase2TrackingRecHitSoAHost")),
68  cms.PSet(type = cms.string("uintAsHostProduct"))
69  )))
70 
71 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase1_cfi import siPixelRecHitSoAFromCUDAPhase1 as _siPixelRecHitSoAFromCUDA
72 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase2_cfi import siPixelRecHitSoAFromCUDAPhase2 as _siPixelRecHitSoAFromCUDAPhase2
73 
74 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDA.clone())
75 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDAPhase2.clone())
76 
77 # transfer the pixel rechits to the host and convert them from SoA
78 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase1_cfi import siPixelRecHitFromCUDAPhase1 as _siPixelRecHitFromCUDA
79 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase2_cfi import siPixelRecHitFromCUDAPhase2 as _siPixelRecHitFromCUDAPhase2
80 
81 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
82 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDAPhase2.clone())
83 
84 
85 
86 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
87  cms.Task(
88  # reconstruct the pixel rechits on the cpu
89  siPixelRecHitsPreSplittingCPU,
90  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
91  siPixelRecHitsPreSplittingTask.copy(),
92  # producing and converting on cpu (if needed)
93  siPixelRecHitsPreSplittingSoA)
94  )
95  )
96 
97 
98 #(gpu & pixelNtupletFit & phase2_tracker).toReplaceWith(siPixelRecHitsPreSplitting , cuda = _siPixelRecHitFromCUDAPhase2.clone())
99 
100 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
101  # reconstruct the pixel rechits on the gpu or on the cpu
102  # (normally only one of the two is run because only one is consumed from later stages)
103  siPixelRecHitsPreSplittingCUDA,
104  siPixelRecHitsPreSplittingCPU,
105  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
106  siPixelRecHitsPreSplittingTask.copy(),
107  # producing and converting on cpu (if needed)
108  siPixelRecHitsPreSplittingSoA
109 ))