コード例 #1
0
def customisePixelTrackReconstruction(process):

    if not 'HLTRecoPixelTracksSequence' in process.__dict__:
        return process

    hasHLTPixelVertexReco = 'HLTRecopixelvertexingSequence' in process.__dict__

    # FIXME replace the Sequences with empty ones to avoid expanding them during the (re)definition of Modules and EDAliases

    process.HLTRecoPixelTracksSequence = cms.Sequence()
    if hasHLTPixelVertexReco:
        process.HLTRecopixelvertexingSequence = cms.Sequence()

    # Modules and EDAliases

    # referenced in process.HLTRecoPixelTracksTask

    # cpu only: convert the pixel rechits from legacy to SoA format
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as _siPixelRecHitSoAFromLegacy
    process.hltSiPixelRecHitSoA = _siPixelRecHitSoAFromLegacy.clone(
        src="hltSiPixelClusters",
        beamSpot="hltOnlineBeamSpot",
        convertToLegacy=True)

    # build pixel ntuplets and pixel tracks in SoA format on gpu
    from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA
    process.hltPixelTracksCUDA = _pixelTracksCUDA.clone(
        idealConditions=False,
        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
    from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA
    process.hltPixelTracksSoA = SwitchProducerCUDA(
        # build pixel ntuplets and pixel tracks in SoA format on cpu
        cpu=_pixelTracksCUDA.clone(idealConditions=False,
                                   pixelRecHitSrc="hltSiPixelRecHitSoA",
                                   onGPU=False),
        # transfer the pixel tracks in SoA format to the host
        cuda=_pixelTracksSoA.clone(src="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
    process.hltPixelTracks = _pixelTrackProducerFromSoA.clone(
        beamSpot="hltOnlineBeamSpot",
        pixelRecHitLegacySrc="hltSiPixelRecHits",
        trackSrc="hltPixelTracksSoA")

    # referenced in process.HLTRecopixelvertexingTask
    if hasHLTPixelVertexReco:

        # build pixel vertices in SoA format on gpu
        from RecoPixelVertexing.PixelVertexFinding.pixelVerticesCUDA_cfi import pixelVerticesCUDA as _pixelVerticesCUDA
        process.hltPixelVerticesCUDA = _pixelVerticesCUDA.clone(
            pixelTrackSrc="hltPixelTracksCUDA", onGPU=True)

        # build or transfer pixel vertices in SoA format on cpu
        from RecoPixelVertexing.PixelVertexFinding.pixelVerticesSoA_cfi import pixelVerticesSoA as _pixelVerticesSoA
        process.hltPixelVerticesSoA = SwitchProducerCUDA(
            # build pixel vertices in SoA format on cpu
            cpu=_pixelVerticesCUDA.clone(pixelTrackSrc="hltPixelTracksSoA",
                                         onGPU=False),
            # transfer the pixel vertices in SoA format to cpu
            cuda=_pixelVerticesSoA.clone(src="hltPixelVerticesCUDA"))

        # convert the pixel vertices from SoA to legacy format
        from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
        process.hltPixelVertices = _pixelVertexFromSoA.clone(
            src="hltPixelVerticesSoA",
            TrackCollection="hltPixelTracks",
            beamSpot="hltOnlineBeamSpot")

    # Tasks and Sequences

    process.HLTRecoPixelTracksTask = cms.Task(
        process.hltPixelTracksTrackingRegions,  # from the original sequence
        process.hltSiPixelRecHitSoA,  # pixel rechits on cpu, converted to SoA
        process.hltPixelTracksCUDA,  # pixel ntuplets on gpu, in SoA format
        process.hltPixelTracksSoA,  # pixel ntuplets on cpu, in SoA format
        process.hltPixelTracks)  # pixel tracks on cpu, in legacy format

    process.HLTRecoPixelTracksSequence = cms.Sequence(
        process.HLTRecoPixelTracksTask)

    if hasHLTPixelVertexReco:
        process.HLTRecopixelvertexingTask = cms.Task(
            process.HLTRecoPixelTracksTask,
            process.
            hltPixelVerticesCUDA,  # pixel vertices on gpu, in SoA format
            process.
            hltPixelVerticesSoA,  # pixel vertices on cpu, in SoA format
            process.
            hltPixelVertices,  # pixel vertices on cpu, in legacy format
            process.hltTrimmedPixelVertices)  # from the original sequence

        process.HLTRecopixelvertexingSequence = cms.Sequence(
            process.hltPixelTracksFitter
            +  # not used here, kept for compatibility with legacy sequences
            process.
            hltPixelTracksFilter,  # not used here, kept for compatibility with legacy sequences
            process.HLTRecopixelvertexingTask)

    # done
    return process
コード例 #2
0
ファイル: PixelTracks_cff.py プロジェクト: y19y19/cmssw
_pixelTracksTask_lowPU = pixelTracksTask.copy()
_pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets,
                               pixelTracksHitTriplets)
trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU)

# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction
from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit

from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA

# SwitchProducer providing the pixel tracks in SoA format on the CPU
pixelTracksSoA = SwitchProducerCUDA(
    # build pixel ntuplets and pixel tracks in SoA format on the CPU
    cpu=_pixelTracksCUDA.clone(pixelRecHitSrc="siPixelRecHitsPreSplittingSoA",
                               idealConditions=False,
                               onGPU=False))
# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows
run3_common.toModify(pixelTracksSoA.cpu, idealConditions=True)

# convert the pixel tracks from SoA to legacy format
from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA
pixelNtupletFit.toReplaceWith(
    pixelTracks,
    _pixelTrackProducerFromSoA.clone(
        pixelRecHitLegacySrc="siPixelRecHitsPreSplitting", ))

pixelNtupletFit.toReplaceWith(
    pixelTracksTask,
    cms.Task(
        #pixelTracksTrackingRegions,