Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-07-03 00:42:27

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 customiseForOffline(process):
0021     # For running HLT offline and relieve the strain on Frontier so it will no longer inject a
0022     # transaction id which tells Frontier to add a unique "&freshkey" to many query URLs.
0023     # That was intended as a feature to only be used by the Online HLT, to guarantee that fresh conditions
0024     # from the database were loaded at each Lumi section
0025     # Seee CMSHLT-3123 for further details
0026     if hasattr(process, 'GlobalTag'):
0027         # Set ReconnectEachRun and RefreshEachRun to False
0028         process.GlobalTag.ReconnectEachRun = cms.untracked.bool(False)
0029         process.GlobalTag.RefreshEachRun = cms.untracked.bool(False)
0030 
0031         if hasattr(process.GlobalTag, 'toGet'):
0032             # Filter out PSet objects containing only 'record' and 'refreshTime'
0033             process.GlobalTag.toGet = [
0034                 pset for pset in process.GlobalTag.toGet
0035                 if set(pset.parameterNames_()) != {'record', 'refreshTime'}
0036             ]
0037 
0038     return process
0039 
0040 def customizeHLTfor47611(process):
0041     """ This customizer
0042         - cleans up the CANtupletAlpaka producers paramters;
0043         - adds the geometry paramters used to fill the CAGeometry;
0044         - adds the average sizes paramters to the CANtupletAlpaka producers;
0045         - for pp and HIN hlt setups.
0046     """
0047  
0048     ca_producers_pp = ['CAHitNtupletAlpakaPhase1@alpaka','alpaka_serial_sync::CAHitNtupletAlpakaPhase1']
0049     ca_producers_hi = ['CAHitNtupletAlpakaHIonPhase1@alpaka','alpaka_serial_sync::CAHitNtupletAlpakaHIonPhase1']
0050     ca_producers = ca_producers_pp + ca_producers_hi
0051     ca_parameters = [ 'CAThetaCutBarrel', 'CAThetaCutForward', 
0052         'dcaCutInnerTriplet', 'dcaCutOuterTriplet', 
0053         'doPtCut', 'doZ0Cut', 'idealConditions', 
0054         'includeJumpingForwardDoublets', 'phiCuts','doClusterCut','CPE'] 
0055 
0056     has_pp_producers = False
0057     has_hi_producers = False
0058 
0059     for ca_producer in ca_producers:
0060         for prod in producers_by_type(process, ca_producer):
0061 
0062             for par in ca_parameters:
0063                 if hasattr(prod, par):
0064                     delattr(prod,par)
0065 
0066             if not hasattr(prod, 'dzdrFact'):
0067                 setattr(prod, 'dzdrFact', cms.double(8.0 * 0.0285 / 0.015))
0068             if not hasattr(prod, 'maxDYsize12'):
0069                 setattr(prod, 'maxDYsize12', cms.int32(28))
0070             if not hasattr(prod, 'maxDYsize'):
0071                 setattr(prod, 'maxDYsize', cms.int32(20))
0072             if not hasattr(prod, 'maxDYPred'):
0073                 setattr(prod, 'maxDYPred', cms.int32(20))
0074             
0075             if hasattr(prod, 'maxNumberOfDoublets'):
0076                 v = getattr(prod, 'maxNumberOfDoublets')
0077                 delattr(prod, 'maxNumberOfDoublets')
0078                 setattr(prod, 'maxNumberOfDoublets', cms.string(str(v.value())))
0079             
0080     for ca_producer in ca_producers_pp:
0081         for prod in producers_by_type(process, ca_producer):
0082 
0083             has_pp_producers = True
0084 
0085             if not hasattr(prod, 'maxNumberOfTuples'):
0086                 setattr(prod,'maxNumberOfTuples',cms.string(str(32*1024)))
0087                 
0088             if not hasattr(prod, 'avgCellsPerCell'):
0089                 setattr(prod, 'avgCellsPerCell', cms.double(0.071))
0090             
0091             if not hasattr(prod, 'avgCellsPerHit'):
0092                 setattr(prod, 'avgCellsPerHit', cms.double(27))
0093             
0094             if not hasattr(prod, 'avgHitsPerTrack'):
0095                 setattr(prod, 'avgHitsPerTrack', cms.double(4.5))
0096             
0097             if not hasattr(prod, 'avgTracksPerCell'):
0098                 setattr(prod, 'avgTracksPerCell', cms.double(0.127))
0099             
0100             if not hasattr(prod, 'geometry'):
0101 
0102                 geometryPS = cms.PSet(
0103                     startingPairs = cms.vuint32( [i for i in range(8)] + [i for i in range(13,20)]),
0104                     caDCACuts = cms.vdouble( [0.0918113099491] + [0.420724617835] * 9),
0105                     caThetaCuts = cms.vdouble([0.00123302705499] * 4 + [0.00355691321774] * 6),
0106                     pairGraph = cms.vuint32( 
0107                         0, 1, 0, 4, 0,
0108                         7, 1, 2, 1, 4,
0109                         1, 7, 4, 5, 7,
0110                         8, 2, 3, 2, 4,
0111                         2, 7, 5, 6, 8,
0112                         9, 0, 2, 1, 3,
0113                         0, 5, 0, 8, 
0114                         4, 6, 7, 9 
0115                     ),
0116                     phiCuts = cms.vint32( 
0117                         965, 1241, 395, 698, 1058,
0118                         1211, 348, 782, 1016, 810,
0119                         463, 755, 694, 531, 770,
0120                         471, 592, 750, 348
0121                     ),
0122                     minZ = cms.vdouble(
0123                         -20., 0., -30., -22., 10., 
0124                         -30., -70., -70., -22., 15., 
0125                         -30, -70., -70., -20., -22., 
0126                         0, -30., -70., -70.
0127                     ),
0128                     maxZ = cms.vdouble( 20., 30., 0., 22., 30., 
0129                         -10., 70., 70., 22., 30., 
0130                         -15., 70., 70., 20., 22., 
0131                         30., 0., 70., 70.),
0132                     maxR = cms.vdouble(20., 9., 9., 20., 7., 
0133                         7., 5., 5., 20., 6., 
0134                         6., 5., 5., 20., 20., 
0135                         9., 9., 9., 9.)
0136                 )
0137                 
0138                 setattr(prod, 'geometry', geometryPS)
0139 
0140     for ca_producer in ca_producers_hi:
0141         for prod in producers_by_type(process, ca_producer):
0142             
0143             has_hi_producers = True
0144             
0145             if not hasattr(prod, 'maxNumberOfTuples'):
0146                 setattr(prod,'maxNumberOfTuples',cms.string(str(256 * 1024))) # way too much, could be ~20k
0147                 
0148             if not hasattr(prod, 'avgCellsPerCell'):
0149                 setattr(prod, 'avgCellsPerCell', cms.double(0.5))
0150             
0151             if not hasattr(prod, 'avgCellsPerHit'):
0152                 setattr(prod, 'avgCellsPerHit', cms.double(40))
0153             
0154             if not hasattr(prod, 'avgHitsPerTrack'):
0155                 setattr(prod, 'avgHitsPerTrack', cms.double(5.0))
0156             
0157             if not hasattr(prod, 'avgTracksPerCell'):
0158                 setattr(prod, 'avgTracksPerCell', cms.double(0.5))
0159 
0160             if not hasattr(prod, 'geometry'):
0161 
0162                 geometryPS = cms.PSet(
0163                     caDCACuts = cms.vdouble(
0164                         0.05, 0.1, 0.1, 0.1, 0.1,
0165                         0.1, 0.1, 0.1, 0.1, 0.1
0166                     ),
0167                     caThetaCuts = cms.vdouble(
0168                         0.001, 0.001, 0.001, 0.001, 0.002,
0169                         0.002, 0.002, 0.002, 0.002, 0.002
0170                     ),
0171 
0172                     ## This are the defaults actually
0173                     startingPairs = cms.vuint32(0,1,2),
0174                     pairGraph = cms.vuint32(0, 1, 0, 4, 0, 7, 1, 2, 1, 4, 1, 7, 4, 5, 7, 8, 2, 3, 2, 4, 2, 7, 5, 6, 8, 9, 0, 2, 1, 3, 0, 5, 0, 8, 4, 6, 7, 9),
0175                     phiCuts = cms.vint32(522, 730, 730, 522, 626, 626, 522, 522, 626, 626, 626, 522, 522, 522, 522, 522, 522, 522, 522),
0176                     minZ = cms.vdouble(-20, 0, -30, -22, 10, -30, -70, -70, -22, 15, -30, -70, -70, -20, -22, 0, -30, -70, -70),
0177                     maxZ = cms.vdouble(20, 30, 0, 22, 30, -10, 70, 70, 22, 30, -15, 70, 70, 20, 22, 30, 0, 70, 70),
0178                     maxR = cms.vdouble(20, 9, 9, 20, 7, 7, 5, 5, 20, 6, 6, 5, 5, 20, 20, 9, 9, 9, 9)
0179                 )
0180 
0181                 setattr(prod, 'geometry', geometryPS)
0182 
0183     return process
0184 
0185 # CMSSW version specific customizations
0186 def customizeHLTforCMSSW(process, menuType="GRun"):
0187 
0188     process = customiseForOffline(process)
0189 
0190     # add call to action function in proper order: newest last!
0191     # process = customiseFor12718(process)
0192     
0193     process = customizeHLTfor47611(process)
0194 
0195     return process
0196