CMS 3D CMS Logo

customizeHLTforCMSSW.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 # helper fuctions
5 
6 # add one customisation function per PR
7 # - put the PR number into the name of the function
8 # - add a short comment
9 # for example:
10 
11 # CCCTF tuning
12 # def customiseFor12718(process):
13 # for pset in process._Process__psets.values():
14 # if hasattr(pset,'ComponentType'):
15 # if (pset.ComponentType == 'CkfBaseTrajectoryFilter'):
16 # if not hasattr(pset,'minGoodStripCharge'):
17 # pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone'))
18 # return process
19 
21 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _seedingThresholdsHB, _thresholdsHB
22 from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHBHE_cfi import _thresholdsHB as _thresholdsHBRec
23 
24 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHCAL_cfi import _thresholdsHEphase1 as _thresholdsHEphase1HCAL
25 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _seedingThresholdsHEphase1, _thresholdsHEphase1
26 from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHBHE_cfi import _thresholdsHEphase1 as _thresholdsHEphase1Rec
27 
28 
29 logWeightDenominatorHCAL2018 = cms.VPSet(
30  cms.PSet(
31  depths = cms.vint32(1, 2, 3, 4),
32  detector = cms.string('HCAL_BARREL1'),
33  logWeightDenominator = _thresholdsHB
34  ),
35  cms.PSet(
36  depths = cms.vint32(
37  1, 2, 3, 4, 5, 6, 7
38  ),
39  detector = cms.string('HCAL_ENDCAP'),
40  logWeightDenominator = _thresholdsHEphase1HCAL
41  )
42 )
43 
44 
46  # this function bring back the Run3 menu to a Run2-2018 like meny, for testing in data 2018
47 
48  #----------------------------------------------------------------------------------------------------------
49  # adapt threshold for HB - in 2018 only one depth
50 
51  for producer in producers_by_type(process, "PFClusterProducer"):
52  if producer.seedFinder.thresholdsByDetector[0].detector.value() == 'HCAL_BARREL1':
53  producer.seedFinder.thresholdsByDetector[0].seedingThreshold = _seedingThresholdsHB
54  producer.initialClusteringStep.thresholdsByDetector[0].gatheringThreshold = _thresholdsHB
55  producer.pfClusterBuilder.recHitEnergyNorms[0].recHitEnergyNorm = _thresholdsHB
56 
57  producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
58  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
59 
60  for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
61  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
62 
63  for producer in producers_by_type(process, "PFRecHitProducer"):
64  if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
65  producer.producers[0].qualityTests[0].cuts[0].threshold = _thresholdsHBRec
66 
67  for producer in producers_by_type(process, "CaloTowersCreator"):
68  producer.HBThreshold1 = cms.double(0.7)
69  producer.HBThreshold2 = cms.double(0.7)
70  producer.HBThreshold = cms.double(0.7)
71 
72  #--------------------------------------------------------
73  # switch on the QI8 processing as in HB-Run2 (in Run3 we have only QIE11)
74  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
75  producer.processQIE8 = cms.bool( True )
76  producer.setNoiseFlagsQIE8 = cms.bool( True )
77  producer.setPulseShapeFlagsQIE8 = cms.bool( True )
78 
79  #----------------------------------------------------------
80  # Use 1+8p fit (PR29617) and apply HB- correction (PR26177)
81  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
82  producer.algorithm.applyLegacyHBMCorrection = cms.bool( True )
83  producer.algorithm.chiSqSwitch = cms.double(15.0)
84 
85  return process
86 
88  # this function bring forward the sw changes of Run3 to 2018 data starting from a Run2-2018 like menu
89 
90  #-----------------------------------------------------------------------------------------------------------
91  # A) remove collapser from sequence
92  process.hltHbhereco = process.hltHbhePhase1Reco.clone()
93  process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco )
94  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco )
95  process.HLTDoLocalHcalWithTowerSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco + process.hltTowerMakerForAll )
96 
97 
98  #----------------------------------------------------------------------------------------------------------
99  # B) adapt threshold following removal of the collapser
100  # note this is done only for HE
101 
102  for producer in producers_by_type(process, "PFClusterProducer"):
103  if producer.seedFinder.thresholdsByDetector[1].detector.value() == 'HCAL_ENDCAP':
104  producer.seedFinder.thresholdsByDetector[1].seedingThreshold = _seedingThresholdsHEphase1
105  producer.initialClusteringStep.thresholdsByDetector[1].gatheringThreshold = _thresholdsHEphase1
106  producer.pfClusterBuilder.recHitEnergyNorms[1].recHitEnergyNorm = _thresholdsHEphase1
107 
108  del producer.pfClusterBuilder.positionCalc.logWeightDenominator
109  producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
110  del producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominator
111  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
112 
113  for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
114  del producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominator
115  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
116 
117  for producer in producers_by_type(process, "PFRecHitProducer"):
118  if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
119  producer.producers[0].qualityTests[0].cuts[1].threshold = _thresholdsHEphase1Rec
120 
121  for producer in producers_by_type(process, "CaloTowersCreator"):
122  producer.HcalPhase = cms.int32(1)
123  producer.HESThreshold1 = cms.double(0.1)
124  producer.HESThreshold = cms.double(0.2)
125  producer.HEDThreshold1 = cms.double(0.1)
126  producer.HEDThreshold = cms.double(0.2)
127 
128  #--------------------------------------------------------
129  # C) add arrival time following PR 26270 (emulate what we will do in Run3 at HLT)
130  # (unused HLT quantity, set to false to save CPU)
131  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
132  producer.algorithm.calculateArrivalTime = cms.bool(False)
133 
134  #--------------------------------------------------------
135  # D) 3->8 pulse fit for PR 25469 (emulate what we will do in Run3 at HLT)
136  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
137  producer.use8ts = cms.bool(True)
138  producer.algorithm.dynamicPed = cms.bool(False)
139  producer.algorithm.activeBXs = cms.vint32(-3, -2, -1, 0, 1, 2, 3, 4)
140 
141  return process
142 
143 
145  """Adapt the HLT to run the legacy DT unpacking
146  for pre2018 data/MC workflows as the default"""
147 
148  if hasattr(process,'hltMuonDTDigis'):
149  process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
150  useStandardFEDid = cms.bool( True ),
151  maxFEDid = cms.untracked.int32( 779 ),
152  inputLabel = cms.InputTag( "rawDataCollector" ),
153  minFEDid = cms.untracked.int32( 770 ),
154  dataType = cms.string( "DDU" ),
155  readOutParameters = cms.PSet(
156  localDAQ = cms.untracked.bool( False ),
157  debug = cms.untracked.bool( False ),
158  rosParameters = cms.PSet(
159  localDAQ = cms.untracked.bool( False ),
160  debug = cms.untracked.bool( False ),
161  writeSC = cms.untracked.bool( True ),
162  readDDUIDfromDDU = cms.untracked.bool( True ),
163  readingDDU = cms.untracked.bool( True ),
164  performDataIntegrityMonitor = cms.untracked.bool( False )
165  ),
166  performDataIntegrityMonitor = cms.untracked.bool( False )
167  ),
168  dqmOnly = cms.bool( False )
169  )
170 
171  return process
172 
174  """Customise the HLT to run on Run 2 data/MC using the old definition of the pixel calibrations
175  Up to 11.0.x, the pixel calibarations were fully specified in the configuration:
176  VCaltoElectronGain = 47
177  VCaltoElectronGain_L1 = 50
178  VCaltoElectronOffset = -60
179  VCaltoElectronOffset_L1 = -670
180  Starting with 11.1.x, the calibrations for Run 3 were moved to the conditions, leaving in the configuration only:
181  VCaltoElectronGain = 1
182  VCaltoElectronGain_L1 = 1
183  VCaltoElectronOffset = 0
184  VCaltoElectronOffset_L1 = 0
185  Since the conditions for Run 2 have not been updated to the new scheme, the HLT configuration needs to be reverted.
186  """
187  # revert the Pixel parameters to be compatible with the Run 2 conditions
188  for producer in producers_by_type(process, "SiPixelClusterProducer"):
189  producer.VCaltoElectronGain = 47
190  producer.VCaltoElectronGain_L1 = 50
191  producer.VCaltoElectronOffset = -60
192  producer.VCaltoElectronOffset_L1 = -670
193 
194  return process
195 
196 
198  """Customise the HLT to run on Run 2 data/MC"""
199  process = customisePixelGainForRun2Input(process)
200  process = synchronizeHCALHLTofflineRun3on2018data(process)
201 
202 
203 # CMSSW version specific customizations
204 def customizeHLTforCMSSW(process, menuType="GRun"):
205 
206  # add call to action function in proper order: newest last!
207  # process = customiseFor12718(process)
208 
209  return process
customizeHLTforCMSSW.synchronizeHCALHLTofflineRun3on2018data
def synchronizeHCALHLTofflineRun3on2018data(process)
Definition: customizeHLTforCMSSW.py:45
common
customizeHLTforCMSSW.customizeHLTforCMSSW
def customizeHLTforCMSSW(process, menuType="GRun")
Definition: customizeHLTforCMSSW.py:204
particleFlowClusterHBHE_cfi
particleFlowClusterHCAL_cfi
customizeHLTforCMSSW.synchronizeHCALHLTofflineRun2
def synchronizeHCALHLTofflineRun2(process)
Definition: customizeHLTforCMSSW.py:87
customizeHLTforCMSSW.customiseFor2017DtUnpacking
def customiseFor2017DtUnpacking(process)
Definition: customizeHLTforCMSSW.py:144
particleFlowRecHitHBHE_cfi
customizeHLTforCMSSW.customisePixelGainForRun2Input
def customisePixelGainForRun2Input(process)
Definition: customizeHLTforCMSSW.py:173
customizeHLTforCMSSW.customiseFor2018Input
def customiseFor2018Input(process)
Definition: customizeHLTforCMSSW.py:197
common.producers_by_type
def producers_by_type(process, *types)
Definition: common.py:6