Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:20

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 siPixelClustersPreSplittingAlpaka = _siPixelRawToClusterAlpaka.clone()
0115 
0116 (alpaka & run3_common).toModify(siPixelClustersPreSplittingAlpaka,
0117     # use the pixel channel calibrations scheme for Run 3
0118     clusterThreshold_layer1 = 4000,
0119     VCaltoElectronGain      = 1,  # all gains=1, pedestals=0
0120     VCaltoElectronGain_L1   = 1,
0121     VCaltoElectronOffset    = 0,
0122     VCaltoElectronOffset_L1 = 0)
0123 
0124 from RecoLocalTracker.SiPixelClusterizer.siPixelPhase2DigiToCluster_cfi import siPixelPhase2DigiToCluster as _siPixelPhase2DigiToCluster
0125 
0126 (alpaka & phase2_tracker).toReplaceWith(siPixelClustersPreSplittingAlpaka, _siPixelPhase2DigiToCluster.clone(
0127     Phase2ReadoutMode = PixelDigitizerAlgorithmCommon.Phase2ReadoutMode.value(), # flag to decide Readout Mode : linear TDR (-1), dual slope with slope parameters (+1,+2,+3,+4 ...) with threshold subtraction
0128     Phase2DigiBaseline = int(PixelDigitizerAlgorithmCommon.ThresholdInElectrons_Barrel.value()), # same for barrel and endcap
0129     Phase2KinkADC = 8,
0130     ElectronPerADCGain = PixelDigitizerAlgorithmCommon.ElectronPerAdc.value()
0131 ))
0132 
0133 # reconstruct the pixel digis and clusters with alpaka on the cpu, for validation
0134 siPixelClustersPreSplittingAlpakaSerial = makeSerialClone(siPixelClustersPreSplittingAlpaka)
0135 
0136 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase1_cfi import siPixelDigisClustersFromSoAAlpakaPhase1 as _siPixelDigisClustersFromSoAAlpakaPhase1
0137 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase2_cfi import siPixelDigisClustersFromSoAAlpakaPhase2 as _siPixelDigisClustersFromSoAAlpakaPhase2
0138 
0139 (alpaka & ~phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting,_siPixelDigisClustersFromSoAAlpakaPhase1.clone(
0140     src = "siPixelClustersPreSplittingAlpaka"
0141 ))
0142 
0143 (alpaka & phase2_tracker).toReplaceWith(siPixelDigisClustersPreSplitting,_siPixelDigisClustersFromSoAAlpakaPhase2.clone(
0144     clusterThreshold_layer1 = 4000,
0145     clusterThreshold_otherLayers = 4000,
0146     src = "siPixelClustersPreSplittingAlpaka",
0147     storeDigis = False,
0148     produceDigis = False
0149 ))
0150 
0151 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase1_cfi import siPixelDigisClustersFromSoAAlpakaPhase1 as _siPixelDigisClustersFromSoAAlpakaPhase1
0152 from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoAAlpakaPhase2_cfi import siPixelDigisClustersFromSoAAlpakaPhase2 as _siPixelDigisClustersFromSoAAlpakaPhase2
0153 
0154 alpaka.toModify(siPixelClustersPreSplitting,
0155     cpu = cms.EDAlias(
0156         siPixelDigisClustersPreSplitting = cms.VPSet(
0157             cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector"))
0158         )
0159     )
0160 )
0161 
0162 # Run 3
0163 alpaka.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0164     # reconstruct the pixel clusters with alpaka
0165     siPixelClustersPreSplittingAlpaka,
0166     # reconstruct the pixel clusters with alpaka on the cpu (if requested by the validation)
0167     siPixelClustersPreSplittingAlpakaSerial,
0168     # convert from host SoA to legacy formats (digis and clusters)
0169     siPixelDigisClustersPreSplitting,
0170     # EDAlias for the clusters
0171     siPixelClustersPreSplitting)
0172 )
0173 
0174 # Phase 2
0175 (alpaka & phase2_tracker).toReplaceWith(siPixelClustersPreSplittingTask, cms.Task(
0176     # reconstruct the pixel clusters with alpaka from copied digis
0177     siPixelClustersPreSplittingAlpaka,
0178     # reconstruct the pixel clusters with alpaka from copied digis on the cpu (if requested by the validation)
0179     siPixelClustersPreSplittingAlpakaSerial,
0180     # convert the pixel digis (except errors) and clusters to the legacy format
0181     siPixelDigisClustersPreSplitting,
0182     # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA
0183     siPixelClustersPreSplitting)
0184 )