Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-28 02:36:35

0001 import FWCore.ParameterSet.Config as cms
0002 from HeterogeneousCore.AlpakaCore.functions import *
0003 from Configuration.Eras.Modifier_run3_common_cff import run3_common
0004 from Configuration.ProcessModifiers.gpu_cff import gpu
0005 from Configuration.ProcessModifiers.alpaka_cff import alpaka
0006 
0007 # conditions used *only* by the modules running on GPU
0008 from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import siPixelROCsStatusAndMappingWrapperESProducer
0009 from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import siPixelGainCalibrationForHLTGPU
0010 
0011 # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0012 from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import siPixelClustersPreSplitting
0013 
0014 siPixelClustersPreSplittingTask = cms.Task(
0015     # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0016     siPixelClustersPreSplitting
0017 )
0018 
0019 # reconstruct the pixel digis and clusters on the gpu
0020 from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDAPhase1_cfi import siPixelRawToClusterCUDAPhase1 as _siPixelRawToClusterCUDA
0021 from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDAHIonPhase1_cfi import siPixelRawToClusterCUDAHIonPhase1 as _siPixelRawToClusterCUDAHIonPhase1
0022 
0023 siPixelClustersPreSplittingCUDA = _siPixelRawToClusterCUDA.clone()
0024 
0025 # HIon Modifiers
0026 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0027 # Phase 2 Tracker Modifier
0028 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
0029 
0030 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelClustersPreSplittingCUDA, _siPixelRawToClusterCUDAHIonPhase1.clone())
0031 
0032 run3_common.toModify(siPixelClustersPreSplittingCUDA,
0033                      # use the pixel channel calibrations scheme for Run 3
0034                      clusterThreshold_layer1 = 4000,
0035                      VCaltoElectronGain      = 1,  # all gains=1, pedestals=0
0036                      VCaltoElectronGain_L1   = 1,
0037                      VCaltoElectronOffset    = 0,
0038                      VCaltoElectronOffset_L1 = 0)
0039 
0040 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAPhase1_cfi import siPixelDigisClustersFromSoAPhase1 as _siPixelDigisClustersFromSoAPhase1
0041 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAPhase2_cfi import siPixelDigisClustersFromSoAPhase2 as _siPixelDigisClustersFromSoAPhase2
0042 
0043 siPixelDigisClustersPreSplitting = _siPixelDigisClustersFromSoAPhase1.clone()
0044 
0045 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAHIonPhase1_cfi import siPixelDigisClustersFromSoAHIonPhase1 as _siPixelDigisClustersFromSoAHIonPhase1
0046 (pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting, _siPixelDigisClustersFromSoAHIonPhase1.clone())
0047 
0048 
0049 run3_common.toModify(siPixelDigisClustersPreSplitting,
0050                      clusterThreshold_layer1 = 4000)
0051 
0052 gpu.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0053     # conditions used *only* by the modules running on GPU
0054     siPixelROCsStatusAndMappingWrapperESProducer,
0055     siPixelGainCalibrationForHLTGPU,
0056     # reconstruct the pixel digis and clusters on the gpu
0057     siPixelClustersPreSplittingCUDA,
0058     # convert the pixel digis (except errors) and clusters to the legacy format
0059     siPixelDigisClustersPreSplitting,
0060     # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0061     siPixelClustersPreSplittingTask.copy()
0062 ))
0063 
0064 from RecoLocalTracker.SiPixelClusterizer.siPixelPhase2DigiToClusterCUDA_cfi import siPixelPhase2DigiToClusterCUDA as _siPixelPhase2DigiToClusterCUDA
0065 # for phase2 no pixel raw2digi is available at the moment
0066 # so we skip the raw2digi step and run on pixel digis copied to gpu
0067 
0068 from SimTracker.SiPhase2Digitizer.phase2TrackerDigitizer_cfi import PixelDigitizerAlgorithmCommon
0069 
0070 phase2_tracker.toReplaceWith(siPixelClustersPreSplittingCUDA,_siPixelPhase2DigiToClusterCUDA.clone(
0071   Phase2ReadoutMode = PixelDigitizerAlgorithmCommon.Phase2ReadoutMode.value(), # Flag to decide Readout Mode : linear TDR (-1), dual slope with slope parameters (+1,+2,+3,+4 ...) with threshold subtraction
0072   Phase2DigiBaseline = int(PixelDigitizerAlgorithmCommon.ThresholdInElectrons_Barrel.value()), #Same for barrel and endcap
0073   Phase2KinkADC = 8,
0074   ElectronPerADCGain = PixelDigitizerAlgorithmCommon.ElectronPerAdc.value()
0075 ))
0076 
0077 from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA
0078 siPixelDigisPhase2SoA = _siPixelDigisSoAFromCUDA.clone(
0079     src = "siPixelClustersPreSplittingCUDA"
0080 )
0081 
0082 phase2_tracker.toReplaceWith(siPixelDigisClustersPreSplitting, _siPixelDigisClustersFromSoAPhase2.clone(
0083                         clusterThreshold_layer1 = 4000,
0084                         clusterThreshold_otherLayers = 4000,
0085                         src = "siPixelDigisPhase2SoA",
0086                         #produceDigis = False
0087                         ))
0088 
0089 (gpu & phase2_tracker).toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0090                             # reconstruct the pixel clusters on the gpu from copied digis
0091                             siPixelClustersPreSplittingCUDA,
0092                             # copy from gpu to cpu
0093                             siPixelDigisPhase2SoA,
0094                             # convert the pixel digis (except errors) and clusters to the legacy format
0095                             siPixelDigisClustersPreSplitting,
0096                             # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0097                             siPixelClustersPreSplitting))
0098 
0099 ######################################################################
0100 
0101 ### Alpaka Pixel Clusters Reco
0102 
0103 #from CalibTracker.SiPixelESProducers.siPixelCablingSoAESProducer_cfi import siPixelCablingSoAESProducer
0104 #from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTSoAESProducer_cfi import siPixelGainCalibrationForHLTSoAESProducer
0105 
0106 def _addProcessCalibTrackerAlpakaES(process):
0107     process.load("CalibTracker.SiPixelESProducers.siPixelCablingSoAESProducer_cfi")
0108     process.load("CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTSoAESProducer_cfi")
0109 
0110 modifyConfigurationCalibTrackerAlpakaES_ = alpaka.makeProcessModifier(_addProcessCalibTrackerAlpakaES)
0111 
0112 # reconstruct the pixel digis and clusters with alpaka on the device
0113 from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterPhase1_cfi import siPixelRawToClusterPhase1 as _siPixelRawToClusterAlpaka
0114 from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterHIonPhase1_cfi import siPixelRawToClusterHIonPhase1 as _siPixelRawToClusterAlpakaHIonPhase1
0115 
0116 siPixelClustersPreSplittingAlpaka = _siPixelRawToClusterAlpaka.clone()
0117 
0118 (alpaka & pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelClustersPreSplittingAlpaka,_siPixelRawToClusterAlpakaHIonPhase1.clone())
0119 
0120 (alpaka & run3_common).toModify(siPixelClustersPreSplittingAlpaka,
0121     # use the pixel channel calibrations scheme for Run 3
0122     clusterThreshold_layer1 = 4000,
0123     VCaltoElectronGain      = 1,  # all gains=1, pedestals=0
0124     VCaltoElectronGain_L1   = 1,
0125     VCaltoElectronOffset    = 0,
0126     VCaltoElectronOffset_L1 = 0)
0127 
0128 from RecoLocalTracker.SiPixelClusterizer.siPixelPhase2DigiToCluster_cfi import siPixelPhase2DigiToCluster as _siPixelPhase2DigiToCluster
0129 
0130 (alpaka & phase2_tracker).toReplaceWith(siPixelClustersPreSplittingAlpaka, _siPixelPhase2DigiToCluster.clone(
0131     Phase2ReadoutMode = PixelDigitizerAlgorithmCommon.Phase2ReadoutMode.value(), # flag to decide Readout Mode : linear TDR (-1), dual slope with slope parameters (+1,+2,+3,+4 ...) with threshold subtraction
0132     Phase2DigiBaseline = int(PixelDigitizerAlgorithmCommon.ThresholdInElectrons_Barrel.value()), # same for barrel and endcap
0133     Phase2KinkADC = 8,
0134     ElectronPerADCGain = PixelDigitizerAlgorithmCommon.ElectronPerAdc.value()
0135 ))
0136 
0137 # reconstruct the pixel digis and clusters with alpaka on the cpu, for validation
0138 siPixelClustersPreSplittingAlpakaSerial = makeSerialClone(siPixelClustersPreSplittingAlpaka)
0139 
0140 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase1_cfi import siPixelDigisClustersFromSoAAlpakaPhase1 as _siPixelDigisClustersFromSoAAlpakaPhase1
0141 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase2_cfi import siPixelDigisClustersFromSoAAlpakaPhase2 as _siPixelDigisClustersFromSoAAlpakaPhase2
0142 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaHIonPhase1_cfi import siPixelDigisClustersFromSoAAlpakaHIonPhase1 as _siPixelDigisClustersFromSoAAlpakaHIonPhase1
0143 
0144 (alpaka & ~phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting,_siPixelDigisClustersFromSoAAlpakaPhase1.clone(
0145     src = "siPixelClustersPreSplittingAlpaka"
0146 ))
0147 
0148 (alpaka & pp_on_AA & ~phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting,_siPixelDigisClustersFromSoAAlpakaHIonPhase1.clone(
0149     src = "siPixelClustersPreSplittingAlpaka"
0150 ))
0151 
0152 (alpaka & phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting,_siPixelDigisClustersFromSoAAlpakaPhase2.clone(
0153     clusterThreshold_layer1 = 4000,
0154     clusterThreshold_otherLayers = 4000,
0155     src = "siPixelClustersPreSplittingAlpaka",
0156     storeDigis = False,
0157     produceDigis = False
0158 ))
0159 
0160 alpaka.toModify(siPixelClustersPreSplitting,
0161     cpu = cms.EDAlias(
0162         siPixelDigisClustersPreSplitting = cms.VPSet(
0163             cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector"))
0164         )
0165     )
0166 )
0167 
0168 # These produce pixelDigiErrors in Alpaka; they are constructed here because they need
0169 # siPixelClustersPreSplittingAlpaka* as input
0170 from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoAAlpaka_cfi import siPixelDigiErrorsFromSoAAlpaka as _siPixelDigiErrorsFromSoAAlpaka
0171 siPixelDigiErrorsAlpaka = _siPixelDigiErrorsFromSoAAlpaka.clone(
0172     digiErrorSoASrc = cms.InputTag('siPixelClustersPreSplittingAlpaka'),
0173     fmtErrorsSoASrc = cms.InputTag('siPixelClustersPreSplittingAlpaka'),
0174     UsePhase1 = cms.bool(True)
0175 )
0176 
0177 siPixelDigiErrorsAlpakaSerial = siPixelDigiErrorsAlpaka.clone(
0178     digiErrorSoASrc = cms.InputTag('siPixelClustersPreSplittingAlpakaSerial'),
0179     fmtErrorsSoASrc = cms.InputTag('siPixelClustersPreSplittingAlpakaSerial')
0180 )
0181 
0182 # Run 3
0183 alpaka.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0184     # reconstruct the pixel clusters with alpaka
0185     siPixelClustersPreSplittingAlpaka,
0186     # reconstruct the pixel clusters with alpaka on the cpu (if requested by the validation)
0187     siPixelClustersPreSplittingAlpakaSerial,
0188     # reconstruct pixel digis errors legacy with alpaka on serial and device
0189     siPixelDigiErrorsAlpaka,
0190     siPixelDigiErrorsAlpakaSerial,
0191     # convert from host SoA to legacy formats (digis and clusters)
0192     siPixelDigisClustersPreSplitting,
0193     # EDAlias for the clusters
0194     siPixelClustersPreSplitting)
0195 )
0196 
0197 # Phase 2
0198 (alpaka & phase2_tracker).toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0199     # reconstruct the pixel clusters with alpaka from copied digis
0200     siPixelClustersPreSplittingAlpaka,
0201     # reconstruct the pixel clusters with alpaka from copied digis on the cpu (if requested by the validation)
0202     siPixelClustersPreSplittingAlpakaSerial,
0203     # reconstruct pixel digis errors legacy with alpaka on serial and device
0204     siPixelDigiErrorsAlpaka,
0205     siPixelDigiErrorsAlpakaSerial,
0206     # convert the pixel digis (except errors) and clusters to the legacy format
0207     siPixelDigisClustersPreSplitting,
0208     # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0209     siPixelClustersPreSplitting)
0210 )