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 # convert the pixel rechits from legacy to SoA format
20 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitsPreSplittingSoA
21 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromCUDA_cfi import siPixelRecHitSoAFromCUDA as _siPixelRecHitSoAFromCUDA
22 
23 siPixelRecHitsPreSplittingCPU = _siPixelRecHitsPreSplittingSoA.clone(convertToLegacy=True)
24 
25 # phase 2 tracker modifier
26 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
27 phase2_tracker.toModify(siPixelRecHitsPreSplittingCPU,
28  isPhase2 = True)
29 
30 # modifier used to prompt patatrack pixel tracks reconstruction on cpu
31 from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
32 pixelNtupletFit.toModify(siPixelRecHitsPreSplitting,
33  cpu = cms.EDAlias(
34  siPixelRecHitsPreSplittingCPU = cms.VPSet(
35  cms.PSet(type = cms.string("SiPixelRecHitedmNewDetSetVector")),
36  cms.PSet(type = cms.string("uintAsHostProduct"))
37  )
38 ))
39 
40 
41 siPixelRecHitsPreSplittingTask = cms.Task(
42  # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
43  siPixelRecHitsPreSplitting
44 )
45 
46 # reconstruct the pixel rechits on the gpu
47 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
48 siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone(
49  beamSpot = "offlineBeamSpotToCUDA"
50 )
51 
52 # transfer the pixel rechits to the host and convert them from SoA
53 from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
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("cmscudacompatCPUTraitsTrackingRecHit2DHeterogeneous")),
60  cms.PSet(type = cms.string("uintAsHostProduct"))
61  )),
62 )
63 
64 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA,cuda = _siPixelRecHitSoAFromCUDA.clone())
65 
66 (gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting, cuda = _siPixelRecHitFromCUDA.clone())
67 
68 pixelNtupletFit.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
69  cms.Task(
70  # reconstruct the pixel rechits on the cpu
71  siPixelRecHitsPreSplittingCPU,
72  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
73  siPixelRecHitsPreSplittingTask.copy(),
74  # producing and converting on cpu (if needed)
75  siPixelRecHitsPreSplittingSoA)
76  )
77  )
78 
79 (gpu & pixelNtupletFit).toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task(
80  # reconstruct the pixel rechits on the gpu or on the cpu
81  # (normally only one of the two is run because only one is consumed from later stages)
82  siPixelRecHitsPreSplittingCUDA,
83  siPixelRecHitsPreSplittingCPU,
84  # SwitchProducer wrapping an EDAlias on cpu or the converter from SoA to legacy on gpu
85  siPixelRecHitsPreSplittingTask.copy(),
86  # producing and converting on cpu (if needed)
87  siPixelRecHitsPreSplittingSoA
88 ))