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 
20 # EG filter enhancements PR #18559
21 def customiseFor18559(process):
22  for filt in filters_by_type(process, "HLTEgammaGenericFilter", "HLTMuonGenericFilter", "HLTEgammaGenericQuadraticFilter", "HLTEgammaGenericQuadraticEtaFilter"):
23  if not hasattr(filt, "doRhoCorrection"):
24  filt.doRhoCorrection = cms.bool( False )
25  filt.rhoTag = cms.InputTag( "" )
26  filt.effectiveAreas = cms.vdouble( 0.0 )
27  filt.absEtaLowEdges = cms.vdouble( 0.0 )
28  filt.rhoMax = cms.double( 9.9999999E7 )
29  filt.rhoScale = cms.double( 1.0 )
30 
31  for filt in filters_by_type(process, "HLTEgammaGenericFilter", "HLTMuonGenericFilter", "HLTEgammaGenericQuadraticFilter"):
32  if not hasattr(filt, "energyLowEdges"):
33  cutRegularEB = filt.thrRegularEB.value()
34  cutRegularEE = filt.thrRegularEE.value()
35  cutOverEEB = filt.thrOverEEB.value()
36  cutOverEEE = filt.thrOverEEE.value()
37  cutOverE2EB = filt.thrOverE2EB.value()
38  cutOverE2EE = filt.thrOverE2EE.value()
39 
40  del filt.thrRegularEB
41  del filt.thrRegularEE
42  del filt.thrOverEEB
43  del filt.thrOverEEE
44  del filt.thrOverE2EB
45  del filt.thrOverE2EE
46 
47  filt.energyLowEdges = cms.vdouble( 0.0 )
48  filt.thrRegularEB = cms.vdouble( cutRegularEB )
49  filt.thrRegularEE = cms.vdouble( cutRegularEE )
50  filt.thrOverEEB = cms.vdouble( cutOverEEB )
51  filt.thrOverEEE = cms.vdouble( cutOverEEE )
52  filt.thrOverE2EB = cms.vdouble( cutOverE2EB )
53  filt.thrOverE2EE = cms.vdouble( cutOverE2EE )
54 
55  for filt in filters_by_type(process, "HLTEgammaGenericQuadraticEtaFilter"):
56  if not hasattr(filt, "energyLowEdges"):
57  cutRegularEB1 = filt.thrRegularEB1.value()
58  cutRegularEE1 = filt.thrRegularEE1.value()
59  cutOverEEB1 = filt.thrOverEEB1.value()
60  cutOverEEE1 = filt.thrOverEEE1.value()
61  cutOverE2EB1 = filt.thrOverE2EB1.value()
62  cutOverE2EE1 = filt.thrOverE2EE1.value()
63  cutRegularEB2 = filt.thrRegularEB2.value()
64  cutRegularEE2 = filt.thrRegularEE2.value()
65  cutOverEEB2 = filt.thrOverEEB2.value()
66  cutOverEEE2 = filt.thrOverEEE2.value()
67  cutOverE2EB2 = filt.thrOverE2EB2.value()
68  cutOverE2EE2 = filt.thrOverE2EE2.value()
69 
70  del filt.thrRegularEB1
71  del filt.thrRegularEE1
72  del filt.thrOverEEB1
73  del filt.thrOverEEE1
74  del filt.thrOverE2EB1
75  del filt.thrOverE2EE1
76  del filt.thrRegularEB2
77  del filt.thrRegularEE2
78  del filt.thrOverEEB2
79  del filt.thrOverEEE2
80  del filt.thrOverE2EB2
81  del filt.thrOverE2EE2
82 
83  filt.energyLowEdges = cms.vdouble( 0.0 )
84  filt.thrRegularEB1 = cms.vdouble( cutRegularEB1 )
85  filt.thrRegularEE1 = cms.vdouble( cutRegularEE1 )
86  filt.thrOverEEB1 = cms.vdouble( cutOverEEB1 )
87  filt.thrOverEEE1 = cms.vdouble( cutOverEEE1 )
88  filt.thrOverE2EB1 = cms.vdouble( cutOverE2EB1 )
89  filt.thrOverE2EE1 = cms.vdouble( cutOverE2EE1 )
90  filt.thrRegularEB2 = cms.vdouble( cutRegularEB2 )
91  filt.thrRegularEE2 = cms.vdouble( cutRegularEE2 )
92  filt.thrOverEEB2 = cms.vdouble( cutOverEEB2 )
93  filt.thrOverEEE2 = cms.vdouble( cutOverEEE2 )
94  filt.thrOverE2EB2 = cms.vdouble( cutOverE2EB2 )
95  filt.thrOverE2EE2 = cms.vdouble( cutOverE2EE2 )
96  return process
97 
98 # Matching ECAL selective readout in particle flow, need a new input with online Selective Readout Flags
99 def customiseFor17794(process):
100  for edproducer in producers_by_type(process, "PFRecHitProducer"):
101  if hasattr(edproducer,'producers'):
102  for pset in edproducer.producers:
103  if (pset.name == 'PFEBRecHitCreator' or pset.name == 'PFEERecHitCreator'):
104  if not hasattr(pset,'srFlags'):
105  pset.srFlags = cms.InputTag('hltEcalDigis')
106  return process
107 
108 
109 # Dynamic track algo priority order
110 def customiseFor17771(process):
111  if not hasattr(process, "hltTrackAlgoPriorityOrder"):
112  from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder
113  process.hltTrackAlgoPriorityOrder = trackAlgoPriorityOrder.clone(
114  ComponentName = "hltTrackAlgoPriorityOrder",
115  algoOrder = [] # HLT iteration order is correct in the hard-coded default
116  )
117 
118  for producer in producers_by_type(process, "SimpleTrackListMerger", "TrackCollectionMerger", "TrackListMerger"):
119  if not hasattr(producer, "trackAlgoPriorityOrder"):
120  producer.trackAlgoPriorityOrder = cms.string("hltTrackAlgoPriorityOrder")
121  return process
122 
123 # Add optional SeedStopReason to CkfTrackCandidateMaker
124 def customiseFor17792(process):
125  for producer in producers_by_type(process, "CkfTrackCandidateMaker"):
126  if not hasattr(producer, "produceSeedStopReasons"):
127  producer.produceSeedStopReasons = cms.bool(False)
128  return process
129 
130 # DA clusterizer tuning
131 def customiseFor18330(process):
132  for producer in producers_by_type(process, "PrimaryVertexProducer"):
133  if producer.TkFilterParameters.algorithm.value() == "filter" and not hasattr(producer.TkFilterParameters, "maxEta"):
134  producer.TkFilterParameters.maxEta = cms.double(100.0)
135 
136  if producer.TkClusParameters.algorithm.value() == "DA_vect":
137  if abs(producer.TkClusParameters.TkDAClusParameters.Tmin.value() - 4.0) < 1e-3:
138  # default value was changed, going from 4.0 -> 2.4 should give no change in results
139  producer.TkClusParameters.TkDAClusParameters.Tmin = 2.4
140  if not hasattr(producer.TkClusParameters.TkDAClusParameters, "Tpurge"):
141  producer.TkClusParameters.TkDAClusParameters.Tpurge = cms.double(2.0)
142  if not hasattr(producer.TkClusParameters.TkDAClusParameters, "Tstop"):
143  producer.TkClusParameters.TkDAClusParameters.Tstop = cms.double(0.5)
144  if not hasattr(producer.TkClusParameters.TkDAClusParameters, "zmerge"):
145  producer.TkClusParameters.TkDAClusParameters.zmerge = cms.double(1e-2)
146  if not hasattr(producer.TkClusParameters.TkDAClusParameters, "uniquetrkweight"):
147  producer.TkClusParameters.TkDAClusParameters.uniquetrkweight = cms.double(0.9)
148 
149  for pset in producer.vertexCollections:
150  if pset.algorithm.value() == "AdaptiveVertexFitter" and not hasattr(pset, "chi2cutoff"):
151  pset.chi2cutoff = cms.double(3.0)
152  return process
153 
154 # Add new parameters required by RecoTauBuilderConePlugin
155 def customiseFor18429(process):
156  for producer in producers_by_type(process, "RecoTauProducer"):
157  if hasattr(producer,'builders'):
158  for pset in producer.builders:
159  if not hasattr(pset,'minAbsPhotonSumPt_insideSignalCone'):
160  pset.minAbsPhotonSumPt_insideSignalCone = cms.double(2.5)
161  if not hasattr(pset,'minRelPhotonSumPt_insideSignalCone'):
162  pset.minRelPhotonSumPt_insideSignalCone = cms.double(0.10)
163 
164  return process
165 
166 # Updating FastjetJetProducer (and related producers) with fillDescriptions
167 def customiseFor19098(process):
168  for producer in producers_by_type(process, "FastjetJetProducer"):
169  if hasattr(producer, "doOutputJets"): del producer.doOutputJets
170  if hasattr(producer, "addNegative"): del producer.addNegative
171  if hasattr(producer, "addNegativesFromCone"): del producer.addNegativesFromCone
172  if hasattr(producer, "dropZeros"): del producer.dropZeros
173  if hasattr(producer, "infinitesimalPt"): del producer.infinitesimalPt
174  return process
175 
177  for producer in producers_by_type(process, "SiPixelClusterProducer"):
178  producer.VCaltoElectronGain_L1 = cms.int32(65)
179  producer.VCaltoElectronOffset_L1 = cms.int32(-414)
180  producer.ClusterThreshold = cms.int32(4000)
181  producer.ClusterThreshold_L1 = cms.int32(4000)
182  return process
183 
185  for producer in producers_by_type(process, "SiPixelClusterProducer"):
186  producer.VCaltoElectronGain = cms.int32(47)
187  producer.VCaltoElectronGain_L1 = cms.int32(50)
188  producer.VCaltoElectronOffset = cms.int32(-60)
189  producer.VCaltoElectronOffset_L1 = cms.int32(-670)
190  producer.ClusterThreshold = cms.int32(4000)
191  producer.ClusterThreshold_L1 = cms.int32(2000)
192  return process
193 
194 # CMSSW version specific customizations
195 def customizeHLTforCMSSW(process, menuType="GRun"):
196 
197  if (menuType == "GRun2016"):
198  # GRun2016 is a 90X menu
199  process = customiseFor17771(process)
200  process = customiseFor17792(process)
201  process = customiseFor17794(process)
202  process = customiseFor18330(process)
203  process = customiseFor18429(process)
204  process = customiseFor18559(process)
205  process = customiseFor19098(process)
206 
207  # add call to action function in proper order: newest last!
208  # process = customiseFor12718(process)
209 
210  if (menuType == "GRun2016"):
211  process = customiseFor19181_pixel_phase0(process)
212  else:
213  process = customiseFor19181_pixel_phase1(process)
214 
215  return process
def customiseFor19181_pixel_phase1(process)
def customiseFor19181_pixel_phase0(process)
def customizeHLTforCMSSW(process, menuType="GRun")
def filters_by_type(process, types)
Definition: common.py:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def producers_by_type(process, types)
Definition: common.py:5