CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 from Configuration.Eras.Modifier_phase2_brickedPixels_cff import phase2_brickedPixels
13 phase2_brickedPixels.toModify(siPixelRecHits,
14  CPE = 'PixelCPEGenericForBricked'
15 )
16 
17 # SwitchProducer wrapping the legacy pixel rechit producer
18 siPixelRecHitsPreSplitting = SwitchProducerCUDA(
19  cpu = siPixelRecHits.clone(
20  src = 'siPixelClustersPreSplitting'
21  )
22 )
23 
24 # convert the pixel rechits from legacy to SoA format
25 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitsPreSplittingSoA
26 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDA_cfi import siPixelRecHitSoAFromCUDA as _siPixelRecHitSoAFromCUDA
27 
28 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
29 
30 # phase 2 tracker modifier
31 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
32 phase2_tracker.toModify(siPixelRecHitsPreSplittingCPU,
33  isPhase2 = True)
34 
35 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
36 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
37 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
38  cpu = cms.EDAlias(
39  siPixelRecHitsPreSplittingCPU = cms.VPSet(
40  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
41  cms.PSet(type = cms.string("uintAsHostProduct"))
42  )
43 ))
44 
45 
46 siPixelRecHitsPreSplittingTask = cms.Task(
47  # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
48  siPixelRecHitsPreSplitting
49 )
50 
51 # reconstruct the pixel rechits on the gpu
52 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
53 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone(
54  beamSpot = "offlineBeamSpotToCUDA"
55 )
56 
57 # transfer the pixel rechits to the host and convert them from SoA
58 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
59 
60 #this is an alias for the SoA on GPU or CPU to be used for DQM
61 siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
62  cpu = cms.EDAlias(
63  siPixelRecHitsPreSplittingCPU = cms.VPSet(
64  cms.PSet(type = cms.string("cmscudacompatCPUTraitsTrackingRecHit2DHeterogeneous")),
65  cms.PSet(type = cms.string("uintAsHostProduct"))
66  )),
67 )
68 
69 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA,cuda = _siPixelRecHitSoAFromCUDA.clone())
70 
71 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
72 
73 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
74  cms.Task(
75  # reconstruct the pixel rechits on the cpu
76  siPixelRecHitsPreSplittingCPU,
77  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
78  siPixelRecHitsPreSplittingTask.copy(),
79  # producing and converting on cpu (if needed)
80  siPixelRecHitsPreSplittingSoA)
81  )
82  )
83 
84 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
85  # reconstruct the pixel rechits on the gpu or on the cpu
86  # (normally only one of the two is run because only one is consumed from later stages)
87  siPixelRecHitsPreSplittingCUDA,
88  siPixelRecHitsPreSplittingCPU,
89  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
90  siPixelRecHitsPreSplittingTask.copy(),
91  # producing and converting on cpu (if needed)
92  siPixelRecHitsPreSplittingSoA
93 ))