Skip to content

Commit

Permalink
Update customizeHLTforPatatrack for Run 3 and CMSSW 11.2.x (#573)
Browse files Browse the repository at this point in the history
Update the pixel reconstruction for Run 3 conditions:
  - hltSiPixelClustersCUDA.isRun2 = False
  - hltPixelTracksCUDA.idealConditions = True
  - hltPixelTracksSoA.cpu.idealConditions = True

Do not set the Pixel CPE "DoLorentz" parameter, since it has no effect.

Update the beamspot module name to `hltOnlineBeamSpotToCUDA`.

Add the GPU status to the HLT and process schedule.

Remove the ECAL and HCAL GenericConsumer modules from the default sequences.

Add customisations to benchmark the Pixel, ECAL and HCAL reconstruction:
  - on the GPU in SoA format;
  - on the CPU in SoA format (when available);
  - on the CPU in legacy format.
  • Loading branch information
fwyzard authored Nov 23, 2020
1 parent 3ef20e5 commit 4c8d955
Showing 1 changed file with 106 additions and 20 deletions.
126 changes: 106 additions & 20 deletions HLTrigger/Configuration/python/customizeHLTforPatatrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import FWCore.ParameterSet.Config as cms
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
from HLTrigger.Configuration.common import *
from Configuration.Eras.Modifier_run3_common_cff import run3_common


# force the SwitchProducerCUDA choice to pick a specific backend: True for offloading to a gpu, False for running on cpu
Expand Down Expand Up @@ -54,6 +55,10 @@ def customiseCommon(process):
replace_with(process.Status_OnGPU, cms.Path(process.statusOnGPU + process.statusOnGPUFilter))
else:
process.Status_OnGPU = cms.Path(process.statusOnGPU + process.statusOnGPUFilter)
if 'HLTSchedule' in process.__dict__:
process.HLTSchedule.append(process.Status_OnGPU)
if process.schedule is not None:
process.schedule.append(process.Status_OnGPU)


# make the ScoutingCaloMuonOutput endpath compatible with using Tasks in the Scouting paths
Expand Down Expand Up @@ -100,22 +105,23 @@ def customisePixelLocalReconstruction(process):
process.load("CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi") # this should be used only on GPUs, will crash otherwise
process.load("RecoLocalTracker.SiPixelClusterizer.siPixelFedCablingMapGPUWrapper_cfi") # this should be used only on GPUs, will crash otherwise
process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")
process.PixelCPEFastESProducer.DoLorentz = True


# Modules and EDAliases

# referenced in HLTDoLocalPixelTask

# transfer the beamspot to the gpu
from RecoVertex.BeamSpotProducer.offlineBeamSpotCUDA_cfi import offlineBeamSpotCUDA as _offlineBeamSpotCUDA
process.hltOnlineBeamSpotCUDA = _offlineBeamSpotCUDA.clone(
from RecoVertex.BeamSpotProducer.offlineBeamSpotToCUDA_cfi import offlineBeamSpotToCUDA as _offlineBeamSpotToCUDA
process.hltOnlineBeamSpotToCUDA = _offlineBeamSpotToCUDA.clone(
src = "hltOnlineBeamSpot"
)

# reconstruct the pixel digis and clusters on the gpu
from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA
process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone()
# use the pixel channel calibrations scheme for Run 3
run3_common.toModify(process.hltSiPixelClustersCUDA, isRun2 = False)

# copy the pixel digis errors to the host
from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA
Expand Down Expand Up @@ -175,7 +181,7 @@ def customisePixelLocalReconstruction(process):
from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
src = "hltSiPixelClustersCUDA",
beamSpot = "hltOnlineBeamSpotCUDA"
beamSpot = "hltOnlineBeamSpotToCUDA"
)

# SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
Expand All @@ -194,7 +200,7 @@ def customisePixelLocalReconstruction(process):
# Tasks and Sequences

process.HLTDoLocalPixelTask = cms.Task(
process.hltOnlineBeamSpotCUDA, # transfer the beamspot to the gpu
process.hltOnlineBeamSpotToCUDA, # transfer the beamspot to the gpu
process.hltSiPixelClustersCUDA, # reconstruct the pixel digis and clusters on the gpu
process.hltSiPixelRecHitsCUDA, # reconstruct the pixel rechits on the gpu
process.hltSiPixelDigisSoA, # copy the pixel digis (except errors) and clusters to the host
Expand Down Expand Up @@ -245,6 +251,8 @@ def customisePixelTrackReconstruction(process):
pixelRecHitSrc = "hltSiPixelRecHitsCUDA",
onGPU = True
)
# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
run3_common.toModify(process.hltPixelTracksCUDA, idealConditions = True)

# SwitchProducer providing the pixel tracks in SoA format on cpu
process.hltPixelTracksSoA = SwitchProducerCUDA(
Expand All @@ -259,6 +267,8 @@ def customisePixelTrackReconstruction(process):
src = cms.InputTag("hltPixelTracksCUDA")
)
)
# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
run3_common.toModify(process.hltPixelTracksSoA.cpu, idealConditions = True)

