Example #1
0
def customizePixelTracksSoAonCPU(process):

    process.CUDAService = cms.Service("CUDAService",
                                      enabled=cms.untracked.bool(False))

    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitHostSoA_cfi import siPixelRecHitHostSoA
    process.siPixelRecHitsPreSplitting = siPixelRecHitHostSoA.clone(
        convertToLegacy=True)

    from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA
    process.pixelTrackSoA = caHitNtupletCUDA.clone(
        onGPU=False, pixelRecHitSrc='siPixelRecHitsPreSplitting')

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA
    process.pixelVertexSoA = pixelVertexCUDA.clone(
        onGPU=False, pixelTrackSrc='pixelTrackSoA')

    from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA
    process.pixelTracks = pixelTrackProducerFromSoA.clone(
        pixelRecHitLegacySrc='siPixelRecHitsPreSplitting')

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA
    process.pixelVertices = pixelVertexFromSoA.clone()

    process.reconstruction_step += process.siPixelRecHitsPreSplitting + process.pixelTrackSoA + process.pixelVertexSoA

    return process
def customizePixelTracksSoAonCPU(process):

    process.CUDAService = cms.Service('CUDAService',
                                      enabled=cms.untracked.bool(False))

    # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU
    process.siPixelClustersPreSplitting.cpu.payloadType = cms.string('HLT')

    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy
    process.siPixelRecHitsPreSplitting = siPixelRecHitSoAFromLegacy.clone(
        convertToLegacy=True)

    from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA
    process.pixelTrackSoA = caHitNtupletCUDA.clone(
        onGPU=False, pixelRecHitSrc='siPixelRecHitsPreSplitting')

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA
    process.pixelVertexSoA = pixelVertexCUDA.clone(
        onGPU=False, pixelTrackSrc='pixelTrackSoA')

    from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA
    process.pixelTracks = pixelTrackProducerFromSoA.clone(
        pixelRecHitLegacySrc='siPixelRecHitsPreSplitting')

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA
    process.pixelVertices = pixelVertexFromSoA.clone()

    process.reconstruction_step += process.siPixelRecHitsPreSplitting + process.pixelTrackSoA + process.pixelVertexSoA

    return process
