CMS 3D CMS Logo

TrackValidation_cff.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 import FWCore.ParameterSet.Config as cms
3 
8 from Validation.RecoTrack.trajectorySeedTracks_cfi import trajectorySeedTracks as _trajectorySeedTracks
12 import Validation.RecoTrack.cutsRecoTracks_cfi as cutsRecoTracks_cfi
13 #from . import cutsRecoTracks_cfi
14 
17 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector
18 from CommonTools.RecoAlgos.trackingParticleConversionRefSelector_cfi import trackingParticleConversionRefSelector as _trackingParticleConversionRefSelector
19 from SimTracker.TrackHistory.trackingParticleBHadronRefSelector_cfi import trackingParticleBHadronRefSelector as _trackingParticleBHadronRefSelector
21 from CommonTools.RecoAlgos.recoChargedRefCandidateToTrackRefProducer_cfi import recoChargedRefCandidateToTrackRefProducer as _recoChargedRefCandidateToTrackRefProducer
22 
23 import RecoTracker.IterativeTracking.iterativeTkConfig as _cfg
24 import RecoTracker.IterativeTracking.iterativeTkUtils as _utils
25 from Configuration.Eras.Modifier_fastSim_cff import fastSim
26 import six
27 
28 
30 for _eraName, _postfix, _era in _cfg.allEras():
31  _seedProd = ["initialStepSeedsPreSplitting"]
32  _trackProd = ["initialStepTracksPreSplitting"]
33  if _eraName in ["trackingLowPU", "trackingPhase2PU140"]: # these don't have preSplitting
34  _seedProd = []
35  _trackProd = []
36 
37  locals()["_algos"+_postfix] = ["generalTracks"] + _cfg.iterationAlgos(_postfix) + ["duplicateMerge"]
38  locals()["_seedProducersPreSplitting"+_postfix] = _seedProd
39  locals()["_trackProducersPreSplitting"+_postfix] = _trackProd
40  locals()["_seedProducers"+_postfix] = _cfg.seedProducers(_postfix)
41  locals()["_trackProducers"+_postfix] = _cfg.trackProducers(_postfix)
42 
43  if _eraName != "trackingPhase2PU140":
44  locals()["_electronSeedProducers"+_postfix] = ["tripletElectronSeeds", "pixelPairElectronSeeds", "stripPairElectronSeeds"]
45  else:
46  locals()["_electronSeedProducers"+_postfix] = ["tripletElectronSeeds"]
47 
48 _removeForFastSimSeedProducers =["initialStepSeedsPreSplitting",
49  "jetCoreRegionalStepSeeds",
50  "muonSeededSeedsInOut",
51  "muonSeededSeedsOutIn"]
52 _seedProducers_fastSim = [ x for x in _seedProducers if x not in _removeForFastSimSeedProducers]
53 
54 _removeForFastTrackProducers = ["initialStepTracksPreSplitting",
55  "jetCoreRegionalStepTracks",
56  "muonSeededTracksInOut",
57  "muonSeededTracksOutIn"]
58 _trackProducers_fastSim = [ x for x in _trackProducers if x not in _removeForFastTrackProducers]
59 
60 def _algoToSelector(algo):
61  sel = ""
62  if algo != "generalTracks":
63  sel = algo[0].upper()+algo[1:]
64  return "cutsRecoTracks"+sel
65 
66 def _addSelectorsByAlgo(algos, modDict):
67  names = []
68  task = cms.Task()
69  for algo in algos:
70  if algo == "generalTracks":
71  continue
72  modName = _algoToSelector(algo)
73  if modName not in modDict:
74  mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(
75 # src = [src],
76  algorithm=[algo]
77  )
78  modDict[modName] = mod
79  else:
80  mod = modDict[modName]
81  names.append(modName)
82  task.add(mod)
83  return (names, task)
84 def _addSelectorsByHp(algos, modDict):
85  task = cms.Task()
86  names = []
87  for algo in algos:
88  modName = _algoToSelector(algo)
89  modNameHp = modName+"Hp"
90  if modNameHp not in modDict:
91  if algo == "generalTracks":
92  mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(quality=["highPurity"])
93  else:
94  mod = modDict[modName].clone(quality=["highPurity"])
95  modDict[modNameHp] = mod
96  else:
97  mod = modDict[modNameHp]
98  names.append(modNameHp)
99  task.add(mod)
100  return (names, task)
101 def _addSelectorsBySrc(modules, midfix, src, modDict):
102  task = cms.Task()
103  names = []
104  for modName in modules:
105  modNameNew = modName.replace("cutsRecoTracks", "cutsRecoTracks"+midfix)
106  if modNameNew not in modDict:
107  mod = modDict[modName].clone(src=src)
108  modDict[modNameNew] = mod
109  else:
110  mod = modDict[modNameNew]
111  names.append(modNameNew)
112  task.add(mod)
113  return (names, task)
114 def _addSelectorsByOriginalAlgoMask(modules, midfix, algoParam,modDict):
115  task = cms.Task()
116  names = []
117  for modName in modules:
118  if modName[-2:] == "Hp":
119  modNameNew = modName[:-2] + midfix + "Hp"
120  else:
121  modNameNew = modName + midfix
122  if modNameNew not in modDict:
123  mod = modDict[modName].clone()
124  setattr(mod, algoParam, mod.algorithm.value())
125  mod.algorithm = []
126  modDict[modNameNew] = mod
127  else:
128  mod = modDict[modNameNew]
129  names.append(modNameNew)
130  task.add(mod)
131  return (names, task)
132 def _addSeedToTrackProducers(seedProducers,modDict):
133  names = []
134  task = cms.Task()
135  for seed in seedProducers:
136  modName = "seedTracks"+seed
137  if modName not in modDict:
138  mod = _trajectorySeedTracks.clone(src=seed)
139  modDict[modName] = mod
140  else:
141  mod = modDict[modName]
142  names.append(modName)
143  task.add(mod)
144  return (names, task)
145 
146 _relevantEras = _cfg.allEras()
147 _relevantErasAndFastSim = _relevantEras + [("fastSim", "_fastSim", fastSim)]
148 def _translateArgs(args, postfix, modDict):
149  ret = []
150  for arg in args:
151  if isinstance(arg, list):
152  ret.append(_translateArgs(arg, postfix, modDict))
153  else:
154  ret.append(modDict[arg+postfix])
155  return ret
156 def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False):
157  if task[0] != "_":
158  raise Exception("Task name is expected to begin with _")
159 
160  _eras = _relevantErasAndFastSim if includeFastSim else _relevantEras
161  for eraName, postfix, _era in _eras:
162  _args = _translateArgs(args, postfix, modDict)
163  _args.extend(plainArgs)
164  ret = function(*_args, modDict=modDict)
165  if len(ret) != 2:
166  raise Exception("_taskForEachEra is expected to return 2 values, but function returned %d" % len(ret))
167  modDict[names+postfix] = ret[0]
168  modDict[task+postfix] = ret[1]
169 
170  # The task of the first era will be the default one
171  defaultTaskName = task+_eras[0][0]
172  defaultTask = modDict[defaultTaskName]
173  modDict[defaultTaskName[1:]] = defaultTask # remove leading underscore
174 
175  # Optionally modify task before applying the era
176  if modifyTask is not None:
177  for eraName, postfix, _era in _eras:
178  modifyTask(modDict[task+postfix])
179 
180  # Apply eras
181  for _eraName, _postfix, _era in _eras[1:]:
182  _era.toReplaceWith(defaultTask, modDict[task+_postfix])
183 def _setForEra(module, eraName, era, **kwargs):
184  if eraName == "":
185  for key, value in six.iteritems(kwargs):
186  setattr(module, key, value)
187  else:
188  era.toModify(module, **kwargs)
189 
190 # Seeding layer sets
191 def _getSeedingLayers(seedProducers, config):
192  def _findSeedingLayers(name):
193  prod = getattr(config, name)
194  if hasattr(prod, "triplets"):
195  if hasattr(prod, "layerList"): # merger
196  return prod.layerList.refToPSet_.value()
197  return _findSeedingLayers(prod.triplets.getModuleLabel())
198  elif hasattr(prod, "doublets"):
199  return _findSeedingLayers(prod.doublets.getModuleLabel())
200  label = prod.trackingRegionsSeedingLayers.getModuleLabel()
201  if label != "":
202  return label
203  return prod.seedingLayers.getModuleLabel()
204 
205  seedingLayersMerged = []
206  for seedName in seedProducers:
207  seedProd = getattr(config, seedName)
208  seedingLayersName = None
209  seedingLayers = None
210  if hasattr(seedProd, "OrderedHitsFactoryPSet"): # old seeding framework
211  seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel()
212  elif hasattr(seedProd, "seedingHitSets"): # new seeding framework
213  seedingLayersName = _findSeedingLayers(seedProd.seedingHitSets.getModuleLabel())
214  elif hasattr(seedProd, "layerList"): # FastSim:
215  seedingLayers = seedProd.layerList.value()
216  else:
217  continue
218 
219  if seedingLayersName is not None:
220  seedingLayers = getattr(config, seedingLayersName).layerList.value()
221  for layerSet in seedingLayers:
222  if layerSet not in seedingLayersMerged:
223  seedingLayersMerged.append(layerSet)
224 
225  return seedingLayersMerged
226 import RecoTracker.IterativeTracking.iterativeTk_cff as _iterativeTk_cff
227 import RecoTracker.IterativeTracking.ElectronSeeds_cff as _ElectronSeeds_cff
228 for _eraName, _postfix, _era in _relevantErasAndFastSim:
229  _stdLayers = _getSeedingLayers(locals()["_seedProducers"+_postfix], _iterativeTk_cff)
230  _eleLayers = []
231  if "_electronSeedProducers"+_postfix in locals(): # doesn't exist for FastSim
232  for _layer in _getSeedingLayers(locals()["_electronSeedProducers"+_postfix], _ElectronSeeds_cff):
233  if _layer not in _stdLayers:
234  _eleLayers.append(_layer)
235 
236  locals()["_seedingLayerSets"+_postfix] = _stdLayers
237  locals()["_seedingLayerSetsForElectrons"+_postfix] = _eleLayers
238 
239 
240 # MVA selectors
241 def _getMVASelectors(postfix):
242  mvaSel = _utils.getMVASelectors(postfix)
243 
244  pset = cms.untracked.PSet()
245  for iteration, (trackProducer, classifiers) in six.iteritems(mvaSel):
246  setattr(pset, trackProducer, cms.untracked.vstring(classifiers))
247  return pset
248 for _eraName, _postfix, _era in _relevantEras:
249  locals()["_mvaSelectors"+_postfix] = _getMVASelectors(_postfix)
250 
251 # Validation iterative steps
252 _taskForEachEra(_addSelectorsByAlgo, args=["_algos"], names="_selectorsByAlgo", task="_tracksValidationSelectorsByAlgo", modDict=globals())
253 
254 # high purity
255 _taskForEachEra(_addSelectorsByHp, args=["_algos"], names="_selectorsByAlgoHp", task="_tracksValidationSelectorsByAlgoHp", modDict=globals())
256 
257 # by originalAlgo
258 for _eraName, _postfix, _era in _relevantEras:
259  locals()["_selectorsByAlgoAndHp"+_postfix] = locals()["_selectorsByAlgo"+_postfix] + locals()["_selectorsByAlgoHp"+_postfix]
260  # For ByAlgoMask
261  locals()["_selectorsByAlgoAndHpNoGenTk"+_postfix] = [n for n in locals()["_selectorsByAlgoAndHp"+_postfix] if n not in ["generalTracks", "cutsRecoTracksHp"]]
262  # For ByOriginalAlgo
263  locals()["_selectorsByAlgoAndHpNoGenTkDupMerge"+_postfix] = [n for n in locals()["_selectorsByAlgoAndHpNoGenTk"+_postfix] if n not in ["cutsRecoTracksDuplicateMerge", "cutsRecoTracksDuplicateMergeHp"]]
264 _taskForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(),
265  args = ["_selectorsByAlgoAndHpNoGenTkDupMerge"], plainArgs = ["ByOriginalAlgo", "originalAlgorithm"],
266  names = "_selectorsByOriginalAlgo", task = "_tracksValidationSelectorsByOriginalAlgo")
267 
268 
269 for _eraName, _postfix, _era in _relevantEras:
270  selectors = locals()["_selectorsByAlgoHp"+_postfix]
271  locals()["_generalTracksHp"+_postfix] = selectors[0]
272  locals()["_selectorsByAlgoHp"+_postfix] = selectors[1:]
273 
274 # BTV-like selection
275 import PhysicsTools.RecoAlgos.btvTracks_cfi as btvTracks_cfi
276 cutsRecoTracksBtvLike = btvTracks_cfi.btvTrackRefs.clone()
277 
278 # Select tracks associated to AK4 jets
280 ak4JetTracksAssociatorExplicitAll = ak4JTA_cff.ak4JetTracksAssociatorExplicit.clone(
281  jets = "ak4PFJets"
282 )
284 import JetMETCorrections.JetCorrector.jetTracksAssociationToTrackRefs_cfi as jetTracksAssociationToTrackRefs_cfi
285 cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone(
286  association = "ak4JetTracksAssociatorExplicitAll",
287  jets = "ak4PFJets",
288  correctedPtMin = 10,
289 )
290 
291 
292 
293 trackingParticlesSignal = _trackingParticleRefSelector.clone(
294  signalOnly = True,
295  chargedOnly = False,
296  tip = 1e5,
297  lip = 1e5,
298  minRapidity = -10,
299  maxRapidity = 10,
300  ptMin = 0,
301 )
302 
303 # select tracks with pT > 0.9 GeV (for upgrade fake rates)
304 generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9)
305 # and then the selectors
306 _taskForEachEra(_addSelectorsBySrc, modDict=globals(),
307  args=[["_generalTracksHp"]],
308  plainArgs=["Pt09", "generalTracksPt09"],
309  names="_selectorsPt09", task="_tracksValidationSelectorsPt09",
310  modifyTask=lambda task:task.add(generalTracksPt09))
311 
312 # select tracks from the PV
313 from CommonTools.RecoAlgos.TrackWithVertexRefSelector_cfi import trackWithVertexRefSelector as _trackWithVertexRefSelector
314 generalTracksFromPV = _trackWithVertexRefSelector.clone(
315  src = "generalTracks",
316  ptMin = 0,
317  ptMax = 1e10,
318  ptErrorCut = 1e10,
319  quality = "loose",
320  vertexTag = "offlinePrimaryVertices",
321  nVertices = 1,
322  vtxFallback = False,
323  zetaVtx = 0.1, # 1 mm
324  rhoVtx = 1e10, # intentionally no dxy cut
325 )
326 # and then the selectors
327 _taskForEachEra(_addSelectorsBySrc, modDict=globals(),
328  args=[["_generalTracksHp"]],
329  plainArgs=["FromPV", "generalTracksFromPV"],
330  names="_selectorsFromPV", task="_tracksValidationSelectorsFromPV",
331  modifyTask=lambda task: task.add(generalTracksFromPV))
332 
333 # select tracks with pT > 0.9 GeV from the PV
334 generalTracksFromPVPt09 = generalTracksPt09.clone(src="generalTracksFromPV")
335 # and then the selectors
336 _taskForEachEra(_addSelectorsBySrc, modDict=globals(),
337  args=[["_generalTracksHp"]],
338  plainArgs=["FromPVPt09", "generalTracksFromPVPt09"],
339  names="_selectorsFromPVPt09", task="_tracksValidationSelectorsFromPVPt09",
340  modifyTask=lambda task: task.add(generalTracksFromPVPt09))
341 
342 
343 trackingParticlesConversion = _trackingParticleConversionRefSelector.clone()
344 
345 
346 trackingParticlesElectron = _trackingParticleRefSelector.clone(
347  pdgId = [-11, 11],
348  signalOnly = False,
349  tip = 1e5,
350  lip = 1e5,
351  minRapidity = -10,
352  maxRapidity = 10,
353  ptMin = 0,
354 )
355 
356 # Select jets for JetCore tracking
357 highPtJets = cms.EDFilter("CandPtrSelector", src = cms.InputTag("ak4CaloJets"), cut = cms.string("pt()>1000"))
358 highPtJetsForTrk = highPtJets.clone(src = "ak4CaloJetsForTrk")
359 
360 # Select B-hadron TPs
361 trackingParticlesBHadron = _trackingParticleBHadronRefSelector.clone()
362 
363 
364 trackValidator = Validation.RecoTrack.MultiTrackValidator_cfi.multiTrackValidator.clone(
365  useLogPt = cms.untracked.bool(True),
366  dodEdxPlots = True,
367  doPVAssociationPlots = True
368  #,minpT = cms.double(-1)
369  #,maxpT = cms.double(3)
370  #,nintpT = cms.int32(40)
371 )
372 fastSim.toModify(trackValidator,
373  dodEdxPlots = False)
374 
375 for _eraName, _postfix, _era in _relevantEras:
376  _setForEra(trackValidator, _eraName, _era,
377  label = ["generalTracks", locals()["_generalTracksHp"+_postfix]] +
378  locals()["_selectorsByAlgo"+_postfix] + locals()["_selectorsByAlgoHp"+_postfix] +
379  locals()["_selectorsByOriginalAlgo"+_postfix] +
380  ["generalTracksPt09"] + locals()["_selectorsPt09"+_postfix] +
381  [
382  "cutsRecoTracksBtvLike",
383  "cutsRecoTracksAK4PFJets"
384  ],
385  doResolutionPlotsForLabels = [
386  "generalTracks",
387  locals()["_generalTracksHp"+_postfix],
388  "generalTracksPt09",
389  "cutsRecoTracksBtvLike",
390  "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo",
391  ]
392  )
393  _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()["_seedingLayerSets"+_postfix])
394 
395 # for low-pT
396 trackValidatorTPPtLess09 = trackValidator.clone(
397  dirName = "Tracking/TrackTPPtLess09/",
398  label = [x for x in trackValidator.label.value() if ("Pt09" not in x) and ("BtvLike" not in x) and ("AK4PFJets" not in x)],
399  ptMaxTP = 0.9, # set maximum pT globally
400  histoProducerAlgoBlock = dict(
401  TpSelectorForEfficiencyVsEta = dict(ptMin=0.05), # enough to set min pT here
402  TpSelectorForEfficiencyVsPhi = dict(ptMin=0.05),
403  TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.05),
404  TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.05),
405  ),
406  doSimPlots = False, # same as in trackValidator, no need to repeat here
407  doRecoTrackPlots = False, # fake rates are same as in trackValidator, no need to repeat here
408  doResolutionPlotsForLabels = ["disabled"], # resolutions are same as in trackValidator, no need to repeat here
409 )
410 
411 
412 trackingParticlesEtaGreater2p7 = _trackingParticleRefSelector.clone(
413  signalOnly = cms.bool(False),
414  tip = 1e5,
415  lip = 1e5,
416  minRapidity = -2.7,
417  maxRapidity = 2.7,
418  invertRapidityCut = cms.bool(True),
419  ptMin = 0,
420 )
421 
422 
423 # select tracks with |eta| > 2.7
424 generalTracksEtaGreater2p7 = cutsRecoTracks_cfi.cutsRecoTracks.clone(
425  minRapidity = cms.double(-2.7),
426  maxRapidity = cms.double( 2.7),
427  invertRapidityCut = cms.bool(True)
428 )
429 
430 _taskForEachEra(_addSelectorsBySrc, modDict=globals(),
431  args=[["_generalTracksHp"]],
432  plainArgs=["EtaGreater2p7", "generalTracksEtaGreater2p7"],
433  names="_selectorsEtaGreater2p7", task="_tracksValidationSelectorsEtaGreater2p7",
434  modifyTask=lambda task: task.add(generalTracksEtaGreater2p7))
435 
436 # for high-eta (phase2 : |eta| > 2.7)
437 trackValidatorTPEtaGreater2p7 = trackValidator.clone(
438  dirName = "Tracking/TrackTPEtaGreater2p7/",
439  label_tp_effic = "trackingParticlesEtaGreater2p7",
440  label_tp_fake = "trackingParticlesEtaGreater2p7",
441  label_tp_effic_refvector = True,
442  label_tp_fake_refvector = True,
443  dodEdxPlots = False,
444 # doPVAssociationPlots = False,
445  minRapidityTP = -2.7,
446  maxRapidityTP = 2.7,
447  invertRapidityCutTP = True,
448 # ptMaxTP = 0.9, # set maximum pT globally
449  histoProducerAlgoBlock = dict(
450  TpSelectorForEfficiencyVsPt = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True), # enough to set min pT here
451  TpSelectorForEfficiencyVsEta = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True), # enough to set min pT here
452  TpSelectorForEfficiencyVsPhi = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True),
453  TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True),
454  TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True),
455  generalTpSelector = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=True),
456 # minEta = -4.5,
457 # maxEta = 4.5,
458 # nintEta = 90,
459  # minPt = 0.01,
460  ),
461  doSimPlots = True, # ####same as in trackValidator, no need to repeat here
462  doRecoTrackPlots = True, # ####fake rates are same as in trackValidator, no need to repeat here
463  doResolutionPlotsForLabels = ["disabled"] # resolutions are same as in trackValidator, no need to repeat here
464 )
465 for _eraName, _postfix, _era in _relevantEras:
466  _setForEra(trackValidatorTPEtaGreater2p7, _eraName, _era,
467  label = ["generalTracksEtaGreater2p7"] + locals()["_selectorsEtaGreater2p7"+_postfix] +
468  locals()["_selectorsByAlgo"+_postfix] + locals()["_selectorsByAlgoHp"+_postfix],
469  doResolutionPlotsForLabels = ["generalTracksEtaGreater2p7"] + locals()["_selectorsEtaGreater2p7"+_postfix]
470  )
471 
472 # For efficiency of signal TPs vs. signal tracks, and fake rate of
473 # signal tracks vs. signal TPs
474 trackValidatorFromPV = trackValidator.clone(
475  dirName = "Tracking/TrackFromPV/",
476  label_tp_effic = "trackingParticlesSignal",
477  label_tp_fake = "trackingParticlesSignal",
478  label_tp_effic_refvector = True,
479  label_tp_fake_refvector = True,
480  trackCollectionForDrCalculation = "generalTracksFromPV",
481  doPlotsOnlyForTruePV = True,
482  doPVAssociationPlots = False,
483  doResolutionPlotsForLabels = ["disabled"],
484 )
485 for _eraName, _postfix, _era in _relevantEras:
486  _setForEra(trackValidatorFromPV, _eraName, _era,
487  label = ["generalTracksFromPV"] + locals()["_selectorsFromPV"+_postfix] + ["generalTracksFromPVPt09"] + locals()["_selectorsFromPVPt09"+_postfix],
488  doResolutionPlotsForLabels = [] # for standard "FromPV" do resolution plots for all input collections as they are already limited
489  )
490 
491 # For fake rate of signal tracks vs. all TPs, and pileup rate of
492 # signal tracks vs. non-signal TPs
493 trackValidatorFromPVAllTP = trackValidatorFromPV.clone(
494  dirName = "Tracking/TrackFromPVAllTP/",
495  label_tp_effic = trackValidator.label_tp_effic.value(),
496  label_tp_fake = trackValidator.label_tp_fake.value(),
497  label_tp_effic_refvector = False,
498  label_tp_fake_refvector = False,
499  doSimPlots = False,
500  doSimTrackPlots = False,
501  doResolutionPlotsForLabels = ["disabled"], # resolution plots are the same as in "trackValidatorFromPV"
502 )
503 
504 # For efficiency of all TPs vs. all tracks
505 trackValidatorAllTPEffic = trackValidator.clone(
506  dirName = "Tracking/TrackAllTPEffic/",
507  label = [x for x in trackValidator.label.value() if "Pt09" not in x],
508  doSimPlots = False,
509  doRecoTrackPlots = True, # Fake rate of all tracks vs. all TPs is already included in trackValidator, but we want the reco plots for other reasons
510  doPVAssociationPlots = False,
511  doResolutionPlotsForLabels = ["disabled"], # resolution plots are the same as in "trackValidator"
512 )
513 trackValidatorAllTPEffic.histoProducerAlgoBlock.generalTpSelector.signalOnly = False
514 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsEta.signalOnly = False
515 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPhi.signalOnly = False
516 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsPt.signalOnly = False
517 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXR.signalOnly = False
518 trackValidatorAllTPEffic.histoProducerAlgoBlock.TpSelectorForEfficiencyVsVTXZ.signalOnly = False
519 for _eraName, _postfix, _era in _relevantEras:
520  _setForEra(trackValidatorAllTPEffic, _eraName, _era, label = ["generalTracks", locals()["_generalTracksHp"+_postfix]])
521 
522 # Built tracks, in the standard sequence mainly for monitoring the track selection MVA
523 tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc = "siPixelClustersPreSplitting")
524 quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc = "tpClusterProducerPreSplitting")
525 _trackValidatorSeedingBuilding = trackValidator.clone( # common for built tracks and seeds (in trackingOnly)
526  associators = ["quickTrackAssociatorByHits"],
527  UseAssociators = True,
528  dodEdxPlots = False,
529  doPVAssociationPlots = False,
530  doSimPlots = False,
531  doResolutionPlotsForLabels = ["disabled"],
532 )
533 trackValidatorBuilding = _trackValidatorSeedingBuilding.clone(
534  dirName = "Tracking/TrackBuilding/",
535  doMVAPlots = True,
536  doResolutionPlotsForLabels = ['jetCoreRegionalStepTracks'],
537 )
538 trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone(
539  associators = ["quickTrackAssociatorByHitsPreSplitting"],
540  doMVAPlots = False,
541  doSummaryPlots = False,
542 )
543 for _eraName, _postfix, _era in _relevantErasAndFastSim:
544  _setForEra(trackValidatorBuilding, _eraName, _era, label = locals()["_trackProducers"+_postfix])
545 fastSim.toModify(trackValidatorBuilding, doMVAPlots=False)
546 for _eraName, _postfix, _era in _relevantEras:
547  _setForEra(trackValidatorBuilding, _eraName, _era, mvaLabels = locals()["_mvaSelectors"+_postfix])
548  _setForEra(trackValidatorBuildingPreSplitting, _eraName, _era, label = locals()["_trackProducersPreSplitting"+_postfix])
549 
550 
551 # For conversions
552 trackValidatorConversion = trackValidator.clone(
553  dirName = "Tracking/TrackConversion/",
554  label = [
555  "convStepTracks",
556  "conversionStepTracks",
557  "ckfInOutTracksFromConversions",
558  "ckfOutInTracksFromConversions",
559  ],
560  label_tp_effic = "trackingParticlesConversion",
561  label_tp_effic_refvector = True,
562  associators = ["quickTrackAssociatorByHits"],
563  UseAssociators = True,
564  doSimPlots = True,
565  dodEdxPlots = False,
566  doPVAssociationPlots = False,
567  calculateDrSingleCollection = False,
568 )
569 from RecoTracker.ConversionSeedGenerators.ConversionStep_cff import convLayerPairs as _convLayerPairs
570 def _uniqueFirstLayers(layerList):
571  firstLayers = [layerSet.split("+")[0] for layerSet in layerList]
572  ret = []
573  for l in firstLayers:
574  if not l in ret:
575  ret.append(l)
576  # For conversions add also the mono-TEC to the list as 'TEC'
577  # is used for both matched and unmatched rphi/stereo hits
578  if l.startswith("TEC"):
579  ret.append("M"+l)
580  return ret
581 # PhotonConversionTrajectorySeedProducerFromSingleLeg keeps only the
582 # first hit of the pairs in the seed, bookkeeping those is the best we
583 # can do without major further development
584 trackValidatorConversion.histoProducerAlgoBlock.seedingLayerSets = _uniqueFirstLayers(_convLayerPairs.layerList.value())
585 # relax lip and tip
586 for n in ["Eta", "Phi", "Pt", "VTXR", "VTXZ"]:
587  pset = getattr(trackValidatorConversion.histoProducerAlgoBlock, "TpSelectorForEfficiencyVs"+n)
588  pset.lip = trackValidatorConversion.lipTP.value()
589  pset.tip = trackValidatorConversion.tipTP.value()
590 
591 # For electrons
592 trackValidatorGsfTracks = trackValidatorConversion.clone(
593  dirName = "Tracking/TrackGsf/",
594  label = ["electronGsfTracks"],
595  label_tp_effic = "trackingParticlesElectron",
596 )
597 # add the additional seeding layers from ElectronSeeds
598 for _eraName, _postfix, _era in _relevantEras:
599  _setForEra(trackValidatorGsfTracks.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=trackValidator.histoProducerAlgoBlock.seedingLayerSets.value()+locals()["_seedingLayerSetsForElectrons"+_postfix])
600 
601 # For jetCore tracks
602 trackValidatorJetCore = trackValidator.clone(#equivalent to trackBuilding case
603  dirName = "Tracking/JetCore/",
604  useLogPt = cms.untracked.bool(True),
605  dodEdxPlots = False,
606  associators= ["trackAssociatorByChi2"],#cms.untracked.VInputTag('MTVTrackAssociationByChi2'),
607  UseAssociators = True,
608  doPVAssociationPlots = True,
609 )
610 for _eraName, _postfix, _era in _relevantEras:
611  if 'jetCoreRegionalStep' in _cfg.iterationAlgos(_postfix) :
612  _setForEra(trackValidatorJetCore, _eraName, _era,
613  label = ["generalTracks", "jetCoreRegionalStepTracks",
614  "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo","cutsRecoTracksJetCoreRegionalStepByOriginalAlgoHp",
615  "cutsRecoTracksJetCoreRegionalStep", "cutsRecoTracksJetCoreRegionalStepHp"],
616  doResolutionPlotsForLabels =["generalTracks", "jetCoreRegionalStepTracks",
617  "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo","cutsRecoTracksJetCoreRegionalStepByOriginalAlgoHp",
618  "cutsRecoTracksJetCoreRegionalStep", "cutsRecoTracksJetCoreRegionalStepHp"],
619  )
620 
621 # for B-hadrons
622 trackValidatorBHadron = trackValidator.clone(
623  dirName = "Tracking/TrackBHadron/",
624  label_tp_effic = "trackingParticlesBHadron",
625  label_tp_effic_refvector = True,
626  doSimPlots = True,
627  doRecoTrackPlots = False, # Fake rate is defined wrt. all TPs, and that is already included in trackValidator
628  dodEdxPlots = False,
629 )
630 for _eraName, _postfix, _era in _relevantEras:
631  _setForEra(trackValidatorBHadron, _eraName, _era,
632  label = ["generalTracks", locals()["_generalTracksHp"+_postfix], "cutsRecoTracksBtvLike"]
633  )
634 
635 
636 # for displaced tracks
637 trackValidatorDisplaced = trackValidator.clone(
638  dirName = "Tracking/TrackDisplaced/",
639  label = [x for x in trackValidator.label.value() if ("Pt09" not in x) and ("BtvLike" not in x) and ("AK4PFJets" not in x)],
640  ptMaxTP = 1e5,
641  dodEdxPlots = False,
642  invertRapidityCutTP = False,
643  histoProducerAlgoBlock = dict(
644  TpSelectorForEfficiencyVsPt = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5), # enough to set min pT here
645  TpSelectorForEfficiencyVsEta = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5), # enough to set min pT here
646  TpSelectorForEfficiencyVsPhi = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5),
647  TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5),
648  TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5),
649  generalTpSelector = dict(ptMin=0.005, signalOnly=True, tip=1e5, lip=1e5),
650  minDxy = -60,
651  maxDxy = 60,
652  nintDxy = 120,
653  minDz = -30,
654  maxDz = 30,
655  nintDz = 60,
656  ),
657  signalOnlyTP = True,
658  lipTP = 1e5,
659  tipTP = 1e5,
660 )
661 
662 # the track selectors
663 tracksValidationSelectors = cms.Task(
664  tracksValidationSelectorsByAlgo,
665  tracksValidationSelectorsByAlgoHp,
666  tracksValidationSelectorsByOriginalAlgo,
667  cutsRecoTracksBtvLike,
668  ak4JetTracksAssociatorExplicitAll,
669  cutsRecoTracksAK4PFJets
670 )
671 phase2_tracker.toModify(tracksValidationSelectors, lambda x: x.add(generalTracksEtaGreater2p7))
672 phase2_tracker.toModify(tracksValidationSelectors, lambda x: x.add(cutsRecoTracksEtaGreater2p7Hp))
673 
674 # Validation iterative steps
675 _taskForEachEra(_addSelectorsByAlgo, modDict=globals(),
676  args=["_algos"],
677  names="_selectorsByAlgo", task="_tracksEtaGreater2p7ValidationSelectorsByAlgo"
678  )
679 
680 # high purity
681 _taskForEachEra(_addSelectorsByHp, modDict=globals(),
682  args=["_algos"],
683  names="_selectorsByAlgoHp", task="_tracksEtaGreater2p7ValidationSelectorsByAlgoHp"
684  )
685 
686 for _eraName, _postfix, _era in _relevantEras:
687  selectors = locals()["_selectorsByAlgoHp"+_postfix]
688  locals()["_generalTracksHp"+_postfix] = selectors[0]
689  locals()["_selectorsByAlgoHp"+_postfix] = selectors[1:]
690 
691 phase2_tracker.toModify(tracksValidationSelectors, lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgo))
692 phase2_tracker.toModify(tracksValidationSelectors, lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgoHp))
693 
694 tracksValidationTruth = cms.Task(
695  tpClusterProducer,
696  tpClusterProducerPreSplitting,
697  trackAssociatorByChi2,
698  quickTrackAssociatorByHits,
699  quickTrackAssociatorByHitsPreSplitting,
700  trackingParticleRecoTrackAsssociation,
701  VertexAssociatorByPositionAndTracks,
702  trackingParticleNumberOfLayersProducer
703 )
704 fastSim.toModify(tracksValidationTruth, lambda x: x.remove(tpClusterProducer))
705 
706 tracksPreValidation = cms.Task(
707  highPtJetsForTrk,
708  tracksValidationSelectors,
709  tracksValidationSelectorsPt09,
710  tracksValidationSelectorsFromPV,
711  tracksValidationSelectorsFromPVPt09,
712  tracksValidationTruth,
713  trackingParticlesSignal,
714  trackingParticlesElectron,
715  trackingParticlesConversion
716 )
717 fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([
718  trackingParticlesElectron,
719  trackingParticlesConversion,
720 ]))
721 
722 
723 
724 tracksValidation = cms.Sequence(
725  trackValidator +
726  trackValidatorTPPtLess09 +
727  trackValidatorFromPV +
728  trackValidatorFromPVAllTP +
729  trackValidatorAllTPEffic +
730  trackValidatorBuilding +
731  trackValidatorBuildingPreSplitting +
732  trackValidatorConversion +
733  trackValidatorGsfTracks,
734  tracksPreValidation
735 )
736 
737 from Configuration.ProcessModifiers.seedingDeepCore_cff import seedingDeepCore
738 seedingDeepCore.toReplaceWith(tracksValidation, cms.Sequence(tracksValidation.copy()+trackValidatorJetCore))
739 
740 from Configuration.ProcessModifiers.displacedTrackValidation_cff import displacedTrackValidation
741 displacedTrackValidation.toReplaceWith(tracksValidation, cms.Sequence(tracksValidation.copy()+trackValidatorDisplaced))
742 
743 from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker
744 tracksPreValidationPhase2 = tracksPreValidation.copy()
745 tracksPreValidationPhase2.add(trackingParticlesEtaGreater2p7)
746 phase2_tracker.toReplaceWith(tracksPreValidation, tracksPreValidationPhase2)
747 
748 tracksValidationPhase2 = tracksValidation.copyAndExclude([
749  trackValidatorJetCore
750 ])
751 tracksValidationPhase2+=trackValidatorTPEtaGreater2p7
752 phase2_tracker.toReplaceWith(tracksValidation, tracksValidationPhase2)
753 
754 fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
755  trackValidatorBuildingPreSplitting,
756  trackValidatorConversion,
757  trackValidatorGsfTracks,
758 ]))
759 
760 
761 
762 # Select by originalAlgo and algoMask
763 _taskForEachEra(_addSelectorsByOriginalAlgoMask, modDict = globals(),
764  args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["ByAlgoMask", "algorithmMaskContains"],
765  names = "_selectorsByAlgoMask", task = "_tracksValidationSelectorsByAlgoMaskStandalone")
766 
767 # Select pT>0.9 by iteration
768 # Need to avoid generalTracks+HP because those are already included in the standard validator
769 _taskForEachEra(_addSelectorsBySrc, modDict = globals(),
770  args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["Pt09", "generalTracksPt09"],
771  names = "_selectorsPt09Standalone", task = "_tracksValidationSelectorsPt09Standalone")
772 
773 # Select fromPV by iteration
774 # Need to avoid generalTracks+HP because those are already included in the standard validator
775 _taskForEachEra(_addSelectorsBySrc, modDict = globals(),
776  args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPV", "generalTracksFromPV"],
777  names = "_selectorsFromPVStandalone", task = "_tracksValidationSelectorsFromPVStandalone")
778 
779 # Select pt>0.9 and fromPV by iteration
780 # Need to avoid generalTracks+HP because those are already included in the standard validator
781 _taskForEachEra(_addSelectorsBySrc, modDict = globals(),
782  args = ["_selectorsByAlgoAndHpNoGenTk"], plainArgs = ["FromPVPt09", "generalTracksFromPVPt09"],
783  names = "_selectorsFromPVPt09Standalone", task = "_tracksValidationSelectorsFromPVPt09Standalone")
784 
785 # MTV instances
786 trackValidatorStandalone = trackValidator.clone(
787  cores = "highPtJets"
788 )
789 trackValidatorTPPtLess09Standalone = trackValidatorTPPtLess09.clone(
790  cores = "highPtJets"
791 )
792 for _eraName, _postfix, _era in _relevantEras:
793  _setForEra(trackValidatorStandalone, _eraName, _era, label = trackValidator.label + locals()["_selectorsByAlgoMask"+_postfix] + locals()["_selectorsPt09Standalone"+_postfix])
794  _setForEra(trackValidatorTPPtLess09Standalone, _eraName, _era, label = trackValidatorTPPtLess09.label + locals()["_selectorsByAlgoMask"+_postfix] + locals()["_selectorsPt09Standalone"+_postfix])
795 
796 trackValidatorFromPVStandalone = trackValidatorFromPV.clone(
797  cores = "highPtJets"
798 )
799 for _eraName, _postfix, _era in _relevantEras:
800  _setForEra(trackValidatorFromPVStandalone, _eraName, _era, label = trackValidatorFromPV.label + locals()["_selectorsFromPVStandalone"+_postfix] + locals()["_selectorsFromPVPt09Standalone"+_postfix])
801 # do resolutions as in the standard version
802 
803 trackValidatorFromPVAllTPStandalone = trackValidatorFromPVAllTP.clone(
804  label = trackValidatorFromPVStandalone.label.value(),
805  cores = "highPtJets"
806 
807 )
808 trackValidatorAllTPEfficStandalone = trackValidatorAllTPEffic.clone(
809  label = [ x for x in trackValidator.label.value() if x not in ["cutsRecoTracksBtvLike", "cutsRecoTracksAK4PFJets"] and "Pt09" not in x],
810  cores = "highPtJets"
811 )
812 
813 trackValidatorConversionStandalone = trackValidatorConversion.clone(
814  label = [x for x in trackValidatorConversion.label if x != "convStepTracks"],
815  cores = "highPtJets"
816 )
817 
818 trackValidatorBHadronStandalone = trackValidatorBHadron.clone(
819  label = [x for x in trackValidatorStandalone.label if "Pt09" not in x],
820  cores = "highPtJets"
821 )
822 
823 trackValidatorGsfTracksStandalone = trackValidatorGsfTracks.clone(
824  cores = "highPtJets"
825 )
826 
827 # sequences
828 tracksPreValidationStandalone = tracksPreValidation.copy()
829 tracksPreValidationStandalone.add(trackingParticlesBHadron)
830 tracksPreValidationStandalone.replace(highPtJetsForTrk,highPtJets)
831 fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation)
832 
833 tracksValidationSelectorsStandalone = cms.Task(
834  tracksValidationSelectorsByAlgoMaskStandalone,
835  tracksValidationSelectorsPt09Standalone,
836  tracksValidationSelectorsFromPVStandalone,
837  tracksValidationSelectorsFromPVPt09Standalone
838 )
839 
840 # we copy this for both Standalone and TrackingOnly
841 # and later make modifications from it which change based on era
842 _trackValidatorsBase = cms.Sequence(
843  trackValidatorStandalone +
844  trackValidatorTPPtLess09Standalone +
845  trackValidatorFromPVStandalone +
846  trackValidatorFromPVAllTPStandalone +
847  trackValidatorAllTPEfficStandalone +
848  trackValidatorConversionStandalone +
849  trackValidatorGsfTracksStandalone +
850  trackValidatorBHadronStandalone
851 )
852 
853 _trackValidatorsBasePhase2 = _trackValidatorsBase.copy()
854 _trackValidatorsBasePhase2+=trackValidatorTPEtaGreater2p7
855 phase2_tracker.toReplaceWith(_trackValidatorsBase, _trackValidatorsBasePhase2)
856 
857 trackValidatorsStandalone = _trackValidatorsBase.copy()
858 fastSim.toModify(trackValidatorsStandalone, lambda x: x.remove(trackValidatorConversionStandalone) )
859 
860 tracksValidationStandalone = cms.Sequence(
861  ak4PFL1FastL2L3CorrectorChain +
862  trackValidatorsStandalone,
863  tracksPreValidationStandalone,
864  tracksValidationSelectorsStandalone
865 )
866 
867 
868 
869 # selectors
870 tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets]) # selectors using track information only (i.e. no PF)
871 _taskForEachEra(_addSeedToTrackProducers, args=["_seedProducers"], names="_seedSelectors", task="_tracksValidationSeedSelectorsTrackingOnly", includeFastSim=True, modDict=globals())
872 _taskForEachEra(_addSeedToTrackProducers, args=["_seedProducersPreSplitting"], names="_seedSelectorsPreSplitting", task="_tracksValidationSeedSelectorsPreSplittingTrackingOnly", modDict=globals())
873 tracksValidationSeedSelectorsTrackingOnly.add(tracksValidationSeedSelectorsPreSplittingTrackingOnly)
874 
875 # MTV instances
876 trackValidatorTrackingOnly = trackValidatorStandalone.clone(
877  label = [ x for x in trackValidatorStandalone.label if x != "cutsRecoTracksAK4PFJets"],
878  cores = "highPtJetsForTrk"
879  )
880 
881 trackValidatorSeedingTrackingOnly = _trackValidatorSeedingBuilding.clone(
882  dirName = "Tracking/TrackSeeding/",
883  label = _seedSelectors,
884  doSeedPlots = True,
885  doResolutionPlotsForLabels = [ "seedTracksjetCoreRegionalStepSeeds",]
886 )
887 trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
888  associators = ["quickTrackAssociatorByHitsPreSplitting"],
889  label = _seedSelectorsPreSplitting,
890  doSummaryPlots = False,
891 
892 )
893 
894 trackValidatorJetCoreSeedingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
895  dirName = "Tracking/JetCore/TrackSeeding/",
896  associators = ["trackAssociatorByChi2"],
897  UseAssociators = True,
898  doSeedPlots = True,
899 )
900 
901 for _eraName, _postfix, _era in _relevantEras:
902  if 'jetCoreRegionalStep' in _cfg.iterationAlgos(_postfix) :
903  _setForEra(trackValidatorJetCoreSeedingTrackingOnly, _eraName, _era,
904  label = [ "seedTracksjetCoreRegionalStepSeeds",],
905  doResolutionPlotsForLabels = [ "seedTracksjetCoreRegionalStepSeeds",]
906  )
907 
908 for _eraName, _postfix, _era in _relevantErasAndFastSim:
909  _setForEra(trackValidatorSeedingTrackingOnly, _eraName, _era, label = locals()["_seedSelectors"+_postfix])
910 for _eraName, _postfix, _era in _relevantEras:
911  _setForEra(trackValidatorSeedingPreSplittingTrackingOnly, _eraName, _era, label = locals()["_seedSelectorsPreSplitting"+_postfix])
912 
913 
914 trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x for x in trackValidatorConversion.label if x not in ["ckfInOutTracksFromConversions", "ckfOutInTracksFromConversions"]])
915 
916 trackValidatorBHadronTrackingOnly = trackValidatorBHadron.clone(label = [x for x in trackValidatorTrackingOnly.label if "Pt09" not in x])
917 
918 trackValidatorTPPtLess09TrackingOnly = trackValidatorTPPtLess09Standalone.clone(cores = "highPtJetsForTrk")
919 trackValidatorFromPVTrackingOnly = trackValidatorFromPVStandalone.clone(cores = "highPtJetsForTrk")
920 trackValidatorFromPVAllTPTrackingOnly = trackValidatorFromPVAllTPStandalone.clone(cores = "highPtJetsForTrk")
921 trackValidatorAllTPEfficTrackingOnly = trackValidatorAllTPEfficStandalone.clone(cores = "highPtJetsForTrk")
922 # sequences
923 tracksPreValidationTrackingOnly = tracksPreValidationStandalone.copy()
924 tracksPreValidationTrackingOnly.replace(tracksValidationSelectors, tracksValidationSelectorsTrackingOnly)
925 tracksPreValidationTrackingOnly.replace(highPtJets,highPtJetsForTrk)
926 
927 trackValidatorsTrackingOnly = _trackValidatorsBase.copy()
928 trackValidatorsTrackingOnly.replace(trackValidatorStandalone, trackValidatorTrackingOnly)
929 trackValidatorsTrackingOnly.replace(trackValidatorTPPtLess09Standalone,trackValidatorTPPtLess09TrackingOnly)
930 trackValidatorsTrackingOnly.replace(trackValidatorFromPVStandalone,trackValidatorFromPVTrackingOnly)
931 trackValidatorsTrackingOnly.replace(trackValidatorFromPVAllTPStandalone,trackValidatorFromPVAllTPTrackingOnly)
932 trackValidatorsTrackingOnly.replace(trackValidatorAllTPEfficStandalone,trackValidatorAllTPEfficTrackingOnly)
933 trackValidatorsTrackingOnly += trackValidatorSeedingTrackingOnly
934 trackValidatorsTrackingOnly += trackValidatorSeedingPreSplittingTrackingOnly
935 trackValidatorsTrackingOnly += trackValidatorBuilding
936 trackValidatorsTrackingOnly += trackValidatorBuildingPreSplitting
937 trackValidatorsTrackingOnly.replace(trackValidatorConversionStandalone, trackValidatorConversionTrackingOnly)
938 trackValidatorsTrackingOnly.remove(trackValidatorGsfTracksStandalone)
939 trackValidatorsTrackingOnly.replace(trackValidatorBHadronStandalone, trackValidatorBHadronTrackingOnly)
940 
941 seedingDeepCore.toReplaceWith(trackValidatorsTrackingOnly, cms.Sequence(
942  trackValidatorsTrackingOnly.copy()+
943  trackValidatorJetCore+
944  trackValidatorJetCoreSeedingTrackingOnly
945  )
946  )
947 phase2_tracker.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([ #must be done for each era which does not have jetcore in the iteration
948  trackValidatorJetCore,
949  trackValidatorJetCoreSeedingTrackingOnly
950 ]))
951 
952 displacedTrackValidation.toReplaceWith(trackValidatorsTrackingOnly, cms.Sequence(trackValidatorsTrackingOnly.copy()+trackValidatorDisplaced))
953 
954 fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
955  trackValidatorBuildingPreSplitting,
956  trackValidatorSeedingPreSplittingTrackingOnly,
957  trackValidatorConversionTrackingOnly,
958  trackValidatorBHadronTrackingOnly
959 ]))
960 tracksValidationTrackingOnly = cms.Sequence(
961  trackValidatorsTrackingOnly,
962  tracksPreValidationTrackingOnly,
963  tracksValidationSelectorsStandalone,
964  tracksValidationSeedSelectorsTrackingOnly
965 )
966 
967 
968 
969 trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
970  label_tr = "pixelTracks",
971  associator = "quickTrackAssociatorByHitsPreSplitting",
972 )
973 PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
974  trackAssociation = "trackingParticlePixelTrackAsssociation"
975 )
976 
977 _pixelTracksCustom = dict(
978  src = "pixelTracks",
979  vertexTag = "pixelVertices",
980 )
981 pixelTracksPt09 = generalTracksPt09.clone(quality = ["undefQuality"], **_pixelTracksCustom)
982 pixelTracksFromPV = generalTracksFromPV.clone(quality = "undefQuality", **_pixelTracksCustom)
983 pixelTracksFromPVPt09 = pixelTracksPt09.clone(src = "pixelTracksFromPV")
984 
985 trackValidatorPixelTrackingOnly = trackValidator.clone(
986  dirName = "Tracking/PixelTrack/",
987  label = ["pixelTracks", "pixelTracksPt09"],
988  doResolutionPlotsForLabels = [],
989  trackCollectionForDrCalculation = "pixelTracks",
990  associators = ["trackingParticlePixelTrackAsssociation"],
991  label_vertex = "pixelVertices",
992  vertexAssociator = "PixelVertexAssociatorByPositionAndTracks",
993  dodEdxPlots = False,
994  cores = cms.InputTag(""),
995 )
996 trackValidatorFromPVPixelTrackingOnly = trackValidatorPixelTrackingOnly.clone(
997  dirName = "Tracking/PixelTrackFromPV/",
998  label = ["pixelTracksFromPV", "pixelTracksFromPVPt09"],
999  label_tp_effic = "trackingParticlesSignal",
1000  label_tp_fake = "trackingParticlesSignal",
1001  label_tp_effic_refvector = True,
1002  label_tp_fake_refvector = True,
1003  trackCollectionForDrCalculation = "pixelTracksFromPV",
1004  doPlotsOnlyForTruePV = True,
1005  doPVAssociationPlots = False,
1006  doResolutionPlotsForLabels = ["disabled"],
1007 )
1008 trackValidatorFromPVAllTPPixelTrackingOnly = trackValidatorFromPVPixelTrackingOnly.clone(
1009  dirName = "Tracking/PixelTrackFromPVAllTP/",
1010  label_tp_effic = trackValidatorPixelTrackingOnly.label_tp_effic.value(),
1011  label_tp_fake = trackValidatorPixelTrackingOnly.label_tp_fake.value(),
1012  label_tp_effic_refvector = False,
1013  label_tp_fake_refvector = False,
1014  doSimPlots = False,
1015  doSimTrackPlots = False,
1016 )
1017 trackValidatorBHadronPixelTrackingOnly = trackValidatorPixelTrackingOnly.clone(
1018  dirName = "Tracking/PixelTrackBHadron/",
1019  label_tp_effic = "trackingParticlesBHadron",
1020  label_tp_effic_refvector = True,
1021  doSimPlots = True,
1022  doRecoTrackPlots = False, # Fake rate is defined wrt. all TPs, and that is already included in trackValidator
1023  dodEdxPlots = False,
1024 )
1025 
1026 tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
1027 tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
1028 tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
1029 tracksValidationTruthPixelTrackingOnly.add(trackingParticlesBHadron)
1030 
1031 tracksPreValidationPixelTrackingOnly = cms.Task(
1032  tracksValidationTruthPixelTrackingOnly,
1033  trackingParticlesSignal,
1034  pixelTracksPt09,
1035  pixelTracksFromPV,
1036  pixelTracksFromPVPt09,
1037 )
1038 tracksValidationPixelTrackingOnly = cms.Sequence(
1039  trackValidatorPixelTrackingOnly +
1040  trackValidatorFromPVPixelTrackingOnly +
1041  trackValidatorFromPVAllTPPixelTrackingOnly +
1042  trackValidatorBHadronPixelTrackingOnly,
1043  tracksPreValidationPixelTrackingOnly
1044 )
1045 
1046 
1047 
1048 trackValidatorLite = trackValidator.clone(
1049  label = ["generalTracks", "cutsRecoTracksHp"]
1050 )
1051 tracksValidationLite = cms.Sequence(
1052  cutsRecoTracksHp +
1053  trackValidatorLite,
1054  tracksValidationTruth
1055 )
1056 
1057 
1058 from Configuration.Eras.Modifier_phase2_timing_layer_cff import phase2_timing_layer
1059 phase2_timing_layer.toModify( generalTracksFromPV,
1060  timesTag = cms.InputTag('tofPID:t0'),
1061  timeResosTag = cms.InputTag('tofPID:sigmat0'),
1062  nSigmaDtVertex = cms.double(3) )
1063 phase2_timing_layer.toModify( trackValidatorStandalone,
1064  label_vertex = cms.untracked.InputTag('offlinePrimaryVertices4D') )
1065 phase2_timing_layer.toModify( trackValidatorFromPVStandalone,
1066  label_vertex = cms.untracked.InputTag('offlinePrimaryVertices4D') )
1067 phase2_timing_layer.toModify( trackValidatorFromPVAllTPStandalone,
1068  label_vertex = cms.untracked.InputTag('offlinePrimaryVertices4D') )
1069 phase2_timing_layer.toModify( trackValidatorConversionStandalone,
1070  label_vertex = cms.untracked.InputTag('offlinePrimaryVertices4D') )
1071 phase2_timing_layer.toModify( trackValidatorGsfTracks,
1072  label_vertex = cms.untracked.InputTag('offlinePrimaryVertices4D') )
TrackValidation_cff._addSelectorsBySrc
_addSelectorsBySrc
Definition: TrackValidation_cff.py:306
TrackWithVertexRefSelector_cfi
TrackValidation_cff._addSelectorsByAlgo
_addSelectorsByAlgo
Definition: TrackValidation_cff.py:252
ElectronSeeds_cff
LhcParametersDefinerForTP_cfi
TrackValidation_cff._getSeedingLayers
def _getSeedingLayers(seedProducers, config)
Definition: TrackValidation_cff.py:191
ak4JTA_cff
TrackValidation_cff._translateArgs
def _translateArgs(args, postfix, modDict)
Definition: TrackValidation_cff.py:148
trackAssociatorByChi2_cfi
TrackValidation_cff._addSelectorsByHp
_addSelectorsByHp
Definition: TrackValidation_cff.py:255
iterativeTk_cff
trackingParticleNumberOfLayersProducer_cff
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
MultiTrackValidator_cfi
TrackValidation_cff._getMVASelectors
def _getMVASelectors(postfix)
Definition: TrackValidation_cff.py:241
TrackValidation_cff._addSelectorsByOriginalAlgoMask
_addSelectorsByOriginalAlgoMask
Then define stuff for standalone mode (i.e.
Definition: TrackValidation_cff.py:264
TrackValidation_cff._algoToSelector
def _algoToSelector(algo)
Definition: TrackValidation_cff.py:60
TrackValidation_cff.modifyTask
modifyTask
Definition: TrackValidation_cff.py:310
Exception
tpClusterProducer_cfi
JetCorrectors_cff
TrackValidation_cff._addSeedToTrackProducers
_addSeedToTrackProducers
Definition: TrackValidation_cff.py:871
TrackValidation_cff._taskForEachEra
def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False)
Definition: TrackValidation_cff.py:156
TrackValidation_cff._setForEra
def _setForEra(module, eraName, era, **kwargs)
Definition: TrackValidation_cff.py:183
VertexAssociatorByPositionAndTracks_cfi
PostProcessorTracker_cfi
quickTrackAssociatorByHits_cfi
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
pileupCalc.upper
upper
Definition: pileupCalc.py:214
cutsRecoTracks_cfi
CosmicParametersDefinerForTP_cfi
trackingParticleRecoTrackAsssociation_cfi
TrackValidation_cff._uniqueFirstLayers
def _uniqueFirstLayers(layerList)
Definition: TrackValidation_cff.py:570
ConversionStep_cff