Beispiel #1
0
def customisePixelLocalReconstruction(process):

    if not 'HLTDoLocalPixelSequence' 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.HLTDoLocalPixelSequence = cms.Sequence()

    # Event Setup

    process.load(
        "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load(
        "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")

    # Modules and EDAliases

    # referenced in HLTDoLocalPixelTask

    # transfer the beamspot to the gpu
    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
    process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # convert the pixel digis errors to the legacy format
    from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
    process.hltSiPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone(
        digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True)

    # copy the pixel digis (except errors) and clusters to the host
    from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
    process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # convert the pixel digis (except errors) and clusters to the legacy format
    from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA
    process.hltSiPixelDigisClusters = _siPixelDigisClustersFromSoA.clone(
        src="hltSiPixelDigisSoA")

    # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA
    process.hltSiPixelDigis = SwitchProducerCUDA(
        # legacy producer
        cpu=process.hltSiPixelDigis,
        # alias used to access products from multiple conversion modules
        cuda=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")))))

    # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
    process.hltSiPixelClusters = SwitchProducerCUDA(
        # legacy producer
        cpu=process.hltSiPixelClusters,
        # alias used to access products from multiple conversion modules
        cuda=cms.EDAlias(hltSiPixelDigisClusters=cms.VPSet(
            cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector")))))

    # reconstruct the pixel rechits on the gpu
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
    process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
        src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA")

    # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
    process.hltSiPixelRecHits = SwitchProducerCUDA(
        # legacy producer
        cpu=process.hltSiPixelRecHits,
        # converter to legacy format
        cuda=_siPixelRecHitFromCUDA.clone(
            pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters"))

    # Tasks and Sequences

    process.HLTDoLocalPixelTask = cms.Task(
        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
        process.
        hltSiPixelDigisClusters,  # convert the pixel digis (except errors) and clusters to the legacy format
        process.
        hltSiPixelDigiErrorsSoA,  # copy the pixel digis errors to the host
        process.
        hltSiPixelDigiErrors,  # convert the pixel digis errors to the legacy format
        process.
        hltSiPixelDigis,  # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA
        process.
        hltSiPixelClusters,  # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
        process.
        hltSiPixelClustersCache,  # legacy module, used by the legacy pixel quadruplet producer
        process.hltSiPixelRecHits
    )  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA

    process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)

    # done
    return process
Beispiel #2
0
def customizePixelTracksSoAonGPU(process) :

  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitHostSoA_cfi import siPixelRecHitHostSoA as _siPixelRecHitFromSOA

  process.load('RecoLocalTracker/SiPixelRecHits/siPixelRecHitHostSoA_cfi')
  process.load('RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi')
  process.load('RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi')
  process.load('RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi')
  process.load('RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi')
  process.load('RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi')

  from RecoLocalTracker.SiPixelClusterizer.siPixelClusterDigisCUDA_cfi import siPixelClusterDigisCUDA
  from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA
  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA
  from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromSOA_cfi import siPixelRecHitFromSOA

  #from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA
  #from RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi import pixelTrackSoA
  #from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackFromSoA

  process.pixelTrackCUDA = process.caHitNtupletCUDA.clone()
  process.pixelTrackCUDA.onGPU = True
  process.pixelTrackCUDA.pixelRecHitSrc = 'siPixelRecHitCUDA'#'siPixelRecHitHostSoA'

  # process.pixelTrackSoA.earlyFishbone = False
  # process.pixelTrackSoA.lateFishbone = True

  process.pixelTrackCUDA.trackQualityCuts.tripletMinPt = 0.5
  process.pixelTrackCUDA.trackQualityCuts.tripletMaxTip = 0.1
  process.pixelTrackCUDA.trackQualityCuts.tripletMaxZip = 7.5
  process.pixelTrackCUDA.trackQualityCuts.quadrupletMinPt = 0.5
  process.pixelTrackCUDA.trackQualityCuts.quadrupletMaxTip = 0.09
  process.pixelTrackCUDA.trackQualityCuts.quadrupletMaxZip = 9.0
  #process.pixelTrackCUDA.trackQualityCuts.upgrade = True
  #process.pixelTrackCUDA.trackQualityCuts.tripletChi2MaxPt = 2.5
  #process.pixelTrackCUDA.trackQualityCuts.chi2MaxPt = 1.8

  process.pixelVertexSoA = process.pixelVertexCUDA.clone()
  process.pixelTrackCUDA.isUpgrade = True

  process.pixelTrackSoA.src = 'pixelTrackCUDA'
  process.pixelTrackCUDA.doClusterCut= False

  #process.pixelVertexSoA.eps = 0.01
  process.pixelVertexSoA.onGPU = True
  process.pixelVertexSoA.pixelTrackSrc = 'pixelTrackSoA'
  
  
  process.pixelTracks = process.pixelTrackProducerFromSoA.clone()
  process.pixelTracks.pixelRecHitLegacySrc = 'siPixelRecHitsPreSplitting'#'siPixelRecHitFromSOA'#'siPixelRecHitHostSoA'

  #process.pixelVertices = process.pixelVertexFromSoA.clone()

  process.siPixelRecHitsPreSplitting = _siPixelRecHitFromSOA.clone()
  process.siPixelRecHitsPreSplitting.Upgrade = True
  process.siPixelRecHitsPreSplittingTask = cms.Task(process.siPixelRecHitsPreSplitting)
  process.siPixelRecHitsPreSplitting.convertToLegacy = True

  process.PixelCPEFastESProducer.Upgrade = True

  process.siPixelClusterDigisCUDA = siPixelClusterDigisCUDA.clone()
#  process.siPixelDigisClustersFromSoA = siPixelDigisClustersFromSoA.clone()
#  process.siPixelDigisClustersPreSplitting = siPixelDigisClustersFromSoA.clone()
  from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
   
  process.siPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
    src = "siPixelClusterDigisCUDA",
    #Upgrade = True
)

  process.siPixelClustersPreSplitting = siPixelDigisClustersFromSoA.clone()
  process.siPixelClustersPreSplitting.src = "siPixelDigisSoA"
  process.siPixelClustersPreSplitting.Upgrade = True
#  process.siPixelRecHitFromSOA = siPixelRecHitFromSOA.clone()
#  process.siPixelRecHitFromSOA.pixelRecHitSrc = 'siPixelRecHitCUDA'
  process.siPixelRecHitsPreSplitting = siPixelRecHitFromSOA.clone()
  process.siPixelRecHitsPreSplitting.pixelRecHitSrc = 'siPixelRecHitCUDA'

#  process.siPixelClustersPreSplitting = siPixelRecHitFromSOA.clone()
#  process.siPixelClustersPreSplitting.pixelRecHitSrc = 'siPixelRecHitCUDA'
   
  process.siPixelRecHitCUDA = siPixelRecHitCUDA.clone()
  process.siPixelRecHitCUDA.src = 'siPixelClusterDigisCUDA'
  
  process.siPixelClustersPreSplittingTask_gpu = cms.Task(
    process.siPixelClusterDigisCUDA,
    process.siPixelDigisSoA,
    process.siPixelClustersPreSplitting #siPixelDigisClustersFromSoA
  )

  process.siPixelRecHitsPreSplittingTask_gpu = cms.Task(
    process.siPixelRecHitCUDA,
    process.siPixelRecHitsPreSplitting #siPixelRecHitFromSOA
  )

  process.PixelCPEFastESProducer.Upgrade = True
  
  #process.pixeltrackerlocalrecoTask = cms.Task(process.siPixelClustersPreSplittingTask,process.siPixelRecHitsPreSplittingTask)
  process.reconstruction_step += process.siPixelClusterDigisCUDA + process.siPixelDigisSoA + process.siPixelRecHitCUDA +process.offlineBeamSpotCUDA + process.pixelTrackCUDA + process.pixelTrackSoA + process.pixelVertexSoA
  #process.pixeltrackerlocalrecoTask = cms.Task(process.siPixelClustersPreSplittingTask_gpu,process.siPixelRecHitsPreSplittingTask_gpu)
  
  return process
def customisePixelLocalReconstruction(process):

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

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

    process.HLTDoLocalPixelSequence = cms.Sequence()

    # Event Setup

    process.load(
        "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load(
        "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")

    # Modules and EDAliases

    # referenced in HLTDoLocalPixelTask

    # transfer the beamspot to the gpu
    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 same thresholds as the legacy module
        clusterThreshold_layer1=process.hltSiPixelClusters.ClusterThreshold_L1,
        clusterThreshold_otherLayers=process.hltSiPixelClusters.
        ClusterThreshold)
    # 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
    process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # copy the pixel digis (except errors) and clusters to the host
    from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
    process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # reconstruct the pixel digis on the cpu
    process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()

    # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
    from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
    process.hltSiPixelDigis = SwitchProducerCUDA(
        # legacy producer
        cpu=cms.EDAlias(hltSiPixelDigisLegacy=cms.VPSet(
            cms.PSet(type=cms.string("DetIdedmEDCollection")),
            cms.PSet(type=cms.string("SiPixelRawDataErroredmDetSetVector")),
            cms.PSet(type=cms.string("PixelFEDChanneledmNewDetSetVector")))),
        # conversion from SoA to legacy format
        cuda=_siPixelDigiErrorsFromSoA.clone(
            digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True))

    # reconstruct the pixel clusters on the cpu
    process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone(
        src="hltSiPixelDigisLegacy")

    # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format
    from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA
    process.hltSiPixelClusters = SwitchProducerCUDA(
        # legacy producer
        cpu=cms.EDAlias(hltSiPixelClustersLegacy=cms.VPSet(
            cms.PSet(type=cms.string("SiPixelClusteredmNewDetSetVector")))),
        # conversion from SoA to legacy format
        cuda=_siPixelDigisClustersFromSoA.clone(
            src="hltSiPixelDigisSoA",
            produceDigis=False,
            storeDigis=False,
            # use the same thresholds as the legacy module
            clusterThreshold_layer1=process.hltSiPixelClusters.
            ClusterThreshold_L1,
            clusterThreshold_otherLayers=process.hltSiPixelClusters.
            ClusterThreshold))

    # reconstruct the pixel rechits on the gpu
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
    process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
        src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA")

    # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
    process.hltSiPixelRecHits = SwitchProducerCUDA(
        # legacy producer
        cpu=process.hltSiPixelRecHits,
        # conversion from SoA to legacy format
        cuda=_siPixelRecHitFromCUDA.clone(
            pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters"))

    # Tasks and Sequences

    process.HLTDoLocalPixelTask = cms.Task(
        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
        process.
        hltSiPixelDigiErrorsSoA,  # copy the pixel digis errors to the host
        process.hltSiPixelDigisLegacy,  # legacy pixel digis producer
        process.
        hltSiPixelDigis,  # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA
        process.hltSiPixelClustersLegacy,  # legacy pixel cluster producer
        process.
        hltSiPixelClusters,  # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA
        process.
        hltSiPixelClustersCache,  # legacy module, used by the legacy pixel quadruplet producer
        process.hltSiPixelRecHits
    )  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA

    process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)

    # workaround for AlCa paths

    if 'AlCa_LumiPixelsCounts_Random_v1' in process.__dict__:
        if "HLTSchedule" in process.__dict__:
            ind = process.HLTSchedule.index(
                process.AlCa_LumiPixelsCounts_Random_v1)
            process.HLTSchedule.remove(process.AlCa_LumiPixelsCounts_Random_v1)
        # redefine the path to use the HLTDoLocalPixelSequence
        process.AlCa_LumiPixelsCounts_Random_v1 = cms.Path(
            process.HLTBeginSequenceRandom + process.hltScalersRawToDigi +
            process.hltPreAlCaLumiPixelsCountsRandom +
            process.hltPixelTrackerHVOn + process.HLTDoLocalPixelSequence +
            process.hltAlcaPixelClusterCounts + process.HLTEndSequence)
        if "HLTSchedule" in process.__dict__:
            process.HLTSchedule.insert(ind,
                                       process.AlCa_LumiPixelsCounts_Random_v1)

    if 'AlCa_LumiPixelsCounts_ZeroBias_v1' in process.__dict__:
        if "HLTSchedule" in process.__dict__:
            ind = process.HLTSchedule.index(
                process.AlCa_LumiPixelsCounts_ZeroBias_v1)
            process.HLTSchedule.remove(
                process.AlCa_LumiPixelsCounts_ZeroBias_v1)
        # redefine the path to use the HLTDoLocalPixelSequence
        process.AlCa_LumiPixelsCounts_ZeroBias_v1 = cms.Path(
            process.HLTBeginSequence + process.hltScalersRawToDigi +
            process.hltL1sZeroBias +
            process.hltPreAlCaLumiPixelsCountsZeroBias +
            process.hltPixelTrackerHVOn + process.HLTDoLocalPixelSequence +
            process.hltAlcaPixelClusterCounts + process.HLTEndSequence)
        if "HLTSchedule" in process.__dict__:
            process.HLTSchedule.insert(
                ind, process.AlCa_LumiPixelsCounts_ZeroBias_v1)

    # done
    return process
Beispiel #4
0
# modifier used to prompt patatrack pixel tracks reconstruction on cpu
from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit
pixelNtupletFit.toModify(
    siPixelRecHitsPreSplitting,
    cpu=cms.EDAlias(siPixelRecHitsPreSplittingCPU=cms.VPSet(
        cms.PSet(type=cms.string("SiPixelRecHitedmNewDetSetVector")),
        cms.PSet(type=cms.string("uintAsHostProduct")))))

siPixelRecHitsPreSplittingTask = cms.Task(
    # SwitchProducer wrapping the legacy pixel rechit producer or the cpu SoA producer
    siPixelRecHitsPreSplitting)

# reconstruct the pixel rechits on the gpu
from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone(
    beamSpot="offlineBeamSpotToCUDA")

# transfer the pixel rechits to the host and convert them from SoA
from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA

#this is an alias for the SoA on GPU or CPU to be used for DQM
siPixelRecHitsPreSplittingSoA = SwitchProducerCUDA(
    cpu=cms.EDAlias(siPixelRecHitsPreSplittingCPU=cms.VPSet(
        cms.PSet(type=cms.string(
            "cmscudacompatCPUTraitsTrackingRecHit2DHeterogeneous")),
        cms.PSet(type=cms.string("uintAsHostProduct")))), )

(gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplittingSoA,
                                 cuda=_siPixelRecHitSoAFromCUDA.clone())

(gpu & pixelNtupletFit).toModify(siPixelRecHitsPreSplitting,
Beispiel #5
0
def customisePixelLocalReconstruction(process):

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

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

    process.HLTDoLocalPixelSequence = cms.Sequence()

    # Event Setup

    process.load(
        "CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load(
        "CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi"
    )  # this should be used only on GPUs, will crash otherwise
    process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEFastESProducer_cfi")

    # Modules and EDAliases

    # referenced in HLTDoLocalPixelTask

    # transfer the beamspot to the gpu
    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
    if 'hltSiPixelClustersLegacy' in process.__dict__:
        process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone(
            # use the same thresholds as the legacy module
            clusterThreshold_layer1=process.hltSiPixelClustersLegacy.
            ClusterThreshold_L1,
            clusterThreshold_otherLayers=process.hltSiPixelClustersLegacy.
            ClusterThreshold)

    else:
        process.hltSiPixelClustersCUDA = _siPixelRawToClusterCUDA.clone(
            # use the same thresholds as the legacy module
            clusterThreshold_layer1=process.hltSiPixelClusters.
            ClusterThreshold_L1,
            clusterThreshold_otherLayers=process.hltSiPixelClusters.
            ClusterThreshold)

    # 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
    process.hltSiPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # copy the pixel digis (except errors) and clusters to the host
    from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
    process.hltSiPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone(
        src="hltSiPixelClustersCUDA")

    # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
    if not isinstance(process.hltSiPixelDigis, SwitchProducerCUDA):

        if 'hltSiPixelDigisLegacy' in process.__dict__:
            raise Exception(
                'unsupported configuration: "process.hltSiPixelDigis" is not a SwitchProducerCUDA, but "process.hltSiPixelDigisLegacy" already exists'
            )

        # reconstruct the pixel digis on the cpu
        process.hltSiPixelDigisLegacy = process.hltSiPixelDigis.clone()

        # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors to the legacy format
        process.hltSiPixelDigis = SwitchProducerCUDA(
            # legacy producer
            cpu=cms.EDAlias(hltSiPixelDigisLegacy=cms.VPSet(
                cms.PSet(type=cms.string("DetIdedmEDCollection")),
                cms.PSet(
                    type=cms.string("SiPixelRawDataErroredmDetSetVector")),
                cms.PSet(
                    type=cms.string("PixelFEDChanneledmNewDetSetVector")))))
    # conversion from SoA to legacy format
    from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA
    process.hltSiPixelDigis.cuda = _siPixelDigiErrorsFromSoA.clone(
        digiErrorSoASrc="hltSiPixelDigiErrorsSoA", UsePhase1=True)

    # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters to the legacy format
    if not isinstance(process.hltSiPixelClusters, SwitchProducerCUDA):

        if 'hltSiPixelClustersLegacy' in process.__dict__:
            raise Exception(
                'unsupported configuration: "process.hltSiPixelClusters" is not a SwitchProducerCUDA, but "process.hltSiPixelClustersLegacy" already exists'
            )

        # reconstruct the pixel clusters on the cpu
        process.hltSiPixelClustersLegacy = process.hltSiPixelClusters.clone(
            src="hltSiPixelDigisLegacy")

        process.hltSiPixelClusters = SwitchProducerCUDA(
            # legacy producer
            cpu=cms.EDAlias(hltSiPixelClustersLegacy=cms.VPSet(
                cms.PSet(
                    type=cms.string("SiPixelClusteredmNewDetSetVector")))))
    # conversion from SoA to legacy format
    from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA
    process.hltSiPixelClusters.cuda = _siPixelDigisClustersFromSoA.clone(
        src="hltSiPixelDigisSoA",
        produceDigis=False,
        storeDigis=False,
        # use the same thresholds as the legacy module
        clusterThreshold_layer1=process.hltSiPixelClustersLegacy.
        ClusterThreshold_L1,
        clusterThreshold_otherLayers=process.hltSiPixelClustersLegacy.
        ClusterThreshold)

    # reconstruct the pixel rechits on the gpu
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA
    process.hltSiPixelRecHitsCUDA = _siPixelRecHitCUDA.clone(
        src="hltSiPixelClustersCUDA", beamSpot="hltOnlineBeamSpotToCUDA")

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

    # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA
    from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA
    process.hltSiPixelRecHits = SwitchProducerCUDA(
        # legacy producer
        cpu=cms.EDAlias(hltSiPixelRecHitSoA=cms.VPSet(
            cms.PSet(type=cms.string("SiPixelRecHitedmNewDetSetVector")),
            cms.PSet(type=cms.string("uintAsHostProduct")))),
        # conversion from SoA to legacy format
        cuda=_siPixelRecHitFromCUDA.clone(
            pixelRecHitSrc="hltSiPixelRecHitsCUDA", src="hltSiPixelClusters"))

    # Tasks and Sequences
    if 'HLTDoLocalPixelTask' in process.__dict__ and not isinstance(
            process.HLTDoLocalPixelTask, cms.Task):
        raise Exception(
            'unsupported configuration: "process.HLTDoLocalPixelTask" already exists, but it is not a Task'
        )

    process.HLTDoLocalPixelTask = cms.Task(
        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
        process.
        hltSiPixelDigiErrorsSoA,  # copy the pixel digis errors to the host
        process.hltSiPixelDigisLegacy,  # legacy pixel digis producer
        process.
        hltSiPixelDigis,  # SwitchProducer wrapping a subset of the legacy pixel digis producer, or the conversion of the pixel digis errors from SoA
        process.hltSiPixelClustersLegacy,  # legacy pixel cluster producer
        process.
        hltSiPixelClusters,  # SwitchProducer wrapping a subset of the legacy pixel cluster producer, or the conversion of the pixel digis (except errors) and clusters from SoA
        process.
        hltSiPixelClustersCache,  # legacy module, used by the legacy pixel quadruplet producer
        process.
        hltSiPixelRecHitSoA,  # pixel rechits on cpu, in SoA & legacy format
        process.hltSiPixelRecHits
    )  # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA

    process.HLTDoLocalPixelSequence = cms.Sequence(process.HLTDoLocalPixelTask)

    # workaround for old version of AlCa_LumiPixelsCounts paths
    for AlCaPathName in [
            'AlCa_LumiPixelsCounts_Random_v1',
            'AlCa_LumiPixelsCounts_ZeroBias_v1'
    ]:
        if AlCaPathName in process.__dict__:
            AlCaPath = getattr(process, AlCaPathName)
            # replace hltSiPixelDigis+hltSiPixelClusters with HLTDoLocalPixelSequence
            hasSiPixelDigis, hasSiPixelClusters = False, False
            for (itemLabel, itemName) in AlCaPath.directDependencies():
                if itemLabel != 'modules': continue
                if itemName == 'hltSiPixelDigis': hasSiPixelDigis = True
                elif itemName == 'hltSiPixelClusters':
                    hasSiPixelClusters = True
            if hasSiPixelDigis and hasSiPixelClusters:
                AlCaPath.remove(process.hltSiPixelClusters)
                AlCaPath.replace(process.hltSiPixelDigis,
                                 process.HLTDoLocalPixelSequence)

    # done
    return process