# convert the pixel tracks from SoA to legacy format
from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA
Expand Down Expand Up @@ -521,11 +531,6 @@ def customiseEcalLocalReconstruction(process):
)
)

# consume the ECAL rechits
process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltEcalRecHit' )
)

# Tasks and Sequences

process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask = cms.Task(
Expand All @@ -541,7 +546,6 @@ def customiseEcalLocalReconstruction(process):
process.hltEcalRecHit) # legacy producer

process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence(
process.hltEcalConsumer, # consume the ECAL rechits
process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerTask)

process.HLTPreshowerTask = cms.Task(
Expand All @@ -555,11 +559,9 @@ def customiseEcalLocalReconstruction(process):
process.HLTPreshowerTask)

process.HLTDoFullUnpackingEgammaEcalSequence = cms.Sequence(
process.hltEcalConsumer, # consume the ECAL rechits
process.HLTDoFullUnpackingEgammaEcalTask)

process.HLTDoFullUnpackingEgammaEcalMFSequence = cms.Sequence(
process.hltEcalConsumer, # consume the ECAL rechits
process.HLTDoFullUnpackingEgammaEcalTask)


Expand Down Expand Up @@ -648,11 +650,6 @@ def customiseHcalLocalReconstruction(process):
)
)

# consume the HCAL rechits
process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltHbhereco' )
)


# Tasks and Sequences

Expand All @@ -667,7 +664,6 @@ def customiseHcalLocalReconstruction(process):
process.hltHoreco) # legacy producer

process.HLTDoLocalHcalSequence = cms.Sequence(
process.hltHbheConsumer, # consume the HCAL rechits
process.HLTDoLocalHcalTask)

process.HLTStoppedHSCPLocalHcalRecoTask = cms.Task(
Expand All @@ -678,7 +674,6 @@ def customiseHcalLocalReconstruction(process):
process.hltHbhereco) # SwitchProducer between the legacy producer and the copy from gpu with conversion

process.HLTStoppedHSCPLocalHcalReco = cms.Sequence(
process.hltHbheConsumer, # consume the HCAL rechits
process.HLTStoppedHSCPLocalHcalRecoTask)


Expand All @@ -694,3 +689,94 @@ def customizeHLTforPatatrack(process):
process = customiseEcalLocalReconstruction(process)
process = customiseHcalLocalReconstruction(process)
return process


def _addConsumerPath(process):
# add to a path all consumers and the tasks that define the producers
process.Consumer = cms.Path(
process.HLTBeginSequence +
process.hltPixelConsumer +
process.hltEcalConsumer +
process.hltHbheConsumer,
process.HLTDoLocalPixelTask,
process.HLTRecoPixelTracksTask,
process.HLTRecopixelvertexingTask,
process.HLTDoFullUnpackingEgammaEcalTask,
process.HLTDoLocalHcalTask,
)

if 'HLTSchedule' in process.__dict__:
process.HLTSchedule.append(process.Consumer)
if process.schedule is not None:
process.schedule.append(process.Consumer)

# done
return process


def consumeGPUSoAProducts(process):
# consume the Pixel tracks and vertices on the GPU in SoA format
process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltPixelTracksCUDA', 'hltPixelVerticesCUDA' )
)

# consume the ECAL uncalibrated rechits on the GPU in SoA format
process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitGPU' )
)

# consume the HCAL rechits on the GPU in SoA format
process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltHbherecoGPU' )
)

# add to a path all consumers and the tasks that define the producers
process = _addConsumerPath(process)

# done
return process


def consumeCPUSoAProducts(process):
# consume the Pixel tracks and vertices on the CPU in SoA format
process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltPixelTracksSoA', 'hltPixelVerticesSoA' )
)

# consume the ECAL uncalibrated rechits on the CPU in SoA format
process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHitSoA' )
)

# consume the HCAL rechits on the CPU in legacy format
process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltHbhereco' )
)

# add to a path all consumers and the tasks that define the producers
process = _addConsumerPath(process)

# done
return process

def consumeCPULegacyProducts(process):
# consume the Pixel tracks and vertices on the CPU in legacy format
process.hltPixelConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltPixelTracks', 'hltPixelVertices' )
)

# consume the ECAL runcalibrated echits on the CPU in legacy format
process.hltEcalConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltEcalUncalibRecHit' )
)

# consume the HCAL rechits on the CPU in legacy format
process.hltHbheConsumer = cms.EDAnalyzer("GenericConsumer",
eventProducts = cms.untracked.vstring( 'hltHbhereco' )
)

# add to a path all consumers and the tasks that define the producers
process = _addConsumerPath(process)

# done
return process

0 comments on commit 4c8d955

Please sign in to comment.