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