CMS 3D CMS Logo

DetachedTripletStep_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 as _tracker_apv_vfp30_2016
3 import RecoTracker.IterativeTracking.iterativeTkConfig as _cfg
4 
5 #for fastsim
6 from Configuration.Eras.Modifier_fastSim_cff import fastSim
7 from FastSimulation.Tracking.SeedingMigration import _hitSetProducerToFactoryPSet
8 
9 
10 ###############################################
11 # Low pT and detached tracks from pixel triplets
12 ###############################################
13 
14 # REMOVE HITS ASSIGNED TO GOOD TRACKS FROM PREVIOUS ITERATIONS
15 detachedTripletStepClusters = _cfg.clusterRemoverForIter("DetachedTripletStep")
16 for _eraName, _postfix, _era in _cfg.nonDefaultEras():
17  _era.toReplaceWith(detachedTripletStepClusters, _cfg.clusterRemoverForIter("DetachedTripletStep", _eraName, _postfix))
18 
19 # SEEDING LAYERS
21 detachedTripletStepSeedLayers = RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi.PixelLayerTriplets.clone()
22 detachedTripletStepSeedLayers.BPix.skipClusters = cms.InputTag('detachedTripletStepClusters')
23 detachedTripletStepSeedLayers.FPix.skipClusters = cms.InputTag('detachedTripletStepClusters')
24 _phase1LayerList = [
25  'BPix1+BPix2+BPix3',
26  'BPix2+BPix3+BPix4',
27 # 'BPix1+BPix3+BPix4', # has "hole", not tested
28 # 'BPix1+BPix2+BPix4', # has "hole", not tested
29  'BPix2+BPix3+FPix1_pos', 'BPix2+BPix3+FPix1_neg',
30 # 'BPix1+BPix2+FPix1_pos', 'BPix1+BPix2+FPix1_neg', # mostly fake tracks, lots of seeds
31 # 'BPix1+BPix3+FPix1_pos', 'BPix1+BPix3+FPix1_neg', # has "hole", not tested
32  'BPix2+FPix1_pos+FPix2_pos', 'BPix2+FPix1_neg+FPix2_neg',
33 # 'BPix1+FPix1_pos+FPix2_pos', 'BPix1+FPix1_neg+FPix2_neg', # mostly fake tracks, lots of seeds
34 # 'BPix1+BPix2+FPix2_pos', 'BPix1+BPix2+FPix2_neg', # has "hole", not tested
35  'FPix1_pos+FPix2_pos+FPix3_pos', 'FPix1_neg+FPix2_neg+FPix3_neg',
36 # 'BPix1+FPix2_pos+FPix3_pos', 'BPix1+FPix2_neg+FPix3_neg', # has "hole", not tested
37 # 'BPix1+FPix1_pos+FPix3_pos', 'BPix1+FPix1_neg+FPix3_neg' # has "hole", not tested
38  ]
39 from Configuration.Eras.Modifier_trackingPhase1_cff import trackingPhase1
40 trackingPhase1.toModify(detachedTripletStepSeedLayers, layerList=_phase1LayerList)
41 from Configuration.Eras.Modifier_trackingPhase1QuadProp_cff import trackingPhase1QuadProp
42 trackingPhase1QuadProp.toModify(detachedTripletStepSeedLayers, layerList=_phase1LayerList)
43 
44 # TrackingRegion
45 from RecoTracker.TkTrackingRegions.globalTrackingRegionFromBeamSpotFixedZ_cfi import globalTrackingRegionFromBeamSpotFixedZ as _globalTrackingRegionFromBeamSpotFixedZ
46 detachedTripletStepTrackingRegions = _globalTrackingRegionFromBeamSpotFixedZ.clone(RegionPSet = dict(
47  ptMin = 0.3,
48  originHalfLength = 15.0,
49  originRadius = 1.5
50 ))
51 trackingPhase1.toModify(detachedTripletStepTrackingRegions, RegionPSet = dict(ptMin = 0.25))
52 
53 from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
54 from RecoTracker.TkTrackingRegions.globalTrackingRegionWithVertices_cff import globalTrackingRegionWithVertices as _globalTrackingRegionWithVertices
55 pp_on_XeXe_2017.toReplaceWith(detachedTripletStepTrackingRegions,
56  _globalTrackingRegionWithVertices.clone(RegionPSet=dict(
57  fixedError = 3.0,
58  ptMin = 0.8,
59  originRadius = 1.5
60  )
61  )
62 )
63 
64 
65 # seeding
66 from RecoTracker.TkHitPairs.hitPairEDProducer_cfi import hitPairEDProducer as _hitPairEDProducer
67 detachedTripletStepHitDoublets = _hitPairEDProducer.clone(
68  seedingLayers = "detachedTripletStepSeedLayers",
69  trackingRegions = "detachedTripletStepTrackingRegions",
70  maxElement = 0,
71  produceIntermediateHitDoublets = True,
72 )
73 from RecoPixelVertexing.PixelTriplets.pixelTripletLargeTipEDProducer_cfi import pixelTripletLargeTipEDProducer as _pixelTripletLargeTipEDProducer
75 detachedTripletStepHitTriplets = _pixelTripletLargeTipEDProducer.clone(
76  doublets = "detachedTripletStepHitDoublets",
77  produceSeedingHitSets = True,
78 )
79 from RecoTracker.TkSeedGenerator.seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer_cff import seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer as _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer
80 detachedTripletStepSeeds = _seedCreatorFromRegionConsecutiveHitsTripletOnlyEDProducer.clone(
81  seedingHitSets = "detachedTripletStepHitTriplets",
82  SeedComparitorPSet = dict(# FIXME: is this defined in any cfi that could be imported instead of copy-paste?
83  ComponentName = 'PixelClusterShapeSeedComparitor',
84  FilterAtHelixStage = cms.bool(False),
85  FilterPixelHits = cms.bool(True),
86  FilterStripHits = cms.bool(False),
87  ClusterShapeHitFilterName = cms.string('ClusterShapeHitFilter'),
88  ClusterShapeCacheSrc = cms.InputTag('siPixelClusterShapeCache')
89  ),
90 )
91 
92 from RecoPixelVertexing.PixelTriplets.caHitTripletEDProducer_cfi import caHitTripletEDProducer as _caHitTripletEDProducer
93 trackingPhase1.toModify(detachedTripletStepHitDoublets, layerPairs = [0,1]) # layer pairs (0,1), (1,2)
94 trackingPhase1.toReplaceWith(detachedTripletStepHitTriplets, _caHitTripletEDProducer.clone(
95  doublets = "detachedTripletStepHitDoublets",
96  extraHitRPhitolerance = detachedTripletStepHitTriplets.extraHitRPhitolerance,
97  maxChi2 = dict(
98  pt1 = 0.8, pt2 = 2,
99  value1 = 300 , value2 = 10,
100  ),
101  useBendingCorrection = True,
102  CAThetaCut = 0.001,
103  CAPhiCut = 0,
104  CAHardPtCut = 0.2,
105 ))
106 
107 import FastSimulation.Tracking.TrajectorySeedProducer_cfi
108 _fastSim_detachedTripletStepSeeds = FastSimulation.Tracking.TrajectorySeedProducer_cfi.trajectorySeedProducer.clone(
109  trackingRegions = "detachedTripletStepTrackingRegions",
110  hitMasks = cms.InputTag("detachedTripletStepMasks"),
111  seedFinderSelector = dict( pixelTripletGeneratorFactory = _hitSetProducerToFactoryPSet(detachedTripletStepHitTriplets),
112  layerList = detachedTripletStepSeedLayers.layerList.value())
113 )
114 #new for phase1
115 trackingPhase1.toModify(_fastSim_detachedTripletStepSeeds, seedFinderSelector = dict(
116  pixelTripletGeneratorFactory = None,
117  CAHitTripletGeneratorFactory = _hitSetProducerToFactoryPSet(detachedTripletStepHitTriplets),
118  #new parameters required for phase1 seeding
119  BPix = dict(
120  TTRHBuilder = 'WithoutRefit',
121  HitProducer = 'TrackingRecHitProducer',
122  ),
123  FPix = dict(
124  TTRHBuilder = 'WithoutRefit',
125  HitProducer = 'TrackingRecHitProducer',
126  ),
127  layerPairs = detachedTripletStepHitDoublets.layerPairs.value()
128  )
129 )
130 fastSim.toReplaceWith(detachedTripletStepSeeds,_fastSim_detachedTripletStepSeeds)
131 
132 # QUALITY CUTS DURING TRACK BUILDING
134 _detachedTripletStepTrajectoryFilterBase = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone(
135 # maxLostHitsFraction = cms.double(1./10.),
136 # constantValueForLostHitsFractionFilter = cms.double(0.701),
137  minimumNumberOfHits = 3,
138  minPt = 0.075,
139 )
140 detachedTripletStepTrajectoryFilterBase = _detachedTripletStepTrajectoryFilterBase.clone(
141  maxCCCLostHits = 0,
142  minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutLoose'))
143 )
144 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016
145 _tracker_apv_vfp30_2016.toModify(detachedTripletStepTrajectoryFilterBase, maxCCCLostHits = 2)
146 from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU
147 trackingLowPU.toReplaceWith(detachedTripletStepTrajectoryFilterBase, _detachedTripletStepTrajectoryFilterBase.clone(
148  maxLostHitsFraction = 1./10.,
149  constantValueForLostHitsFractionFilter = 0.701,
150 ))
151 
152 pp_on_XeXe_2017.toModify(detachedTripletStepTrajectoryFilterBase, minPt=0.9)
153 
154 import RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeTrajectoryFilter_cfi
155 detachedTripletStepTrajectoryFilterShape = RecoPixelVertexing.PixelLowPtUtilities.StripSubClusterShapeTrajectoryFilter_cfi.StripSubClusterShapeTrajectoryFilterTIX12.clone()
156 detachedTripletStepTrajectoryFilter = cms.PSet(
157  ComponentType = cms.string('CompositeTrajectoryFilter'),
158  filters = cms.VPSet(
159  cms.PSet( refToPSet_ = cms.string('detachedTripletStepTrajectoryFilterBase')),
160 # cms.PSet( refToPSet_ = cms.string('detachedTripletStepTrajectoryFilterShape'))
161  ),
162 )
163 
164 
165 import RecoTracker.MeasurementDet.Chi2ChargeMeasurementEstimator_cfi
166 detachedTripletStepChi2Est = RecoTracker.MeasurementDet.Chi2ChargeMeasurementEstimator_cfi.Chi2ChargeMeasurementEstimator.clone(
167  ComponentName = cms.string('detachedTripletStepChi2Est'),
168  nSigma = cms.double(3.0),
169  MaxChi2 = cms.double(9.0),
170  clusterChargeCut = cms.PSet(refToPSet_ = cms.string('SiStripClusterChargeCutTight')),
171 )
172 _tracker_apv_vfp30_2016.toModify(detachedTripletStepChi2Est,
173  clusterChargeCut = dict(refToPSet_ = "SiStripClusterChargeCutTiny")
174 )
175 
176 # TRACK BUILDING
178 detachedTripletStepTrajectoryBuilder = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
179  MeasurementTrackerName = '',
180  trajectoryFilter = cms.PSet(refToPSet_ = cms.string('detachedTripletStepTrajectoryFilter')),
181  maxCand = 3,
182  alwaysUseInvalidHits = True,
183  estimator = cms.string('detachedTripletStepChi2Est'),
184  maxDPhiForLooperReconstruction = cms.double(2.0),
185  maxPtForLooperReconstruction = cms.double(0.7)
186  )
187 trackingLowPU.toModify(detachedTripletStepTrajectoryBuilder,
188  maxCand = 2,
189  alwaysUseInvalidHits = False,
190 )
191 
192 # MAKING OF TRACK CANDIDATES
194 detachedTripletStepTrackCandidates = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
195  src = cms.InputTag('detachedTripletStepSeeds'),
196  clustersToSkip = cms.InputTag('detachedTripletStepClusters'),
197  ### these two parameters are relevant only for the CachingSeedCleanerBySharedInput
198  numHitsForSeedCleaner = cms.int32(50),
199  onlyPixelHitsForSeedCleaner = cms.bool(True),
200  TrajectoryBuilderPSet = cms.PSet(refToPSet_ = cms.string('detachedTripletStepTrajectoryBuilder')),
201  doSeedingRegionRebuilding = True,
202  useHitsSplitting = True
203  )
204 
205 from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import trajectoryCleanerBySharedHits
206 detachedTripletStepTrajectoryCleanerBySharedHits = trajectoryCleanerBySharedHits.clone(
207  ComponentName = cms.string('detachedTripletStepTrajectoryCleanerBySharedHits'),
208  fractionShared = cms.double(0.13),
209  allowSharedFirstHit = cms.bool(True)
210  )
211 detachedTripletStepTrackCandidates.TrajectoryCleaner = 'detachedTripletStepTrajectoryCleanerBySharedHits'
212 trackingLowPU.toModify(detachedTripletStepTrajectoryCleanerBySharedHits, fractionShared = 0.19)
213 
214 import FastSimulation.Tracking.TrackCandidateProducer_cfi
215 _fastSim_detachedTripletStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
216  src = cms.InputTag("detachedTripletStepSeeds"),
217  MinNumberOfCrossedLayers = 3,
218  hitMasks = cms.InputTag("detachedTripletStepMasks")
219  )
220 fastSim.toReplaceWith(detachedTripletStepTrackCandidates,_fastSim_detachedTripletStepTrackCandidates)
221 
222 
223 # TRACK FITTING
225 detachedTripletStepTracks = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
226  AlgorithmName = cms.string('detachedTripletStep'),
227  src = 'detachedTripletStepTrackCandidates',
228  Fitter = cms.string('FlexibleKFFittingSmoother')
229  )
230 fastSim.toModify(detachedTripletStepTracks,TTRHBuilder = 'WithoutRefit')
231 
232 # TRACK SELECTION AND QUALITY FLAG SETTING.
233 
234 
237 detachedTripletStepClassifier1 = TrackMVAClassifierDetached.clone()
238 detachedTripletStepClassifier1.src = 'detachedTripletStepTracks'
239 detachedTripletStepClassifier1.mva.GBRForestLabel = 'MVASelectorIter3_13TeV'
240 detachedTripletStepClassifier1.qualityCuts = [-0.5,0.0,0.5]
241 fastSim.toModify(detachedTripletStepClassifier1,vertices = "firstStepPrimaryVerticesBeforeMixing")
242 
243 detachedTripletStepClassifier2 = TrackMVAClassifierPrompt.clone()
244 detachedTripletStepClassifier2.src = 'detachedTripletStepTracks'
245 detachedTripletStepClassifier2.mva.GBRForestLabel = 'MVASelectorIter0_13TeV'
246 detachedTripletStepClassifier2.qualityCuts = [-0.2,0.0,0.4]
247 fastSim.toModify(detachedTripletStepClassifier2,vertices = "firstStepPrimaryVerticesBeforeMixing")
248 
250 detachedTripletStep = ClassifierMerger.clone()
251 detachedTripletStep.inputClassifiers=['detachedTripletStepClassifier1','detachedTripletStepClassifier2']
252 
253 trackingPhase1.toReplaceWith(detachedTripletStep, detachedTripletStepClassifier1.clone(
254  mva = dict(GBRForestLabel = 'MVASelectorDetachedTripletStep_Phase1'),
255  qualityCuts = [-0.2,0.3,0.8],
256 ))
257 trackingPhase1QuadProp.toReplaceWith(detachedTripletStep, detachedTripletStepClassifier1.clone(
258  mva = dict(GBRForestLabel = 'MVASelectorDetachedTripletStep_Phase1'),
259  qualityCuts = [-0.2,0.3,0.8],
260 ))
261 
262 # For LowPU
263 import RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi
264 detachedTripletStepSelector = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
265  src = 'detachedTripletStepTracks',
266  useAnyMVA = cms.bool(False),
267  GBRForestLabel = cms.string('MVASelectorIter3'),
268  trackSelectors = [
269  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
270  name = 'detachedTripletStepVtxLoose',
271  chi2n_par = 1.6,
272  res_par = ( 0.003, 0.001 ),
273  minNumberLayers = 3,
274  d0_par1 = ( 1.2, 3.0 ),
275  dz_par1 = ( 1.2, 3.0 ),
276  d0_par2 = ( 1.3, 3.0 ),
277  dz_par2 = ( 1.3, 3.0 )
278  ),
279  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
280  name = 'detachedTripletStepTrkLoose',
281  chi2n_par = 0.7,
282  res_par = ( 0.003, 0.001 ),
283  minNumberLayers = 3,
284  d0_par1 = ( 1.6, 4.0 ),
285  dz_par1 = ( 1.6, 4.0 ),
286  d0_par2 = ( 1.6, 4.0 ),
287  dz_par2 = ( 1.6, 4.0 )
288  ),
289  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
290  name = 'detachedTripletStepVtxTight',
291  preFilterName = 'detachedTripletStepVtxLoose',
292  chi2n_par = 0.7,
293  res_par = ( 0.003, 0.001 ),
294  minNumberLayers = 3,
295  maxNumberLostLayers = 1,
296  minNumber3DLayers = 3,
297  d0_par1 = ( 0.95, 3.0 ),
298  dz_par1 = ( 0.9, 3.0 ),
299  d0_par2 = ( 1.0, 3.0 ),
300  dz_par2 = ( 1.0, 3.0 )
301  ),
302  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
303  name = 'detachedTripletStepTrkTight',
304  preFilterName = 'detachedTripletStepTrkLoose',
305  chi2n_par = 0.5,
306  res_par = ( 0.003, 0.001 ),
307  minNumberLayers = 5,
308  maxNumberLostLayers = 1,
309  minNumber3DLayers = 3,
310  d0_par1 = ( 1.1, 4.0 ),
311  dz_par1 = ( 1.1, 4.0 ),
312  d0_par2 = ( 1.1, 4.0 ),
313  dz_par2 = ( 1.1, 4.0 )
314  ),
315  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
316  name = 'detachedTripletStepVtx',
317  preFilterName = 'detachedTripletStepVtxTight',
318  chi2n_par = 0.7,
319  res_par = ( 0.003, 0.001 ),
320  minNumberLayers = 3,
321  maxNumberLostLayers = 1,
322  minNumber3DLayers = 3,
323  d0_par1 = ( 0.85, 3.0 ),
324  dz_par1 = ( 0.8, 3.0 ),
325  d0_par2 = ( 0.9, 3.0 ),
326  dz_par2 = ( 0.9, 3.0 )
327  ),
328  RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
329  name = 'detachedTripletStepTrk',
330  preFilterName = 'detachedTripletStepTrkTight',
331  chi2n_par = 0.4,
332  res_par = ( 0.003, 0.001 ),
333  minNumberLayers = 5,
334  maxNumberLostLayers = 1,
335  minNumber3DLayers = 4,
336  d0_par1 = ( 1.0, 4.0 ),
337  dz_par1 = ( 1.0, 4.0 ),
338  d0_par2 = ( 1.0, 4.0 ),
339  dz_par2 = ( 1.0, 4.0 )
340  )
341  ] #end of vpset
342 ) #end of clone
343 
344 from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder
346 trackingLowPU.toReplaceWith(detachedTripletStep, RecoTracker.FinalTrackSelectors.trackListMerger_cfi.trackListMerger.clone(
347  TrackProducers = [
348  'detachedTripletStepTracks',
349  'detachedTripletStepTracks',
350  ],
351  hasSelector = [1,1],
352  selectedTrackQuals = [
353  cms.InputTag("detachedTripletStepSelector","detachedTripletStepVtx"),
354  cms.InputTag("detachedTripletStepSelector","detachedTripletStepTrk")
355  ],
356  setsToMerge = [cms.PSet( tLists=cms.vint32(0,1), pQual=cms.bool(True) )],
357  writeOnlyTrkQuals =True
358 ))
359 
360 DetachedTripletStep = cms.Sequence(detachedTripletStepClusters*
361  detachedTripletStepSeedLayers*
362  detachedTripletStepTrackingRegions*
363  detachedTripletStepHitDoublets*
364  detachedTripletStepHitTriplets*
365  detachedTripletStepSeeds*
366  detachedTripletStepTrackCandidates*
367  detachedTripletStepTracks*
368  detachedTripletStepClassifier1*detachedTripletStepClassifier2*
369  detachedTripletStep)
370 _DetachedTripletStep_LowPU = DetachedTripletStep.copyAndExclude([detachedTripletStepClassifier2])
371 _DetachedTripletStep_LowPU.replace(detachedTripletStepClassifier1, detachedTripletStepSelector)
372 trackingLowPU.toReplaceWith(DetachedTripletStep, _DetachedTripletStep_LowPU)
373 
374 # fast tracking mask producer
375 from FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi import maskProducerFromClusterRemover
376 detachedTripletStepMasks = maskProducerFromClusterRemover(detachedTripletStepClusters)
377 fastSim.toReplaceWith(DetachedTripletStep,
378  cms.Sequence(detachedTripletStepMasks
379  +detachedTripletStepTrackingRegions
380  +detachedTripletStepSeeds
381  +detachedTripletStepTrackCandidates
382  +detachedTripletStepTracks
383  +detachedTripletStepClassifier1*detachedTripletStepClassifier2
384  +detachedTripletStep
385  ) )
COSMIC RUN SETTING.
def _hitSetProducerToFactoryPSet(producer)