Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-21 03:38:58

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 # helper functions
0004 from HLTrigger.Configuration.common import *
0005 
0006 # add one customisation function per PR
0007 # - put the PR number into the name of the function
0008 # - add a short comment
0009 # for example:
0010 
0011 # CCCTF tuning
0012 # def customiseFor12718(process):
0013 #     for pset in process._Process__psets.values():
0014 #         if hasattr(pset,'ComponentType'):
0015 #             if (pset.ComponentType == 'CkfBaseTrajectoryFilter'):
0016 #                 if not hasattr(pset,'minGoodStripCharge'):
0017 #                     pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone'))
0018 #     return process
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         # switch on the QI8 processing for 2018 HCAL barrel
0025         producer.processQIE8 = True
0026 
0027     # adapt CaloTowers threshold for 2018 HCAL barrel with only one depth
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     # adapt Particle Flow threshold for 2018 HCAL barrel with only one depth
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     # done
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     # revert the Pixel parameters to be compatible with the Run 2 conditions
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     # revert the pixel Layer 1 cluster threshold to be compatible with Run2:
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     # For Run-2 data, disable the use of the BS transient record, to read the BS record from SCAL.
0156     # Additionally, remove all instances of OnlineBeamSpotESProducer (not needed if useTransientRecord=False).
0157     # See CMSHLT-2271 and CMSHLT-2300 for further details.
0158     for prod in producers_by_type(process, 'BeamSpotOnlineProducer'):
0159         prod.useTransientRecord = False
0160     onlineBeamSpotESPLabels = [prod.label_() for prod in esproducers_by_type(process, 'OnlineBeamSpotESProducer')]
0161     for espLabel in onlineBeamSpotESPLabels:
0162         delattr(process, espLabel)
0163 
0164     return process
0165 
0166 def customiseFor2018Input(process):
0167     """Customise the HLT to run on Run 2 data/MC"""
0168     process = customisePixelGainForRun2Input(process)
0169     process = customisePixelL1ClusterThresholdForRun2Input(process)
0170     process = customiseHCALFor2018Input(process)
0171     process = customiseCTPPSFor2018Input(process)
0172     process = customiseEGammaRecoFor2018Input(process)
0173     process = customiseBeamSpotFor2018Input(process)
0174 
0175     return process
0176 
0177 
0178 def customiseForOffline(process):
0179 
0180     # For running HLT offline on Run-3 Data, use "(OnlineBeamSpotESProducer).timeThreshold = 1e6",
0181     # in order to pick the beamspot that was actually used by the HLT (instead of a "fake" beamspot).
0182     # These same settings can be used offline for Run-3 Data and Run-3 MC alike.
0183     # Note: the products of the OnlineBeamSpotESProducer are used only
0184     #       if the configuration uses "(BeamSpotOnlineProducer).useTransientRecord = True".
0185     # See CMSHLT-2271 and CMSHLT-2300 for further details.
0186     for prod in esproducers_by_type(process, 'OnlineBeamSpotESProducer'):
0187         prod.timeThreshold = int(1e6)
0188 
0189     return process
0190 
0191 
0192 # CMSSW version specific customizations
0193 def customizeHLTforCMSSW(process, menuType="GRun"):
0194 
0195     process = customiseForOffline(process)
0196 
0197     # add call to action function in proper order: newest last!
0198     # process = customiseFor12718(process)
0199 
0200     return process