Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-04-24 01:30:29

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA
0003 from Configuration.ProcessModifiers.gpu_cff import gpu
0004 
0005 # ECAL calibrated rechit reconstruction on CPU
0006 from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import ecalRecHit as _ecalRecHit
0007 ecalRecHitCPU = _ecalRecHit.clone()
0008 ecalRecHit = SwitchProducerCUDA(
0009     cpu = ecalRecHitCPU
0010 )
0011 
0012 ecalCalibratedRecHitTask = cms.Task(
0013     ecalRecHit
0014 )
0015 
0016 from Configuration.StandardSequences.Accelerators_cff import *
0017 
0018 # ECAL rechit calibrations on GPU
0019 from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer
0020 from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer
0021 from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer
0022 from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer
0023 from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer
0024 from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer
0025 from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer
0026 
0027 # ECAL rechits running on GPU
0028 from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU
0029 ecalRecHitGPU = _ecalRecHitGPU.clone(
0030     uncalibrecHitsInLabelEB = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'),
0031     uncalibrecHitsInLabelEE = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE')
0032 )
0033 
0034 # copy the rechits from GPU to CPU
0035 from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer
0036 ecalRecHitSoA = _ecalCPURecHitProducer.clone(
0037     recHitsInLabelEB = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEB'),
0038     recHitsInLabelEE = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEE')
0039 )
0040 
0041 # TODO: the ECAL calibrated rechits produced on the GPU are not correct, yet.
0042 # When they are working and validated, remove this comment and uncomment the next lines:
0043 # convert the rechits from SoA to legacy format
0044 #from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitFromSoA
0045 #gpu.toModify(ecalRecHit,
0046 #    cuda = _ecalRecHitFromSoA.clone(
0047 #        recHitsLabelGPUEB = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEB'),
0048 #        recHitsLabelGPUEE = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEE')
0049 #    )
0050 #)
0051 
0052 # ECAL calibrated rechit reconstruction on GPU
0053 gpu.toReplaceWith(ecalCalibratedRecHitTask, cms.Task(
0054   # ECAL rechit calibrations on GPU
0055   ecalRechitADCToGeVConstantGPUESProducer,
0056   ecalRechitChannelStatusGPUESProducer,
0057   ecalIntercalibConstantsGPUESProducer,
0058   ecalLaserAPDPNRatiosGPUESProducer,
0059   ecalLaserAPDPNRatiosRefGPUESProducer,
0060   ecalLaserAlphasGPUESProducer,
0061   ecalLinearCorrectionsGPUESProducer,
0062   # ECAL rechits running on GPU
0063   ecalRecHitGPU,
0064   # copy the rechits from GPU to CPU
0065   ecalRecHitSoA,
0066   # convert the rechits from SoA to legacy format
0067   ecalRecHit
0068 ))
0069 
0070 # modifications for alpaka
0071 from Configuration.ProcessModifiers.alpaka_cff import alpaka
0072 
0073 # ECAL conditions used by the rechit producer running on the accelerator
0074 from RecoLocalCalo.EcalRecProducers.ecalRecHitConditionsESProducer_cfi import ecalRecHitConditionsESProducer
0075 
0076 # ECAL rechit producer running on the accelerator
0077 from RecoLocalCalo.EcalRecProducers.ecalRecHitProducerPortable_cfi import ecalRecHitProducerPortable as _ecalRecHitProducerPortable
0078 ecalRecHitPortable = _ecalRecHitProducerPortable.clone(
0079   uncalibrecHitsInLabelEB = 'ecalMultiFitUncalibRecHitPortable:EcalUncalibRecHitsEB',
0080   uncalibrecHitsInLabelEE = 'ecalMultiFitUncalibRecHitPortable:EcalUncalibRecHitsEE'
0081 )
0082 
0083 # replace the SwitchProducerCUDA branches with the module to convert the rechits from SoA to legacy format
0084 from RecoLocalCalo.EcalRecProducers.ecalRecHitSoAToLegacy_cfi import ecalRecHitSoAToLegacy as _ecalRecHitSoAToLegacy
0085 # TODO: the portably produced ECAL calibrated rechits are not correct yet.
0086 # When they are working and validated, remove this comment and uncomment the next lines:
0087 #alpaka.toModify(ecalRecHit,
0088 #    cpu = _ecalRecHitSoAToLegacy.clone()
0089 #)
0090 
0091 alpaka.toReplaceWith(ecalCalibratedRecHitTask, cms.Task(
0092   # ECAL conditions and parameters used by the rechit producer running on the accelerator
0093   ecalRecHitConditionsESProducer,
0094   # ECAL rechit producer running on device
0095   ecalRecHitPortable,
0096   # ECAL rechit producer running on CPU, or convert the rechits from SoA to legacy format
0097   ecalRecHit,
0098 ))
0099 
0100 # for alpaka validation compare the legacy CPU module with the alpaka module
0101 from Configuration.ProcessModifiers.alpakaValidationEcal_cff import alpakaValidationEcal
0102 alpakaValidationEcal.toModify(ecalRecHit, cpu = ecalRecHitCPU)
0103 alpakaValidationEcal.toModify(ecalRecHit, cuda = _ecalRecHitSoAToLegacy.clone())
0104 
0105 from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel
0106 phase2_ecal_devel.toModify(ecalRecHitPortable, isPhase2 = True)
0107 phase2_ecal_devel.toModify(ecalRecHitPortable, uncalibrecHitsInLabelEB = 'ecalUncalibRecHitPhase2SoA:EcalUncalibRecHitsEB')
0108 phase2_ecal_devel.toModify(ecalRecHitPortable, EELaserMAX = None)
0109 phase2_ecal_devel.toModify(ecalRecHitPortable, EELaserMIN = None)
0110 phase2_ecal_devel.toModify(ecalRecHitPortable, recHitsLabelEE = None)
0111 phase2_ecal_devel.toModify(ecalRecHitPortable, recoverEEFE = None)
0112 phase2_ecal_devel.toModify(ecalRecHitPortable, recoverEEIsolatedChannels = None)
0113 phase2_ecal_devel.toModify(ecalRecHitPortable, recoverEEVFE = None)
0114 phase2_ecal_devel.toModify(ecalRecHitPortable, uncalibrecHitsInLabelEE = None)