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