File indexing completed on 2023-02-01 05:46:58
0001 import FWCore.ParameterSet.Config as cms
0002
0003
0004 from HLTrigger.Configuration.common import *
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 def customiseHCALFor2018Input(process):
0021 """Customise the HLT to run on Run 2 data/MC using the old readout for the HCAL barel"""
0022
0023 for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
0024
0025 producer.processQIE8 = True
0026
0027
0028 for producer in producers_by_type(process, "CaloTowersCreator"):
0029 producer.HBThreshold1 = 0.7
0030 producer.HBThreshold2 = 0.7
0031 producer.HBThreshold = 0.7
0032
0033
0034 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _thresholdsHB, _thresholdsHEphase1, _seedingThresholdsHB
0035
0036 logWeightDenominatorHCAL2018 = cms.VPSet(
0037 cms.PSet(
0038 depths = cms.vint32(1, 2, 3, 4),
0039 detector = cms.string('HCAL_BARREL1'),
0040 logWeightDenominator = _thresholdsHB
0041 ),
0042 cms.PSet(
0043 depths = cms.vint32(1, 2, 3, 4, 5, 6, 7),
0044 detector = cms.string('HCAL_ENDCAP'),
0045 logWeightDenominator = _thresholdsHEphase1
0046 )
0047 )
0048
0049 for producer in producers_by_type(process, "PFRecHitProducer"):
0050 if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
0051 producer.producers[0].qualityTests[0].cuts[0].threshold = _thresholdsHB
0052
0053 for producer in producers_by_type(process, "PFClusterProducer"):
0054 if producer.seedFinder.thresholdsByDetector[0].detector.value() == 'HCAL_BARREL1':
0055 producer.seedFinder.thresholdsByDetector[0].seedingThreshold = _seedingThresholdsHB
0056 producer.initialClusteringStep.thresholdsByDetector[0].gatheringThreshold = _thresholdsHB
0057 producer.pfClusterBuilder.recHitEnergyNorms[0].recHitEnergyNorm = _thresholdsHB
0058 producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
0059 producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
0060
0061 for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
0062 producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
0063
0064
0065 return process
0066
0067 def customiseFor2017DtUnpacking(process):
0068 """Adapt the HLT to run the legacy DT unpacking
0069 for pre2018 data/MC workflows as the default"""
0070
0071 if hasattr(process,'hltMuonDTDigis'):
0072 process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
0073 useStandardFEDid = cms.bool( True ),
0074 maxFEDid = cms.untracked.int32( 779 ),
0075 inputLabel = cms.InputTag( "rawDataCollector" ),
0076 minFEDid = cms.untracked.int32( 770 ),
0077 dataType = cms.string( "DDU" ),
0078 readOutParameters = cms.PSet(
0079 localDAQ = cms.untracked.bool( False ),
0080 debug = cms.untracked.bool( False ),
0081 rosParameters = cms.PSet(
0082 localDAQ = cms.untracked.bool( False ),
0083 debug = cms.untracked.bool( False ),
0084 writeSC = cms.untracked.bool( True ),
0085 readDDUIDfromDDU = cms.untracked.bool( True ),
0086 readingDDU = cms.untracked.bool( True ),
0087 performDataIntegrityMonitor = cms.untracked.bool( False )
0088 ),
0089 performDataIntegrityMonitor = cms.untracked.bool( False )
0090 ),
0091 dqmOnly = cms.bool( False )
0092 )
0093
0094 return process
0095
0096 def customisePixelGainForRun2Input(process):
0097 """Customise the HLT to run on Run 2 data/MC using the old definition of the pixel calibrations
0098
0099 Up to 11.0.x, the pixel calibarations were fully specified in the configuration:
0100 VCaltoElectronGain = 47
0101 VCaltoElectronGain_L1 = 50
0102 VCaltoElectronOffset = -60
0103 VCaltoElectronOffset_L1 = -670
0104
0105 Starting with 11.1.x, the calibrations for Run 3 were moved to the conditions, leaving in the configuration only:
0106 VCaltoElectronGain = 1
0107 VCaltoElectronGain_L1 = 1
0108 VCaltoElectronOffset = 0
0109 VCaltoElectronOffset_L1 = 0
0110
0111 Since the conditions for Run 2 have not been updated to the new scheme, the HLT configuration needs to be reverted.
0112 """
0113
0114 for producer in producers_by_type(process, "SiPixelClusterProducer"):
0115 producer.VCaltoElectronGain = 47
0116 producer.VCaltoElectronGain_L1 = 50
0117 producer.VCaltoElectronOffset = -60
0118 producer.VCaltoElectronOffset_L1 = -670
0119
0120 for producer in producers_by_type(process, "SiPixelRawToClusterCUDA"):
0121 producer.isRun2 = True
0122
0123 return process
0124
0125 def customisePixelL1ClusterThresholdForRun2Input(process):
0126
0127 for producer in producers_by_type(process, "SiPixelClusterProducer"):
0128 if hasattr(producer,"ClusterThreshold_L1"):
0129 producer.ClusterThreshold_L1 = 2000
0130 for producer in producers_by_type(process, "SiPixelRawToClusterCUDA"):
0131 if hasattr(producer,"clusterThreshold_layer1"):
0132 producer.clusterThreshold_layer1 = 2000
0133 for producer in producers_by_type(process, "SiPixelDigisClustersFromSoA"):
0134 if hasattr(producer,"clusterThreshold_layer1"):
0135 producer.clusterThreshold_layer1 = 2000
0136
0137 return process
0138
0139 def customiseCTPPSFor2018Input(process):
0140 for prod in producers_by_type(process, 'CTPPSGeometryESModule'):
0141 prod.isRun2 = True
0142 for prod in producers_by_type(process, 'CTPPSPixelRawToDigi'):
0143 prod.isRun3 = False
0144
0145 return process
0146
0147 def customiseEGammaRecoFor2018Input(process):
0148 for prod in producers_by_type(process, 'PFECALSuperClusterProducer'):
0149 if hasattr(prod, 'regressionConfig'):
0150 prod.regressionConfig.regTrainedWithPS = cms.bool(False)
0151
0152 return process
0153
0154 def customiseBeamSpotFor2018Input(process):
0155 """Customisation for the HLT BeamSpot when running on Run-2 (2018) data:
0156 - For Run-2 data, disable the use of the BS transient record, in order to read the BS record from SCAL.
0157 - Additionally, remove all instances of OnlineBeamSpotESProducer (not needed if useTransientRecord=False).
0158 - See CMSHLT-2271 and CMSHLT-2300 for further details.
0159 """
0160 for prod in producers_by_type(process, 'BeamSpotOnlineProducer'):
0161 prod.useTransientRecord = False
0162 onlineBeamSpotESPLabels = [prod.label_() for prod in esproducers_by_type(process, 'OnlineBeamSpotESProducer')]
0163 for espLabel in onlineBeamSpotESPLabels:
0164 delattr(process, espLabel)
0165
0166 return process
0167
0168 def customiseECALCalibrationsFor2018Input(process):
0169 """Customisation to apply the ECAL Run-2 Ultra-Legacy calibrations (CMSHLT-2339)"""
0170 if hasattr(process, 'GlobalTag'):
0171 if not hasattr(process.GlobalTag, 'toGet'):
0172 process.GlobalTag.toGet = cms.VPSet()
0173 process.GlobalTag.toGet += [
0174 cms.PSet(
0175 record = cms.string('EcalLaserAlphasRcd'),
0176 tag = cms.string('EcalLaserAlphas_UL_Run1_Run2_2018_lastIOV_movedTo1')
0177 ),
0178 cms.PSet(
0179 record = cms.string('EcalIntercalibConstantsRcd'),
0180 tag = cms.string('EcalIntercalibConstants_UL_Run1_Run2_2018_lastIOV_movedTo1')
0181 )
0182 ]
0183 else:
0184 print('# customiseECALCalibrationsFor2018Input -- the process.GlobalTag ESSource does not exist: no customisation applied.')
0185
0186 return process
0187
0188 def customiseFor2018Input(process):
0189 """Customise the HLT to run on Run 2 data/MC"""
0190 process = customisePixelGainForRun2Input(process)
0191 process = customisePixelL1ClusterThresholdForRun2Input(process)
0192 process = customiseHCALFor2018Input(process)
0193 process = customiseCTPPSFor2018Input(process)
0194 process = customiseEGammaRecoFor2018Input(process)
0195 process = customiseBeamSpotFor2018Input(process)
0196 process = customiseECALCalibrationsFor2018Input(process)
0197
0198 return process
0199
0200
0201 def customiseForOffline(process):
0202
0203
0204
0205
0206
0207
0208 for prod in esproducers_by_type(process, 'OnlineBeamSpotESProducer'):
0209 prod.timeThreshold = int(1e6)
0210
0211 return process
0212
0213
0214 def customizeHLTfor40443(process):
0215 for producer in [producers for producers in esproducers_by_type(process, "TrackerAdditionalParametersPerDetESModule")]:
0216 delattr(process, producer.label())
0217 return process
0218
0219
0220
0221 def customizeHLTforCMSSW(process, menuType="GRun"):
0222
0223 process = customiseForOffline(process)
0224
0225
0226
0227
0228 process = customizeHLTfor40443(process)
0229
0230 return process