CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
reco_TLR_42X.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 def memorySavingTracking(process):
4  toRemove={}
5  #list of modules in iterative tracking
6  ## remove rekeying of clusters refs from track producer
7  trackProducers=['preFilterZeroStepTracks',
8  'preFilterStepOneTracks',
9  'secWithMaterialTracks',
10  'thWithMaterialTracks',
11  'fourthWithMaterialTracks',
12  'fifthWithMaterialTracks',
13  ]
14 
15  for tp in trackProducers:
16  m=getattr(process,tp)
17  if hasattr(m,"clusterRemovalInfo"):
18  #print "removing cluter rekeying from",tp
19  delattr(m,"clusterRemovalInfo")
20 
21  measurementTrackers=['MeasurementTracker',
22  'newMeasurementTracker',
23  'secMeasurementTracker',
24  'thMeasurementTracker',
25  'fourthMeasurementTracker',
26  'fifthMeasurementTracker',
27  ]
28 
29  # list of measurement tracker, component names
30  ## create the clusterRef to skip creators (MT+'ToSkip')
31  for mt in measurementTrackers:
32  es=getattr(process,mt)
33  ## modify MT to point to the full cluster list
34  #if es.pixelClusterProducer.value() == 'siPixelClusters':
35  # continue
36 
37  #old trackclusterremoval module
38  removalModule=es.pixelClusterProducer.value()
39 
40  if (removalModule != 'siPixelClusters'):
41  es.skipClusters = cms.InputTag(removalModule)
42  es.pixelClusterProducer = 'siPixelClusters'
43  es.stripClusterProducer = 'siStripClusters'
44  #print mt,es.skipClusters,es.pixelClusterProducer,es.stripClusterProducer
45  tcremoval = getattr(process,removalModule)
46  #print removalModule,"turned to using new scheme"
47  tcremoval.clusterLessSolution= cms.bool(True)
48  tcremoval.stripClusters = 'siStripClusters'
49  tcremoval.pixelClusters = 'siPixelClusters'
50  skipTrackQualityFilter=False
51  if (skipTrackQualityFilter):
52  tcremoval.TrackQuality = cms.string('highPurity')
53  #remove the QualityFilter module from the path
54  toRemove[tcremoval.trajectories.value()]=True
55  qf=getattr(process,tcremoval.trajectories.value())
56  tcremoval.trajectories = qf.recTracks
57  #else:
58  #print mt,'no cluster to skip',es.pixelClusterProducer,es.stripClusterProducer
59 
60  patternRecoModules=[
61  'fifthTrackCandidates',
62  'fourthTrackCandidates',
63  'newTrackCandidateMaker',
64  'secTrackCandidates',
65  'stepOneTrackCandidateMaker',
66  'thTrackCandidates'
67  ]
68 
69  for ckfm in patternRecoModules:
70  ckf=getattr(process,ckfm)
71  builder=getattr(process,ckf.TrajectoryBuilder.value())
72  mtn= builder.MeasurementTrackerName.value()
73  if mtn!='':
74  #make it look at the central MT
75  builder.MeasurementTrackerName=''
76  mt=getattr(process,mtn)
77  # transfer the cluster removal from the MT to the builder
78  builder.clustersToSkip = mt.skipClusters
79  #print "setting",ckf.TrajectoryBuilder.value(),"via",ckfm,"to look at central MT"
80  #print "removing MT:",mtn
81  delattr(process,mtn)
82  #else:
83  #print ckfm,"untouched"
84 
85  #all seeding layers should point to the same rechits collections
86  for esp in process.es_producers_().keys():
87  es = getattr(process,esp)
88  if es._TypedParameterizable__type != 'SeedingLayersESProducer':
89  continue
90  for pm in es.parameters_().keys():
91  p=getattr(es,pm)
92  if p.pythonTypeName() == 'cms.PSet':
93  if hasattr(p,'HitProducer'):
94  #print "pixel",pm,p
95  #pixel case
96  if p.HitProducer != 'siPixelRecHits':
97  toRemove[p.HitProducer.value()]=True
98  skip=getattr(process,p.HitProducer.value()).src
99  p.HitProducer = 'siPixelRecHits'
100  #and set the skipping
101  p.skipClusters = cms.InputTag(skip.value())
102  #print esp,"modified for new skipping"
103  #print esp,pm,p
104 
105  if hasattr(p,'matchedRecHits'):
106  #print "strip",pm,p
107  #strip case
108  ## rename the collection
109  if p.matchedRecHits.moduleLabel != 'siStripMatchedRecHits':
110  toRemove[p.matchedRecHits.moduleLabel]=True
111  skip=getattr(process,p.matchedRecHits.moduleLabel).ClusterProducer
112  p.matchedRecHits.setModuleLabel('siStripMatchedRecHits')
113  #and set the skipping
114  p.skipClusters = cms.InputTag(skip.value())
115  #print esp,pm,p
116 
117 
118  for edp in process.producers_():
119  p=getattr(process,edp)
120  if hasattr(p,'ClusterCheckPSet'):
121  #print "resetting cluster check for",edp
122  p.ClusterCheckPSet.PixelClusterCollectionLabel = 'siPixelClusters'
123  p.ClusterCheckPSet.ClusterCollectionLabel = 'siStripClusters'
124 
125  #force useless module to be removed
126  toRemove['secStripRecHits']=True
127  toRemove['fourthPixelRecHits']=True
128  toRemove['fifthPixelRecHits']=True
129 
130  for tr in toRemove:
131  if hasattr(process,tr):
132  #print "removing",tr
133  process.reconstruction_step.remove(getattr(process,tr))
134 
135  delattr(process.newCombinedSeeds,'clusterRemovalInfos')
136 
137  return (process)
138 
139 
140 def customiseCommon(process):
141 
142  process = memorySavingTracking(process)
143 
144  return (process)
145 
146 
147 ##############################################################################
148 def customisePPData(process):
149  process= customiseCommon(process)
150 
151  ## particle flow HF cleaning
152  process.particleFlowRecHitHCAL.LongShortFibre_Cut = 30.
153  process.particleFlowRecHitHCAL.ApplyPulseDPG = True
154 
155  ## HF cleaning for data only
156  process.hcalRecAlgos.SeverityLevels[3].RecHitFlags.remove("HFDigiTime")
157  process.hcalRecAlgos.SeverityLevels[4].RecHitFlags.append("HFDigiTime")
158 
159  ##beam-halo-id for data only
160  process.CSCHaloData.ExpectedBX = cms.int32(3)
161 
162  ## hcal hit flagging
163  process.hfreco.PETstat.flagsToSkip = 2
164  process.hfreco.S8S1stat.flagsToSkip = 18
165  process.hfreco.S9S1stat.flagsToSkip = 26
166 
167  return process
168 
169 
170 ##############################################################################
171 def customisePPMC(process):
172  process=customiseCommon(process)
173 
174  return process
175 
176 ##############################################################################
177 def customiseCosmicData(process):
178 
179  return process
180 
181 ##############################################################################
182 def customiseCosmicMC(process):
183 
184  return process
185 
186 ##############################################################################
187 def customiseVALSKIM(process):
188  process= customisePPData(process)
189  process.reconstruction.remove(process.lumiProducer)
190  return process
191 
192 ##############################################################################
193 def customiseExpress(process):
194  process= customisePPData(process)
195 
197  process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
198 
199  return process
200 
201 ##############################################################################
202 def customisePrompt(process):
203  process= customisePPData(process)
204  return process
205 
206 ##############################################################################
207 ##############################################################################
208 
209 def customiseCommonHI(process):
210 
211  ###############################################################################################
212  ####
213  #### Top level replaces for handling strange scenarios of early HI collisions
214  ####
215 
216  ## Offline Silicon Tracker Zero Suppression
217  process.siStripZeroSuppression.Algorithms.CommonModeNoiseSubtractionMode = cms.string("IteratedMedian")
218  process.siStripZeroSuppression.Algorithms.CutToAvoidSignal = cms.double(2.0)
219  process.siStripZeroSuppression.Algorithms.Iterations = cms.int32(3)
220  process.siStripZeroSuppression.storeCM = cms.bool(True)
221 
222 
223  ###
224  ### end of top level replacements
225  ###
226  ###############################################################################################
227 
228  return process
229 
230 ##############################################################################
231 def customiseExpressHI(process):
232  process= customiseCommonHI(process)
233 
235  process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
236 
237  return process
238 
239 ##############################################################################
240 def customisePromptHI(process):
241  process= customiseCommonHI(process)
242 
244  process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()
245 
246  return process
247 
248 ##############################################################################
def customiseCosmicMC
def customiseExpress
def customiseCommonHI
def customiseExpressHI
def customiseVALSKIM
def customiseCosmicData
def customisePromptHI
def memorySavingTracking
Definition: reco_TLR_42X.py:3