CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonSeededStep_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 ###### Muon reconstruction module #####
4 from RecoMuon.MuonIdentification.earlyMuons_cfi import earlyMuons
5 
6 ###### SEEDER MODELS ######
7 import RecoTracker.SpecialSeedGenerators.outInSeedsFromStandaloneMuons_cfi
8 import RecoTracker.SpecialSeedGenerators.inOutSeedsFromTrackerMuons_cfi
9 muonSeededSeedsOutIn = RecoTracker.SpecialSeedGenerators.outInSeedsFromStandaloneMuons_cfi.outInSeedsFromStandaloneMuons.clone(
10  src = 'earlyMuons',
11 )
12 muonSeededSeedsInOut = RecoTracker.SpecialSeedGenerators.inOutSeedsFromTrackerMuons_cfi.inOutSeedsFromTrackerMuons.clone(
13  src = 'earlyMuons',
14 )
15 ### This is also needed for seeding
16 from RecoTracker.SpecialSeedGenerators.outInSeedsFromStandaloneMuons_cfi import hitCollectorForOutInMuonSeeds
17 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 as _tracker_apv_vfp30_2016
18 _tracker_apv_vfp30_2016.toModify(hitCollectorForOutInMuonSeeds, MinPtForHitRecoveryInGluedDet=1e9)
19 
20 ###### EVENT-SETUP STUFF #######
21 ###---------- Trajectory Cleaner, deciding how overlapping track candidates are arbitrated ----------------
23 muonSeededTrajectoryCleanerBySharedHits = TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi.trajectoryCleanerBySharedHits.clone(
24  ComponentName = 'muonSeededTrajectoryCleanerBySharedHits',
25  fractionShared = 0.1,
26  ValidHitBonus = 1000.0,
27  MissingHitPenalty = 1.0,
28  ComponentType = 'TrajectoryCleanerBySharedHits',
29  allowSharedFirstHit = True
30 )
31 
32 ###------------- MeasurementEstimator, defining the searcgh window for pattern recongnition ----------------
33 
34 from TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi import Chi2MeasurementEstimator as _Chi2MeasurementEstimator
35 _muonSeededMeasurementEstimatorForInOutBase = _Chi2MeasurementEstimator.clone(
36  ComponentName = 'muonSeededMeasurementEstimatorForInOut',
37  MaxChi2 = 80.0, ## was 30 ## TO BE TUNED
38  nSigma = 4., ## was 3 ## TO BE TUNED
39 )
40 muonSeededMeasurementEstimatorForInOut = _muonSeededMeasurementEstimatorForInOutBase.clone(
41  MaxSagitta = -1.
42 )
43 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140
44 trackingPhase2PU140.toModify(muonSeededMeasurementEstimatorForInOut, MaxChi2 = 400.0, MaxSagitta = 2)
45 
46 _muonSeededMeasurementEstimatorForOutInBase = _Chi2MeasurementEstimator.clone(
47  ComponentName = 'muonSeededMeasurementEstimatorForOutIn',
48  MaxChi2 = 30.0, ## was 30 ## TO BE TUNED
49  nSigma = 3., ## was 3 ## TO BE TUNED
50 )
51 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 as _tracker_apv_vfp30_2016
52 _tracker_apv_vfp30_2016.toModify(_muonSeededMeasurementEstimatorForOutInBase, MinPtForHitRecoveryInGluedDet=1e9)
53 muonSeededMeasurementEstimatorForOutIn = _muonSeededMeasurementEstimatorForOutInBase.clone(
54  MaxSagitta = -1.
55 )
56 
57 ###------------- TrajectoryFilter, defining selections on the trajectories while building them ----------------
59 muonSeededTrajectoryFilterForInOut = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone(
60  constantValueForLostHitsFractionFilter = 10, ## allow more lost hits
61  minimumNumberOfHits = 3 ## allow more lost hits
62 )
63 muonSeededTrajectoryFilterForOutIn = muonSeededTrajectoryFilterForInOut.clone(
64  constantValueForLostHitsFractionFilter = 10, ## allow more lost hits
65  minimumNumberOfHits = 5 ## allow more lost hits
66 )
67 ###------------- TrajectoryBuilders ----------------
69 muonSeededTrajectoryBuilderForInOut = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
70  foundHitBonus = 1000.0,
71  lostHitPenalty = 1.0,
72  maxCand = 5,
73  estimator = 'muonSeededMeasurementEstimatorForInOut',
74  trajectoryFilter = dict(refToPSet_ = 'muonSeededTrajectoryFilterForInOut'),
75  inOutTrajectoryFilter = dict(refToPSet_ = 'muonSeededTrajectoryFilterForInOut'), # not sure if it is used
76  minNrOfHitsForRebuild = 2,
77  requireSeedHitsInRebuild = True,
78  keepOriginalIfRebuildFails = True,
79 )
80 muonSeededTrajectoryBuilderForOutIn = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
81  foundHitBonus = 1000.0,
82  lostHitPenalty = 1.0,
83  maxCand = 3,
84  estimator = 'muonSeededMeasurementEstimatorForOutIn',
85  trajectoryFilter = dict(refToPSet_ = 'muonSeededTrajectoryFilterForOutIn'),
86  inOutTrajectoryFilter = dict(refToPSet_ = 'muonSeededTrajectoryFilterForOutIn'), # not sure if it is used
87  minNrOfHitsForRebuild = 5,
88  requireSeedHitsInRebuild = True,
89  keepOriginalIfRebuildFails = False,
90 )
91 
92 ###------------- Fitter-Smoother -------------------
94 muonSeededFittingSmootherWithOutliersRejectionAndRK = TrackingTools.TrackFitters.RungeKuttaFitters_cff.KFFittingSmootherWithOutliersRejectionAndRK.clone(
95  ComponentName = 'muonSeededFittingSmootherWithOutliersRejectionAndRK',
96  BreakTrajWith2ConsecutiveMissing = False,
97  EstimateCut = 50., ## was 20.
98 )
99 
100 ######## TRACK CANDIDATE MAKERS
102 muonSeededTrackCandidatesInOut = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
103  src = 'muonSeededSeedsInOut',
104  TrajectoryBuilderPSet = dict(refToPSet_ = 'muonSeededTrajectoryBuilderForInOut'),
105  TrajectoryCleaner = 'muonSeededTrajectoryCleanerBySharedHits',
106  RedundantSeedCleaner = 'none',
107 )
108 muonSeededTrackCandidatesOutIn = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
109  src = 'muonSeededSeedsOutIn',
110  TrajectoryBuilderPSet = dict(refToPSet_ = 'muonSeededTrajectoryBuilderForOutIn'),
111  TrajectoryCleaner = 'muonSeededTrajectoryCleanerBySharedHits',
112  numHitsForSeedCleaner = 50,
113  onlyPixelHitsForSeedCleaner = False,
114 )
115 
116 ######## TRACK PRODUCERS
118 muonSeededTracksOutIn = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
119  src = 'muonSeededTrackCandidatesOutIn',
120  AlgorithmName = 'muonSeededStepOutIn',
121  Fitter = 'muonSeededFittingSmootherWithOutliersRejectionAndRK',
122 )
123 muonSeededTracksInOut = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
124  src = 'muonSeededTrackCandidatesInOut',
125  AlgorithmName = 'muonSeededStepInOut',
126  Fitter = 'muonSeededFittingSmootherWithOutliersRejectionAndRK',
127 )
128 
129 # Final Classifier
131 muonSeededTracksInOutClassifier = TrackCutClassifier.clone(
132  src = 'muonSeededTracksInOut',
133  mva = dict(
134  minPixelHits = [0,0,0],
135  maxChi2 = [9999.,9999.,9999.],
136  maxChi2n = [10.0,1.0,0.4],
137  minLayers = [3,5,5],
138  min3DLayers = [1,2,2],
139  maxLostLayers = [4,3,2]
140  )
141 )
142 
143 muonSeededTracksOutInClassifier = TrackCutClassifier.clone(
144  src = 'muonSeededTracksOutIn',
145  mva = dict(
146  minPixelHits = [0,0,0],
147  maxChi2 = [9999.,9999.,9999.],
148  maxChi2n = [10.0,1.0,0.4],
149  minLayers = [3,5,5],
150  min3DLayers = [1,2,2],
151  maxLostLayers = [4,3,2]
152  )
153 )
154 
155 # For Phase2PU140
156 import RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi
157 muonSeededTracksInOutSelector = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
158  src='muonSeededTracksInOut',
159  trackSelectors= cms.VPSet(
160  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
161  name = 'muonSeededTracksInOutLoose',
162  applyAdaptedPVCuts = False,
163  chi2n_par = 10.0,
164  minNumberLayers = 3,
165  min_nhits = 5,
166  maxNumberLostLayers = 4,
167  minNumber3DLayers = 0,
168  minHitsToBypassChecks = 7
169  ),
170  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
171  name = 'muonSeededTracksInOutTight',
172  preFilterName = 'muonSeededTracksInOutLoose',
173  applyAdaptedPVCuts = False,
174  chi2n_par = 1.0,
175  minNumberLayers = 5,
176  min_nhits = 6,
177  maxNumberLostLayers = 3,
178  minNumber3DLayers = 2,
179  minHitsToBypassChecks = 10
180  ),
181  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
182  name = 'muonSeededTracksInOutHighPurity',
183  preFilterName = 'muonSeededTracksInOutTight',
184  applyAdaptedPVCuts = False,
185  chi2n_par = 0.4,
186  minNumberLayers = 5,
187  min_nhits = 7,
188  maxNumberLostLayers = 2,
189  minNumber3DLayers = 2,
190  minHitsToBypassChecks = 20
191  ),
192  ) #end of vpset
193  ) #end of clone
194 muonSeededTracksOutInSelector = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
195  src='muonSeededTracksOutIn',
196  trackSelectors= cms.VPSet(
197  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
198  name = 'muonSeededTracksOutInLoose',
199  applyAdaptedPVCuts = False,
200  chi2n_par = 10.0,
201  minNumberLayers = 3,
202  min_nhits = 5,
203  maxNumberLostLayers = 4,
204  minNumber3DLayers = 0,
205  minHitsToBypassChecks = 7
206  ),
207  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
208  name = 'muonSeededTracksOutInTight',
209  preFilterName = 'muonSeededTracksOutInLoose',
210  applyAdaptedPVCuts = False,
211  chi2n_par = 1.0,
212  minNumberLayers = 5,
213  min_nhits = 6,
214  maxNumberLostLayers = 3,
215  minNumber3DLayers = 2,
216  minHitsToBypassChecks = 10
217  ),
218  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
219  name = 'muonSeededTracksOutInHighPurity',
220  preFilterName = 'muonSeededTracksOutInTight',
221  applyAdaptedPVCuts = False,
222  chi2n_par = 0.4,
223  minNumberLayers = 5,
224  min_nhits = 7,
225  maxNumberLostLayers = 2,
226  minNumber3DLayers = 2,
227  minHitsToBypassChecks = 20
228  ),
229  ) #end of vpset
230  ) #end of clone
231 
232 
233 
234 muonSeededStepCoreInOutTask = cms.Task(
235  muonSeededSeedsInOut , muonSeededTrackCandidatesInOut , muonSeededTracksInOut
236 )
237 muonSeededStepCoreInOut = cms.Sequence(muonSeededStepCoreInOutTask)
238 
239 muonSeededStepCoreOutInTask = cms.Task(
240  muonSeededSeedsOutIn , muonSeededTrackCandidatesOutIn , muonSeededTracksOutIn
241 )
242 muonSeededStepCoreOutIn = cms.Sequence(muonSeededStepCoreOutInTask)
243 
244 muonSeededStepCoreTask = cms.Task(
245  muonSeededStepCoreInOutTask ,
246  muonSeededStepCoreOutInTask
247 )
248 muonSeededStepCore = cms.Sequence(muonSeededStepCoreTask)
249 #Phase2 : just muon Seed InOut is used in this moment
250 #trackingPhase2PU140.toReplaceWith(muonSeededStepCore, muonSeededStepCoreInOut)
251 
252 from Configuration.Eras.Modifier_phase2_timing_layer_cff import phase2_timing_layer
253 phase2_timing_layer.toModify(muonSeededTracksInOut, TrajectoryInEvent = True)
254 phase2_timing_layer.toModify(muonSeededTracksOutIn, TrajectoryInEvent = True)
255 
256 muonSeededStepExtraInOutTask = cms.Task(
257  muonSeededTracksInOutClassifier
258 )
259 muonSeededStepExtraInOut = cms.Sequence(muonSeededStepExtraInOutTask)
260 
261 trackingPhase2PU140.toReplaceWith(muonSeededStepExtraInOutTask, cms.Task(
262  muonSeededTracksInOutSelector
263 ))
264 
265 muonSeededStepExtraTask = cms.Task(
266  muonSeededStepExtraInOutTask ,
267  muonSeededTracksOutInClassifier
268 )
269 
270 muonSeededStepExtra = cms.Sequence(muonSeededStepExtraTask)
271 trackingPhase2PU140.toReplaceWith(muonSeededStepExtraTask, cms.Task(
272  muonSeededStepExtraInOutTask ,
273  muonSeededTracksOutInSelector
274 ))
275 
276 muonSeededStepTask = cms.Task(
277  earlyMuons,
278  muonSeededStepCoreTask,
279  muonSeededStepExtraTask
280 )
281 muonSeededStep = cms.Sequence(muonSeededStepTask)
282 
283 
284 ##### MODULES FOR DEBUGGING ###############3
285 muonSeededSeedsInOutAsTracks = cms.EDProducer('FakeTrackProducerFromSeed', src = cms.InputTag('muonSeededSeedsInOut'))
286 muonSeededSeedsOutInAsTracks = cms.EDProducer('FakeTrackProducerFromSeed', src = cms.InputTag('muonSeededSeedsOutIn'))
287 muonSeededTrackCandidatesInOutAsTracks = cms.EDProducer('FakeTrackProducerFromCandidate', src = cms.InputTag('muonSeededTrackCandidatesInOut'))
288 muonSeededTrackCandidatesOutInAsTracks = cms.EDProducer('FakeTrackProducerFromCandidate', src = cms.InputTag('muonSeededTrackCandidatesOutIn'))
289 muonSeededStepDebugInOutTask = cms.Task(
290  muonSeededSeedsInOutAsTracks , muonSeededTrackCandidatesInOutAsTracks
291 )
292 muonSeededStepDebugInOut = cms.Sequence(muonSeededStepDebugInOutTask)
293 muonSeededStepDebugTask = cms.Task(
294  muonSeededSeedsOutInAsTracks , muonSeededTrackCandidatesOutInAsTracks ,
295  muonSeededStepDebugInOutTask
296 )
297 muonSeededStepDebug = cms.Sequence(muonSeededStepDebugTask)