CMS 3D CMS Logo

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 = cms.string('muonSeededTrajectoryCleanerBySharedHits'),
25  fractionShared = cms.double(0.1),
26  ValidHitBonus = cms.double(1000.0),
27  MissingHitPenalty = cms.double(1.0),
28  ComponentType = cms.string('TrajectoryCleanerBySharedHits'),
29  allowSharedFirstHit = cms.bool(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 = cms.string('muonSeededMeasurementEstimatorForInOut'),
37  MaxChi2 = cms.double(80.0), ## was 30 ## TO BE TUNED
38  nSigma = cms.double(4.), ## was 3 ## TO BE TUNED
39 )
40 muonSeededMeasurementEstimatorForInOut = _muonSeededMeasurementEstimatorForInOutBase.clone(
41  MaxSagitta = cms.double(-1.)
42 )
43 from Configuration.Eras.Modifier_trackingPhase1PU70_cff import trackingPhase1PU70
44 trackingPhase1PU70.toReplaceWith(muonSeededMeasurementEstimatorForInOut, _muonSeededMeasurementEstimatorForInOutBase.clone(
45  MaxChi2 = 400
46 ))
47 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140
48 trackingPhase2PU140.toModify(muonSeededMeasurementEstimatorForInOut, MaxChi2 = 400.0, MaxSagitta = 2)
49 
50 _muonSeededMeasurementEstimatorForOutInBase = _Chi2MeasurementEstimator.clone(
51  ComponentName = cms.string('muonSeededMeasurementEstimatorForOutIn'),
52  MaxChi2 = cms.double(30.0), ## was 30 ## TO BE TUNED
53  nSigma = cms.double(3.), ## was 3 ## TO BE TUNED
54 )
55 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 as _tracker_apv_vfp30_2016
56 _tracker_apv_vfp30_2016.toModify(_muonSeededMeasurementEstimatorForOutInBase, MinPtForHitRecoveryInGluedDet=1e9)
57 muonSeededMeasurementEstimatorForOutIn = _muonSeededMeasurementEstimatorForOutInBase.clone(
58  MaxSagitta = cms.double(-1.)
59 )
60 trackingPhase1PU70.toReplaceWith(muonSeededMeasurementEstimatorForOutIn, _muonSeededMeasurementEstimatorForOutInBase)
61 
62 ###------------- TrajectoryFilter, defining selections on the trajectories while building them ----------------
64 muonSeededTrajectoryFilterForInOut = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone()
65 muonSeededTrajectoryFilterForInOut.constantValueForLostHitsFractionFilter = 10 ## allow more lost hits
66 muonSeededTrajectoryFilterForInOut.minimumNumberOfHits = 3 ## allow more lost hits
67 
68 muonSeededTrajectoryFilterForOutIn = muonSeededTrajectoryFilterForInOut.clone()
69 muonSeededTrajectoryFilterForOutIn.constantValueForLostHitsFractionFilter = 10 ## allow more lost hits
70 muonSeededTrajectoryFilterForOutIn.minimumNumberOfHits = 5 ## allow more lost hits
71 
72 ###------------- TrajectoryBuilders ----------------
74 muonSeededTrajectoryBuilderForInOut = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
75  foundHitBonus = cms.double(1000.0),
76  lostHitPenalty = cms.double(1.0),
77  maxCand = cms.int32(5),
78  estimator = cms.string('muonSeededMeasurementEstimatorForInOut'),
79  trajectoryFilter = cms.PSet(refToPSet_ = cms.string('muonSeededTrajectoryFilterForInOut')),
80  inOutTrajectoryFilter = cms.PSet(refToPSet_ = cms.string('muonSeededTrajectoryFilterForInOut')), # not sure if it is used
81  minNrOfHitsForRebuild = cms.int32(2),
82  requireSeedHitsInRebuild = cms.bool(True),
83  keepOriginalIfRebuildFails = cms.bool(True),
84 )
85 muonSeededTrajectoryBuilderForOutIn = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
86  foundHitBonus = cms.double(1000.0),
87  lostHitPenalty = cms.double(1.0),
88  maxCand = cms.int32(3),
89  estimator = cms.string('muonSeededMeasurementEstimatorForOutIn'),
90  trajectoryFilter = cms.PSet(refToPSet_ = cms.string('muonSeededTrajectoryFilterForOutIn')),
91  inOutTrajectoryFilter = cms.PSet(refToPSet_ = cms.string('muonSeededTrajectoryFilterForOutIn')), # not sure if it is used
92  minNrOfHitsForRebuild = cms.int32(5),
93  requireSeedHitsInRebuild = cms.bool(True),
94  keepOriginalIfRebuildFails = cms.bool(False),
95 )
96 
97 ###------------- Fitter-Smoother -------------------
99 muonSeededFittingSmootherWithOutliersRejectionAndRK = TrackingTools.TrackFitters.RungeKuttaFitters_cff.KFFittingSmootherWithOutliersRejectionAndRK.clone(
100  ComponentName = cms.string("muonSeededFittingSmootherWithOutliersRejectionAndRK"),
101  BreakTrajWith2ConsecutiveMissing = cms.bool(False),
102  EstimateCut = cms.double(50.), ## was 20.
103 )
104 
105 ######## TRACK CANDIDATE MAKERS
107 muonSeededTrackCandidatesInOut = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
108  src = cms.InputTag("muonSeededSeedsInOut"),
109  TrajectoryBuilderPSet = cms.PSet(refToPSet_ = cms.string("muonSeededTrajectoryBuilderForInOut")),
110  TrajectoryCleaner = cms.string('muonSeededTrajectoryCleanerBySharedHits'),
111  RedundantSeedCleaner = cms.string("none"),
112 )
113 muonSeededTrackCandidatesOutIn = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
114  src = cms.InputTag("muonSeededSeedsOutIn"),
115  TrajectoryBuilderPSet = cms.PSet(refToPSet_ = cms.string("muonSeededTrajectoryBuilderForOutIn")),
116  TrajectoryCleaner = cms.string('muonSeededTrajectoryCleanerBySharedHits'),
117  numHitsForSeedCleaner = cms.int32(50),
118  onlyPixelHitsForSeedCleaner = cms.bool(False),
119 )
120 
121 ######## TRACK PRODUCERS
123 muonSeededTracksOutIn = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
124  src = cms.InputTag("muonSeededTrackCandidatesOutIn"),
125  AlgorithmName = cms.string('muonSeededStepOutIn'),
126  Fitter = cms.string("muonSeededFittingSmootherWithOutliersRejectionAndRK"),
127 )
128 muonSeededTracksInOut = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
129  src = cms.InputTag("muonSeededTrackCandidatesInOut"),
130  AlgorithmName = cms.string('muonSeededStepInOut'),
131  Fitter = cms.string("muonSeededFittingSmootherWithOutliersRejectionAndRK"),
132 )
133 
134 
135 # Final Classifier
137 muonSeededTracksInOutClassifier = TrackCutClassifier.clone()
138 muonSeededTracksInOutClassifier.src='muonSeededTracksInOut'
139 muonSeededTracksInOutClassifier.mva.minPixelHits = [0,0,0]
140 muonSeededTracksInOutClassifier.mva.maxChi2 = [9999.,9999.,9999.]
141 muonSeededTracksInOutClassifier.mva.maxChi2n = [10.0,1.0,0.4]
142 muonSeededTracksInOutClassifier.mva.minLayers = [3,5,5]
143 muonSeededTracksInOutClassifier.mva.min3DLayers = [1,2,2]
144 muonSeededTracksInOutClassifier.mva.maxLostLayers = [4,3,2]
145 
146 
147 muonSeededTracksOutInClassifier = TrackCutClassifier.clone()
148 muonSeededTracksOutInClassifier.src='muonSeededTracksOutIn'
149 muonSeededTracksOutInClassifier.mva.minPixelHits = [0,0,0]
150 muonSeededTracksOutInClassifier.mva.maxChi2 = [9999.,9999.,9999.]
151 muonSeededTracksOutInClassifier.mva.maxChi2n = [10.0,1.0,0.4]
152 muonSeededTracksOutInClassifier.mva.minLayers = [3,5,5]
153 muonSeededTracksOutInClassifier.mva.min3DLayers = [1,2,2]
154 muonSeededTracksOutInClassifier.mva.maxLostLayers = [4,3,2]
155 
156 
157 # For Phase1PU70
158 import RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi
159 muonSeededTracksInOutSelector = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
160  src='muonSeededTracksInOut',
161  trackSelectors= cms.VPSet(
162  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
163  name = 'muonSeededTracksInOutLoose',
164  applyAdaptedPVCuts = cms.bool(False),
165  chi2n_par = 10.0,
166  minNumberLayers = 3,
167  min_nhits = 5,
168  maxNumberLostLayers = 4,
169  minNumber3DLayers = 0,
170  minHitsToBypassChecks = 7
171  ),
172  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
173  name = 'muonSeededTracksInOutTight',
174  preFilterName = 'muonSeededTracksInOutLoose',
175  applyAdaptedPVCuts = cms.bool(False),
176  chi2n_par = 1.0,
177  minNumberLayers = 5,
178  min_nhits = 6,
179  maxNumberLostLayers = 3,
180  minNumber3DLayers = 2,
181  minHitsToBypassChecks = 10
182  ),
183  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
184  name = 'muonSeededTracksInOutHighPurity',
185  preFilterName = 'muonSeededTracksInOutTight',
186  applyAdaptedPVCuts = cms.bool(False),
187  chi2n_par = 0.4,
188  minNumberLayers = 5,
189  min_nhits = 7,
190  maxNumberLostLayers = 2,
191  minNumber3DLayers = 2,
192  minHitsToBypassChecks = 20
193  ),
194  ) #end of vpset
195  ) #end of clone
196 muonSeededTracksOutInSelector = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
197  src='muonSeededTracksOutIn',
198  trackSelectors= cms.VPSet(
199  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
200  name = 'muonSeededTracksOutInLoose',
201  applyAdaptedPVCuts = cms.bool(False),
202  chi2n_par = 10.0,
203  minNumberLayers = 3,
204  min_nhits = 5,
205  maxNumberLostLayers = 4,
206  minNumber3DLayers = 0,
207  minHitsToBypassChecks = 7
208  ),
209  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
210  name = 'muonSeededTracksOutInTight',
211  preFilterName = 'muonSeededTracksOutInLoose',
212  applyAdaptedPVCuts = cms.bool(False),
213  chi2n_par = 1.0,
214  minNumberLayers = 5,
215  min_nhits = 6,
216  maxNumberLostLayers = 3,
217  minNumber3DLayers = 2,
218  minHitsToBypassChecks = 10
219  ),
220  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
221  name = 'muonSeededTracksOutInHighPurity',
222  preFilterName = 'muonSeededTracksOutInTight',
223  applyAdaptedPVCuts = cms.bool(False),
224  chi2n_par = 0.4,
225  minNumberLayers = 5,
226  min_nhits = 7,
227  maxNumberLostLayers = 2,
228  minNumber3DLayers = 2,
229  minHitsToBypassChecks = 20
230  ),
231  ) #end of vpset
232  ) #end of clone
233 
234 
235 
236 muonSeededStepCoreInOut = cms.Sequence(
237  muonSeededSeedsInOut + muonSeededTrackCandidatesInOut + muonSeededTracksInOut
238 )
239 muonSeededStepCoreOutIn = cms.Sequence(
240  muonSeededSeedsOutIn + muonSeededTrackCandidatesOutIn + muonSeededTracksOutIn
241 )
242 muonSeededStepCore = cms.Sequence(
243  muonSeededStepCoreInOut +
244  muonSeededStepCoreOutIn
245 )
246 #Phase2 : just muon Seed InOut is used in this moment
247 #trackingPhase2PU140.toReplaceWith(muonSeededStepCore, muonSeededStepCoreInOut)
248 muonSeededStepExtraInOut = cms.Sequence(
249  muonSeededTracksInOutClassifier
250 )
251 trackingPhase1PU70.toReplaceWith(muonSeededStepExtraInOut, cms.Sequence(
252  muonSeededTracksInOutSelector
253 ))
254 trackingPhase2PU140.toReplaceWith(muonSeededStepExtraInOut, cms.Sequence(
255  muonSeededTracksInOutSelector
256 ))
257 muonSeededStepExtra = cms.Sequence(
258  muonSeededStepExtraInOut +
259  muonSeededTracksOutInClassifier
260 )
261 trackingPhase1PU70.toReplaceWith(muonSeededStepExtra, cms.Sequence(
262  muonSeededStepExtraInOut +
263  muonSeededTracksOutInSelector
264 ))
265 trackingPhase2PU140.toReplaceWith(muonSeededStepExtra, cms.Sequence(
266  muonSeededStepExtraInOut +
267  muonSeededTracksOutInSelector
268 ))
269 
270 muonSeededStep = cms.Sequence(
271  earlyMuons +
272  muonSeededStepCore +
273  muonSeededStepExtra
274 )
275 
276 
277 ##### MODULES FOR DEBUGGING ###############3
278 muonSeededSeedsInOutAsTracks = cms.EDProducer("FakeTrackProducerFromSeed", src = cms.InputTag("muonSeededSeedsInOut"))
279 muonSeededSeedsOutInAsTracks = cms.EDProducer("FakeTrackProducerFromSeed", src = cms.InputTag("muonSeededSeedsOutIn"))
280 muonSeededTrackCandidatesInOutAsTracks = cms.EDProducer("FakeTrackProducerFromCandidate", src = cms.InputTag("muonSeededTrackCandidatesInOut"))
281 muonSeededTrackCandidatesOutInAsTracks = cms.EDProducer("FakeTrackProducerFromCandidate", src = cms.InputTag("muonSeededTrackCandidatesOutIn"))
282 muonSeededStepDebugInOut = cms.Sequence(
283  muonSeededSeedsInOutAsTracks + muonSeededTrackCandidatesInOutAsTracks
284 )
285 muonSeededStepDebug = cms.Sequence(
286  muonSeededSeedsOutInAsTracks + muonSeededTrackCandidatesOutInAsTracks +
287  muonSeededStepDebugInOut
288 )