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 # HIon modifiers
22 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
23 
24 # convert the pixel rechits from legacy to SoA format on CPU
25 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase1_cfi import siPixelRecHitSoAFromLegacyPhase1 as _siPixelRecHitsPreSplittingSoA
26 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyPhase2_cfi import siPixelRecHitSoAFromLegacyPhase2 as _siPixelRecHitsPreSplittingSoAPhase2
27 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacyHIonPhase1_cfi import siPixelRecHitSoAFromLegacyHIonPhase1 as _siPixelRecHitsPreSplittingSoAHIonPhase1
28 
29 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
30 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelRecHitsPreSplittingCPU, _siPixelRecHitsPreSplittingSoAHIonPhase1.clone(convertToLegacy=True, CPE = cms.string('PixelCPEFastHIonPhase1')))
31 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCPU, _siPixelRecHitsPreSplittingSoAPhase2.clone(convertToLegacy=True, CPE = cms.string('PixelCPEFastPhase2')))
32 
33 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
34 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
35 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
36  cpu = cms.EDAlias(
37  siPixelRecHitsPreSplittingCPU = cms.VPSet(
38  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
39  cms.PSet(type = cms.string("uintAsHostProduct"))
40  )
41 ))
42 
43 
44 siPixelRecHitsPreSplittingTask = cms.Task(
45  # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
46  siPixelRecHitsPreSplitting
47 )
48 
49 # reconstruct the pixel rechits on the gpu
50 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase1_cfi import siPixelRecHitCUDAPhase1 as _siPixelRecHitCUDAPhase1
51 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAPhase2_cfi import siPixelRecHitCUDAPhase2 as _siPixelRecHitCUDAPhase2
52 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDAHIonPhase1_cfi import siPixelRecHitCUDAHIonPhase1 as _siPixelRecHitCUDAHIonPhase1
53 
54 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDAPhase1.clone(
55  beamSpot = "offlineBeamSpotToCUDA"
56 )
57 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelRecHitsPreSplittingCUDA,_siPixelRecHitCUDAHIonPhase1.clone(
58  beamSpot = "offlineBeamSpotToCUDA"
59 ))
60 phase2_tracker.toReplaceWith(siPixelRecHitsPreSplittingCUDA,_siPixelRecHitCUDAPhase2.clone(
61  beamSpot = "offlineBeamSpotToCUDA"
62 ))
63 
64 #this is an alias for the SoA on GPU or CPU to be used for DQM
65 siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
66  cpu = cms.EDAlias(
67  siPixelRecHitsPreSplittingCPU = cms.VPSet(
68  cms.PSet(type = cms.string("pixelTopologyPhase1TrackingRecHitSoAHost")),
69  cms.PSet(type = cms.string("uintAsHostProduct"))
70  )),
71 )
72 
73 (pp_on_AA & ~phase2_tracker).toModify(siPixelRecHitsPreSplittingSoA,
74  cpu = cms.EDAlias(
75  siPixelRecHitsPreSplittingCPU = cms.VPSet(
76  cms.PSet(type = cms.string("pixelTopologyHIonPhase1TrackingRecHitSoAHost")),
77  cms.PSet(type = cms.string("uintAsHostProduct"))
78  )))
79 
80 phase2_tracker.toModify(siPixelRecHitsPreSplittingSoA,
81  cpu = cms.EDAlias(
82  siPixelRecHitsPreSplittingCPU = cms.VPSet(
83  cms.PSet(type = cms.string("pixelTopologyPhase2TrackingRecHitSoAHost")),
84  cms.PSet(type = cms.string("uintAsHostProduct"))
85  )))
86 
87 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase1_cfi import siPixelRecHitSoAFromCUDAPhase1 as _siPixelRecHitSoAFromCUDA
88 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAHIonPhase1_cfi import siPixelRecHitSoAFromCUDAHIonPhase1 as _siPixelRecHitSoAFromCUDAHIonPhase1
89 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDAPhase2_cfi import siPixelRecHitSoAFromCUDAPhase2 as _siPixelRecHitSoAFromCUDAPhase2
90 
91 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDA.clone())
92 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplittingSoA, cuda = _siPixelRecHitSoAFromCUDAPhase2.clone())
93 
94 # transfer the pixel rechits to the host and convert them from SoA
95 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase1_cfi import siPixelRecHitFromCUDAPhase1 as _siPixelRecHitFromCUDA
96 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAHIonPhase1_cfi import siPixelRecHitFromCUDAHIonPhase1 as _siPixelRecHitFromCUDAHIonPhase1
97 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDAPhase2_cfi import siPixelRecHitFromCUDAPhase2 as _siPixelRecHitFromCUDAPhase2
98 
99 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
100 (gpu & pixelNtupletFit & pp_on_AA).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDAHIonPhase1.clone())
101 (gpu & pixelNtupletFit & phase2_tracker).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDAPhase2.clone())
102 
103 
104 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
105  cms.Task(
106  # reconstruct the pixel rechits on the cpu
107  siPixelRecHitsPreSplittingCPU,
108  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
109  siPixelRecHitsPreSplittingTask.copy(),
110  # producing and converting on cpu (if needed)
111  siPixelRecHitsPreSplittingSoA)
112  )
113  )
114 
115 
116 #(gpu & pixelNtupletFit & phase2_tracker).toReplaceWith(siPixelRecHitsPreSplitting , cuda = _siPixelRecHitFromCUDAPhase2.clone())
117 
118 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
119  # reconstruct the pixel rechits on the gpu or on the cpu
120  # (normally only one of the two is run because only one is consumed from later stages)
121  siPixelRecHitsPreSplittingCUDA,
122  siPixelRecHitsPreSplittingCPU,
123  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
124  siPixelRecHitsPreSplittingTask.copy(),
125  # producing and converting on cpu (if needed)
126  siPixelRecHitsPreSplittingSoA
127 ))