1 from __future__
import absolute_import
2 import FWCore.ParameterSet.Config
as cms
8 from Validation.RecoTrack.trajectorySeedTracks_cfi
import trajectorySeedTracks
as _trajectorySeedTracks
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
23 import RecoTracker.IterativeTracking.iterativeTkConfig
as _cfg
24 import RecoTracker.IterativeTracking.iterativeTkUtils
as _utils
25 from Configuration.Eras.Modifier_fastSim_cff
import fastSim
30 for _eraName, _postfix, _era
in _cfg.allEras():
31 _seedProd = [
"initialStepSeedsPreSplitting"]
32 _trackProd = [
"initialStepTracksPreSplitting"]
33 if _eraName
in [
"trackingLowPU",
"trackingPhase2PU140"]:
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)
43 if _eraName !=
"trackingPhase2PU140":
44 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds",
"pixelPairElectronSeeds",
"stripPairElectronSeeds"]
46 locals()[
"_electronSeedProducers"+_postfix] = [
"tripletElectronSeeds"]
48 _removeForFastSimSeedProducers =[
"initialStepSeedsPreSplitting",
49 "jetCoreRegionalStepSeeds",
50 "muonSeededSeedsInOut",
51 "muonSeededSeedsOutIn"]
52 _seedProducers_fastSim = [ x
for x
in _seedProducers
if x
not in _removeForFastSimSeedProducers]
54 _removeForFastTrackProducers = [
"initialStepTracksPreSplitting",
55 "jetCoreRegionalStepTracks",
56 "muonSeededTracksInOut",
57 "muonSeededTracksOutIn"]
58 _trackProducers_fastSim = [ x
for x
in _trackProducers
if x
not in _removeForFastTrackProducers]
62 if algo !=
"generalTracks":
63 sel = algo[0].
upper()+algo[1:]
64 return "cutsRecoTracks"+sel
70 if algo ==
"generalTracks":
73 if modName
not in modDict:
74 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(
78 modDict[modName] = mod
80 mod = modDict[modName]
89 modNameHp = modName+
"Hp"
90 if modNameHp
not in modDict:
91 if algo ==
"generalTracks":
92 mod = cutsRecoTracks_cfi.cutsRecoTracks.clone(quality=[
"highPurity"])
94 mod = modDict[modName].
clone(quality=[
"highPurity"])
95 modDict[modNameHp] = mod
97 mod = modDict[modNameHp]
98 names.append(modNameHp)
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
110 mod = modDict[modNameNew]
111 names.append(modNameNew)
117 for modName
in modules:
118 if modName[-2:] ==
"Hp":
119 modNameNew = modName[:-2] + midfix +
"Hp"
121 modNameNew = modName + midfix
122 if modNameNew
not in modDict:
123 mod = modDict[modName].
clone()
124 setattr(mod, algoParam, mod.algorithm.value())
126 modDict[modNameNew] = mod
128 mod = modDict[modNameNew]
129 names.append(modNameNew)
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
141 mod = modDict[modName]
142 names.append(modName)
146 _relevantEras = _cfg.allEras()
147 _relevantErasAndFastSim = _relevantEras + [(
"fastSim",
"_fastSim", fastSim)]
151 if isinstance(arg, list):
154 ret.append(modDict[arg+postfix])
156 def _taskForEachEra(function, args, names, task, modDict, plainArgs=[], modifyTask=None, includeFastSim=False):
158 raise Exception(
"Task name is expected to begin with _")
160 _eras = _relevantErasAndFastSim
if includeFastSim
else _relevantEras
161 for eraName, postfix, _era
in _eras:
163 _args.extend(plainArgs)
164 ret =
function(*_args, modDict=modDict)
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]
171 defaultTaskName = task+_eras[0][0]
172 defaultTask = modDict[defaultTaskName]
173 modDict[defaultTaskName[1:]] = defaultTask
176 if modifyTask
is not None:
177 for eraName, postfix, _era
in _eras:
181 for _eraName, _postfix, _era
in _eras[1:]:
182 _era.toReplaceWith(defaultTask, modDict[task+_postfix])
185 for key, value
in six.iteritems(kwargs):
186 setattr(module, key, value)
188 era.toModify(module, **kwargs)
192 def _findSeedingLayers(name):
193 prod = getattr(config, name)
194 if hasattr(prod,
"triplets"):
195 if hasattr(prod,
"layerList"):
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()
203 return prod.seedingLayers.getModuleLabel()
205 seedingLayersMerged = []
206 for seedName
in seedProducers:
207 seedProd = getattr(config, seedName)
208 seedingLayersName =
None
210 if hasattr(seedProd,
"OrderedHitsFactoryPSet"):
211 seedingLayersName = seedProd.OrderedHitsFactoryPSet.SeedingLayers.getModuleLabel()
212 elif hasattr(seedProd,
"seedingHitSets"):
213 seedingLayersName = _findSeedingLayers(seedProd.seedingHitSets.getModuleLabel())
214 elif hasattr(seedProd,
"layerList"):
215 seedingLayers = seedProd.layerList.value()
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)
225 return seedingLayersMerged
228 for _eraName, _postfix, _era
in _relevantErasAndFastSim:
231 if "_electronSeedProducers"+_postfix
in locals():
232 for _layer
in _getSeedingLayers(locals()[
"_electronSeedProducers"+_postfix], _ElectronSeeds_cff):
233 if _layer
not in _stdLayers:
234 _eleLayers.append(_layer)
236 locals()[
"_seedingLayerSets"+_postfix] = _stdLayers
237 locals()[
"_seedingLayerSetsForElectrons"+_postfix] = _eleLayers
242 mvaSel = _utils.getMVASelectors(postfix)
244 pset = cms.untracked.PSet()
245 for iteration, (trackProducer, classifiers)
in six.iteritems(mvaSel):
246 setattr(pset, trackProducer, cms.untracked.vstring(classifiers))
248 for _eraName, _postfix, _era
in _relevantEras:
252 _taskForEachEra(_addSelectorsByAlgo, args=[
"_algos"], names=
"_selectorsByAlgo", task=
"_tracksValidationSelectorsByAlgo", modDict=globals())
255 _taskForEachEra(_addSelectorsByHp, args=[
"_algos"], names=
"_selectorsByAlgoHp", task=
"_tracksValidationSelectorsByAlgoHp", modDict=globals())
258 for _eraName, _postfix, _era
in _relevantEras:
259 locals()[
"_selectorsByAlgoAndHp"+_postfix] = locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix]
261 locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHp"+_postfix]
if n
not in [
"generalTracks",
"cutsRecoTracksHp"]]
263 locals()[
"_selectorsByAlgoAndHpNoGenTkDupMerge"+_postfix] = [n
for n
in locals()[
"_selectorsByAlgoAndHpNoGenTk"+_postfix]
if n
not in [
"cutsRecoTracksDuplicateMerge",
"cutsRecoTracksDuplicateMergeHp"]]
265 args = [
"_selectorsByAlgoAndHpNoGenTkDupMerge"], plainArgs = [
"ByOriginalAlgo",
"originalAlgorithm"],
266 names =
"_selectorsByOriginalAlgo", task =
"_tracksValidationSelectorsByOriginalAlgo")
269 for _eraName, _postfix, _era
in _relevantEras:
270 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
271 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
272 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
275 import PhysicsTools.RecoAlgos.btvTracks_cfi
as btvTracks_cfi
276 cutsRecoTracksBtvLike = btvTracks_cfi.btvTrackRefs.clone()
280 ak4JetTracksAssociatorExplicitAll = ak4JTA_cff.ak4JetTracksAssociatorExplicit.clone(
284 import JetMETCorrections.JetCorrector.jetTracksAssociationToTrackRefs_cfi
as jetTracksAssociationToTrackRefs_cfi
285 cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone(
286 association =
"ak4JetTracksAssociatorExplicitAll",
293 trackingParticlesSignal = _trackingParticleRefSelector.clone(
304 generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9)
307 args=[[
"_generalTracksHp"]],
308 plainArgs=[
"Pt09",
"generalTracksPt09"],
309 names=
"_selectorsPt09", task=
"_tracksValidationSelectorsPt09",
310 modifyTask=
lambda task:task.add(generalTracksPt09))
314 generalTracksFromPV = _trackWithVertexRefSelector.clone(
315 src =
"generalTracks",
320 vertexTag =
"offlinePrimaryVertices",
328 args=[[
"_generalTracksHp"]],
329 plainArgs=[
"FromPV",
"generalTracksFromPV"],
330 names=
"_selectorsFromPV", task=
"_tracksValidationSelectorsFromPV",
331 modifyTask=
lambda task: task.add(generalTracksFromPV))
334 generalTracksFromPVPt09 = generalTracksPt09.clone(src=
"generalTracksFromPV")
337 args=[[
"_generalTracksHp"]],
338 plainArgs=[
"FromPVPt09",
"generalTracksFromPVPt09"],
339 names=
"_selectorsFromPVPt09", task=
"_tracksValidationSelectorsFromPVPt09",
340 modifyTask=
lambda task: task.add(generalTracksFromPVPt09))
343 trackingParticlesConversion = _trackingParticleConversionRefSelector.clone()
346 trackingParticlesElectron = _trackingParticleRefSelector.clone(
357 highPtJets = cms.EDFilter(
"CandPtrSelector", src = cms.InputTag(
"ak4CaloJets"), cut = cms.string(
"pt()>1000"))
358 highPtJetsForTrk = highPtJets.clone(src =
"ak4CaloJetsForTrk")
361 trackingParticlesBHadron = _trackingParticleBHadronRefSelector.clone()
364 trackValidator = Validation.RecoTrack.MultiTrackValidator_cfi.multiTrackValidator.clone(
365 useLogPt = cms.untracked.bool(
True),
367 doPVAssociationPlots =
True
372 fastSim.toModify(trackValidator,
375 for _eraName, _postfix, _era
in _relevantEras:
377 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix]] +
378 locals()[
"_selectorsByAlgo"+_postfix] + locals()[
"_selectorsByAlgoHp"+_postfix] +
379 locals()[
"_selectorsByOriginalAlgo"+_postfix] +
380 [
"generalTracksPt09"] + locals()[
"_selectorsPt09"+_postfix] +
382 "cutsRecoTracksBtvLike",
383 "cutsRecoTracksAK4PFJets"
385 doResolutionPlotsForLabels = [
387 locals()[
"_generalTracksHp"+_postfix],
389 "cutsRecoTracksBtvLike",
390 "cutsRecoTracksJetCoreRegionalStepByOriginalAlgo",
393 _setForEra(trackValidator.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=locals()[
"_seedingLayerSets"+_postfix])
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)],
400 histoProducerAlgoBlock = dict(
401 TpSelectorForEfficiencyVsEta = dict(ptMin=0.05),
402 TpSelectorForEfficiencyVsPhi = dict(ptMin=0.05),
403 TpSelectorForEfficiencyVsVTXR = dict(ptMin=0.05),
404 TpSelectorForEfficiencyVsVTXZ = dict(ptMin=0.05),
407 doRecoTrackPlots =
False,
408 doResolutionPlotsForLabels = [
"disabled"],
412 trackingParticlesEtaGreater2p7 = _trackingParticleRefSelector.clone(
413 signalOnly = cms.bool(
False),
418 invertRapidityCut = cms.bool(
True),
424 generalTracksEtaGreater2p7 = cutsRecoTracks_cfi.cutsRecoTracks.clone(
425 minRapidity = cms.double(-2.7),
426 maxRapidity = cms.double( 2.7),
427 invertRapidityCut = cms.bool(
True)
431 args=[[
"_generalTracksHp"]],
432 plainArgs=[
"EtaGreater2p7",
"generalTracksEtaGreater2p7"],
433 names=
"_selectorsEtaGreater2p7", task=
"_tracksValidationSelectorsEtaGreater2p7",
434 modifyTask=
lambda task: task.add(generalTracksEtaGreater2p7))
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,
445 minRapidityTP = -2.7,
447 invertRapidityCutTP =
True,
449 histoProducerAlgoBlock = dict(
450 TpSelectorForEfficiencyVsPt = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
451 TpSelectorForEfficiencyVsEta = dict(ptMin=0.005,minRapidity=-2.7,maxRapidity=2.7,invertRapidityCut=
True),
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),
462 doRecoTrackPlots =
True,
463 doResolutionPlotsForLabels = [
"disabled"]
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]
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"],
485 for _eraName, _postfix, _era
in _relevantEras:
486 _setForEra(trackValidatorFromPV, _eraName, _era,
487 label = [
"generalTracksFromPV"] + locals()[
"_selectorsFromPV"+_postfix] + [
"generalTracksFromPVPt09"] + locals()[
"_selectorsFromPVPt09"+_postfix],
488 doResolutionPlotsForLabels = []
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,
500 doSimTrackPlots =
False,
501 doResolutionPlotsForLabels = [
"disabled"],
505 trackValidatorAllTPEffic = trackValidator.clone(
506 dirName =
"Tracking/TrackAllTPEffic/",
507 label = [x
for x
in trackValidator.label.value()
if "Pt09" not in x],
509 doRecoTrackPlots =
True,
510 doPVAssociationPlots =
False,
511 doResolutionPlotsForLabels = [
"disabled"],
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]])
523 tpClusterProducerPreSplitting = tpClusterProducer.clone(pixelClusterSrc =
"siPixelClustersPreSplitting")
524 quickTrackAssociatorByHitsPreSplitting = quickTrackAssociatorByHits.clone(cluster2TPSrc =
"tpClusterProducerPreSplitting")
525 _trackValidatorSeedingBuilding = trackValidator.clone(
526 associators = [
"quickTrackAssociatorByHits"],
527 UseAssociators =
True,
529 doPVAssociationPlots =
False,
531 doResolutionPlotsForLabels = [
"disabled"],
533 trackValidatorBuilding = _trackValidatorSeedingBuilding.clone(
534 dirName =
"Tracking/TrackBuilding/",
536 doResolutionPlotsForLabels = [
'jetCoreRegionalStepTracks'],
538 trackValidatorBuildingPreSplitting = trackValidatorBuilding.clone(
539 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
541 doSummaryPlots =
False,
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])
552 trackValidatorConversion = trackValidator.clone(
553 dirName =
"Tracking/TrackConversion/",
556 "conversionStepTracks",
557 "ckfInOutTracksFromConversions",
558 "ckfOutInTracksFromConversions",
560 label_tp_effic =
"trackingParticlesConversion",
561 label_tp_effic_refvector =
True,
562 associators = [
"quickTrackAssociatorByHits"],
563 UseAssociators =
True,
566 doPVAssociationPlots =
False,
567 calculateDrSingleCollection =
False,
571 firstLayers = [layerSet.split(
"+")[0]
for layerSet
in layerList]
573 for l
in firstLayers:
578 if l.startswith(
"TEC"):
584 trackValidatorConversion.histoProducerAlgoBlock.seedingLayerSets =
_uniqueFirstLayers(_convLayerPairs.layerList.value())
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()
592 trackValidatorGsfTracks = trackValidatorConversion.clone(
593 dirName =
"Tracking/TrackGsf/",
594 label = [
"electronGsfTracks"],
595 label_tp_effic =
"trackingParticlesElectron",
598 for _eraName, _postfix, _era
in _relevantEras:
599 _setForEra(trackValidatorGsfTracks.histoProducerAlgoBlock, _eraName, _era, seedingLayerSets=trackValidator.histoProducerAlgoBlock.seedingLayerSets.value()+locals()[
"_seedingLayerSetsForElectrons"+_postfix])
602 trackValidatorJetCore = trackValidator.clone(
603 dirName =
"Tracking/JetCore/",
604 useLogPt = cms.untracked.bool(
True),
606 associators= [
"trackAssociatorByChi2"],
607 UseAssociators =
True,
608 doPVAssociationPlots =
True,
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"],
622 trackValidatorBHadron = trackValidator.clone(
623 dirName =
"Tracking/TrackBHadron/",
624 label_tp_effic =
"trackingParticlesBHadron",
625 label_tp_effic_refvector =
True,
627 doRecoTrackPlots =
False,
630 for _eraName, _postfix, _era
in _relevantEras:
631 _setForEra(trackValidatorBHadron, _eraName, _era,
632 label = [
"generalTracks", locals()[
"_generalTracksHp"+_postfix],
"cutsRecoTracksBtvLike"]
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)],
642 invertRapidityCutTP =
False,
643 histoProducerAlgoBlock = dict(
644 TpSelectorForEfficiencyVsPt = dict(ptMin=0.005, signalOnly=
True, tip=1e5, lip=1e5),
645 TpSelectorForEfficiencyVsEta = dict(ptMin=0.005, signalOnly=
True, tip=1e5, lip=1e5),
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),
663 tracksValidationSelectors = cms.Task(
664 tracksValidationSelectorsByAlgo,
665 tracksValidationSelectorsByAlgoHp,
666 tracksValidationSelectorsByOriginalAlgo,
667 cutsRecoTracksBtvLike,
668 ak4JetTracksAssociatorExplicitAll,
669 cutsRecoTracksAK4PFJets
671 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(generalTracksEtaGreater2p7))
672 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(cutsRecoTracksEtaGreater2p7Hp))
677 names=
"_selectorsByAlgo", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgo"
683 names=
"_selectorsByAlgoHp", task=
"_tracksEtaGreater2p7ValidationSelectorsByAlgoHp"
686 for _eraName, _postfix, _era
in _relevantEras:
687 selectors = locals()[
"_selectorsByAlgoHp"+_postfix]
688 locals()[
"_generalTracksHp"+_postfix] = selectors[0]
689 locals()[
"_selectorsByAlgoHp"+_postfix] = selectors[1:]
691 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgo))
692 phase2_tracker.toModify(tracksValidationSelectors,
lambda x: x.add(tracksEtaGreater2p7ValidationSelectorsByAlgoHp))
694 tracksValidationTruth = cms.Task(
696 tpClusterProducerPreSplitting,
697 trackAssociatorByChi2,
698 quickTrackAssociatorByHits,
699 quickTrackAssociatorByHitsPreSplitting,
700 trackingParticleRecoTrackAsssociation,
701 VertexAssociatorByPositionAndTracks,
702 trackingParticleNumberOfLayersProducer
704 fastSim.toModify(tracksValidationTruth,
lambda x: x.remove(tpClusterProducer))
706 tracksPreValidation = cms.Task(
708 tracksValidationSelectors,
709 tracksValidationSelectorsPt09,
710 tracksValidationSelectorsFromPV,
711 tracksValidationSelectorsFromPVPt09,
712 tracksValidationTruth,
713 trackingParticlesSignal,
714 trackingParticlesElectron,
715 trackingParticlesConversion
717 fastSim.toReplaceWith(tracksPreValidation, tracksPreValidation.copyAndExclude([
718 trackingParticlesElectron,
719 trackingParticlesConversion,
724 tracksValidation = cms.Sequence(
726 trackValidatorTPPtLess09 +
727 trackValidatorFromPV +
728 trackValidatorFromPVAllTP +
729 trackValidatorAllTPEffic +
730 trackValidatorBuilding +
731 trackValidatorBuildingPreSplitting +
732 trackValidatorConversion +
733 trackValidatorGsfTracks,
737 from Configuration.ProcessModifiers.seedingDeepCore_cff
import seedingDeepCore
738 seedingDeepCore.toReplaceWith(tracksValidation, cms.Sequence(tracksValidation.copy()+trackValidatorJetCore))
740 from Configuration.ProcessModifiers.displacedTrackValidation_cff
import displacedTrackValidation
741 displacedTrackValidation.toReplaceWith(tracksValidation, cms.Sequence(tracksValidation.copy()+trackValidatorDisplaced))
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)
748 tracksValidationPhase2 = tracksValidation.copyAndExclude([
749 trackValidatorJetCore
751 tracksValidationPhase2+=trackValidatorTPEtaGreater2p7
752 phase2_tracker.toReplaceWith(tracksValidation, tracksValidationPhase2)
754 fastSim.toReplaceWith(tracksValidation, tracksValidation.copyAndExclude([
755 trackValidatorBuildingPreSplitting,
756 trackValidatorConversion,
757 trackValidatorGsfTracks,
764 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"ByAlgoMask",
"algorithmMaskContains"],
765 names =
"_selectorsByAlgoMask", task =
"_tracksValidationSelectorsByAlgoMaskStandalone")
770 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"Pt09",
"generalTracksPt09"],
771 names =
"_selectorsPt09Standalone", task =
"_tracksValidationSelectorsPt09Standalone")
776 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPV",
"generalTracksFromPV"],
777 names =
"_selectorsFromPVStandalone", task =
"_tracksValidationSelectorsFromPVStandalone")
782 args = [
"_selectorsByAlgoAndHpNoGenTk"], plainArgs = [
"FromPVPt09",
"generalTracksFromPVPt09"],
783 names =
"_selectorsFromPVPt09Standalone", task =
"_tracksValidationSelectorsFromPVPt09Standalone")
786 trackValidatorStandalone = trackValidator.clone(
789 trackValidatorTPPtLess09Standalone = trackValidatorTPPtLess09.clone(
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])
796 trackValidatorFromPVStandalone = trackValidatorFromPV.clone(
799 for _eraName, _postfix, _era
in _relevantEras:
800 _setForEra(trackValidatorFromPVStandalone, _eraName, _era, label = trackValidatorFromPV.label + locals()[
"_selectorsFromPVStandalone"+_postfix] + locals()[
"_selectorsFromPVPt09Standalone"+_postfix])
803 trackValidatorFromPVAllTPStandalone = trackValidatorFromPVAllTP.clone(
804 label = trackValidatorFromPVStandalone.label.value(),
808 trackValidatorAllTPEfficStandalone = trackValidatorAllTPEffic.clone(
809 label = [ x
for x
in trackValidator.label.value()
if x
not in [
"cutsRecoTracksBtvLike",
"cutsRecoTracksAK4PFJets"]
and "Pt09" not in x],
813 trackValidatorConversionStandalone = trackValidatorConversion.clone(
814 label = [x
for x
in trackValidatorConversion.label
if x !=
"convStepTracks"],
818 trackValidatorBHadronStandalone = trackValidatorBHadron.clone(
819 label = [x
for x
in trackValidatorStandalone.label
if "Pt09" not in x],
823 trackValidatorGsfTracksStandalone = trackValidatorGsfTracks.clone(
828 tracksPreValidationStandalone = tracksPreValidation.copy()
829 tracksPreValidationStandalone.add(trackingParticlesBHadron)
830 tracksPreValidationStandalone.replace(highPtJetsForTrk,highPtJets)
831 fastSim.toReplaceWith(tracksPreValidationStandalone, tracksPreValidation)
833 tracksValidationSelectorsStandalone = cms.Task(
834 tracksValidationSelectorsByAlgoMaskStandalone,
835 tracksValidationSelectorsPt09Standalone,
836 tracksValidationSelectorsFromPVStandalone,
837 tracksValidationSelectorsFromPVPt09Standalone
842 _trackValidatorsBase = cms.Sequence(
843 trackValidatorStandalone +
844 trackValidatorTPPtLess09Standalone +
845 trackValidatorFromPVStandalone +
846 trackValidatorFromPVAllTPStandalone +
847 trackValidatorAllTPEfficStandalone +
848 trackValidatorConversionStandalone +
849 trackValidatorGsfTracksStandalone +
850 trackValidatorBHadronStandalone
853 _trackValidatorsBasePhase2 = _trackValidatorsBase.copy()
854 _trackValidatorsBasePhase2+=trackValidatorTPEtaGreater2p7
855 phase2_tracker.toReplaceWith(_trackValidatorsBase, _trackValidatorsBasePhase2)
857 trackValidatorsStandalone = _trackValidatorsBase.copy()
858 fastSim.toModify(trackValidatorsStandalone,
lambda x: x.remove(trackValidatorConversionStandalone) )
860 tracksValidationStandalone = cms.Sequence(
861 ak4PFL1FastL2L3CorrectorChain +
862 trackValidatorsStandalone,
863 tracksPreValidationStandalone,
864 tracksValidationSelectorsStandalone
870 tracksValidationSelectorsTrackingOnly = tracksValidationSelectors.copyAndExclude([ak4JetTracksAssociatorExplicitAll,cutsRecoTracksAK4PFJets])
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)
876 trackValidatorTrackingOnly = trackValidatorStandalone.clone(
877 label = [ x
for x
in trackValidatorStandalone.label
if x !=
"cutsRecoTracksAK4PFJets"],
878 cores =
"highPtJetsForTrk"
881 trackValidatorSeedingTrackingOnly = _trackValidatorSeedingBuilding.clone(
882 dirName =
"Tracking/TrackSeeding/",
883 label = _seedSelectors,
885 doResolutionPlotsForLabels = [
"seedTracksjetCoreRegionalStepSeeds",]
887 trackValidatorSeedingPreSplittingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
888 associators = [
"quickTrackAssociatorByHitsPreSplitting"],
889 label = _seedSelectorsPreSplitting,
890 doSummaryPlots =
False,
894 trackValidatorJetCoreSeedingTrackingOnly = trackValidatorSeedingTrackingOnly.clone(
895 dirName =
"Tracking/JetCore/TrackSeeding/",
896 associators = [
"trackAssociatorByChi2"],
897 UseAssociators =
True,
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",]
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])
914 trackValidatorConversionTrackingOnly = trackValidatorConversion.clone(label = [x
for x
in trackValidatorConversion.label
if x
not in [
"ckfInOutTracksFromConversions",
"ckfOutInTracksFromConversions"]])
916 trackValidatorBHadronTrackingOnly = trackValidatorBHadron.clone(label = [x
for x
in trackValidatorTrackingOnly.label
if "Pt09" not in x])
918 trackValidatorTPPtLess09TrackingOnly = trackValidatorTPPtLess09Standalone.clone(cores =
"highPtJetsForTrk")
919 trackValidatorFromPVTrackingOnly = trackValidatorFromPVStandalone.clone(cores =
"highPtJetsForTrk")
920 trackValidatorFromPVAllTPTrackingOnly = trackValidatorFromPVAllTPStandalone.clone(cores =
"highPtJetsForTrk")
921 trackValidatorAllTPEfficTrackingOnly = trackValidatorAllTPEfficStandalone.clone(cores =
"highPtJetsForTrk")
923 tracksPreValidationTrackingOnly = tracksPreValidationStandalone.copy()
924 tracksPreValidationTrackingOnly.replace(tracksValidationSelectors, tracksValidationSelectorsTrackingOnly)
925 tracksPreValidationTrackingOnly.replace(highPtJets,highPtJetsForTrk)
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)
941 seedingDeepCore.toReplaceWith(trackValidatorsTrackingOnly, cms.Sequence(
942 trackValidatorsTrackingOnly.copy()+
943 trackValidatorJetCore+
944 trackValidatorJetCoreSeedingTrackingOnly
947 phase2_tracker.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
948 trackValidatorJetCore,
949 trackValidatorJetCoreSeedingTrackingOnly
952 displacedTrackValidation.toReplaceWith(trackValidatorsTrackingOnly, cms.Sequence(trackValidatorsTrackingOnly.copy()+trackValidatorDisplaced))
954 fastSim.toReplaceWith(trackValidatorsTrackingOnly, trackValidatorsTrackingOnly.copyAndExclude([
955 trackValidatorBuildingPreSplitting,
956 trackValidatorSeedingPreSplittingTrackingOnly,
957 trackValidatorConversionTrackingOnly,
958 trackValidatorBHadronTrackingOnly
960 tracksValidationTrackingOnly = cms.Sequence(
961 trackValidatorsTrackingOnly,
962 tracksPreValidationTrackingOnly,
963 tracksValidationSelectorsStandalone,
964 tracksValidationSeedSelectorsTrackingOnly
969 trackingParticlePixelTrackAsssociation = trackingParticleRecoTrackAsssociation.clone(
970 label_tr =
"pixelTracks",
971 associator =
"quickTrackAssociatorByHitsPreSplitting",
973 PixelVertexAssociatorByPositionAndTracks = VertexAssociatorByPositionAndTracks.clone(
974 trackAssociation =
"trackingParticlePixelTrackAsssociation"
977 _pixelTracksCustom = dict(
979 vertexTag =
"pixelVertices",
981 pixelTracksPt09 = generalTracksPt09.clone(quality = [
"undefQuality"], **_pixelTracksCustom)
982 pixelTracksFromPV = generalTracksFromPV.clone(quality =
"undefQuality", **_pixelTracksCustom)
983 pixelTracksFromPVPt09 = pixelTracksPt09.clone(src =
"pixelTracksFromPV")
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",
994 cores = cms.InputTag(
""),
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"],
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,
1015 doSimTrackPlots =
False,
1017 trackValidatorBHadronPixelTrackingOnly = trackValidatorPixelTrackingOnly.clone(
1018 dirName =
"Tracking/PixelTrackBHadron/",
1019 label_tp_effic =
"trackingParticlesBHadron",
1020 label_tp_effic_refvector =
True,
1022 doRecoTrackPlots =
False,
1023 dodEdxPlots =
False,
1026 tracksValidationTruthPixelTrackingOnly = tracksValidationTruth.copy()
1027 tracksValidationTruthPixelTrackingOnly.replace(trackingParticleRecoTrackAsssociation, trackingParticlePixelTrackAsssociation)
1028 tracksValidationTruthPixelTrackingOnly.replace(VertexAssociatorByPositionAndTracks, PixelVertexAssociatorByPositionAndTracks)
1029 tracksValidationTruthPixelTrackingOnly.add(trackingParticlesBHadron)
1031 tracksPreValidationPixelTrackingOnly = cms.Task(
1032 tracksValidationTruthPixelTrackingOnly,
1033 trackingParticlesSignal,
1036 pixelTracksFromPVPt09,
1038 tracksValidationPixelTrackingOnly = cms.Sequence(
1039 trackValidatorPixelTrackingOnly +
1040 trackValidatorFromPVPixelTrackingOnly +
1041 trackValidatorFromPVAllTPPixelTrackingOnly +
1042 trackValidatorBHadronPixelTrackingOnly,
1043 tracksPreValidationPixelTrackingOnly
1048 trackValidatorLite = trackValidator.clone(
1049 label = [
"generalTracks",
"cutsRecoTracksHp"]
1051 tracksValidationLite = cms.Sequence(
1054 tracksValidationTruth
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') )