Example #3
0
def customisePixelTrackReconstruction(process):

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

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

    process.HLTRecoPixelTracksSequence = cms.Sequence()
    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.caHitNtupletCUDA_cfi import caHitNtupletCUDA as _caHitNtupletCUDA
    process.hltPixelTracksCUDA = _caHitNtupletCUDA.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
    process.hltPixelTracksSoA = SwitchProducerCUDA(
        # build pixel ntuplets and pixel tracks in SoA format on cpu
        cpu=_caHitNtupletCUDA.clone(idealConditions=False,
                                    pixelRecHitSrc="hltSiPixelRecHitSoA",
                                    onGPU=False),
        # transfer the pixel tracks in SoA format to the host
        cuda=cms.EDProducer("PixelTrackSoAFromCUDA",
                            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
    process.hltPixelTracks = _pixelTrackProducerFromSoA.clone(
        beamSpot="hltOnlineBeamSpot",
        pixelRecHitLegacySrc="hltSiPixelRecHits",
        trackSrc="hltPixelTracksSoA")

    # referenced in process.HLTRecopixelvertexingTask

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

    # build or transfer pixel vertices in SoA format on cpu
    process.hltPixelVerticesSoA = SwitchProducerCUDA(
        # build pixel vertices in SoA format on cpu
        cpu=_pixelVertexCUDA.clone(pixelTrackSrc="hltPixelTracksSoA",
                                   onGPU=False),
        # transfer the pixel vertices in SoA format to cpu
        cuda=cms.EDProducer("PixelVertexSoAFromCUDA",
                            src=cms.InputTag("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)

    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
def customise_cpu_pixel(process):

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

    process.HLTRecoPixelTracksPPOnAASequence = cms.Sequence()
    process.HLTRecopixelvertexingSequencePPOnAA = cms.Sequence()

    # Event Setup

    process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")
    process.PixelCPEFastESProducer.DoLorentz = True

    # Modules and EDAliases

    # referenced in process.HLTRecoPixelTracksSequence

    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitHostSoA_cfi import siPixelRecHitHostSoA as _siPixelRecHitHostSoA
    process.hltSiPixelRecHitSoAPPOnAA = _siPixelRecHitHostSoA.clone(
        beamSpot="hltOnlineBeamSpot",
        src="hltSiPixelClustersPPOnAA",
        convertToLegacy=True)

    from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA as _caHitNtupletCUDA
    process.hltPixelTracksHitQuadrupletsPPOnAA = _caHitNtupletCUDA.clone(
        idealConditions=False,
        pixelRecHitSrc="hltSiPixelRecHitSoAPPOnAA",
        onGPU=False)

    process.hltPixelTracksSoAPPOnAA = cms.EDAlias(
        hltPixelTracksHitQuadrupletsPPOnAA=cms.VPSet(
            cms.PSet(type=cms.string("32768TrackSoATHeterogeneousSoA"))))

    from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA
    process.hltPixelTracksPPOnAA = _pixelTrackProducerFromSoA.clone(
        beamSpot="hltOnlineBeamSpot",
        pixelRecHitLegacySrc="hltSiPixelRecHitsPPOnAA",
        trackSrc="hltPixelTracksSoAPPOnAA")

    # referenced in process.HLTRecopixelvertexingSequence

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA
    process.hltPixelVerticesSoAPPOnAA = _pixelVertexCUDA.clone(
        pixelTrackSrc="hltPixelTracksSoAPPOnAA", onGPU=False)

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA
    process.hltPixelVerticesPPOnAA = _pixelVertexFromSoA.clone(
        TrackCollection="hltPixelTracksPPOnAA",
        beamSpot="hltOnlineBeamSpot",
        src="hltPixelVerticesSoAPPOnAA")

    # Sequences

    process.HLTRecoPixelTracksSequencePPOnAA = 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.
        hltPixelTracksTrackingRegionsPPOnAA  # from the original sequence
        + process.
        hltSiPixelRecHitSoAPPOnAA  # pixel rechits on cpu, converted to SoA
        + process.
        hltPixelTracksHitQuadrupletsPPOnAA  # pixel ntuplets on cpu, in SoA format
        # process.hltPixelTracksSoA                         # alias for hltPixelTracksHitQuadruplets
        + process.hltPixelTracksPPOnAA
    )  # pixel tracks on cpu, with transfer and conversion to legacy
    process.HLTRecoPixelTracksPPOnAASequence = cms.Sequence(
        process.HLTRecoPixelTracksSequencePPOnAA)

    process.HLTRecopixelvertexingSequencePPOnAA = cms.Sequence(
        process.HLTRecoPixelTracksSequencePPOnAA + process.
        hltPixelVerticesSoAPPOnAA  # pixel vertices on cpu, in SoA format
        + process.
        hltPixelVerticesPPOnAA  # pixel vertices on cpu, in legacy format
        + process.hltTrimmedPixelVerticesPPOnAA)  # from the original sequence
    process.HLTPixelVertexingPPOnAASequence = cms.Sequence(
        process.HLTRecopixelvertexingSequencePPOnAA)
    process.HLTPixelVertexingSequencePPOnAA = cms.Sequence(
        process.HLTRecopixelvertexingSequencePPOnAA)

    # done
    return process
def customise_gpu_pixel(process):

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

    process.HLTDoLocalPixelSequencePPOnAA = cms.Sequence()
    process.HLTRecoPixelTracksPPOnAASequence = cms.Sequence()
    process.HLTRecopixelvertexingSequencePPOnAA = cms.Sequence()
    process.HLTDoLocalPixelSequencePPOnAAForLowPt = cms.Sequence()

    # Event Setup

    process.load(
        "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi")
    process.load(
        "RecoLocalTracker.SiPixelClusterizer.siPixelFedCablingMapGPUWrapper_cfi"
    )
    process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")
    process.PixelCPEFastESProducer.DoLorentz = True

    # Modules and EDAliases

    # referenced in process.HLTDoLocalPixelSequence

    process.hltOnlineBeamSpotCUDA = cms.EDProducer(
        "BeamSpotToCUDA", src=cms.InputTag("hltOnlineBeamSpot"))

    from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA
    process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone()

    process.hltSiPixelRecHitsCUDA = cms.EDProducer(
        "SiPixelRecHitCUDA",
        CPE=cms.string("PixelCPEFast"),
        beamSpot=cms.InputTag("hltOnlineBeamSpotCUDA"),
        src=cms.InputTag("hltSiPixelClustersCUDA"))

    process.hltSiPixelDigisSoA = cms.EDProducer(
        "SiPixelDigisSoAFromCUDA", src=cms.InputTag("hltSiPixelClustersCUDA"))

    process.hltSiPixelDigisClusters = cms.EDProducer(
        "SiPixelDigisClustersFromSoA", src=cms.InputTag("hltSiPixelDigisSoA"))

    process.hltSiPixelDigiErrorsSoA = cms.EDProducer(
        "SiPixelDigiErrorsSoAFromCUDA",
        src=cms.InputTag("hltSiPixelClustersCUDA"))

    from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
    process.hltSiPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone(
        UsePhase1=True, digiErrorSoASrc="hltSiPixelDigiErrorsSoA")

    process.hltSiPixelRecHitsPPOnAA = cms.EDProducer(
        "SiPixelRecHitFromSOA",
        pixelRecHitSrc=cms.InputTag("hltSiPixelRecHitsCUDA"),
        src=cms.InputTag("hltSiPixelDigisClusters"))
    process.hltSiPixelRecHitsPPOnAAForLowPt = process.hltSiPixelRecHitsPPOnAA.clone(
    )

    process.hltSiPixelDigis = cms.EDAlias(
        hltSiPixelDigisClusters=cms.VPSet(
            cms.PSet(type=cms.string("PixelDigiedmDetSetVector"))),
        hltSiPixelDigiErrors=cms.VPSet(
            cms.PSet(type=cms.string("DetIdedmEDCollection")),
            cms.PSet(type=cms.string("SiPixelRawDataErroredmDetSetVector")),
            cms.PSet(type=cms.string("PixelFEDChanneledmNewDetSetVector"))))

    process.hltSiPixelClustersPPOnAA = cms.EDAlias(
        hltSiPixelDigisClusters=cms.VPSet(
            cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector"))))
    process.hltSiPixelClustersPPOnAAForLowPt = process.hltSiPixelClustersPPOnAA.clone(
    )

    # referenced in process.HLTRecoPixelTracksSequence

    from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA as _caHitNtupletCUDA
    process.hltPixelTracksHitQuadrupletsPPOnAA = _caHitNtupletCUDA.clone(
        idealConditions=False,
        pixelRecHitSrc="hltSiPixelRecHitsCUDA",
        onGPU=True)

    process.hltPixelTracksSoAPPOnAA = cms.EDProducer(
        "PixelTrackSoAFromCUDA",
        src=cms.InputTag("hltPixelTracksHitQuadrupletsPPOnAA"))

    process.hltPixelTracksPPOnAA = cms.EDProducer(
        "PixelTrackProducerFromSoA",
        beamSpot=cms.InputTag("hltOnlineBeamSpot"),
        minNumberOfHits=cms.int32(0),
        pixelRecHitLegacySrc=cms.InputTag("hltSiPixelRecHitsPPOnAA"),
        trackSrc=cms.InputTag("hltPixelTracksSoAPPOnAA"))

    # referenced in process.HLTRecopixelvertexingSequence

    from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA
    process.hltPixelVerticesCUDAPPOnAA = _pixelVertexCUDA.clone(
        pixelTrackSrc="hltPixelTracksHitQuadrupletsPPOnAA", onGPU=True)

    process.hltPixelVerticesSoAPPOnAA = cms.EDProducer(
        "PixelVertexSoAFromCUDA",
        src=cms.InputTag("hltPixelVerticesCUDAPPOnAA"))

    process.hltPixelVerticesPPOnAA = cms.EDProducer(
        "PixelVertexProducerFromSoA",
        src=cms.InputTag("hltPixelVerticesSoAPPOnAA"),
        beamSpot=cms.InputTag("hltOnlineBeamSpot"),
        TrackCollection=cms.InputTag("hltPixelTracksPPOnAA"))

    # Sequences

    HLTLocalPixelGPUSequence = cms.Sequence(
        process.hltOnlineBeamSpotCUDA  # transfer the beamspot to the gpu
        + process.hltSiPixelClustersCUDA  # digis and clusters on gpu
        + process.hltSiPixelRecHitsCUDA  # rechits on gpu
        + process.hltSiPixelDigisSoA  # copy to host
        + process.hltSiPixelDigisClusters  # convert to legacy
        + process.hltSiPixelDigiErrorsSoA  # copy to host
        + process.hltSiPixelDigiErrors)  # convert to legacy

    process.HLTDoLocalPixelSequencePPOnAA = cms.Sequence(
        HLTLocalPixelGPUSequence
        # process.hltSiPixelDigis                           # replaced by an alias
        # process.hltSiPixelClustersPPOnAA                  # replaced by an alias
        + process.
        hltSiPixelClustersCachePPOnAA  # not used here, kept for compatibility with legacy sequences
        + process.hltSiPixelRecHitsPPOnAA)  # convert to legacy

    process.HLTDoLocalPixelSequencePPOnAAForLowPt = cms.Sequence(
        HLTLocalPixelGPUSequence
        # process.hltSiPixelDigis                           # replaced by an alias
        # process.hltSiPixelClustersPPOnAAForLowPt          # replaced by an alias
        + process.
        hltSiPixelClustersCachePPOnAAForLowPt  # not used here, kept for compatibility with legacy sequences
        + process.hltSiPixelRecHitsPPOnAAForLowPt)

    process.HLTRecoPixelTracksSequencePPOnAA = 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.
        hltPixelTracksTrackingRegionsPPOnAA  # from the original sequence
        + process.
        hltPixelTracksHitQuadrupletsPPOnAA  # pixel ntuplets on gpu, in SoA format
        +
        process.hltPixelTracksSoAPPOnAA  # pixel ntuplets on cpu, in SoA format
        + process.hltPixelTracksPPOnAA
    )  # pixel tracks on gpu, with transfer and conversion to legacy
    process.HLTRecoPixelTracksPPOnAASequence = cms.Sequence(
        process.HLTRecoPixelTracksSequencePPOnAA)

    process.HLTRecopixelvertexingSequencePPOnAA = cms.Sequence(
        process.HLTRecoPixelTracksSequencePPOnAA + process.
        hltPixelVerticesCUDAPPOnAA  # pixel vertices on gpu, in SoA format
        + process.
        hltPixelVerticesSoAPPOnAA  # pixel vertices on cpu, in SoA format
        + process.
        hltPixelVerticesPPOnAA  # pixel vertices on cpu, in legacy format
        + process.hltTrimmedPixelVerticesPPOnAA)  # from the original sequence
    process.HLTPixelVertexingPPOnAASequence = cms.Sequence(
        process.HLTRecopixelvertexingSequencePPOnAA)
    process.HLTPixelVertexingSequencePPOnAA = cms.Sequence(
        process.HLTRecopixelvertexingSequencePPOnAA)

    # done

    return process