CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
customizeHLTforCMSSW.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 # modifiers
4 from Configuration.ProcessModifiers.gpu_cff import gpu
5 
6 # helper fuctions
8 
9 # add one customisation function per PR
10 # - put the PR number into the name of the function
11 # - add a short comment
12 # for example:
13 
14 # CCCTF tuning
15 # def customiseFor12718(process):
16 # for pset in process._Process__psets.values():
17 # if hasattr(pset,'ComponentType'):
18 # if (pset.ComponentType == 'CkfBaseTrajectoryFilter'):
19 # if not hasattr(pset,'minGoodStripCharge'):
20 # pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone'))
21 # return process
22 
23 
25  """Customise the HLT to run on Run 2 data/MC using the old readout for the HCAL barel"""
26 
27  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
28  # switch on the QI8 processing for 2018 HCAL barrel
29  producer.processQIE8 = True
30 
31  # adapt CaloTowers threshold for 2018 HCAL barrel with only one depth
32  for producer in producers_by_type(process, "CaloTowersCreator"):
33  producer.HBThreshold1 = 0.7
34  producer.HBThreshold2 = 0.7
35  producer.HBThreshold = 0.7
36 
37  # adapt Particle Flow threshold for 2018 HCAL barrel with only one depth
38  from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _thresholdsHB, _thresholdsHEphase1, _seedingThresholdsHB
39 
40  logWeightDenominatorHCAL2018 = cms.VPSet(
41  cms.PSet(
42  depths = cms.vint32(1, 2, 3, 4),
43  detector = cms.string('HCAL_BARREL1'),
44  logWeightDenominator = _thresholdsHB
45  ),
46  cms.PSet(
47  depths = cms.vint32(1, 2, 3, 4, 5, 6, 7),
48  detector = cms.string('HCAL_ENDCAP'),
49  logWeightDenominator = _thresholdsHEphase1
50  )
51  )
52 
53  for producer in producers_by_type(process, "PFRecHitProducer"):
54  if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
55  producer.producers[0].qualityTests[0].cuts[0].threshold = _thresholdsHB
56 
57  for producer in producers_by_type(process, "PFClusterProducer"):
58  if producer.seedFinder.thresholdsByDetector[0].detector.value() == 'HCAL_BARREL1':
59  producer.seedFinder.thresholdsByDetector[0].seedingThreshold = _seedingThresholdsHB
60  producer.initialClusteringStep.thresholdsByDetector[0].gatheringThreshold = _thresholdsHB
61  producer.pfClusterBuilder.recHitEnergyNorms[0].recHitEnergyNorm = _thresholdsHB
62  producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
63  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
64 
65  for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
66  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
67 
68  # done
69  return process
70 
71 
73  """Adapt the HLT to run the legacy DT unpacking
74  for pre2018 data/MC workflows as the default"""
75 
76  if hasattr(process,'hltMuonDTDigis'):
77  process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
78  useStandardFEDid = cms.bool( True ),
79  maxFEDid = cms.untracked.int32( 779 ),
80  inputLabel = cms.InputTag( "rawDataCollector" ),
81  minFEDid = cms.untracked.int32( 770 ),
82  dataType = cms.string( "DDU" ),
83  readOutParameters = cms.PSet(
84  localDAQ = cms.untracked.bool( False ),
85  debug = cms.untracked.bool( False ),
86  rosParameters = cms.PSet(
87  localDAQ = cms.untracked.bool( False ),
88  debug = cms.untracked.bool( False ),
89  writeSC = cms.untracked.bool( True ),
90  readDDUIDfromDDU = cms.untracked.bool( True ),
91  readingDDU = cms.untracked.bool( True ),
92  performDataIntegrityMonitor = cms.untracked.bool( False )
93  ),
94  performDataIntegrityMonitor = cms.untracked.bool( False )
95  ),
96  dqmOnly = cms.bool( False )
97  )
98 
99  return process
100 
102  """Customise the HLT to run on Run 2 data/MC using the old definition of the pixel calibrations
103 
104  Up to 11.0.x, the pixel calibarations were fully specified in the configuration:
105  VCaltoElectronGain = 47
106  VCaltoElectronGain_L1 = 50
107  VCaltoElectronOffset = -60
108  VCaltoElectronOffset_L1 = -670
109 
110  Starting with 11.1.x, the calibrations for Run 3 were moved to the conditions, leaving in the configuration only:
111  VCaltoElectronGain = 1
112  VCaltoElectronGain_L1 = 1
113  VCaltoElectronOffset = 0
114  VCaltoElectronOffset_L1 = 0
115 
116  Since the conditions for Run 2 have not been updated to the new scheme, the HLT configuration needs to be reverted.
117  """
118  # revert the Pixel parameters to be compatible with the Run 2 conditions
119  for producer in producers_by_type(process, "SiPixelClusterProducer"):
120  producer.VCaltoElectronGain = 47
121  producer.VCaltoElectronGain_L1 = 50
122  producer.VCaltoElectronOffset = -60
123  producer.VCaltoElectronOffset_L1 = -670
124 
125  return process
126 
128  # revert the pixel Layer 1 cluster threshold to be compatible with Run2:
129  for producer in producers_by_type(process, "SiPixelClusterProducer"):
130  if hasattr(producer,"ClusterThreshold_L1"):
131  producer.ClusterThreshold_L1 = 2000
132  for producer in producers_by_type(process, "SiPixelRawToClusterCUDA"):
133  if hasattr(producer,"clusterThreshold_layer1"):
134  producer.clusterThreshold_layer1 = 2000
135 
136  return process
137 
139  """Customise the HLT to run on Run 2 data/MC"""
140  process = customisePixelGainForRun2Input(process)
142  process = customiseHCALFor2018Input(process)
143 
144  return process
145 
146 
147 # CMSSW version specific customizations
148 def customizeHLTforCMSSW(process, menuType="GRun"):
149 
150  # if the gpu modifier is enabled, make the Pixel, ECAL and HCAL reconstruction offloadable to a GPU
151  from HLTrigger.Configuration.customizeHLTforPatatrack import customizeHLTforPatatrack
152  gpu.makeProcessModifier(customizeHLTforPatatrack).apply(process)
153 
154  # add call to action function in proper order: newest last!
155  # process = customiseFor12718(process)
156 
157  return process
def producers_by_type
Definition: common.py:4
Vec apply(Vec v, F f)
Definition: ExtVec.h:81